Commit 0e10468f authored by Leigh Stoller's avatar Leigh Stoller

Fix several bogus errors that was causing checkpass to bypass the gecos

tests completely.
parent 1b6e3b2b
......@@ -13,7 +13,7 @@ all: checkpass
#
SRCDIR += $(TESTBED_SRCDIR)/$(SUBDIR)/cracklib,2.7/cracklib
OBJECTS = fascist.o packlib.o rules.o stringlib.o
CFLAGS += -I$(TESTBED_SRCDIR)/$(SUBDIR)/cracklib,2.7/cracklib -DIN_CRACKLIB
CFLAGS += -g -I$(TESTBED_SRCDIR)/$(SUBDIR)/cracklib,2.7/cracklib -DIN_CRACKLIB
include $(TESTBED_SRCDIR)/GNUmakerules
......
......@@ -16,7 +16,7 @@ int main(int ARGC, char* ARGV[]) {
}
strcpy(passwd,ARGV[1]);
sprintf(gecos,"%s:%s",ARGV[1],ARGV[3]);
sprintf(gecos,"%s:%s",ARGV[2],ARGV[3]);
retval = (char *) FascistCheck(passwd,path,gecos);
......
......@@ -493,24 +493,22 @@ FascistGecos(password, uid, gecos)
int wc;
char *ptr;
int gwords;
struct passwd *pwp;
struct passwd *pwp, pw;
char gbuffer[STRINGSIZE];
char tbuffer[STRINGSIZE];
char *uwords[STRINGSIZE];
char longbuffer[STRINGSIZE * 2];
if (!(pwp = getpwuid(uid)))
{
/* OLD CODE
return ("you are not registered in the password file");
*/
if (gecos) {
if (uid && !(pwp = getpwuid(uid))) {
return ("you are not registered in the password file");
}
if (gecos) {
pwp = &pw;
pwp->pw_name = (char *)(strtok(gecos,":"));
pwp->pw_gecos = (char *)(strtok(NULL,":"));
} else {
} else {
return ("you are not registered in the password file");
}
}
}
/* lets get really paranoid and assume a dangerously long gecos entry */
......@@ -719,7 +717,7 @@ FascistLook(pwp, instring, gecos)
/* OLD CODE
if (ptr = FascistGecos(password, getuid()))
*/
if (ptr = FascistGecos(password, getuid(), gecos))
if (ptr = FascistGecos(password, 0, gecos))
{
return (ptr);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment