[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] ftpd segfault
From: |
Simon Josefsson |
Subject: |
Re: [bug-inetutils] ftpd segfault |
Date: |
Tue, 17 Jan 2012 09:51:43 +0100 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.92 (gnu/linux) |
Michal Mazurek <address@hidden> writes:
> Run in the source dir:
> ./ftpd/ftpd -a default
>
> ftpd will segfault.
>
> OS is debian, linux 2.6.38-2-686.
>
> Please CC me when replying, I am not subscribed to this list.
Thank you for the report. The cause is that arg is NULL here:
case 'a':
if (strcasecmp (arg, "default") == 0)
cred.auth_type = AUTH_TYPE_PASSWD;
...
break;
You may work around this by specifying 'ftpd -adefault' or 'ftpd
--auth=default' as suggested by the --help output.
Some observations:
1) The -a parameter is defined to only optionally take an option:
{ "auth", 'a', "AUTH", OPTION_ARG_OPTIONAL,
"use AUTH for authentication",
GRID+1 },
What's the point of this?
2) The '-a' parameter seems to be used for other things by BSD ftpd:
-a Give anonymous an other login-name (anonymous and ftpd will still
work).
Do we have some parameter confusion here?
I believe the patch below should be applied. It will solve the crash.
Thoughts?
/Simon
diff --git a/ftpd/ftpd.c b/ftpd/ftpd.c
index 29e9eed..bc31558 100644
--- a/ftpd/ftpd.c
+++ b/ftpd/ftpd.c
@@ -283,7 +283,7 @@ static struct argp_option options[] = {
{ "umask", 'u', "VAL", 0,
"set default umask",
GRID+1 },
- { "auth", 'a', "AUTH", OPTION_ARG_OPTIONAL,
+ { "auth", 'a', "AUTH", 0,
"use AUTH for authentication",
GRID+1 },
{ NULL, 0, NULL, 0, "AUTH can be one of the following:", GRID+2 },