summaryrefslogtreecommitdiff
path: root/packages/tinylogin/tinylogin-1.4/adduser-empty_pwd.patch
blob: 737ac423c4979381fd87bab398e9ea8292f9e674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--- tinylogin-1.4/adduser.c.orig	2004-09-30 18:01:46.000000000 +0200
+++ tinylogin-1.4/adduser.c	2004-09-30 18:07:01.000000000 +0200
@@ -249,6 +249,7 @@
 struct option long_options[] = {
   { "home",		1, NULL, 'h' },
   { "disabled-password", 0, NULL, 'D' },
+  { "empty-password", 0, NULL, 'E' },
   { "system",		0, NULL, 'S' },
   { "ingroup",		1, NULL, 'G' },
   { "no-create-home",   0, NULL, 'H' },
@@ -287,7 +288,7 @@
 	shell = default_shell;
 
 	/* get args */
-	while ((opt = getopt_long (argc, argv, "h:g:s:G:DSH", long_options, &option_index)) != -1) {
+	while ((opt = getopt_long (argc, argv, "h:g:s:G:DESH", long_options, &option_index)) != -1) {
 		switch (opt) {
 			case 'h':
 				home = optarg;
@@ -304,6 +305,9 @@
 			case 'D':
 				setpass = 0;
 				break;
+			case 'E':
+				setpass = -1;
+				break;
 			case 'S':
 				system = 1;
 				break;
@@ -338,7 +342,12 @@
 
 	/* create a passwd struct */
 	pw.pw_name = (char *)login;
-	pw.pw_passwd = (char *)default_passwd;
+	if (setpass != -1)
+		pw.pw_passwd = (char *)default_passwd;
+	else {
+		pw.pw_passwd = (char *)"";
+		setpass = 0;
+	}
 	pw.pw_uid = 0;
 	pw.pw_gid = 0;
 	pw.pw_gecos = (char *)gecos;