diff options
author | gildea <empty> | 1995-07-07 21:54:42 +0000 |
---|---|---|
committer | gildea <empty> | 1995-07-07 21:54:42 +0000 |
commit | 9f6e22e0c7e7ad2cb7e575323163bcbc6fde66ce (patch) | |
tree | d246a51393e9142fef8f88f756eef7c603d4d8f3 /xc | |
parent | 472b7fc77cc08c191dbcb310f214311250e02bc3 (diff) |
fall back to passwd file if shadow file doesn't have entry.
For Unixware 2.0, where passwd works with NIS but shadow doesn't.
Should really be using ia_* functions of libiaf (see ia_uinfo(3I)).
Diffstat (limited to 'xc')
-rw-r--r-- | xc/programs/xdm/greeter/verify.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/xc/programs/xdm/greeter/verify.c b/xc/programs/xdm/greeter/verify.c index 1dc6d5b60..f4c59b1f4 100644 --- a/xc/programs/xdm/greeter/verify.c +++ b/xc/programs/xdm/greeter/verify.c @@ -1,4 +1,4 @@ -/* $XConsortium: verify.c,v 1.33 94/09/21 20:49:08 converse Exp converse $ */ +/* $XConsortium: verify.c,v 1.34 94/10/07 19:41:36 converse Exp gildea $ */ /* Copyright (c) 1988 X Consortium @@ -42,6 +42,10 @@ from the X Consortium. # include <pwd.h> #ifdef USESHADOW # include <shadow.h> +# include <errno.h> +#ifdef X_NOT_STDC_ENV +extern int errno; +#endif #endif # include "greet.h" @@ -100,6 +104,7 @@ struct verify_info *verify; #ifdef USESHADOW struct spwd *sp; #endif + char *user_pass; #if !defined(SVR4) || !defined(GREET_LIB) /* shared lib decls handle this */ char *crypt (); char **systemEnv (), **parseArgs (); @@ -113,23 +118,23 @@ struct verify_info *verify; Debug ("getpwnam() failed.\n"); bzero(greet->password, strlen(greet->password)); return 0; + } else { + user_pass = p->pw_passwd; } #ifdef USESHADOW + errno = 0; sp = getspnam(greet->name); if (sp == NULL) { - Debug ("getspnam() failed. Are you root?\n"); - bzero(greet->password, strlen(greet->password)); - return 0; + Debug ("getspnam() failed, errno=%d. Are you root?\n", errno); + } else { + user_pass = sp->sp_pwdp; } endspent(); - - if (strcmp (crypt (greet->password, sp->sp_pwdp), sp->sp_pwdp)) -#else +#endif #if defined(ultrix) || defined(__ultrix__) if (authenticate_user(p, greet->password, NULL) < 0) #else - if (strcmp (crypt (greet->password, p->pw_passwd), p->pw_passwd)) -#endif + if (strcmp (crypt (greet->password, user_pass), user_pass)) #endif { Debug ("password verify failed\n"); @@ -137,7 +142,9 @@ struct verify_info *verify; return 0; } Debug ("verify succeeded\n"); -/* bzero(greet->password, strlen(greet->password)); */ + bzero(user_pass, strlen(user_pass)); /* in case shadow password */ + /* The password is passed to StartClient() for use by user-based + authorization schemes. It is zeroed there. */ verify->uid = p->pw_uid; verify->gid = p->pw_gid; home = p->pw_dir; |