summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/tinylogin/tinylogin-1.4/add-system.patch
blob: 0a97974114a84fc55e480766e5c7114a018e7889 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Upstream-Status: Backport

? add-system.patch
? cvs-20040608.patch
? familiar
? pod2htmd.tmp
? pod2htmi.tmp
? system.diff
? tinylogin_1.4-20030620.1_arm.ipk
? tinylogin_1.4-20030620.1_arm.ipk.asc
? tinylogin_1.4-20030620.1_arm.ipk.upload.html
? tinylogin_1.4-20030620.2_arm.ipk
? tinylogin_1.4-20030620.2_arm.ipk.asc
? tinylogin_1.4-20030620.2_arm.ipk.upload.html
? tinylogin_1.4-20030620_arm.ipk
? tinylogin_1.4-20030620_arm.ipk.asc
? tinylogin_1.4-20030620_arm.ipk.upload.html
? tmp
Index: addgroup.c
===================================================================
RCS file: /var/cvs/tinylogin/addgroup.c,v
retrieving revision 1.23
diff -u -r1.23 addgroup.c
--- a/addgroup.c	9 Jan 2003 18:43:29 -0000	1.23
+++ b/addgroup.c	8 Jun 2004 08:56:08 -0000
@@ -31,6 +31,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <getopt.h>
 #include "tinylogin.h"
 
 #define GROUP_FILE      "/etc/group"
@@ -124,6 +125,11 @@
 	return 0;
 }
 
+static struct option long_options[] = {
+  { "system",		0, NULL, 'S' },
+  { 0,			0, 0, 0 }
+};
+
 /*
  * addgroup will take a login_name as its first parameter.
  *
@@ -136,14 +142,19 @@
 	int opt;
 	char *group;
 	char *user;
+	int option_index = -1;
 	gid_t gid = 0;
+	int system = 0;
 
 	/* get remaining args */
-	while ((opt = getopt (argc, argv, "g:")) != -1) {
+	while ((opt = getopt_long (argc, argv, "g:S", long_options, &option_index)) != -1) {
 		switch (opt) {
 			case 'g':
 				gid = strtol(optarg, NULL, 10);
 				break;
+			case 'S':
+				system = 1;
+				break;
 			default:
 				show_usage();
 				break;
Index: adduser.c
===================================================================
RCS file: /var/cvs/tinylogin/adduser.c,v
retrieving revision 1.38
diff -u -r1.38 adduser.c
--- a/adduser.c	21 Jun 2003 19:35:42 -0000	1.38
+++ b/adduser.c	8 Jun 2004 08:56:09 -0000
@@ -66,13 +66,13 @@
 
 /* remix */
 /* EDR recoded such that the uid may be passed in *p */
-static int passwd_study(const char *filename, struct passwd *p)
+static int passwd_study(const char *filename, struct passwd *p, int system)
 {
 	struct passwd *pw;
 	FILE *passwd;
 
-	const int min = 500;
-	const int max = 65000;
+	const int min = system ? 10 : 500;
+	const int max = system ? 99 : 65000;
 
 	passwd = wfopen(filename, "r");
 	if (!passwd)
@@ -142,7 +142,7 @@
 }
 
 /* putpwent(3) remix */
-static int adduser(const char *filename, struct passwd *p, int makehome, int setpass)
+static int adduser(const char *filename, struct passwd *p, int makehome, int setpass, int system)
 {
 	FILE *passwd;
 	int r;
@@ -165,7 +165,7 @@
 	fseek(passwd, 0, SEEK_END);
 
 	/* if (passwd_study(filename, p) == 0) { */
-	r = passwd_study(filename, p);
+	r = passwd_study(filename, p, system);
 	if (r) {
 		if (r == 1)
 			error_msg("%s: login already in use", p->pw_name);
@@ -357,7 +357,7 @@
 	}
 
 	/* grand finale */
-	return adduser(PASSWD_FILE, &pw, makehome, setpass);
+	return adduser(PASSWD_FILE, &pw, makehome, setpass, system);
 }
 
 /* $Id: adduser.c,v 1.38 2003/06/21 19:35:42 andersen Exp $ */