summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/VFS/Makefile.in34
-rw-r--r--examples/VFS/README23
-rw-r--r--examples/VFS/block/Makefile.in34
-rw-r--r--examples/VFS/block/block.c21
4 files changed, 47 insertions, 65 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;
}