From 32db9daaa89aebd829ec1e0ee16f6aa1eea6a927 Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Tue, 2 Dec 2008 18:08:17 +0000 Subject: [PATCH 1/5] Initialize branch F-10 for afuse --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..dc32377 --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-10 From 1aa268285ea2d5f14e7fbd4c4688122171b2fc2d Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Tue, 2 Dec 2008 18:22:51 +0000 Subject: [PATCH 2/5] branching --- afuse.spec | 42 ++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 2 files changed, 43 insertions(+) create mode 100644 afuse.spec diff --git a/afuse.spec b/afuse.spec new file mode 100644 index 0000000..ef4b8f6 --- /dev/null +++ b/afuse.spec @@ -0,0 +1,42 @@ +Name: afuse +Summary: An automounter implemented with FUSE +Version: 0.2 +Release: 1%{?dist} +License: GPLv2+ +Group: System Environment/Base +Source0: http://downloads.sourceforge.net/afuse/%{name}-%{version}.tar.gz +URL: http://afuse.sourceforge.net/ +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: fuse-devel + +%description +Afuse is an automounting file system implemented in user-space using FUSE. +Afuse currently implements the most basic functionality that can be expected +by an automounter; that is it manages a directory of virtual directories. If +one of these virtual directories is accessed and is not already automounted, +afuse will attempt to mount a filesystem onto that directory. If the mount +succeeds the requested access proceeds as normal, otherwise it will fail +with an error. + +%prep +%setup -q + +%build +%configure +make %{?_smp_mflags} + +%install +rm -rf %{buildroot} +make DESTDIR=%{buildroot} install + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING README +%{_bindir}/afuse + +%changelog +* Fri Nov 21 2008 Tom "spot" Callaway 0.2-1 +- Initial package for Fedora diff --git a/sources b/sources index e69de29..4b287f4 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +97b58a768ecb30696fb6c33dd8435b83 afuse-0.2.tar.gz From 0e0a24209f58b5fba33c99d5f1a86c76a1ff7c4a Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Mon, 17 Aug 2009 17:22:13 +0000 Subject: [PATCH 3/5] fix CVE-2008-2232 --- afuse-template-tokenize.patch | 214 ++++++++++++++++++++++++++++++++++ afuse.spec | 14 ++- 2 files changed, 227 insertions(+), 1 deletion(-) create mode 100644 afuse-template-tokenize.patch diff --git a/afuse-template-tokenize.patch b/afuse-template-tokenize.patch new file mode 100644 index 0000000..914400e --- /dev/null +++ b/afuse-template-tokenize.patch @@ -0,0 +1,214 @@ +diff -ur afuse-0.2.orig/src/afuse.c afuse-0.2/src/afuse.c +--- afuse-0.2.orig/src/afuse.c 2008-02-18 17:16:32.000000000 -0500 ++++ afuse-0.2/src/afuse.c 2008-07-10 21:50:06.000000000 -0400 +@@ -280,14 +280,19 @@ + } + + +-// !!FIXME!! allow escaping of %'s + // Note: this method strips out quotes and applies them itself as should be appropriate +-char *expand_template(const char *template, const char *mount_point, const char *root_name) ++bool run_template(const char *template, const char *mount_point, const char *root_name) + { + int len = 0; ++ int nargs = 1; + int i; +- char *expanded_name; +- char *expanded_name_start; ++ char *buf; ++ char *p; ++ char **args; ++ char **arg; ++ bool quote = false; ++ pid_t pid; ++ int status; + + // calculate length + for(i = 0; template[i]; i++) +@@ -295,53 +300,100 @@ + switch(template[i + 1]) + { + case 'm': +- len += strlen(mount_point) + 2; ++ len += strlen(mount_point); + i++; + break; + case 'r': +- len += strlen(root_name) + 2; ++ len += strlen(root_name); ++ i++; ++ break; ++ case '%': ++ len++; + i++; + break; + } +- } else if(template[i] != '"') ++ } else if(template[i] == ' ' && !quote) { ++ len++; ++ nargs++; ++ } else if(template[i] == '"') ++ quote = !quote; ++ else if(template[i] == '\\' && template[i + 1]) ++ len++, i++; ++ else + len++; + +- expanded_name_start = expanded_name = my_malloc(len + 1); ++ buf = my_malloc(len + 1); ++ args = my_malloc((nargs + 1) * sizeof(*args)); ++ ++ p = buf; ++ arg = args; ++ *arg++ = p; + + for(i = 0; template[i]; i++) + if(template[i] == '%') { +- int j = 0; + switch(template[i + 1]) + { + case 'm': +- *expanded_name++ = '"'; +- while(mount_point[j]) +- *expanded_name++ = mount_point[j++]; +- *expanded_name++ = '"'; ++ strcpy(p, mount_point); ++ p += strlen(mount_point); + i++; + break; + case 'r': +- *expanded_name++ = '"'; +- while(root_name[j]) +- *expanded_name++ = root_name[j++]; +- *expanded_name++ = '"'; ++ strcpy(p, root_name); ++ p += strlen(root_name); ++ i++; ++ break; ++ case '%': ++ *p++ = '%'; + i++; + break; + } +- } else if(template[i] != '"') +- *expanded_name++ = template[i]; +- +- *expanded_name = '\0'; +- +- return expanded_name_start; ++ } else if(template[i] == ' ' && !quote) { ++ *p++ = '\0'; ++ *arg++ = p; ++ } else if(template[i] == '"') ++ quote = !quote; ++ else if(template[i] == '\\' && template[i + 1]) ++ *p++ = template[++i]; ++ else ++ *p++ = template[i]; ++ ++ *p = '\0'; ++ *arg = NULL; ++ ++ pid = fork(); ++ if(pid == -1) { ++ fprintf(stderr, "Failed to fork (%s)\n", strerror(errno)); ++ free(args); ++ free(buf); ++ return false; ++ } ++ if(pid == 0) { ++ execvp(args[0], args); ++ abort(); ++ } ++ pid = waitpid(pid, &status, 0); ++ if(pid == -1) { ++ fprintf(stderr, "Failed to waitpid (%s)\n", strerror(errno)); ++ free(args); ++ free(buf); ++ return false; ++ } ++ if(!WIFEXITED(status) || WEXITSTATUS(status) != 0) { ++ fprintf(stderr, "Failed to invoke command: %s\n", args[0]); ++ free(args); ++ free(buf); ++ return false; ++ } ++ free(args); ++ free(buf); ++ return true; + } + + mount_list_t *do_mount(const char *root_name) + { + char *mount_point; +- char *mount_command; + mount_list_t *mount; +- int sysret; + + fprintf(stderr, "Mounting: %s\n", root_name); + +@@ -351,57 +403,33 @@ + return NULL; + } + +- mount_command = expand_template(user_options.mount_command_template, +- mount_point, root_name); +- sysret = system(mount_command); +- +- fprintf(stderr, "sysret: %.8x\n", sysret); +- +- if(sysret) { +- fprintf(stderr, "Failed to invoke mount command: '%s' (%s)\n", +- mount_command, sysret != -1 ? +- "Error executing mount" : +- strerror(errno)); +- ++ if(!run_template(user_options.mount_command_template, ++ mount_point, root_name)) { + // remove the now unused directory + if( rmdir(mount_point) == -1 ) + fprintf(stderr, "Failed to remove mount point dir: %s (%s)", + mount_point, strerror(errno)); + +- free(mount_command); + free(mount_point); + return NULL; + } + + mount = add_mount(root_name, mount_point); +- +- free(mount_command); + return mount; + } + + int do_umount(mount_list_t *mount) + { +- char *unmount_command; +- int sysret; +- + fprintf(stderr, "Unmounting: %s\n", mount->root_name); + +- unmount_command = expand_template(user_options.unmount_command_template, +- mount->mount_point, mount->root_name); +- sysret = system(unmount_command); +- if(sysret) { +- fprintf(stderr, "Failed to invoke unmount command: '%s' (%s)\n", +- unmount_command, sysret != -1 ? +- "Error executing mount" : +- strerror(errno)); +- /* Still unmount anyway */ +- } ++ run_template(user_options.unmount_command_template, ++ mount->mount_point, mount->root_name); ++ /* Still unmount anyway */ + + if( rmdir(mount->mount_point) == -1 ) + fprintf(stderr, "Failed to remove mount point dir: %s (%s)", + mount->mount_point, strerror(errno)); + remove_mount(mount); +- free(unmount_command); + return 1; + } + + + diff --git a/afuse.spec b/afuse.spec index ef4b8f6..f5a284e 100644 --- a/afuse.spec +++ b/afuse.spec @@ -1,13 +1,15 @@ Name: afuse Summary: An automounter implemented with FUSE Version: 0.2 -Release: 1%{?dist} +Release: 4%{?dist} License: GPLv2+ Group: System Environment/Base Source0: http://downloads.sourceforge.net/afuse/%{name}-%{version}.tar.gz URL: http://afuse.sourceforge.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: fuse-devel +# fix CVE-2008-2232 +Patch0: afuse-template-tokenize.patch %description Afuse is an automounting file system implemented in user-space using FUSE. @@ -20,6 +22,7 @@ with an error. %prep %setup -q +%patch0 -p1 -b .CVS-2008-2232 %build %configure @@ -38,5 +41,14 @@ rm -rf %{buildroot} %{_bindir}/afuse %changelog +* Mon Aug 17 2009 Tom "spot" Callaway - 0.2-4 +- fix CVS-2008-2232 + +* Fri Jul 24 2009 Fedora Release Engineering - 0.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Feb 23 2009 Fedora Release Engineering - 0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + * Fri Nov 21 2008 Tom "spot" Callaway 0.2-1 - Initial package for Fedora From 27c0ea98167b0025e90699e68f7bcadf9ba61b6b Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Nov 2009 01:25:26 +0000 Subject: [PATCH 4/5] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 05c9fba..ce056f2 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # Makefile for source rpm: afuse -# $Id$ +# $Id: Makefile,v 1.1 2008/12/02 18:08:14 spot Exp $ NAME := afuse SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From ed1802ebbea8a54bb6d15cb7efe234780bed2f41 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 28 Jul 2010 09:37:38 +0000 Subject: [PATCH 5/5] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - 3 files changed, 22 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index ce056f2..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: afuse -# $Id: Makefile,v 1.1 2008/12/02 18:08:14 spot Exp $ -NAME := afuse -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index dc32377..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-10