diff options
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/add-remove-shell.c | 4 | ||||
-rw-r--r-- | loginutils/adduser.c | 11 | ||||
-rw-r--r-- | loginutils/getty.c | 7 | ||||
-rw-r--r-- | loginutils/login.c | 3 |
4 files changed, 18 insertions, 7 deletions
diff --git a/loginutils/add-remove-shell.c b/loginutils/add-remove-shell.c index e492b6e5a..9419ff5e7 100644 --- a/loginutils/add-remove-shell.c +++ b/loginutils/add-remove-shell.c | |||
@@ -100,7 +100,7 @@ int add_remove_shell_main(int argc UNUSED_PARAM, char **argv) | |||
100 | cpp++; | 100 | cpp++; |
101 | } | 101 | } |
102 | /* copy shell name from old to new file */ | 102 | /* copy shell name from old to new file */ |
103 | printf("%s\n", line); | 103 | puts(line); |
104 | next_line: | 104 | next_line: |
105 | free(line); | 105 | free(line); |
106 | } | 106 | } |
@@ -112,7 +112,7 @@ int add_remove_shell_main(int argc UNUSED_PARAM, char **argv) | |||
112 | char **cpp = argv; | 112 | char **cpp = argv; |
113 | while (*cpp) { | 113 | while (*cpp) { |
114 | if (*cpp != dont_add) | 114 | if (*cpp != dont_add) |
115 | printf("%s\n", *cpp); | 115 | puts(*cpp); |
116 | cpp++; | 116 | cpp++; |
117 | } | 117 | } |
118 | } | 118 | } |
diff --git a/loginutils/adduser.c b/loginutils/adduser.c index 568a3018e..605e3363f 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c | |||
@@ -20,6 +20,7 @@ | |||
20 | //usage: "\n -D Don't assign a password" | 20 | //usage: "\n -D Don't assign a password" |
21 | //usage: "\n -H Don't create home directory" | 21 | //usage: "\n -H Don't create home directory" |
22 | //usage: "\n -u UID User id" | 22 | //usage: "\n -u UID User id" |
23 | //usage: "\n -k SKEL Skeleton directory (/etc/skel)" | ||
23 | 24 | ||
24 | #include "libbb.h" | 25 | #include "libbb.h" |
25 | 26 | ||
@@ -39,6 +40,7 @@ | |||
39 | #define OPT_SYSTEM_ACCOUNT (1 << 5) | 40 | #define OPT_SYSTEM_ACCOUNT (1 << 5) |
40 | #define OPT_DONT_MAKE_HOME (1 << 6) | 41 | #define OPT_DONT_MAKE_HOME (1 << 6) |
41 | #define OPT_UID (1 << 7) | 42 | #define OPT_UID (1 << 7) |
43 | #define OPT_SKEL (1 << 8) | ||
42 | 44 | ||
43 | /* remix */ | 45 | /* remix */ |
44 | /* recoded such that the uid may be passed in *p */ | 46 | /* recoded such that the uid may be passed in *p */ |
@@ -134,6 +136,7 @@ static const char adduser_longopts[] ALIGN1 = | |||
134 | "system\0" No_argument "S" | 136 | "system\0" No_argument "S" |
135 | "no-create-home\0" No_argument "H" | 137 | "no-create-home\0" No_argument "H" |
136 | "uid\0" Required_argument "u" | 138 | "uid\0" Required_argument "u" |
139 | "skel\0" Required_argument "k" | ||
137 | ; | 140 | ; |
138 | #endif | 141 | #endif |
139 | 142 | ||
@@ -150,6 +153,7 @@ int adduser_main(int argc UNUSED_PARAM, char **argv) | |||
150 | char *p; | 153 | char *p; |
151 | unsigned opts; | 154 | unsigned opts; |
152 | char *uid; | 155 | char *uid; |
156 | const char *skel = "/etc/skel"; | ||
153 | 157 | ||
154 | #if ENABLE_FEATURE_ADDUSER_LONG_OPTIONS | 158 | #if ENABLE_FEATURE_ADDUSER_LONG_OPTIONS |
155 | applet_long_options = adduser_longopts; | 159 | applet_long_options = adduser_longopts; |
@@ -168,7 +172,7 @@ int adduser_main(int argc UNUSED_PARAM, char **argv) | |||
168 | /* at least one and at most two non-option args */ | 172 | /* at least one and at most two non-option args */ |
169 | /* disable interactive passwd for system accounts */ | 173 | /* disable interactive passwd for system accounts */ |
170 | opt_complementary = "-1:?2:SD"; | 174 | opt_complementary = "-1:?2:SD"; |
171 | opts = getopt32(argv, "h:g:s:G:DSHu:", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup, &uid); | 175 | opts = getopt32(argv, "h:g:s:G:DSHu:k:", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup, &uid, &skel); |
172 | if (opts & OPT_UID) | 176 | if (opts & OPT_UID) |
173 | pw.pw_uid = xatou_range(uid, 0, CONFIG_LAST_ID); | 177 | pw.pw_uid = xatou_range(uid, 0, CONFIG_LAST_ID); |
174 | 178 | ||
@@ -250,8 +254,9 @@ int adduser_main(int argc UNUSED_PARAM, char **argv) | |||
250 | NULL | 254 | NULL |
251 | }; | 255 | }; |
252 | /* Be silent on any errors (like: no /etc/skel) */ | 256 | /* Be silent on any errors (like: no /etc/skel) */ |
253 | logmode = LOGMODE_NONE; | 257 | if (!(opts & OPT_SKEL)) |
254 | copy_file("/etc/skel", pw.pw_dir, FILEUTILS_RECUR); | 258 | logmode = LOGMODE_NONE; |
259 | copy_file(skel, pw.pw_dir, FILEUTILS_RECUR); | ||
255 | logmode = LOGMODE_STDIO; | 260 | logmode = LOGMODE_STDIO; |
256 | chown_main(4, (char**)args); | 261 | chown_main(4, (char**)args); |
257 | } | 262 | } |
diff --git a/loginutils/getty.c b/loginutils/getty.c index 174542841..762d5c773 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -520,6 +520,11 @@ static void alarm_handler(int sig UNUSED_PARAM) | |||
520 | _exit(EXIT_SUCCESS); | 520 | _exit(EXIT_SUCCESS); |
521 | } | 521 | } |
522 | 522 | ||
523 | static void sleep10(void) | ||
524 | { | ||
525 | sleep(10); | ||
526 | } | ||
527 | |||
523 | int getty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 528 | int getty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
524 | int getty_main(int argc UNUSED_PARAM, char **argv) | 529 | int getty_main(int argc UNUSED_PARAM, char **argv) |
525 | { | 530 | { |
@@ -599,7 +604,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv) | |||
599 | close(n--); | 604 | close(n--); |
600 | 605 | ||
601 | /* Logging. We want special flavor of error_msg_and_die */ | 606 | /* Logging. We want special flavor of error_msg_and_die */ |
602 | die_sleep = 10; | 607 | die_func = sleep10; |
603 | msg_eol = "\r\n"; | 608 | msg_eol = "\r\n"; |
604 | /* most likely will internally use fd #3 in CLOEXEC mode: */ | 609 | /* most likely will internally use fd #3 in CLOEXEC mode: */ |
605 | openlog(applet_name, LOG_PID, LOG_AUTH); | 610 | openlog(applet_name, LOG_PID, LOG_AUTH); |
diff --git a/loginutils/login.c b/loginutils/login.c index b9d910331..1700cfcb5 100644 --- a/loginutils/login.c +++ b/loginutils/login.c | |||
@@ -489,7 +489,8 @@ int login_main(int argc UNUSED_PARAM, char **argv) | |||
489 | } | 489 | } |
490 | #endif | 490 | #endif |
491 | 491 | ||
492 | motd(); | 492 | if (access(".hushlogin", F_OK) != 0) |
493 | motd(); | ||
493 | 494 | ||
494 | if (pw->pw_uid == 0) | 495 | if (pw->pw_uid == 0) |
495 | syslog(LOG_INFO, "root login%s", fromhost); | 496 | syslog(LOG_INFO, "root login%s", fromhost); |