Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.bin/chpass Pullup 1.18 [phil]:



details:   https://anonhg.NetBSD.org/src/rev/70f386a6b635
branches:  netbsd-1-5
changeset: 490007:70f386a6b635
user:      tv <tv%NetBSD.org@localhost>
date:      Mon Oct 30 22:45:22 2000 +0000

description:
Pullup 1.18 [phil]:
getpwuid() and getpwnam() both support YP maps, insecure and secure.
Remove local ypgetpw{uid,nam} which don't support secure maps.
(Using chpass/chfn with secure maps and these local functions turns off
users by putting * in password entry.)

diffstat:

 usr.bin/chpass/pw_yp.c |  119 +------------------------------------------------
 1 files changed, 2 insertions(+), 117 deletions(-)

diffs (147 lines):

diff -r 4fa05424c4ee -r 70f386a6b635 usr.bin/chpass/pw_yp.c
--- a/usr.bin/chpass/pw_yp.c    Mon Oct 30 22:45:09 2000 +0000
+++ b/usr.bin/chpass/pw_yp.c    Mon Oct 30 22:45:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pw_yp.c,v 1.15.8.1 2000/10/18 01:32:41 tv Exp $        */
+/*     $NetBSD: pw_yp.c,v 1.15.8.2 2000/10/30 22:45:22 tv Exp $        */
 
 /*
  * Copyright (c) 1988 The Regents of the University of California.
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)pw_yp.c    1.0 2/2/93";
 #else
-__RCSID("$NetBSD: pw_yp.c,v 1.15.8.1 2000/10/18 01:32:41 tv Exp $");
+__RCSID("$NetBSD: pw_yp.c,v 1.15.8.2 2000/10/30 22:45:22 tv Exp $");
 #endif
 #endif /* not lint */
 
@@ -65,9 +65,6 @@
 
 static char *domain;
 
-static struct passwd *interpret __P((struct passwd *, char *));
-static char *pwskip __P((char *));
-
 /*
  * Check if rpc.yppasswdd is running on the master YP server.
  * XXX this duplicates some code, but is much less complex
@@ -199,118 +196,6 @@
        return (0);
 }
 
-static char *
-pwskip(p)
-       char *p;
-{
-       while (*p && *p != ':' && *p != '\n')
-               ++p;
-       if (*p)
-               *p++ = 0;
-       return (p);
-}
-
-static struct passwd *
-interpret(pwent, line)
-       struct passwd *pwent;
-       char *line;
-{
-       char    *p = line;
-
-       pwent->pw_passwd = "*";
-       pwent->pw_uid = 0;
-       pwent->pw_gid = 0;
-       pwent->pw_gecos = "";
-       pwent->pw_dir = "";
-       pwent->pw_shell = "";
-       pwent->pw_change = 0;
-       pwent->pw_expire = 0;
-       pwent->pw_class = "";
-       
-       /* line without colon separators is no good, so ignore it */
-       if(!strchr(p,':'))
-               return(NULL);
-
-       pwent->pw_name = p;
-       p = pwskip(p);
-       pwent->pw_passwd = p;
-       p = pwskip(p);
-       pwent->pw_uid = (uid_t)strtoul(p, NULL, 10);
-       p = pwskip(p);
-       pwent->pw_gid = (gid_t)strtoul(p, NULL, 10);
-       p = pwskip(p);
-       pwent->pw_gecos = p;
-       p = pwskip(p);
-       pwent->pw_dir = p;
-       p = pwskip(p);
-       pwent->pw_shell = p;
-       while (*p && *p != '\n')
-               p++;
-       *p = '\0';
-       return (pwent);
-}
-
-struct passwd *
-ypgetpwnam(nam)
-       const char *nam;
-{
-       static struct passwd pwent;
-       static char line[1024];
-       char *val;
-       int reason, vallen;
-       
-       /*
-        * Get local domain
-        */
-       if (!domain && (reason = yp_get_default_domain(&domain)))
-               errx(1, "can't get local YP domain. Reason: %s",
-                   yperr_string(reason));
-
-       val = NULL;
-       reason = yp_match(domain, "passwd.byname", nam, strlen(nam),
-           &val, &vallen);
-       if (reason != 0) {
-               if (val)
-                       free (val);
-               return (NULL);
-       }
-       val[vallen] = '\0';
-       (void)strncpy(line, val, sizeof(line) - 1);
-       free(val);
-
-       return(interpret(&pwent, line));
-}
-
-struct passwd *
-ypgetpwuid(uid)
-       uid_t uid;
-{
-       static struct passwd pwent;
-       static char line[1024];
-       char *val;
-       int reason, vallen;
-       char namebuf[16];
-       
-       if (!domain && (reason = yp_get_default_domain(&domain)))
-               errx(1, "can't get local YP domain. Reason: %s\n",
-                   yperr_string(reason));
-
-       (void)snprintf(namebuf, sizeof namebuf, "%d", uid);
-       val = NULL;
-       reason = yp_match(domain, "passwd.byuid", namebuf, strlen(namebuf),
-           &val, &vallen);
-       if (reason != 0) {
-               if (val)
-                       free (val);
-               return (NULL);
-       }
-       val[vallen] = '\0';
-       (void)strncpy(line, val, sizeof(line) - 1);
-       free(val);
-
-       return(interpret(&pwent, line));
-}
-
 void
 yppw_error(name, err, eval)
        const char *name;



Home | Main Index | Thread Index | Old Index