diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-26 17:37:38 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-26 17:37:38 +0000 |
commit | bfa21cc6ff4902cb8a48e574cce5c78f5fd98ee6 (patch) | |
tree | da5995d46e8f5505cf0af5d3049087f7d7cf5d16 | |
parent | 52f326a239527e7242321661d2ba06b50daa3c43 (diff) | |
download | busybox-w32-bfa21cc6ff4902cb8a48e574cce5c78f5fd98ee6.tar.gz busybox-w32-bfa21cc6ff4902cb8a48e574cce5c78f5fd98ee6.tar.bz2 busybox-w32-bfa21cc6ff4902cb8a48e574cce5c78f5fd98ee6.zip |
adduser: trivial code movement
git-svn-id: svn://busybox.net/trunk/busybox@17082 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | Config.in | 2 | ||||
-rw-r--r-- | examples/udhcp/udhcpd.conf | 2 | ||||
-rw-r--r-- | loginutils/adduser.c | 12 |
3 files changed, 8 insertions, 8 deletions
@@ -441,7 +441,7 @@ config INSTALL_APPLET_DONT | |||
441 | prompt "not installed" | 441 | prompt "not installed" |
442 | depends on FEATURE_INSTALLER || FEATURE_SH_STANDALONE_SHELL | 442 | depends on FEATURE_INSTALLER || FEATURE_SH_STANDALONE_SHELL |
443 | help | 443 | help |
444 | Do not install applets links. Usefull when using the -install feature | 444 | Do not install applet links. Useful when using the -install feature |
445 | or a standalone shell for rescue pruposes. | 445 | or a standalone shell for rescue pruposes. |
446 | 446 | ||
447 | endchoice | 447 | endchoice |
diff --git a/examples/udhcp/udhcpd.conf b/examples/udhcp/udhcpd.conf index f91fddebf..34e47f788 100644 --- a/examples/udhcp/udhcpd.conf +++ b/examples/udhcp/udhcpd.conf | |||
@@ -67,7 +67,7 @@ interface eth0 #default: eth0 | |||
67 | 67 | ||
68 | #notify_file #default: (no script) | 68 | #notify_file #default: (no script) |
69 | 69 | ||
70 | #notify_file dumpleases # <--- usefull for debugging | 70 | #notify_file dumpleases # <--- useful for debugging |
71 | 71 | ||
72 | # The following are bootp specific options, setable by udhcpd. | 72 | # The following are bootp specific options, setable by udhcpd. |
73 | 73 | ||
diff --git a/loginutils/adduser.c b/loginutils/adduser.c index 44516ef5a..418d4c785 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c | |||
@@ -164,6 +164,11 @@ int adduser_main(int argc, char **argv) | |||
164 | const char *usegroup = NULL; | 164 | const char *usegroup = NULL; |
165 | unsigned long flags; | 165 | unsigned long flags; |
166 | 166 | ||
167 | /* got root? */ | ||
168 | if (geteuid()) { | ||
169 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); | ||
170 | } | ||
171 | |||
167 | pw.pw_gecos = "Linux User,,,"; | 172 | pw.pw_gecos = "Linux User,,,"; |
168 | pw.pw_shell = (char *)DEFAULT_SHELL; | 173 | pw.pw_shell = (char *)DEFAULT_SHELL; |
169 | pw.pw_dir = NULL; | 174 | pw.pw_dir = NULL; |
@@ -172,15 +177,10 @@ int adduser_main(int argc, char **argv) | |||
172 | opt_complementary = "-1:?1:?"; | 177 | opt_complementary = "-1:?1:?"; |
173 | flags = getopt32(argc, argv, "h:g:s:G:DSH", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup); | 178 | flags = getopt32(argc, argv, "h:g:s:G:DSH", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup); |
174 | 179 | ||
175 | /* got root? */ | ||
176 | if(geteuid()) { | ||
177 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); | ||
178 | } | ||
179 | |||
180 | /* create string for $HOME if not specified already */ | 180 | /* create string for $HOME if not specified already */ |
181 | if (!pw.pw_dir) { | 181 | if (!pw.pw_dir) { |
182 | snprintf(bb_common_bufsiz1, BUFSIZ, "/home/%s", argv[optind]); | 182 | snprintf(bb_common_bufsiz1, BUFSIZ, "/home/%s", argv[optind]); |
183 | pw.pw_dir = &bb_common_bufsiz1[0]; | 183 | pw.pw_dir = bb_common_bufsiz1; |
184 | } | 184 | } |
185 | 185 | ||
186 | /* create a passwd struct */ | 186 | /* create a passwd struct */ |