diff options
-rw-r--r-- | examples/VFS/Makefile.in | 34 | ||||
-rw-r--r-- | examples/VFS/README | 23 | ||||
-rw-r--r-- | examples/VFS/block/Makefile.in | 34 | ||||
-rw-r--r-- | examples/VFS/block/block.c | 21 | ||||
-rwxr-xr-x | source3/configure | 7 | ||||
-rw-r--r-- | source3/configure.in | 5 |
6 files changed, 56 insertions, 68 deletions
diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 3126dfa3b8..6ae4f49434 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -1,42 +1,28 @@ -MAKEFILE = Makefile.vfs - -include $(MAKEFILE) - CC = @CC@ -LIBTOOL = libtool -CFLAGS = @CFLAGS@ $(VFS_CFLAGS) -CPPFLAGS = @CPPFLAGS@ $(VFS_CPPFLAGS) -LDFLAGS = @LDFLAGS@ $(VFS_LDFLAGS) +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ LDSHFLAGS = -shared srcdir = @builddir@ FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) +VFS_OBJS = audit.so recycle.so + # Default target default: $(VFS_OBJS) -# if file doesn't exist try to create one; -# it is possible that some variables will be -# defined correctly -Makefile.vfs: - @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ - for i in *.c; do \ - echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ - done; \ - echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) - make - # Pattern rules -%.so: %.lo - $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< +%.so: %.o + $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< -%.lo: %.c - $(LIBTOOL) $(CC) $(FLAGS) -c $< +%.o: %.c + $(CC) $(FLAGS) -c $< # Misc targets clean: rm -rf .libs rm -f core *~ *% *.bak \ - $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) + $(VFS_OBJ) $(VFS_OBJS) diff --git a/examples/VFS/README b/examples/VFS/README index 7a2152fc4d..1b09929059 100644 --- a/examples/VFS/README +++ b/examples/VFS/README @@ -17,15 +17,26 @@ construction. The following VFS modules are given: connect/disconnect, directory opens/create/remove, file open/close/rename/unlink/chmod. + recycle + A recycle-bin like modules. When used any unlink call + will be intercepted and files moved to the recycle + directory nstead of beeing deleted. + block A simple module to block access to certain mount points or directories. This module only hides the specified directories - and all directories beneath them. It should NOT be used to secure - directories. If the name of a file in one of those directories is - known, the file can still be opened. - -The libtool program, available from your favourite GNU software -archive, is required to compile these programs. + and all directories beneath them. It should NOT be used to + secure directories. If the name of a file in one of those + directories is known, the file can still be opened. + + netatalk + A netatalk module, that will ease co-existence of samba and + netatalk file sharing services. + Looka t the README for more informations. + +You may have problems to compile these modules, as shared libraries are +compiled and linked in different ways on different systems. +I currently tested them against GNU/linux and IRIX. To use the VFS modules, create a share similar to the one below. The important parameter is the 'vfs object' parameter which must point to diff --git a/examples/VFS/block/Makefile.in b/examples/VFS/block/Makefile.in index 3126dfa3b8..3deb17c596 100644 --- a/examples/VFS/block/Makefile.in +++ b/examples/VFS/block/Makefile.in @@ -1,42 +1,28 @@ -MAKEFILE = Makefile.vfs - -include $(MAKEFILE) - CC = @CC@ -LIBTOOL = libtool -CFLAGS = @CFLAGS@ $(VFS_CFLAGS) -CPPFLAGS = @CPPFLAGS@ $(VFS_CPPFLAGS) -LDFLAGS = @LDFLAGS@ $(VFS_LDFLAGS) +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ LDSHFLAGS = -shared srcdir = @builddir@ FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) +VFS_OBJS = block.so + # Default target default: $(VFS_OBJS) -# if file doesn't exist try to create one; -# it is possible that some variables will be -# defined correctly -Makefile.vfs: - @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ - for i in *.c; do \ - echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ - done; \ - echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) - make - # Pattern rules -%.so: %.lo - $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< +%.so: %.o + $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< -%.lo: %.c - $(LIBTOOL) $(CC) $(FLAGS) -c $< +%.o: %.c + $(CC) $(FLAGS) -c $< # Misc targets clean: rm -rf .libs rm -f core *~ *% *.bak \ - $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) + $(VFS_OBJ) $(VFS_OBJS) diff --git a/examples/VFS/block/block.c b/examples/VFS/block/block.c index 9478b75f0f..6566bf3d8c 100644 --- a/examples/VFS/block/block.c +++ b/examples/VFS/block/block.c @@ -87,7 +87,7 @@ static BOOL get_section(char *sect); static BOOL get_parameter_value(char *param, char *value); static BOOL load_param(void); static BOOL search(struct stat *stat_buf); -static BOOL dir_search(char *link, char *dir); +static BOOL dir_search(char *linkstr, char *dir); static BOOL enter_pblock_dir(char *dir); @@ -346,12 +346,11 @@ static DIR *block_opendir(struct connection_struct *conn, char *fname) char *dir_name = NULL; struct stat stat_buf; + size_t len; - dir_name = alloca((strlen(conn->origpath) + strlen(fname) + 2) * sizeof(char)); - - pstrcpy(dir_name,conn->origpath); - pstrcat(dir_name, "/"); - strncat(dir_name, fname, strcspn(fname,"/")); + len = strlen(conn->origpath) + 1 + strcspn(fname, "/"); + asprintf(&dir_name, "%s/%s", conn->origpath, fname); + dir_name[len] = '\0'; if((lstat(dir_name,&stat_buf)) == 0) { @@ -397,13 +396,13 @@ static BOOL search(struct stat *stat_buf) * Find dir in list to block id the starting point is link from a share */ -static BOOL dir_search(char *link, char *dir) +static BOOL dir_search(char *linkstr, char *dir) { char buf[PATH_MAX +1], *ext_path; int len = 0; struct block_dir *tmp_pblock = pblock_dir; - if((len = readlink(link,buf,sizeof(buf))) == -1) + if((len = readlink(linkstr, buf, sizeof(buf))) == -1) { return TRUE; @@ -413,9 +412,9 @@ static BOOL dir_search(char *link, char *dir) } - if((ext_path = strchr(dir,'/')) != NULL) + if((ext_path = strchr(dir, '/')) != NULL) { - pstrcat(buf,&ext_path[1]); + pstrcat(buf, &ext_path[1]); len = strlen(buf); } @@ -427,7 +426,7 @@ static BOOL dir_search(char *link, char *dir) continue; } - if((strstr(buf,tmp_pblock->dir_name)) != NULL) + if((strstr(buf, tmp_pblock->dir_name)) != NULL) { return TRUE; } diff --git a/source3/configure b/source3/configure index f95f30e393..431edcbe35 100755 --- a/source3/configure +++ b/source3/configure @@ -14018,6 +14018,9 @@ fi builddir=`pwd` +# I added make files that are outside /source directory. +# I know this is not a good solution, will work out a better +# solution soon. --simo trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -14119,7 +14122,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/VFS/block/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/VFS/block/Makefile ../examples/VFS/netatalk/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <<EOF @@ -14254,7 +14257,7 @@ EOF cat >> $CONFIG_STATUS <<EOF -CONFIG_FILES=\${CONFIG_FILES-"include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/VFS/block/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile"} +CONFIG_FILES=\${CONFIG_FILES-"include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/VFS/block/Makefile ../examples/VFS/netatalk/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile"} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/source3/configure.in b/source3/configure.in index 90b07ef20a..de8da34091 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2808,7 +2808,10 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"], builddir=`pwd` AC_SUBST(builddir) -AC_OUTPUT(include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/VFS/block/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile) +# I added make files that are outside /source directory. +# I know this is not a good solution, will work out a better +# solution soon. --simo +AC_OUTPUT(include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/VFS/block/Makefile ../examples/VFS/netatalk/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile) ################################################# # Print very concise instructions on building/use |