1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
2000-05-29  Ulrich Drepper  <drepper@redhat.com>

	* inet/Makefile (CFLAGS-rcmd.c, CFLAGS-rexec.c, CFLAGS-ruserpass.c):
	Removed.
	* inet/rcmd.c: Remove __P.  Remove unused variables.
	(iruserfopen): Make first parameter const.
	(ruserok_sa): Return result of ruserok2_sa.
	(__checkhost_sa): Correctly iterate through results of getaddrinfo.
	* inet/rexec.c: Remove unused variables.  Other small cleanups.
	* inet/ruserpass.c: Remove __P.  Remove unused variables.
	(ruserpass): Check results of memory allocation.
	* include/netdb.h: Add prototype for ruserpass.
This commit is contained in:
Ulrich Drepper
2000-05-29 18:04:55 +00:00
parent 41b5aaf9c9
commit 3846463e07
5 changed files with 66 additions and 44 deletions

View File

@ -37,6 +37,7 @@ static char sccsid[] = "@(#)ruserpass.c 8.3 (Berkeley) 4/2/94";
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -45,7 +46,7 @@ static char sccsid[] = "@(#)ruserpass.c 8.3 (Berkeley) 4/2/94";
/* #include "ftp_var.h" */
static int token __P((void));
static int token (void);
static FILE *cfile;
#define DEFAULT 1
@ -93,11 +94,11 @@ static const struct toktab {
int
ruserpass(host, aname, apass)
char *host, **aname, **apass;
const char *host, **aname, **apass;
{
char *hdir, *buf, *tmp;
char myname[1024], *mydomain;
int t, i, c, usedefault = 0;
int t, usedefault = 0;
struct stat stb;
hdir = __secure_getenv("HOME");
@ -157,14 +158,21 @@ next:
while ((t = token()) && t != MACHINE && t != DEFAULT) switch(t) {
case LOGIN:
if (token())
if (token()) {
if (*aname == 0) {
*aname = malloc((unsigned) strlen(tokval) + 1);
(void) strcpy(*aname, tokval);
char *newp;
newp = malloc((unsigned) strlen(tokval) + 1);
if (newp == NULL)
{
warnx(_("out of memory"));
goto bad;
}
*aname = strcpy(newp, tokval);
} else {
if (strcmp(*aname, tokval))
goto next;
}
}
break;
case PASSWD:
if (strcmp(*aname, "anonymous") &&
@ -175,8 +183,14 @@ next:
goto bad;
}
if (token() && *apass == 0) {
*apass = malloc((unsigned) strlen(tokval) + 1);
(void) strcpy(*apass, tokval);
char *newp;
newp = malloc((unsigned) strlen(tokval) + 1);
if (newp == NULL)
{
warnx(_("out of memory"));
goto bad;
}
*apass = strcpy(newp, tokval);
}
break;
case ACCOUNT: