diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-10 02:01:51 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-10 02:01:51 +0000 |
| commit | 3db254c8866de390c327d759ba615693e45aff6f (patch) | |
| tree | 1dd0f6a0cc97f1f75a7b88d4488d4919ea2417bd | |
| parent | 6cee58e9cfedfa09ede3f5499eb5f635fc2bb77c (diff) | |
| download | busybox-w32-1_8_1.tar.gz busybox-w32-1_8_1.tar.bz2 busybox-w32-1_8_1.zip | |
apply accumulated post 1.8.0 fixes, bump version to 1.8.11_8_1
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | archival/unzip.c | 14 | ||||
| -rw-r--r-- | loginutils/login.c | 65 | ||||
| -rw-r--r-- | modutils/modprobe.c | 2 | ||||
| -rw-r--r-- | networking/telnetd.c | 34 | ||||
| -rw-r--r-- | scripts/defconfig | 18 | ||||
| -rw-r--r-- | sysklogd/syslogd.c | 37 |
7 files changed, 120 insertions, 52 deletions
| @@ -1,6 +1,6 @@ | |||
| 1 | VERSION = 1 | 1 | VERSION = 1 |
| 2 | PATCHLEVEL = 8 | 2 | PATCHLEVEL = 8 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 1 |
| 4 | EXTRAVERSION = | 4 | EXTRAVERSION = |
| 5 | NAME = Unnamed | 5 | NAME = Unnamed |
| 6 | 6 | ||
diff --git a/archival/unzip.c b/archival/unzip.c index 56a5eb625..8462822f1 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
| @@ -41,8 +41,10 @@ enum { | |||
| 41 | #endif | 41 | #endif |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | #define ZIP_HEADER_LEN 26 | ||
| 45 | |||
| 44 | typedef union { | 46 | typedef union { |
| 45 | uint8_t raw[26]; | 47 | uint8_t raw[ZIP_HEADER_LEN]; |
| 46 | struct { | 48 | struct { |
| 47 | uint16_t version; /* 0-1 */ | 49 | uint16_t version; /* 0-1 */ |
| 48 | uint16_t flags; /* 2-3 */ | 50 | uint16_t flags; /* 2-3 */ |
| @@ -57,8 +59,14 @@ typedef union { | |||
| 57 | } formatted ATTRIBUTE_PACKED; | 59 | } formatted ATTRIBUTE_PACKED; |
| 58 | } zip_header_t; | 60 | } zip_header_t; |
| 59 | 61 | ||
| 62 | /* Check the offset of the last element, not the length. This leniency | ||
| 63 | * allows for poor packing, whereby the overall struct may be too long, | ||
| 64 | * even though the elements are all in the right place. | ||
| 65 | */ | ||
| 60 | struct BUG_zip_header_must_be_26_bytes { | 66 | struct BUG_zip_header_must_be_26_bytes { |
| 61 | char BUG_zip_header_must_be_26_bytes[sizeof(zip_header_t) == 26 ? 1 : -1]; | 67 | char BUG_zip_header_must_be_26_bytes[ |
| 68 | offsetof(zip_header_t, formatted.extra_len) + 2 == | ||
| 69 | ZIP_HEADER_LEN ? 1 : -1]; | ||
| 62 | }; | 70 | }; |
| 63 | 71 | ||
| 64 | #define FIX_ENDIANNESS(zip_header) do { \ | 72 | #define FIX_ENDIANNESS(zip_header) do { \ |
| @@ -256,7 +264,7 @@ int unzip_main(int argc, char **argv) | |||
| 256 | bb_error_msg_and_die("invalid zip magic %08X", magic); | 264 | bb_error_msg_and_die("invalid zip magic %08X", magic); |
| 257 | 265 | ||
| 258 | /* Read the file header */ | 266 | /* Read the file header */ |
| 259 | xread(src_fd, zip_header.raw, sizeof(zip_header)); | 267 | xread(src_fd, zip_header.raw, ZIP_HEADER_LEN); |
| 260 | FIX_ENDIANNESS(zip_header); | 268 | FIX_ENDIANNESS(zip_header); |
| 261 | if ((zip_header.formatted.method != 0) && (zip_header.formatted.method != 8)) { | 269 | if ((zip_header.formatted.method != 0) && (zip_header.formatted.method != 8)) { |
| 262 | bb_error_msg_and_die("unsupported method %d", zip_header.formatted.method); | 270 | bb_error_msg_and_die("unsupported method %d", zip_header.formatted.method); |
diff --git a/loginutils/login.c b/loginutils/login.c index bddc0f533..53d3e528b 100644 --- a/loginutils/login.c +++ b/loginutils/login.c | |||
| @@ -239,9 +239,14 @@ int login_main(int argc, char **argv) | |||
| 239 | char full_tty[TTYNAME_SIZE]; | 239 | char full_tty[TTYNAME_SIZE]; |
| 240 | USE_SELINUX(security_context_t user_sid = NULL;) | 240 | USE_SELINUX(security_context_t user_sid = NULL;) |
| 241 | USE_FEATURE_UTMP(struct utmp utent;) | 241 | USE_FEATURE_UTMP(struct utmp utent;) |
| 242 | USE_PAM(pam_handle_t *pamh;) | 242 | #if ENABLE_PAM |
| 243 | USE_PAM(int pamret;) | 243 | int pamret; |
| 244 | USE_PAM(const char *failed_msg;) | 244 | pam_handle_t *pamh; |
| 245 | const char *pamuser; | ||
| 246 | const char *failed_msg; | ||
| 247 | struct passwd pwdstruct; | ||
| 248 | char pwdbuf[256]; | ||
| 249 | #endif | ||
| 245 | 250 | ||
| 246 | short_tty = full_tty; | 251 | short_tty = full_tty; |
| 247 | username[0] = '\0'; | 252 | username[0] = '\0'; |
| @@ -297,18 +302,18 @@ int login_main(int argc, char **argv) | |||
| 297 | #if ENABLE_PAM | 302 | #if ENABLE_PAM |
| 298 | pamret = pam_start("login", username, &conv, &pamh); | 303 | pamret = pam_start("login", username, &conv, &pamh); |
| 299 | if (pamret != PAM_SUCCESS) { | 304 | if (pamret != PAM_SUCCESS) { |
| 300 | failed_msg = "pam_start"; | 305 | failed_msg = "start"; |
| 301 | goto pam_auth_failed; | 306 | goto pam_auth_failed; |
| 302 | } | 307 | } |
| 303 | /* set TTY (so things like securetty work) */ | 308 | /* set TTY (so things like securetty work) */ |
| 304 | pamret = pam_set_item(pamh, PAM_TTY, short_tty); | 309 | pamret = pam_set_item(pamh, PAM_TTY, short_tty); |
| 305 | if (pamret != PAM_SUCCESS) { | 310 | if (pamret != PAM_SUCCESS) { |
| 306 | failed_msg = "pam_set_item(TTY)"; | 311 | failed_msg = "set_item(TTY)"; |
| 307 | goto pam_auth_failed; | 312 | goto pam_auth_failed; |
| 308 | } | 313 | } |
| 309 | pamret = pam_authenticate(pamh, 0); | 314 | pamret = pam_authenticate(pamh, 0); |
| 310 | if (pamret != PAM_SUCCESS) { | 315 | if (pamret != PAM_SUCCESS) { |
| 311 | failed_msg = "pam_authenticate"; | 316 | failed_msg = "authenticate"; |
| 312 | goto pam_auth_failed; | 317 | goto pam_auth_failed; |
| 313 | /* TODO: or just "goto auth_failed" | 318 | /* TODO: or just "goto auth_failed" |
| 314 | * since user seems to enter wrong password | 319 | * since user seems to enter wrong password |
| @@ -318,28 +323,42 @@ int login_main(int argc, char **argv) | |||
| 318 | /* check that the account is healthy */ | 323 | /* check that the account is healthy */ |
| 319 | pamret = pam_acct_mgmt(pamh, 0); | 324 | pamret = pam_acct_mgmt(pamh, 0); |
| 320 | if (pamret != PAM_SUCCESS) { | 325 | if (pamret != PAM_SUCCESS) { |
| 321 | failed_msg = "account setup"; | 326 | failed_msg = "acct_mgmt"; |
| 322 | goto pam_auth_failed; | 327 | goto pam_auth_failed; |
| 323 | } | 328 | } |
| 324 | /* read user back */ | 329 | /* read user back */ |
| 325 | { | 330 | pamuser = NULL; |
| 326 | const char *pamuser; | 331 | /* gcc: "dereferencing type-punned pointer breaks aliasing rules..." |
| 327 | /* gcc: "dereferencing type-punned pointer breaks aliasing rules..." | 332 | * thus we cast to (void*) */ |
| 328 | * thus we cast to (void*) */ | 333 | if (pam_get_item(pamh, PAM_USER, (void*)&pamuser) != PAM_SUCCESS) { |
| 329 | if (pam_get_item(pamh, PAM_USER, (void*)&pamuser) != PAM_SUCCESS) { | 334 | failed_msg = "get_item(USER)"; |
| 330 | failed_msg = "pam_get_item(USER)"; | 335 | goto pam_auth_failed; |
| 331 | goto pam_auth_failed; | ||
| 332 | } | ||
| 333 | safe_strncpy(username, pamuser, sizeof(username)); | ||
| 334 | } | 336 | } |
| 335 | /* If we get here, the user was authenticated, and is | 337 | if (!pamuser || !pamuser[0]) |
| 336 | * granted access. */ | 338 | goto auth_failed; |
| 337 | pw = getpwnam(username); | 339 | safe_strncpy(username, pamuser, sizeof(username)); |
| 338 | if (pw) | 340 | /* Don't use "pw = getpwnam(username);", |
| 339 | break; | 341 | * PAM is said to be capable of destroying static storage |
| 340 | goto auth_failed; | 342 | * used by getpwnam(). We are using safe(r) function */ |
| 343 | pw = NULL; | ||
| 344 | getpwnam_r(username, &pwdstruct, pwdbuf, sizeof(pwdbuf), &pw); | ||
| 345 | if (!pw) | ||
| 346 | goto auth_failed; | ||
| 347 | pamret = pam_open_session(pamh, 0); | ||
| 348 | if (pamret != PAM_SUCCESS) { | ||
| 349 | failed_msg = "open_session"; | ||
| 350 | goto pam_auth_failed; | ||
| 351 | } | ||
| 352 | pamret = pam_setcred(pamh, PAM_ESTABLISH_CRED); | ||
| 353 | if (pamret != PAM_SUCCESS) { | ||
| 354 | failed_msg = "setcred"; | ||
| 355 | goto pam_auth_failed; | ||
| 356 | } | ||
| 357 | break; /* success, continue login process */ | ||
| 358 | |||
| 341 | pam_auth_failed: | 359 | pam_auth_failed: |
| 342 | bb_error_msg("%s failed: %s (%d)", failed_msg, pam_strerror(pamh, pamret), pamret); | 360 | bb_error_msg("pam_%s call failed: %s (%d)", failed_msg, |
| 361 | pam_strerror(pamh, pamret), pamret); | ||
| 343 | safe_strncpy(username, "UNKNOWN", sizeof(username)); | 362 | safe_strncpy(username, "UNKNOWN", sizeof(username)); |
| 344 | #else /* not PAM */ | 363 | #else /* not PAM */ |
| 345 | pw = getpwnam(username); | 364 | pw = getpwnam(username); |
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index f7d193a05..dafbb4ecd 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
| @@ -791,7 +791,7 @@ static void check_dep(char *mod, struct mod_list_t **head, struct mod_list_t **t | |||
| 791 | if (*tail) | 791 | if (*tail) |
| 792 | (*tail)->m_next = find; | 792 | (*tail)->m_next = find; |
| 793 | find->m_prev = *tail; | 793 | find->m_prev = *tail; |
| 794 | /*find->m_next = NULL; - xzalloc did it */ | 794 | find->m_next = NULL; /* possibly NOT done by xzalloc! */ |
| 795 | 795 | ||
| 796 | if (!*head) | 796 | if (!*head) |
| 797 | *head = find; | 797 | *head = find; |
diff --git a/networking/telnetd.c b/networking/telnetd.c index cccf03dfd..108bbf44f 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c | |||
| @@ -279,6 +279,10 @@ make_new_session( | |||
| 279 | /* make new session and process group */ | 279 | /* make new session and process group */ |
| 280 | setsid(); | 280 | setsid(); |
| 281 | 281 | ||
| 282 | /* Restore default signal handling */ | ||
| 283 | signal(SIGCHLD, SIG_DFL); | ||
| 284 | signal(SIGPIPE, SIG_DFL); | ||
| 285 | |||
| 282 | /* open the child's side of the tty. */ | 286 | /* open the child's side of the tty. */ |
| 283 | /* NB: setsid() disconnects from any previous ctty's. Therefore | 287 | /* NB: setsid() disconnects from any previous ctty's. Therefore |
| 284 | * we must open child's side of the tty AFTER setsid! */ | 288 | * we must open child's side of the tty AFTER setsid! */ |
| @@ -302,14 +306,18 @@ make_new_session( | |||
| 302 | /* Uses FILE-based I/O to stdout, but does fflush(stdout), | 306 | /* Uses FILE-based I/O to stdout, but does fflush(stdout), |
| 303 | * so should be safe with vfork. | 307 | * so should be safe with vfork. |
| 304 | * I fear, though, that some users will have ridiculously big | 308 | * I fear, though, that some users will have ridiculously big |
| 305 | * issue files, and they may block writing to fd 1. */ | 309 | * issue files, and they may block writing to fd 1, |
| 310 | * (parent is supposed to read it, but parent waits | ||
| 311 | * for vforked child to exec!) */ | ||
| 306 | print_login_issue(issuefile, NULL); | 312 | print_login_issue(issuefile, NULL); |
| 307 | 313 | ||
| 308 | /* Exec shell / login / whatever */ | 314 | /* Exec shell / login / whatever */ |
| 309 | login_argv[0] = loginpath; | 315 | login_argv[0] = loginpath; |
| 310 | login_argv[1] = NULL; | 316 | login_argv[1] = NULL; |
| 311 | execvp(loginpath, (char **)login_argv); | 317 | /* exec busybox applet (if PREFER_APPLETS=y), if that fails, |
| 312 | /* Safer with vfork, and we shouldn't send message | 318 | * exec external program */ |
| 319 | BB_EXECVP(loginpath, (char **)login_argv); | ||
| 320 | /* _exit is safer with vfork, and we shouldn't send message | ||
| 313 | * to remote clients anyway */ | 321 | * to remote clients anyway */ |
| 314 | _exit(1); /*bb_perror_msg_and_die("execv %s", loginpath);*/ | 322 | _exit(1); /*bb_perror_msg_and_die("execv %s", loginpath);*/ |
| 315 | } | 323 | } |
| @@ -374,7 +382,7 @@ free_session(struct tsession *ts) | |||
| 374 | 382 | ||
| 375 | #else /* !FEATURE_TELNETD_STANDALONE */ | 383 | #else /* !FEATURE_TELNETD_STANDALONE */ |
| 376 | 384 | ||
| 377 | /* Used in main() only, thus exits. */ | 385 | /* Used in main() only, thus "return 0" actually is exit(0). */ |
| 378 | #define free_session(ts) return 0 | 386 | #define free_session(ts) return 0 |
| 379 | 387 | ||
| 380 | #endif | 388 | #endif |
| @@ -384,20 +392,22 @@ static void handle_sigchld(int sig) | |||
| 384 | pid_t pid; | 392 | pid_t pid; |
| 385 | struct tsession *ts; | 393 | struct tsession *ts; |
| 386 | 394 | ||
| 387 | pid = waitpid(-1, &sig, WNOHANG); | 395 | /* Looping: more than one child may have exited */ |
| 388 | if (pid > 0) { | 396 | while (1) { |
| 397 | pid = waitpid(-1, NULL, WNOHANG); | ||
| 398 | if (pid <= 0) | ||
| 399 | break; | ||
| 389 | ts = sessions; | 400 | ts = sessions; |
| 390 | while (ts) { | 401 | while (ts) { |
| 391 | if (ts->shell_pid == pid) { | 402 | if (ts->shell_pid == pid) { |
| 392 | ts->shell_pid = -1; | 403 | ts->shell_pid = -1; |
| 393 | return; | 404 | break; |
| 394 | } | 405 | } |
| 395 | ts = ts->next; | 406 | ts = ts->next; |
| 396 | } | 407 | } |
| 397 | } | 408 | } |
| 398 | } | 409 | } |
| 399 | 410 | ||
| 400 | |||
| 401 | int telnetd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 411 | int telnetd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 402 | int telnetd_main(int argc, char **argv) | 412 | int telnetd_main(int argc, char **argv) |
| 403 | { | 413 | { |
| @@ -430,7 +440,7 @@ int telnetd_main(int argc, char **argv) | |||
| 430 | if (!(opt & OPT_FOREGROUND)) { | 440 | if (!(opt & OPT_FOREGROUND)) { |
| 431 | /* DAEMON_CHDIR_ROOT was giving inconsistent | 441 | /* DAEMON_CHDIR_ROOT was giving inconsistent |
| 432 | * behavior with/without -F, -i */ | 442 | * behavior with/without -F, -i */ |
| 433 | bb_daemonize_or_rexec(0 /*DAEMON_CHDIR_ROOT*/, argv); | 443 | bb_daemonize_or_rexec(0 /*was DAEMON_CHDIR_ROOT*/, argv); |
| 434 | } | 444 | } |
| 435 | } | 445 | } |
| 436 | /* Redirect log to syslog early, if needed */ | 446 | /* Redirect log to syslog early, if needed */ |
| @@ -466,6 +476,8 @@ int telnetd_main(int argc, char **argv) | |||
| 466 | 476 | ||
| 467 | if (opt & OPT_WATCHCHILD) | 477 | if (opt & OPT_WATCHCHILD) |
| 468 | signal(SIGCHLD, handle_sigchld); | 478 | signal(SIGCHLD, handle_sigchld); |
| 479 | else /* prevent dead children from becoming zombies */ | ||
| 480 | signal(SIGCHLD, SIG_IGN); | ||
| 469 | 481 | ||
| 470 | /* | 482 | /* |
| 471 | This is how the buffers are used. The arrows indicate the movement | 483 | This is how the buffers are used. The arrows indicate the movement |
| @@ -497,7 +509,7 @@ int telnetd_main(int argc, char **argv) | |||
| 497 | while (ts) { | 509 | while (ts) { |
| 498 | struct tsession *next = ts->next; /* in case we free ts. */ | 510 | struct tsession *next = ts->next; /* in case we free ts. */ |
| 499 | if (ts->shell_pid == -1) { | 511 | if (ts->shell_pid == -1) { |
| 500 | /* Child died ad we detected that */ | 512 | /* Child died and we detected that */ |
| 501 | free_session(ts); | 513 | free_session(ts); |
| 502 | } else { | 514 | } else { |
| 503 | if (ts->size1 > 0) /* can write to pty */ | 515 | if (ts->size1 > 0) /* can write to pty */ |
| @@ -514,7 +526,7 @@ int telnetd_main(int argc, char **argv) | |||
| 514 | if (!IS_INETD) { | 526 | if (!IS_INETD) { |
| 515 | FD_SET(master_fd, &rdfdset); | 527 | FD_SET(master_fd, &rdfdset); |
| 516 | /* This is needed because free_session() does not | 528 | /* This is needed because free_session() does not |
| 517 | * take into account master_fd when it finds new | 529 | * take master_fd into account when it finds new |
| 518 | * maxfd among remaining fd's */ | 530 | * maxfd among remaining fd's */ |
| 519 | if (master_fd > maxfd) | 531 | if (master_fd > maxfd) |
| 520 | maxfd = master_fd; | 532 | maxfd = master_fd; |
diff --git a/scripts/defconfig b/scripts/defconfig index 7cd17ec64..5c359a843 100644 --- a/scripts/defconfig +++ b/scripts/defconfig | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | # | 1 | # |
| 2 | # | ||
| 3 | CONFIG_HAVE_DOT_CONFIG=y | 2 | CONFIG_HAVE_DOT_CONFIG=y |
| 4 | 3 | ||
| 5 | # | 4 | # |
| @@ -37,10 +36,9 @@ CONFIG_FEATURE_HAVE_RPC=y | |||
| 37 | # | 36 | # |
| 38 | # CONFIG_STATIC is not set | 37 | # CONFIG_STATIC is not set |
| 39 | # CONFIG_BUILD_LIBBUSYBOX is not set | 38 | # CONFIG_BUILD_LIBBUSYBOX is not set |
| 40 | # CONFIG_FEATURE_FULL_LIBBUSYBOX is not set | 39 | # CONFIG_FEATURE_INDIVIDUAL is not set |
| 41 | # CONFIG_FEATURE_SHARED_BUSYBOX is not set | 40 | # CONFIG_FEATURE_SHARED_BUSYBOX is not set |
| 42 | CONFIG_LFS=y | 41 | CONFIG_LFS=y |
| 43 | # CONFIG_BUILD_AT_ONCE is not set | ||
| 44 | 42 | ||
| 45 | # | 43 | # |
| 46 | # Debugging Options | 44 | # Debugging Options |
| @@ -58,7 +56,11 @@ CONFIG_INCLUDE_SUSv2=y | |||
| 58 | # CONFIG_INSTALL_NO_USR is not set | 56 | # CONFIG_INSTALL_NO_USR is not set |
| 59 | CONFIG_INSTALL_APPLET_SYMLINKS=y | 57 | CONFIG_INSTALL_APPLET_SYMLINKS=y |
| 60 | # CONFIG_INSTALL_APPLET_HARDLINKS is not set | 58 | # CONFIG_INSTALL_APPLET_HARDLINKS is not set |
| 59 | # CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set | ||
| 61 | # CONFIG_INSTALL_APPLET_DONT is not set | 60 | # CONFIG_INSTALL_APPLET_DONT is not set |
| 61 | # CONFIG_INSTALL_SH_APPLET_SYMLINK is not set | ||
| 62 | # CONFIG_INSTALL_SH_APPLET_HARDLINK is not set | ||
| 63 | # CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set | ||
| 62 | CONFIG_PREFIX="./_install" | 64 | CONFIG_PREFIX="./_install" |
| 63 | 65 | ||
| 64 | # | 66 | # |
| @@ -90,6 +92,7 @@ CONFIG_IOCTL_HEX2STR_ERROR=y | |||
| 90 | CONFIG_AR=y | 92 | CONFIG_AR=y |
| 91 | CONFIG_FEATURE_AR_LONG_FILENAMES=y | 93 | CONFIG_FEATURE_AR_LONG_FILENAMES=y |
| 92 | CONFIG_BUNZIP2=y | 94 | CONFIG_BUNZIP2=y |
| 95 | CONFIG_BZIP2=y | ||
| 93 | CONFIG_CPIO=y | 96 | CONFIG_CPIO=y |
| 94 | # CONFIG_DPKG is not set | 97 | # CONFIG_DPKG is not set |
| 95 | # CONFIG_DPKG_DEB is not set | 98 | # CONFIG_DPKG_DEB is not set |
| @@ -261,6 +264,7 @@ CONFIG_CHVT=y | |||
| 261 | CONFIG_CLEAR=y | 264 | CONFIG_CLEAR=y |
| 262 | CONFIG_DEALLOCVT=y | 265 | CONFIG_DEALLOCVT=y |
| 263 | CONFIG_DUMPKMAP=y | 266 | CONFIG_DUMPKMAP=y |
| 267 | CONFIG_KBD_MODE=y | ||
| 264 | CONFIG_LOADFONT=y | 268 | CONFIG_LOADFONT=y |
| 265 | CONFIG_LOADKMAP=y | 269 | CONFIG_LOADKMAP=y |
| 266 | CONFIG_OPENVT=y | 270 | CONFIG_OPENVT=y |
| @@ -465,6 +469,7 @@ CONFIG_FEATURE_MKSWAP_V0=y | |||
| 465 | CONFIG_MORE=y | 469 | CONFIG_MORE=y |
| 466 | CONFIG_FEATURE_USE_TERMIOS=y | 470 | CONFIG_FEATURE_USE_TERMIOS=y |
| 467 | CONFIG_MOUNT=y | 471 | CONFIG_MOUNT=y |
| 472 | CONFIG_FEATURE_MOUNT_HELPERS=y | ||
| 468 | CONFIG_FEATURE_MOUNT_NFS=y | 473 | CONFIG_FEATURE_MOUNT_NFS=y |
| 469 | CONFIG_FEATURE_MOUNT_CIFS=y | 474 | CONFIG_FEATURE_MOUNT_CIFS=y |
| 470 | CONFIG_FEATURE_MOUNT_FLAGS=y | 475 | CONFIG_FEATURE_MOUNT_FLAGS=y |
| @@ -549,6 +554,7 @@ CONFIG_FTPPUT=y | |||
| 549 | CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y | 554 | CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y |
| 550 | CONFIG_HOSTNAME=y | 555 | CONFIG_HOSTNAME=y |
| 551 | CONFIG_HTTPD=y | 556 | CONFIG_HTTPD=y |
| 557 | CONFIG_FEATURE_HTTPD_RANGES=y | ||
| 552 | CONFIG_FEATURE_HTTPD_USE_SENDFILE=y | 558 | CONFIG_FEATURE_HTTPD_USE_SENDFILE=y |
| 553 | # CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP is not set | 559 | # CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP is not set |
| 554 | # CONFIG_FEATURE_HTTPD_SETUID is not set | 560 | # CONFIG_FEATURE_HTTPD_SETUID is not set |
| @@ -560,6 +566,7 @@ CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y | |||
| 560 | CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y | 566 | CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y |
| 561 | CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y | 567 | CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y |
| 562 | CONFIG_FEATURE_HTTPD_ERROR_PAGES=y | 568 | CONFIG_FEATURE_HTTPD_ERROR_PAGES=y |
| 569 | CONFIG_FEATURE_HTTPD_PROXY=y | ||
| 563 | CONFIG_IFCONFIG=y | 570 | CONFIG_IFCONFIG=y |
| 564 | CONFIG_FEATURE_IFCONFIG_STATUS=y | 571 | CONFIG_FEATURE_IFCONFIG_STATUS=y |
| 565 | CONFIG_FEATURE_IFCONFIG_SLIP=y | 572 | CONFIG_FEATURE_IFCONFIG_SLIP=y |
| @@ -589,6 +596,7 @@ CONFIG_FEATURE_IP_ROUTE=y | |||
| 589 | CONFIG_FEATURE_IP_TUNNEL=y | 596 | CONFIG_FEATURE_IP_TUNNEL=y |
| 590 | CONFIG_FEATURE_IP_RULE=y | 597 | CONFIG_FEATURE_IP_RULE=y |
| 591 | CONFIG_FEATURE_IP_SHORT_FORMS=y | 598 | CONFIG_FEATURE_IP_SHORT_FORMS=y |
| 599 | CONFIG_FEATURE_IP_RARE_PROTOCOLS=y | ||
| 592 | CONFIG_IPADDR=y | 600 | CONFIG_IPADDR=y |
| 593 | CONFIG_IPLINK=y | 601 | CONFIG_IPLINK=y |
| 594 | CONFIG_IPROUTE=y | 602 | CONFIG_IPROUTE=y |
| @@ -647,9 +655,11 @@ CONFIG_KILL=y | |||
| 647 | CONFIG_KILLALL=y | 655 | CONFIG_KILLALL=y |
| 648 | CONFIG_KILLALL5=y | 656 | CONFIG_KILLALL5=y |
| 649 | CONFIG_NMETER=y | 657 | CONFIG_NMETER=y |
| 658 | CONFIG_PGREP=y | ||
| 650 | CONFIG_PIDOF=y | 659 | CONFIG_PIDOF=y |
| 651 | CONFIG_FEATURE_PIDOF_SINGLE=y | 660 | CONFIG_FEATURE_PIDOF_SINGLE=y |
| 652 | CONFIG_FEATURE_PIDOF_OMIT=y | 661 | CONFIG_FEATURE_PIDOF_OMIT=y |
| 662 | CONFIG_PKILL=y | ||
| 653 | CONFIG_PS=y | 663 | CONFIG_PS=y |
| 654 | CONFIG_FEATURE_PS_WIDE=y | 664 | CONFIG_FEATURE_PS_WIDE=y |
| 655 | CONFIG_RENICE=y | 665 | CONFIG_RENICE=y |
| @@ -658,6 +668,7 @@ CONFIG_TOP=y | |||
| 658 | CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y | 668 | CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y |
| 659 | CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y | 669 | CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y |
| 660 | # CONFIG_FEATURE_TOP_DECIMALS is not set | 670 | # CONFIG_FEATURE_TOP_DECIMALS is not set |
| 671 | CONFIG_FEATURE_TOPMEM=y | ||
| 661 | CONFIG_UPTIME=y | 672 | CONFIG_UPTIME=y |
| 662 | CONFIG_WATCH=y | 673 | CONFIG_WATCH=y |
| 663 | 674 | ||
| @@ -743,6 +754,7 @@ CONFIG_SOFTLIMIT=y | |||
| 743 | # CONFIG_SETENFORCE is not set | 754 | # CONFIG_SETENFORCE is not set |
| 744 | # CONFIG_SETFILES is not set | 755 | # CONFIG_SETFILES is not set |
| 745 | # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set | 756 | # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set |
| 757 | # CONFIG_SETSEBOOL is not set | ||
| 746 | 758 | ||
| 747 | # | 759 | # |
| 748 | # ipsvd utilities | 760 | # ipsvd utilities |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index ba46792b6..da63ced42 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
| @@ -381,8 +381,8 @@ static void parse_fac_prio_20(int pri, char *res20) | |||
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | /* len parameter is used only for "is there a timestamp?" check. | 383 | /* len parameter is used only for "is there a timestamp?" check. |
| 384 | * NB: some callers cheat and supply 0 when they know | 384 | * NB: some callers cheat and supply len==0 when they know |
| 385 | * that there is no timestamp, short-cutting the test. */ | 385 | * that there is no timestamp, short-circuiting the test. */ |
| 386 | static void timestamp_and_log(int pri, char *msg, int len) | 386 | static void timestamp_and_log(int pri, char *msg, int len) |
| 387 | { | 387 | { |
| 388 | char *timestamp; | 388 | char *timestamp; |
| @@ -427,10 +427,10 @@ static void split_escape_and_log(char *tmpbuf, int len) | |||
| 427 | if (*p == '<') { | 427 | if (*p == '<') { |
| 428 | /* Parse the magic priority number */ | 428 | /* Parse the magic priority number */ |
| 429 | pri = bb_strtou(p + 1, &p, 10); | 429 | pri = bb_strtou(p + 1, &p, 10); |
| 430 | if (*p == '>') p++; | 430 | if (*p == '>') |
| 431 | if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) { | 431 | p++; |
| 432 | if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) | ||
| 432 | pri = (LOG_USER | LOG_NOTICE); | 433 | pri = (LOG_USER | LOG_NOTICE); |
| 433 | } | ||
| 434 | } | 434 | } |
| 435 | 435 | ||
| 436 | while ((c = *p++)) { | 436 | while ((c = *p++)) { |
| @@ -526,14 +526,32 @@ static void do_syslogd(void) | |||
| 526 | 526 | ||
| 527 | for (;;) { | 527 | for (;;) { |
| 528 | size_t sz; | 528 | size_t sz; |
| 529 | 529 | read_again: | |
| 530 | sz = safe_read(sock_fd, G.recvbuf, MAX_READ - 1); | 530 | sz = safe_read(sock_fd, G.recvbuf, MAX_READ - 1); |
| 531 | if (sz <= 0) { | 531 | if (sz < 0) { |
| 532 | //if (sz == 0) | ||
| 533 | // continue; /* EOF from unix socket??? */ | ||
| 534 | bb_perror_msg_and_die("read from /dev/log"); | 532 | bb_perror_msg_and_die("read from /dev/log"); |
| 535 | } | 533 | } |
| 536 | 534 | ||
| 535 | /* Drop trailing NULs (typically there is one NUL) */ | ||
| 536 | while (1) { | ||
| 537 | if (sz == 0) | ||
| 538 | goto read_again; | ||
| 539 | /* man 3 syslog says: "A trailing newline is added when needed". | ||
| 540 | * However, neither glibc nor uclibc do this: | ||
| 541 | * syslog(prio, "test") sends "test\0" to /dev/log, | ||
| 542 | * syslog(prio, "test\n") sends "test\n\0", | ||
| 543 | * IOW: newline is passed verbatim! | ||
| 544 | * I take it to mean that it's syslogd's job | ||
| 545 | * to make those look identical in the log files */ | ||
| 546 | if (G.recvbuf[sz-1] && G.recvbuf[sz-1] != '\n') | ||
| 547 | break; | ||
| 548 | sz--; | ||
| 549 | } | ||
| 550 | /* Maybe we need to add '\n' here, not later? | ||
| 551 | * It looks like stock syslogd does send '\n' over network, | ||
| 552 | * but we do not (see sendto below) */ | ||
| 553 | G.recvbuf[sz] = '\0'; /* make sure it *is* NUL terminated */ | ||
| 554 | |||
| 537 | /* TODO: maybe suppress duplicates? */ | 555 | /* TODO: maybe suppress duplicates? */ |
| 538 | #if ENABLE_FEATURE_REMOTE_LOG | 556 | #if ENABLE_FEATURE_REMOTE_LOG |
| 539 | /* We are not modifying log messages in any way before send */ | 557 | /* We are not modifying log messages in any way before send */ |
| @@ -549,7 +567,6 @@ static void do_syslogd(void) | |||
| 549 | } | 567 | } |
| 550 | } | 568 | } |
| 551 | #endif | 569 | #endif |
| 552 | G.recvbuf[sz] = '\0'; | ||
| 553 | split_escape_and_log(G.recvbuf, sz); | 570 | split_escape_and_log(G.recvbuf, sz); |
| 554 | } /* for */ | 571 | } /* for */ |
| 555 | } | 572 | } |
