]> git.pld-linux.org Git - packages/shadow.git/blob - shadow-pld.patch
- useradd -r option is back
[packages/shadow.git] / shadow-pld.patch
1 diff -Nur shadow-4.0.0.orig/src/groupadd.c shadow-4.0.0/src/groupadd.c
2 --- shadow-4.0.0.orig/src/groupadd.c    Mon Oct  9 21:02:20 2000
3 +++ shadow-4.0.0/src/groupadd.c Thu Oct 18 10:41:15 2001
4 @@ -78,6 +78,8 @@
5  static int oflg = 0; /* permit non-unique group ID to be specified with -g */
6  static int gflg = 0; /* ID value for the new group */
7  static int fflg = 0; /* if group already exists, do nothing and exit(0) */
8 +static int rflg = 0; /* for adding system accounts */
9 +#define MIN_GID                10
10  
11  #ifdef NDBM
12  extern int     gr_dbm_mode;
13 @@ -108,7 +110,7 @@
14  static void
15  usage(void)
16  {
17 -       fprintf(stderr, _("usage: groupadd [-g gid [-o]] group\n"));
18 +       fprintf(stderr, _("usage: groupadd [-g gid [-o]] [-r] [-f] group\n"));
19         exit(E_USAGE);
20  }
21  
22 @@ -233,8 +235,13 @@
23         const struct group *grp;
24         gid_t gid_min, gid_max;
25  
26 -       gid_min = getdef_num("GID_MIN", 100);
27 +       if (!rflg) {
28 +       gid_min = getdef_num("GID_MIN", 500);
29         gid_max = getdef_num("GID_MAX", 60000);
30 +       } else {
31 +       gid_min = MIN_GID;
32 +       gid_max = getdef_num("GID_MIN", 499);
33 +       }
34  
35         /*
36          * Start with some GID value if the user didn't provide us with
37 @@ -344,7 +351,7 @@
38         char *cp;
39         int arg;
40  
41 -       while ((arg = getopt(argc, argv, "og:O:f")) != EOF) {
42 +       while ((arg = getopt(argc, argv, "og:O:fr")) != EOF) {
43                 switch (arg) {
44                 case 'g':
45                         gflg++;
46 @@ -389,6 +396,12 @@
47                          */
48                         fflg++;
49                         break;
50 +               case 'r':
51 +                       /*
52 +                        * create system group
53 +                        */
54 +                       rflg++;
55 +                       break;
56                 default:
57                         usage();
58                 }
59 diff -Nur shadow-4.0.0.orig/src/useradd.c shadow-4.0.0/src/useradd.c
60 --- shadow-4.0.0.orig/src/useradd.c     Fri Sep  7 17:12:54 2001
61 +++ shadow-4.0.0/src/useradd.c  Thu Oct 18 10:51:10 2001
62 @@ -78,10 +78,10 @@
63  /*
64   * These defaults are used if there is no defaults file.
65   */
66 -static gid_t def_group = 100;
67 +static gid_t def_group = 1000;
68  static const char *def_gname = "other";
69 -static const char *def_home = "/home";
70 -static const char *def_shell = "";
71 +static const char *def_home = "/home/users";
72 +static const char *def_shell = "/dev/null";
73  static const char *def_template = SKEL_DIR;
74  #ifdef SHADOWPWD
75  static long def_inactive = -1;
76 @@ -93,7 +93,7 @@
77  #define        VALID(s)        (strcspn (s, ":\n") == strlen (s))
78  
79  static const char *user_name = "";
80 -static const char *user_pass = "!";
81 +static const char *user_pass = "!!";
82  static uid_t user_id;
83  static gid_t user_gid;
84  static const char *user_comment = "";
85 @@ -122,10 +122,12 @@
86         sflg = 0, /* shell program for new account */
87         cflg = 0, /* comment (GECOS) field for new account */
88         mflg = 0, /* create user's home directory if it doesn't exist */
89 +       Mflg = 0, /* don't create user's home directory */
90         kflg = 0, /* specify a directory to fill new user directory */
91         fflg = 0, /* days until account with expired password is locked */
92         eflg = 0, /* days since 1970-01-01 when account is locked */
93         Dflg = 0, /* set/show new user default values */
94 +       rflg = 0, /* system account */
95         nflg = 0; /* create a group having the same name as the user */
96  
97  #ifdef AUTH_METHODS
98 @@ -179,6 +181,7 @@
99   * exit status values
100   */
101  #define E_SUCCESS      0       /* success */
102 +#define E_LOCKING      1       /* locking error */
103  #define E_PW_UPDATE    1       /* can't update password file */
104  #define E_USAGE                2       /* bad command syntax */
105  #define E_BAD_ARG      3       /* invalid argument to option */
106 @@ -728,7 +731,7 @@
107  #ifdef AUTH_METHODS
108         fprintf(stderr, _("[-A program] "));
109  #endif
110 -       fprintf(stderr, _("[-p passwd] name\n"));
111 +       fprintf(stderr, _("[-p passwd] [-n] [-r] name\n"));
112  
113         fprintf(stderr, _("       %s\t-D [-g group] [-b base] [-s shell]\n"),
114                 Prog);
115 @@ -985,9 +988,14 @@
116  {
117         const struct passwd *pwd;
118         uid_t uid_min, uid_max;
119 -
120 -       uid_min = getdef_num("UID_MIN", 100);
121 +       
122 +       if (!rflg) {
123 +       uid_min = getdef_num("UID_MIN", 500);
124         uid_max = getdef_num("UID_MAX", 60000);
125 +       } else {
126 +       uid_min = 1;
127 +       uid_max = 949;
128 +       }
129  
130         /*
131          * Start with some UID value if the user didn't provide us with
132 @@ -1143,9 +1151,9 @@
133         char *cp;
134  
135  #ifdef SHADOWPWD
136 -#define FLAGS "A:Du:og:G:d:s:c:mk:p:f:e:b:O:M"
137 +#define FLAGS "A:Du:og:G:d:s:c:mk:p:f:e:b:O:Mnr"
138  #else
139 -#define FLAGS "A:Du:og:G:d:s:c:mk:p:b:O:M"
140 +#define FLAGS "A:Du:og:G:d:s:c:mk:p:b:O:Mnr"
141  #endif
142         while ((arg = getopt(argc, argv, FLAGS)) != EOF) {
143  #undef FLAGS
144 @@ -1278,6 +1286,9 @@
145                 case 'o':
146                         oflg++;
147                         break;
148 +               case 'n':
149 +                       nflg++;
150 +                       break;
151                 case 'O':
152                         /*
153                          * override login.defs defaults (-O name=value)
154 @@ -1304,6 +1315,9 @@
155                         }
156                         user_pass = optarg;
157                         break;
158 +               case 'r':  /* system account */
159 +                       rflg++;
160 +                       break;
161                 case 's':
162                         if (!VALID(optarg) || (optarg[0] &&
163                             (optarg[0] != '/' && optarg[0] != '*'))) {
164 @@ -1329,7 +1343,9 @@
165          * Certain options are only valid in combination with others.
166          * Check it here so that they can be specified in any order.
167          */
168 -       if ((oflg && !uflg) || (kflg && !mflg))
169 +       if (kflg && !mflg)
170 +               usage();
171 +       if (mflg && Mflg)
172                 usage();
173  
174         /*
This page took 0.181826 seconds and 4 git commands to generate.