summaryrefslogtreecommitdiffstats
path: root/usr.bin/ftp/ruserpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ftp/ruserpass.c')
-rw-r--r--usr.bin/ftp/ruserpass.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/usr.bin/ftp/ruserpass.c b/usr.bin/ftp/ruserpass.c
index 35302a0..bc19f62 100644
--- a/usr.bin/ftp/ruserpass.c
+++ b/usr.bin/ftp/ruserpass.c
@@ -1,5 +1,5 @@
-/* $Id: ruserpass.c,v 1.5 1997/06/25 08:56:45 msmith Exp $ */
-/* $NetBSD: ruserpass.c,v 1.13 1997/04/01 14:20:34 mrg Exp $ */
+/* $Id$ */
+/* $NetBSD: ruserpass.c,v 1.14.2.1 1997/11/18 01:02:05 mellon Exp $ */
/*
* Copyright (c) 1985, 1993, 1994
@@ -34,11 +34,13 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95";
#else
-static char rcsid[] = "$Id: ruserpass.c,v 1.5 1997/06/25 08:56:45 msmith Exp $";
+__RCSID("$Id$");
+__RCSID_SOURCE("$NetBSD: ruserpass.c,v 1.14.2.1 1997/11/18 01:02:05 mellon Exp $");
#endif
#endif /* not lint */
@@ -148,10 +150,10 @@ next:
case LOGIN:
if (token())
- if (*aname == 0) {
- *aname = malloc((unsigned)
- strlen(tokval) + 1);
- (void)strcpy(*aname, tokval);
+ if (*aname == NULL) {
+ *aname = strdup(tokval);
+ if (*aname == NULL)
+ err(1, "can't strdup *aname");
} else {
if (strcmp(*aname, tokval))
goto next;
@@ -165,9 +167,10 @@ next:
warnx("Remove password or make file unreadable by others.");
goto bad;
}
- if (token() && *apass == 0) {
- *apass = malloc((unsigned) strlen(tokval) + 1);
- (void)strcpy(*apass, tokval);
+ if (token() && *apass == NULL) {
+ *apass = strdup(tokval);
+ if (*apass == NULL)
+ err(1, "can't strdup *apass");
}
break;
case ACCOUNT:
@@ -177,9 +180,10 @@ next:
warnx("Remove account or make file unreadable by others.");
goto bad;
}
- if (token() && *aacct == 0) {
- *aacct = malloc((unsigned) strlen(tokval) + 1);
- (void)strcpy(*aacct, tokval);
+ if (token() && *aacct == NULL) {
+ *aacct = strdup(tokval);
+ if (*aacct == NULL)
+ err(1, "can't strdup *aacct");
}
break;
case MACDEF:
@@ -202,7 +206,7 @@ next:
tmp = macros[macnum].mac_name;
*tmp++ = c;
for (i=0; i < 8 && (c=getc(cfile)) != EOF &&
- (!isascii(c) || !isspace(c)); ++i) {
+ (!isascii(c) || !isspace(c)); ++i) {
*tmp++ = c;
}
if (c == EOF) {
OpenPOWER on IntegriCloud