aboutsummaryrefslogtreecommitdiffstats
path: root/package/busybox/patches/110-no_shadow.patch
blob: f0c61a0bdc7d2cb9f02a62f1c0cba24ff1f62981 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
--- busybox-1.3.1/include/libbb.h	Wed Dec 27 05:56:18 2006
+++ busybox-1.3.1.shadow/include/libbb.h	Sat Dec 30 15:24:07 2006
@@ -46,11 +46,13 @@
 #ifdef CONFIG_LOCALE_SUPPORT
 #include <locale.h>
 #else
-#define setlocale(x,y)
+#define setlocale(x,y) ((void)0)
 #endif
 
 #include "pwd_.h"
 #include "grp_.h"
+/* ifdef it out, because it may include <shadow.h> */
+/* and we may not even _have_ <shadow.h>! */
 #if ENABLE_FEATURE_SHADOWPASSWDS
 #include "shadow_.h"
 #endif
@@ -59,7 +61,7 @@
 #include <limits.h>
 #include <sys/param.h>
 #ifndef PATH_MAX
-#define  PATH_MAX         256
+#define PATH_MAX 256
 #endif
 
 /* Tested to work correctly (IIRC :]) */
--- busybox-1.3.1/libpwdgrp/pwd_grp.c	Wed Dec 27 05:56:32 2006
+++ busybox-1.3.1.shadow/libpwdgrp/pwd_grp.c	Sat Dec 30 15:24:07 2006
@@ -52,7 +52,9 @@
 
 extern int __parsepwent(void *pw, char *line);
 extern int __parsegrent(void *gr, char *line);
+#if ENABLE_USE_BB_SHADOW
 extern int __parsespent(void *sp, char *line);
+#endif
 
 extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data,
 		char *__restrict line_buff, size_t buflen, FILE *f);
@@ -103,6 +105,7 @@
 	return rv;
 }
 
+#if ENABLE_USE_BB_SHADOW
 int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
 				char *__restrict buffer, size_t buflen,
 				struct spwd **__restrict result)
@@ -117,6 +120,7 @@
 
 	return rv;
 }
+#endif
 
 /**********************************************************************/
 /* For the various fget??ent funcs, return NULL on failure and a
@@ -144,6 +148,7 @@
 	return result;
 }
 
+#if ENABLE_USE_BB_SHADOW
 extern int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
 				char *__restrict buffer, size_t buflen,
 				struct spwd **__restrict result);
@@ -184,6 +189,7 @@
  DONE:
 	return rv;
 }
+#endif
 
 /**********************************************************************/
 
@@ -207,6 +213,7 @@
 #define DO_GETXXKEY_R_PATHNAME  _PATH_GROUP
 #include "pwd_grp_internal.c"
 
+#if ENABLE_USE_BB_SHADOW
 #define GETXXKEY_R_FUNC			getspnam_R
 #define GETXXKEY_R_PARSER		__parsespent
 #define GETXXKEY_R_ENTTYPE		struct spwd
@@ -214,6 +221,7 @@
 #define DO_GETXXKEY_R_KEYTYPE	const char *__restrict
 #define DO_GETXXKEY_R_PATHNAME  _PATH_SHADOW
 #include "pwd_grp_internal.c"
+#endif
 
 #define GETXXKEY_R_FUNC			getpwuid_R
 #define GETXXKEY_R_PARSER		__parsepwent
@@ -253,6 +261,7 @@
 	return result;
 }
 
+#if 0 //ENABLE_USE_BB_SHADOW
 /* This function is non-standard and is currently not built.  It seems
  * to have been created as a reentrant version of the non-standard
  * functions getspuid.  Why getspuid was added, I do not know. */
@@ -286,6 +295,7 @@
 	getspuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result);
 	return result;
 }
+#endif
 
 struct passwd *getpwnam(const char *name)
 {
@@ -307,6 +317,7 @@
 	return result;
 }
 
+#if ENABLE_USE_BB_SHADOW
 struct spwd *getspnam(const char *name)
 {
 	static char buffer[PWD_BUFFER_SIZE];
@@ -316,6 +327,7 @@
 	getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result);
 	return result;
 }
+#endif
 
 int getpw(uid_t uid, char *buf)
 {
@@ -444,6 +456,7 @@
 	return rv;
 }
 
+#if ENABLE_USE_BB_SHADOW
 static FILE *spf /*= NULL*/;
 void setspent(void)
 {
@@ -488,6 +501,7 @@
 	UNLOCK;
 	return rv;
 }
+#endif
 
 struct passwd *getpwent(void)
 {
@@ -509,6 +523,7 @@
 	return result;
 }
 
+#if ENABLE_USE_BB_SHADOW
 struct spwd *getspent(void)
 {
 	static char line_buff[PWD_BUFFER_SIZE];
@@ -528,6 +543,7 @@
 	sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result);
 	return result;
 }
+#endif
 
 int initgroups(const char *user, gid_t gid)
 {
@@ -643,6 +659,7 @@
 	return rv;
 }
 
+#if ENABLE_USE_BB_SHADOW
 static const unsigned char _sp_off[] = {
 	offsetof(struct spwd, sp_lstchg),	/* 2 - not a char ptr */
 	offsetof(struct spwd, sp_min),		/* 3 - not a char ptr */
@@ -688,6 +705,7 @@
 DO_UNLOCK:
 	return rv;
 }
+#endif
 
 /**********************************************************************/
 /* Internal uClibc functions.					 */
@@ -846,6 +864,7 @@
 
 /**********************************************************************/
 
+#if ENABLE_USE_BB_SHADOW
 static const unsigned char sp_off[] = {
 	offsetof(struct spwd, sp_namp),		/* 0 */
 	offsetof(struct spwd, sp_pwdp),		/* 1 */
@@ -900,6 +919,7 @@
 
 	return EINVAL;
 }
+#endif
 
 /**********************************************************************/
 
--- busybox-1.3.1/loginutils/passwd.c	Wed Dec 27 05:56:20 2006
+++ busybox-1.3.1.shadow/loginutils/passwd.c	Sat Dec 30 15:24:07 2006
@@ -275,7 +275,8 @@
 	}
 
 	filename = bb_path_passwd_file;
-	if (ENABLE_FEATURE_SHADOWPASSWDS) {
+#if ENABLE_FEATURE_SHADOWPASSWDS
+	{
 		struct spwd *sp = getspnam(name);
 		if (!sp) {
 			/* LOGMODE_BOTH */
@@ -287,6 +288,7 @@
 			pw->pw_passwd = sp->sp_pwdp;
 		}
 	}
+#endif
 
 	/* Decide what the new password will be */
 	newp = NULL;
--- busybox-1.3.1/loginutils/sulogin.c	Wed Dec 27 05:56:20 2006
+++ busybox-1.3.1.shadow/loginutils/sulogin.c	Sat Dec 30 15:24:07 2006
@@ -41,7 +41,6 @@
 	char *timeout_arg;
 	const char * const *p;
 	struct passwd *pwd;
-	struct spwd *spwd;
 	const char *shell;
 
 	logmode = LOGMODE_BOTH;
@@ -75,13 +74,15 @@
 		goto auth_error;
 	}
 
-	if (ENABLE_FEATURE_SHADOWPASSWDS) {
-		spwd = getspnam(pwd->pw_name);
+#if ENABLE_FEATURE_SHADOWPASSWDS
+	{
+		struct spwd *spwd = getspnam(pwd->pw_name);
 		if (!spwd) {
 			goto auth_error;
 		}
 		pwd->pw_passwd = spwd->sp_pwdp;
 	}
+#endif
 
 	while (1) {
 		/* cp points to a static buffer that is zeroed every time */