]> git.pld-linux.org Git - packages/shadow.git/blob - shadow-pld.patch
- default users group: 1000 instead of 100
[packages/shadow.git] / shadow-pld.patch
1 diff -Naur shadow-19990827/src/groupadd.c shadow-19990827-patched/src/groupadd.c
2 --- shadow-19990827/src/groupadd.c      Mon Jun  7 18:40:45 1999
3 +++ shadow-19990827-patched/src/groupadd.c      Wed Apr 12 12:25:07 2000
4 @@ -72,6 +72,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 @@ -103,7 +105,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 @@ -228,9 +230,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 -
31 +       } else {
32 +       gid_min = MIN_GID;
33 +       gid_max = getdef_num("GID_MIN", 499);
34 +       }
35         /*
36          * Start with some GID value if the user didn't provide us with
37          * one already.
38 @@ -339,7 +345,7 @@
39         char *cp;
40         int arg;
41  
42 -       while ((arg = getopt(argc, argv, "og:O:f")) != EOF) {
43 +       while ((arg = getopt(argc, argv, "og:O:fr")) != EOF) {
44                 switch (arg) {
45                 case 'g':
46                         gflg++;
47 @@ -383,6 +389,12 @@
48                          * RedHat's patch from shadow-utils-970616-9.
49                          */
50                         fflg++;
51 +                       break;
52 +                       case 'r':
53 +                       /*
54 +                       * create system group
55 +                       */
56 +                       rflg++;
57                         break;
58                 default:
59                         usage();
60 diff -Naur shadow-19990827/src/useradd.c shadow-19990827-patched/src/useradd.c
61 --- shadow-19990827/src/useradd.c       Mon Jun  7 18:40:45 1999
62 +++ shadow-19990827-patched/src/useradd.c       Wed Apr 12 12:25:41 2000
63 @@ -72,10 +72,10 @@
64  /*
65   * These defaults are used if there is no defaults file.
66   */
67 -static gid_t def_group = 100;
68 +static gid_t def_group = 1000;
69  static const char *def_gname = "other";
70 -static const char *def_home = "/home";
71 -static const char *def_shell = "";
72 +static const char *def_home = "/home/users";
73 +static const char *def_shell = "/dev/null";
74  static const char *def_template = SKEL_DIR;
75  #ifdef SHADOWPWD
76  static long def_inactive = -1;
77 @@ -87,7 +87,7 @@
78  #define        VALID(s)        (strcspn (s, ":\n") == strlen (s))
79  
80  static const char *user_name = "";
81 -static const char *user_pass = "!";
82 +static const char *user_pass = "!!";
83  static uid_t user_id;
84  static gid_t user_gid;
85  static const char *user_comment = "";
86 @@ -115,10 +115,13 @@
87         sflg = 0, /* shell program for new account */
88         cflg = 0, /* comment (GECOS) field for new account */
89         mflg = 0, /* create user's home directory if it doesn't exist */
90 +       nflg = 0, /* no group for this user */
91         kflg = 0, /* specify a directory to fill new user directory */
92 +       Mflg = 0, /* don't crate user's home directory */
93         fflg = 0, /* days until account with expired password is locked */
94         eflg = 0, /* days since 1970-01-01 when account is locked */
95 -       Dflg = 0; /* set/show new user default values */
96 +       Dflg = 0, /* set/show new user default values */
97 +       rflg = 0; /* system account */
98  
99  #ifdef AUTH_METHODS
100  static int Aflg = 0; /* specify authentication method for user */
101 @@ -171,6 +174,7 @@
102   * exit status values
103   */
104  #define E_SUCCESS      0       /* success */
105 +#define E_LOCKING      1       /* locking error */
106  #define E_PW_UPDATE    1       /* can't update password file */
107  #define E_USAGE                2       /* bad command syntax */
108  #define E_BAD_ARG      3       /* invalid argument to option */
109 @@ -711,7 +715,7 @@
110  #ifdef AUTH_METHODS
111         fprintf(stderr, _("[-A program] "));
112  #endif
113 -       fprintf(stderr, _("[-p passwd] name\n"));
114 +       fprintf(stderr, _("[-p passwd] [-n] [-r] name\n"));
115  
116         fprintf(stderr, _("       %s\t-D [-g group] [-b base] [-s shell]\n"),
117                 Prog);
118 @@ -968,10 +972,13 @@
119  {
120         const struct passwd *pwd;
121         uid_t uid_min, uid_max;
122 -
123 -       uid_min = getdef_num("UID_MIN", 100);
124 +       if (!rflg) {
125 +       uid_min = getdef_num("UID_MIN", 500);
126         uid_max = getdef_num("UID_MAX", 60000);
127 -
128 +       } else {
129 +       uid_min = 1;
130 +       uid_max = 949;
131 +       }
132         /*
133          * Start with some UID value if the user didn't provide us with
134          * one already.
135 @@ -1126,9 +1133,9 @@
136         char *cp;
137  
138  #ifdef SHADOWPWD
139 -#define FLAGS "A:Du:og:G:d:s:c:mk:p:f:e:b:O:M"
140 +#define FLAGS "A:Du:og:G:d:s:c:mk:p:f:e:b:O:M:nr"
141  #else
142 -#define FLAGS "A:Du:og:G:d:s:c:mk:p:b:O:M"
143 +#define FLAGS "A:Du:og:G:d:s:c:mk:p:b:O:M:nr"
144  #endif
145         while ((arg = getopt(argc, argv, FLAGS)) != EOF) {
146  #undef FLAGS
147 @@ -1261,6 +1268,12 @@
148                 case 'o':
149                         oflg++;
150                         break;
151 +               case 'n':
152 +                       nflg++;
153 +                       break;
154 +               case 'r':
155 +                       rflg++;
156 +                       break;
157                 case 'O':
158                         /*
159                          * override login.defs defaults (-O name=value)
160 @@ -1312,9 +1325,10 @@
161          * Certain options are only valid in combination with others.
162          * Check it here so that they can be specified in any order.
163          */
164 -       if ((oflg && !uflg) || (kflg && !mflg))
165 +       if (kflg && !mflg)
166 +               usage();
167 +       if (mflg && Mflg)
168                 usage();
169 -
170         /*
171          * Either -D or username is required.  Defaults can be set with -D
172          * for the -b, -e, -f, -g, -s options only.
This page took 0.085562 seconds and 4 git commands to generate.