Loading package/busybox/busybox-1.4.0-conf.patch 0 → 100644 +37 −0 Original line number Diff line number Diff line --- busybox-1.4.0/applets/applets.c Fri Jan 19 22:23:11 2007 +++ busybox-1.4.0-conf/applets/applets.c Wed Jan 24 10:15:49 2007 @@ -340,20 +340,26 @@ if (sct) { mode_t m = sct->m_mode; - if (sct->m_uid == ruid) /* same uid */ + if (sct->m_uid == ruid) + /* same uid */ m >>= 6; - else if ((sct->m_gid == rgid) || ingroup(ruid, sct->m_gid)) /* same group / in group */ + else if ((sct->m_gid == rgid) || ingroup(ruid, sct->m_gid)) + /* same group / in group */ m >>= 3; if (!(m & S_IXOTH)) /* is x bit not set ? */ bb_error_msg_and_die("you have no permission to run this applet!"); - if ((sct->m_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { /* *both* have to be set for sgid */ - xsetgid(sct->m_gid); - } else xsetgid(rgid); /* no sgid -> drop */ - - if (sct->m_mode & S_ISUID) xsetuid(sct->m_uid); - else xsetuid(ruid); /* no suid -> drop */ + if (sct->m_gid != 0) { + /* _both_ have to be set for sgid */ + if ((sct->m_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { + xsetgid(sct->m_gid); + } else xsetgid(rgid); /* no sgid -> drop */ + } + if (sct->m_uid != 0) { + if (sct->m_mode & S_ISUID) xsetuid(sct->m_uid); + else xsetuid(ruid); /* no suid -> drop */ + } } else { /* default: drop all privileges */ xsetgid(rgid); package/busybox/busybox-1.4.0-libnetlink.patch 0 → 100644 +19 −0 Original line number Diff line number Diff line --- busybox-1.4.0/networking/libiproute/libnetlink.h Fri Jan 19 22:22:58 2007 +++ busybox-1.4.0-libnetlink/networking/libiproute/libnetlink.h Tue Jan 23 00:30:45 2007 @@ -2,6 +2,9 @@ #ifndef __LIBNETLINK_H__ #define __LIBNETLINK_H__ 1 +#include <linux/types.h> +/* We need linux/types.h because older kernels use __u32 etc + * in linux/[rt]netlink.h. 2.6.19 seems to be ok, though */ #include <linux/netlink.h> #include <linux/rtnetlink.h> @@ -37,6 +40,4 @@ extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); - #endif /* __LIBNETLINK_H__ */ - package/busybox/busybox-1.4.0-parse_config_file.patch 0 → 100644 +11 −0 Original line number Diff line number Diff line --- busybox-1.4.0/applets/applets.c Fri Jan 19 22:23:11 2007 +++ busybox-1.4.0-parse_config_file/applets/applets.c Tue Jan 23 21:35:00 2007 @@ -320,7 +320,7 @@ } #else -#define parse_config_file() +#define parse_config_file() ((void)0) #endif /* CONFIG_FEATURE_SUID_CONFIG */ #ifdef CONFIG_FEATURE_SUID package/busybox/busybox-1.4.0-syslogd-n.patch 0 → 100644 +65 −0 Original line number Diff line number Diff line --- busybox-1.4.0/libbb/vdprintf.c Fri Jan 19 22:23:06 2007 +++ busybox-1.4.0-syslogd-n/libbb/vdprintf.c Tue Jan 23 21:50:54 2007 @@ -7,11 +7,7 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include <stdio.h> -#include <unistd.h> #include "libbb.h" - - #if defined(__GLIBC__) && __GLIBC__ < 2 int vdprintf(int d, const char *format, va_list ap) --- busybox-1.4.0/libbb/xfuncs.c Fri Jan 19 22:23:06 2007 +++ busybox-1.4.0-syslogd-n/libbb/xfuncs.c Tue Jan 23 21:47:27 2007 @@ -81,13 +81,14 @@ t = (char*) s; while (m) { if (!*t) break; - m--; t++; + m--; + t++; } - n = n - m; + n -= m; t = xmalloc(n + 1); t[n] = '\0'; - return memcpy(t,s,n); + return memcpy(t, s, n); } // Die if we can't open a file and return a FILE * to it. --- busybox-1.4.0/libbb/xreadlink.c Fri Jan 19 22:23:06 2007 +++ busybox-1.4.0-syslogd-n/libbb/xreadlink.c Tue Jan 23 22:35:45 2007 @@ -36,7 +36,7 @@ char *xmalloc_realpath(const char *path) { -#ifdef __GLIBC__ +#if defined(__GLIBC__) && !defined(__UCLIBC__) /* glibc provides a non-standard extension */ return realpath(path, NULL); #else --- busybox-1.4.0/sysklogd/syslogd.c Fri Jan 19 22:23:02 2007 +++ busybox-1.4.0-syslogd-n/sysklogd/syslogd.c Wed Jan 24 21:52:07 2007 @@ -569,7 +569,7 @@ //if (option_mask32 & OPT_locallog) // -L #endif #if ENABLE_FEATURE_IPC_SYSLOG - if ((option_mask32 & OPT_circularlog) && opt_C) // -C + if (opt_C) // -Cn shm_size = xatoul_range(opt_C, 4, INT_MAX/1024) * 1024; #endif @@ -588,7 +588,7 @@ #ifdef BB_NOMMU vfork_daemon_rexec(0, 1, argc, argv, "-n"); #else - xdaemon(0, 1); + bb_daemonize(); #endif } umask(0); package/busybox/busybox-1.4.0-tar.patch 0 → 100644 +117 −0 Original line number Diff line number Diff line --- busybox-1.4.0/archival/tar.c Fri Jan 19 22:23:02 2007 +++ busybox-1.4.0-tar/archival/tar.c Wed Jan 24 21:32:00 2007 @@ -23,10 +23,10 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include "busybox.h" -#include "unarchive.h" #include <fnmatch.h> #include <getopt.h> +#include "busybox.h" +#include "unarchive.h" #if ENABLE_FEATURE_TAR_CREATE @@ -37,6 +37,7 @@ /* POSIX tar Header Block, from POSIX 1003.1-1990 */ #define NAME_SIZE 100 #define NAME_SIZE_STR "100" +typedef struct TarHeader TarHeader; struct TarHeader { /* byte offset */ char name[NAME_SIZE]; /* 0-99 */ char mode[8]; /* 100-107 */ @@ -56,7 +57,6 @@ char prefix[155]; /* 345-499 */ char padding[12]; /* 500-512 (pad to exactly the TAR_BLOCK_SIZE) */ }; -typedef struct TarHeader TarHeader; /* ** writeTarFile(), writeFileToTarball(), and writeTarHeader() are @@ -73,6 +73,7 @@ }; /* Some info to be carried along when creating a new tarball */ +typedef struct TarBallInfo TarBallInfo; struct TarBallInfo { int tarFd; /* Open-for-write file descriptor for the tarball */ @@ -85,7 +86,6 @@ HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */ HardLinkInfo *hlInfo; /* Hard Link Info for the current file */ }; -typedef struct TarBallInfo TarBallInfo; /* A nice enum with all the possible tar file content types */ enum TarFileType { @@ -348,7 +348,7 @@ return TRUE; } -# if ENABLE_FEATURE_TAR_FROM +#if ENABLE_FEATURE_TAR_FROM static int exclude_file(const llist_t *excluded_files, const char *file) { while (excluded_files) { @@ -371,12 +371,12 @@ return 0; } -# else +#else #define exclude_file(excluded_files, file) 0 -# endif +#endif static int writeFileToTarball(const char *fileName, struct stat *statbuf, - void *userData, int depth) + void *userData, int depth ATTRIBUTE_UNUSED) { struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData; const char *header_name; @@ -509,14 +509,14 @@ if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0) bb_perror_msg_and_die("pipe"); - signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */ + signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */ -# if __GNUC__ +#if defined(__GNUC__) && __GNUC__ /* Avoid vfork clobbering */ (void) &include; (void) &errorFlag; (void) &zip_exec; -# endif +#endif gzipPid = vfork(); @@ -600,7 +600,7 @@ int writeTarFile(const int tar_fd, const int verboseFlag, const unsigned long dereferenceFlag, const llist_t *include, const llist_t *exclude, const int gzip); -#endif /* tar_create */ +#endif /* FEATURE_TAR_CREATE */ #if ENABLE_FEATURE_TAR_FROM static llist_t *append_file_list_to_list(llist_t *list) @@ -628,7 +628,7 @@ return newlist; } #else -#define append_file_list_to_list(x) 0 +#define append_file_list_to_list(x) 0 #endif #if ENABLE_FEATURE_TAR_COMPRESS @@ -653,7 +653,7 @@ return EXIT_FAILURE; } #else -#define get_header_tar_Z 0 +#define get_header_tar_Z NULL #endif #ifdef CHECK_FOR_CHILD_EXITCODE Loading
package/busybox/busybox-1.4.0-conf.patch 0 → 100644 +37 −0 Original line number Diff line number Diff line --- busybox-1.4.0/applets/applets.c Fri Jan 19 22:23:11 2007 +++ busybox-1.4.0-conf/applets/applets.c Wed Jan 24 10:15:49 2007 @@ -340,20 +340,26 @@ if (sct) { mode_t m = sct->m_mode; - if (sct->m_uid == ruid) /* same uid */ + if (sct->m_uid == ruid) + /* same uid */ m >>= 6; - else if ((sct->m_gid == rgid) || ingroup(ruid, sct->m_gid)) /* same group / in group */ + else if ((sct->m_gid == rgid) || ingroup(ruid, sct->m_gid)) + /* same group / in group */ m >>= 3; if (!(m & S_IXOTH)) /* is x bit not set ? */ bb_error_msg_and_die("you have no permission to run this applet!"); - if ((sct->m_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { /* *both* have to be set for sgid */ - xsetgid(sct->m_gid); - } else xsetgid(rgid); /* no sgid -> drop */ - - if (sct->m_mode & S_ISUID) xsetuid(sct->m_uid); - else xsetuid(ruid); /* no suid -> drop */ + if (sct->m_gid != 0) { + /* _both_ have to be set for sgid */ + if ((sct->m_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { + xsetgid(sct->m_gid); + } else xsetgid(rgid); /* no sgid -> drop */ + } + if (sct->m_uid != 0) { + if (sct->m_mode & S_ISUID) xsetuid(sct->m_uid); + else xsetuid(ruid); /* no suid -> drop */ + } } else { /* default: drop all privileges */ xsetgid(rgid);
package/busybox/busybox-1.4.0-libnetlink.patch 0 → 100644 +19 −0 Original line number Diff line number Diff line --- busybox-1.4.0/networking/libiproute/libnetlink.h Fri Jan 19 22:22:58 2007 +++ busybox-1.4.0-libnetlink/networking/libiproute/libnetlink.h Tue Jan 23 00:30:45 2007 @@ -2,6 +2,9 @@ #ifndef __LIBNETLINK_H__ #define __LIBNETLINK_H__ 1 +#include <linux/types.h> +/* We need linux/types.h because older kernels use __u32 etc + * in linux/[rt]netlink.h. 2.6.19 seems to be ok, though */ #include <linux/netlink.h> #include <linux/rtnetlink.h> @@ -37,6 +40,4 @@ extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); - #endif /* __LIBNETLINK_H__ */ -
package/busybox/busybox-1.4.0-parse_config_file.patch 0 → 100644 +11 −0 Original line number Diff line number Diff line --- busybox-1.4.0/applets/applets.c Fri Jan 19 22:23:11 2007 +++ busybox-1.4.0-parse_config_file/applets/applets.c Tue Jan 23 21:35:00 2007 @@ -320,7 +320,7 @@ } #else -#define parse_config_file() +#define parse_config_file() ((void)0) #endif /* CONFIG_FEATURE_SUID_CONFIG */ #ifdef CONFIG_FEATURE_SUID
package/busybox/busybox-1.4.0-syslogd-n.patch 0 → 100644 +65 −0 Original line number Diff line number Diff line --- busybox-1.4.0/libbb/vdprintf.c Fri Jan 19 22:23:06 2007 +++ busybox-1.4.0-syslogd-n/libbb/vdprintf.c Tue Jan 23 21:50:54 2007 @@ -7,11 +7,7 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include <stdio.h> -#include <unistd.h> #include "libbb.h" - - #if defined(__GLIBC__) && __GLIBC__ < 2 int vdprintf(int d, const char *format, va_list ap) --- busybox-1.4.0/libbb/xfuncs.c Fri Jan 19 22:23:06 2007 +++ busybox-1.4.0-syslogd-n/libbb/xfuncs.c Tue Jan 23 21:47:27 2007 @@ -81,13 +81,14 @@ t = (char*) s; while (m) { if (!*t) break; - m--; t++; + m--; + t++; } - n = n - m; + n -= m; t = xmalloc(n + 1); t[n] = '\0'; - return memcpy(t,s,n); + return memcpy(t, s, n); } // Die if we can't open a file and return a FILE * to it. --- busybox-1.4.0/libbb/xreadlink.c Fri Jan 19 22:23:06 2007 +++ busybox-1.4.0-syslogd-n/libbb/xreadlink.c Tue Jan 23 22:35:45 2007 @@ -36,7 +36,7 @@ char *xmalloc_realpath(const char *path) { -#ifdef __GLIBC__ +#if defined(__GLIBC__) && !defined(__UCLIBC__) /* glibc provides a non-standard extension */ return realpath(path, NULL); #else --- busybox-1.4.0/sysklogd/syslogd.c Fri Jan 19 22:23:02 2007 +++ busybox-1.4.0-syslogd-n/sysklogd/syslogd.c Wed Jan 24 21:52:07 2007 @@ -569,7 +569,7 @@ //if (option_mask32 & OPT_locallog) // -L #endif #if ENABLE_FEATURE_IPC_SYSLOG - if ((option_mask32 & OPT_circularlog) && opt_C) // -C + if (opt_C) // -Cn shm_size = xatoul_range(opt_C, 4, INT_MAX/1024) * 1024; #endif @@ -588,7 +588,7 @@ #ifdef BB_NOMMU vfork_daemon_rexec(0, 1, argc, argv, "-n"); #else - xdaemon(0, 1); + bb_daemonize(); #endif } umask(0);
package/busybox/busybox-1.4.0-tar.patch 0 → 100644 +117 −0 Original line number Diff line number Diff line --- busybox-1.4.0/archival/tar.c Fri Jan 19 22:23:02 2007 +++ busybox-1.4.0-tar/archival/tar.c Wed Jan 24 21:32:00 2007 @@ -23,10 +23,10 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include "busybox.h" -#include "unarchive.h" #include <fnmatch.h> #include <getopt.h> +#include "busybox.h" +#include "unarchive.h" #if ENABLE_FEATURE_TAR_CREATE @@ -37,6 +37,7 @@ /* POSIX tar Header Block, from POSIX 1003.1-1990 */ #define NAME_SIZE 100 #define NAME_SIZE_STR "100" +typedef struct TarHeader TarHeader; struct TarHeader { /* byte offset */ char name[NAME_SIZE]; /* 0-99 */ char mode[8]; /* 100-107 */ @@ -56,7 +57,6 @@ char prefix[155]; /* 345-499 */ char padding[12]; /* 500-512 (pad to exactly the TAR_BLOCK_SIZE) */ }; -typedef struct TarHeader TarHeader; /* ** writeTarFile(), writeFileToTarball(), and writeTarHeader() are @@ -73,6 +73,7 @@ }; /* Some info to be carried along when creating a new tarball */ +typedef struct TarBallInfo TarBallInfo; struct TarBallInfo { int tarFd; /* Open-for-write file descriptor for the tarball */ @@ -85,7 +86,6 @@ HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */ HardLinkInfo *hlInfo; /* Hard Link Info for the current file */ }; -typedef struct TarBallInfo TarBallInfo; /* A nice enum with all the possible tar file content types */ enum TarFileType { @@ -348,7 +348,7 @@ return TRUE; } -# if ENABLE_FEATURE_TAR_FROM +#if ENABLE_FEATURE_TAR_FROM static int exclude_file(const llist_t *excluded_files, const char *file) { while (excluded_files) { @@ -371,12 +371,12 @@ return 0; } -# else +#else #define exclude_file(excluded_files, file) 0 -# endif +#endif static int writeFileToTarball(const char *fileName, struct stat *statbuf, - void *userData, int depth) + void *userData, int depth ATTRIBUTE_UNUSED) { struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData; const char *header_name; @@ -509,14 +509,14 @@ if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0) bb_perror_msg_and_die("pipe"); - signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */ + signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */ -# if __GNUC__ +#if defined(__GNUC__) && __GNUC__ /* Avoid vfork clobbering */ (void) &include; (void) &errorFlag; (void) &zip_exec; -# endif +#endif gzipPid = vfork(); @@ -600,7 +600,7 @@ int writeTarFile(const int tar_fd, const int verboseFlag, const unsigned long dereferenceFlag, const llist_t *include, const llist_t *exclude, const int gzip); -#endif /* tar_create */ +#endif /* FEATURE_TAR_CREATE */ #if ENABLE_FEATURE_TAR_FROM static llist_t *append_file_list_to_list(llist_t *list) @@ -628,7 +628,7 @@ return newlist; } #else -#define append_file_list_to_list(x) 0 +#define append_file_list_to_list(x) 0 #endif #if ENABLE_FEATURE_TAR_COMPRESS @@ -653,7 +653,7 @@ return EXIT_FAILURE; } #else -#define get_header_tar_Z 0 +#define get_header_tar_Z NULL #endif #ifdef CHECK_FOR_CHILD_EXITCODE