Fix for VFS modules

Scot W. Hetzel hetzels at westbend.net
Fri May 10 11:01:01 GMT 2002


While trying to compile the VFS modules for Samba 2.2.4 under
FreeBSD 4.5-STABLE, I encountered several problems:

1. Missing include directory, unable to find popt.h if using bundled popt library.

2. Undefined Symbols when smbd loads a VFS module.
	- defined DYNEXP for the *bsd* case

3. Recycle VFS Module SIG 11 when deleting files size is > 0
	- caused by incorrect pointer useage

Attached is the patch that corrects these problems.

Scot W. Hetzel

diff -ruN samba-2.2.4.orig/examples/VFS/Makefile samba-2.2.4/examples/VFS/Makefile
--- samba-2.2.4.orig/examples/VFS/Makefile	Thu May  2 20:02:11 2002
+++ samba-2.2.4/examples/VFS/Makefile	Fri May 10 10:16:04 2002
@@ -10,9 +10,10 @@
 
 SAMBA_SRC = ../../source
 SAMBA_INCL = ../../source/include
+POPT_INCL = ../../source/popt
 UBIQX_SRC = ../../source/ubiqx
 SMBWR_SRC = ../../source/smbwrapper
-CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -Wall -g
+CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -I${POPT_INCL} -Wall -g
 VFS_OBJS = audit.so skel.so recycle.so
 
 # Default target
diff -ruN samba-2.2.4.orig/examples/VFS/recycle.c samba-2.2.4/examples/VFS/recycle.c
--- samba-2.2.4.orig/examples/VFS/recycle.c	Tue Apr 30 08:43:30 2002
+++ samba-2.2.4/examples/VFS/recycle.c	Fri May 10 10:15:43 2002
@@ -238,15 +238,18 @@
 		return default_vfs_ops.unlink(conn,fname);
 	}
 
-	base = strrchr(fname, '/') + 1;
-	if(base == (char*)1)
-		ext = strrchr(fname, '.');
-	else
-		ext = strrchr(base, '.');
-
+	base = strrchr(fname, '/');
 	pstrcpy(bin, recycle_bin);
 	pstrcat(bin, "/");
-	pstrcat(bin, base);
+
+	if(base == NULL) {
+		ext = strrchr(fname, '.');
+		pstrcat(bin, fname);
+	} else {
+		ext = strrchr(base, '.');
+		pstrcat(bin, base+1);
+	}
+	DEBUG(3, ("recycle bin: base %s, ext %s, fname %s, bin %s\n", base, ext, fname, bin));
 
 	if(strcmp(fname,bin) == 0) {
 		DEBUG(3, ("recycle bin: file %s exists, purging...\n", fname));
@@ -254,6 +257,8 @@
 	}
 
 	len = strlen(bin);
+	if ( ext != NULL)
+		len = len - strlen(ext);
 	addlen = sizeof(pstring)-len-1;
 	while(recycle_file_exist(conn,bin)) {
 		slprintf(bin+len, addlen, " (Copy #%d)", i++);
diff -ruN samba-2.2.4.orig/source/configure.in samba-2.2.4/source/configure.in
--- samba-2.2.4.orig/source/configure.in	Thu May  2 20:02:46 2002
+++ samba-2.2.4/source/configure.in	Fri May 10 10:21:24 2002
@@ -870,6 +870,7 @@
 		;;
 		*bsd*)  BLDSHARED="true"
 			LDSHFLAGS="-shared"
+			DYNEXP="-Wl,--export-dynamic"
 			SONAMEFLAG="-Wl,-soname,"
 			PICFLAG="-fPIC"
 			AC_DEFINE(STAT_ST_BLOCKSIZE,512)




More information about the samba-technical mailing list