aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applets/applets.c287
-rw-r--r--include/applets.h360
-rw-r--r--include/busybox.h12
-rw-r--r--include/libbb.h2
-rw-r--r--sysdeps/linux/config.in10
5 files changed, 491 insertions, 180 deletions
diff --git a/applets/applets.c b/applets/applets.c
index f3e56a9f3..2ab44059a 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -25,6 +25,7 @@
25 * 25 *
26 */ 26 */
27 27
28#include <unistd.h>
28#include <stdio.h> 29#include <stdio.h>
29#include <stdlib.h> 30#include <stdlib.h>
30#include <string.h> 31#include <string.h>
@@ -40,6 +41,42 @@ struct BB_applet *applet_using;
40/* The -1 arises because of the {0,NULL,0,-1} entry above. */ 41/* The -1 arises because of the {0,NULL,0,-1} entry above. */
41const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1); 42const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
42 43
44
45#ifdef CONFIG_FEATURE_SUID
46
47static void check_suid ( struct BB_applet *app );
48
49#ifdef CONFIG_FEATURE_SUID_CONFIG
50
51#include <sys/stat.h>
52#include <ctype.h>
53#include "pwd.h"
54#include "grp.h"
55
56static void parse_error ( int line, const char *err );
57static void parse_config_file ( void );
58
59#define CONFIG_FILE "/etc/busybox.conf"
60
61// applets [] is const, so we have to define this "override" structure
62struct BB_suid_config {
63 struct BB_applet *m_applet;
64
65 uid_t m_uid;
66 gid_t m_gid;
67 mode_t m_mode;
68
69 struct BB_suid_config *m_next;
70};
71
72static struct BB_suid_config *suid_config;
73
74#endif // CONFIG_FEATURE_SUID_CONFIG
75
76#endif // CONFIG_FEATURE_SUID
77
78
79
43extern void show_usage(void) 80extern void show_usage(void)
44{ 81{
45 const char *format_string; 82 const char *format_string;
@@ -80,6 +117,11 @@ void run_applet_by_name(const char *name, int argc, char **argv)
80 static int recurse_level = 0; 117 static int recurse_level = 0;
81 extern int been_there_done_that; /* From busybox.c */ 118 extern int been_there_done_that; /* From busybox.c */
82 119
120#ifdef CONFIG_FEATURE_SUID_CONFIG
121 if ( recurse_level == 0 )
122 parse_config_file ( );
123#endif
124
83 recurse_level++; 125 recurse_level++;
84 /* Do a binary search to find the applet entry given the name. */ 126 /* Do a binary search to find the applet entry given the name. */
85 if ((applet_using = find_applet_by_name(name)) != NULL) { 127 if ((applet_using = find_applet_by_name(name)) != NULL) {
@@ -96,6 +138,10 @@ void run_applet_by_name(const char *name, int argc, char **argv)
96 been_there_done_that=1; 138 been_there_done_that=1;
97 busybox_main(0, NULL); 139 busybox_main(0, NULL);
98 } 140 }
141#ifdef CONFIG_FEATURE_SUID
142 check_suid ( applet_using );
143#endif
144
99 exit((*(applet_using->main)) (argc, argv)); 145 exit((*(applet_using->main)) (argc, argv));
100 } 146 }
101 /* Just in case they have renamed busybox - Check argv[1] */ 147 /* Just in case they have renamed busybox - Check argv[1] */
@@ -106,6 +152,247 @@ void run_applet_by_name(const char *name, int argc, char **argv)
106} 152}
107 153
108 154
155#ifdef CONFIG_FEATURE_SUID
156
157#ifdef CONFIG_FEATURE_SUID_CONFIG
158
159// check if u is member of group g
160static int ingroup ( uid_t u, gid_t g )
161{
162 struct group *grp = getgrgid ( g );
163
164 if ( grp ) {
165 char **mem;
166
167 for ( mem = grp-> gr_mem; *mem; mem++ ) {
168 struct passwd *pwd = getpwnam ( *mem );
169
170 if ( pwd && ( pwd-> pw_uid == u ))
171 return 1;
172 }
173 }
174 return 0;
175}
176
177#endif
178
179
180void check_suid ( struct BB_applet *applet )
181{
182 uid_t ruid = getuid ( ); // real [ug]id
183 uid_t rgid = getgid ( );
184
185#ifdef CONFIG_FEATURE_SUID_CONFIG
186 struct BB_suid_config *sct;
187
188 for ( sct = suid_config; sct; sct = sct-> m_next ) {
189 if ( sct-> m_applet == applet )
190 break;
191 }
192 if ( sct ) {
193 mode_t m = sct-> m_mode;
194
195 if ( sct-> m_uid == ruid ) // same uid
196 m >>= 6;
197 else if (( sct-> m_gid == rgid ) || ingroup ( ruid, sct-> m_gid )) // same group / in group
198 m >>= 3;
199
200 if (!( m & S_IXOTH )) // is x bit not set ?
201 error_msg_and_die ( "You have no permission to run this applet!" );
202
203 if (( sct-> m_mode & ( S_ISGID | S_IXGRP )) == ( S_ISGID | S_IXGRP )) { // *both* have to be set for sgid
204 if ( setegid ( sct-> m_gid ))
205 error_msg_and_die ( "BusyBox binary has insufficient rights to set proper GID for applet!" );
206 }
207 else
208 setgid ( rgid ); // no sgid -> drop
209
210 if ( sct-> m_mode & S_ISUID ) {
211 if ( seteuid ( sct-> m_uid ))
212 error_msg_and_die ( "BusyBox binary has insufficient rights to set proper UID for applet!" );
213 }
214 else
215 setuid ( ruid ); // no suid -> drop
216 }
217 else { // default: drop all priviledges
218 setgid ( rgid );
219 setuid ( ruid );
220 }
221#else
222
223 if ( applet-> need_suid == _BB_SUID_ALWAYS ) {
224 if ( geteuid ( ) != 0 )
225 error_msg_and_die ( "This applet requires root priviledges!" );
226 }
227 else if ( applet-> need_suid == _BB_SUID_NEVER ) {
228 setgid ( rgid ); // drop all priviledges
229 setuid ( ruid );
230 }
231#endif
232}
233
234#ifdef CONFIG_FEATURE_SUID_CONFIG
235
236void parse_error ( int line, const char *err )
237{
238 char msg [512];
239 snprintf ( msg, sizeof( msg ) - 1, "Parse error in %s, line %d: %s", CONFIG_FILE, line, err );
240
241 error_msg_and_die ( msg );
242}
243
244
245void parse_config_file ( void )
246{
247 struct stat st;
248
249 suid_config = 0;
250
251 // is there a config file ?
252 if ( stat ( CONFIG_FILE, &st ) == 0 ) {
253 // is it owned by root with no write perm. for group and others ?
254 if ( S_ISREG( st. st_mode ) && ( st. st_uid == 0 ) && (!( st. st_mode & ( S_IWGRP | S_IWOTH )))) {
255 // that's ok .. then try to open it
256 FILE *f = fopen ( CONFIG_FILE, "r" );
257
258 if ( f ) {
259 char buffer [4096];
260 int section = 0;
261 int lc = 0;
262
263 while ( fgets ( buffer, sizeof( buffer ) - 1, f )) {
264 char c = buffer [0];
265 char *p;
266
267 lc++;
268
269 p = strchr ( buffer, '#' );
270 if ( p )
271 *p = 0;
272 p = buffer + xstrlen ( buffer );
273 while (( p > buffer ) && isspace ( *--p ))
274 *p = 0;
275
276 if ( p == buffer )
277 continue;
278
279 if ( c == '[' ) {
280 p = strchr ( buffer, ']' );
281
282 if ( !p || ( p == ( buffer + 1 ))) // no matching ] or empty []
283 parse_error ( lc, "malformed section header" );
284
285 *p = 0;
286
287 if ( strcasecmp ( buffer + 1, "SUID" ) == 0 )
288 section = 1;
289 else
290 section = -1; // unknown section - just skip
291 }
292 else if ( section ) {
293 switch ( section ) {
294 case 1: { // SUID
295 int l;
296 struct BB_applet *applet;
297
298 p = strchr ( buffer, '=' ); // <key>[::space::]*=[::space::]*<value>
299
300 if ( !p || ( p == ( buffer + 1 ))) // no = or key is empty
301 parse_error ( lc, "malformed keyword" );
302
303 l = p - buffer;
304 while ( isspace ( buffer [--l] )) { } // skip whitespace
305
306 buffer [l+1] = 0;
307
308 if (( applet = find_applet_by_name ( buffer ))) {
309 struct BB_suid_config *sct = xmalloc ( sizeof( struct BB_suid_config ));
310
311 sct-> m_applet = applet;
312 sct-> m_next = suid_config;
313 suid_config = sct;
314
315 while ( isspace ( *++p )) { } // skip whitespace
316
317 sct-> m_mode = 0;
318
319 switch ( *p++ ) {
320 case 'S': sct-> m_mode |= S_ISUID; break;
321 case 's': sct-> m_mode |= S_ISUID; // no break
322 case 'x': sct-> m_mode |= S_IXUSR; break;
323 case '-': break;
324 default : parse_error ( lc, "invalid user mode" );
325 }
326
327 switch ( *p++ ) {
328 case 's': sct-> m_mode |= S_ISGID; // no break
329 case 'x': sct-> m_mode |= S_IXGRP; break;
330 case 'S': break;
331 case '-': break;
332 default : parse_error ( lc, "invalid group mode" );
333 }
334
335 switch ( *p ) {
336 case 't':
337 case 'x': sct-> m_mode |= S_IXOTH; break;
338 case 'T':
339 case '-': break;
340 default : parse_error ( lc, "invalid other mode" );
341 }
342
343 while ( isspace ( *++p )) { } // skip whitespace
344
345 if ( isdigit ( *p )) {
346 sct-> m_uid = strtol ( p, &p, 10 );
347 if ( *p++ != '.' )
348 parse_error ( lc, "parsing <uid>.<gid>" );
349 }
350 else {
351 struct passwd *pwd;
352 char *p2 = strchr ( p, '.' );
353
354 if ( !p2 )
355 parse_error ( lc, "parsing <uid>.<gid>" );
356
357 *p2 = 0;
358 pwd = getpwnam ( p );
359
360 if ( !pwd )
361 parse_error ( lc, "invalid user name" );
362
363 sct-> m_uid = pwd-> pw_uid;
364 p = p2 + 1;
365 }
366 if ( isdigit ( *p ))
367 sct-> m_gid = strtol ( p, &p, 10 );
368 else {
369 struct group *grp = getgrnam ( p );
370
371 if ( !grp )
372 parse_error ( lc, "invalid group name" );
373
374 sct-> m_gid = grp-> gr_gid;
375 }
376 }
377 break;
378 }
379 default: // unknown - skip
380 break;
381 }
382 }
383 else
384 parse_error ( lc, "keyword not within section" );
385 }
386 fclose ( f );
387 }
388 }
389 }
390}
391
392#endif
393
394#endif
395
109/* END CODE */ 396/* END CODE */
110/* 397/*
111Local Variables: 398Local Variables:
diff --git a/include/applets.h b/include/applets.h
index 6d01901a3..3a8c731a5 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -16,515 +16,521 @@
16 16
17 17
18#if defined(PROTOTYPES) 18#if defined(PROTOTYPES)
19 #define APPLET(a,b,c) extern int b(int argc, char **argv); 19 #define APPLET(a,b,c,d) extern int b(int argc, char **argv);
20 #define APPLET_NOUSAGE(a,b,c) extern int b(int argc, char **argv); 20 #define APPLET_NOUSAGE(a,b,c,d) extern int b(int argc, char **argv);
21 #define APPLET_ODDNAME(a,b,c,d) extern int b(int argc, char **argv); 21 #define APPLET_ODDNAME(a,b,c,d,e) extern int b(int argc, char **argv);
22 extern const char usage_messages[]; 22 extern const char usage_messages[];
23#elif defined(MAKE_USAGE) 23#elif defined(MAKE_USAGE)
24 #ifdef CONFIG_FEATURE_VERBOSE_USAGE 24 #ifdef CONFIG_FEATURE_VERBOSE_USAGE
25 #define APPLET(a,b,c) a##_trivial_usage "\n\n" a##_full_usage "\0" 25 #define APPLET(a,b,c,d) a##_trivial_usage "\n\n" a##_full_usage "\0"
26 #define APPLET_NOUSAGE(a,b,c) "\0" 26 #define APPLET_NOUSAGE(a,b,c,d) "\0"
27 #define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\n\n" d##_full_usage "\0" 27 #define APPLET_ODDNAME(a,b,c,d,e) e##_trivial_usage "\n\n" e##_full_usage "\0"
28 #else 28 #else
29 #define APPLET(a,b,c) a##_trivial_usage "\0" 29 #define APPLET(a,b,c,d) a##_trivial_usage "\0"
30 #define APPLET_NOUSAGE(a,b,c) "\0" 30 #define APPLET_NOUSAGE(a,b,c,d) "\0"
31 #define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\0" 31 #define APPLET_ODDNAME(a,b,c,d,e) e##_trivial_usage "\0"
32 #endif 32 #endif
33#elif defined(MAKE_LINKS) 33#elif defined(MAKE_LINKS)
34# define APPLET(a,b,c) LINK c a 34# define APPLET(a,b,c,d) LINK c a
35# define APPLET_NOUSAGE(a,b,c) LINK c a 35# define APPLET_NOUSAGE(a,b,c,d) LINK c a
36# define APPLET_ODDNAME(a,b,c,d) LINK c a 36# define APPLET_ODDNAME(a,b,c,d,e) LINK c a
37#else 37#else
38 const struct BB_applet applets[] = { 38 const struct BB_applet applets[] = {
39 #define APPLET(a,b,c) {#a,b,c}, 39 #define APPLET(a,b,c,d) {#a,b,c,d},
40 #define APPLET_NOUSAGE(a,b,c) {a,b,c}, 40 #define APPLET_NOUSAGE(a,b,c,d) {a,b,c,d},
41 #define APPLET_ODDNAME(a,b,c,d) {a,b,c}, 41 #define APPLET_ODDNAME(a,b,c,d,e) {a,b,c,d},
42#endif 42#endif
43 43
44 44
45 45
46#ifdef CONFIG_TEST 46#ifdef CONFIG_TEST
47 APPLET_NOUSAGE("[", test_main, _BB_DIR_USR_BIN) 47 APPLET_NOUSAGE("[", test_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
48#endif 48#endif
49#ifdef CONFIG_ADDGROUP 49#ifdef CONFIG_ADDGROUP
50 APPLET(addgroup, addgroup_main, _BB_DIR_BIN) 50 APPLET(addgroup, addgroup_main, _BB_DIR_BIN, _BB_SUID_NEVER)
51#endif 51#endif
52#ifdef CONFIG_ADDUSER 52#ifdef CONFIG_ADDUSER
53 APPLET(adduser, adduser_main, _BB_DIR_BIN) 53 APPLET(adduser, adduser_main, _BB_DIR_BIN, _BB_SUID_NEVER)
54#endif 54#endif
55#ifdef CONFIG_ADJTIMEX 55#ifdef CONFIG_ADJTIMEX
56 APPLET(adjtimex, adjtimex_main, _BB_DIR_SBIN) 56 APPLET(adjtimex, adjtimex_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
57#endif 57#endif
58#ifdef CONFIG_AR 58#ifdef CONFIG_AR
59 APPLET(ar, ar_main, _BB_DIR_USR_BIN) 59 APPLET(ar, ar_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
60#endif 60#endif
61#ifdef CONFIG_ASH 61#ifdef CONFIG_ASH
62 APPLET_NOUSAGE("ash", ash_main, _BB_DIR_BIN) 62 APPLET_NOUSAGE("ash", ash_main, _BB_DIR_BIN, _BB_SUID_NEVER)
63#endif 63#endif
64#ifdef CONFIG_BASENAME 64#ifdef CONFIG_BASENAME
65 APPLET(basename, basename_main, _BB_DIR_USR_BIN) 65 APPLET(basename, basename_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
66#endif 66#endif
67#ifdef CONFIG_BUNZIP2 67#ifdef CONFIG_BUNZIP2
68 APPLET(bunzip2, bunzip2_main, _BB_DIR_USR_BIN) 68 APPLET(bunzip2, bunzip2_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
69#endif 69#endif
70 APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN) 70 APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN, _BB_SUID_MAYBE)
71#ifdef CONFIG_BUNZIP2 71#ifdef CONFIG_BUNZIP2
72 APPLET(bzcat, bunzip2_main, _BB_DIR_USR_BIN) 72 APPLET(bzcat, bunzip2_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
73#endif 73#endif
74#ifdef CONFIG_CAL 74#ifdef CONFIG_CAL
75 APPLET(cal, cal_main, _BB_DIR_USR_BIN) 75 APPLET(cal, cal_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
76#endif 76#endif
77#ifdef CONFIG_CAT 77#ifdef CONFIG_CAT
78 APPLET(cat, cat_main, _BB_DIR_BIN) 78 APPLET(cat, cat_main, _BB_DIR_BIN, _BB_SUID_NEVER)
79#endif 79#endif
80#ifdef CONFIG_CHGRP 80#ifdef CONFIG_CHGRP
81 APPLET(chgrp, chgrp_main, _BB_DIR_BIN) 81 APPLET(chgrp, chgrp_main, _BB_DIR_BIN, _BB_SUID_NEVER)
82#endif 82#endif
83#ifdef CONFIG_CHMOD 83#ifdef CONFIG_CHMOD
84 APPLET(chmod, chmod_main, _BB_DIR_BIN) 84 APPLET(chmod, chmod_main, _BB_DIR_BIN, _BB_SUID_NEVER)
85#endif 85#endif
86#ifdef CONFIG_CHOWN 86#ifdef CONFIG_CHOWN
87 APPLET(chown, chown_main, _BB_DIR_BIN) 87 APPLET(chown, chown_main, _BB_DIR_BIN, _BB_SUID_NEVER)
88#endif 88#endif
89#ifdef CONFIG_CHROOT 89#ifdef CONFIG_CHROOT
90 APPLET(chroot, chroot_main, _BB_DIR_USR_SBIN) 90 APPLET(chroot, chroot_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
91#endif 91#endif
92#ifdef CONFIG_CHVT 92#ifdef CONFIG_CHVT
93 APPLET(chvt, chvt_main, _BB_DIR_USR_BIN) 93 APPLET(chvt, chvt_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
94#endif 94#endif
95#ifdef CONFIG_CLEAR 95#ifdef CONFIG_CLEAR
96 APPLET(clear, clear_main, _BB_DIR_USR_BIN) 96 APPLET(clear, clear_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
97#endif 97#endif
98#ifdef CONFIG_CMP 98#ifdef CONFIG_CMP
99 APPLET(cmp, cmp_main, _BB_DIR_USR_BIN) 99 APPLET(cmp, cmp_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
100#endif 100#endif
101#ifdef CONFIG_CP 101#ifdef CONFIG_CP
102 APPLET(cp, cp_main, _BB_DIR_BIN) 102 APPLET(cp, cp_main, _BB_DIR_BIN, _BB_SUID_NEVER)
103#endif 103#endif
104#ifdef CONFIG_CPIO 104#ifdef CONFIG_CPIO
105 APPLET(cpio, cpio_main, _BB_DIR_BIN) 105 APPLET(cpio, cpio_main, _BB_DIR_BIN, _BB_SUID_NEVER)
106#endif 106#endif
107#ifdef CONFIG_CUT 107#ifdef CONFIG_CUT
108 APPLET(cut, cut_main, _BB_DIR_USR_BIN) 108 APPLET(cut, cut_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
109#endif 109#endif
110#ifdef CONFIG_DATE 110#ifdef CONFIG_DATE
111 APPLET(date, date_main, _BB_DIR_BIN) 111 APPLET(date, date_main, _BB_DIR_BIN, _BB_SUID_NEVER)
112#endif 112#endif
113#ifdef CONFIG_DC 113#ifdef CONFIG_DC
114 APPLET(dc, dc_main, _BB_DIR_USR_BIN) 114 APPLET(dc, dc_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
115#endif 115#endif
116#ifdef CONFIG_DD 116#ifdef CONFIG_DD
117 APPLET(dd, dd_main, _BB_DIR_BIN) 117 APPLET(dd, dd_main, _BB_DIR_BIN, _BB_SUID_NEVER)
118#endif 118#endif
119#ifdef CONFIG_DEALLOCVT 119#ifdef CONFIG_DEALLOCVT
120 APPLET(deallocvt, deallocvt_main, _BB_DIR_USR_BIN) 120 APPLET(deallocvt, deallocvt_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
121#endif 121#endif
122#ifdef CONFIG_DELGROUP 122#ifdef CONFIG_DELGROUP
123 APPLET(delgroup, delgroup_main, _BB_DIR_BIN) 123 APPLET(delgroup, delgroup_main, _BB_DIR_BIN, _BB_SUID_NEVER)
124#endif 124#endif
125#ifdef CONFIG_DELUSER 125#ifdef CONFIG_DELUSER
126 APPLET(deluser, deluser_main, _BB_DIR_BIN) 126 APPLET(deluser, deluser_main, _BB_DIR_BIN, _BB_SUID_NEVER)
127#endif 127#endif
128#ifdef CONFIG_DF 128#ifdef CONFIG_DF
129 APPLET(df, df_main, _BB_DIR_BIN) 129 APPLET(df, df_main, _BB_DIR_BIN, _BB_SUID_NEVER)
130#endif 130#endif
131#ifdef CONFIG_DIRNAME 131#ifdef CONFIG_DIRNAME
132 APPLET(dirname, dirname_main, _BB_DIR_USR_BIN) 132 APPLET(dirname, dirname_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
133#endif 133#endif
134#ifdef CONFIG_DMESG 134#ifdef CONFIG_DMESG
135 APPLET(dmesg, dmesg_main, _BB_DIR_BIN) 135 APPLET(dmesg, dmesg_main, _BB_DIR_BIN, _BB_SUID_NEVER)
136#endif 136#endif
137#ifdef CONFIG_DOS2UNIX 137#ifdef CONFIG_DOS2UNIX
138 APPLET(dos2unix, dos2unix_main, _BB_DIR_USR_BIN) 138 APPLET(dos2unix, dos2unix_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
139#endif 139#endif
140#ifdef CONFIG_DPKG 140#ifdef CONFIG_DPKG
141 APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN) 141 APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
142#endif 142#endif
143#ifdef CONFIG_DPKG_DEB 143#ifdef CONFIG_DPKG_DEB
144 APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb) 144 APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dpkg_deb)
145#endif 145#endif
146#ifdef CONFIG_DU 146#ifdef CONFIG_DU
147 APPLET(du, du_main, _BB_DIR_USR_BIN) 147 APPLET(du, du_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
148#endif 148#endif
149#ifdef CONFIG_DUMPKMAP 149#ifdef CONFIG_DUMPKMAP
150 APPLET(dumpkmap, dumpkmap_main, _BB_DIR_BIN) 150 APPLET(dumpkmap, dumpkmap_main, _BB_DIR_BIN, _BB_SUID_NEVER)
151#endif 151#endif
152#ifdef CONFIG_DUTMP 152#ifdef CONFIG_DUTMP
153 APPLET(dutmp, dutmp_main, _BB_DIR_USR_SBIN) 153 APPLET(dutmp, dutmp_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
154#endif 154#endif
155#ifdef CONFIG_ECHO 155#ifdef CONFIG_ECHO
156 APPLET(echo, echo_main, _BB_DIR_BIN) 156 APPLET(echo, echo_main, _BB_DIR_BIN, _BB_SUID_NEVER)
157#endif 157#endif
158#if defined(CONFIG_FEATURE_GREP_EGREP_ALIAS) 158#if defined(CONFIG_FEATURE_GREP_EGREP_ALIAS)
159 APPLET_NOUSAGE("egrep", grep_main, _BB_DIR_BIN) 159 APPLET_NOUSAGE("egrep", grep_main, _BB_DIR_BIN, _BB_SUID_NEVER)
160#endif 160#endif
161#ifdef CONFIG_ENV 161#ifdef CONFIG_ENV
162 APPLET(env, env_main, _BB_DIR_USR_BIN) 162 APPLET(env, env_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
163#endif 163#endif
164#ifdef CONFIG_EXPR 164#ifdef CONFIG_EXPR
165 APPLET(expr, expr_main, _BB_DIR_USR_BIN) 165 APPLET(expr, expr_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
166#endif 166#endif
167#ifdef CONFIG_FALSE 167#ifdef CONFIG_FALSE
168 APPLET(false, false_main, _BB_DIR_BIN) 168 APPLET(false, false_main, _BB_DIR_BIN, _BB_SUID_NEVER)
169#endif 169#endif
170#ifdef CONFIG_FBSET 170#ifdef CONFIG_FBSET
171 APPLET(fbset, fbset_main, _BB_DIR_USR_SBIN) 171 APPLET(fbset, fbset_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
172#endif 172#endif
173#ifdef CONFIG_FDFLUSH 173#ifdef CONFIG_FDFLUSH
174 APPLET(fdflush, fdflush_main, _BB_DIR_BIN) 174 APPLET(fdflush, fdflush_main, _BB_DIR_BIN, _BB_SUID_NEVER)
175#endif 175#endif
176#ifdef CONFIG_FIND 176#ifdef CONFIG_FIND
177 APPLET(find, find_main, _BB_DIR_USR_BIN) 177 APPLET(find, find_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
178#endif 178#endif
179#ifdef CONFIG_FREE 179#ifdef CONFIG_FREE
180 APPLET(free, free_main, _BB_DIR_USR_BIN) 180 APPLET(free, free_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
181#endif 181#endif
182#ifdef CONFIG_FREERAMDISK 182#ifdef CONFIG_FREERAMDISK
183 APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN) 183 APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
184#endif 184#endif
185#ifdef CONFIG_FSCK_MINIX 185#ifdef CONFIG_FSCK_MINIX
186 APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix) 186 APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_minix)
187#endif 187#endif
188#ifdef CONFIG_GETOPT 188#ifdef CONFIG_GETOPT
189 APPLET(getopt, getopt_main, _BB_DIR_BIN) 189 APPLET(getopt, getopt_main, _BB_DIR_BIN, _BB_SUID_NEVER)
190#endif 190#endif
191#ifdef CONFIG_GETTY 191#ifdef CONFIG_GETTY
192 APPLET(getty, getty_main, _BB_DIR_SBIN) 192 APPLET(getty, getty_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
193#endif 193#endif
194#ifdef CONFIG_GREP 194#ifdef CONFIG_GREP
195 APPLET(grep, grep_main, _BB_DIR_BIN) 195 APPLET(grep, grep_main, _BB_DIR_BIN, _BB_SUID_NEVER)
196#endif 196#endif
197#ifdef CONFIG_GUNZIP 197#ifdef CONFIG_GUNZIP
198 APPLET(gunzip, gunzip_main, _BB_DIR_BIN) 198 APPLET(gunzip, gunzip_main, _BB_DIR_BIN, _BB_SUID_NEVER)
199#endif 199#endif
200#ifdef CONFIG_GZIP 200#ifdef CONFIG_GZIP
201 APPLET(gzip, gzip_main, _BB_DIR_BIN) 201 APPLET(gzip, gzip_main, _BB_DIR_BIN, _BB_SUID_NEVER)
202#endif 202#endif
203#ifdef CONFIG_HALT 203#ifdef CONFIG_HALT
204 APPLET(halt, halt_main, _BB_DIR_SBIN) 204 APPLET(halt, halt_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
205#endif 205#endif
206#ifdef CONFIG_HEAD 206#ifdef CONFIG_HEAD
207 APPLET(head, head_main, _BB_DIR_USR_BIN) 207 APPLET(head, head_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
208#endif 208#endif
209#ifdef CONFIG_HEXDUMP 209#ifdef CONFIG_HEXDUMP
210 APPLET(hexdump, hexdump_main, _BB_DIR_USR_BIN) 210 APPLET(hexdump, hexdump_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
211#endif 211#endif
212#ifdef CONFIG_HOSTID 212#ifdef CONFIG_HOSTID
213 APPLET(hostid, hostid_main, _BB_DIR_USR_BIN) 213 APPLET(hostid, hostid_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
214#endif 214#endif
215#ifdef CONFIG_HOSTNAME 215#ifdef CONFIG_HOSTNAME
216 APPLET(hostname, hostname_main, _BB_DIR_BIN) 216 APPLET(hostname, hostname_main, _BB_DIR_BIN, _BB_SUID_NEVER)
217#endif 217#endif
218#ifdef CONFIG_HUSH 218#ifdef CONFIG_HUSH
219 APPLET_NOUSAGE("hush", hush_main, _BB_DIR_BIN) 219 APPLET_NOUSAGE("hush", hush_main, _BB_DIR_BIN, _BB_SUID_NEVER)
220#endif 220#endif
221#ifdef CONFIG_ID 221#ifdef CONFIG_ID
222 APPLET(id, id_main, _BB_DIR_USR_BIN) 222 APPLET(id, id_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
223#endif 223#endif
224#ifdef CONFIG_IFCONFIG 224#ifdef CONFIG_IFCONFIG
225 APPLET(ifconfig, ifconfig_main, _BB_DIR_SBIN) 225 APPLET(ifconfig, ifconfig_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
226#endif 226#endif
227#ifdef CONFIG_INIT 227#ifdef CONFIG_INIT
228 APPLET(init, init_main, _BB_DIR_SBIN) 228 APPLET(init, init_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
229#endif 229#endif
230#ifdef CONFIG_INSMOD 230#ifdef CONFIG_INSMOD
231 APPLET(insmod, insmod_main, _BB_DIR_SBIN) 231 APPLET(insmod, insmod_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
232#endif 232#endif
233#ifdef CONFIG_KILL 233#ifdef CONFIG_KILL
234 APPLET(kill, kill_main, _BB_DIR_BIN) 234 APPLET(kill, kill_main, _BB_DIR_BIN, _BB_SUID_NEVER)
235#endif 235#endif
236#ifdef CONFIG_KILLALL 236#ifdef CONFIG_KILLALL
237 APPLET(killall, kill_main, _BB_DIR_USR_BIN) 237 APPLET(killall, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
238#endif 238#endif
239#ifdef CONFIG_KLOGD 239#ifdef CONFIG_KLOGD
240 APPLET(klogd, klogd_main, _BB_DIR_SBIN) 240 APPLET(klogd, klogd_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
241#endif 241#endif
242#ifdef CONFIG_LASH 242#ifdef CONFIG_LASH
243 APPLET(lash, lash_main, _BB_DIR_BIN) 243 APPLET(lash, lash_main, _BB_DIR_BIN, _BB_SUID_NEVER)
244#endif 244#endif
245#ifdef CONFIG_LENGTH 245#ifdef CONFIG_LENGTH
246 APPLET(length, length_main, _BB_DIR_USR_BIN) 246 APPLET(length, length_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
247#endif 247#endif
248#ifdef CONFIG_FEATURE_INITRD 248#ifdef CONFIG_FEATURE_INITRD
249 APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT) 249 APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT, _BB_SUID_NEVER)
250#endif 250#endif
251#ifdef CONFIG_LN 251#ifdef CONFIG_LN
252 APPLET(ln, ln_main, _BB_DIR_BIN) 252 APPLET(ln, ln_main, _BB_DIR_BIN, _BB_SUID_NEVER)
253#endif 253#endif
254#ifdef CONFIG_LOADACM 254#ifdef CONFIG_LOADACM
255 APPLET(loadacm, loadacm_main, _BB_DIR_USR_BIN) 255 APPLET(loadacm, loadacm_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
256#endif 256#endif
257#ifdef CONFIG_LOADFONT 257#ifdef CONFIG_LOADFONT
258 APPLET(loadfont, loadfont_main, _BB_DIR_USR_BIN) 258 APPLET(loadfont, loadfont_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
259#endif 259#endif
260#ifdef CONFIG_LOADKMAP 260#ifdef CONFIG_LOADKMAP
261 APPLET(loadkmap, loadkmap_main, _BB_DIR_SBIN) 261 APPLET(loadkmap, loadkmap_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
262#endif 262#endif
263#ifdef CONFIG_LOGGER 263#ifdef CONFIG_LOGGER
264 APPLET(logger, logger_main, _BB_DIR_USR_BIN) 264 APPLET(logger, logger_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
265#endif
266#ifdef CONFIG_LOGIN
267 APPLET(login, login_main, _BB_DIR_BIN, _BB_SUID_NEVER)
265#endif 268#endif
266#ifdef CONFIG_LOGNAME 269#ifdef CONFIG_LOGNAME
267 APPLET(logname, logname_main, _BB_DIR_USR_BIN) 270 APPLET(logname, logname_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
268#endif 271#endif
269#ifdef CONFIG_LOGREAD 272#ifdef CONFIG_LOGREAD
270 APPLET(logread, logread_main, _BB_DIR_SBIN) 273 APPLET(logread, logread_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
271#endif 274#endif
272#ifdef CONFIG_LOSETUP 275#ifdef CONFIG_LOSETUP
273 APPLET(losetup, losetup_main, _BB_DIR_SBIN) 276 APPLET(losetup, losetup_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
274#endif 277#endif
275#ifdef CONFIG_LS 278#ifdef CONFIG_LS
276 APPLET(ls, ls_main, _BB_DIR_BIN) 279 APPLET(ls, ls_main, _BB_DIR_BIN, _BB_SUID_NEVER)
277#endif 280#endif
278#ifdef CONFIG_LSMOD 281#ifdef CONFIG_LSMOD
279 APPLET(lsmod, lsmod_main, _BB_DIR_SBIN) 282 APPLET(lsmod, lsmod_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
280#endif 283#endif
281#ifdef CONFIG_MAKEDEVS 284#ifdef CONFIG_MAKEDEVS
282 APPLET(makedevs, makedevs_main, _BB_DIR_SBIN) 285 APPLET(makedevs, makedevs_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
283#endif 286#endif
284#ifdef CONFIG_MD5SUM 287#ifdef CONFIG_MD5SUM
285 APPLET(md5sum, md5sum_main, _BB_DIR_USR_BIN) 288 APPLET(md5sum, md5sum_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
286#endif 289#endif
287#ifdef CONFIG_MKDIR 290#ifdef CONFIG_MKDIR
288 APPLET(mkdir, mkdir_main, _BB_DIR_BIN) 291 APPLET(mkdir, mkdir_main, _BB_DIR_BIN, _BB_SUID_NEVER)
289#endif 292#endif
290#ifdef CONFIG_MKFIFO 293#ifdef CONFIG_MKFIFO
291 APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN) 294 APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
292#endif 295#endif
293#ifdef CONFIG_MKFS_MINIX 296#ifdef CONFIG_MKFS_MINIX
294 APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix) 297 APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_minix)
295#endif 298#endif
296#ifdef CONFIG_MKNOD 299#ifdef CONFIG_MKNOD
297 APPLET(mknod, mknod_main, _BB_DIR_BIN) 300 APPLET(mknod, mknod_main, _BB_DIR_BIN, _BB_SUID_NEVER)
298#endif 301#endif
299#ifdef CONFIG_MKSWAP 302#ifdef CONFIG_MKSWAP
300 APPLET(mkswap, mkswap_main, _BB_DIR_SBIN) 303 APPLET(mkswap, mkswap_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
301#endif 304#endif
302#ifdef CONFIG_MKTEMP 305#ifdef CONFIG_MKTEMP
303 APPLET(mktemp, mktemp_main, _BB_DIR_BIN) 306 APPLET(mktemp, mktemp_main, _BB_DIR_BIN, _BB_SUID_NEVER)
304#endif 307#endif
305#ifdef CONFIG_MODPROBE 308#ifdef CONFIG_MODPROBE
306 APPLET(modprobe, modprobe_main, _BB_DIR_SBIN) 309 APPLET(modprobe, modprobe_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
307#endif 310#endif
308#ifdef CONFIG_MORE 311#ifdef CONFIG_MORE
309 APPLET(more, more_main, _BB_DIR_BIN) 312 APPLET(more, more_main, _BB_DIR_BIN, _BB_SUID_NEVER)
310#endif 313#endif
311#ifdef CONFIG_MOUNT 314#ifdef CONFIG_MOUNT
312 APPLET(mount, mount_main, _BB_DIR_BIN) 315 APPLET(mount, mount_main, _BB_DIR_BIN, _BB_SUID_NEVER)
313#endif 316#endif
314#ifdef CONFIG_MSH 317#ifdef CONFIG_MSH
315 APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN) 318 APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN, _BB_SUID_NEVER)
316#endif 319#endif
317#ifdef CONFIG_MT 320#ifdef CONFIG_MT
318 APPLET(mt, mt_main, _BB_DIR_BIN) 321 APPLET(mt, mt_main, _BB_DIR_BIN, _BB_SUID_NEVER)
319#endif 322#endif
320#ifdef CONFIG_MV 323#ifdef CONFIG_MV
321 APPLET(mv, mv_main, _BB_DIR_BIN) 324 APPLET(mv, mv_main, _BB_DIR_BIN, _BB_SUID_NEVER)
322#endif 325#endif
323#ifdef CONFIG_NC 326#ifdef CONFIG_NC
324 APPLET(nc, nc_main, _BB_DIR_USR_BIN) 327 APPLET(nc, nc_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
325#endif 328#endif
326#ifdef CONFIG_NETSTAT 329#ifdef CONFIG_NETSTAT
327 APPLET(netstat, netstat_main, _BB_DIR_BIN) 330 APPLET(netstat, netstat_main, _BB_DIR_BIN, _BB_SUID_NEVER)
328#endif 331#endif
329#ifdef CONFIG_NSLOOKUP 332#ifdef CONFIG_NSLOOKUP
330 APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN) 333 APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
331#endif 334#endif
332#ifdef CONFIG_OD 335#ifdef CONFIG_OD
333 APPLET(od, od_main, _BB_DIR_USR_BIN) 336 APPLET(od, od_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
334#endif 337#endif
335#ifdef CONFIG_PIDOF 338#ifdef CONFIG_PIDOF
336 APPLET(pidof, pidof_main, _BB_DIR_BIN) 339 APPLET(pidof, pidof_main, _BB_DIR_BIN, _BB_SUID_NEVER)
337#endif 340#endif
338#ifdef CONFIG_PING 341#ifdef CONFIG_PING
339 APPLET(ping, ping_main, _BB_DIR_BIN) 342 APPLET(ping, ping_main, _BB_DIR_BIN, _BB_SUID_NEVER)
340#endif 343#endif
341#ifdef CONFIG_PIVOT_ROOT 344#ifdef CONFIG_PIVOT_ROOT
342 APPLET(pivot_root, pivot_root_main, _BB_DIR_SBIN) 345 APPLET(pivot_root, pivot_root_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
343#endif 346#endif
344#ifdef CONFIG_POWEROFF 347#ifdef CONFIG_POWEROFF
345 APPLET(poweroff, poweroff_main, _BB_DIR_SBIN) 348 APPLET(poweroff, poweroff_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
346#endif 349#endif
347#ifdef CONFIG_PRINTF 350#ifdef CONFIG_PRINTF
348 APPLET(printf, printf_main, _BB_DIR_USR_BIN) 351 APPLET(printf, printf_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
349#endif 352#endif
350#ifdef CONFIG_PS 353#ifdef CONFIG_PS
351 APPLET(ps, ps_main, _BB_DIR_BIN) 354 APPLET(ps, ps_main, _BB_DIR_BIN, _BB_SUID_NEVER)
352#endif 355#endif
353#ifdef CONFIG_PWD 356#ifdef CONFIG_PWD
354 APPLET(pwd, pwd_main, _BB_DIR_BIN) 357 APPLET(pwd, pwd_main, _BB_DIR_BIN, _BB_SUID_NEVER)
355#endif 358#endif
356#ifdef CONFIG_RDATE 359#ifdef CONFIG_RDATE
357 APPLET(rdate, rdate_main, _BB_DIR_USR_BIN) 360 APPLET(rdate, rdate_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
358#endif 361#endif
359#ifdef CONFIG_READLINK 362#ifdef CONFIG_READLINK
360 APPLET(readlink, readlink_main, _BB_DIR_USR_BIN) 363 APPLET(readlink, readlink_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
361#endif 364#endif
362#ifdef CONFIG_REBOOT 365#ifdef CONFIG_REBOOT
363 APPLET(reboot, reboot_main, _BB_DIR_SBIN) 366 APPLET(reboot, reboot_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
364#endif 367#endif
365#ifdef CONFIG_RENICE 368#ifdef CONFIG_RENICE
366 APPLET(renice, renice_main, _BB_DIR_USR_BIN) 369 APPLET(renice, renice_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
367#endif 370#endif
368#ifdef CONFIG_RESET 371#ifdef CONFIG_RESET
369 APPLET(reset, reset_main, _BB_DIR_USR_BIN) 372 APPLET(reset, reset_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
370#endif 373#endif
371#ifdef CONFIG_RM 374#ifdef CONFIG_RM
372 APPLET(rm, rm_main, _BB_DIR_BIN) 375 APPLET(rm, rm_main, _BB_DIR_BIN, _BB_SUID_NEVER)
373#endif 376#endif
374#ifdef CONFIG_RMDIR 377#ifdef CONFIG_RMDIR
375 APPLET(rmdir, rmdir_main, _BB_DIR_BIN) 378 APPLET(rmdir, rmdir_main, _BB_DIR_BIN, _BB_SUID_NEVER)
376#endif 379#endif
377#ifdef CONFIG_RMMOD 380#ifdef CONFIG_RMMOD
378 APPLET(rmmod, rmmod_main, _BB_DIR_SBIN) 381 APPLET(rmmod, rmmod_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
379#endif 382#endif
380#ifdef CONFIG_ROUTE 383#ifdef CONFIG_ROUTE
381 APPLET(route, route_main, _BB_DIR_SBIN) 384 APPLET(route, route_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
382#endif 385#endif
383#ifdef CONFIG_RPM2CPIO 386#ifdef CONFIG_RPM2CPIO
384 APPLET(rpm2cpio, rpm2cpio_main, _BB_DIR_USR_BIN) 387 APPLET(rpm2cpio, rpm2cpio_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
385#endif 388#endif
386#ifdef CONFIG_RUN_PARTS 389#ifdef CONFIG_RUN_PARTS
387 APPLET_ODDNAME("run-parts", run_parts_main, _BB_DIR_BIN, run_parts) 390 APPLET_ODDNAME("run-parts", run_parts_main, _BB_DIR_BIN, _BB_SUID_NEVER, run_parts)
388#endif 391#endif
389#ifdef CONFIG_SED 392#ifdef CONFIG_SED
390 APPLET(sed, sed_main, _BB_DIR_BIN) 393 APPLET(sed, sed_main, _BB_DIR_BIN, _BB_SUID_NEVER)
391#endif 394#endif
392#ifdef CONFIG_SETKEYCODES 395#ifdef CONFIG_SETKEYCODES
393 APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN) 396 APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
394#endif 397#endif
395#if defined(CONFIG_FEATURE_SH_IS_ASH) && defined(CONFIG_ASH) 398#if defined(CONFIG_FEATURE_SH_IS_ASH) && defined(CONFIG_ASH)
396 APPLET_NOUSAGE("sh", ash_main, _BB_DIR_BIN) 399 APPLET_NOUSAGE("sh", ash_main, _BB_DIR_BIN, _BB_SUID_NEVER)
397#elif defined(CONFIG_FEATURE_SH_IS_HUSH) && defined(CONFIG_HUSH) 400#elif defined(CONFIG_FEATURE_SH_IS_HUSH) && defined(CONFIG_HUSH)
398 APPLET_NOUSAGE("sh", hush_main, _BB_DIR_BIN) 401 APPLET_NOUSAGE("sh", hush_main, _BB_DIR_BIN, _BB_SUID_NEVER)
399#elif defined(CONFIG_FEATURE_SH_IS_LASH) && defined(CONFIG_LASH) 402#elif defined(CONFIG_FEATURE_SH_IS_LASH) && defined(CONFIG_LASH)
400 APPLET_NOUSAGE("sh", lash_main, _BB_DIR_BIN) 403 APPLET_NOUSAGE("sh", lash_main, _BB_DIR_BIN, _BB_SUID_NEVER)
401#elif defined(CONFIG_FEATURE_SH_IS_MSH) && defined(CONFIG_MSH) 404#elif defined(CONFIG_FEATURE_SH_IS_MSH) && defined(CONFIG_MSH)
402 APPLET_NOUSAGE("sh", msh_main, _BB_DIR_BIN) 405 APPLET_NOUSAGE("sh", msh_main, _BB_DIR_BIN, _BB_SUID_NEVER)
403#endif 406#endif
404#ifdef CONFIG_SLEEP 407#ifdef CONFIG_SLEEP
405 APPLET(sleep, sleep_main, _BB_DIR_BIN) 408 APPLET(sleep, sleep_main, _BB_DIR_BIN, _BB_SUID_NEVER)
406#endif 409#endif
407#ifdef CONFIG_SORT 410#ifdef CONFIG_SORT
408 APPLET(sort, sort_main, _BB_DIR_USR_BIN) 411 APPLET(sort, sort_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
409#endif 412#endif
410#ifdef CONFIG_START_STOP_DAEMON 413#ifdef CONFIG_START_STOP_DAEMON
411 APPLET_ODDNAME("start-stop-daemon", start_stop_daemon_main, _BB_DIR_SBIN, start_stop_daemon) 414 APPLET_ODDNAME("start-stop-daemon", start_stop_daemon_main, _BB_DIR_SBIN, _BB_SUID_NEVER, start_stop_daemon)
412#endif 415#endif
413#ifdef CONFIG_STTY 416#ifdef CONFIG_STTY
414 APPLET(stty, stty_main, _BB_DIR_BIN) 417 APPLET(stty, stty_main, _BB_DIR_BIN, _BB_SUID_NEVER)
418#endif
419#ifdef CONFIG_SU
420 APPLET(su, su_main, _BB_DIR_BIN, _BB_SUID_ALWAYS)
415#endif 421#endif
416#ifdef CONFIG_SWAPONOFF 422#ifdef CONFIG_SWAPONOFF
417 APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN) 423 APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
418#endif 424#endif
419#ifdef CONFIG_SWAPONOFF 425#ifdef CONFIG_SWAPONOFF
420 APPLET(swapon, swap_on_off_main, _BB_DIR_SBIN) 426 APPLET(swapon, swap_on_off_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
421#endif 427#endif
422#ifdef CONFIG_SYNC 428#ifdef CONFIG_SYNC
423 APPLET(sync, sync_main, _BB_DIR_BIN) 429 APPLET(sync, sync_main, _BB_DIR_BIN, _BB_SUID_NEVER)
424#endif 430#endif
425#ifdef CONFIG_SYSLOGD 431#ifdef CONFIG_SYSLOGD
426 APPLET(syslogd, syslogd_main, _BB_DIR_SBIN) 432 APPLET(syslogd, syslogd_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
427#endif 433#endif
428#ifdef CONFIG_TAIL 434#ifdef CONFIG_TAIL
429 APPLET(tail, tail_main, _BB_DIR_USR_BIN) 435 APPLET(tail, tail_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
430#endif 436#endif
431#ifdef CONFIG_TAR 437#ifdef CONFIG_TAR
432 APPLET(tar, tar_main, _BB_DIR_BIN) 438 APPLET(tar, tar_main, _BB_DIR_BIN, _BB_SUID_NEVER)
433#endif 439#endif
434#ifdef CONFIG_TEE 440#ifdef CONFIG_TEE
435 APPLET(tee, tee_main, _BB_DIR_USR_BIN) 441 APPLET(tee, tee_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
436#endif 442#endif
437#ifdef CONFIG_TELNET 443#ifdef CONFIG_TELNET
438 APPLET(telnet, telnet_main, _BB_DIR_USR_BIN) 444 APPLET(telnet, telnet_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
439#endif 445#endif
440#ifdef CONFIG_TEST 446#ifdef CONFIG_TEST
441 APPLET(test, test_main, _BB_DIR_USR_BIN) 447 APPLET(test, test_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
442#endif 448#endif
443#ifdef CONFIG_TFTP 449#ifdef CONFIG_TFTP
444 APPLET(tftp, tftp_main, _BB_DIR_USR_BIN) 450 APPLET(tftp, tftp_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
445#endif 451#endif
446#ifdef CONFIG_TIME 452#ifdef CONFIG_TIME
447 APPLET(time, time_main, _BB_DIR_USR_BIN) 453 APPLET(time, time_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
448#endif 454#endif
449#ifdef CONFIG_TOUCH 455#ifdef CONFIG_TOUCH
450 APPLET(touch, touch_main, _BB_DIR_BIN) 456 APPLET(touch, touch_main, _BB_DIR_BIN, _BB_SUID_NEVER)
451#endif 457#endif
452#ifdef CONFIG_TR 458#ifdef CONFIG_TR
453 APPLET(tr, tr_main, _BB_DIR_USR_BIN) 459 APPLET(tr, tr_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
454#endif 460#endif
455#ifdef CONFIG_TRACEROUTE 461#ifdef CONFIG_TRACEROUTE
456 APPLET(traceroute, traceroute_main, _BB_DIR_USR_BIN) 462 APPLET(traceroute, traceroute_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
457#endif 463#endif
458#ifdef CONFIG_TRUE 464#ifdef CONFIG_TRUE
459 APPLET(true, true_main, _BB_DIR_BIN) 465 APPLET(true, true_main, _BB_DIR_BIN, _BB_SUID_NEVER)
460#endif 466#endif
461#ifdef CONFIG_TTY 467#ifdef CONFIG_TTY
462 APPLET(tty, tty_main, _BB_DIR_USR_BIN) 468 APPLET(tty, tty_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
463#endif 469#endif
464#ifdef CONFIG_UMOUNT 470#ifdef CONFIG_UMOUNT
465 APPLET(umount, umount_main, _BB_DIR_BIN) 471 APPLET(umount, umount_main, _BB_DIR_BIN, _BB_SUID_NEVER)
466#endif 472#endif
467#ifdef CONFIG_UNAME 473#ifdef CONFIG_UNAME
468 APPLET(uname, uname_main, _BB_DIR_BIN) 474 APPLET(uname, uname_main, _BB_DIR_BIN, _BB_SUID_NEVER)
469#endif 475#endif
470#ifdef CONFIG_GUNZIP 476#ifdef CONFIG_GUNZIP
471# ifdef CONFIG_FEATURE_UNCOMPRESS 477# ifdef CONFIG_FEATURE_UNCOMPRESS
472 APPLET_ODDNAME("uncompress", gunzip_main, _BB_DIR_BIN, gunzip) 478 APPLET_ODDNAME("uncompress", gunzip_main, _BB_DIR_BIN, _BB_SUID_NEVER, gunzip)
473# endif 479# endif
474#endif 480#endif
475#ifdef CONFIG_UNIQ 481#ifdef CONFIG_UNIQ
476 APPLET(uniq, uniq_main, _BB_DIR_USR_BIN) 482 APPLET(uniq, uniq_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
477#endif 483#endif
478#ifdef CONFIG_UNIX2DOS 484#ifdef CONFIG_UNIX2DOS
479 APPLET(unix2dos, dos2unix_main, _BB_DIR_USR_BIN) 485 APPLET(unix2dos, dos2unix_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
480#endif 486#endif
481#ifdef CONFIG_UNZIP 487#ifdef CONFIG_UNZIP
482 APPLET(unzip, unzip_main, _BB_DIR_USR_BIN) 488 APPLET(unzip, unzip_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
483#endif 489#endif
484#ifdef CONFIG_UPDATE 490#ifdef CONFIG_UPDATE
485 APPLET(update, update_main, _BB_DIR_SBIN) 491 APPLET(update, update_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
486#endif 492#endif
487#ifdef CONFIG_UPTIME 493#ifdef CONFIG_UPTIME
488 APPLET(uptime, uptime_main, _BB_DIR_USR_BIN) 494 APPLET(uptime, uptime_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
489#endif 495#endif
490#ifdef CONFIG_USLEEP 496#ifdef CONFIG_USLEEP
491 APPLET(usleep, usleep_main, _BB_DIR_BIN) 497 APPLET(usleep, usleep_main, _BB_DIR_BIN, _BB_SUID_NEVER)
492#endif 498#endif
493#ifdef CONFIG_UUDECODE 499#ifdef CONFIG_UUDECODE
494 APPLET(uudecode, uudecode_main, _BB_DIR_USR_BIN) 500 APPLET(uudecode, uudecode_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
495#endif 501#endif
496#ifdef CONFIG_UUENCODE 502#ifdef CONFIG_UUENCODE
497 APPLET(uuencode, uuencode_main, _BB_DIR_USR_BIN) 503 APPLET(uuencode, uuencode_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
498#endif 504#endif
499#ifdef CONFIG_VI 505#ifdef CONFIG_VI
500 APPLET(vi, vi_main, _BB_DIR_BIN) 506 APPLET(vi, vi_main, _BB_DIR_BIN, _BB_SUID_NEVER)
501#endif 507#endif
502#ifdef CONFIG_WATCHDOG 508#ifdef CONFIG_WATCHDOG
503 APPLET(watchdog, watchdog_main, _BB_DIR_SBIN) 509 APPLET(watchdog, watchdog_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
504#endif 510#endif
505#ifdef CONFIG_WC 511#ifdef CONFIG_WC
506 APPLET(wc, wc_main, _BB_DIR_USR_BIN) 512 APPLET(wc, wc_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
507#endif 513#endif
508#ifdef CONFIG_WGET 514#ifdef CONFIG_WGET
509 APPLET(wget, wget_main, _BB_DIR_USR_BIN) 515 APPLET(wget, wget_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
510#endif 516#endif
511#ifdef CONFIG_WHICH 517#ifdef CONFIG_WHICH
512 APPLET(which, which_main, _BB_DIR_USR_BIN) 518 APPLET(which, which_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
513#endif 519#endif
514#ifdef CONFIG_WHO 520#ifdef CONFIG_WHO
515 APPLET(who, who_main, _BB_DIR_USR_BIN) 521 APPLET(who, who_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
516#endif 522#endif
517#ifdef CONFIG_WHOAMI 523#ifdef CONFIG_WHOAMI
518 APPLET(whoami, whoami_main, _BB_DIR_USR_BIN) 524 APPLET(whoami, whoami_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
519#endif 525#endif
520#ifdef CONFIG_XARGS 526#ifdef CONFIG_XARGS
521 APPLET(xargs, xargs_main, _BB_DIR_USR_BIN) 527 APPLET(xargs, xargs_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
522#endif 528#endif
523#ifdef CONFIG_YES 529#ifdef CONFIG_YES
524 APPLET(yes, yes_main, _BB_DIR_USR_BIN) 530 APPLET(yes, yes_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
525#endif 531#endif
526#ifdef CONFIG_GUNZIP 532#ifdef CONFIG_GUNZIP
527 APPLET(zcat, gunzip_main, _BB_DIR_BIN) 533 APPLET(zcat, gunzip_main, _BB_DIR_BIN, _BB_SUID_NEVER)
528#endif 534#endif
529 535
530#if !defined(PROTOTYPES) && !defined(MAKE_USAGE) 536#if !defined(PROTOTYPES) && !defined(MAKE_USAGE)
diff --git a/include/busybox.h b/include/busybox.h
index ea58c0c28..2e54ac55e 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -39,6 +39,7 @@
39 39
40#include <features.h> 40#include <features.h>
41 41
42#include "libbb.h"
42 43
43enum Location { 44enum Location {
44 _BB_DIR_ROOT = 0, 45 _BB_DIR_ROOT = 0,
@@ -48,10 +49,17 @@ enum Location {
48 _BB_DIR_USR_SBIN 49 _BB_DIR_USR_SBIN
49}; 50};
50 51
52enum SUIDRoot {
53 _BB_SUID_NEVER = 0,
54 _BB_SUID_MAYBE,
55 _BB_SUID_ALWAYS
56};
57
51struct BB_applet { 58struct BB_applet {
52 const char* name; 59 const char* name;
53 int (*main)(int argc, char** argv); 60 int (*main)(int argc, char** argv);
54 enum Location location; 61 enum Location location : 4;
62 enum SUIDRoot need_suid : 4;
55}; 63};
56/* From busybox.c */ 64/* From busybox.c */
57extern const struct BB_applet applets[]; 65extern const struct BB_applet applets[];
@@ -99,7 +107,7 @@ extern const struct BB_applet applets[];
99 107
100 108
101/* Pull in the utility routines from libbb */ 109/* Pull in the utility routines from libbb */
102#include "libbb.h" 110// #include "libbb.h"
103 111
104/* Try to pull in PATH_MAX */ 112/* Try to pull in PATH_MAX */
105#include <limits.h> 113#include <limits.h>
diff --git a/include/libbb.h b/include/libbb.h
index 40cff8b4b..0b2411fcd 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -37,6 +37,8 @@
37 37
38#include <features.h> 38#include <features.h>
39 39
40#include "config.h"
41
40#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__) 42#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
41/* libc5 doesn't define socklen_t */ 43/* libc5 doesn't define socklen_t */
42typedef unsigned int socklen_t; 44typedef unsigned int socklen_t;
diff --git a/sysdeps/linux/config.in b/sysdeps/linux/config.in
index f1b064a40..e2ae0e8c4 100644
--- a/sysdeps/linux/config.in
+++ b/sysdeps/linux/config.in
@@ -16,6 +16,14 @@ bool 'Enable locale support (system needs locale for this to work)' CONFIG_LOCAL
16bool 'Support for devfs' CONFIG_FEATURE_DEVFS 16bool 'Support for devfs' CONFIG_FEATURE_DEVFS
17bool 'Support compress format (.Z) in unzip operations' CONFIG_FEATURE_UNCOMPRESS 17bool 'Support compress format (.Z) in unzip operations' CONFIG_FEATURE_UNCOMPRESS
18bool 'Clean up all memory before exiting (usually not needed)' CONFIG_FEATURE_CLEAN_UP 18bool 'Clean up all memory before exiting (usually not needed)' CONFIG_FEATURE_CLEAN_UP
19bool 'Support for SUID/SGID handling' CONFIG_FEATURE_SUID
20if [ "$CONFIG_FEATURE_SUID" = "y" ]; then
21 bool ' Runtime configuration via /etc/busybox.conf' CONFIG_FEATURE_SUID_CONFIG
22fi
23bool 'Use busybox password and group functions' CONFIG_USE_BB_PWD_GRP
24if [ "$CONFIG_USE_BB_PWD_GRP" = "y" ]; then
25 bool ' Use busybox shadow password functions' CONFIG_USE_BB_SHADOW
26fi
19endmenu 27endmenu
20 28
21source archival/config.in 29source archival/config.in
@@ -27,7 +35,7 @@ source init/config.in
27source miscutils/config.in 35source miscutils/config.in
28source modutils/config.in 36source modutils/config.in
29source networking/config.in 37source networking/config.in
30source pwd_grp/config.in 38source loginutils/config.in
31source procps/config.in 39source procps/config.in
32source shell/config.in 40source shell/config.in
33source shellutils/config.in 41source shellutils/config.in