mirror of
https://gitlab.com/padavan-ng/padavan-ng.git
synced 2024-02-13 08:33:30 +08:00
busybox: apply openwrt patches
100-trylink_bash.patch 101-gen_build_files_bash.patch 110-no_static_libgcc.patch 120-lto-jobserver.patch 130-mconf_missing_sigwinch.patch 200-udhcpc_reduce_msgs.patch 201-udhcpc_changed_ifindex.patch 203-udhcpc_renew_no_deconfig.patch 240-telnetd_intr.patch 250-date-k-flag.patch 270-libbb_make_unicode_printable.patch 301-ip-link-fix-netlink-msg-size.patch 500-move-traceroute-applets-to-bin.patch 510-move-passwd-applet-to-bin.patch 520-loginutils-handle-crypt-failures.patch
This commit is contained in:
@ -51,7 +51,7 @@ CFLAGS += $(call cc-option,-fno-builtin-strlen -finline-limit=0 -fomit-frame-poi
|
||||
# -fno-guess-branch-probability: prohibit pseudo-random guessing
|
||||
# of branch probabilities (hopefully makes bloatcheck more stable):
|
||||
CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
|
||||
CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
|
||||
CFLAGS += $(call cc-option,-funsigned-char,)
|
||||
CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,)
|
||||
# Defeat .eh_frame bloat (gcc 4.6.3 x86-32 defconfig: 20% smaller busybox binary):
|
||||
CFLAGS += $(call cc-option,-fno-unwind-tables,)
|
||||
|
@ -123,6 +123,7 @@
|
||||
//usage: IF_FEATURE_DATE_ISOFMT(
|
||||
//usage: "\n -D FMT Use FMT for -d TIME conversion"
|
||||
//usage: )
|
||||
//usage: "\n -k Set Kernel timezone from localtime and exit"
|
||||
//usage: "\n"
|
||||
//usage: "\nRecognized TIME formats:"
|
||||
//usage: "\n hh:mm[:ss]"
|
||||
@ -139,9 +140,8 @@
|
||||
|
||||
#include "libbb.h"
|
||||
#include "common_bufsiz.h"
|
||||
#if ENABLE_FEATURE_DATE_NANO
|
||||
# include <sys/syscall.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
enum {
|
||||
OPT_RFC2822 = (1 << 0), /* R */
|
||||
@ -149,8 +149,9 @@ enum {
|
||||
OPT_UTC = (1 << 2), /* u */
|
||||
OPT_DATE = (1 << 3), /* d */
|
||||
OPT_REFERENCE = (1 << 4), /* r */
|
||||
OPT_TIMESPEC = (1 << 5) * ENABLE_FEATURE_DATE_ISOFMT, /* I */
|
||||
OPT_HINT = (1 << 6) * ENABLE_FEATURE_DATE_ISOFMT, /* D */
|
||||
OPT_KERNELTZ = (1 << 5), /* k */
|
||||
OPT_TIMESPEC = (1 << 6) * ENABLE_FEATURE_DATE_ISOFMT, /* I */
|
||||
OPT_HINT = (1 << 7) * ENABLE_FEATURE_DATE_ISOFMT, /* D */
|
||||
};
|
||||
|
||||
#if ENABLE_LONG_OPTS
|
||||
@ -162,6 +163,7 @@ static const char date_longopts[] ALIGN1 =
|
||||
/* "universal\0" No_argument "u" */
|
||||
"date\0" Required_argument "d"
|
||||
"reference\0" Required_argument "r"
|
||||
"set-kernel-tz\0" No_argument "k"
|
||||
;
|
||||
#endif
|
||||
|
||||
@ -181,6 +183,8 @@ static void maybe_set_utc(int opt)
|
||||
int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
time_t tt;
|
||||
struct timezone tz;
|
||||
struct timespec ts;
|
||||
struct tm tm_time;
|
||||
char buf_fmt_dt2str[64];
|
||||
@ -193,7 +197,7 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
char *isofmt_arg = NULL;
|
||||
|
||||
opt = getopt32long(argv, "^"
|
||||
"Rs:ud:r:"
|
||||
"Rs:ud:r:k"
|
||||
IF_FEATURE_DATE_ISOFMT("I::D:")
|
||||
"\0"
|
||||
"d--s:s--d"
|
||||
@ -256,6 +260,31 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (*argv)
|
||||
bb_show_usage();
|
||||
|
||||
/* Setting of kernel timezone was requested */
|
||||
if (opt & OPT_KERNELTZ) {
|
||||
tt = time(NULL);
|
||||
localtime_r(&tt, &tm_time);
|
||||
|
||||
/* workaround warp_clock() on first invocation */
|
||||
memset(&tz, 0, sizeof(tz));
|
||||
syscall(SYS_settimeofday, NULL, &tz);
|
||||
|
||||
memset(&tz, 0, sizeof(tz));
|
||||
#ifdef __USE_MISC
|
||||
tz.tz_minuteswest = -(tm_time.tm_gmtoff / 60);
|
||||
#else
|
||||
tz.tz_minuteswest = -(tm_time.__tm_gmtoff / 60);
|
||||
#endif
|
||||
|
||||
if (syscall(SYS_settimeofday, NULL, &tz))
|
||||
{
|
||||
bb_perror_msg("can't set kernel time zone");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Now we have parsed all the information except the date format
|
||||
* which depends on whether the clock is being set or read */
|
||||
|
||||
|
@ -28,8 +28,6 @@ const char* FAST_FUNC printable_string2(uni_stat_t *stats, const char *str)
|
||||
}
|
||||
if (c < ' ')
|
||||
break;
|
||||
if (c >= 0x7f)
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
|
||||
@ -42,7 +40,7 @@ const char* FAST_FUNC printable_string2(uni_stat_t *stats, const char *str)
|
||||
unsigned char c = *d;
|
||||
if (c == '\0')
|
||||
break;
|
||||
if (c < ' ' || c >= 0x7f)
|
||||
if (c < ' ')
|
||||
*d = '?';
|
||||
d++;
|
||||
}
|
||||
|
@ -97,6 +97,11 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
crypt_make_pw_salt(salt, algo);
|
||||
free_me = pass = pw_encrypt(pass, salt, 0);
|
||||
|
||||
if (pass[0] == 0) {
|
||||
free(free_me);
|
||||
bb_perror_msg_and_die("password encryption failed");
|
||||
}
|
||||
}
|
||||
|
||||
/* This is rather complex: if user is not found in /etc/shadow,
|
||||
|
@ -95,7 +95,7 @@ int cryptpw_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* Supports: cryptpw -m sha256 PASS 'rounds=999999999$SALT' */
|
||||
char salt[MAX_PW_SALT_LEN + sizeof("rounds=999999999$")];
|
||||
char *salt_ptr;
|
||||
char *password;
|
||||
char *password, *hash;
|
||||
const char *opt_m, *opt_S;
|
||||
int fd;
|
||||
|
||||
@ -140,8 +140,12 @@ int cryptpw_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* may still be NULL on EOF/error */
|
||||
}
|
||||
|
||||
if (password)
|
||||
puts(pw_encrypt(password, salt, 1));
|
||||
if (password) {
|
||||
hash = pw_encrypt(password, salt, 1);
|
||||
if (hash[0] == 0)
|
||||
bb_perror_msg_and_die("password encryption failed");
|
||||
puts(hash);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
//config: With this option passwd will refuse new passwords which are "weak".
|
||||
|
||||
//applet:/* Needs to be run by root or be suid root - needs to change /etc/{passwd,shadow}: */
|
||||
//applet:IF_PASSWD(APPLET(passwd, BB_DIR_USR_BIN, BB_SUID_REQUIRE))
|
||||
//applet:IF_PASSWD(APPLET(passwd, BB_DIR_BIN, BB_SUID_REQUIRE))
|
||||
|
||||
//kbuild:lib-$(CONFIG_PASSWD) += passwd.o
|
||||
|
||||
@ -187,6 +187,10 @@ int passwd_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (!newp) {
|
||||
logmode = LOGMODE_STDIO;
|
||||
bb_error_msg_and_die("password for %s is unchanged", name);
|
||||
} else if (newp[0] == 0) {
|
||||
logmode = LOGMODE_STDIO;
|
||||
free(newp);
|
||||
bb_perror_msg_and_die("password encryption failed");
|
||||
}
|
||||
} else if (opt & OPT_lock) {
|
||||
if (!c)
|
||||
|
@ -652,7 +652,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
|
||||
}
|
||||
xrtnl_open(&rth);
|
||||
ll_init_map(&rth);
|
||||
if (type_str) {
|
||||
if (type_str && rtm == RTM_NEWLINK) {
|
||||
struct rtattr *linkinfo = NLMSG_TAIL(&req.n);
|
||||
|
||||
addattr_l(&req.n, sizeof(req), IFLA_LINKINFO, NULL, 0);
|
||||
|
@ -497,6 +497,7 @@ make_new_session(
|
||||
|
||||
/* Restore default signal handling ASAP */
|
||||
bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL);
|
||||
signal(SIGINT, SIG_DFL);
|
||||
|
||||
pid = getpid();
|
||||
|
||||
|
@ -237,8 +237,8 @@
|
||||
//config: depends on TRACEROUTE || TRACEROUTE6
|
||||
|
||||
/* Needs socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), therefore BB_SUID_MAYBE: */
|
||||
//applet:IF_TRACEROUTE(APPLET(traceroute, BB_DIR_USR_BIN, BB_SUID_MAYBE))
|
||||
//applet:IF_TRACEROUTE6(APPLET(traceroute6, BB_DIR_USR_BIN, BB_SUID_MAYBE))
|
||||
//applet:IF_TRACEROUTE(APPLET(traceroute, BB_DIR_BIN, BB_SUID_MAYBE))
|
||||
//applet:IF_TRACEROUTE6(APPLET(traceroute6, BB_DIR_BIN, BB_SUID_MAYBE))
|
||||
|
||||
//kbuild:lib-$(CONFIG_TRACEROUTE) += traceroute.o
|
||||
//kbuild:lib-$(CONFIG_TRACEROUTE6) += traceroute.o
|
||||
|
@ -723,6 +723,7 @@ static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t
|
||||
static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
|
||||
{
|
||||
struct dhcp_packet packet;
|
||||
static int msgs = 0;
|
||||
|
||||
/* Fill in: op, htype, hlen, cookie, chaddr fields,
|
||||
* random xid field (we override it below),
|
||||
@ -740,6 +741,7 @@ static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
|
||||
*/
|
||||
add_client_options(&packet);
|
||||
|
||||
if (msgs++ < 3)
|
||||
bb_error_msg("sending %s", "discover");
|
||||
return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
|
||||
}
|
||||
@ -1136,7 +1138,6 @@ static void perform_renew(void)
|
||||
state = RENEW_REQUESTED;
|
||||
break;
|
||||
case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
|
||||
udhcp_run_script(NULL, "deconfig");
|
||||
case REQUESTING:
|
||||
case RELEASED:
|
||||
change_listen_mode(LISTEN_RAW);
|
||||
@ -1434,6 +1435,12 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* silence "uninitialized!" warning */
|
||||
unsigned timestamp_before_wait = timestamp_before_wait;
|
||||
|
||||
/* When running on a bridge, the ifindex may have changed (e.g. if
|
||||
* member interfaces were added/removed or if the status of the
|
||||
* bridge changed).
|
||||
* Workaround: refresh it here before processing the next packet */
|
||||
udhcp_read_interface(client_config.interface, &client_config.ifindex, NULL, client_config.client_mac, &client_config.client_mtu);
|
||||
|
||||
//bb_error_msg("sockfd:%d, listen_mode:%d", sockfd, listen_mode);
|
||||
|
||||
/* Was opening raw or udp socket here
|
||||
|
@ -130,7 +130,7 @@ make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))
|
||||
#
|
||||
if_changed = $(if $(strip $(filter-out $(PHONY),$?) \
|
||||
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
|
||||
@set -e; \
|
||||
+@set -e; \
|
||||
$(echo-cmd) $(cmd_$(1)); \
|
||||
echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd)
|
||||
|
||||
@ -139,7 +139,7 @@ if_changed = $(if $(strip $(filter-out $(PHONY),$?) \
|
||||
if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \
|
||||
$(filter-out FORCE $(wildcard $^),$^) \
|
||||
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
|
||||
@set -e; \
|
||||
+@set -e; \
|
||||
$(echo-cmd) $(cmd_$(1)); \
|
||||
scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \
|
||||
rm -f $(depfile); \
|
||||
@ -150,5 +150,5 @@ if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \
|
||||
# and if so will execute $(rule_foo)
|
||||
if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \
|
||||
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
|
||||
@set -e; \
|
||||
+@set -e; \
|
||||
$(rule_$(1)))
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Note: was using sed OPTS CMD -- FILES
|
||||
# but users complain that many sed implementations
|
||||
|
@ -31,6 +31,10 @@
|
||||
#define SIGWINCH 28
|
||||
#endif
|
||||
|
||||
#ifndef SIGWINCH
|
||||
#define SIGWINCH 28
|
||||
#endif
|
||||
|
||||
#define LKC_DIRECT_LINK
|
||||
#include "lkc.h"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
debug=false
|
||||
|
||||
|
Reference in New Issue
Block a user