Date: Thu, 9 May 2002 11:00:54 -0500 (CDT) From: "Scot W. Hetzel" <hetzels@westbend.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/37888: net/samba: fix vfs module support - restore recycle bin Message-ID: <200205091600.g49G0sOL006986@mail.westbend.net>
next in thread | raw e-mail | index | archive | help
>Number: 37888 >Category: ports >Synopsis: net/samba: fix vfs module support - restore recycle bin >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu May 09 09:10:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Scot W. Hetzel >Release: FreeBSD 4.5-STABLE i386 >Organization: West Bend Internet >Environment: System: FreeBSD wbiW009.westbend.net 4.5-STABLE FreeBSD 4.5-STABLE #7: Wed Apr 24 10:46:07 CDT 2002 root@wbiW009.westbend.net:/usr/obj/usr/src/sys/GENERIC-SMP i386 >Description: Previous to Samba 2.2.4, the port had a recycle bin function. This was removed when the port was updated. The site that hosts the recycle bin patches are currently not up todate, also it has been ported to a vfs module in 2.2.4. >How-To-Repeat: >Fix: The attached patch adds the recycle bin function back into the port, as well as updates the smb.conf.default to the latest version. changed files: Makefile pkg-plist files/README.FreeBSD - There is no Chinese Samba port files/patch-* - Changed due to addition of PATCH_WRKSRC files/patch-ba - Addition of check for libc, as well as defining DYNEXP="-Wl,--export-dynamic" for the bsd case (needed for VFS modules) files/smb.conf.default - Updated for 2.2.4, as well as add example entry for the recycle VFS module. New files: files/patch-examples-VFS-Makefile - Add missing ../source/popt to includes files/patch-examples-VFS-recycle.c - fixes a NULL pointer + 1 bug, caused by strrchr returning a NULL when '/' is not found files/patch-source-include-includes.h Removed file: files/patch-include-includes.h - renamed to patch-source-include-includes.h Index: Makefile =================================================================== RCS file: /home/ncvs/ports/net/samba/Makefile,v retrieving revision 1.81 diff -u -r1.81 Makefile --- Makefile 6 May 2002 21:01:43 -0000 1.81 +++ Makefile 9 May 2002 08:43:34 -0000 @@ -7,6 +7,7 @@ PORTNAME= samba PORTVERSION= 2.2.4 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ftp://ftp.samba.org/pub/samba/%SUBDIR%/ \ ftp://samba.anu.edu.au/pub/samba/%SUBDIR%/ \ @@ -19,12 +20,32 @@ USE_BZIP2= YES +.if defined(WITH_AUDIT) || defined(WITH_RECYCLE) +USE_GMAKE= YES +.endif + +AUDIT= "@comment " +RECYCLE= "@comment " +LIBSAMBA= "@comment " + +.if defined(WITH_AUDIT) +AUDIT= "" +LIBSAMBA= "" +.endif + +.if defined(WITH_RECYCLE) +RECYCLE= "" +LIBSAMBA= "" +.endif + # directories VARDIR= /var SAMBA_SPOOL= ${VARDIR}/spool/samba SAMBA_LOGDIR= ${VARDIR}/log SAMBA_PRIVATE= ${PREFIX}/private SAMBA_CONFDIR= ${PREFIX}/etc +SAMBA_VFSDIR= ${PREFIX}/lib/samba + # sample files STARTUP_SCRIPT= ${PREFIX}/etc/rc.d/samba.sh.sample SAMPLE_CONFIG= ${SAMBA_CONFDIR}/smb.conf.default @@ -89,6 +110,7 @@ .endif WRKSRC= ${WRKDIR}/${DISTNAME}/source +PATCH_WRKSRC= ${WRKDIR}/${DISTNAME} MAN1= findsmb.1 make_smbcodepage.1 rpcclient.1 make_unicodemap.1 \ nmblookup.1 smbcacls.1 smbclient.1 smbcontrol.1 \ @@ -101,9 +123,34 @@ SED_PLIST= ${SED} -e 's!${PREFIX}!%D!g' +PLIST_SUB= AUDIT=${AUDIT} \ + RECYCLE=${RECYCLE} \ + LIBSAMBA=${LIBSAMBA} + +.if defined(WITH_RECYCLE) || defined(WITH_AUDIT) +post-build: + cd ${WRKDIR}/${DISTNAME}/examples/VFS; \ + ${GMAKE} +.endif + post-install: +.if defined(WITH_AUDIT) || defined(WITH_RECYCLE) + @test -d ${SAMBA_VFSDIR} || ${MKDIR} ${SAMBA_VFSDIR} +.if defined(WITH_AUDIT) + ${INSTALL_PROGRAM) ${WRKDIR}/${DISTNAME}/examples/VFS/audit.so ${SAMBA_VFSDIR} +.endif +.if defined(WITH_RECYCLE) + ${INSTALL_PROGRAM} ${WRKDIR}/${DISTNAME}/examples/VFS/recycle.so ${SAMBA_VFSDIR} +.endif +.endif ${MKDIR} ${PREFIX}/share/examples/samba ${CP} -rp ${WRKDIR}/${DISTNAME}/examples/* ${PREFIX}/share/examples/samba +.if defined(WITH_AUDIT) || defined(WITH_RECYCLE) + @${RM} -rf ${PREFIX}/share/examples/samba/VFS/.libs + @for file in Makefile.orig audit.o audit.so recycle.o recycle.so skel.o skel.so ; do \ + ${RM} ${PREFIX}/share/examples/samba/VFS/$${file} ; \ + done +.endif @if [ ! -f ${STARTUP_SCRIPT} ]; then \ ${ECHO} "Installing ${STARTUP_SCRIPT} startup file." ; \ ${INSTALL_SCRIPT} ${FILESDIR}/samba.sh.sample \ @@ -114,6 +161,7 @@ ${SED} -e 's!%%SAMBA_SPOOL%%!${SAMBA_SPOOL}!' \ -e 's!%%SAMBA_LOGDIR%%!${SAMBA_LOGDIR}!' \ -e 's!%%SAMBA_CONFDIR%%!${SAMBA_CONFDIR}!' \ + -e 's!%%SAMBA_VFSDIR%%!${SAMBA_VFSDIR}!' \ ${FILESDIR}/smb.conf.default \ > ${SAMPLE_CONFIG} ; \ fi Index: pkg-plist =================================================================== RCS file: /home/ncvs/ports/net/samba/pkg-plist,v retrieving revision 1.32 diff -u -r1.32 pkg-plist --- pkg-plist 6 May 2002 21:01:43 -0000 1.32 +++ pkg-plist 7 May 2002 16:51:34 -0000 @@ -49,6 +49,8 @@ etc/codepages/unicode_map.KOI8-R etc/rc.d/samba.sh.sample etc/smb.conf.default +%%AUDIT%%lib/samba/audit.so +%%RECYCLE%%lib/samba/recycle.so sbin/nmbd sbin/smbd sbin/swat @@ -480,3 +482,4 @@ %%PORTDOCS%%@dirrm share/doc/samba/faq %%PORTDOCS%%@dirrm share/doc/samba @dirrm etc/codepages +%%LIBSAMBA%%@dirrm lib/samba Index: files/README.FreeBSD =================================================================== RCS file: /home/ncvs/ports/net/samba/files/README.FreeBSD,v retrieving revision 1.5 diff -u -r1.5 README.FreeBSD --- files/README.FreeBSD 16 Dec 2001 17:56:48 -0000 1.5 +++ files/README.FreeBSD 7 Feb 2002 02:07:42 -0000 @@ -10,12 +10,10 @@ FreeBSD Samba ports for localization and encrypt passwords support are no longer provided because these supports have been integrated into the -original distribution since 1.9.18. If you're Western European or Japanese -Windows users, please set "client code page" parameter in smb.conf (1.9.18 -does not support Chinese Windows. If you want to use Chinese samba, please -use chinese/samba port). See smb.conf.sample for details. If you want to -use NT4+SP3 or Win95+updates clients, set "encrypt passwords" parameter to -yes and use smbpasswd [username] to use /usr/local/private/smbpasswd for -authentication. +original distribution since 1.9.18. If you're Western European, Japanese, +or Chinese Windows users, please set "client code page" parameter in smb.conf. +See smb.conf.sample for details. If you want to use NT4+SP3 or Win95+updates +clients, set "encrypt passwords" parameter to yes and use smbpasswd [username] +to use /usr/local/private/smbpasswd for authentication. FreeBSD SAMBA ports maintainer: Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org> Index: files/patch-aa =================================================================== RCS file: /home/ncvs/ports/net/samba/files/patch-aa,v retrieving revision 1.16 diff -u -r1.16 patch-aa --- files/patch-aa 6 May 2002 21:01:43 -0000 1.16 +++ files/patch-aa 7 May 2002 16:44:55 -0000 @@ -1,5 +1,5 @@ ---- Makefile.in.orig Thu May 2 20:02:26 2002 -+++ Makefile.in Fri May 3 10:04:22 2002 +--- source/Makefile.in.orig Thu May 2 20:02:26 2002 ++++ source/Makefile.in Fri May 3 10:04:22 2002 @@ -51,7 +51,7 @@ CONFIGFILE = $(CONFIGDIR)/smb.conf LMHOSTSFILE = $(CONFIGDIR)/lmhosts Index: files/patch-ae =================================================================== RCS file: /home/ncvs/ports/net/samba/files/patch-ae,v retrieving revision 1.2 diff -u -r1.2 patch-ae --- files/patch-ae 16 Dec 2001 17:56:48 -0000 1.2 +++ files/patch-ae 7 May 2002 16:40:40 -0000 @@ -1,5 +1,5 @@ ---- script/convert_smbpasswd.orig Thu Nov 5 02:50:17 1998 -+++ script/convert_smbpasswd Tue Oct 16 17:19:10 2001 +--- source/script/convert_smbpasswd.orig Thu Nov 5 02:50:17 1998 ++++ source/script/convert_smbpasswd Tue Oct 16 17:19:10 2001 @@ -7,7 +7,7 @@ # with trying to work out how to get the seconds since 1970 # in awk or the shell. JRA. Index: files/patch-aj =================================================================== RCS file: /home/ncvs/ports/net/samba/files/patch-aj,v retrieving revision 1.2 diff -u -r1.2 patch-aj --- files/patch-aj 16 Dec 2001 17:56:48 -0000 1.2 +++ files/patch-aj 7 May 2002 16:40:53 -0000 @@ -1,5 +1,5 @@ ---- include/local.h.orig Fri Jul 6 03:01:26 2001 -+++ include/local.h Tue Oct 16 17:20:36 2001 +--- source/include/local.h.orig Fri Jul 6 03:01:26 2001 ++++ source/include/local.h Tue Oct 16 17:20:36 2001 @@ -176,10 +176,10 @@ * Default passwd chat script. */ Index: files/patch-ba =================================================================== RCS file: /home/ncvs/ports/net/samba/files/patch-ba,v retrieving revision 1.5 diff -u -r1.5 patch-ba --- files/patch-ba 13 Mar 2002 18:49:52 -0000 1.5 +++ files/patch-ba 9 May 2002 07:33:32 -0000 @@ -1,6 +1,40 @@ ---- configure.in.orig Wed Feb 6 20:56:47 2002 -+++ configure.in Wed Mar 13 12:42:20 2002 -@@ -1792,7 +1792,7 @@ +--- source/configure.in.orig Thu May 2 20:02:46 2002 ++++ source/configure.in Thu May 9 02:29:20 2002 +@@ -498,9 +498,23 @@ + ############################################ + # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the new VFS code + AC_CHECK_FUNCS(dlopen) ++case "$host_os" in ++ *bsd*) ++ AC_CHECK_LIB(c, dlopen, [LIBS="$LIBS -lc"; ++ AC_DEFINE(HAVE_DLOPEN)]) ++ ;; ++esac + if test x"$ac_cv_func_dlopen" = x"no"; then +- AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"; +- AC_DEFINE(HAVE_DLOPEN)]) ++ case "$host_os" in ++ *bsd*) ++ AC_CHECK_LIB(c, dlopen, [LIBS="$LIBS -lc"; ++ AC_DEFINE(HAVE_DLOPEN)]) ++ ;; ++ *) ++ AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"; ++ AC_DEFINE(HAVE_DLOPEN)]) ++ ;; ++ esac + fi + # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then + +@@ -870,6 +884,7 @@ + ;; + *bsd*) BLDSHARED="true" + LDSHFLAGS="-shared" ++ DYNEXP="-Wl,--export-dynamic" + SONAMEFLAG="-Wl,-soname," + PICFLAG="-fPIC" + AC_DEFINE(STAT_ST_BLOCKSIZE,512) +@@ -1868,7 +1883,7 @@ yes) AC_MSG_RESULT(yes) AC_DEFINE(KRB5_AUTH) @@ -9,7 +43,7 @@ CFLAGS="$CFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib" ;; -@@ -1966,7 +1966,7 @@ +@@ -2042,7 +2057,7 @@ yes) AC_MSG_RESULT(yes) AC_DEFINE(WITH_LDAP_SAM) Index: files/patch-examples-VFS-Makefile =================================================================== RCS file: files/patch-examples-VFS-Makefile diff -N files/patch-examples-VFS-Makefile --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-examples-VFS-Makefile 7 May 2002 16:29:39 -0000 @@ -0,0 +1,14 @@ +--- examples/VFS/Makefile.orig Tue May 7 11:17:58 2002 ++++ examples/VFS/Makefile Tue May 7 11:19:31 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 Index: files/patch-examples-VFS-recycle.c =================================================================== RCS file: files/patch-examples-VFS-recycle.c diff -N files/patch-examples-VFS-recycle.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-examples-VFS-recycle.c 9 May 2002 07:42:38 -0000 @@ -0,0 +1,37 @@ +--- examples/VFS/recycle.c.orig Wed May 8 21:30:11 2002 ++++ examples/VFS/recycle.c Thu May 9 02:19:32 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++); Index: files/patch-include-includes.h =================================================================== RCS file: files/patch-include-includes.h diff -N files/patch-include-includes.h --- files/patch-include-includes.h 17 Jan 2002 22:50:51 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ ---- include/includes.h.orig Sat Oct 13 17:09:21 2001 -+++ include/includes.h Fri Jan 11 22:12:06 2002 -@@ -27,6 +27,11 @@ - - #include "local.h" - -+#ifdef __FreeBSD__ -+#define DEFAULT_PRINTING PRINT_BSD -+#define PRINTCAP_NAME "/etc/printcap" -+#endif /* __FreeBSD__ */ -+ - #ifdef AIX - #define DEFAULT_PRINTING PRINT_AIX - #define PRINTCAP_NAME "/etc/qconfig" Index: files/patch-source-include-includes.h =================================================================== RCS file: files/patch-source-include-includes.h diff -N files/patch-source-include-includes.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-source-include-includes.h 7 May 2002 16:49:24 -0000 @@ -0,0 +1,14 @@ +--- source/include/includes.h.orig Sat Oct 13 17:09:21 2001 ++++ source/include/includes.h Fri Jan 11 22:12:06 2002 +@@ -27,6 +27,11 @@ + + #include "local.h" + ++#ifdef __FreeBSD__ ++#define DEFAULT_PRINTING PRINT_BSD ++#define PRINTCAP_NAME "/etc/printcap" ++#endif /* __FreeBSD__ */ ++ + #ifdef AIX + #define DEFAULT_PRINTING PRINT_AIX + #define PRINTCAP_NAME "/etc/qconfig" Index: files/smb.conf.default =================================================================== RCS file: /home/ncvs/ports/net/samba/files/smb.conf.default,v retrieving revision 1.10 diff -u -r1.10 smb.conf.default --- files/smb.conf.default 11 Mar 2000 00:06:00 -0000 1.10 +++ files/smb.conf.default 9 May 2002 15:28:54 -0000 @@ -58,9 +58,17 @@ # Security mode. Most people will want user level security. See # security_level.txt for details. security = user + # Use password server option only with security = server +# The argument list may include: +# password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name] +# or to auto-locate the domain controller/s +# password server = * ; password server = <NT-Server-Name> +# Note: Do NOT use the now deprecated option of "domain controller" +# This option is no longer implemented. + # You may wish to use password encryption. Please read # ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation. # Do not enable this option unless you have read those documents @@ -73,6 +81,8 @@ # Most people will find that this option gives better performance. # See speed.txt and the manual pages for details +# You may want to add the following on a Linux system: +# SO_RCVBUF=8192 SO_SNDBUF=8192 socket options = TCP_NODELAY # Configure Samba to use multiple interfaces @@ -98,10 +108,6 @@ # and gives it a slightly higher chance of winning the election ; preferred master = yes -# Use only if you have an NT server on your network that has been -# configured at install time to be a primary domain controller. -; domain controller = <NT-Domain-Controller-SMBName> - # Enable this if you want Samba to be a domain logon server for # Windows95 workstations. ; domain logons = yes @@ -174,6 +180,10 @@ comment = Home Directories browseable = no writeable = yes +# Un-comment the following two lines to add a recycle bin facility to a samba share +# NOTE: It currently doesn't work with the [homes] virtual share, use a regular share instead +; vfs object = %%SAMBA_VFSDIR%%/recycle.so +; vfs options= recycle=.recycle # Un-comment the following and create the netlogon directory for Domain Logons ; [netlogon] @@ -265,6 +275,9 @@ ; only guest = yes ; writeable = yes ; printable = no +# Un-comment the following two lines to add a recycle bin facility to a samba share +; vfs object = %%SAMBA_VFSDIR%%/recycle.so +; vfs options= recycle=.recycle # The following two entries demonstrate how to share a directory so that two # users can place files there that will be owned by the specific users. In this - - >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205091600.g49G0sOL006986>