=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/passwd/Attic/yp_passwd.c,v retrieving revision 1.24 retrieving revision 1.25 diff -c -r1.24 -r1.25 *** src/usr.bin/passwd/Attic/yp_passwd.c 2003/06/03 02:56:14 1.24 --- src/usr.bin/passwd/Attic/yp_passwd.c 2004/02/20 21:24:57 1.25 *************** *** 1,4 **** ! /* $OpenBSD: yp_passwd.c,v 1.24 2003/06/03 02:56:14 millert Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: yp_passwd.c,v 1.25 2004/02/20 21:24:57 maja Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. *************** *** 30,36 **** */ #ifndef lint /*static const char sccsid[] = "from: @(#)yp_passwd.c 1.0 2/2/93";*/ ! static const char rcsid[] = "$OpenBSD: yp_passwd.c,v 1.24 2003/06/03 02:56:14 millert Exp $"; #endif /* not lint */ #ifdef YP --- 30,36 ---- */ #ifndef lint /*static const char sccsid[] = "from: @(#)yp_passwd.c 1.0 2/2/93";*/ ! static const char rcsid[] = "$OpenBSD: yp_passwd.c,v 1.25 2004/02/20 21:24:57 maja Exp $"; #endif /* not lint */ #ifdef YP *************** *** 63,69 **** extern void kbintr(int); char *ypgetnewpasswd(struct passwd *, login_cap_t *, char **); ! struct passwd *ypgetpwnam(char *); char *domain; --- 63,69 ---- extern void kbintr(int); char *ypgetnewpasswd(struct passwd *, login_cap_t *, char **); ! struct passwd *ypgetpwnam(char *, int); char *domain; *************** *** 85,91 **** yp_passwd(char *username) { struct yppasswd yppasswd; ! int r, rpcport, status; struct passwd *pw; struct timeval tv; login_cap_t *lc; --- 85,91 ---- yp_passwd(char *username) { struct yppasswd yppasswd; ! int r, rpcport, status, secure=0; struct passwd *pw; struct timeval tv; login_cap_t *lc; *************** *** 106,112 **** * Find the host for the passwd map; it should be running * the daemon. */ ! if ((r = yp_master(domain, "passwd.byname", &master)) != 0) { warnx("can't find the master YP server. Reason: %s", yperr_string(r)); return (1); --- 106,114 ---- * Find the host for the passwd map; it should be running * the daemon. */ ! if ((r = yp_master(domain, "master.passwd.byname", &master)) == 0) { ! secure=1; ! } else if ((r = yp_master(domain, "passwd.byname", &master)) != 0) { warnx("can't find the master YP server. Reason: %s", yperr_string(r)); return (1); *************** *** 131,137 **** } /* Get user's login identity */ ! if (!(pw = ypgetpwnam(username))) { warnx("unknown user %s.", username); return (1); } --- 133,139 ---- } /* Get user's login identity */ ! if (!(pw = ypgetpwnam(username, secure))) { warnx("unknown user %s.", username); return (1); } *************** *** 257,263 **** } struct passwd * ! interpret(struct passwd *pwent, char *line) { char *p = line; --- 259,265 ---- } struct passwd * ! interpret(struct passwd *pwent, char *line, int secure) { char *p = line; *************** *** 283,288 **** --- 285,298 ---- p = pwskip(p); pwent->pw_gid = (gid_t)strtoul(p, NULL, 10); p = pwskip(p); + if ( secure == 1 ) { + pwent->pw_class = p; + p = pwskip(p); + pwent->pw_change = (time_t)strtoul(p, NULL, 10); + p = pwskip(p); + pwent->pw_expire = (time_t)strtoul(p, NULL, 10); + p = pwskip(p); + } pwent->pw_gecos = p; p = pwskip(p); pwent->pw_dir = p; *************** *** 297,310 **** static char *__yplin; struct passwd * ! ypgetpwnam(char *nam) { static struct passwd pwent; int reason, vallen; char *val; ! reason = yp_match(domain, "passwd.byname", nam, strlen(nam), ! &val, &vallen); switch (reason) { case 0: break; --- 307,321 ---- static char *__yplin; struct passwd * ! ypgetpwnam(char *nam, int secure) { static struct passwd pwent; int reason, vallen; char *val; ! reason = yp_match(domain, ! secure ? "master.passwd.byname" : "passwd.byname", ! nam, strlen(nam), &val, &vallen); switch (reason) { case 0: break; *************** *** 321,327 **** strlcpy(__yplin, val, vallen + 1); free(val); ! return (interpret(&pwent, __yplin)); } #endif /* YP */ --- 332,338 ---- strlcpy(__yplin, val, vallen + 1); free(val); ! return (interpret(&pwent, __yplin, secure)); } #endif /* YP */