* Center for Telecommunications Research
* Columbia University, New York City
*
- * $Id: pw_yp.c,v 1.4 1996/03/04 15:34:43 wpaul Exp $
+ * $Id: pw_yp.c,v 1.9 1997/02/22 19:54:26 peter Exp $
*/
#ifdef YP
int force_old = 0;
int _use_yp = 0;
int suser_override = 0;
+int yp_in_pw_file = 0;
char *yp_domain = NULL;
char *yp_server = NULL;
bzero((char *)buf, sizeof(buf));
if ((clnt = clnt_create(server, YPPROG,YPVERS,"udp")) == NULL) {
- warnx("%s", clnt_spcreateerror("failed to create handle"));
+ warnx("failed to create UDP handle: %s",
+ clnt_spcreateerror(server));
pw_error(tempname, 0, 1);
}
bf[0] = _PW_KEYYPENABLED;
key.data = (u_char *)bf;
key.size = 1;
- if ((!(dbp->get)(dbp,&key,&data,0) && _yp_check(NULL)) ||
- (yp_domain && yp_server)) {
+ yp_in_pw_file = !(dbp->get)(dbp,&key,&data,0);
+ if (_yp_check(NULL) || (yp_domain && yp_server)) {
server = get_yp_master(0);
/* Is the user in the NIS passwd map */
return(USER_LOCAL_ONLY);
else if (!user_exists)
return(USER_UNKNOWN);
+
return(-1);
}
master_yppasswd.newpw.pw_gecos = strdup(pw->pw_gecos);
master_yppasswd.newpw.pw_dir = strdup(pw->pw_dir);
master_yppasswd.newpw.pw_shell = strdup(pw->pw_shell);
- master_yppasswd.newpw.pw_class = strdup(pw->pw_class);
+ master_yppasswd.newpw.pw_class = pw->pw_class != NULL ?
+ strdup(pw->pw_class) : "";
master_yppasswd.oldpass = ""; /* not really needed */
master_yppasswd.domain = yp_domain;
} else {
if ((clnt = clnt_create(master, YPPASSWDPROG,
YPPASSWDVERS, "udp")) == NULL) {
- warnx("failed to contact rpc.yppasswdd on %s: %s",
- master, clnt_spcreateerror(""));
+ warnx("failed to contact rpc.yppasswdd: %s",
+ master, clnt_spcreateerror(master));
pw_error(tempname, 0, 1);
}