[BACK]Return to getpwent.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/gen/getpwent.c between version 1.14.4.2 and 1.15

version 1.14.4.2, 1996/09/19 20:03:04 version 1.15, 1996/12/20 20:16:05
Line 42  static char rcsid[] = "$NetBSD$";
Line 42  static char rcsid[] = "$NetBSD$";
 #endif  #endif
 #endif /* LIBC_SCCS and not lint */  #endif /* LIBC_SCCS and not lint */
   
 #include "namespace.h"  
 #include <sys/param.h>  #include <sys/param.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <db.h>  #include <db.h>
Line 63  static char rcsid[] = "$NetBSD$";
Line 62  static char rcsid[] = "$NetBSD$";
 #include <rpcsvc/ypclnt.h>  #include <rpcsvc/ypclnt.h>
 #endif  #endif
   
 #ifdef __weak_alias  
 __weak_alias(endpwent,_endpwent);  
 __weak_alias(getpwent,_getpwent);  
 __weak_alias(getpwnam,_getpwnam);  
 __weak_alias(getpwuid,_getpwuid);  
 __weak_alias(setpassent,_setpassent);  
 __weak_alias(setpwent,_setpwent);  
 #endif  
   
 static struct passwd _pw_passwd;        /* password structure */  static struct passwd _pw_passwd;        /* password structure */
 static DB *_pw_db;                      /* password database */  static DB *_pw_db;                      /* password database */
 static int _pw_keynum;                  /* key counter */  static int _pw_keynum;                  /* key counter */
Line 455  __has_yppw()
Line 445  __has_yppw()
         DBT key, data;          DBT key, data;
         DBT pkey, pdata;          DBT pkey, pdata;
         int len;          int len;
         char bf[UT_NAMESIZE];          char bf[MAXLOGNAME];
   
         key.data = (u_char *)__yp_token;          key.data = (u_char *)__yp_token;
         key.size = strlen(__yp_token);          key.size = strlen(__yp_token);
   
         /* Pre-token database support. */          /* Pre-token database support. */
         bf[0] = _PW_KEYBYNAME;          bf[0] = _PW_KEYBYNAME;
         len = strlen("+");          bf[1] = '+';
         bcopy("+", bf + 1, MIN(len, UT_NAMESIZE));  
         pkey.data = (u_char *)bf;          pkey.data = (u_char *)bf;
         pkey.size = len + 1;          pkey.size = 2;
   
         if ((_pw_db->get)(_pw_db, &key, &data, 0)          if ((_pw_db->get)(_pw_db, &key, &data, 0)
             && (_pw_db->get)(_pw_db, &pkey, &pdata, 0))              && (_pw_db->get)(_pw_db, &pkey, &pdata, 0))
Line 480  getpwnam(name)
Line 469  getpwnam(name)
 {  {
         DBT key;          DBT key;
         int len, rval;          int len, rval;
         char bf[UT_NAMESIZE + 1];          char bf[MAXLOGNAME + 1];
   
         if (!_pw_db && !__initdb())          if (!_pw_db && !__initdb())
                 return((struct passwd *)NULL);                  return((struct passwd *)NULL);
Line 644  pwnam_netgrp:
Line 633  pwnam_netgrp:
   
         bf[0] = _PW_KEYBYNAME;          bf[0] = _PW_KEYBYNAME;
         len = strlen(name);          len = strlen(name);
         bcopy(name, bf + 1, MIN(len, UT_NAMESIZE));          len = MIN(len, MAXLOGNAME);
           bcopy(name, bf + 1, len);
         key.data = (u_char *)bf;          key.data = (u_char *)bf;
         key.size = len + 1;          key.size = len + 1;
         rval = __hashpw(&key);          rval = __hashpw(&key);

Legend:
Removed from v.1.14.4.2  
changed lines
  Added in v.1.15

CVSweb <webmaster@jp.NetBSD.org>