Author: emaste
Date: Tue May  1 00:53:46 2018
New Revision: 333133
URL: https://svnweb.freebsd.org/changeset/base/333133

Log:
  pwd_mkdb: retire legacy v3 db support (-l option)
  
  pwd_mkdb has emitted v4 password database records since 2003 (r113596)
  in addition to v3, and as of r283981 by default it emitted only v4.
  As described in r283981, retire the -l legacy option.
  
  The -B and -L options were originally added to set the endianness of v3
  records emitted by pwd_mkdb, but they also set the db hash endiannes and
  so have been retained temporarily.
  
  Announced on the FreeBSD-Current and FreeBSD-Stable lists.  In stable/11
  the man page contains a deprecation notice, and pwd_mkdb will emit a
  deprecation notice if the -l option is specified.
  
  Reviewed by:  delphij, lidl, rgrimes
  Relnotes:     Yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D15144

Modified:
  head/usr.sbin/pwd_mkdb/pwd_mkdb.8
  head/usr.sbin/pwd_mkdb/pwd_mkdb.c

Modified: head/usr.sbin/pwd_mkdb/pwd_mkdb.8
==============================================================================
--- head/usr.sbin/pwd_mkdb/pwd_mkdb.8   Tue May  1 00:36:56 2018        
(r333132)
+++ head/usr.sbin/pwd_mkdb/pwd_mkdb.8   Tue May  1 00:53:46 2018        
(r333133)
@@ -28,7 +28,7 @@
 .\"    @(#)pwd_mkdb.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd April 22, 2018
+.Dd April 30, 2018
 .Dt PWD_MKDB 8
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Nd "generate the password databases"
 .Sh SYNOPSIS
 .Nm
-.Op Fl BCilLNp
+.Op Fl BCiLNp
 .Op Fl d Ar directory
 .Op Fl s Ar cachesize
 .Op Fl u Ar username
@@ -112,31 +112,8 @@ encrypted password and the insecure version has an ast
 The databases are used by the C library password routines (see
 .Xr getpwent 3 ) .
 .Pp
-By default,
-the
-.Nm
-utility generates new,
-machine independent format
-.Pq v4
-entries only.
-For compatibility with
-.Fx 5.0
-and earlier releases,
-the
-.Fl l
-option may be specified,
-which enables generation of legacy format
-.Pq v3
-entries.
-The legacy format entries are endianness dependent.
-The
-.Fl l
-option is deprecated and is not present in
-.Fx 12.0
-and later.
-.Pp
-The following options may be specified and will affect the
-generation of legacy entries.
+The following options affected the generation of legacy entries,
+and are now deprecated.
 .Bl -tag -width flag
 .It Fl B
 Store data in big-endian format.

Modified: head/usr.sbin/pwd_mkdb/pwd_mkdb.c
==============================================================================
--- head/usr.sbin/pwd_mkdb/pwd_mkdb.c   Tue May  1 00:36:56 2018        
(r333132)
+++ head/usr.sbin/pwd_mkdb/pwd_mkdb.c   Tue May  1 00:53:46 2018        
(r333133)
@@ -115,26 +115,25 @@ main(int argc, char *argv[])
        char sbuf2[MAXPATHLEN];
        char *username;
        u_int method, methoduid;
-       int Cflag, dflag, iflag, lflag;
+       int Cflag, dflag, iflag;
        int nblock = 0;
 
-       iflag = dflag = Cflag = lflag = 0;
+       iflag = dflag = Cflag = 0;
        strcpy(prefix, _PATH_PWD);
        makeold = 0;
        username = NULL;
        oldfp = NULL;
-       while ((ch = getopt(argc, argv, "BCLlNd:ips:u:v")) != -1)
+       while ((ch = getopt(argc, argv, "BCLNd:ips:u:v")) != -1)
                switch(ch) {
                case 'B':                       /* big-endian output */
+                       warnx("endiannes options (-B/-L) are deprecated");
                        openinfo.lorder = BIG_ENDIAN;
                        break;
                case 'C':                       /* verify only */
                        Cflag = 1;
                        break;
-               case 'l':                       /* generate legacy entries */
-                       lflag = 1;
-                       break;
                case 'L':                       /* little-endian output */
+                       warnx("endiannes options (-B/-L) are deprecated");
                        openinfo.lorder = LITTLE_ENDIAN;
                        break;
                case 'N':                       /* do not wait for lock */
@@ -166,8 +165,6 @@ main(int argc, char *argv[])
 
        if (argc != 1 || (username && (*username == '+' || *username == '-')))
                usage();
-       if (lflag)
-               warnx("legacy (v3) database format support is deprecated");
 
        /*
         * This could be changed to allow the user to interrupt.
@@ -472,98 +469,6 @@ main(int argc, char *argv[])
                                if ((sdp->put)(sdp, &key, &sdata, method) == -1)
                                        error("put");
                        }
-
-                       if (lflag) {
-                               /* Create insecure data. (legacy version) */
-                               p = buf;
-                               COMPACT(pwd.pw_name);
-                               COMPACT("*");
-                               LSCALAR(pwd.pw_uid);
-                               LSCALAR(pwd.pw_gid);
-                               LSCALAR(pwd.pw_change);
-                               COMPACT(pwd.pw_class);
-                               COMPACT(pwd.pw_gecos);
-                               COMPACT(pwd.pw_dir);
-                               COMPACT(pwd.pw_shell);
-                               LSCALAR(pwd.pw_expire);
-                               LSCALAR(pwd.pw_fields);
-                               data.size = p - buf;
-
-                               /* Create secure data. (legacy version) */
-                               p = sbuf;
-                               COMPACT(pwd.pw_name);
-                               COMPACT(pwd.pw_passwd);
-                               LSCALAR(pwd.pw_uid);
-                               LSCALAR(pwd.pw_gid);
-                               LSCALAR(pwd.pw_change);
-                               COMPACT(pwd.pw_class);
-                               COMPACT(pwd.pw_gecos);
-                               COMPACT(pwd.pw_dir);
-                               COMPACT(pwd.pw_shell);
-                               LSCALAR(pwd.pw_expire);
-                               LSCALAR(pwd.pw_fields);
-                               sdata.size = p - sbuf;
-
-                               /* Store insecure by name. */
-                               tbuf[0] = LEGACY_VERSION(_PW_KEYBYNAME);
-                               len = strlen(pwd.pw_name);
-                               memmove(tbuf + 1, pwd.pw_name, len);
-                               key.size = len + 1;
-                               if ((dp->put)(dp, &key, &data, method) == -1)
-                                       error("put");
-
-                               /* Store insecure by number. */
-                               tbuf[0] = LEGACY_VERSION(_PW_KEYBYNUM);
-                               store = HTOL(cnt);
-                               memmove(tbuf + 1, &store, sizeof(store));
-                               key.size = sizeof(store) + 1;
-                               if ((dp->put)(dp, &key, &data, method) == -1)
-                                       error("put");
-
-                               /* Store insecure by uid. */
-                               tbuf[0] = LEGACY_VERSION(_PW_KEYBYUID);
-                               store = HTOL(pwd.pw_uid);
-                               memmove(tbuf + 1, &store, sizeof(store));
-                               key.size = sizeof(store) + 1;
-                               if ((dp->put)(dp, &key, &data, methoduid) == -1)
-                                       error("put");
-
-                               /* Store secure by name. */
-                               tbuf[0] = LEGACY_VERSION(_PW_KEYBYNAME);
-                               len = strlen(pwd.pw_name);
-                               memmove(tbuf + 1, pwd.pw_name, len);
-                               key.size = len + 1;
-                               if ((sdp->put)(sdp, &key, &sdata, method) == -1)
-                                       error("put");
-
-                               /* Store secure by number. */
-                               tbuf[0] = LEGACY_VERSION(_PW_KEYBYNUM);
-                               store = HTOL(cnt);
-                               memmove(tbuf + 1, &store, sizeof(store));
-                               key.size = sizeof(store) + 1;
-                               if ((sdp->put)(sdp, &key, &sdata, method) == -1)
-                                       error("put");
-
-                               /* Store secure by uid. */
-                               tbuf[0] = LEGACY_VERSION(_PW_KEYBYUID);
-                               store = HTOL(pwd.pw_uid);
-                               memmove(tbuf + 1, &store, sizeof(store));
-                               key.size = sizeof(store) + 1;
-                               if ((sdp->put)(sdp, &key, &sdata, methoduid) == 
-1)
-                                       error("put");
-
-                               /* Store insecure and secure special plus and 
special minus */
-                               if (pwd.pw_name[0] == '+' || pwd.pw_name[0] == 
'-') {
-                                       tbuf[0] = 
LEGACY_VERSION(_PW_KEYYPBYNUM);
-                                       store = HTOL(ypcnt);
-                                       memmove(tbuf + 1, &store, 
sizeof(store));
-                                       key.size = sizeof(store) + 1;
-                                       if ((dp->put)(dp, &key, &data, method) 
== -1)
-                                               error("put");
-                                       if ((sdp->put)(sdp, &key, &sdata, 
method) == -1)
-                                               error("put");
-                               }
-                       }
                }
                /* Create original format password file entry */
                if (is_comment && makeold){     /* copy comments */
@@ -593,14 +498,6 @@ main(int argc, char *argv[])
                        error("put");
                if ((sdp->put)(sdp, &key, &data, method) == -1)
                        error("put");
-               if (lflag) {
-                       tbuf[0] = LEGACY_VERSION(_PW_KEYYPENABLED);
-                       key.size = 1;
-                       if ((dp->put)(dp, &key, &data, method) == -1)
-                               error("put");
-                       if ((sdp->put)(sdp, &key, &data, method) == -1)
-                               error("put");
-               }
        }
 
        if ((dp->close)(dp) == -1)
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to