From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- .../1.6.2-patches/cronolog-define-strptime.patch | 11 + .../files/1.6.2-patches/cronolog-doc.patch | 12 + .../files/1.6.2-patches/cronolog-getopt-long.patch | 24 ++ .../files/1.6.2-patches/cronolog-large-file.patch | 27 ++ .../1.6.2-patches/cronolog-missing-symlink.patch | 11 + .../files/1.6.2-patches/cronolog-setugid.patch | 390 +++++++++++++++++++++ .../files/1.6.2-patches/cronolog-sigusr1.patch | 46 +++ .../files/1.6.2-patches/cronolog-strftime.patch | 26 ++ 8 files changed, 547 insertions(+) create mode 100644 app-admin/cronolog/files/1.6.2-patches/cronolog-define-strptime.patch create mode 100644 app-admin/cronolog/files/1.6.2-patches/cronolog-doc.patch create mode 100644 app-admin/cronolog/files/1.6.2-patches/cronolog-getopt-long.patch create mode 100644 app-admin/cronolog/files/1.6.2-patches/cronolog-large-file.patch create mode 100644 app-admin/cronolog/files/1.6.2-patches/cronolog-missing-symlink.patch create mode 100644 app-admin/cronolog/files/1.6.2-patches/cronolog-setugid.patch create mode 100644 app-admin/cronolog/files/1.6.2-patches/cronolog-sigusr1.patch create mode 100644 app-admin/cronolog/files/1.6.2-patches/cronolog-strftime.patch (limited to 'app-admin/cronolog/files/1.6.2-patches') diff --git a/app-admin/cronolog/files/1.6.2-patches/cronolog-define-strptime.patch b/app-admin/cronolog/files/1.6.2-patches/cronolog-define-strptime.patch new file mode 100644 index 000000000000..26ac2a40319c --- /dev/null +++ b/app-admin/cronolog/files/1.6.2-patches/cronolog-define-strptime.patch @@ -0,0 +1,11 @@ +diff -urb cronolog-1.6.2/src/cronoutils.c cronolog-1.6.2-patched/src/cronoutils.c +--- a/src/cronoutils.c 2001-05-03 09:43:21.000000000 -0700 ++++ b/src/cronoutils.c 2008-01-05 22:08:42.000000000 -0800 +@@ -69,6 +69,8 @@ + * + */ + ++#define _GNU_SOURCE ++ + #include "cronoutils.h" + extern char *tzname[2]; diff --git a/app-admin/cronolog/files/1.6.2-patches/cronolog-doc.patch b/app-admin/cronolog/files/1.6.2-patches/cronolog-doc.patch new file mode 100644 index 000000000000..b4b68d5690a9 --- /dev/null +++ b/app-admin/cronolog/files/1.6.2-patches/cronolog-doc.patch @@ -0,0 +1,12 @@ +diff -ur cronolog-1.6.2/doc/cronolog.1m cronolog-1.6.2/doc/cronolog.1m +--- a/doc/cronolog.1m 2001-05-04 01:44:55.000000000 -0700 ++++ b/doc/cronolog.1m 2008-01-06 00:43:33.000000000 -0800 +@@ -77,7 +77,7 @@ + to the current log file. + .\" + .IP "-P \fINAME\fP" +-.IP "--prevlink=\fINAME\fP" ++.IP "--prev-symlink=\fINAME\fP" + maintain a symbolic link from + .I NAME + to the previous log file. Requires that the diff --git a/app-admin/cronolog/files/1.6.2-patches/cronolog-getopt-long.patch b/app-admin/cronolog/files/1.6.2-patches/cronolog-getopt-long.patch new file mode 100644 index 000000000000..b7eb5c1760c4 --- /dev/null +++ b/app-admin/cronolog/files/1.6.2-patches/cronolog-getopt-long.patch @@ -0,0 +1,24 @@ +diff -urp cronolog-1.6.2/src/cronolog.c cronolog-1.6.2/src/cronolog.c +--- a/src/cronolog.c 2001-05-03 09:42:48.000000000 -0700 ++++ b/src/cronolog.c 2008-01-05 23:54:53.000000000 -0800 +@@ -139,7 +139,8 @@ struct option long_options[] = + { "delay", required_argument, NULL, 'd' }, + { "once-only", no_argument, NULL, 'o' }, + { "help", no_argument, NULL, 'h' }, +- { "version", no_argument, NULL, 'V' } ++ { "version", no_argument, NULL, 'V' }, ++ { NULL, 0, NULL, 0 } + }; + #endif + +diff -urp cronolog-1.6.2/src/cronotest.c cronolog-1.6.2/src/cronotest.c +--- cronolog-1.6.2/src/cronotest.c 2001-05-03 09:26:44.000000000 -0700 ++++ cronolog-1.6.2/src/cronotest.c 2008-01-06 00:02:24.000000000 -0800 +@@ -112,7 +112,8 @@ struct option long_options[] = + { "test-subdirs", required_argument, NULL, 'D' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, +- { "verbose", no_argument, NULL, 'v' } ++ { "verbose", no_argument, NULL, 'v' }, ++ { NULL, 0, NULL, 0 } + }; diff --git a/app-admin/cronolog/files/1.6.2-patches/cronolog-large-file.patch b/app-admin/cronolog/files/1.6.2-patches/cronolog-large-file.patch new file mode 100644 index 000000000000..25e488f061c0 --- /dev/null +++ b/app-admin/cronolog/files/1.6.2-patches/cronolog-large-file.patch @@ -0,0 +1,27 @@ +--- a/src/cronolog.c 2003-10-13 12:35:17.000000000 +0000 ++++ b/src/cronolog.c 2003-10-13 12:36:36.000000000 +0000 +@@ -82,6 +82,8 @@ + * written to "file" (e.g. /dev/console) or to stderr if "file" is "-". + */ + ++#define _GNU_SOURCE 1 ++ + #include "cronoutils.h" + #include "getopt.h" + +@@ -394,13 +396,13 @@ + timestamp(*pnext_period), *pnext_period, + *pnext_period - time_now)); + +- log_fd = open(pfilename, O_WRONLY|O_CREAT|O_APPEND, FILE_MODE); ++ log_fd = open(pfilename, O_WRONLY|O_CREAT|O_APPEND|O_LARGEFILE, FILE_MODE); + + #ifndef DONT_CREATE_SUBDIRS + if ((log_fd < 0) && (errno == ENOENT)) + { + create_subdirs(pfilename); +- log_fd = open(pfilename, O_WRONLY|O_CREAT|O_APPEND, FILE_MODE); ++ log_fd = open(pfilename, O_WRONLY|O_CREAT|O_APPEND|O_LARGEFILE, FILE_MODE); + } + #endif + diff --git a/app-admin/cronolog/files/1.6.2-patches/cronolog-missing-symlink.patch b/app-admin/cronolog/files/1.6.2-patches/cronolog-missing-symlink.patch new file mode 100644 index 000000000000..974c69faa74a --- /dev/null +++ b/app-admin/cronolog/files/1.6.2-patches/cronolog-missing-symlink.patch @@ -0,0 +1,11 @@ +--- a/src/cronoutils.c 2003-10-13 12:44:59.000000000 +0000 ++++ b/src/cronoutils.c 2003-10-13 12:45:08.000000000 +0000 +@@ -199,7 +199,7 @@ + { + unlink(prevlinkname); + } +- if (stat(linkname, &stat_buf) == 0) ++ if (lstat(linkname, &stat_buf) == 0) + { + if (prevlinkname) { + rename(linkname, prevlinkname); diff --git a/app-admin/cronolog/files/1.6.2-patches/cronolog-setugid.patch b/app-admin/cronolog/files/1.6.2-patches/cronolog-setugid.patch new file mode 100644 index 000000000000..8fe4c0f12396 --- /dev/null +++ b/app-admin/cronolog/files/1.6.2-patches/cronolog-setugid.patch @@ -0,0 +1,390 @@ +diff -Naur cronolog-1.6.2/configure cronolog-1.6.2-new/configure +--- a/configure Thu May 3 17:44:22 2001 ++++ b/configure Mon Jun 3 00:38:32 2002 +@@ -1757,15 +1757,49 @@ + + fi + ++echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 ++echo "configure:1762: checking for uid_t in sys/types.h" >&5 ++if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ++ egrep "uid_t" >/dev/null 2>&1; then ++ rm -rf conftest* ++ ac_cv_type_uid_t=yes ++else ++ rm -rf conftest* ++ ac_cv_type_uid_t=no ++fi ++rm -f conftest* ++ ++fi ++ ++echo "$ac_t""$ac_cv_type_uid_t" 1>&6 ++if test $ac_cv_type_uid_t = no; then ++ cat >> confdefs.h <<\EOF ++#define uid_t int ++EOF ++ ++ cat >> confdefs.h <<\EOF ++#define gid_t int ++EOF ++ ++fi ++ + + + echo $ac_n "checking for strftime""... $ac_c" 1>&6 +-echo "configure:1764: checking for strftime" >&5 ++echo "configure:1798: checking for strftime" >&5 + if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_strftime=yes" + else +@@ -1810,7 +1844,7 @@ + echo "$ac_t""no" 1>&6 + # strftime is in -lintl on SCO UNIX. + echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 +-echo "configure:1814: checking for strftime in -lintl" >&5 ++echo "configure:1848: checking for strftime in -lintl" >&5 + ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +@@ -1818,7 +1852,7 @@ + ac_save_LIBS="$LIBS" + LIBS="-lintl $LIBS" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else +@@ -1856,12 +1890,12 @@ + fi + + echo $ac_n "checking for vprintf""... $ac_c" 1>&6 +-echo "configure:1860: checking for vprintf" >&5 ++echo "configure:1894: checking for vprintf" >&5 + if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" + else +@@ -1908,12 +1942,12 @@ + + if test "$ac_cv_func_vprintf" != yes; then + echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 +-echo "configure:1912: checking for _doprnt" >&5 ++echo "configure:1946: checking for _doprnt" >&5 + if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func__doprnt=yes" + else +@@ -1963,12 +1997,12 @@ + for ac_func in mkdir mktime putenv + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +-echo "configure:1967: checking for $ac_func" >&5 ++echo "configure:2001: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:2029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else +@@ -2018,12 +2052,12 @@ + for ac_func in strptime localtime_r + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +-echo "configure:2022: checking for $ac_func" >&5 ++echo "configure:2056: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:2084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else +diff -Naur cronolog-1.6.2/configure.in cronolog-1.6.2-new/configure.in +--- cronolog-1.6.2/configure.in Thu May 3 17:30:50 2001 ++++ cronolog-1.6.2-new/configure.in Mon Jun 3 00:38:32 2002 +@@ -56,6 +56,7 @@ + AC_C_CONST + AC_TYPE_SIZE_T + AC_STRUCT_TM ++AC_TYPE_UID_T + + dnl Checks for library functions. + +diff -Naur cronolog-1.6.2/doc/cronolog.1m cronolog-1.6.2-new/doc/cronolog.1m +--- cronolog-1.6.2/doc/cronolog.1m Fri May 4 09:44:55 2001 ++++ cronolog-1.6.2-new/doc/cronolog.1m Mon Jun 3 00:39:10 2002 +@@ -89,6 +89,20 @@ + .IP --help + print a help message and then exit. + .\" ++.IP "-u \fIUSER\fP" ++.IP "--set-uid=\fIUSER\fP" ++sets the user ID of the cronolog process before any logs are opened. ++\fIUSER\fP can be a username or a numeric user ID. If \fIUSER\fP ++contains solely digits, it will be assumed to be a numeric user ID; ++otherwise, it will be assumed to be a username. ++.\" ++.IP "-g \fIGROUP\fP" ++.IP "--set-gid=\fIGROUP\fP" ++sets the group ID of the cronolog process before any logs are opened. ++\fIGROUP\fP can be a group name or a numeric group ID. If \fIGROUP\fP ++contains solely digits, it will be assumed to be a numeric group ID; ++otherwise, it will be assumed to be a group name. ++.\" + .IP "-p \fIPERIOD\fP" + .IP "--period=\fIPERIOD\fP" + specifies the period explicitly as an optional digit string followed +diff -Naur cronolog-1.6.2/src/cronolog.c cronolog-1.6.2-new/src/cronolog.c +--- cronolog-1.6.2/src/cronolog.c Thu May 3 17:42:48 2001 ++++ cronolog-1.6.2-new/src/cronolog.c Mon Jun 3 00:38:32 2002 +@@ -100,6 +100,12 @@ + #define VERSION_MSG "cronolog version 0.1\n" + #endif + ++#ifndef _WIN32 ++#define SETUGID_USAGE " -u USER, --set-uid=USER change to USER before doing anything (name or UID)\n" \ ++ " -g GROUP, --set-gid=GROUP change to GROUP before doing anything (name or GID)\n" ++#else ++#define SETUGID_USAGE "" ++#endif + + #define USAGE_MSG "usage: %s [OPTIONS] logfile-spec\n" \ + "\n" \ +@@ -117,12 +123,17 @@ + " -e, --european European date formats (default)\n" \ + " -s, --start-time=TIME starting time\n" \ + " -z TZ, --time-zone=TZ use TZ for timezone\n" \ ++ SETUGID_USAGE \ + " -V, --version print version number, then exit\n" + + + /* Definition of the short and long program options */ + ++#ifndef _WIN32 ++char *short_options = "ad:eop:s:z:H:P:S:l:hVx:u:g:"; ++#else + char *short_options = "ad:eop:s:z:H:P:S:l:hVx:"; ++#endif + + #ifndef _WIN32 + struct option long_options[] = +@@ -137,6 +148,8 @@ + { "link", required_argument, NULL, 'l' }, + { "period", required_argument, NULL, 'p' }, + { "delay", required_argument, NULL, 'd' }, ++ { "set-uid", required_argument, NULL, 'u' }, ++ { "set-gid", required_argument, NULL, 'g' }, + { "once-only", no_argument, NULL, 'o' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' } +@@ -160,6 +173,12 @@ + char *template; + char *linkname = NULL; + char *prevlinkname = NULL; ++#ifndef _WIN32 ++ uid_t new_uid = 0; ++ gid_t new_gid = 0; ++ int change_uid = 0; ++ int change_gid = 0; ++#endif + mode_t linktype = 0; + int n_bytes_read; + int ch; +@@ -234,6 +253,16 @@ + } + break; + ++#ifndef _WIN32 ++ case 'u': ++ new_uid = parse_uid(optarg, argv[0]); ++ change_uid = 1; ++ break; ++ case 'g': ++ new_gid = parse_gid(optarg, argv[0]); ++ change_gid = 1; ++ break; ++#endif + case 'o': + periodicity = ONCE_ONLY; + break; +@@ -265,6 +294,17 @@ + fprintf(stderr, USAGE_MSG, argv[0]); + exit(1); + } ++ ++#ifndef _WIN32 ++ if (change_gid && setgid(new_gid) == -1) { ++ fprintf(stderr, "setgid: unable to change to gid: %d\n", new_gid); ++ exit(1); ++ } ++ if (change_uid && setuid(new_uid) == -1) { ++ fprintf(stderr, "setuid: unable to change to uid: %d\n", new_uid); ++ exit(1); ++ } ++#endif + + DEBUG((VERSION_MSG "\n")); + +diff -Naur cronolog-1.6.2/src/cronoutils.c cronolog-1.6.2-new/src/cronoutils.c +--- cronolog-1.6.2/src/cronoutils.c Thu May 3 17:43:21 2001 ++++ cronolog-1.6.2-new/src/cronoutils.c Mon Jun 3 00:38:32 2002 +@@ -710,4 +710,50 @@ + return retval; + } + +- ++ ++#ifndef _WIN32 ++/* Turn a string specifying either a username or UID into an actual ++ * uid_t for use in setuid(). A string is assumed to be a UID if ++ * it contains only decimal digits. */ ++uid_t ++parse_uid(char *user, char *argv0) ++{ ++ char *probe = user; ++ struct passwd *ent; ++ ++ while (*probe && isdigit(*probe)) { ++ probe++; ++ } ++ if (!(*probe)) { ++ return atoi(user); ++ } ++ if (!(ent = getpwnam(user))) { ++ fprintf(stderr, "%s: Bad username %s\n", argv0, user); ++ exit(1); ++ } ++ return (ent->pw_uid); ++} ++ ++ ++/* Turn a string specifying either a group name or GID into an actual ++ * gid_t for use in setgid(). A string is assumed to be a GID if ++ * it contains only decimal digits. */ ++gid_t ++parse_gid(char *group, char *argv0) ++{ ++ char *probe = group; ++ struct group *ent; ++ ++ while (*probe && isdigit(*probe)) { ++ probe++; ++ } ++ if (!(*probe)) { ++ return atoi(group); ++ } ++ if (!(ent = getgrnam(group))) { ++ fprintf(stderr, "%s: Bad group name %s\n", argv0, group); ++ exit(1); ++ } ++ return (ent->gr_gid); ++} ++#endif /* _WIN32 */ +diff -Naur cronolog-1.6.2/src/cronoutils.h cronolog-1.6.2-new/src/cronoutils.h +--- cronolog-1.6.2/src/cronoutils.h Thu May 3 17:40:12 2001 ++++ cronolog-1.6.2-new/src/cronoutils.h Mon Jun 3 00:38:32 2002 +@@ -84,6 +84,8 @@ + #include + #ifndef _WIN32 + #include ++#include ++#include + #else + #include + #include +@@ -172,7 +174,8 @@ + void print_debug_msg(char *msg, ...); + time_t parse_time(char *time_str, int); + char *timestamp(time_t thetime); +- ++uid_t parse_uid(char *user, char *argv0); ++gid_t parse_gid(char *group, char *argv0); + + /* Global variables */ + diff --git a/app-admin/cronolog/files/1.6.2-patches/cronolog-sigusr1.patch b/app-admin/cronolog/files/1.6.2-patches/cronolog-sigusr1.patch new file mode 100644 index 000000000000..e7cc8be2c425 --- /dev/null +++ b/app-admin/cronolog/files/1.6.2-patches/cronolog-sigusr1.patch @@ -0,0 +1,46 @@ +*** a/src/cronolog.c.orig 2001-05-03 17:42:48.000000000 +0100 +--- b/src/cronolog.c 2003-08-15 14:03:17.000000000 +0100 +*************** +*** 84,95 **** +--- 84,97 ---- + + #include "cronoutils.h" + #include "getopt.h" ++ #include + + + /* Forward function declaration */ + + int new_log_file(const char *, const char *, mode_t, const char *, + PERIODICITY, int, int, char *, size_t, time_t, time_t *); ++ void terminate_self(int); + + + /* Definition of version and usage messages */ +*************** +*** 306,311 **** +--- 308,317 ---- + DEBUG(("Rotation period is per %d %s\n", period_multiple, periods[periodicity])); + + ++ /* set up signal handlers to catch USR1 and HUP when restarting Apache */ ++ signal(SIGUSR1, terminate_self); ++ signal(SIGHUP, terminate_self); ++ + /* Loop, waiting for data on standard input */ + + for (;;) +*************** +*** 416,418 **** +--- 422,432 ---- + } + return log_fd; + } ++ ++ void terminate_self(int sig) ++ { ++ time_t time_now = time(NULL); ++ DEBUG(("%s (%d): received signal USR1; terminating.\n", ++ timestamp(time_now), time_now)); ++ exit(6); ++ } diff --git a/app-admin/cronolog/files/1.6.2-patches/cronolog-strftime.patch b/app-admin/cronolog/files/1.6.2-patches/cronolog-strftime.patch new file mode 100644 index 000000000000..12d561776f8c --- /dev/null +++ b/app-admin/cronolog/files/1.6.2-patches/cronolog-strftime.patch @@ -0,0 +1,26 @@ +--- a/src/cronoutils.c Mon Dec 20 00:34:44 1999 ++++ b/src/cronoutils.c Mon Feb 11 03:19:32 2002 +@@ -204,9 +204,21 @@ + { + if (ch == '%') + { +- ch = *spec++; +- if (!ch) break; ++ do { ++ ch = *spec++; ++ if (!ch) break; + ++ switch(ch) { ++ case '_': ++ case '-': ++ case '0': ++ continue; ++ } ++ break; ++ } while(1); ++ ++ if(!ch) break; ++ + switch (ch) + { + case 'y': /* two digit year */ -- cgit v1.2.3