Compare commits

...
10 Commits
12 changed files with 71 additions and 58 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
VERSION = 1
PATCHLEVEL = 6
SUBLEVEL = 0
SUBLEVEL = 2
EXTRAVERSION =
NAME = Unnamed
+1 -1
View File
@@ -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);
+1 -7
View File
@@ -32,16 +32,10 @@
#define DATE_OPT_TIMESPEC 0x20
#define DATE_OPT_HINT 0x40
static void xputenv(char *s)
{
if (putenv(s) != 0)
bb_error_msg_and_die(bb_msg_memory_exhausted);
}
static void maybe_set_utc(int opt)
{
if (opt & DATE_OPT_UTC)
xputenv((char*)"TZ=UTC0");
putenv((char*)"TZ=UTC0");
}
int date_main(int argc, char **argv);
+3 -3
View File
@@ -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');
}
+24 -16
View File
@@ -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
+16 -16
View File
@@ -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;
+3
View File
@@ -277,6 +277,9 @@ static void console_init(void)
while (fd > 2) close(fd--);
}
messageD(L_LOG, "console='%s'", s);
} else {
/* Make sure fd 0,1,2 are not closed */
bb_sanitize_stdio();
}
s = getenv("TERM");
+8 -3
View File
@@ -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;
+5 -5
View File
@@ -109,8 +109,9 @@ static int adduser(struct passwd *p)
if (putpwent(p, file) == -1) {
bb_perror_nomsg_and_die();
}
if (ENABLE_FEATURE_CLEAN_UP)
fclose(file);
/* Do fclose even if !ENABLE_FEATURE_CLEAN_UP.
* We will exec passwd, files must be flushed & closed before that! */
fclose(file);
#if ENABLE_FEATURE_SHADOWPASSWDS
/* add to shadow if necessary */
@@ -123,8 +124,7 @@ static int adduser(struct passwd *p)
0, /* sp->sp_min */
99999, /* sp->sp_max */
7); /* sp->sp_warn */
if (ENABLE_FEATURE_CLEAN_UP)
fclose(file);
fclose(file);
}
#endif
@@ -134,7 +134,7 @@ static int adduser(struct passwd *p)
if (addgroup) addgroup_wrapper(p);
/* Clear the umask for this process so it doesn't
* * screw up the permissions on the mkdir and chown. */
* screw up the permissions on the mkdir and chown. */
umask(0);
if (!(option_mask32 & OPT_DONT_MAKE_HOME)) {
/* Set the owner and group so it is owned by the new user,
+3 -4
View File
@@ -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);
+2 -2
View File
@@ -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
+4
View File
@@ -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.