Don't use non-standard "u_<foo>" types.
Strip trailing whitespace (as well as ':'s) off PAM password prompts. Improve some debug logging related to PAM.
This commit is contained in:
parent
b3f49ac041
commit
ef70558f4f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cmds.c,v 1.25 2008/04/28 20:23:03 martin Exp $ */
|
||||
/* $NetBSD: cmds.c,v 1.26 2008/06/09 00:33:39 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
|
||||
|
@ -90,7 +90,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: cmds.c,v 1.25 2008/04/28 20:23:03 martin Exp $");
|
||||
__RCSID("$NetBSD: cmds.c,v 1.26 2008/06/09 00:33:39 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -879,7 +879,7 @@ discover_path(last_path, new_path)
|
|||
nomorelink = 1;
|
||||
|
||||
while ((cp = strstr(++cp, "/")) != NULL) {
|
||||
sz1 = (u_long)cp - (u_long)tp;
|
||||
sz1 = (unsigned long)cp - (unsigned long)tp;
|
||||
if (sz1 > MAXPATHLEN)
|
||||
goto bad;
|
||||
*cp = 0;
|
||||
|
@ -917,7 +917,8 @@ discover_path(last_path, new_path)
|
|||
} else {
|
||||
/* relative link */
|
||||
for (cq = cp - 1; *cq != '/'; cq--);
|
||||
if (strlen(tp) - ((u_long)cq - (u_long)cp)
|
||||
if (strlen(tp) -
|
||||
((unsigned long)cq - (unsigned long)cp)
|
||||
+ 1 + sz2 > MAXPATHLEN)
|
||||
goto bad;
|
||||
(void)memmove(cq + 1 + sz2,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: conf.c,v 1.60 2008/04/28 20:23:03 martin Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.61 2008/06/09 00:33:39 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: conf.c,v 1.60 2008/04/28 20:23:03 martin Exp $");
|
||||
__RCSID("$NetBSD: conf.c,v 1.61 2008/06/09 00:33:39 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -468,7 +468,7 @@ parse_conf(const char *findclass)
|
|||
REASSIGN(template, EMPTYSTR(arg) ? NULL : ftpd_strdup(arg));
|
||||
|
||||
} else if (strcasecmp(word, "umask") == 0) {
|
||||
u_long fumask;
|
||||
unsigned long fumask;
|
||||
|
||||
curclass.umask = DEFAULT_UMASK;
|
||||
if (none || EMPTYSTR(arg))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ftpd.c,v 1.184 2008/04/28 20:23:03 martin Exp $ */
|
||||
/* $NetBSD: ftpd.c,v 1.185 2008/06/09 00:33:39 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
|
||||
|
@ -98,7 +98,7 @@ __COPYRIGHT(
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: ftpd.c,v 1.184 2008/04/28 20:23:03 martin Exp $");
|
||||
__RCSID("$NetBSD: ftpd.c,v 1.185 2008/06/09 00:33:39 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -2502,11 +2502,11 @@ statcmd(void)
|
|||
{
|
||||
struct sockinet *su = NULL;
|
||||
static char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
||||
u_char *a, *p;
|
||||
unsigned char *a, *p;
|
||||
int ispassive, af;
|
||||
off_t otbi, otbo, otb;
|
||||
|
||||
a = p = (u_char *)NULL;
|
||||
a = p = (unsigned char *)NULL;
|
||||
|
||||
reply(-211, "%s FTP server status:", hostname);
|
||||
reply(0, "Version: %s", EMPTYSTR(version) ? "<suppressed>" : version);
|
||||
|
@ -2563,8 +2563,8 @@ statcmd(void)
|
|||
printaddr:
|
||||
/* PASV/PORT */
|
||||
if (su->su_family == AF_INET) {
|
||||
a = (u_char *) &su->su_addr;
|
||||
p = (u_char *) &su->su_port;
|
||||
a = (unsigned char *) &su->su_addr;
|
||||
p = (unsigned char *) &su->su_port;
|
||||
#define UC(b) (((int) b) & 0xff)
|
||||
reply(0, "%s (%d,%d,%d,%d,%d,%d)",
|
||||
ispassive ? "PASV" : "PORT" ,
|
||||
|
@ -2579,15 +2579,15 @@ statcmd(void)
|
|||
alen = 0;
|
||||
switch (su->su_family) {
|
||||
case AF_INET:
|
||||
a = (u_char *) &su->su_addr;
|
||||
p = (u_char *) &su->su_port;
|
||||
a = (unsigned char *) &su->su_addr;
|
||||
p = (unsigned char *) &su->su_port;
|
||||
alen = sizeof(su->su_addr);
|
||||
af = 4;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
a = (u_char *) &su->su_6addr;
|
||||
p = (u_char *) &su->su_port;
|
||||
a = (unsigned char *) &su->su_6addr;
|
||||
p = (unsigned char *) &su->su_port;
|
||||
alen = sizeof(su->su_6addr);
|
||||
af = 6;
|
||||
break;
|
||||
|
@ -3721,15 +3721,20 @@ auth_conv(int num_msg, const struct pam_message **msg,
|
|||
if (msg[i]->msg[0] == '\0') {
|
||||
(void)strlcpy(pbuf, "password", sizeof(pbuf));
|
||||
} else {
|
||||
/* Uncapitalize msg, remove trailing ':' */
|
||||
/* Uncapitalize msg */
|
||||
(void)strlcpy(pbuf, msg[i]->msg, sizeof(pbuf));
|
||||
n = strlen(pbuf);
|
||||
if (isupper((unsigned char)pbuf[0]))
|
||||
pbuf[0] = tolower(
|
||||
(unsigned char)pbuf[0]);
|
||||
n = strlen(pbuf) - 1;
|
||||
if (pbuf[n] == ':')
|
||||
pbuf[n] = '\0';
|
||||
/* Remove trailing ':' and whitespace */
|
||||
n = strlen(pbuf);
|
||||
while (n-- > 0) {
|
||||
if (isspace((unsigned char)pbuf[n]) ||
|
||||
pbuf[n] == ':')
|
||||
pbuf[n] = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Send reply, wait for a response. */
|
||||
reply(331, "User %s accepted, provide %s.",
|
||||
|
@ -3825,6 +3830,9 @@ auth_pam(void)
|
|||
}
|
||||
|
||||
e = pam_authenticate(pamh, 0);
|
||||
if (ftpd_debug)
|
||||
syslog(LOG_DEBUG, "pam_authenticate: user '%s' returned %d",
|
||||
curname, e);
|
||||
switch (e) {
|
||||
case PAM_SUCCESS:
|
||||
/*
|
||||
|
@ -3852,7 +3860,8 @@ auth_pam(void)
|
|||
pw = sgetpwnam(tmpl_user);
|
||||
if (ftpd_debug)
|
||||
syslog(LOG_DEBUG,
|
||||
"PAM changed user from %s to %s",
|
||||
"auth_pam: PAM changed "
|
||||
"user from '%s' to '%s'",
|
||||
curname, pw->pw_name);
|
||||
(void)strlcpy(curname, pw->pw_name,
|
||||
curname_len);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: popen.c,v 1.32 2008/04/28 20:23:03 martin Exp $ */
|
||||
/* $NetBSD: popen.c,v 1.33 2008/06/09 00:33:40 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
|
||||
|
@ -67,7 +67,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: popen.c,v 1.32 2008/04/28 20:23:03 martin Exp $");
|
||||
__RCSID("$NetBSD: popen.c,v 1.33 2008/06/09 00:33:40 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -120,7 +120,7 @@ ftpd_popen(char *argv[], const char *ptype, int stderrfd)
|
|||
if (!pids) {
|
||||
if ((fds = getdtablesize()) <= 0)
|
||||
return (NULL);
|
||||
if ((pids = (int *)malloc((u_int)(fds * sizeof(int)))) == NULL)
|
||||
if ((pids = (int *)malloc((unsigned int)(fds * sizeof(int)))) == NULL)
|
||||
return (NULL);
|
||||
memset(pids, 0, fds * sizeof(int));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: version.h,v 1.67 2008/04/28 20:23:03 martin Exp $ */
|
||||
/* $NetBSD: version.h,v 1.68 2008/06/09 00:33:40 lukem Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -29,5 +29,5 @@
|
|||
*/
|
||||
|
||||
#ifndef FTPD_VERSION
|
||||
#define FTPD_VERSION "NetBSD-ftpd 20080326"
|
||||
#define FTPD_VERSION "NetBSD-ftpd 20080609"
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue