version 1.184, 2008/04/28 20:23:03 |
version 1.185, 2008/06/09 00:33:39 |
|
|
{ |
{ |
struct sockinet *su = NULL; |
struct sockinet *su = NULL; |
static char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; |
static char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; |
u_char *a, *p; |
unsigned char *a, *p; |
int ispassive, af; |
int ispassive, af; |
off_t otbi, otbo, otb; |
off_t otbi, otbo, otb; |
|
|
a = p = (u_char *)NULL; |
a = p = (unsigned char *)NULL; |
|
|
reply(-211, "%s FTP server status:", hostname); |
reply(-211, "%s FTP server status:", hostname); |
reply(0, "Version: %s", EMPTYSTR(version) ? "<suppressed>" : version); |
reply(0, "Version: %s", EMPTYSTR(version) ? "<suppressed>" : version); |
|
|
printaddr: |
printaddr: |
/* PASV/PORT */ |
/* PASV/PORT */ |
if (su->su_family == AF_INET) { |
if (su->su_family == AF_INET) { |
a = (u_char *) &su->su_addr; |
a = (unsigned char *) &su->su_addr; |
p = (u_char *) &su->su_port; |
p = (unsigned char *) &su->su_port; |
#define UC(b) (((int) b) & 0xff) |
#define UC(b) (((int) b) & 0xff) |
reply(0, "%s (%d,%d,%d,%d,%d,%d)", |
reply(0, "%s (%d,%d,%d,%d,%d,%d)", |
ispassive ? "PASV" : "PORT" , |
ispassive ? "PASV" : "PORT" , |
|
|
alen = 0; |
alen = 0; |
switch (su->su_family) { |
switch (su->su_family) { |
case AF_INET: |
case AF_INET: |
a = (u_char *) &su->su_addr; |
a = (unsigned char *) &su->su_addr; |
p = (u_char *) &su->su_port; |
p = (unsigned char *) &su->su_port; |
alen = sizeof(su->su_addr); |
alen = sizeof(su->su_addr); |
af = 4; |
af = 4; |
break; |
break; |
#ifdef INET6 |
#ifdef INET6 |
case AF_INET6: |
case AF_INET6: |
a = (u_char *) &su->su_6addr; |
a = (unsigned char *) &su->su_6addr; |
p = (u_char *) &su->su_port; |
p = (unsigned char *) &su->su_port; |
alen = sizeof(su->su_6addr); |
alen = sizeof(su->su_6addr); |
af = 6; |
af = 6; |
break; |
break; |
Line 3721 auth_conv(int num_msg, const struct pam_ |
|
Line 3721 auth_conv(int num_msg, const struct pam_ |
|
if (msg[i]->msg[0] == '\0') { |
if (msg[i]->msg[0] == '\0') { |
(void)strlcpy(pbuf, "password", sizeof(pbuf)); |
(void)strlcpy(pbuf, "password", sizeof(pbuf)); |
} else { |
} else { |
/* Uncapitalize msg, remove trailing ':' */ |
/* Uncapitalize msg */ |
(void)strlcpy(pbuf, msg[i]->msg, sizeof(pbuf)); |
(void)strlcpy(pbuf, msg[i]->msg, sizeof(pbuf)); |
n = strlen(pbuf); |
|
if (isupper((unsigned char)pbuf[0])) |
if (isupper((unsigned char)pbuf[0])) |
pbuf[0] = tolower( |
pbuf[0] = tolower( |
(unsigned char)pbuf[0]); |
(unsigned char)pbuf[0]); |
n = strlen(pbuf) - 1; |
/* Remove trailing ':' and whitespace */ |
if (pbuf[n] == ':') |
n = strlen(pbuf); |
pbuf[n] = '\0'; |
while (n-- > 0) { |
|
if (isspace((unsigned char)pbuf[n]) || |
|
pbuf[n] == ':') |
|
pbuf[n] = '\0'; |
|
else |
|
break; |
|
} |
} |
} |
/* Send reply, wait for a response. */ |
/* Send reply, wait for a response. */ |
reply(331, "User %s accepted, provide %s.", |
reply(331, "User %s accepted, provide %s.", |
|
|
} |
} |
|
|
e = pam_authenticate(pamh, 0); |
e = pam_authenticate(pamh, 0); |
|
if (ftpd_debug) |
|
syslog(LOG_DEBUG, "pam_authenticate: user '%s' returned %d", |
|
curname, e); |
switch (e) { |
switch (e) { |
case PAM_SUCCESS: |
case PAM_SUCCESS: |
/* |
/* |
|
|
pw = sgetpwnam(tmpl_user); |
pw = sgetpwnam(tmpl_user); |
if (ftpd_debug) |
if (ftpd_debug) |
syslog(LOG_DEBUG, |
syslog(LOG_DEBUG, |
"PAM changed user from %s to %s", |
"auth_pam: PAM changed " |
|
"user from '%s' to '%s'", |
curname, pw->pw_name); |
curname, pw->pw_name); |
(void)strlcpy(curname, pw->pw_name, |
(void)strlcpy(curname, pw->pw_name, |
curname_len); |
curname_len); |