update busybox to v1.3.1, i was too lazy to update patch 320, feel free to do so

SVN-Revision: 5941
This commit is contained in:
Nicolas Thill 2006-12-30 19:35:58 +00:00
parent c8fea8d380
commit a64b16df64
22 changed files with 593 additions and 1196 deletions

View File

@ -9,12 +9,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=busybox
PKG_VERSION:=1.2.1
PKG_VERSION:=1.3.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.busybox.net/downloads
PKG_MD5SUM:=362b3dc0f2023ddfda901dc1f1a74391
PKG_MD5SUM:=571531cfa83726947ccb566de017ad4f
PKG_CAT:=bzcat
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@ -50,15 +50,17 @@ define Build/Configure
$(SCRIPT_DIR)/gen_busybox_config.pl $(TOPDIR)/.config > $(PKG_BUILD_DIR)/.config
yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CROSS="$(TARGET_CROSS)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(ARCH)" \
oldconfig
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CROSS="$(TARGET_CROSS)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
ARCH="$(ARCH)" \
IPKG_ARCH="$(ARCH)" \
all
endef
@ -66,10 +68,11 @@ endef
define Package/busybox/install
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CROSS="$(TARGET_CROSS)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
ARCH="$(ARCH)" \
IPKG_ARCH="$(ARCH)" \
PREFIX="$(1)" \
CONFIG_PREFIX="$(1)" \
install
mkdir -p $(1)/etc/init.d
for tmp in $(init-y); do \

View File

@ -1,22 +0,0 @@
Index: busybox-CURRENT/networking/wget.c
===================================================================
--- busybox-CURRENT/networking/wget.c (revision 15806)
+++ busybox-CURRENT/networking/wget.c (working copy)
@@ -133,7 +133,7 @@
#define WGET_OPT_PREFIX 32
#define WGET_OPT_PROXY 64
-#if ENABLE_WGET_LONG_OPTIONS
+#if CONFIG_FEATURE_WGET_LONG_OPTIONS
static const struct option wget_long_options[] = {
{ "continue", 0, NULL, 'c' },
{ "quiet", 0, NULL, 'q' },
@@ -177,7 +177,7 @@
* Crack command line.
*/
bb_opt_complementally = "-1:\203::";
-#if ENABLE_WGET_LONG_OPTIONS
+#if CONFIG_FEATURE_WGET_LONG_OPTIONS
bb_applet_long_options = wget_long_options;
#endif
opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:",

View File

@ -1,85 +0,0 @@
diff -ruN busybox-1.2.0-old/include/applets.h busybox-1.2.0-new/include/applets.h
--- busybox-1.2.0-old/include/applets.h 2006-07-01 00:42:10.000000000 +0200
+++ busybox-1.2.0-new/include/applets.h 2006-07-31 00:29:34.000000000 +0200
@@ -157,6 +157,7 @@
USE_IPTUNNEL(APPLET(iptunnel, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_KILL(APPLET(kill, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_KILLALL(APPLET_ODDNAME(killall, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall))
+USE_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall5))
USE_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
diff -ruN busybox-1.2.0-old/include/usage.h busybox-1.2.0-new/include/usage.h
--- busybox-1.2.0-old/include/usage.h 2006-07-01 00:42:10.000000000 +0200
+++ busybox-1.2.0-new/include/usage.h 2006-07-31 00:25:57.000000000 +0200
@@ -1503,6 +1503,13 @@
#define killall_example_usage \
"$ killall apache\n"
+#define killall5_trivial_usage \
+ ""
+#define killall5_full_usage \
+ ""
+#define killall5_example_usage \
+ ""
+
#define klogd_trivial_usage \
"[-c n] [-n]"
#define klogd_full_usage \
diff -ruN busybox-1.2.0-old/procps/Config.in busybox-1.2.0-new/procps/Config.in
--- busybox-1.2.0-old/procps/Config.in 2006-07-01 00:42:12.000000000 +0200
+++ busybox-1.2.0-new/procps/Config.in 2006-07-31 00:25:57.000000000 +0200
@@ -38,6 +38,11 @@
specified commands. If no signal name is specified, SIGTERM is
sent.
+config CONFIG_KILLALL5
+ bool "killall5"
+ default n
+ depends on CONFIG_KILL
+
config CONFIG_PIDOF
bool "pidof"
default n
diff -ruN busybox-1.2.0-old/procps/kill.c busybox-1.2.0-new/procps/kill.c
--- busybox-1.2.0-old/procps/kill.c 2006-07-01 00:42:12.000000000 +0200
+++ busybox-1.2.0-new/procps/kill.c 2006-07-31 00:25:57.000000000 +0200
@@ -20,6 +20,7 @@
#define KILL 0
#define KILLALL 1
+#define KILLALL5 2
int kill_main(int argc, char **argv)
{
@@ -34,6 +35,9 @@
#else
whichApp = KILL;
#endif
+#ifdef CONFIG_KILLALL5
+ whichApp = (strcmp(bb_applet_name, "killall5") == 0)? KILLALL5 : whichApp;
+#endif
/* Parse any options */
if (argc < 2)
@@ -112,6 +116,20 @@
}
}
+#ifdef CONFIG_KILLALL5
+ else if (whichApp == KILLALL5) {
+ procps_status_t * p;
+ pid_t myPid=getpid();
+ while ((p = procps_scan(0)) != 0) {
+ if (p->pid != 1 && p->pid != myPid && p->pid != p->ppid) {
+ if (kill(p->pid, signo) != 0) {
+ bb_perror_msg( "Could not kill pid '%d'", p->pid);
+ errors++;
+ }
+ }
+ }
+ }
+#endif
#ifdef CONFIG_KILLALL
else {
pid_t myPid=getpid();

View File

@ -0,0 +1,12 @@
--- busybox-1.3.1-old/include/libbb.h 2006-12-27 05:56:18.000000000 +0100
+++ busybox-1.3.1/include/libbb.h 2006-12-28 07:08:09.000000000 +0100
@@ -51,9 +51,7 @@
#include "pwd_.h"
#include "grp_.h"
-#if ENABLE_FEATURE_SHADOWPASSWDS
#include "shadow_.h"
-#endif
/* Try to pull in PATH_MAX */
#include <limits.h>

View File

@ -1,51 +0,0 @@
diff -ruN busybox-1.2.0-old/networking/telnetd.c busybox-1.2.0-new/networking/telnetd.c
--- busybox-1.2.0-old/networking/telnetd.c 2006-07-01 00:42:02.000000000 +0200
+++ busybox-1.2.0-new/networking/telnetd.c 2006-07-31 10:52:30.000000000 +0200
@@ -44,6 +44,7 @@
#include <arpa/telnet.h>
#include <ctype.h>
#include <sys/syslog.h>
+#include <net/if.h>
#include "busybox.h"
@@ -391,11 +392,13 @@
struct in_addr bind_addr = { .s_addr = 0x0 };
#endif /* CONFIG_FEATURE_TELNETD_INETD */
int c;
+ char *interface_name = NULL;
+ struct ifreq interface;
static const char options[] =
#ifdef CONFIG_FEATURE_TELNETD_INETD
- "f:l:";
+ "i:f:l:";
#else /* CONFIG_EATURE_TELNETD_INETD */
- "f:l:p:b:";
+ "i:f:l:p:b:";
#endif /* CONFIG_FEATURE_TELNETD_INETD */
int maxlen, w, r;
@@ -410,6 +413,9 @@
case 'f':
issuefile = optarg;
break;
+ case 'i':
+ interface_name = strdup(optarg);
+ break;
case 'l':
loginpath = optarg;
break;
@@ -459,6 +465,13 @@
sa.sin_addr = bind_addr;
#endif
+ /* Set it to listen on the specified interface */
+ if (interface_name) {
+ strncpy(interface.ifr_ifrn.ifrn_name, interface_name, IFNAMSIZ);
+ (void)setsockopt(master_fd, SOL_SOCKET,
+ SO_BINDTODEVICE, &interface, sizeof(interface));
+ }
+
bb_xbind(master_fd, (struct sockaddr *) &sa, sizeof(sa));
bb_xlisten(master_fd, 1);
bb_xdaemon(0, 0);

View File

@ -0,0 +1,24 @@
--- busybox-1.3.1/networking/ping.c 2006-12-27 05:52:39.000000000 +0100
+++ busybox-1.3.1-new/networking/ping.c 2006-12-29 18:42:36.000000000 +0100
@@ -217,7 +217,8 @@
pkt->icmp_type = ICMP_ECHO;
pkt->icmp_code = 0;
pkt->icmp_cksum = 0;
- pkt->icmp_seq = htons(ntransmitted++);
+ pkt->icmp_seq = htons(ntransmitted);
+ ntransmitted++;
pkt->icmp_id = myid;
CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK);
--- busybox-1.3.1/networking/ping6.c 2006-12-27 05:52:39.000000000 +0100
+++ busybox-1.3.1-new/networking/ping6.c 2006-12-29 18:44:02.000000000 +0100
@@ -205,7 +205,8 @@
pkt->icmp6_type = ICMP6_ECHO_REQUEST;
pkt->icmp6_code = 0;
pkt->icmp6_cksum = 0;
- pkt->icmp6_seq = htons(ntransmitted++);
+ pkt->icmp6_seq = htons(ntransmitted);
+ ntransmitted++;
pkt->icmp6_id = myid;
CLR(pkt->icmp6_seq % MAX_DUP_CHK);

View File

@ -1,32 +0,0 @@
--- busybox-1.00.old/loginutils/passwd.c 2004-09-15 04:39:09.000000000 +0200
+++ busybox-1.00/loginutils/passwd.c 2005-03-23 15:31:07.000000000 +0100
@@ -54,11 +54,12 @@
snprintf(filename, sizeof filename, "%s", bb_path_passwd_file);
}
- if (((fp = fopen(filename, "r+")) == 0) || (fstat(fileno(fp), &sb))) {
+ if (((fp = fopen(filename, "r")) == 0) || (fstat(fileno(fp), &sb))) {
/* return 0; */
return 1;
}
+#if 0
/* Lock the password file before updating */
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
@@ -69,6 +70,7 @@
return 1;
}
lock.l_type = F_UNLCK;
+#endif
snprintf(buf, sizeof buf, "%s-", filename);
if (create_backup(buf, fp)) {
@@ -119,6 +121,7 @@
fclose(fp);
return 1;
}
+ unlink(filename);
if (rename(buf, filename) < 0) {
fcntl(fileno(fp), F_SETLK, &lock);
fclose(fp);

View File

@ -1,90 +0,0 @@
diff -ruN busybox-1.2.0-old/include/usage.h busybox-1.2.0-new/include/usage.h
--- busybox-1.2.0-old/include/usage.h 2006-07-31 10:47:56.000000000 +0200
+++ busybox-1.2.0-new/include/usage.h 2006-07-31 11:08:49.000000000 +0200
@@ -3190,6 +3190,7 @@
"\t-n,\t--now\tExit with failure if lease cannot be immediately negotiated\n" \
"\t-p,\t--pidfile=file\tStore process ID of daemon in file\n" \
"\t-q,\t--quit\tQuit after obtaining lease\n" \
+ "\t-R,\t--release\tRelease IP on quit\n" \
"\t-r,\t--request=IP\tIP address to request (default: none)\n" \
"\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \
"\t-t,\t--retries=NUM\tSend up to NUM request packets\n"\
diff -ruN busybox-1.2.0-old/networking/udhcp/dhcpc.c busybox-1.2.0-new/networking/udhcp/dhcpc.c
--- busybox-1.2.0-old/networking/udhcp/dhcpc.c 2006-07-01 00:42:02.000000000 +0200
+++ busybox-1.2.0-new/networking/udhcp/dhcpc.c 2006-07-31 11:08:49.000000000 +0200
@@ -47,6 +47,7 @@
.abort_if_no_lease = 0,
.foreground = 0,
.quit_after_lease = 0,
+ .release_on_quit = 0,
.background_if_no_lease = 0,
.interface = "eth0",
.pidfile = NULL,
@@ -163,6 +164,7 @@
{"now", no_argument, 0, 'n'},
{"pidfile", required_argument, 0, 'p'},
{"quit", no_argument, 0, 'q'},
+ {"release", no_argument, 0, 'R'},
{"request", required_argument, 0, 'r'},
{"script", required_argument, 0, 's'},
{"timeout", required_argument, 0, 'T'},
@@ -174,7 +176,7 @@
/* get options */
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "c:CV:fbH:h:F:i:np:qr:s:T:t:v", arg_options, &option_index);
+ c = getopt_long(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v", arg_options, &option_index);
if (c == -1) break;
switch (c) {
@@ -244,6 +246,9 @@
case 'q':
client_config.quit_after_lease = 1;
break;
+ case 'R':
+ client_config.release_on_quit = 1;
+ break;
case 'r':
requested_ip = inet_addr(optarg);
break;
@@ -488,8 +493,11 @@
state = BOUND;
change_mode(LISTEN_NONE);
- if (client_config.quit_after_lease)
+ if (client_config.quit_after_lease) {
+ if (client_config.release_on_quit)
+ perform_release();
return 0;
+ }
if (!client_config.foreground)
client_background();
@@ -514,12 +522,13 @@
case SIGUSR1:
perform_renew();
break;
- case SIGUSR2:
- perform_release();
- break;
case SIGTERM:
LOG(LOG_INFO, "Received SIGTERM");
+ if (!client_config.release_on_quit)
return 0;
+ case SIGUSR2:
+ perform_release();
+ break;
}
} else if (retval == -1 && errno == EINTR) {
/* a signal was caught */
diff -ruN busybox-1.2.0-old/networking/udhcp/dhcpc.h busybox-1.2.0-new/networking/udhcp/dhcpc.h
--- busybox-1.2.0-old/networking/udhcp/dhcpc.h 2006-07-01 00:42:02.000000000 +0200
+++ busybox-1.2.0-new/networking/udhcp/dhcpc.h 2006-07-31 11:08:49.000000000 +0200
@@ -18,6 +18,7 @@
struct client_config_t {
char foreground; /* Do not fork */
char quit_after_lease; /* Quit after obtaining lease */
+ char release_on_quit; /* perform release on quit */
char abort_if_no_lease; /* Abort if no lease */
char background_if_no_lease; /* Fork to background if no lease */
char *interface; /* The name of the interface to use */

View File

@ -1,15 +0,0 @@
diff -Nur busybox-1.00.orig/networking/udhcp/options.c busybox-1.00/networking/udhcp/options.c
--- busybox-1.00.orig/networking/udhcp/options.c 2004-03-15 09:29:01.000000000 +0100
+++ busybox-1.00/networking/udhcp/options.c 2005-09-14 13:27:23.792609800 +0200
@@ -39,8 +39,11 @@
{"dhcptype", OPTION_U8, 0x35},
{"serverid", OPTION_IP, 0x36},
{"message", OPTION_STRING, 0x38},
+ {"vendorclass", OPTION_STRING, 0x3C},
+ {"clientid", OPTION_STRING, 0x3D},
{"tftp", OPTION_STRING, 0x42},
{"bootfile", OPTION_STRING, 0x43},
+ {"userclass", OPTION_STRING, 0x4D},
{"", 0x00, 0x00}
};

View File

@ -1,12 +0,0 @@
diff -urN busybox.old/networking/telnetd.c busybox.dev/networking/telnetd.c
--- busybox.old/networking/telnetd.c 2005-08-17 03:29:10.000000000 +0200
+++ busybox.dev/networking/telnetd.c 2005-10-22 19:37:49.976396000 +0200
@@ -49,6 +49,8 @@
#define BUFSIZE 4000
+#undef CONFIG_FEATURE_IPV6
+
#ifdef CONFIG_FEATURE_IPV6
#define SOCKET_TYPE AF_INET6
typedef struct sockaddr_in6 sockaddr_type;

View File

@ -1,80 +0,0 @@
Copyright (C) 2006 OpenWrt.org
diff -urN busybox.old/shell/ash.c busybox.dev/shell/ash.c
--- busybox.old/shell/ash.c 2005-11-12 22:39:19.853826250 +0100
+++ busybox.dev/shell/ash.c 2005-11-12 22:39:42.771258500 +0100
@@ -1414,6 +1414,13 @@
#define NUMBUILTINS (sizeof (builtincmd) / sizeof (struct builtincmd) )
+static const char *safe_applets[] = {
+ "[", "test", "echo", "cat",
+ "ln", "cp", "touch", "mkdir", "rm",
+ "cut", "hexdump", "awk", "sort",
+ "find", "xargs", "ls", "dd",
+ "chown", "chmod"
+};
struct cmdentry {
@@ -2050,6 +2057,19 @@
static void exitshell(void) __attribute__((__noreturn__));
static int decode_signal(const char *, int);
+
+static int is_safe_applet(char *name)
+{
+ int n = sizeof(safe_applets) / sizeof(char *);
+ int i;
+ for (i = 0; i < n; i++)
+ if (strcmp(safe_applets[i], name) == 0)
+ return 1;
+
+ return 0;
+}
+
+
/*
* This routine is called when an error or an interrupt occurs in an
* interactive shell and control is returned to the main command loop.
@@ -3680,6 +3700,7 @@
clearredir(1);
envp = environment();
if (strchr(argv[0], '/') != NULL
+ || is_safe_applet(argv[0])
#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
|| find_applet_by_name(argv[0])
#endif
@@ -3721,6 +3742,18 @@
tryexec(char *cmd, char **argv, char **envp)
{
int repeated = 0;
+ struct BB_applet *a;
+ int argc = 0;
+ char **c;
+
+ if(strchr(cmd, '/') == NULL && is_safe_applet(cmd) && (a = find_applet_by_name(cmd)) != NULL) {
+ c = argv;
+ while (*c != NULL) {
+ c++; argc++;
+ }
+ bb_applet_name = cmd;
+ exit(a->main(argc, argv));
+ }
#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
int flg_bb = 0;
char *name = cmd;
@@ -3919,6 +3952,12 @@
}
#endif
+ if (is_safe_applet(name)) {
+ entry->cmdtype = CMDNORMAL;
+ entry->u.index = -1;
+ return;
+ }
+
updatetbl = (path == pathval());
if (!updatetbl) {
act |= DO_ALTPATH;

View File

@ -1,15 +0,0 @@
Copyright (C) 2006 OpenWrt.org
diff -urN busybox.old/loginutils/passwd.c busybox.dev/loginutils/passwd.c
--- busybox.old/loginutils/passwd.c 2005-12-11 22:52:46.185150000 +0100
+++ busybox.dev/loginutils/passwd.c 2005-12-11 23:19:15.276596500 +0100
@@ -353,7 +353,7 @@
} else {
orig[0] = '\0';
}
- if (! (cp=bb_askpass(0, "Enter the new password (minimum of 5, maximum of 8 characters)\n"
+ if (! (cp=bb_askpass(0, "Enter the new password (minimum of 5 characters)\n"
"Please use a combination of upper and lower case letters and numbers.\n"
"Enter new password: ")))
{

View File

@ -1,64 +0,0 @@
Copyright (C) 2006 OpenWrt.org
--- busybox-1.00/editors/awk.c.orig 2004-09-24 05:24:27 -04:00
+++ busybox-1.00/editors/awk.c 2006-03-08 02:16:52 -05:00
@@ -271,7 +271,8 @@
/* builtins */
enum {
B_a2=0, B_ix, B_ma, B_sp, B_ss, B_ti, B_lo, B_up,
- B_ge, B_gs, B_su
+ B_ge, B_gs, B_su,
+ B_an, B_co, B_ls, B_or, B_rs, B_xo,
};
/* tokens and their corresponding info values */
@@ -311,6 +312,8 @@
"\5while" NTC
"\4else" NTC
+ "\3and" "\5compl" "\6lshift" "\2or"
+ "\6rshift" "\3xor"
"\5close" "\6system" "\6fflush" "\5atan2" /* BUILTIN */
"\3cos" "\3exp" "\3int" "\3log"
"\4rand" "\3sin" "\4sqrt" "\5srand"
@@ -364,6 +367,8 @@
ST_WHILE,
0,
+ OC_B|B_an|P(0x83), OC_B|B_co|P(0x41), OC_B|B_ls|P(0x83), OC_B|B_or|P(0x83),
+ OC_B|B_rs|P(0x83), OC_B|B_xo|P(0x83),
OC_FBLTIN|Sx|F_cl, OC_FBLTIN|Sx|F_sy, OC_FBLTIN|Sx|F_ff, OC_B|B_a2|P(0x83),
OC_FBLTIN|Nx|F_co, OC_FBLTIN|Nx|F_ex, OC_FBLTIN|Nx|F_in, OC_FBLTIN|Nx|F_lg,
OC_FBLTIN|F_rn, OC_FBLTIN|Nx|F_si, OC_FBLTIN|Nx|F_sq, OC_FBLTIN|Nx|F_sr,
@@ -1942,6 +1947,30 @@
strncpy(s, as[0]+i, n);
s[n] = '\0';
setvar_p(res, s);
+ break;
+
+ case B_an:
+ setvar_i(res, (long)getvar_i(av[0]) & (long)getvar_i(av[1]));
+ break;
+
+ case B_co:
+ setvar_i(res, ~(long)getvar_i(av[0]));
+ break;
+
+ case B_ls:
+ setvar_i(res, (long)getvar_i(av[0]) << (long)getvar_i(av[1]));
+ break;
+
+ case B_or:
+ setvar_i(res, (long)getvar_i(av[0]) | (long)getvar_i(av[1]));
+ break;
+
+ case B_rs:
+ setvar_i(res, (long)((unsigned long)getvar_i(av[0]) >> (unsigned long)getvar_i(av[1])));
+ break;
+
+ case B_xo:
+ setvar_i(res, (long)getvar_i(av[0]) ^ (long)getvar_i(av[1]));
break;
case B_lo:

View File

@ -1,12 +0,0 @@
diff -Nur busybox-1.2.1/findutils/grep.c busybox-1.2.1/findutils/grep.c
--- busybox-1.2.1/findutils/grep.c 2006-09-25 14:47:51.000000000 -0700
+++ busybox-1.2.1/findutils/grep.c 2006-09-25 14:39:39.000000000 -0700
@@ -51,7 +51,7 @@
#define GREP_OPT_L (1<<12)
#define PRINT_FILES_WITHOUT_MATCHES ((opt & GREP_OPT_L) != 0)
#if ENABLE_FEATURE_GREP_CONTEXT
-#define GREP_OPT_CONTEXT "A:B:C"
+#define GREP_OPT_CONTEXT "A:B:C:"
#define GREP_OPT_A (1<<13)
#define GREP_OPT_B (1<<14)
#define GREP_OPT_C (1<<15)

View File

@ -1,7 +1,7 @@
diff -ruN busybox-1.2.1-old/networking/udhcp/packet.c busybox-1.2.1-new/networking/udhcp/packet.c
--- busybox-1.2.1-old/networking/udhcp/packet.c 2006-07-01 00:42:02.000000000 +0200
+++ busybox-1.2.1-new/networking/udhcp/packet.c 2006-11-19 01:04:40.000000000 +0100
@@ -111,6 +111,10 @@
diff -ruN busybox-1.3.1-old/networking/udhcp/packet.c busybox-1.3.1/networking/udhcp/packet.c
--- busybox-1.3.1-old/networking/udhcp/packet.c 2006-12-27 05:52:33.000000000 +0100
+++ busybox-1.3.1/networking/udhcp/packet.c 2006-12-28 05:38:36.000000000 +0100
@@ -107,6 +107,10 @@
return ~sum;
}
@ -11,16 +11,16 @@ diff -ruN busybox-1.2.1-old/networking/udhcp/packet.c busybox-1.2.1-new/networki
+}
/* Construct a ip/udp header for a packet, and specify the source and dest hardware address */
int udhcp_raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
@@ -120,6 +124,7 @@
void BUG_sizeof_struct_udp_dhcp_packet_must_be_576(void);
@@ -118,6 +122,7 @@
int result;
struct sockaddr_ll dest;
struct udp_dhcp_packet packet;
+ int p_len = udhcp_get_payload_len(payload);
if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) {
DEBUG(LOG_ERR, "socket call failed: %m");
@@ -128,6 +133,7 @@
fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP));
if (fd < 0) {
@@ -127,6 +132,7 @@
memset(&dest, 0, sizeof(dest));
memset(&packet, 0, sizeof(packet));
@ -28,7 +28,7 @@ diff -ruN busybox-1.2.1-old/networking/udhcp/packet.c busybox-1.2.1-new/networki
dest.sll_family = AF_PACKET;
dest.sll_protocol = htons(ETH_P_IP);
@@ -145,18 +151,19 @@
@@ -144,12 +150,13 @@
packet.ip.daddr = dest_ip;
packet.udp.source = htons(source_port);
packet.udp.dest = htons(dest_port);
@ -46,14 +46,16 @@ diff -ruN busybox-1.2.1-old/networking/udhcp/packet.c busybox-1.2.1-new/networki
packet.ip.ihl = sizeof(packet.ip) >> 2;
packet.ip.version = IPVERSION;
packet.ip.ttl = IPDEFTTL;
packet.ip.check = udhcp_checksum(&(packet.ip), sizeof(packet.ip));
@@ -158,7 +165,7 @@
if (sizeof(struct udp_dhcp_packet) != 576)
BUG_sizeof_struct_udp_dhcp_packet_must_be_576();
- result = sendto(fd, &packet, sizeof(struct udp_dhcp_packet), 0, (struct sockaddr *) &dest, sizeof(dest));
+ result = sendto(fd, &packet, p_len, 0, (struct sockaddr *) &dest, sizeof(dest));
- result = sendto(fd, &packet, sizeof(struct udp_dhcp_packet), 0,
+ result = sendto(fd, &packet, p_len, 0,
(struct sockaddr *) &dest, sizeof(dest));
if (result <= 0) {
DEBUG(LOG_ERR, "write on socket failed: %m");
}
@@ -201,7 +208,7 @@
bb_perror_msg("sendto");
@@ -205,7 +212,7 @@
return -1;
}
@ -62,10 +64,10 @@ diff -ruN busybox-1.2.1-old/networking/udhcp/packet.c busybox-1.2.1-new/networki
close(fd);
return result;
}
diff -ruN busybox-1.2.1-old/networking/udhcp/packet.h busybox-1.2.1-new/networking/udhcp/packet.h
--- busybox-1.2.1-old/networking/udhcp/packet.h 2006-07-01 00:42:02.000000000 +0200
+++ busybox-1.2.1-new/networking/udhcp/packet.h 2006-11-19 00:49:38.000000000 +0100
@@ -4,6 +4,8 @@
diff -ruN busybox-1.3.1-old/networking/udhcp/common.h busybox-1.3.1/networking/udhcp/common.h
--- busybox-1.3.1-old/networking/udhcp/common.h 2006-12-27 05:52:33.000000000 +0100
+++ busybox-1.3.1/networking/udhcp/common.h 2006-12-28 05:17:06.000000000 +0100
@@ -26,6 +26,8 @@
#include <netinet/udp.h>
#include <netinet/ip.h>
@ -74,7 +76,7 @@ diff -ruN busybox-1.2.1-old/networking/udhcp/packet.h busybox-1.2.1-new/networki
struct dhcpMessage {
uint8_t op;
uint8_t htype;
@@ -20,7 +22,7 @@
@@ -42,7 +44,7 @@
uint8_t sname[64];
uint8_t file[128];
uint32_t cookie;

View File

@ -1,49 +1,44 @@
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
diff -ruN busybox-1.2.0-old/include/applets.h busybox-1.2.0-new/include/applets.h
--- busybox-1.2.0-old/include/applets.h 2006-07-31 10:47:56.000000000 +0200
+++ busybox-1.2.0-new/include/applets.h 2006-07-31 11:21:00.000000000 +0200
@@ -200,6 +200,7 @@
diff -ruN busybox-1.3.1-old/include/applets.h busybox-1.3.1-new/include/applets.h
--- busybox-1.3.1-old/include/applets.h 2006-12-27 05:56:18.000000000 +0100
+++ busybox-1.3.1-new/include/applets.h 2006-12-28 07:25:35.000000000 +0100
@@ -211,6 +211,7 @@
USE_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+USE_NETMSG(APPLET_NOUSAGE(netmsg, netmsg, _BB_DIR_BIN, _BB_SUID_ALWAYS))
USE_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
diff -ruN busybox-1.2.0-old/networking/Config.in busybox-1.2.0-new/networking/Config.in
--- busybox-1.2.0-old/networking/Config.in 2006-07-01 00:42:02.000000000 +0200
+++ busybox-1.2.0-new/networking/Config.in 2006-07-31 11:18:01.000000000 +0200
@@ -445,6 +445,12 @@
USE_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
diff -ruN busybox-1.3.1-old/networking/Config.in busybox-1.3.1-new/networking/Config.in
--- busybox-1.3.1-old/networking/Config.in 2006-12-27 05:52:39.000000000 +0100
+++ busybox-1.3.1-new/networking/Config.in 2006-12-28 07:25:35.000000000 +0100
@@ -452,6 +452,12 @@
help
A simple Unix utility which reads and writes data across network
connections.
+
+config CONFIG_NETMSG
+config NETMSG
+ bool "netmsg"
+ default n
+ help
+ simple program for sending udp broadcast messages
config CONFIG_NC_GAPING_SECURITY_HOLE
bool "gaping security hole"
diff -ruN busybox-1.2.0-old/networking/Makefile.in busybox-1.2.0-new/networking/Makefile.in
--- busybox-1.2.0-old/networking/Makefile.in 2006-07-01 00:42:02.000000000 +0200
+++ busybox-1.2.0-new/networking/Makefile.in 2006-07-31 11:18:01.000000000 +0200
@@ -30,6 +30,7 @@
NETWORKING-$(CONFIG_IPTUNNEL) += iptunnel.o
NETWORKING-$(CONFIG_NAMEIF) += nameif.o
NETWORKING-$(CONFIG_NC) += nc.o
+NETWORKING-$(CONFIG_NETMSG) += netmsg.o
NETWORKING-$(CONFIG_NETSTAT) += netstat.o
NETWORKING-$(CONFIG_NSLOOKUP) += nslookup.o
NETWORKING-$(CONFIG_PING) += ping.o
diff -ruN busybox-1.2.0-old/networking/netmsg.c busybox-1.2.0-new/networking/netmsg.c
--- busybox-1.2.0-old/networking/netmsg.c 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.2.0-new/networking/netmsg.c 2006-07-31 11:18:01.000000000 +0200
config NC_SERVER
bool "Netcat server options (-lp)"
diff -ruN busybox-1.3.1-old/networking/Kbuild busybox-1.3.1-new/networking/Kbuild
--- busybox-1.3.1-old/networking/Kbuild 2006-12-27 05:52:39.000000000 +0100
+++ busybox-1.3.1-new/networking/Kbuild 2006-12-28 07:28:29.000000000 +0100
@@ -25,6 +25,7 @@
lib-$(CONFIG_IPTUNNEL) += iptunnel.o
lib-$(CONFIG_NAMEIF) += nameif.o
lib-$(CONFIG_NC) += nc.o
+lib-$(CONFIG_NETMSG) += netmsg.o
lib-$(CONFIG_NETSTAT) += netstat.o
lib-$(CONFIG_NSLOOKUP) += nslookup.o
lib-$(CONFIG_PING) += ping.o
diff -ruN busybox-1.3.1-old/networking/netmsg.c busybox-1.3.1-new/networking/netmsg.c
--- busybox-1.3.1-old/networking/netmsg.c 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.3.1-new/networking/netmsg.c 2006-12-28 07:25:52.000000000 +0100
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
@ -66,7 +61,7 @@ diff -ruN busybox-1.2.0-old/networking/netmsg.c busybox-1.2.0-new/networking/net
+int netmsg_main(int argc, char **argv)
+#endif
+{
+ int s, i;
+ int s;
+ struct sockaddr_in addr;
+ int optval = 1;
+ unsigned char buf[1001];

View File

@ -1,44 +1,44 @@
Copyright (C) 2006 OpenWrt.org
diff -urN busybox.old/networking/httpd.c busybox.dev/networking/httpd.c
--- busybox.old/networking/httpd.c 2004-10-08 10:03:29.000000000 +0200
+++ busybox.dev/networking/httpd.c 2006-02-04 01:54:19.688016250 +0100
@@ -1467,12 +1467,26 @@
{
char *cipher;
char *pp;
+ char *ppnew = NULL;
+ struct passwd *pwd = NULL;
diff -ruN busybox-1.3.1-old/networking/httpd.c busybox-1.3.1/networking/httpd.c
--- busybox-1.3.1-old/networking/httpd.c 2006-12-28 18:17:23.000000000 +0100
+++ busybox-1.3.1/networking/httpd.c 2006-12-28 19:56:34.000000000 +0100
@@ -1381,12 +1381,26 @@
if (ENABLE_FEATURE_HTTPD_AUTH_MD5) {
char *cipher;
char *pp;
+ char *ppnew = NULL;
+ struct passwd *pwd = NULL;
if(strncmp(p, request, u-request) != 0) {
/* user uncompared */
continue;
}
pp = strchr(p, ':');
+ if(pp && pp[1] == '$' && pp[2] == 'p' &&
if (strncmp(p, request, u-request) != 0) {
/* user uncompared */
continue;
}
pp = strchr(p, ':');
+ if(pp && pp[1] == '$' && pp[2] == 'p' &&
+ pp[3] == '$' && pp[4] &&
+ (pwd = getpwnam(&pp[4])) != NULL) {
+ if(pwd->pw_passwd && pwd->pw_passwd[0] == '!') {
+ prev = NULL;
+ continue;
+ (pwd = getpwnam(&pp[4])) != NULL) {
+ if(pwd->pw_passwd && pwd->pw_passwd[0] == '!') {
+ prev = NULL;
+ continue;
+ }
+ ppnew = xrealloc(ppnew, 5 + strlen(pwd->pw_passwd));
+ ppnew[0] = ':';
+ strcpy(ppnew + 1, pwd->pw_passwd);
+ pp = ppnew;
+ }
if (pp && pp[1] == '$' && pp[2] == '1' &&
pp[3] == '$' && pp[4]) {
pp++;
@@ -1396,6 +1410,10 @@
/* unauthorized */
continue;
}
+ if (ppnew) {
+ free(ppnew);
+ ppnew = NULL;
+ }
+ ppnew = malloc(5 + strlen(pwd->pw_passwd));
+ ppnew[0] = ':';
+ strcpy(ppnew + 1, pwd->pw_passwd);
+ pp = ppnew;
+ }
if(pp && pp[1] == '$' && pp[2] == '1' &&
pp[3] == '$' && pp[4]) {
pp++;
@@ -1482,6 +1492,10 @@
/* unauthorized */
continue;
}
+ if (ppnew) {
+ free(ppnew);
+ ppnew = NULL;
+ }
}
#endif
if (strcmp(p, request) == 0) {
if (strcmp(p, request) == 0) {

View File

@ -1,95 +0,0 @@
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
diff -ruN busybox-1.2.0-old/networking/httpd.c busybox-1.2.0-new/networking/httpd.c
--- busybox-1.2.0-old/networking/httpd.c 2006-07-01 00:42:02.000000000 +0200
+++ busybox-1.2.0-new/networking/httpd.c 2006-08-01 10:06:58.000000000 +0200
@@ -99,6 +99,7 @@
#include <sys/types.h>
#include <sys/socket.h> /* for connect and socket*/
#include <netinet/in.h> /* for sockaddr_in */
+#include <arpa/inet.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h> /* for open modes */
@@ -165,6 +166,7 @@
#endif
unsigned port; /* server initial port and for
set env REMOTE_PORT */
+ char *address;
union HTTPD_FOUND {
const char *found_mime_type;
const char *found_moved_temporarily;
@@ -868,7 +870,10 @@
/* inet_addr() returns a value that is already in network order */
memset(&lsocket, 0, sizeof(lsocket));
lsocket.sin_family = AF_INET;
- lsocket.sin_addr.s_addr = INADDR_ANY;
+ if (inet_aton(config->address, &(lsocket.sin_addr)) == 1) {
+ if (config->address != NULL) lsocket.sin_addr.s_addr = ((struct in_addr *) ((gethostbyname(config->address))->h_addr))->s_addr;
+ else lsocket.sin_addr.s_addr = htons(INADDR_ANY);
+ }
lsocket.sin_port = htons(config->port);
fd = bb_xsocket(AF_INET, SOCK_STREAM, 0);
/* tell the OS it's OK to reuse a previous address even though */
@@ -1899,6 +1904,7 @@
USE_FEATURE_HTTPD_AUTH_MD5(m_opt_md5,)
USE_FEATURE_HTTPD_SETUID(u_opt_setuid,)
USE_FEATURE_HTTPD_WITHOUT_INETD(p_opt_port,)
+ USE_FEATURE_HTTPD_WITHOUT_INETD(l_opt_addr,)
};
static const char httpd_opts[]="c:d:h:"
@@ -1906,7 +1912,7 @@
USE_FEATURE_HTTPD_BASIC_AUTH("r:")
USE_FEATURE_HTTPD_AUTH_MD5("m:")
USE_FEATURE_HTTPD_SETUID("u:")
- USE_FEATURE_HTTPD_WITHOUT_INETD("p:");
+ USE_FEATURE_HTTPD_WITHOUT_INETD("p:l:");
#define OPT_CONFIG_FILE (1<<c_opt_config_file)
#define OPT_DECODE_URL (1<<d_opt_decode_url)
@@ -1927,6 +1933,8 @@
#define OPT_PORT USE_FEATURE_HTTPD_WITHOUT_INETD((1<<p_opt_port)) \
SKIP_FEATURE_HTTPD_WITHOUT_INETD(0)
+#define OPT_ADDRESS USE_FEATURE_HTTPD_WITHOUT_INETD((1<<l_opt_addr)) \
+ SKIP_FEATURE_HTTPD_WITHOUT_INETD(0)
int httpd_main(int argc, char *argv[])
{
@@ -1935,6 +1943,7 @@
char *url_for_decode;
USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;)
USE_FEATURE_HTTPD_WITHOUT_INETD(const char *s_port;)
+ USE_FEATURE_HTTPD_WITHOUT_INETD(const char *s_addr;)
USE_FEATURE_HTTPD_WITHOUT_INETD(int server;)
USE_FEATURE_HTTPD_SETUID(const char *s_uid;)
@@ -1949,6 +1958,7 @@
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
config->port = 80;
+ config->address = "";
#endif
config->ContentLength = -1;
@@ -1960,6 +1970,7 @@
USE_FEATURE_HTTPD_AUTH_MD5(, &pass)
USE_FEATURE_HTTPD_SETUID(, &s_uid)
USE_FEATURE_HTTPD_WITHOUT_INETD(, &s_port)
+ USE_FEATURE_HTTPD_WITHOUT_INETD(, &s_addr)
);
if(opt & OPT_DECODE_URL) {
@@ -1981,6 +1992,8 @@
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
if(opt & OPT_PORT)
config->port = bb_xgetlarg(s_port, 10, 1, 0xffff);
+ if (opt & OPT_ADDRESS)
+ if (s_addr) config->address = (char *) s_addr;
#ifdef CONFIG_FEATURE_HTTPD_SETUID
if(opt & OPT_SETUID) {
char *e;

View File

@ -1,30 +1,28 @@
diff -Nur busybox-1.1.1/networking/httpd.c busybox-1.1.1-owrt/networking/httpd.c
--- busybox-1.1.1/networking/httpd.c 2006-04-01 19:42:36.000000000 +0200
+++ busybox-1.1.1-owrt/networking/httpd.c 2006-04-01 19:43:59.000000000 +0200
@@ -247,6 +247,7 @@
const char *query;
diff -ruN busybox-1.3.1-old/networking/httpd.c busybox-1.3.1/networking/httpd.c
--- busybox-1.3.1-old/networking/httpd.c 2006-12-27 05:52:39.000000000 +0100
+++ busybox-1.3.1/networking/httpd.c 2006-12-28 18:04:53.000000000 +0100
@@ -137,6 +137,7 @@
const char *query;
USE_FEATURE_HTTPD_CGI(char *referer;)
+ USE_FEATURE_HTTPD_CGI(char *user_agent;)
USE_FEATURE_HTTPD_CGI(char *referer;)
+ USE_FEATURE_HTTPD_CGI(char *user_agent;)
const char *configFile;
const char *configFile;
@@ -1208,6 +1209,7 @@
addEnv("SERVER", "PROTOCOL", "HTTP/1.0");
addEnv("GATEWAY_INTERFACE", "", "CGI/1.1");
addEnv("REMOTE", "ADDR", config->rmt_ip_str);
+ addEnv("HTTP","USER_AGENT", config->user_agent);
#ifdef CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
addEnvPort("REMOTE");
@@ -1062,6 +1063,7 @@
putenv("SERVER_PROTOCOL=HTTP/1.0");
putenv("GATEWAY_INTERFACE=CGI/1.1");
setenv1("REMOTE_ADDR", config->rmt_ip_str);
+ setenv1("HTTP_USER_AGENT", config->user_agent);
#if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
setenv_long("REMOTE_PORT", config->port);
#endif
@@ -1771,6 +1773,10 @@
for(test = buf + 8; isspace(*test); test++)
;
config->referer = strdup(test);
+ } else if ((strncasecmp(buf, "User-Agent:",11) ==0)) {
+ for(test = buf + 11; isspace(*test); test++)
+ ;
+ config->user_agent = strdup(test);
}
@@ -1605,6 +1607,8 @@
content_type = strdup(skip_whitespace(buf + sizeof("Content-Type:")-1));
} else if ((STRNCASECMP(buf, "Referer:") == 0)) {
config->referer = strdup(skip_whitespace(buf + sizeof("Referer:")-1));
+ } else if ((STRNCASECMP(buf, "User-Agent:") == 0)) {
+ config->user_agent = strdup(skip_whitespace(buf + sizeof("User-Agent:")-1));
}
#endif

View File

@ -1,12 +1,7 @@
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
diff -ruN busybox-1.2.0-old/include/applets.h busybox-1.2.0-new/include/applets.h
--- busybox-1.2.0-old/include/applets.h 2006-07-31 11:21:00.000000000 +0200
+++ busybox-1.2.0-new/include/applets.h 2006-08-01 10:21:15.000000000 +0200
@@ -169,6 +169,7 @@
diff -ruN busybox-1.3.1-old/include/applets.h busybox-1.3.1/include/applets.h
--- busybox-1.3.1-old/include/applets.h 2006-12-28 07:43:24.000000000 +0100
+++ busybox-1.3.1/include/applets.h 2006-12-28 03:11:36.000000000 +0100
@@ -180,6 +180,7 @@
USE_LN(APPLET(ln, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_LOADFONT(APPLET(loadfont, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_LOADKMAP(APPLET(loadkmap, _BB_DIR_SBIN, _BB_SUID_NEVER))
@ -14,25 +9,36 @@ diff -ruN busybox-1.2.0-old/include/applets.h busybox-1.2.0-new/include/applets.
USE_LOGGER(APPLET(logger, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_LOGIN(APPLET(login, _BB_DIR_BIN, _BB_SUID_ALWAYS))
USE_LOGNAME(APPLET(logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
diff -ruN busybox-1.2.0-old/miscutils/Config.in busybox-1.2.0-new/miscutils/Config.in
--- busybox-1.2.0-old/miscutils/Config.in 2006-07-01 00:42:09.000000000 +0200
+++ busybox-1.2.0-new/miscutils/Config.in 2006-08-01 10:21:15.000000000 +0200
@@ -231,6 +231,12 @@
diff -ruN busybox-1.3.1-old/miscutils/Config.in busybox-1.3.1/miscutils/Config.in
--- busybox-1.3.1-old/miscutils/Config.in 2006-12-27 05:56:09.000000000 +0100
+++ busybox-1.3.1/miscutils/Config.in 2006-12-28 03:14:16.000000000 +0100
@@ -232,6 +232,12 @@
Enables the 'hdparm -d' option to get/set using_dma flag.
This is dangerous stuff, so you should probably say N.
+config CONFIG_LOCK
+config LOCK
+ bool "lock"
+ default y
+ help
+ Small utility for using locks in scripts
+
config CONFIG_MAKEDEVS
config MAKEDEVS
bool "makedevs"
default n
diff -ruN busybox-1.2.0-old/miscutils/lock.c busybox-1.2.0-new/miscutils/lock.c
--- busybox-1.2.0-old/miscutils/lock.c 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.2.0-new/miscutils/lock.c 2006-08-01 10:21:15.000000000 +0200
diff -ruN busybox-1.3.1-old/miscutils/Kbuild busybox-1.3.1/miscutils/Kbuild
--- busybox-1.3.1-old/miscutils/Kbuild 2006-12-27 05:56:09.000000000 +0100
+++ busybox-1.3.1/miscutils/Kbuild 2006-12-28 03:15:47.000000000 +0100
@@ -15,6 +15,7 @@
lib-$(CONFIG_HDPARM) += hdparm.o
lib-$(CONFIG_LAST) += last.o
lib-$(CONFIG_LESS) += less.o
+lib-$(CONFIG_LOCK) += lock.o
lib-$(CONFIG_MAKEDEVS) += makedevs.o
lib-$(CONFIG_MOUNTPOINT) += mountpoint.o
lib-$(CONFIG_MT) += mt.o
diff -ruN busybox-1.3.1-old/miscutils/lock.c busybox-1.3.1/miscutils/lock.c
--- busybox-1.3.1-old/miscutils/lock.c 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.3.1/miscutils/lock.c 2006-12-28 03:11:36.000000000 +0100
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
@ -169,14 +175,3 @@ diff -ruN busybox-1.2.0-old/miscutils/lock.c busybox-1.2.0-new/miscutils/lock.c
+ else
+ return do_lock();
+}
diff -ruN busybox-1.2.0-old/miscutils/Makefile.in busybox-1.2.0-new/miscutils/Makefile.in
--- busybox-1.2.0-old/miscutils/Makefile.in 2006-07-01 00:42:09.000000000 +0200
+++ busybox-1.2.0-new/miscutils/Makefile.in 2006-08-01 10:21:15.000000000 +0200
@@ -20,6 +20,7 @@
MISCUTILS-$(CONFIG_EJECT) += eject.o
MISCUTILS-$(CONFIG_HDPARM) += hdparm.o
MISCUTILS-$(CONFIG_LAST) += last.o
+MISCUTILS-$(CONFIG_LOCK) += lock.o
MISCUTILS-${CONFIG_LESS} += less.o
MISCUTILS-$(CONFIG_MAKEDEVS) += makedevs.o
MISCUTILS-$(CONFIG_MOUNTPOINT) += mountpoint.o

File diff suppressed because it is too large Load Diff

View File

@ -5,10 +5,10 @@
#
# expose (again) an hash_fd function (used in 911-ipkg.patch)
#
diff -ruN busybox-1.2.0-orig/coreutils/md5_sha1_sum.c busybox-1.2.0-libbb_hash/coreutils/md5_sha1_sum.c
--- busybox-1.2.0-orig/coreutils/md5_sha1_sum.c 2006-07-01 00:42:07.000000000 +0200
+++ busybox-1.2.0-libbb_hash/coreutils/md5_sha1_sum.c 2006-07-22 17:08:02.000000000 +0200
@@ -16,79 +16,10 @@
diff -ruN busybox-1.3.1-orig/coreutils/md5_sha1_sum.c busybox-1.3.1-913/coreutils/md5_sha1_sum.c
--- busybox-1.3.1-orig/coreutils/md5_sha1_sum.c 2006-12-27 05:54:50.000000000 +0100
+++ busybox-1.3.1-913/coreutils/md5_sha1_sum.c 2006-12-28 00:59:35.000000000 +0100
@@ -8,78 +8,10 @@
#include "busybox.h"
@ -20,17 +20,14 @@ diff -ruN busybox-1.2.0-orig/coreutils/md5_sha1_sum.c busybox-1.2.0-libbb_hash/c
-/* This might be useful elsewhere */
-static unsigned char *hash_bin_to_hex(unsigned char *hash_value,
- unsigned char hash_length)
- unsigned hash_length)
-{
- int x, len, max;
- unsigned char *hex_value;
-
- max = (hash_length * 2) + 2;
- hex_value = xmalloc(max);
- for (x = len = 0; x < hash_length; x++) {
- len += snprintf((char*)(hex_value + len), max - len, "%02x", hash_value[x]);
- int len = 0;
- char *hex_value = xmalloc((hash_length * 2) + 2);
- while (hash_length--) {
- len += sprintf(hex_value + len, "%02x", *hash_value++);
- }
- return (hex_value);
- return hex_value;
-}
-
-static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo)
@ -45,11 +42,13 @@ diff -ruN busybox-1.2.0-orig/coreutils/md5_sha1_sum.c busybox-1.2.0-libbb_hash/c
- void (*update)(const void*, size_t, void*);
- void (*final)(void*, void*);
-
- if (strcmp(filename, "-") == 0) {
- src_fd = STDIN_FILENO;
- } else if(0 > (src_fd = open(filename, O_RDONLY))) {
- bb_perror_msg("%s", filename);
- return NULL;
- src_fd = STDIN_FILENO;
- if (filename[0] != '-' || filename[1]) { /* not "-" */
- src_fd = open(filename, O_RDONLY);
- if (src_fd < 0) {
- bb_perror_msg("%s", filename);
- return NULL;
- }
- }
-
- /* figure specific hash algorithims */
@ -67,7 +66,7 @@ diff -ruN busybox-1.2.0-orig/coreutils/md5_sha1_sum.c busybox-1.2.0-libbb_hash/c
- bb_error_msg_and_die("algorithm not supported");
- }
-
- while (0 < (count = read(src_fd, in_buf, 4096))) {
- while (0 < (count = safe_read(src_fd, in_buf, 4096))) {
- update(in_buf, count, &context);
- }
-
@ -85,22 +84,22 @@ diff -ruN busybox-1.2.0-orig/coreutils/md5_sha1_sum.c busybox-1.2.0-libbb_hash/c
- return hash_value;
-}
-
/* This could become a common function for md5 as well, by using md5_stream */
static int hash_files(int argc, char **argv, hash_algo_t hash_algo)
int md5_sha1_sum_main(int argc, char **argv)
{
diff -ruN busybox-1.2.0-orig/include/libbb.h busybox-1.2.0-libbb_hash/include/libbb.h
--- busybox-1.2.0-orig/include/libbb.h 2006-07-01 00:42:10.000000000 +0200
+++ busybox-1.2.0-libbb_hash/include/libbb.h 2006-07-22 17:01:06.000000000 +0200
@@ -518,6 +518,8 @@
extern int get_terminal_width_height(int fd, int *width, int *height);
extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *));
int return_value = EXIT_SUCCESS;
diff -ruN busybox-1.3.1-orig/include/libbb.h busybox-1.3.1-913/include/libbb.h
--- busybox-1.3.1-orig/include/libbb.h 2006-12-27 05:56:18.000000000 +0100
+++ busybox-1.3.1-913/include/libbb.h 2006-12-27 23:25:52.000000000 +0100
@@ -528,6 +528,8 @@
extern const char bb_uuenc_tbl_std[];
void bb_uuencode(const unsigned char *s, char *store, const int length, const char *tbl);
+typedef enum { HASH_SHA1, HASH_MD5 } hash_algo_t;
+
typedef struct _sha1_ctx_t_ {
typedef struct sha1_ctx_t {
uint32_t count[2];
uint32_t hash[5];
@@ -542,6 +544,10 @@
@@ -550,6 +552,10 @@
void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
void *md5_end(void *resbuf, md5_ctx_t *ctx);
@ -108,13 +107,13 @@ diff -ruN busybox-1.2.0-orig/include/libbb.h busybox-1.2.0-libbb_hash/include/li
+int hash_fd(int fd, hash_algo_t hash_algo, uint8_t *hash_value);
+uint8_t *hash_file(const char *filename, hash_algo_t hash_algo);
+
extern uint32_t *bb_crc32_filltable (int endian);
uint32_t *crc32_filltable(int endian);
#ifndef RB_POWER_OFF
diff -ruN busybox-1.2.0-orig/libbb/hash.c busybox-1.2.0-libbb_hash/libbb/hash.c
--- busybox-1.2.0-orig/libbb/hash.c 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.2.0-libbb_hash/libbb/hash.c 2006-07-22 17:07:34.000000000 +0200
@@ -0,0 +1,100 @@
diff -ruN busybox-1.3.1-orig/libbb/hash.c busybox-1.3.1-913/libbb/hash.c
--- busybox-1.3.1-orig/libbb/hash.c 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.3.1-913/libbb/hash.c 2006-12-28 00:48:52.000000000 +0100
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2003 Glenn L. McGrath
+ * Copyright (C) 2003-2004 Erik Andersen
@ -134,15 +133,12 @@ diff -ruN busybox-1.2.0-orig/libbb/hash.c busybox-1.2.0-libbb_hash/libbb/hash.c
+
+unsigned char *hash_bin_to_hex(unsigned char *hash_value, unsigned char hash_length)
+{
+ int x, len, max;
+ unsigned char *hex_value;
+
+ max = (hash_length * 2) + 2;
+ hex_value = xmalloc(max);
+ for (x = len = 0; x < hash_length; x++) {
+ len += snprintf((char*)(hex_value + len), max - len, "%02x", hash_value[x]);
+ int len = 0;
+ char *hex_value = xmalloc((hash_length * 2) + 2);
+ while (hash_length--) {
+ len += sprintf(hex_value + len, "%02x", *hash_value++);
+ }
+ return (hex_value);
+ return hex_value;
+}
+
+int hash_fd(int fd, hash_algo_t hash_algo, uint8_t *hash_value)
@ -168,7 +164,7 @@ diff -ruN busybox-1.2.0-orig/libbb/hash.c busybox-1.2.0-libbb_hash/libbb/hash.c
+ }
+
+
+ while (0 < (count = read(fd, in_buf, sizeof in_buf))) {
+ while (0 < (count = safe_read(fd, in_buf, sizeof in_buf))) {
+ update(in_buf, count, &context);
+ result += count;
+ }
@ -196,11 +192,13 @@ diff -ruN busybox-1.2.0-orig/libbb/hash.c busybox-1.2.0-libbb_hash/libbb/hash.c
+ bb_error_msg_and_die("algotithm not supported");
+ }
+
+ if (strcmp(filename, "-") == 0) {
+ src_fd = STDIN_FILENO;
+ } else if (0 > (src_fd = open(filename, O_RDONLY))) {
+ bb_perror_msg("%s", filename);
+ return NULL;
+ src_fd = STDIN_FILENO;
+ if (filename[0] != '-' || filename[1]) { /* not "-" */
+ src_fd = open(filename, O_RDONLY);
+ if (src_fd < 0) {
+ bb_perror_msg("%s", filename);
+ return NULL;
+ }
+ }
+
+ if (hash_fd(src_fd, hash_algo, hash_buf) > 0) {
@ -215,14 +213,14 @@ diff -ruN busybox-1.2.0-orig/libbb/hash.c busybox-1.2.0-libbb_hash/libbb/hash.c
+
+ return hash_value;
+}
diff -ruN busybox-1.2.0-orig/libbb/Makefile.in busybox-1.2.0-libbb_hash/libbb/Makefile.in
--- busybox-1.2.0-orig/libbb/Makefile.in 2006-07-01 00:42:08.000000000 +0200
+++ busybox-1.2.0-libbb_hash/libbb/Makefile.in 2006-07-22 16:51:47.000000000 +0200
@@ -11,6 +11,7 @@
LIBBB-n:=
LIBBB-y:= \
+ hash.c \
bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \
compare_string_array.c concat_path_file.c copy_file.c copyfd.c \
crc32.c create_icmp_socket.c create_icmp6_socket.c \
diff -ruN busybox-1.3.1-orig/libbb/Kbuild busybox-1.3.1-913/libbb/Kbuild
--- busybox-1.3.1-orig/libbb/Kbuild 2006-12-27 05:55:04.000000000 +0100
+++ busybox-1.3.1-913/libbb/Kbuild 2006-12-27 23:31:20.000000000 +0100
@@ -37,6 +37,7 @@
lib-y += get_last_path_component.o
lib-y += get_line_from_file.o
lib-y += getopt32.o
+lib-y += hash.o
lib-y += herror_msg.o
lib-y += herror_msg_and_die.o
lib-y += human_readable.o