1 |
vapier 08/02/24 12:00:38 |
2 |
|
3 |
Added: shadow-4.1.0-fix-useradd-usergroups.patch |
4 |
Log: |
5 |
Version bump. |
6 |
(Portage version: 2.2_pre2) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 sys-apps/shadow/files/shadow-4.1.0-fix-useradd-usergroups.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/shadow/files/shadow-4.1.0-fix-useradd-usergroups.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/shadow/files/shadow-4.1.0-fix-useradd-usergroups.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: shadow-4.1.0-fix-useradd-usergroups.patch |
15 |
=================================================================== |
16 |
http://bugs.gentoo.org/128715 |
17 |
|
18 |
exact implementation details are still in discussion upstream, but this fixes |
19 |
the behavior to not suck like current code |
20 |
|
21 |
--- src/useradd.c |
22 |
+++ src/useradd.c |
23 |
@@ -254,6 +254,12 @@ |
24 |
char *cp, *ep; |
25 |
|
26 |
/* |
27 |
+ * Pull relevant settings from login.defs first. |
28 |
+ */ |
29 |
+ if (getdef_bool ("USERGROUPS_ENAB")) |
30 |
+ nflg = -1; |
31 |
+ |
32 |
+ /* |
33 |
* Open the defaults file for reading. |
34 |
*/ |
35 |
|
36 |
@@ -632,6 +638,8 @@ |
37 |
" -K, --key KEY=VALUE overrides /etc/login.defs defaults\n" |
38 |
" -m, --create-home create home directory for the new user\n" |
39 |
" account\n" |
40 |
+ " -n, --user-group create a new group with the same name as the\n" |
41 |
+ " new user\n" |
42 |
" -o, --non-unique allow create user with duplicate\n" |
43 |
" (non-unique) UID\n" |
44 |
" -p, --password PASSWORD use encrypted password for the new user\n" |
45 |
@@ -1001,6 +1009,7 @@ |
46 |
{"skel", required_argument, NULL, 'k'}, |
47 |
{"key", required_argument, NULL, 'K'}, |
48 |
{"create-home", no_argument, NULL, 'm'}, |
49 |
+ {"user-group", no_argument, NULL, 'n'}, |
50 |
{"non-unique", no_argument, NULL, 'o'}, |
51 |
{"password", required_argument, NULL, 'p'}, |
52 |
{"shell", required_argument, NULL, 's'}, |
53 |
@@ -1008,7 +1017,7 @@ |
54 |
{NULL, 0, NULL, '\0'} |
55 |
}; |
56 |
while ((c = |
57 |
- getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMop:s:u:", |
58 |
+ getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:mMnop:s:u:", |
59 |
long_options, NULL)) != -1) { |
60 |
switch (c) { |
61 |
case 'b': |
62 |
@@ -1145,6 +1154,9 @@ |
63 |
case 'm': |
64 |
mflg++; |
65 |
break; |
66 |
+ case 'n': |
67 |
+ nflg = 1; |
68 |
+ break; |
69 |
case 'o': |
70 |
oflg++; |
71 |
break; |
72 |
@@ -1192,6 +1204,16 @@ |
73 |
usage (); |
74 |
|
75 |
/* |
76 |
+ * Using --gid and --user-group doesn't make sense. |
77 |
+ */ |
78 |
+ if (nflg == -1 && gflg) |
79 |
+ nflg = 0; |
80 |
+ if (nflg && gflg) { |
81 |
+ fprintf (stderr, _("%s: options -g and -n conflict\n"), Prog); |
82 |
+ exit (E_BAD_ARG); |
83 |
+ } |
84 |
+ |
85 |
+ /* |
86 |
* Either -D or username is required. Defaults can be set with -D |
87 |
* for the -b, -e, -f, -g, -s options only. |
88 |
*/ |
89 |
@@ -1728,7 +1750,7 @@ |
90 |
* to that group, use useradd -g username username. |
91 |
* --bero |
92 |
*/ |
93 |
- if (!gflg) { |
94 |
+ if (nflg) { |
95 |
if (getgrnam (user_name)) { /* local, no need for xgetgrnam */ |
96 |
fprintf (stderr, |
97 |
_ |
98 |
@@ -1762,7 +1784,7 @@ |
99 |
|
100 |
/* do we have to add a group for that user? This is why we need to |
101 |
* open the group files in the open_files() function --gafton */ |
102 |
- if (!(nflg || gflg)) { |
103 |
+ if (nflg) { |
104 |
find_new_gid (); |
105 |
grp_add (); |
106 |
} |
107 |
|
108 |
|
109 |
|
110 |
-- |
111 |
gentoo-commits@l.g.o mailing list |