From 37ec9a93b0d1ba7d3252f36842155194c7f0c4c0 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 22 Apr 2009 13:41:59 +1000 Subject: fixes up to 1.6.1 --- Makefile | 2 +- archival/dpkg.c | 2 +- coreutils/echo.c | 6 +++--- coreutils/test.c | 40 ++++++++++++++++++++++++---------------- docs/busybox_footer.pod | 2 +- findutils/grep.c | 32 ++++++++++++++++---------------- libbb/correct_password.c | 11 ++++++++--- loginutils/login.c | 7 +++---- networking/wget.c | 4 ++-- shell/Config.in | 4 ++++ 10 files changed, 63 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 9556a37c4..8718ebb52 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 6 -SUBLEVEL = 0 +SUBLEVEL = 1 EXTRAVERSION = NAME = Unnamed diff --git a/archival/dpkg.c b/archival/dpkg.c index dcbd0d162..0ab54c30e 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1550,7 +1550,7 @@ static void configure_package(deb_file_t *deb_file) /* Run the postinst script */ if (run_package_script(package_name, "postinst") != 0) { /* TODO: handle failure gracefully */ - bb_error_msg_and_die("postrm failure.. set status to what?"); + bb_error_msg_and_die("postinst failure.. set status to what?"); } /* Change status to reflect success */ set_status(status_num, "install", 1); diff --git a/coreutils/echo.c b/coreutils/echo.c index 9aad2c2ba..085e8516c 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c @@ -33,7 +33,9 @@ int bb_echo(char **argv) eflag = '\\', nflag = 1, /* 1 -- print '\n' */ }; - ++argv; + arg = *++argv; + if (!arg) + goto newline_ret; #else const char *p; char nflag = 1; @@ -107,9 +109,7 @@ int bb_echo(char **argv) putchar(' '); } -#if ENABLE_FEATURE_FANCY_ECHO newline_ret: -#endif if (nflag) { putchar('\n'); } diff --git a/coreutils/test.c b/coreutils/test.c index fd10e6845..c26e7e572 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -182,19 +182,23 @@ static void initialize_group_array(void); int bb_test(int argc, char **argv) { int res; + char *arg0; + bool _off; - if (LONE_CHAR(argv[0], '[')) { + arg0 = strrchr(argv[0], '/'); + if (!arg0++) arg0 = argv[0]; + if (arg0[0] == '[') { --argc; - if (NOT_LONE_CHAR(argv[argc], ']')) { - bb_error_msg("missing ]"); - return 2; - } - argv[argc] = NULL; - } else if (strcmp(argv[0], "[[") == 0) { - --argc; - if (strcmp(argv[argc], "]]")) { - bb_error_msg("missing ]]"); - return 2; + if (!arg0[1]) { /* "[" ? */ + if (NOT_LONE_CHAR(argv[argc], ']')) { + bb_error_msg("missing ]"); + return 2; + } + } else { /* assuming "[[" */ + if (strcmp(argv[argc], "]]") != 0) { + bb_error_msg("missing ]]"); + return 2; + } } argv[argc] = NULL; } @@ -219,15 +223,19 @@ int bb_test(int argc, char **argv) if (argc == 2) return *argv[1] == '\0'; //assert(argc); - if (LONE_CHAR(argv[1], '!')) { - bool _off; + /* remember if we saw argc==4 which wants *no* '!' test */ + _off = argc - 4; + if (_off ? + (LONE_CHAR(argv[1], '!')) + : (argv[1][0] != '!' || argv[1][1] != '\0')) + { if (argc == 3) return *argv[2] != '\0'; - _off = argc - 4; + t_lex(argv[2 + _off]); if (t_wp_op && t_wp_op->op_type == BINOP) { t_wp = &argv[1 + _off]; - return binop() == 0; + return binop() == _off; } } t_wp = &argv[1]; @@ -378,7 +386,7 @@ static int binop(void) static int filstat(char *nm, enum token mode) { struct stat s; - int i; + int i = i; /* gcc 3.x thinks it can be used uninitialized */ if (mode == FILSYM) { #ifdef S_IFLNK diff --git a/docs/busybox_footer.pod b/docs/busybox_footer.pod index c678e21ad..15e3a4f32 100644 --- a/docs/busybox_footer.pod +++ b/docs/busybox_footer.pod @@ -254,5 +254,5 @@ Tito Ragusa =cut -# $LastChangedDate$ +# $LastChangedDate: 2007-01-22 18:12:56 +0100 (Пнд, 22 Янв 2007) $ diff --git a/findutils/grep.c b/findutils/grep.c index 59508607f..75425b4df 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -48,11 +48,11 @@ enum { OPTBIT_L, OPTBIT_o, OPTBIT_r, - USE_FEATURE_GREP_CONTEXT(OPTBIT_A ,) - USE_FEATURE_GREP_CONTEXT(OPTBIT_B ,) - USE_FEATURE_GREP_CONTEXT(OPTBIT_C ,) - USE_FEATURE_GREP_CONTEXT(OPTBIT_E ,) - USE_DESKTOP( OPTBIT_w ,) + USE_FEATURE_GREP_CONTEXT( OPTBIT_A ,) + USE_FEATURE_GREP_CONTEXT( OPTBIT_B ,) + USE_FEATURE_GREP_CONTEXT( OPTBIT_C ,) + USE_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) + USE_DESKTOP( OPTBIT_w ,) OPT_l = 1 << OPTBIT_l, OPT_n = 1 << OPTBIT_n, OPT_q = 1 << OPTBIT_q, @@ -68,19 +68,19 @@ enum { OPT_L = 1 << OPTBIT_L, OPT_o = 1 << OPTBIT_o, OPT_r = 1 << OPTBIT_r, - OPT_A = USE_FEATURE_GREP_CONTEXT((1 << OPTBIT_A)) + 0, - OPT_B = USE_FEATURE_GREP_CONTEXT((1 << OPTBIT_B)) + 0, - OPT_C = USE_FEATURE_GREP_CONTEXT((1 << OPTBIT_C)) + 0, - OPT_E = USE_FEATURE_GREP_CONTEXT((1 << OPTBIT_E)) + 0, - OPT_w = USE_DESKTOP( (1 << OPTBIT_w)) + 0, + OPT_A = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0, + OPT_B = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0, + OPT_C = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0, + OPT_E = USE_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0, + OPT_w = USE_DESKTOP( (1 << OPTBIT_w)) + 0, }; -#define PRINT_FILES_WITH_MATCHES (option_mask32 & OPT_l) -#define PRINT_LINE_NUM (option_mask32 & OPT_n) -#define BE_QUIET (option_mask32 & OPT_q) -#define SUPPRESS_ERR_MSGS (option_mask32 & OPT_s) -#define PRINT_MATCH_COUNTS (option_mask32 & OPT_c) -#define FGREP_FLAG (option_mask32 & OPT_F) +#define PRINT_FILES_WITH_MATCHES (option_mask32 & OPT_l) +#define PRINT_LINE_NUM (option_mask32 & OPT_n) +#define BE_QUIET (option_mask32 & OPT_q) +#define SUPPRESS_ERR_MSGS (option_mask32 & OPT_s) +#define PRINT_MATCH_COUNTS (option_mask32 & OPT_c) +#define FGREP_FLAG (option_mask32 & OPT_F) #define PRINT_FILES_WITHOUT_MATCHES (option_mask32 & OPT_L) typedef unsigned char byte_t; diff --git a/libbb/correct_password.c b/libbb/correct_password.c index c515b26af..af6ff076d 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c @@ -31,9 +31,10 @@ #include "libbb.h" /* Ask the user for a password. - Return 1 if the user gives the correct password for entry PW, - 0 if not. Return 1 without asking for a password if run by UID 0 - or if PW has an empty password. */ + * Return 1 if the user gives the correct password for entry PW, + * 0 if not. Return 1 without asking if PW has an empty password. + * + * NULL pw means "just fake it for login with bad username" */ int correct_password(const struct passwd *pw) { @@ -46,6 +47,9 @@ int correct_password(const struct passwd *pw) char buffer[256]; #endif + correct = "aa"; /* fake salt. crypt() can choke otherwise */ + if (!pw) + goto fake_it; /* "aa" will never match */ correct = pw->pw_passwd; #if ENABLE_FEATURE_SHADOWPASSWDS if (LONE_CHAR(pw->pw_passwd, 'x') || LONE_CHAR(pw->pw_passwd, '*')) { @@ -59,6 +63,7 @@ int correct_password(const struct passwd *pw) if (!correct || correct[0] == '\0') return 1; + fake_it: unencrypted = bb_askpass(0, "Password: "); if (!unencrypted) { return 0; diff --git a/loginutils/login.c b/loginutils/login.c index 142695008..b6924b641 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -276,8 +276,8 @@ int login_main(int argc, char **argv) pw = getpwnam(username); if (!pw) { - safe_strncpy(username, "UNKNOWN", sizeof(username)); - goto auth_failed; + strcpy(username, "UNKNOWN"); + goto fake_it; } if (pw->pw_passwd[0] == '!' || pw->pw_passwd[0] == '*') @@ -292,11 +292,10 @@ int login_main(int argc, char **argv) /* Don't check the password if password entry is empty (!) */ if (!pw->pw_passwd[0]) break; - + fake_it: /* authorization takes place here */ if (correct_password(pw)) break; - auth_failed: opt &= ~LOGIN_OPT_f; bb_do_delay(FAIL_DELAY); diff --git a/networking/wget.c b/networking/wget.c index 2c060d77d..c06a09d72 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -267,11 +267,11 @@ int wget_main(int argc, char **argv) #if ENABLE_FEATURE_WGET_AUTHENTICATION if (target.user) { fprintf(sfp, "Authorization: Basic %s\r\n", - base64enc((unsigned char*)target.user, buf, sizeof(buf))); + base64enc((unsigned char*)target.user, buf, strlen(target.user))); } if (use_proxy && server.user) { fprintf(sfp, "Proxy-Authorization: Basic %s\r\n", - base64enc((unsigned char*)server.user, buf, sizeof(buf))); + base64enc((unsigned char*)server.user, buf, strlen(server.user))); } #endif diff --git a/shell/Config.in b/shell/Config.in index 90479013e..0689b4ec2 100644 --- a/shell/Config.in +++ b/shell/Config.in @@ -179,6 +179,7 @@ config HUSH config HUSH_HELP bool "help builtin" default n + depends on HUSH help Enable help builtin in hush. Code size + ~1 kbyte. @@ -206,18 +207,21 @@ config HUSH_JOB config HUSH_TICK bool "Process substitution" default n + depends on HUSH help Enable process substitution `command` and $(command) in hush. config HUSH_IF bool "Support if/then/elif/else/fi" default n + depends on HUSH help Enable if/then/elif/else/fi in hush. config HUSH_LOOPS bool "Support for, while and until loops" default n + depends on HUSH help Enable for, while and until loops in hush. -- cgit v1.2.3-55-g6feb