summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Sanda <ps@twin.jikos.cz>2010-12-09 20:10:13 +0100
committerPavel Sanda <ps@twin.jikos.cz>2010-12-09 20:10:13 +0100
commit2110d963b386c707900c44306a5144f3e947ae5d (patch)
tree41225acf9a2cd129e1e818178511bf3ea78db34c /sys-apps
parentKeep slocate (diff)
downloadrebutia-2110d963b386c707900c44306a5144f3e947ae5d.tar.gz
rebutia-2110d963b386c707900c44306a5144f3e947ae5d.tar.bz2
rebutia-2110d963b386c707900c44306a5144f3e947ae5d.zip
forgot patches
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/slocate/files/slocate-2.7-bounds.patch16
-rw-r--r--sys-apps/slocate/files/slocate-2.7-really-long-paths.patch18
-rw-r--r--sys-apps/slocate/files/slocate-3.1-CVE-2007-0227.patch49
-rw-r--r--sys-apps/slocate/files/slocate-3.1-NUL.patch78
-rw-r--r--sys-apps/slocate/files/slocate-3.1-build.patch52
-rw-r--r--sys-apps/slocate/files/slocate-3.1-cron.patch18
-rw-r--r--sys-apps/slocate/files/slocate-3.1-cron2.patch32
-rw-r--r--sys-apps/slocate/files/slocate-3.1-incompat-warning.patch13
-rw-r--r--sys-apps/slocate/files/updatedb.conf20
9 files changed, 296 insertions, 0 deletions
diff --git a/sys-apps/slocate/files/slocate-2.7-bounds.patch b/sys-apps/slocate/files/slocate-2.7-bounds.patch
new file mode 100644
index 0000000..b370d12
--- /dev/null
+++ b/sys-apps/slocate/files/slocate-2.7-bounds.patch
@@ -0,0 +1,16 @@
+Snatched from Fedora.
+
+--- slocate-2.7/main.c
++++ slocate-2.7/main.c
+@@ -1265,6 +1265,11 @@
+
+ pathlen = code_ptr - codedpath;
+
++ if (pathlen < 0) {
++ fprintf(stderr,"%s: decode_db() aborted. Corrupt database?\n",progname);
++ exit(1);
++ }
++
+ jump = 0;
+ while (!jump) {
+ ch = *begin_ptr;
diff --git a/sys-apps/slocate/files/slocate-2.7-really-long-paths.patch b/sys-apps/slocate/files/slocate-2.7-really-long-paths.patch
new file mode 100644
index 0000000..faf7001
--- /dev/null
+++ b/sys-apps/slocate/files/slocate-2.7-really-long-paths.patch
@@ -0,0 +1,18 @@
+Sniped from Fedora
+
+http://bugs.gentoo.org/104378
+http://www.securityfocus.com/bid/14640
+
+--- slocate/main.c
++++ slocate/main.c
+@@ -1057,6 +1057,10 @@
+ if (!file)
+ break;
+
++ /* fts_read () from glibc fails with EOVERFLOW when fts_pathlen
++ would overflow the u_short file->fts_pathlen. */
++ if (file->fts_info == FTS_D && file->fts_pathlen > 32768)
++ fts_set(dir,file,FTS_SKIP);
+ if (file->fts_info != FTS_DP && file->fts_info != FTS_NS) {
+
+ if ((EXCLUDE && !match_exclude(file->fts_path,"")) || !EXCLUDE)
diff --git a/sys-apps/slocate/files/slocate-3.1-CVE-2007-0227.patch b/sys-apps/slocate/files/slocate-3.1-CVE-2007-0227.patch
new file mode 100644
index 0000000..18b52ba
--- /dev/null
+++ b/sys-apps/slocate/files/slocate-3.1-CVE-2007-0227.patch
@@ -0,0 +1,49 @@
+stolen from debian:
+
+ * Include patch to prevent users obtaining names of private files
+ (apply patch directly, since no patch system is used so far)
+ (Closes: #411937) Fixes: CVE-2007-0227
+ Thanks to Kees Cook
+
+--- slocate-3.1.orig/src/utils.c
++++ slocate-3.1/src/utils.c
+@@ -524,6 +524,7 @@
+ {
+ struct stat path_stat;
+ int ret = 0;
++ char *path_copy = NULL;
+ char *ptr = NULL;
+
+ if (lstat(path, &path_stat) == -1)
+@@ -532,15 +533,25 @@
+ if (!S_ISLNK(path_stat.st_mode)) {
+ if (access(path, F_OK) != 0)
+ goto EXIT;
+- } else if ((ptr = rindex(path, '/'))) {
+- *ptr = 0;
+- if (access(path, F_OK) == 0)
+- ret = 1;
+- *ptr = '/';
+- goto EXIT;
+ }
+
++ /* "path" is const, so we shouldn't modify it. Also, for speed,
++ * I suspect strdup/free is less expensive than the deep access
++ * checks... */
++ if (!(path_copy = strdup(path)))
++ goto EXIT;
++
+ ret = 1;
++
++ /* Each directory leading to the file (symlink or not) must be
++ * readable for us to allow it to be listed in search results. */
++ while (ret && (ptr=rindex(path_copy,'/'))) {
++ *ptr=0;
++ if (*path_copy && access(path_copy, R_OK) != 0)
++ ret = 0;
++ }
++ free(path_copy);
++
+ EXIT:
+ return ret;
+ }
diff --git a/sys-apps/slocate/files/slocate-3.1-NUL.patch b/sys-apps/slocate/files/slocate-3.1-NUL.patch
new file mode 100644
index 0000000..cfd1339
--- /dev/null
+++ b/sys-apps/slocate/files/slocate-3.1-NUL.patch
@@ -0,0 +1,78 @@
+add an -0 argument to output results with NUL bytes
+
+http://bugs.gentoo.org/216838
+
+patch by marty rosenberg
+
+--- slocate-3.1/src/cmds.c
++++ slocate-3.1/src/cmds.c
+@@ -129,6 +129,7 @@
+ " --output=<file> - Specifies the database to create.\n"
+ " -d <path>\n"
+ " --database=<path> - Specfies the path of databases to search in.\n"
++ " -0 - Delimit results with \\0 rather than \\n\n"
+ " -h\n"
+ " --help - Display this help.\n"
+ " -v\n"
+@@ -707,7 +708,7 @@
+ if (strcmp(g_data->progname, "updatedb") == 0)
+ cmd_data->updatedb = TRUE;
+
+- while ((ch = getopt(argc,argv,"VvuhqU:r:o:e:l:d:-:n:f:c:i")) != EOF) {
++ while ((ch = getopt(argc,argv,"VvuhqU:r:o:e:l:d:-:n:f:c:i0")) != EOF) {
+ switch(ch) {
+ /* Help */
+ case 'h':
+@@ -823,6 +824,9 @@
+ goto EXIT;
+ }
+ break;
++ case '0':
++ g_data->delim = '\0';
++ break;
+ default:
+ break;
+ }
+@@ -871,4 +875,3 @@
+
+ return NULL;
+ }
+-
+--- slocate-3.1/src/slocate.c
++++ slocate-3.1/src/slocate.c
+@@ -164,6 +164,7 @@
+ g_data->regexp_data = NULL;
+ g_data->queries = -1;
+ g_data->SLOCATE_GID = get_gid(g_data, DB_GROUP, &ret);
++ g_data->delim = '\n';
+ if (!ret)
+ goto EXIT;
+
+@@ -191,7 +192,7 @@
+ goto EXIT;
+ }
+ if (g_data->VERBOSE)
+- fprintf(stdout, "%s\n", path);
++ fprintf(stdout, "%s%c", path, g_data->delim);
+ /* Match number string */
+ ptr1 = path;
+ code_len = 0;
+@@ -471,7 +472,7 @@
+ if (match_ret == 1) {
+ if (g_data->queries > 0)
+ g_data->queries -= 1;
+- fprintf(stdout, "%s\n", full_path);
++ fprintf(stdout, "%s%c", full_path, g_data->delim);
+ }
+ ret = 1;
+ EXIT:
+--- slocate-3.1/src/slocate.h
++++ slocate-3.1/src/slocate.h
+@@ -81,6 +81,7 @@
+ char **input_db;
+ int queries;
+ struct regexp_data_s *regexp_data;
++ char delim;
+ };
+
+ /* Encoding data */
diff --git a/sys-apps/slocate/files/slocate-3.1-build.patch b/sys-apps/slocate/files/slocate-3.1-build.patch
new file mode 100644
index 0000000..98f5ea1
--- /dev/null
+++ b/sys-apps/slocate/files/slocate-3.1-build.patch
@@ -0,0 +1,52 @@
+--- src/slocate.h
++++ src/slocate.h
+@@ -35,20 +35,11 @@
+ #define MTAB_FILE "/etc/mtab"
+ #define UPDATEDB_FILE "/etc/updatedb.conf"
+
+-/* More fitting paths for FreeBSD -matt */
+-#if defined(__FreeBSD__)
+-# define DEFAULT_DB "/var/db/slocate/slocate.db"
+-# define DEFAULT_DB_DIR "/var/db/slocate/"
+-#elif defined(__SunOS__)
+-# define DEFAULT_DB "/var/db/slocate/slocate.db"
+-# define DEFAULT_DB_DIR "/var/db/slocate/"
+-#else
+-# define DEFAULT_DB "/var/lib/slocate/slocate.db"
+-# define DEFAULT_DB_DIR "/var/lib/slocate/"
+-#endif
++#define DEFAULT_DB "/var/lib/slocate/slocate.db"
++#define DEFAULT_DB_DIR "/var/lib/slocate/"
+
+ #define DB_UID 0
+-#define DB_GROUP "slocate"
++#define DB_GROUP "locate"
+ #define DB_MODE 00640
+
+ #define SLOC_ESC -0x80
+--- src/Makefile
++++ src/Makefile
+@@ -1,16 +1,18 @@
+ OBJS=slocate.o cmds.o conf.o utils.o
+ HEADERS=slocate.h cmds.h conf.h utils.h
+
+-CFLAGS=-Wall -Wshadow
+-CFLAGS+=-O2
++CFLAGS+=-Wall -Wshadow
++#CFLAGS+=-O2
+ #CFLAGS+=-g3
+ #LDFLAGS+=-lefence
+
+ PROG=slocate
+-CC=gcc
++CC?=gcc
+
+-all: $(OBJS) $(MOD_OBJS)
+- $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(MOD_OBJS)
++all: $(PROG)
++
++$(PROG): $(OBJS) $(MOD_OBJS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(MOD_OBJS)
+
+ %.o: %.c $(HEADERS)
+ $(CC) -c $(CFLAGS) -o $@ $<
diff --git a/sys-apps/slocate/files/slocate-3.1-cron.patch b/sys-apps/slocate/files/slocate-3.1-cron.patch
new file mode 100644
index 0000000..72c562d
--- /dev/null
+++ b/sys-apps/slocate/files/slocate-3.1-cron.patch
@@ -0,0 +1,18 @@
+--- debian/cron.daily
++++ debian/cron.daily
+@@ -1,12 +1,11 @@
+ #! /bin/sh
+
+-if [ -x /usr/bin/slocate ]
++if [ -x /usr/bin/updatedb ]
+ then
+ if [ -f /etc/updatedb.conf ]
+ then
+- /usr/bin/updatedb
++ nice /usr/bin/updatedb
+ else
+- /usr/bin/updatedb -f proc
++ nice /usr/bin/updatedb -f proc
+ fi
+- chown root.slocate /var/lib/slocate/slocate.db
+ fi
diff --git a/sys-apps/slocate/files/slocate-3.1-cron2.patch b/sys-apps/slocate/files/slocate-3.1-cron2.patch
new file mode 100644
index 0000000..16be3da
--- /dev/null
+++ b/sys-apps/slocate/files/slocate-3.1-cron2.patch
@@ -0,0 +1,32 @@
+--- debian/cron.daily
++++ debian/cron.daily
+@@ -1,12 +1,25 @@
+ #! /bin/sh
++
++. /etc/init.d/functions.sh 2>/dev/null
++on_ac_power 2>/dev/null #312583
++[ $? -eq 1 ] && exit 0
+
+-if [ -x /usr/bin/slocate ]
++if [ -x /usr/bin/updatedb ]
+ then
+ if [ -f /etc/updatedb.conf ]
+ then
+- /usr/bin/updatedb
++ . /etc/updatedb.conf
++ args=""
+ else
+- /usr/bin/updatedb -f proc
++ args="-f proc"
+ fi
+- chown root.slocate /var/lib/slocate/slocate.db
++
++ # run on active process in case ionice isnt installed, or
++ # system is really old and ionice doesnt work ...
++ ioflags=
++ [ -n "${IONICE_CLASS}" ] && ioflags="-c ${IONICE_CLASS}"
++ [ -n "${IONICE_PRIORITY}" ] && ioflags="-n ${IONICE_PRIORITY}"
++ [ -n "${ioflags}" ] && ionice ${ioflags} -p $$ 2>/dev/null
++
++ nice -n ${NICE:-10} /usr/bin/updatedb ${args}
+ fi
diff --git a/sys-apps/slocate/files/slocate-3.1-incompat-warning.patch b/sys-apps/slocate/files/slocate-3.1-incompat-warning.patch
new file mode 100644
index 0000000..158a10a
--- /dev/null
+++ b/sys-apps/slocate/files/slocate-3.1-incompat-warning.patch
@@ -0,0 +1,13 @@
+slocate-2.x databases are incompat with slocate-3.x
+
+--- src/slocate.c
++++ src/slocate.c
+@@ -435,7 +435,7 @@
+ * cancelling the + */
+ len = path_len+code_num;
+ if (len <= 0) {
+- if (!report_error(g_data, FATAL, "set_path_head: path_head len <= 0: %d\n", len))
++ if (!report_error(g_data, FATAL, "set_path_head: path_head len <= 0: %d\nPerhaps your database is still the old format and you need to run `updatedb` ?\n", len))
+ goto EXIT;
+ }
+ if (!(path_head = realloc(path_head, (sizeof(char) * (len+1))))) {
diff --git a/sys-apps/slocate/files/updatedb.conf b/sys-apps/slocate/files/updatedb.conf
new file mode 100644
index 0000000..a6990f2
--- /dev/null
+++ b/sys-apps/slocate/files/updatedb.conf
@@ -0,0 +1,20 @@
+# /etc/updatedb.conf: config file for slocate
+# $Id: updatedb.conf,v 1.25 2008/12/02 20:09:15 vapier Exp $
+
+# This file sets variables that are used by updatedb.
+# For more info, see the updatedb(1) manpage.
+
+# Filesystems that are pruned from updatedb database
+PRUNEFS="afs auto autofs cifs devfs devpts eventpollfs futexfs gfs hugetlbfs iso9660 mqueue ncpfs nfs NFS nfs4 nfsd nnpfs ocfs ocfs2 pipefs proc ramfs rpc_pipefs selinuxfs sfs shfs smbfs sockfs spufs subfs supermount sysfs tmpfs udf usbfs vperfctrfs"
+
+# Paths which are pruned from updatedb database
+PRUNEPATHS="/tmp /var/tmp /root/.ccache"
+
+# nice value to run at: see -n in nice(1)
+NICE="10"
+
+# ionice class to run at: see -c in ionice(1)
+IONICE_CLASS="2"
+
+# ionice priority to run at: see -n in ionice(1)
+IONICE_PRIORITY="7"