[PATCH] module path stuff
Stefan (metze) Metzmacher
metze at metzemix.de
Tue Dec 10 16:27:01 GMT 2002
Hi Jelmer,
here is a new patch for the modules stuff, parametric options and new
smb_register_vfs():
- it adds 'modules path' and 'modules' as per share parameter
(vfs path is now an alias for modules path)
- it add two new parameters to the smb_load_modules function
int smb_load_modules(const char **modules, connection_struct *conn,
SMB_MODULE_TYPES types)
conn == NULL - for the global section.
SMB_MODULE_TYPES types - this is the bitmask witch module types should be
loaded here, ( we don't need a winsdb module in smbd... also
smb_register_winsdb() is not linked to smbd, witch would cause trouble)
now we can use
smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPE_CHARSET)
to load the charsets before the fork in smbd
smb_load_modules(lp_modules(SNUM(conn)),SNUM(conn),MODULE_TYPE_VFS) for
loading the vfs modules per share..
lp_module_path is dyn_LIBDIR by default...
lib_path() for loading upcase.dat,... is replaced by data_path() witch is
default dyn_DATADIR
for making jerry and jht happy I use :
DATADIR = @libdir@ in Makefile.in but it should be changed to
DATADIR = @datadir@
%-Macros can be in 'modules path' and 'modules'
- parametric options now all take a default value.
char *lp_param_string() and char **lp_param_string_list() can be used as
every othere
lp_* function with char * or char **
you should not try to free() the return values of this function!!!
- smb_register_vfs()
Each SAMBA module must provide following global function:
init_module -- module initalization function
NTSTATUS init_module(SMB_MODULE_TYPES types)
{
if (types & MODULE_TYPE_VFS) {
if (smb_register_vfs("recycle", vfs_recycle_init,
VFS_INTERFACE_VERSION)) {
return NT_STATUS_OK;
} else {
return NT_STATUS_UNSUCCESSFUL;
}
}
return NT_STATUS_OK;
}
Each VFS module must provide following global function:
vfs_*_init -- vfs initialization function
vfs_*_init (e.g. vfs_recycle_init ) must return proper initialized
vfs_op_tuple[] array
which describes all operations this module claims to intercept. This
function
is called whenever module is loaded into smbd process using sys_dlopen().
vfs_*_init must have a list (indexed by the SNUM(conn) or CNUM(conn))
for storing the default_vfs_ops and if module wants to store private
information for further usage.
Prototypes:
vfs_op_tuple *vfs_recycle_init(struct connection_struct *conn, struct
vfs_ops *default_vfs_ops, const char *param);
'vfs path' is removed
'vfs options' should not be used anymore( but it's still there)
'vfs object' move to 'vfs objects' ( but 'vfs object' is an alias)
'vfs objects = <module1_name>[:<module1_parameter>]
{[<module2_name>[:<module2_parameter>]]}
- vfs_audit.c is installed as audit.so
- vfs_recycle.c is installed as recycle.so
- vfs_nettalk.c is installed as nettalk.so
vfs_audit.c and vfs_recycle.c are now per connection safe
I modified vfs_nettalk.c also (it compiles fine ) but I havn't the chance
to test it...
I have tested this patch this afternoon and I have no problems...
metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>
-------------- next part --------------
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/Makefile.in HEAD-modules/source/Makefile.in
--- HEAD/source/Makefile.in Mon Dec 9 06:36:39 2002
+++ HEAD-modules/source/Makefile.in Mon Dec 9 07:52:02 2002
@@ -52,6 +52,9 @@ PDBLIBDIR = $(LIBDIR)/pdb
CONFIGDIR = @configdir@
VARDIR = @localstatedir@
MANDIR = @mandir@
+# This is where valid.dat,upcase.dat,lowcase.dat are installed and searched by default
+# DATADIR = @datadir@ change this if jerry and jht agree
+DATADIR = @libdir@
# The permissions to give the executables
INSTALLPERMS = 0755
@@ -94,12 +97,11 @@ FLAGS32 = $(ISA32) $(FLAGS5)
PASSWD_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATE_DIR)\"
PATH_FLAGS1 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\"
-PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\" -DDRIVERFILE=\"$(DRIVERFILE)\"
-PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
-PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
-PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" -DLOGFILEBASE=\"$(LOGFILEBASE)\"
-PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\"
-PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
+PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
+PATH_FLAGS3 = $(PATH_FLAGS2) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
+PATH_FLAGS4 = $(PATH_FLAGS3) -DLIBDIR=\"$(LIBDIR)\" -DLOGFILEBASE=\"$(LOGFILEBASE)\"
+PATH_FLAGS5 = $(PATH_FLAGS4) -DCONFIGDIR=\"$(CONFIGDIR)\" -DDATADIR=\"$(DATADIR)\"
+PATH_FLAGS = $(PATH_FLAGS5) $(PASSWD_FLAGS)
# Note that all executable programs now provide for an optional executable suffix.
@@ -126,7 +128,7 @@ SCRIPTS = $(srcdir)/script/smbtar $(srcd
QUOTAOBJS=@QUOTAOBJS@
-VFS_MODULES = bin/vfs_audit. at SHLIBEXT@ bin/vfs_recycle. at SHLIBEXT@ bin/vfs_netatalk. at SHLIBEXT@
+VFS_MODULES = bin/audit. at SHLIBEXT@ bin/recycle. at SHLIBEXT@ bin/netatalk. at SHLIBEXT@
PDB_MODULES = @MODULE_MYSQL@ @MODULE_XML@
MODULES = bin/developer. at SHLIBEXT@
@@ -869,17 +871,17 @@ bin/xml. at SHLIBEXT@: $(XML_OBJ)
@$(SHLD) $(LDSHFLAGS) -o $@ $(XML_OBJ) @XML_LIBS@ \
@SONAMEFLAG@`basename $@`
-bin/vfs_audit. at SHLIBEXT@: $(VFS_AUDIT_OBJ)
+bin/audit. at SHLIBEXT@: $(VFS_AUDIT_OBJ)
@echo "Building plugin $@"
@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_AUDIT_OBJ) \
@SONAMEFLAG@`basename $@`
-bin/vfs_recycle. at SHLIBEXT@: $(VFS_RECYCLE_OBJ)
+bin/recycle. at SHLIBEXT@: $(VFS_RECYCLE_OBJ)
@echo "Building plugin $@"
@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_RECYCLE_OBJ) \
@SONAMEFLAG@`basename $@`
-bin/vfs_netatalk. at SHLIBEXT@: $(VFS_NETATALK_OBJ)
+bin/netatalk. at SHLIBEXT@: $(VFS_NETATALK_OBJ)
@echo "Building plugin $@"
@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_NETATALK_OBJ) \
@SONAMEFLAG@`basename $@`
@@ -918,24 +920,28 @@ install: installbin installman installsc
# is not used
installdirs:
- @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR) $(DESTDIR)$(VFSLIBDIR) $(DESTDIR)$(PDBLIBDIR)
+ @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR)
installservers: all installdirs
- @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
+ @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
installbin: all installdirs
- @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
- @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
+ @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
+ @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
-installmodules: all installdirs
+installmoduledirs:
+ @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VFSLIBDIR) $(DESTDIR)$(PDBLIBDIR)
+
+installmodules: modules installmoduledirs
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(VFS_MODULES)
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(PDB_MODULES)
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(LIBDIR) $(MODULES)
installscripts: installdirs
@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
installdat: installdirs
- @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
+ @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
installswat: installdirs
@$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
@@ -1016,6 +1022,7 @@ showlayout:
@echo " libdir: $(LIBDIR)"
@echo " vardir: $(VARDIR)"
@echo " mandir: $(MANDIR)"
+ @echo " datadir: $(DATADIR)"
uninstall: uninstallman uninstallbin uninstallscripts
@@ -1024,8 +1031,8 @@ uninstallman:
@$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(srcdir) $(man_langs)
uninstallbin:
- @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
- @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
+ @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
+ @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
uninstallmodules:
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(DESTDIR)$(VFS_MODULES)
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/configure.in HEAD-modules/source/configure.in
--- HEAD/source/configure.in Thu Dec 5 09:43:42 2002
+++ HEAD-modules/source/configure.in Fri Dec 6 09:22:43 2002
@@ -17,9 +17,10 @@ AC_ARG_WITH(fhs,
logfilebase="\${VARDIR}/log/samba"
privatedir="\${CONFIGDIR}/private"
libdir="\${prefix}/lib/samba"
- swatdir="\${DATADIR}/samba/swat",
- configdir="\${LIBDIR}"
- logfilebase="\${VARDIR}"
+ swatdir="${datadir}/samba/swat"
+ datadir="${datadir}/samba",
+ configdir="\$(LIBDIR)"
+ logfilebase="\$(VARDIR)"
lockdir="\${VARDIR}/locks"
piddir="\${VARDIR}/locks"
privatedir="\${prefix}/private"
@@ -129,6 +130,7 @@ AC_SUBST(privatedir)
AC_SUBST(swatdir)
AC_SUBST(bindir)
AC_SUBST(sbindir)
+AC_SUBST(datadir)
dnl Unique-to-Samba variables we'll be playing with.
AC_SUBST(SHELL)
@@ -630,7 +632,7 @@ test "${with_readline+set}" != "set" &&
# test for where we get readline() from
AC_MSG_CHECKING(whether to use readline)
AC_ARG_WITH(readline,
-[ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
+[ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
[ case "$with_readline" in
yes)
AC_MSG_RESULT(yes)
@@ -1969,7 +1971,7 @@ with_ads_support=yes
AC_MSG_CHECKING([whether to use Active Directory])
AC_ARG_WITH(ads,
-[ --with-ads Active Directory support (default yes)],
+[ --with-ads Active Directory support (default yes)],
[ case "$withval" in
no)
with_ads_support=no
@@ -2069,7 +2071,7 @@ with_ldap_support=yes
AC_MSG_CHECKING([whether to use LDAP])
AC_ARG_WITH(ldap,
-[ --with-ldap LDAP support (default yes)],
+[ --with-ldap LDAP support (default yes)],
[ case "$withval" in
no)
with_ldap_support=no
@@ -2265,7 +2267,7 @@ AC_ARG_WITH(sam,
# check for a LDAP password database configuration backwards compatibility
AC_MSG_CHECKING(whether to use LDAP SAM 2.2 compatible configuration)
AC_ARG_WITH(ldapsam,
-[ --with-ldapsam Include LDAP SAM 2.2 compatible configuration (default=no)],
+[ --with-ldapsam Include LDAP SAM 2.2 compatible configuration (default=no)],
[ case "$withval" in
yes)
AC_MSG_RESULT(yes)
@@ -2782,7 +2784,7 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_
with_sendfile_support=yes
AC_MSG_CHECKING(whether to check to support sendfile)
AC_ARG_WITH(sendfile-support,
-[ --with-sendfile-support Check for sendfile support (default=yes)],
+[ --with-sendfile-support Check for sendfile support (default=yes)],
[ case "$withval" in
yes)
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/dynconfig.c HEAD-modules/source/dynconfig.c
--- HEAD/source/dynconfig.c Tue Nov 5 16:25:26 2002
+++ HEAD-modules/source/dynconfig.c Fri Dec 6 09:22:43 2002
@@ -54,9 +54,9 @@ pstring dyn_LMHOSTSFILE = LMHOSTSFILE;
/**
* @brief Samba library directory.
*
- * @sa lib_path() to get the path to a file inside the LIBDIR.
+ * @sa data_path() to get the path to a file inside the DATADIR.
**/
-pstring dyn_LIBDIR = LIBDIR;
+pstring dyn_DATADIR = DATADIR;
/**
* @brief Directory holding lock files.
@@ -68,3 +68,6 @@ const pstring dyn_PIDDIR = PIDDIR;
const pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
const pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
+
+/** default for lp_modules_path(int snum) **/
+const pstring dyn_LIBDIR = LIBDIR;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/include/dynconfig.h HEAD-modules/source/include/dynconfig.h
--- HEAD/source/include/dynconfig.h Tue Nov 5 16:25:26 2002
+++ HEAD-modules/source/include/dynconfig.h Fri Dec 6 09:22:43 2002
@@ -29,8 +29,9 @@ extern char const *dyn_SBINDIR,
extern pstring dyn_CONFIGFILE;
extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
-extern pstring dyn_LIBDIR;
+extern pstring dyn_DATADIR;
extern const pstring dyn_LOCKDIR;
extern const pstring dyn_PIDDIR;
extern const pstring dyn_SMB_PASSWD_FILE;
extern const pstring dyn_PRIVATE_DIR;
+extern const pstring dyn_LIBDIR;
\ No newline at end of file
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/include/includes.h HEAD-modules/source/include/includes.h
--- HEAD/source/include/includes.h Wed Dec 4 07:18:40 2002
+++ HEAD-modules/source/include/includes.h Fri Dec 6 09:22:43 2002
@@ -730,6 +730,7 @@ extern int errno;
#include "version.h"
#include "smb.h"
+#include "modules.h"
#include "smbw.h"
#include "nameserv.h"
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/include/modules.h HEAD-modules/source/include/modules.h
--- HEAD/source/include/modules.h Thu Jan 1 01:00:00 1970
+++ HEAD-modules/source/include/modules.h Fri Dec 6 09:37:02 2002
@@ -0,0 +1,59 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * module loading system
+
+ * Cpoyright (C) Stefan (metze) Metzmacher 2002
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _MODULES_H
+#define _MODULES_H
+
+typedef SMB_BIG_UINT SMB_MODULE_TYPES;
+
+#define MODULE_TYPE_NONE 0x0000000000000000
+#define MODULE_TYPE_PDB 0x0000000000000001
+#define MODULE_TYPE_VFS 0x0000000000000002
+#define MODULE_TYPE_WINSDB 0x0000000000000004
+#define MODULE_TYPE_SAM 0x0000000000000008
+#define MODULE_TYPE_CHARSET 0x0000000000000010
+
+#define MODULE_TYPES_ALL 0xFFFFFFFFFFFFFFFF
+
+#ifdef WITH_SAM
+#define MODULE_TYPES_SMBD MODULE_TYPE_CHARSET | MODULE_TYPE_PDB | MODULE_TYPE_VFS | MODULE_TYPE_SAM
+#else
+#define MODULE_TYPES_SMBD MODULE_TYPE_CHARSET | MODULE_TYPE_PDB | MODULE_TYPE_VFS
+#endif /* WITH_SAM */
+
+#define MODULE_TYPES_PER_SHARE MODULE_TYPE_VFS
+
+#define MODULE_TYPES_NMBD MODULE_TYPE_CHARSET | MODULE_TYPE_WINSDB
+
+#define MODULE_TYPES_WINBINDD MODULE_TYPE_NONE
+
+#define MODULE_TYPES_WREPLD MODULE_TYPES_NMBD
+
+#define MODULE_TYPES_NET MODULE_TYPES_SMBD
+#define MODULE_TYPES_SMBPASSWD MODULE_TYPES_SMBD
+#define MODULE_TYPES_SMBGROUPEDIT MODULE_TYPES_SMBD
+#define MODULE_TYPES_PDBEDIT MODULE_TYPES_SMBD
+#define MODULE_TYPES_VFSTEST MODULE_TYPES_SMBD
+
+/* Module support */
+typedef NTSTATUS (init_module_function) (SMB_MODULE_TYPES);
+
+#endif /* _MODULES_H */
\ No newline at end of file
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/include/smb.h HEAD-modules/source/include/smb.h
--- HEAD/source/include/smb.h Thu Dec 5 09:43:43 2002
+++ HEAD-modules/source/include/smb.h Mon Dec 9 07:24:45 2002
@@ -422,15 +422,6 @@ typedef struct
#include "smb_acls.h"
#include "vfs.h"
-typedef struct smb_vfs_handle_struct
-{
- void *data;
- /* Handle on dlopen() call */
- void *handle;
- struct smb_vfs_handle_struct *next, *prev;
-
-} smb_vfs_handle_struct;
-
typedef struct connection_struct
{
struct connection_struct *next, *prev;
@@ -449,7 +440,7 @@ typedef struct connection_struct
char *origpath;
struct vfs_ops vfs_ops; /* Filesystem operations */
- struct smb_vfs_handle_struct *vfs_private;
+ struct vfs_ops vfs_opaque_ops; /* Opaque (final) vfs operations */
char *user; /* name of user who *opened* this connection */
uid_t uid; /* uid of user who *opened* this connection */
@@ -1706,8 +1697,5 @@ extern struct poptOption popt_common_soc
extern struct poptOption popt_common_version[];
extern struct poptOption popt_common_netbios_name[];
extern struct poptOption popt_common_log_base[];
-
-/* Module support */
-typedef NTSTATUS (init_module_function) (void);
#endif /* _SMB_H */
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/include/smb_macros.h HEAD-modules/source/include/smb_macros.h
--- HEAD/source/include/smb_macros.h Thu Dec 5 09:43:43 2002
+++ HEAD-modules/source/include/smb_macros.h Tue Dec 10 13:37:44 2002
@@ -95,8 +95,11 @@
#define ERROR_WAS_LOCK_DENIED(status) (NT_STATUS_EQUAL((status), NT_STATUS_LOCK_NOT_GRANTED) || \
NT_STATUS_EQUAL((status), NT_STATUS_FILE_LOCK_CONFLICT) )
+/* the service number for the [globals] defaults */
+#define GLOBAL_SECTION_SNUM (-2)
/* translates a connection number into a service number */
-#define SNUM(conn) ((conn)?(conn)->service:-1)
+#define SNUM(conn) ((conn)?(conn)->service:GLOBAL_SECTION_SNUM)
+
/* access various service details */
#define SERVICE(snum) (lp_servicename(snum))
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/include/vfs.h HEAD-modules/source/include/vfs.h
--- HEAD/source/include/vfs.h Wed Sep 18 09:44:22 2002
+++ HEAD-modules/source/include/vfs.h Tue Dec 10 14:30:19 2002
@@ -45,46 +45,45 @@
/* Changed to version 3 for POSIX acl extensions. JRA. */
/* Changed to version 4 for cascaded VFS interface. Alexander Bokovoy. */
/* Changed to version 5 for sendfile addition. JRA. */
-#define SMB_VFS_INTERFACE_VERSION 5
+/* Changed to version 6 for using smb_register_vfs()... metze */
+#define SMB_VFS_INTERFACE_VERSION 6
-/* Version of supported cascaded interface backward copmatibility.
- (version 5 corresponds to SMB_VFS_INTERFACE_VERSION 5)
- It is used in vfs_init_custom() to detect VFS modules which conform to cascaded
- VFS interface but implement elder version than current version of Samba uses.
- This allows to use old modules with new VFS interface as far as combined VFS operation
- set is coherent (will be in most cases).
-*/
-#define SMB_VFS_INTERFACE_CASCADED 5
-
/*
- Each VFS module must provide following global functions:
- vfs_init -- initialization function
- vfs_done -- finalization function
-
- vfs_init must return proper initialized vfs_op_tuple[] array
+ Each SAMBA module must provide following global function:
+ init_module -- module initalization function
+
+ NTSTATUS init_module(SMB_MODULE_TYPES types)
+ {
+ if (types & MODULE_TYPE_VFS) {
+ if (smb_register_vfs("recycle", vfs_recycle_init, VFS_INTERFACE_VERSION)) {
+ return NT_STATUS_OK;
+ } else {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ }
+
+ return NT_STATUS_OK;
+ }
+
+ Each VFS module must provide following global function:
+ vfs_*_init -- vfs initialization function
+
+ vfs_*_init (e.g. vfs_recycle_init ) must return proper initialized vfs_op_tuple[] array
which describes all operations this module claims to intercept. This function
is called whenever module is loaded into smbd process using sys_dlopen().
-
- vfs_init must store somewhere vfs_handle reference if module wants to store per-instance
- private information for further usage. vfs_handle->data should be used to
- store such information. Do not try to change other fields in this structure
- or results likely to be unpredictable.
-
- vfs_done must perform finalization of the module. In particular,
- this function must free vfs_ops structure returned to module from smb_vfs_get_opaque_ops()
- function if it is used (see below). This function is called whenever module
- is unloaded from smbd process using sys_dlclose().
-
+
+ vfs_*_init must have a list (indexed by the SNUM(conn) or CNUM(conn))
+ for storing the default_vfs_ops and if module wants to store private
+ information for further usage.
+
Prototypes:
- vfs_op_tuple *vfs_init(int *vfs_version, const struct vfs_ops *def_vfs_ops,
- struct smb_vfs_handle_struct *vfs_handle);
- void vfs_done(connection_struct *conn);
+ vfs_op_tuple *vfs_recycle_init(struct connection_struct *conn, struct vfs_ops *default_vfs_ops, const char *param);
All intercepted VFS operations must be declared as static functions inside module source
- in order to keep smbd namespace unpolluted. See source of skel, audit, and recycle bin
+ in order to keep smbd namespace unpolluted. See source of nettalk, audit, and recycle bin
example VFS modules for more details.
-
+
*/
/* VFS operations structure */
@@ -93,6 +92,8 @@ struct connection_struct;
struct files_struct;
struct security_descriptor_info;
+#define VFS_OP(x) ((void *) x)
+
struct vfs_ops {
/* Disk operations */
@@ -321,18 +322,12 @@ typedef struct _vfs_op_tuple {
vfs_op_layer layer;
} vfs_op_tuple;
-/*
- Return vfs_ops filled with current opaque VFS operations. This function is designed to
- be called from VFS module initialization function for those modules which needs 'direct' VFS
- access (loggers or initiators of file operations other than connection asks for).
-
- Returned vfs_ops must be cleaned up in VFS module's finalizer function (vfs_done_<module_name>)
- using safe_free().
-
- Prototype:
- struct vfs_ops *smb_vfs_get_opaque_ops();
-
- This prototype will be available via include/proto.h
-*/
+typedef vfs_op_tuple* (*vfs_init_function)(struct connection_struct *, struct vfs_ops *, const char *);
+
+struct vfs_object_function_entry {
+ struct vfs_object_function_entry *prev, *next;
+ char *name;
+ vfs_init_function init;
+};
#endif /* _VFS_H */
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/intl/lang_tdb.c HEAD-modules/source/intl/lang_tdb.c
--- HEAD/source/intl/lang_tdb.c Sat Nov 23 17:52:43 2002
+++ HEAD-modules/source/intl/lang_tdb.c Fri Dec 6 09:22:43 2002
@@ -123,7 +123,7 @@ BOOL lang_tdb_init(const char *lang)
/* if no lang then we don't translate */
if (!lang) return True;
- asprintf(&msg_path, "%s.msg", lib_path((char *)lang));
+ asprintf(&msg_path, "%s.msg", data_path((char *)lang));
if (stat(msg_path, &st) != 0) {
/* the msg file isn't available */
free(msg_path);
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/lib/module.c HEAD-modules/source/lib/module.c
--- HEAD/source/lib/module.c Wed Nov 13 19:52:32 2002
+++ HEAD-modules/source/lib/module.c Tue Dec 10 16:08:57 2002
@@ -22,46 +22,71 @@
#include "includes.h"
#ifdef HAVE_DLOPEN
-NTSTATUS smb_load_module(const char *module_name)
+NTSTATUS smb_load_module(const char *module_name, connection_struct *conn, SMB_MODULE_TYPES types)
{
void *handle;
init_module_function *init;
NTSTATUS nt_status;
+ pstring full_module_name;
+
+ if (lp_modules_path(SNUM(conn)) && *lp_modules_path(SNUM(conn)) && *module_name!='/') {
+ pstrcpy(full_module_name,lp_modules_path(SNUM(conn)));
+ pstrcat(full_module_name,"/");
+ pstrcat(full_module_name,module_name);
+ } else {
+ pstrcpy(full_module_name,module_name);
+ }
+
+ /* substitutions */
+ if (conn) {
+ standard_sub_conn(conn,full_module_name,sizeof(pstring));
+ } else {
+ standard_sub_snum(SNUM(conn),full_module_name,sizeof(pstring));
+ }
/* Always try to use LAZY symbol resolving; if the plugin has
* backwards compatibility, there might be symbols in the
* plugin referencing to old (removed) functions
*/
- handle = sys_dlopen(module_name, RTLD_LAZY);
+ handle = sys_dlopen(full_module_name, RTLD_LAZY);
if(!handle) {
- DEBUG(0, ("Error loading module '%s': %s\n", module_name, sys_dlerror()));
+ DEBUG(0, ("Error loading module '%s': %s\n", full_module_name, sys_dlerror()));
return NT_STATUS_UNSUCCESSFUL;
}
init = sys_dlsym(handle, "init_module");
if(!init) {
- DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", module_name, sys_dlerror()));
+ DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", full_module_name, sys_dlerror()));
return NT_STATUS_UNSUCCESSFUL;
}
- nt_status = init();
+ nt_status = init(types);
- DEBUG(2, ("Module '%s' loaded\n", module_name));
+ DEBUG(2, ("Module '%s' loaded\n", full_module_name));
return nt_status;
}
/* Load all modules in list and return number of
* modules that has been successfully loaded */
-int smb_load_modules(const char **modules)
+int smb_load_modules(const char **modules, connection_struct *conn, SMB_MODULE_TYPES types)
{
int i;
int success = 0;
+ if (SNUM(conn) != GLOBAL_SECTION_SNUM &&
+ lp_modules(GLOBAL_SECTION_SNUM)==modules) {
+ /* don't load modules of the global section
+ * when SNUM(conn) != GLOBAL_SECTION_SNUM !!!
+ */
+ DEBUG(5,("smb_load_modules: don't reload global modules on connection start\n"));
+ return success;
+ }
+
for(i = 0; modules[i]; i++){
- if(NT_STATUS_IS_OK(smb_load_module(modules[i]))) {
+ if(NT_STATUS_IS_OK(smb_load_module(modules[i],conn,types))) {
success++;
}
}
@@ -73,13 +98,13 @@ int smb_load_modules(const char **module
#else /* HAVE_DLOPEN */
-NTSTATUS smb_load_module(const char *module_name)
+NTSTATUS smb_load_module(const char *module_name, connection_struct *conn, SMB_MODULE_TYPES types)
{
DEBUG(0,("This samba executable has not been build with plugin support"));
return NT_STATUS_NOT_SUPPORTED;
}
-int smb_load_modules(const char **modules)
+int smb_load_modules(const char **modules, connection_struct *conn, SMB_MODULE_TYPES types)
{
DEBUG(0,("This samba executable has not been build with plugin support"));
return -1;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/lib/util.c HEAD-modules/source/lib/util.c
--- HEAD/source/lib/util.c Mon Dec 9 06:36:39 2002
+++ HEAD-modules/source/lib/util.c Mon Dec 9 07:20:03 2002
@@ -2162,15 +2162,15 @@ char *pid_path(const char *name)
/**
* @brief Returns an absolute path to a file in the Samba lib directory.
*
- * @param name File to find, relative to LIBDIR.
+ * @param name File to find, relative to DATADIR.
*
* @retval Pointer to a static #pstring containing the full path.
**/
-char *lib_path(const char *name)
+char *data_path(const char *name)
{
static pstring fname;
- snprintf(fname, sizeof(fname), "%s/%s", dyn_LIBDIR, name);
+ snprintf(fname, sizeof(fname), "%s/%s", dyn_DATADIR, name);
return fname;
}
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/lib/util_str.c HEAD-modules/source/lib/util_str.c
--- HEAD/source/lib/util_str.c Wed Nov 27 17:15:02 2002
+++ HEAD-modules/source/lib/util_str.c Mon Dec 9 09:50:07 2002
@@ -1232,6 +1232,54 @@ char **str_list_make(const char *string,
return list;
}
+char **talloc_str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep)
+{
+ char **list, **rlist;
+ const char *str;
+ char *s;
+ int num, lsize;
+ pstring tok;
+
+ if (!string || !*string)
+ return NULL;
+ s = strdup(string);
+ if (!s) {
+ DEBUG(0,("str_list_make: Unable to allocate memory"));
+ return NULL;
+ }
+ if (!sep) sep = LIST_SEP;
+
+ num = lsize = 0;
+ list = NULL;
+
+ str = s;
+ while (next_token(&str, tok, sep, sizeof(tok))) {
+ if (num == lsize) {
+ lsize += S_LIST_ABS;
+ rlist = (char **)talloc_realloc(mem_ctx, list, ((sizeof(char **)) * (lsize +1)));
+ if (!rlist) {
+ DEBUG(0,("str_list_make: Unable to allocate memory"));
+ SAFE_FREE(s);
+ return NULL;
+ } else
+ list = rlist;
+ memset (&list[num], 0, ((sizeof(char**)) * (S_LIST_ABS +1)));
+ }
+
+ list[num] = talloc_strdup(mem_ctx,tok);
+ if (!list[num]) {
+ DEBUG(0,("str_list_make: Unable to allocate memory"));
+ SAFE_FREE(s);
+ return NULL;
+ }
+
+ num++;
+ }
+
+ SAFE_FREE(s);
+ return list;
+}
+
BOOL str_list_copy(char ***dest, const char **src)
{
char **list, **rlist;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/lib/util_unistr.c HEAD-modules/source/lib/util_unistr.c
--- HEAD/source/lib/util_unistr.c Sun Nov 10 00:34:38 2002
+++ HEAD-modules/source/lib/util_unistr.c Fri Dec 6 09:22:43 2002
@@ -43,8 +43,8 @@ void load_case_tables(void)
if (initialised) return;
initialised = 1;
- upcase_table = map_file(lib_path("upcase.dat"), 0x20000);
- lowcase_table = map_file(lib_path("lowcase.dat"), 0x20000);
+ upcase_table = map_file(data_path("upcase.dat"), 0x20000);
+ lowcase_table = map_file(data_path("lowcase.dat"), 0x20000);
/* we would like Samba to limp along even if these tables are
not available */
@@ -108,7 +108,7 @@ void init_valid_table(void)
if (initialised && mapped_file) return;
initialised = 1;
- valid_table = map_file(lib_path("valid.dat"), 0x10000);
+ valid_table = map_file(data_path("valid.dat"), 0x10000);
if (valid_table) {
mapped_file = 1;
return;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/modules/developer.c HEAD-modules/source/modules/developer.c
--- HEAD/source/modules/developer.c Wed Nov 13 20:07:34 2002
+++ HEAD-modules/source/modules/developer.c Fri Dec 6 10:15:44 2002
@@ -125,8 +125,10 @@ static size_t weird_push(void *cd, char
struct charset_functions weird_functions = {"WEIRD", weird_pull, weird_push};
-int init_module(void)
+NTSTATUS init_module(SMB_MODULE_TYPES types)
{
- smb_register_charset(&weird_functions);
- return 0;
+ if (types & MODULE_TYPE_CHARSET)
+ smb_register_charset(&weird_functions);
+
+ return NT_STATUS_OK;
}
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/modules/mysql.c HEAD-modules/source/modules/mysql.c
--- HEAD/source/modules/mysql.c Fri Nov 15 18:01:23 2002
+++ HEAD-modules/source/modules/mysql.c Tue Dec 10 16:39:06 2002
@@ -25,12 +25,12 @@
#define CONFIG_LOGON_TIME_DEFAULT "logon_time"
#define CONFIG_LOGOFF_TIME_DEFAULT "logoff_time"
#define CONFIG_KICKOFF_TIME_DEFAULT "kickoff_time"
-#define CONFIG_PASS_LAST_SET_TIME_DEFAULT "pass_last_set_time"
-#define CONFIG_PASS_CAN_CHANGE_TIME_DEFAULT "pass_can_change_time"
-#define CONFIG_PASS_MUST_CHANGE_TIME_DEFAULT "pass_must_change_time"
+#define CONFIG_PASS_LAST_SET_TIME_DEFAULT "pass_last_set_time"
+#define CONFIG_PASS_CAN_CHANGE_TIME_DEFAULT "pass_can_change_time"
+#define CONFIG_PASS_MUST_CHANGE_TIME_DEFAULT "pass_must_change_time"
#define CONFIG_USERNAME_DEFAULT "username"
#define CONFIG_DOMAIN_DEFAULT "domain"
-#define CONFIG_NT_USERNAME_DEFAULT "nt_username"
+#define CONFIG_NT_USERNAME_DEFAULT "nt_username"
#define CONFIG_FULLNAME_DEFAULT "nt_fullname"
#define CONFIG_HOME_DIR_DEFAULT "home_dir"
#define CONFIG_DIR_DRIVE_DEFAULT "dir_drive"
@@ -40,8 +40,8 @@
#define CONFIG_WORKSTATIONS_DEFAULT "workstations"
#define CONFIG_UNKNOWN_STR_DEFAULT "unknown_str"
#define CONFIG_MUNGED_DIAL_DEFAULT "munged_dial"
-#define CONFIG_UID_DEFAULT "uid"
-#define CONFIG_GID_DEFAULT "gid"
+#define CONFIG_UID_DEFAULT "uid"
+#define CONFIG_GID_DEFAULT "gid"
#define CONFIG_USER_SID_DEFAULT "user_sid"
#define CONFIG_GROUP_SID_DEFAULT "group_sid"
#define CONFIG_LM_PW_DEFAULT "lm_pw"
@@ -53,11 +53,11 @@
#define CONFIG_HOURS_LEN_DEFAULT "hours_len"
#define CONFIG_UNKNOWN_5_DEFAULT "unknown_5"
#define CONFIG_UNKNOWN_6_DEFAULT "unknown_6"
-#define CONFIG_HOST_DEFAULT "localhost"
-#define CONFIG_USER_DEFAULT "samba"
-#define CONFIG_PASS_DEFAULT ""
-#define CONFIG_PORT_DEFAULT "3306"
-#define CONFIG_DB_DEFAULT "samba"
+#define CONFIG_HOST_DEFAULT "localhost"
+#define CONFIG_USER_DEFAULT "samba"
+#define CONFIG_PASS_DEFAULT ""
+#define CONFIG_PORT_DEFAULT "3306"
+#define CONFIG_DB_DEFAULT "samba"
static int mysqlsam_debug_level = DBGC_ALL;
@@ -147,10 +147,7 @@ static NTSTATUS pdb_mysql_string_field(s
static char * config_value(pdb_mysql_data * data, char *name, char *default_value)
{
- if (lp_parm_string(NULL, data->location, name))
- return lp_parm_string(NULL, data->location, name);
-
- return default_value;
+ return lp_parm_string(GLOBAL_SECTION_SNUM, data->location, name, default_value);
}
static char * config_value_write(pdb_mysql_data * data, char *name, char *default_value) {
@@ -1032,12 +1029,15 @@ static NTSTATUS mysqlsam_init(struct pdb
return NT_STATUS_OK;
}
-int init_module(void);
-
-int init_module()
+NTSTATUS init_module(SMB_MODULE_TYPES types)
{
- if(smb_register_passdb("mysql", mysqlsam_init, PASSDB_INTERFACE_VERSION))
- return 0;
-
- return 1;
-}
+ if (types & MODULE_TYPE_PDB) {
+ if (smb_register_passdb("mysql", mysqlsam_init, PASSDB_INTERFACE_VERSION)) {
+ return NT_STATUS_OK;
+ } else {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
\ No newline at end of file
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/modules/vfs_audit.c HEAD-modules/source/modules/vfs_audit.c
--- HEAD/source/modules/vfs_audit.c Wed Nov 13 14:10:29 2002
+++ HEAD-modules/source/modules/vfs_audit.c Tue Dec 10 15:38:32 2002
@@ -4,6 +4,7 @@
*
* Copyright (C) Tim Potter, 1999-2000
* Copyright (C) Alexander Bokovoy, 2002
+ * Copyright (C) Stefan (metze) Metzmacher
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -38,13 +39,13 @@
#include <includes.h>
#include <vfs.h>
-#ifndef SYSLOG_FACILITY
-#define SYSLOG_FACILITY LOG_USER
-#endif
-#ifndef SYSLOG_PRIORITY
-#define SYSLOG_PRIORITY LOG_NOTICE
-#endif
+typedef struct _audit_connection {
+ TALLOC_CTX *mem_ctx;
+ struct _audit_connection *next,*prev;
+ int snum;
+ struct vfs_ops def_vfs_ops;
+} audit_connection;
/* Function prototypes */
@@ -62,10 +63,82 @@ static int audit_chmod_acl(struct connec
static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode);
static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode);
-/* VFS operations */
+static int audit_syslog_facility(struct connection_struct *conn)
+{
+ /* fix me: let this be configurable by:
+ * lp_param_enum(SNUM(conn),"vfs_audit","syslog facility",
+ * audit_enum_facility,LOG_USER);
+ */
+ return LOG_USER;
+}
+
+static int audit_syslog_priority(struct connection_struct *conn)
+{
+ /* fix me: let this be configurable by:
+ * lp_param_enum(SNUM(conn),"vfs_audit","syslog priority",
+ * audit_enum_priority,LOG_USER);
+ */
+ return LOG_NOTICE;
+}
+
+static audit_connection *audit_connections = NULL;
+
+static BOOL audit_set_def_vfs_ops(struct connection_struct *conn, struct vfs_ops *def_vfs_ops)
+{
+ audit_connection *data;
+ TALLOC_CTX *mem_ctx;
+
+ for (data = audit_connections; data; data = data->next) {
+ if (data->snum == SNUM(conn)) {
+ memcpy(&data->def_vfs_ops,def_vfs_ops,sizeof(struct vfs_ops));
+ return True;
+ }
+ }
+
+ if ((mem_ctx = talloc_init_named("audit def_vfs_ops"))==NULL) {
+ DEBUG(0,("audit_set_def_vfs_ops: talloc_init_named failed!\n"));
+ return False;
+ }
+
+ if ((data = (audit_connection *)talloc(mem_ctx,sizeof(audit_connection)))==NULL) {
+ DEBUG(0,("audit_set_def_vfs_ops:: talloc failed!\n"));
+ return False;
+ }
+
+ data->mem_ctx = mem_ctx;
+ data->snum = SNUM(conn);
+ memcpy(&data->def_vfs_ops,def_vfs_ops,sizeof(struct vfs_ops));
+
+ DLIST_ADD(audit_connections,data);
+
+ return True;
+}
-static struct vfs_ops default_vfs_ops; /* For passthrough operation */
-static struct smb_vfs_handle_struct *audit_handle;
+static struct vfs_ops *audit_get_def_vfs_ops(struct connection_struct *conn)
+{
+ audit_connection *data;
+ for (data = audit_connections; data; data = data->next) {
+ if (data->snum == SNUM(conn)) {
+ return &data->def_vfs_ops;
+ }
+ }
+ return NULL;
+}
+
+static BOOL audit_del_def_vfs_ops(struct connection_struct *conn)
+{
+ audit_connection *data;
+ for (data = audit_connections; data; data = data->next) {
+ if (data->snum == SNUM(conn)) {
+ DLIST_REMOVE(audit_connections,data);
+ talloc_destroy(data->mem_ctx);
+ return True;
+ }
+ }
+ return False;
+}
+
+/* VFS operations */
static vfs_op_tuple audit_ops[] = {
@@ -98,23 +171,17 @@ static vfs_op_tuple audit_ops[] = {
/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */
-vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
- struct smb_vfs_handle_struct *vfs_handle)
+vfs_op_tuple *vfs_audit_init(struct connection_struct *conn, struct vfs_ops *def_vfs_ops, const char *param)
{
- *vfs_version = SMB_VFS_INTERFACE_VERSION;
- memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops));
-
- audit_handle = vfs_handle;
+ openlog("smbd_audit", LOG_PID, audit_syslog_facility(conn));
+ syslog(audit_syslog_priority(conn), "VFS_INIT: vfs_ops loaded\n");
- openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY);
- syslog(SYSLOG_PRIORITY, "VFS_INIT: vfs_ops loaded\n");
- return audit_ops;
-}
+ if (!audit_set_def_vfs_ops(conn, def_vfs_ops)) {
+ syslog(audit_syslog_priority(conn),"vfs_audit: can't add default ops to global list!\n");
+ return NULL;
+ }
-/* VFS finalization function. */
-void vfs_done(connection_struct *conn)
-{
- syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n");
+ return audit_ops;
}
/* Implementation of vfs_ops. Pass everything on to the default
@@ -122,23 +189,50 @@ void vfs_done(connection_struct *conn)
static int audit_connect(struct connection_struct *conn, const char *svc, const char *user)
{
- syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n",
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return (-1);
+ }
+
+ syslog(audit_syslog_priority(conn), "connect to service %s by user %s\n",
svc, user);
- return default_vfs_ops.connect(conn, svc, user);
+ return default_vfs_ops->connect(conn, svc, user);
}
static void audit_disconnect(struct connection_struct *conn)
{
- syslog(SYSLOG_PRIORITY, "disconnected\n");
- default_vfs_ops.disconnect(conn);
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return;
+ }
+
+ syslog(audit_syslog_priority(conn), "disconnected\n");
+ default_vfs_ops->disconnect(conn);
+
+ audit_del_def_vfs_ops(conn);
}
static DIR *audit_opendir(struct connection_struct *conn, const char *fname)
{
- DIR *result = default_vfs_ops.opendir(conn, fname);
+ DIR *result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return NULL;
+ }
+
+ result = default_vfs_ops->opendir(conn, fname);
- syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n",
+ syslog(audit_syslog_priority(conn), "opendir %s %s%s\n",
fname,
(result == NULL) ? "failed: " : "",
(result == NULL) ? strerror(errno) : "");
@@ -148,9 +242,18 @@ static DIR *audit_opendir(struct connect
static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode)
{
- int result = default_vfs_ops.mkdir(conn, path, mode);
-
- syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n",
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->mkdir(conn, path, mode);
+
+ syslog(audit_syslog_priority(conn), "mkdir %s %s%s\n",
path,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
@@ -160,9 +263,18 @@ static int audit_mkdir(struct connection
static int audit_rmdir(struct connection_struct *conn, const char *path)
{
- int result = default_vfs_ops.rmdir(conn, path);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->rmdir(conn, path);
- syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n",
+ syslog(audit_syslog_priority(conn), "rmdir %s %s%s\n",
path,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
@@ -172,9 +284,18 @@ static int audit_rmdir(struct connection
static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode)
{
- int result = default_vfs_ops.open(conn, fname, flags, mode);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->open(conn, fname, flags, mode);
- syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n",
+ syslog(audit_syslog_priority(conn), "open %s (fd %d) %s%s%s\n",
fname, result,
((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "",
(result < 0) ? "failed: " : "",
@@ -185,9 +306,18 @@ static int audit_open(struct connection_
static int audit_close(struct files_struct *fsp, int fd)
{
- int result = default_vfs_ops.close(fsp, fd);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(fsp->conn))==NULL) {
+ syslog(audit_syslog_priority(fsp->conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(fsp->conn)),SNUM(fsp->conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->close(fsp, fd);
- syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n",
+ syslog(audit_syslog_priority(fsp->conn), "close fd %d %s%s\n",
fd,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
@@ -197,9 +327,18 @@ static int audit_close(struct files_stru
static int audit_rename(struct connection_struct *conn, const char *old, const char *new)
{
- int result = default_vfs_ops.rename(conn, old, new);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->rename(conn, old, new);
- syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n",
+ syslog(audit_syslog_priority(conn), "rename %s -> %s %s%s\n",
old, new,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
@@ -209,9 +348,18 @@ static int audit_rename(struct connectio
static int audit_unlink(struct connection_struct *conn, const char *path)
{
- int result = default_vfs_ops.unlink(conn, path);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->unlink(conn, path);
- syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n",
+ syslog(audit_syslog_priority(conn), "unlink %s %s%s\n",
path,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
@@ -221,9 +369,18 @@ static int audit_unlink(struct connectio
static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode)
{
- int result = default_vfs_ops.chmod(conn, path, mode);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->chmod(conn, path, mode);
- syslog(SYSLOG_PRIORITY, "chmod %s mode 0x%x %s%s\n",
+ syslog(audit_syslog_priority(conn), "chmod %s mode 0x%x %s%s\n",
path, mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
@@ -233,9 +390,18 @@ static int audit_chmod(struct connection
static int audit_chmod_acl(struct connection_struct *conn, const char *path, mode_t mode)
{
- int result = default_vfs_ops.chmod_acl(conn, path, mode);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(conn))==NULL) {
+ syslog(audit_syslog_priority(conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(conn)),SNUM(conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->chmod_acl(conn, path, mode);
- syslog(SYSLOG_PRIORITY, "chmod_acl %s mode 0x%x %s%s\n",
+ syslog(audit_syslog_priority(conn), "chmod_acl %s mode 0x%x %s%s\n",
path, mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
@@ -245,9 +411,18 @@ static int audit_chmod_acl(struct connec
static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode)
{
- int result = default_vfs_ops.fchmod(fsp, fd, mode);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(fsp->conn))==NULL) {
+ syslog(audit_syslog_priority(fsp->conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(fsp->conn)),SNUM(fsp->conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->fchmod(fsp, fd, mode);
- syslog(SYSLOG_PRIORITY, "fchmod %s mode 0x%x %s%s\n",
+ syslog(audit_syslog_priority(fsp->conn), "fchmod %s mode 0x%x %s%s\n",
fsp->fsp_name, mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
@@ -257,12 +432,34 @@ static int audit_fchmod(struct files_str
static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode)
{
- int result = default_vfs_ops.fchmod_acl(fsp, fd, mode);
+ int result;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = audit_get_def_vfs_ops(fsp->conn))==NULL) {
+ syslog(audit_syslog_priority(fsp->conn),"can't get default ops for service '%s' [%d]\n",
+ lp_servicename(SNUM(fsp->conn)),SNUM(fsp->conn));
+ return (-1);
+ }
+
+ result = default_vfs_ops->fchmod_acl(fsp, fd, mode);
- syslog(SYSLOG_PRIORITY, "fchmod_acl %s mode 0x%x %s%s\n",
+ syslog(audit_syslog_priority(fsp->conn), "fchmod_acl %s mode 0x%x %s%s\n",
fsp->fsp_name, mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
return result;
+}
+
+NTSTATUS init_module(SMB_MODULE_TYPES types)
+{
+ NTSTATUS nt_status = NT_STATUS_OK;
+ if (types & MODULE_TYPE_VFS) {
+ nt_status = smb_register_vfs("audit", vfs_audit_init, SMB_VFS_INTERFACE_VERSION);
+ if (NT_STATUS_IS_ERR(nt_status)) {
+ return nt_status;
+ }
+ }
+
+ return nt_status;
}
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/modules/vfs_netatalk.c HEAD-modules/source/modules/vfs_netatalk.c
--- HEAD/source/modules/vfs_netatalk.c Wed Nov 13 14:10:29 2002
+++ HEAD-modules/source/modules/vfs_netatalk.c Tue Dec 10 15:39:12 2002
@@ -411,20 +411,21 @@ static vfs_op_tuple atalk_ops[] = {
};
/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */
-vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
- struct smb_vfs_handle_struct *vfs_handle)
+vfs_op_tuple *vfs_nettalk_init(struct connection_struct *conn, struct vfs_ops *def_vfs_ops, const char *param)
{
- *vfs_version = SMB_VFS_INTERFACE_VERSION;
- memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops));
-
- atalk_handle = vfs_handle;
-
DEBUG(3, ("ATALK: vfs module loaded\n"));
return atalk_ops;
}
-/* VFS finalization function. */
-void vfs_done(connection_struct *conn)
+NTSTATUS init_module(SMB_MODULE_TYPES types)
{
- DEBUG(3, ("ATALK: vfs module unloaded\n"));
+ NTSTATUS nt_status = NT_STATUS_OK;
+ if (types & MODULE_TYPE_VFS) {
+ nt_status = smb_register_vfs("nettalk", vfs_nettalk_init, SMB_VFS_INTERFACE_VERSION);
+ if (NT_STATUS_IS_ERR(nt_status)) {
+ return nt_status;
+ }
+ }
+
+ return nt_status;
}
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/modules/vfs_recycle.c HEAD-modules/source/modules/vfs_recycle.c
--- HEAD/source/modules/vfs_recycle.c Mon Dec 9 16:53:06 2002
+++ HEAD-modules/source/modules/vfs_recycle.c Tue Dec 10 15:28:53 2002
@@ -6,6 +6,7 @@
* Copyright (C) 2002, Alexander Bokovoy - cascaded VFS adoption,
* Copyright (C) 2002, Juergen Hasch - added some options.
* Copyright (C) 2002, Simo Sorce
+ * Copyright (C) 2002, Stefan (metze) Metzmacher
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,43 +34,19 @@ static int vfs_recycle_debug_level = DBG
static const char *delimiter = "|"; /* delimiter for options */
-/* One per connection */
-typedef struct recycle_bin_struct
-{
- TALLOC_CTX *mem_ctx;
- char *repository; /* name of the recycle bin directory */
- BOOL keep_dir_tree; /* keep directory structure of deleted file in recycle bin */
- BOOL versions; /* create versions of deleted files with identical name */
- BOOL touch; /* touch access date of deleted file */
- char *exclude; /* which files to exclude */
- char *exclude_dir; /* which directories to exclude */
- char *noversions; /* which files to exclude from versioning */
- SMB_OFF_T maxsize; /* maximum file size to be saved */
-} recycle_bin_struct;
-
-typedef struct recycle_bin_connections {
- int conn;
- recycle_bin_struct *data;
- struct recycle_bin_connections *next;
-} recycle_bin_connections;
-
-typedef struct recycle_bin_private_data {
+typedef struct _recycle_bin_connection {
TALLOC_CTX *mem_ctx;
- recycle_bin_connections *conns;
-} recycle_bin_private_data;
-
-struct smb_vfs_handle_struct *recycle_bin_private_handle;
-
-/* VFS operations */
-static struct vfs_ops default_vfs_ops; /* For passthrough operation */
+ struct _recycle_bin_connection *next,*prev;
+ int snum;
+ const char *param;
+ struct vfs_ops def_vfs_ops;
+} recycle_bin_connection;
static int recycle_connect(struct connection_struct *conn, const char *service, const char *user);
static void recycle_disconnect(struct connection_struct *conn);
static int recycle_unlink(connection_struct *, const char *);
-#define VFS_OP(x) ((void *) x)
-
static vfs_op_tuple recycle_ops[] = {
/* Disk operations */
@@ -82,221 +59,239 @@ static vfs_op_tuple recycle_ops[] = {
{NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
};
-/**
- * VFS initialisation function.
- *
- * @retval initialised vfs_op_tuple array
- **/
-vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
- struct smb_vfs_handle_struct *vfs_handle)
-{
- TALLOC_CTX *mem_ctx = NULL;
- DEBUG(10, ("Initializing VFS module recycle\n"));
- *vfs_version = SMB_VFS_INTERFACE_VERSION;
- memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops));
- vfs_recycle_debug_level = debug_add_class("vfs_recycle_bin");
- if (vfs_recycle_debug_level == -1) {
- vfs_recycle_debug_level = DBGC_VFS;
- DEBUG(0, ("vfs_recycle: Couldn't register custom debugging class!\n"));
- } else {
- DEBUG(0, ("vfs_recycle: Debug class number of 'vfs_recycle': %d\n", vfs_recycle_debug_level));
+static recycle_bin_connection *recycle_bin_connections = NULL;
+
+static BOOL recycle_set_def_vfs_ops(struct connection_struct *conn, struct vfs_ops *def_vfs_ops, const char *param)
+{
+ recycle_bin_connection *data;
+ TALLOC_CTX *mem_ctx;
+
+ for (data = recycle_bin_connections; data; data = data->next) {
+ if (data->snum == SNUM(conn)) {
+ memcpy(&data->def_vfs_ops,def_vfs_ops,sizeof(struct vfs_ops));
+ return True;
+ }
}
- recycle_bin_private_handle = vfs_handle;
- if (!(mem_ctx = talloc_init_named("recycle bin data"))) {
- DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
- return NULL;
+ if ((mem_ctx = talloc_init_named("recycle bin def_vfs_ops"))==NULL) {
+ DEBUG(0,("recycle_set_def_vfs_ops: talloc_init_named failed!\n"));
+ return False;
}
- recycle_bin_private_handle->data = talloc(mem_ctx, sizeof(recycle_bin_private_data));
- if (recycle_bin_private_handle->data == NULL) {
- DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
- return NULL;
+ if ((data = (recycle_bin_connection *)talloc(mem_ctx,sizeof(recycle_bin_connection)))==NULL) {
+ DEBUG(0,("recycle_set_def_vfs_ops: talloc failed!\n"));
+ return False;
}
- ((recycle_bin_private_data *)(recycle_bin_private_handle->data))->mem_ctx = mem_ctx;
- ((recycle_bin_private_data *)(recycle_bin_private_handle->data))->conns = NULL;
- return recycle_ops;
+ data->mem_ctx = mem_ctx;
+ data->snum = SNUM(conn);
+ memcpy(&data->def_vfs_ops,def_vfs_ops,sizeof(struct vfs_ops));
+ data->param = talloc_strdup(data->mem_ctx,param);
+
+ DLIST_ADD(recycle_bin_connections,data);
+
+ return True;
}
-/**
- * VFS finalization function.
- *
- **/
-void vfs_done(void)
+static struct vfs_ops *recycle_get_def_vfs_ops(struct connection_struct *conn)
{
- recycle_bin_private_data *recdata;
- recycle_bin_connections *recconn;
-
- DEBUG(10, ("Unloading/Cleaning VFS module recycle bin\n"));
-
- if (recycle_bin_private_handle)
- recdata = (recycle_bin_private_data *)(recycle_bin_private_handle->data);
- else {
- DEBUG(0, ("Recycle bin not initialized!\n"));
- return;
+ recycle_bin_connection *data;
+ for (data = recycle_bin_connections; data; data = data->next) {
+ if (data->snum == SNUM(conn)) {
+ return &data->def_vfs_ops;
+ }
}
+ return NULL;
+}
- if (recdata) {
- if (recdata->conns) {
- recconn = recdata->conns;
- while (recconn) {
- talloc_destroy(recconn->data->mem_ctx);
- recconn = recconn->next;
- }
+static const char *recycle_get_param(struct connection_struct *conn)
+{
+ recycle_bin_connection *data;
+ for (data = recycle_bin_connections; data; data = data->next) {
+ if (data->snum == SNUM(conn)) {
+ return data->param;
}
- if (recdata->mem_ctx) {
- talloc_destroy(recdata->mem_ctx);
+ }
+ return NULL;
+}
+
+static BOOL recycle_del_def_vfs_ops(struct connection_struct *conn)
+{
+ recycle_bin_connection *data;
+ for (data = recycle_bin_connections; data; data = data->next) {
+ if (data->snum == SNUM(conn)) {
+ DLIST_REMOVE(recycle_bin_connections,data);
+ talloc_destroy(data->mem_ctx);
+ return True;
}
- recdata = NULL;
}
+ return False;
}
-static int recycle_connect(struct connection_struct *conn, const char *service, const char *user)
+static const char *recycle_repository(struct connection_struct *conn)
{
- TALLOC_CTX *ctx = NULL;
- recycle_bin_struct *recbin;
- recycle_bin_connections *recconn;
- recycle_bin_connections *recconnbase;
- recycle_bin_private_data *recdata;
- char *tmp_str;
+ char *tmp_str = NULL;
+ const char *tmp_param = recycle_get_param(conn);
+
+ tmp_str = lp_parm_string(SNUM(conn), tmp_param?tmp_param:"vfs_recycle_bin", "repository",".recycle");
- DEBUG(10, ("Called for service %s (%d) as user %s\n", service, SNUM(conn), user));
+ DEBUG(10, ("vfs_recycle_bin: %s:repository = %s\n", tmp_param?tmp_param:"",tmp_str));
+
+ return tmp_str;
+}
- if (recycle_bin_private_handle)
- recdata = (recycle_bin_private_data *)(recycle_bin_private_handle->data);
- else {
- DEBUG(0, ("Recycle bin not initialized!\n"));
- return -1;
- }
+static BOOL recycle_keep_dir_tree(struct connection_struct *conn)
+{
+ BOOL ret;
+ const char *tmp_param = recycle_get_param(conn);
+
+ ret = lp_parm_bool(SNUM(conn), tmp_param?tmp_param:"vfs_recycle_bin", "keeptree",False);
+
+ DEBUG(10, ("vfs_recycle_bin: %s:keeptree = %s\n", tmp_param?tmp_param:"",ret?"True":"False"));
+
+ return ret;
+}
+
+static BOOL recycle_versions(struct connection_struct *conn)
+{
+ BOOL ret;
+ const char *tmp_param = recycle_get_param(conn);
+
+ ret = lp_parm_bool(SNUM(conn), tmp_param?tmp_param:"vfs_recycle_bin", "versions",False);
+
+ DEBUG(10, ("vfs_recycle_bin: %s:versions = %s\n", tmp_param?tmp_param:"",ret?"True":"False"));
+
+ return ret;
+}
+
+static BOOL recycle_touch(struct connection_struct *conn)
+{
+ BOOL ret;
+ const char *tmp_param = recycle_get_param(conn);
+
+ ret = lp_parm_bool(SNUM(conn), tmp_param?tmp_param:"vfs_recycle_bin", "touch",False);
- if (!(ctx = talloc_init_named("recycle bin connection"))) {
- DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
- return -1;
- }
-
- recbin = talloc(ctx, sizeof(recycle_bin_struct));
- if (recbin == NULL) {
- DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
- return -1;
- }
- recbin->mem_ctx = ctx;
-
- /* Set defaults */
- recbin->repository = talloc_strdup(recbin->mem_ctx, ".recycle");
- ALLOC_CHECK(recbin->repository, error);
- recbin->keep_dir_tree = False;
- recbin->versions = False;
- recbin->touch = False;
- recbin->exclude = "";
- recbin->exclude_dir = "";
- recbin->noversions = "";
- recbin->maxsize = 0;
-
- /* parse configuration options */
- if ((tmp_str = lp_parm_string(SNUM(conn), "vfs_recycle_bin", "repository")) != NULL) {
- recbin->repository = talloc_sub_conn(recbin->mem_ctx, conn, tmp_str);
- ALLOC_CHECK(recbin->repository, error);
- trim_string(recbin->repository, "/", "/");
- DEBUG(5, ("recycle.bin: repository = %s\n", recbin->repository));
- }
-
- recbin->keep_dir_tree = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "keeptree");
- DEBUG(5, ("recycle.bin: keeptree = %d\n", recbin->keep_dir_tree));
-
- recbin->versions = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "versions");
- DEBUG(5, ("recycle.bin: versions = %d\n", recbin->versions));
-
- recbin->touch = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "touch");
- DEBUG(5, ("recycle.bin: touch = %d\n", recbin->touch));
-
- recbin->maxsize = lp_parm_ulong(SNUM(conn), "vfs_recycle_bin", "maxsize");
- if (recbin->maxsize == 0) {
- recbin->maxsize = -1;
- DEBUG(5, ("recycle.bin: maxsize = -infinite-\n"));
+ DEBUG(10, ("vfs_recycle_bin: %s:touch = %s\n", tmp_param?tmp_param:"",ret?"True":"False"));
+
+ return ret;
+}
+
+static const char **recycle_exclude(struct connection_struct *conn)
+{
+ const char **tmp_lp;
+ const char *tmp_param = recycle_get_param(conn);
+
+ tmp_lp = lp_parm_string_list(SNUM(conn), tmp_param?tmp_param:"vfs_recycle_bin", "exclude",delimiter,NULL);
+
+ DEBUG(10, ("vfs_recycle_bin: %s:exclude = %s\n", tmp_param?tmp_param:"",tmp_lp?*tmp_lp:""));
+
+ return tmp_lp;
+}
+
+static const char **recycle_exclude_dir(struct connection_struct *conn)
+{
+ const char **tmp_lp;
+ const char *tmp_param = recycle_get_param(conn);
+
+ tmp_lp = lp_parm_string_list(SNUM(conn), tmp_param?tmp_param:"vfs_recycle_bin", "exclude_dir",delimiter,NULL);
+
+ DEBUG(10, ("vfs_recycle_bin: %s:exclude_dir = %s\n", tmp_param?tmp_param:"",tmp_lp?*tmp_lp:""));
+
+ return tmp_lp;
+}
+
+static const char **recycle_noversions(struct connection_struct *conn)
+{
+ const char **tmp_lp;
+ const char *tmp_param = recycle_get_param(conn);
+
+ tmp_lp = lp_parm_string_list(SNUM(conn), tmp_param?tmp_param:"vfs_recycle_bin", "noversions",delimiter,NULL);
+
+ DEBUG(10, ("vfs_recycle_bin: %s:noversions = %s\n", tmp_param?tmp_param:"",tmp_lp?*tmp_lp:""));
+
+ return tmp_lp;
+}
+
+static int recycle_maxsize(struct connection_struct *conn)
+{
+ int maxsize;
+ const char *tmp_param = recycle_get_param(conn);
+
+ maxsize = lp_parm_int(SNUM(conn), tmp_param?tmp_param:"vfs_recycle_bin", "maxsize",0);
+
+ DEBUG(10, ("vfs_recycle_bin: %s:maxsize = %d\n", tmp_param?tmp_param:"",maxsize));
+
+ return maxsize;
+}
+
+/**
+ * VFS initialisation function.
+ *
+ * @retval initialised vfs_op_tuple array
+ **/
+
+vfs_op_tuple *vfs_recycle_init(struct connection_struct *conn, struct vfs_ops *def_vfs_ops, const char *param)
+{
+ DEBUG(10, ("Initializing VFS module recycle\n"));
+
+ vfs_recycle_debug_level = debug_add_class("vfs_recycle_bin");
+ if (vfs_recycle_debug_level == -1) {
+ vfs_recycle_debug_level = DBGC_VFS;
+ DEBUG(0, ("vfs_recycle: Couldn't register custom debugging class!\n"));
} else {
- DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize));
+ DEBUG(10, ("vfs_recycle: Debug class number of 'vfs_recycle': %d\n", vfs_recycle_debug_level));
}
- if ((tmp_str = lp_parm_string(SNUM(conn), "vfs_recycle_bin", "exclude")) != NULL) {
- recbin->exclude = talloc_strdup(recbin->mem_ctx, tmp_str);
- ALLOC_CHECK(recbin->exclude, error);
- DEBUG(5, ("recycle.bin: exclude = %s\n", recbin->exclude));
- }
- if ((tmp_str = lp_parm_string(SNUM(conn), "vfs_recycle_bin", "exclude_dir")) != NULL) {
- recbin->exclude_dir = talloc_strdup(recbin->mem_ctx, tmp_str);
- ALLOC_CHECK(recbin->exclude_dir, error);
- DEBUG(5, ("recycle.bin: exclude_dir = %s\n", recbin->exclude_dir));
- }
- if ((tmp_str = lp_parm_string(SNUM(conn), "vfs_recycle_bin", "noversions")) != NULL) {
- recbin->noversions = talloc_strdup(recbin->mem_ctx, tmp_str);
- ALLOC_CHECK(recbin->noversions, error);
- DEBUG(5, ("recycle.bin: noversions = %s\n", recbin->noversions));
- }
-
- recconn = talloc(recdata->mem_ctx, sizeof(recycle_bin_connections));
- if (recconn == NULL) {
- DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
- goto error;
- }
- recconn->conn = SNUM(conn);
- recconn->data = recbin;
- recconn->next = NULL;
- if (recdata->conns) {
- recconnbase = recdata->conns;
- while (recconnbase->next != NULL) recconnbase = recconnbase->next;
- recconnbase->next = recconn;
- } else {
- recdata->conns = recconn;
+ if (!recycle_set_def_vfs_ops(conn, def_vfs_ops, param)) {
+ DEBUG(0,("vfs_recycle: can't add default ops to global list!\n"));
+ return NULL;
}
- return default_vfs_ops.connect(conn, service, user);
-error:
- talloc_destroy(ctx);
- return -1;
+ return recycle_ops;
}
-static void recycle_disconnect(struct connection_struct *conn)
+static int recycle_connect(struct connection_struct *conn, const char *service, const char *user)
{
- recycle_bin_private_data *recdata;
- recycle_bin_connections *recconn;
+ struct vfs_ops *default_vfs_ops;
+
+ DEBUG(10, ("Called for service %s (%d) as user %s\n", service, SNUM(conn), user));
+
+ if ((default_vfs_ops = recycle_get_def_vfs_ops(conn))==NULL) {
+ DEBUG(0,("can't get default ops for service '%s' [%d]\n",lp_servicename(SNUM(conn)),SNUM(conn)));
+ return (-1);
+ }
+ return default_vfs_ops->connect(conn, service, user);
+}
+
+static void recycle_disconnect(struct connection_struct *conn)
+{
+ struct vfs_ops *default_vfs_ops;
+
DEBUG(10, ("Disconnecting VFS module recycle bin\n"));
- if (recycle_bin_private_handle)
- recdata = (recycle_bin_private_data *)(recycle_bin_private_handle->data);
- else {
- DEBUG(0, ("Recycle bin not initialized!\n"));
+ if ((default_vfs_ops = recycle_get_def_vfs_ops(conn))==NULL) {
+ DEBUG(0,("can't get default ops for service '%s' [%d]\n",lp_servicename(SNUM(conn)),SNUM(conn)));
return;
}
- if (recdata) {
- if (recdata->conns) {
- if (recdata->conns->conn == SNUM(conn)) {
- talloc_destroy(recdata->conns->data->mem_ctx);
- recdata->conns = recdata->conns->next;
- } else {
- recconn = recdata->conns;
- while (recconn->next) {
- if (recconn->next->conn == SNUM(conn)) {
- talloc_destroy(recconn->next->data->mem_ctx);
- recconn->next = recconn->next->next;
- break;
- }
- recconn = recconn->next;
- }
- }
- }
- }
- default_vfs_ops.disconnect(conn);
+ default_vfs_ops->disconnect(conn);
+
+ recycle_del_def_vfs_ops(conn);
}
static BOOL recycle_directory_exist(connection_struct *conn, const char *dname)
{
SMB_STRUCT_STAT st;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = recycle_get_def_vfs_ops(conn))==NULL) {
+ DEBUG(0,("can't get default ops for service '%s' [%d]\n",lp_servicename(SNUM(conn)),SNUM(conn)));
+ return False;
+ }
- if (default_vfs_ops.stat(conn, dname, &st) == 0) {
+ if (default_vfs_ops->stat(conn, dname, &st) == 0) {
if (S_ISDIR(st.st_mode)) {
return True;
}
@@ -308,8 +303,14 @@ static BOOL recycle_directory_exist(conn
static BOOL recycle_file_exist(connection_struct *conn, const char *fname)
{
SMB_STRUCT_STAT st;
+ struct vfs_ops *default_vfs_ops;
- if (default_vfs_ops.stat(conn, fname, &st) == 0) {
+ if ((default_vfs_ops = recycle_get_def_vfs_ops(conn))==NULL) {
+ DEBUG(0,("can't get default ops for service '%s' [%d]\n",lp_servicename(SNUM(conn)),SNUM(conn)));
+ return False;
+ }
+
+ if (default_vfs_ops->stat(conn, fname, &st) == 0) {
if (S_ISREG(st.st_mode)) {
return True;
}
@@ -327,7 +328,14 @@ static BOOL recycle_file_exist(connectio
static SMB_OFF_T recycle_get_file_size(connection_struct *conn, const char *fname)
{
SMB_STRUCT_STAT st;
- if (default_vfs_ops.stat(conn, fname, &st) != 0) {
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = recycle_get_def_vfs_ops(conn))==NULL) {
+ DEBUG(0,("can't get default ops for service '%s' [%d]\n",lp_servicename(SNUM(conn)),SNUM(conn)));
+ return (SMB_OFF_T)0;
+ }
+
+ if (default_vfs_ops->stat(conn, fname, &st) != 0) {
DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno)));
return (SMB_OFF_T)0;
}
@@ -349,6 +357,12 @@ static BOOL recycle_create_dir(connectio
char *token;
char *tok_str;
BOOL ret = False;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = recycle_get_def_vfs_ops(conn))==NULL) {
+ DEBUG(0,("can't get default ops for service '%s' [%d]\n",lp_servicename(SNUM(conn)),SNUM(conn)));
+ return False;
+ }
mode = S_IREAD | S_IWRITE | S_IEXEC;
@@ -368,7 +382,7 @@ static BOOL recycle_create_dir(connectio
DEBUG(10, ("recycle.bin: dir %s already exists\n", new_dir));
else {
DEBUG(5, ("recycle.bin: creating new dir %s\n", new_dir));
- if (default_vfs_ops.mkdir(conn, new_dir, mode) != 0) {
+ if (default_vfs_ops->mkdir(conn, new_dir, mode) != 0) {
DEBUG(1,("recycle.bin: mkdir failed for %s with error: %s\n", new_dir, strerror(errno)));
ret = False;
goto done;
@@ -390,30 +404,21 @@ done:
* @param needle string to be matched exactly to haystack
* @return True if found
**/
-static BOOL checkparam(const char *haystack, const char *needle)
+static BOOL checkparam(const char **haystack_list, const char *needle)
{
- char *token;
- char *tok_str;
- char *tmp_str;
- BOOL ret = False;
+ int i;
- if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) {
+ if (haystack_list == NULL || strlen(*haystack_list) == 0 || needle == NULL || strlen(needle) == 0) {
return False;
}
- tmp_str = strdup(haystack);
- ALLOC_CHECK(tmp_str, done);
- token = tok_str = tmp_str;
-
- for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) {
- if(strcmp(token, needle) == 0) {
- ret = True;
- goto done;
+ for(i=0; haystack_list[i] ; i++) {
+ if(strequal(haystack_list[i], needle)) {
+ return True;
}
}
-done:
- SAFE_FREE(tmp_str);
- return ret;
+
+ return False;
}
/**
@@ -422,42 +427,39 @@ done:
* @param needle string to be matched exectly to haystack including pattern matching
* @return True if found
**/
-static BOOL matchparam(const char *haystack, const char *needle)
+static BOOL matchparam(const char **haystack_list, const char *needle)
{
- char *token;
- char *tok_str;
- char *tmp_str;
- BOOL ret = False;
+ int i;
- if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) {
+ if (haystack_list == NULL || strlen(*haystack_list) == 0 || needle == NULL || strlen(needle) == 0) {
return False;
}
- tmp_str = strdup(haystack);
- ALLOC_CHECK(tmp_str, done);
- token = tok_str = tmp_str;
-
- for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) {
- if (!unix_wild_match(token, needle)) {
- ret = True;
- goto done;
+ for(i=0; haystack_list[i] ; i++) {
+ if(!unix_wild_match((char *)haystack_list[i], (char *)needle)) {
+ return True;
}
}
-done:
- SAFE_FREE(tmp_str);
- return ret;
+
+ return False;
}
/**
* Touch access date
**/
-static void recycle_touch(connection_struct *conn, const char *fname)
+static void recycle_do_touch(struct connection_struct *conn, const char *fname)
{
SMB_STRUCT_STAT st;
struct utimbuf tb;
time_t currtime;
+ struct vfs_ops *default_vfs_ops;
- if (default_vfs_ops.stat(conn, fname, &st) != 0) {
+ if ((default_vfs_ops = recycle_get_def_vfs_ops(conn))==NULL) {
+ DEBUG(0,("can't get default ops for service '%s' [%d]\n",lp_servicename(SNUM(conn)),SNUM(conn)));
+ return;
+ }
+
+ if (default_vfs_ops->stat(conn, fname, &st) != 0) {
DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno)));
return;
}
@@ -465,7 +467,7 @@ static void recycle_touch(connection_str
tb.actime = currtime;
tb.modtime = st.st_mtime;
- if (default_vfs_ops.utime(conn, fname, &tb) == -1 )
+ if (default_vfs_ops->utime(conn, fname, &tb) == -1 )
DEBUG(0, ("recycle.bin: touching %s failed, reason = %s\n", fname, strerror(errno)));
}
@@ -474,52 +476,43 @@ static void recycle_touch(connection_str
**/
static int recycle_unlink(connection_struct *conn, const char *inname)
{
- recycle_bin_private_data *recdata;
- recycle_bin_connections *recconn;
- recycle_bin_struct *recbin;
char *file_name = NULL;
char *path_name = NULL;
char *temp_name = NULL;
char *final_name = NULL;
char *base;
+ char *repository = NULL;
int i;
+ int maxsize;
/* SMB_BIG_UINT dfree, dsize, bsize; */
SMB_OFF_T file_size; /* space_avail; */
BOOL exist;
int rc = -1;
+ struct vfs_ops *default_vfs_ops;
+
+ if ((default_vfs_ops = recycle_get_def_vfs_ops(conn))==NULL) {
+ DEBUG(0,("can't get default ops for service '%s' [%d]\n",lp_servicename(SNUM(conn)),SNUM(conn)));
+ return (-1);
+ }
file_name = strdup(inname);
ALLOC_CHECK(file_name, done);
- recbin = NULL;
- if (recycle_bin_private_handle) {
- recdata = (recycle_bin_private_data *)(recycle_bin_private_handle->data);
- if (recdata) {
- if (recdata->conns) {
- recconn = recdata->conns;
- while (recconn && recconn->conn != SNUM(conn)) recconn = recconn->next;
- if (recconn != NULL) {
- recbin = recconn->data;
- }
- }
- }
- }
- if (recbin == NULL) {
- DEBUG(0, ("Recycle bin not initialized!\n"));
- rc = default_vfs_ops.unlink(conn, file_name);
- goto done;
- }
-
- if(!recbin->repository || *(recbin->repository) == '\0') {
+ repository = alloc_sub_conn(conn, (char *)recycle_repository(conn));
+ ALLOC_CHECK(repository, done);
+ /* shouldn't we allow absolute path names here? --metze */
+ trim_string(repository, "/", "/");
+
+ if(!repository || *(repository) == '\0') {
DEBUG(3, ("Recycle path not set, purging %s...\n", file_name));
- rc = default_vfs_ops.unlink(conn, file_name);
+ rc = default_vfs_ops->unlink(conn, file_name);
goto done;
}
/* we don't recycle the recycle bin... */
- if (strncmp(file_name, recbin->repository, strlen(recbin->repository)) == 0) {
+ if (strncmp(file_name, repository, strlen(repository)) == 0) {
DEBUG(3, ("File is within recycling bin, unlinking ...\n"));
- rc = default_vfs_ops.unlink(conn, file_name);
+ rc = default_vfs_ops->unlink(conn, file_name);
goto done;
}
@@ -529,7 +522,7 @@ static int recycle_unlink(connection_str
*
if(fsize == 0) {
DEBUG(3, ("File %s is empty, purging...\n", file_name));
- rc = default_vfs_ops.unlink(conn,file_name);
+ rc = default_vfs_ops->unlink(conn,file_name);
goto done;
}
*/
@@ -538,20 +531,21 @@ static int recycle_unlink(connection_str
* not greater then maxsize, not the size of the single file, also it is better
* to remove older files
*/
- if(recbin->maxsize > 0 && file_size > recbin->maxsize) {
+ maxsize = recycle_maxsize(conn);
+ if(maxsize > 0 && file_size > maxsize) {
DEBUG(3, ("File %s exceeds maximum recycle size, purging... \n", file_name));
- rc = default_vfs_ops.unlink(conn, file_name);
+ rc = default_vfs_ops->unlink(conn, file_name);
goto done;
}
/* FIXME: this is wrong: moving files with rename does not change the disk space
* allocation
*
- space_avail = default_vfs_ops.disk_free(conn, ".", True, &bsize, &dfree, &dsize) * 1024L;
+ space_avail = default_vfs_ops->disk_free(conn, ".", True, &bsize, &dfree, &dsize) * 1024L;
DEBUG(5, ("space_avail = %Lu, file_size = %Lu\n", space_avail, file_size));
if(space_avail < file_size) {
DEBUG(3, ("Not enough diskspace, purging file %s\n", file_name));
- rc = default_vfs_ops.unlink(conn, file_name);
+ rc = default_vfs_ops->unlink(conn, file_name);
goto done;
}
*/
@@ -571,13 +565,13 @@ static int recycle_unlink(connection_str
base++;
}
- DEBUG(10, ("recycle.bin: fname = %s\n", file_name)); /* original filename with path */
- DEBUG(10, ("recycle.bin: fpath = %s\n", path_name)); /* original path */
- DEBUG(10, ("recycle.bin: base = %s\n", base)); /* filename without path */
-
- if (matchparam(recbin->exclude, base)) {
- DEBUG(3, ("recycle.bin: file %s is excluded \n", base));
- rc = default_vfs_ops.unlink(conn, file_name);
+ DEBUG(10, ("recycle_bin: fname = %s\n", file_name)); /* original filename with path */
+ DEBUG(10, ("recycle_bin: fpath = %s\n", path_name)); /* original path */
+ DEBUG(10, ("recycle_bin: base = %s\n", base)); /* filename without path */
+
+ if (matchparam(recycle_exclude(conn), base)) {
+ DEBUG(3, ("recycle_bin: file %s is excluded \n", base));
+ rc = default_vfs_ops->unlink(conn, file_name);
goto done;
}
@@ -585,30 +579,30 @@ static int recycle_unlink(connection_str
* we shoud check for every level 1, 1/2, 1/2/3, 1/2/3/4 ....
* ---simo
*/
- if (checkparam(recbin->exclude_dir, path_name)) {
- DEBUG(3, ("recycle.bin: directory %s is excluded \n", path_name));
- rc = default_vfs_ops.unlink(conn, file_name);
+ if (checkparam(recycle_exclude_dir(conn), path_name)) {
+ DEBUG(3, ("recycle_bin: directory %s is excluded \n", path_name));
+ rc = default_vfs_ops->unlink(conn, file_name);
goto done;
}
temp_name = (char *)malloc(PATH_MAX);
ALLOC_CHECK(temp_name, done);
- safe_strcpy(temp_name, recbin->repository, PATH_MAX);
+ safe_strcpy(temp_name, repository, PATH_MAX);
/* see if we need to recreate the original directory structure in the recycle bin */
- if (recbin->keep_dir_tree == True) {
+ if (recycle_keep_dir_tree(conn) == True) {
safe_strcat(temp_name, "/", PATH_MAX);
safe_strcat(temp_name, path_name, PATH_MAX);
}
exist = recycle_directory_exist(conn, temp_name);
if (exist) {
- DEBUG(10, ("recycle.bin: Directory already exists\n"));
+ DEBUG(10, ("recycle_bin: Directory already exists\n"));
} else {
- DEBUG(10, ("recycle.bin: Creating directory %s\n", temp_name));
+ DEBUG(10, ("recycle_bin: Creating directory %s\n", temp_name));
if (recycle_create_dir(conn, temp_name) == False) {
DEBUG(3, ("Could not create directory, purging %s...\n", file_name));
- rc = default_vfs_ops.unlink(conn, file_name);
+ rc = default_vfs_ops->unlink(conn, file_name);
goto done;
}
}
@@ -620,10 +614,10 @@ static int recycle_unlink(connection_str
/* check if we should delete file from recycle bin */
if (recycle_file_exist(conn, final_name)) {
- if (recbin->versions == False || matchparam(recbin->noversions, base) == True) {
+ if (recycle_versions(conn) == False || matchparam(recycle_noversions(conn), base) == True) {
DEBUG(3, ("recycle.bin: Removing old file %s from recycle bin\n", final_name));
- if (default_vfs_ops.unlink(conn, final_name) != 0) {
- DEBUG(1, ("recycle.bin: Error deleting old file: %s\n", strerror(errno)));
+ if (default_vfs_ops->unlink(conn, final_name) != 0) {
+ DEBUG(1, ("recycle_bin: Error deleting old file: %s\n", strerror(errno)));
}
}
}
@@ -635,21 +629,35 @@ static int recycle_unlink(connection_str
}
DEBUG(10, ("recycle.bin: Moving %s to %s\n", file_name, final_name));
- rc = default_vfs_ops.rename(conn, file_name, final_name);
+ rc = default_vfs_ops->rename(conn, file_name, final_name);
if (rc != 0) {
- DEBUG(3, ("recycle.bin: Move error %d (%s), purging file %s (%s)\n", errno, strerror(errno), file_name, final_name));
- rc = default_vfs_ops.unlink(conn, file_name);
+ DEBUG(3, ("recycle_bin: Move error %d (%s), purging file %s (%s)\n", errno, strerror(errno), file_name, final_name));
+ rc = default_vfs_ops->unlink(conn, file_name);
goto done;
}
/* touch access date of moved file */
- if (recbin->touch == True )
- recycle_touch(conn, final_name);
+ if (recycle_touch(conn) == True )
+ recycle_do_touch(conn, final_name);
done:
SAFE_FREE(file_name);
SAFE_FREE(path_name);
SAFE_FREE(temp_name);
SAFE_FREE(final_name);
+ SAFE_FREE(repository);
return rc;
}
+
+NTSTATUS init_module(SMB_MODULE_TYPES types)
+{
+ NTSTATUS nt_status;
+ if (types & MODULE_TYPE_VFS) {
+ nt_status = smb_register_vfs("recycle_bin", vfs_recycle_init, SMB_VFS_INTERFACE_VERSION);
+ if (NT_STATUS_IS_ERR(nt_status)) {
+ return nt_status;
+ }
+ }
+
+ return nt_status;
+}
\ No newline at end of file
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/modules/xml.c HEAD-modules/source/modules/xml.c
--- HEAD/source/modules/xml.c Fri Nov 15 18:01:23 2002
+++ HEAD-modules/source/modules/xml.c Fri Dec 6 10:14:20 2002
@@ -564,12 +564,15 @@ NTSTATUS xmlsam_init(PDB_CONTEXT * pdb_c
return NT_STATUS_OK;
}
-int init_module(void);
-
-int init_module()
+NTSTATUS init_module(SMB_MODULE_TYPES types)
{
- if(smb_register_passdb("xml", xmlsam_init, PASSDB_INTERFACE_VERSION))
- return 0;
-
- return 1;
+ if (types & MODULE_TYPE_PDB) {
+ if (smb_register_passdb("xml", xmlsam_init, PASSDB_INTERFACE_VERSION)) {
+ return NT_STATUS_OK;
+ } else {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ }
+
+ return NT_STATUS_OK;
}
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/nmbd/nmbd.c HEAD-modules/source/nmbd/nmbd.c
--- HEAD/source/nmbd/nmbd.c Wed Nov 13 19:52:36 2002
+++ HEAD-modules/source/nmbd/nmbd.c Tue Dec 10 16:13:57 2002
@@ -631,6 +631,9 @@ static BOOL open_sockets(BOOL isdaemon,
if ( !reload_nmbd_services(False) )
return(-1);
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPES_NMBD);
+
if(!init_names())
return -1;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/nsswitch/winbindd.c HEAD-modules/source/nsswitch/winbindd.c
--- HEAD/source/nsswitch/winbindd.c Mon Dec 2 15:46:20 2002
+++ HEAD-modules/source/nsswitch/winbindd.c Tue Dec 10 16:14:38 2002
@@ -828,6 +828,9 @@ static void usage(void)
exit(1);
}
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPES_WINBINDD);
+
/* Setup names. */
if (!init_names())
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/param/loadparm.c HEAD-modules/source/param/loadparm.c
--- HEAD/source/param/loadparm.c Mon Dec 9 16:53:07 2002
+++ HEAD-modules/source/param/loadparm.c Tue Dec 10 14:12:17 2002
@@ -84,8 +84,11 @@ static BOOL defaults_saved = False;
typedef struct _param_opt_struct param_opt_struct;
struct _param_opt_struct {
param_opt_struct *prev, *next;
+ TALLOC_CTX *mem_ctx;
char *key;
char *value;
+ char **list;
+ char *list_sep;
};
/*
@@ -119,7 +122,6 @@ typedef struct
char *szPrivateDir;
char **szPassdbBackend;
char **szSamBackend;
- char **szModules;
char *szPasswordServer;
char *szSocketOptions;
char *szRealm;
@@ -324,9 +326,10 @@ typedef struct
char **printer_admin;
char *volume;
char *fstype;
- char *szVfsObjectFile;
+ char **szVfsObjects;
char *szVfsOptions;
- char *szVfsPath;
+ char *szModulesPath;
+ char **szModules;
int iMinPrintSpace;
int iMaxPrintJobs;
int iWriteCacheSize;
@@ -445,7 +448,8 @@ static service sDefault = {
NULL, /* fstype */
NULL, /* vfs object */
NULL, /* vfs options */
- NULL, /* vfs path */
+ NULL, /* modules path */
+ NULL, /* modules */
0, /* iMinPrintSpace */
1000, /* iMaxPrintJobs */
0, /* iWriteCacheSize */
@@ -534,7 +538,6 @@ static int default_server_announce;
/* prototypes for the special type handlers */
static BOOL handle_include(char *pszParmValue, char **ptr);
static BOOL handle_copy(char *pszParmValue, char **ptr);
-static BOOL handle_vfs_object(char *pszParmValue, char **ptr);
static BOOL handle_source_env(char *pszParmValue, char **ptr);
static BOOL handle_netbios_name(char *pszParmValue, char **ptr);
static BOOL handle_winbind_uid(char *pszParmValue, char **ptr);
@@ -808,7 +811,8 @@ static struct parm_struct parm_table[] =
{"allow hosts", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_HIDE},
{"hosts deny", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER},
{"deny hosts", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_HIDE},
- {"modules", P_LIST, P_GLOBAL, &Globals.szModules, NULL, NULL, FLAG_BASIC | FLAG_GLOBAL},
+ {"modules path", P_STRING, P_LOCAL, &sDefault.szModulesPath, NULL, NULL, FLAG_BASIC | FLAG_SHARE| FLAG_GLOBAL | FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"modules", P_LIST, P_LOCAL, &sDefault.szModules, NULL, NULL, FLAG_BASIC | FLAG_SHARE | FLAG_GLOBAL},
{"Logging Options", P_SEP, P_SEPARATOR},
@@ -1083,11 +1087,10 @@ static struct parm_struct parm_table[] =
{"VFS module options", P_SEP, P_SEPARATOR},
- {"vfs object", P_STRING, P_LOCAL, &sDefault.szVfsObjectFile, handle_vfs_object, NULL, FLAG_SHARE},
- {"vfs options", P_STRING, P_LOCAL, &sDefault.szVfsOptions, NULL, NULL, FLAG_SHARE},
- {"vfs path", P_STRING, P_LOCAL, &sDefault.szVfsPath, NULL, NULL, FLAG_SHARE},
-
-
+ {"vfs objects", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_SHARE},
+ {"vfs object", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_HIDE},
+ {"vfs options", P_STRING, P_LOCAL, &sDefault.szVfsOptions, NULL, NULL, FLAG_SHARE | FLAG_DEPRECATED},
+
{"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_SHARE},
{"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
@@ -1241,6 +1244,7 @@ static void init_globals(void)
string_set(parm_table[i].ptr, "");
string_set(&sDefault.fstype, FSTYPE_STRING);
+ string_set(&sDefault.szModulesPath, dyn_LIBDIR);
init_printer_values();
@@ -1394,6 +1398,7 @@ static void init_globals(void)
Globals.ldap_ssl = LDAP_SSL_ON;
Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
+
/* these parameters are set to defaults that are more appropriate
for the increasing samba install base:
@@ -1578,7 +1583,6 @@ static FN_GLOBAL_STRING(lp_announce_vers
FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
FN_GLOBAL_LIST(lp_passdb_backend, &Globals.szPassdbBackend)
FN_GLOBAL_LIST(lp_sam_backend, &Globals.szSamBackend)
-FN_GLOBAL_LIST(lp_modules, &Globals.szModules)
FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
@@ -1732,9 +1736,10 @@ FN_LOCAL_LIST(lp_readlist, readlist)
FN_LOCAL_LIST(lp_writelist, writelist)
FN_LOCAL_LIST(lp_printer_admin, printer_admin)
FN_LOCAL_STRING(lp_fstype, fstype)
-FN_LOCAL_STRING(lp_vfsobj, szVfsObjectFile)
+FN_LOCAL_LIST(lp_vfsobj, szVfsObjects)
FN_LOCAL_STRING(lp_vfs_options, szVfsOptions)
-FN_LOCAL_STRING(lp_vfs_path, szVfsPath)
+FN_LOCAL_STRING(lp_modules_path, szModulesPath)
+FN_LOCAL_LIST(lp_modules, szModules)
static FN_LOCAL_STRING(lp_volume, volume)
FN_LOCAL_STRING(lp_mangled_map, szMangledMap)
FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
@@ -1827,7 +1832,7 @@ static void init_copymap(service * pserv
/* This is a helper function for parametrical options support. */
/* It returns a pointer to parametrical option value if it exists or NULL otherwise */
/* Actual parametrical functions are quite simple */
-static const char *get_parametrics(int lookup_service, const char *type, const char *option)
+static param_opt_struct *get_parametrics(int lookup_service, const char *type, const char *option)
{
char* vfskey;
param_opt_struct *data;
@@ -1841,26 +1846,25 @@ static const char *get_parametrics(int l
while (data) {
if (strcmp(data->key, vfskey) == 0) {
string_free(&vfskey);
- return data->value;
+ return data;
}
data = data->next;
}
-
if (lookup_service >= 0) {
/* Try to fetch the same option but from globals */
/* but only if we are not already working with Globals */
data = Globals.param_opt;
while (data) {
- if (strcmp(data->key, vfskey) == 0) {
- string_free(&vfskey);
- return data->value;
+ if (strcmp(data->key, vfskey) == 0) {
+ string_free(&vfskey);
+ return data;
}
data = data->next;
}
}
-
- string_free(&vfskey);
+ string_free(&vfskey);
+
return NULL;
}
@@ -1936,87 +1940,101 @@ static int lp_enum(const char *s,const s
/* Return parametric option from a given service. Type is a part of option before ':' */
/* Parametric option has following syntax: 'Type: option = value' */
-/* Returned value is allocated in 'lp_talloc' context */
-char *lp_parm_string(int lookup_service, const char *type, const char *option)
+
+char *lp_parm_string(int lookup_service, const char *type, const char *option, char *def)
{
- const char *value = get_parametrics(lookup_service, type, option);
+ param_opt_struct *data = get_parametrics(lookup_service, type, option);
- if (value)
- return lp_string(value);
-
- return NULL;
+ if (data == NULL)
+ return def;
+
+ return data->value;
}
/* Return parametric option from a given service. Type is a part of option before ':' */
/* Parametric option has following syntax: 'Type: option = value' */
-/* Returned value is allocated in 'lp_talloc' context */
-char **lp_parm_string_list(int lookup_service, const char *type, const char *option,
- const char *separator)
+const char **lp_parm_string_list(int lookup_service, const char *type, const char *option,
+ const char *separator,char **def)
{
- const char *value = get_parametrics(lookup_service, type, option);
-
- if (value)
- return str_list_make(value, separator);
+ param_opt_struct *data = get_parametrics(lookup_service, type, option);
- return NULL;
+ if (data == NULL)
+ return (const char **)def;
+
+ if ((data->list_sep == separator)||
+ (data->list_sep && separator &&
+ strequal(data->list_sep,separator))) {
+ if (data->list==NULL) {
+ data->list = talloc_str_list_make(data->mem_ctx,data->value, separator);
+ if (separator) {
+ data->list_sep = talloc_strdup(data->mem_ctx,separator);
+ }
+ }
+ } else {
+ data->list = talloc_str_list_make(data->mem_ctx,data->value, separator);
+ if (separator) {
+ data->list_sep = talloc_strdup(data->mem_ctx,separator);
+ }
+ }
+
+ return (const char **)data->list;
}
/* Return parametric option from a given service. Type is a part of option before ':' */
/* Parametric option has following syntax: 'Type: option = value' */
-int lp_parm_int(int lookup_service, const char *type, const char *option)
+int lp_parm_int(int lookup_service, const char *type, const char *option, int def)
{
- const char *value = get_parametrics(lookup_service, type, option);
+ param_opt_struct *data = get_parametrics(lookup_service, type, option);
- if (value)
- return lp_int(value);
+ if (data && data->value && *data->value)
+ return lp_int(data->value);
- return (-1);
+ return def;
}
/* Return parametric option from a given service. Type is a part of option before ':' */
/* Parametric option has following syntax: 'Type: option = value' */
-unsigned long lp_parm_ulong(int lookup_service, const char *type, const char *option)
+unsigned long lp_parm_ulong(int lookup_service, const char *type, const char *option, unsigned long def)
{
- const char *value = get_parametrics(lookup_service, type, option);
+ param_opt_struct *data = get_parametrics(lookup_service, type, option);
- if (value)
- return lp_ulong(value);
+ if (data && data->value && *data->value)
+ return lp_ulong(data->value);
- return (0);
+ return def;
}
/* Return parametric option from a given service. Type is a part of option before ':' */
/* Parametric option has following syntax: 'Type: option = value' */
-BOOL lp_parm_bool(int lookup_service, const char *type, const char *option)
+BOOL lp_parm_bool(int lookup_service, const char *type, const char *option, BOOL def)
{
- const char *value = get_parametrics(lookup_service, type, option);
+ param_opt_struct *data = get_parametrics(lookup_service, type, option);
- if (value)
- return lp_bool(value);
+ if (data && data->value && *data->value)
+ return lp_bool(data->value);
- return False;
+ return def;
}
/* Return parametric option from a given service. Type is a part of option before ':' */
/* Parametric option has following syntax: 'Type: option = value' */
int lp_parm_enum(int lookup_service, const char *type, const char *option,
- const struct enum_list *_enum)
+ const struct enum_list *_enum, int def)
{
- const char *value = get_parametrics(lookup_service, type, option);
+ param_opt_struct *data = get_parametrics(lookup_service, type, option);
- if (value)
- return lp_enum(value, _enum);
+ if (data && data->value && *data->value)
+ return lp_enum(data->value, _enum);
- return (-1);
+ return def;
}
-
/***************************************************************************
Initialise a service to the defaults.
***************************************************************************/
@@ -2058,15 +2076,14 @@ static void free_service(service *pservi
(((char *)pservice) +
PTR_DIFF(parm_table[i].ptr, &sDefault)));
}
-
- DEBUG(5,("Freeing parametrics:\n"));
+
data = pservice->param_opt;
+ if (data)
+ DEBUG(5,("Freeing parametrics:\n"));
while (data) {
- DEBUG(5,("[%s = %s]\n", data->key, data->value));
- string_free(&data->key);
- string_free(&data->value);
+ DEBUGADD(5,("[%s = %s]\n", data->key, data->value));
pdata = data->next;
- SAFE_FREE(data);
+ talloc_destroy(data->mem_ctx);
data = pdata;
}
@@ -2095,10 +2112,8 @@ static int add_a_service(const service *
/* They will be added during parsing again */
data = ServicePtrs[i]->param_opt;
while (data) {
- string_free(&data->key);
- string_free(&data->value);
pdata = data->next;
- SAFE_FREE(data);
+ talloc_destroy(data->mem_ctx);
data = pdata;
}
ServicePtrs[i]->param_opt = NULL;
@@ -2347,7 +2362,6 @@ static void copy_service(service * pserv
int i;
BOOL bcopyall = (pcopymapDest == NULL);
param_opt_struct *data, *pdata, *paramo;
- BOOL not_added;
for (i = 0; parm_table[i].label; i++)
if (parm_table[i].ptr && parm_table[i].class == P_LOCAL &&
@@ -2404,24 +2418,33 @@ static void copy_service(service * pserv
data = pserviceSource->param_opt;
while (data) {
- not_added = True;
pdata = pserviceDest->param_opt;
/* Traverse destination */
while (pdata) {
- /* If we already have same option, override it */
+ /* If we already have same option, remove it */
if (strcmp(pdata->key, data->key) == 0) {
- string_free(&pdata->value);
- pdata->value = strdup(data->value);
- not_added = False;
+ DLIST_REMOVE(pserviceDest->param_opt,pdata);
+ talloc_destroy(pdata->mem_ctx);
break;
}
pdata = pdata->next;
}
- if (not_added) {
- paramo = smb_xmalloc(sizeof(param_opt_struct));
- paramo->key = strdup(data->key);
- paramo->value = strdup(data->value);
- DLIST_ADD(pserviceDest->param_opt, paramo);
+ {
+ TALLOC_CTX *mem_ctx = NULL;
+ if ((mem_ctx = talloc_init_named("param options entry"))==NULL) {
+ DEBUG(0,("copy_service: talloc_init_named failed!\n"));
+ return;
+ }
+ if ((paramo=(param_opt_struct *)talloc(mem_ctx,sizeof(param_opt_struct)))==NULL) {
+ DEBUG(0,("copy_service: talloc failed!\n"));
+ return;
+ }
+ paramo->key = talloc_strdup(mem_ctx,data->key);
+ paramo->value = talloc_strdup(mem_ctx,data->value);
+ paramo->list = NULL;
+ paramo->list_sep = NULL;
+ paramo->mem_ctx = mem_ctx;
+ DLIST_ADD(pserviceDest->param_opt, paramo);
}
data = data->next;
}
@@ -2681,22 +2704,6 @@ static BOOL handle_source_env(char *pszP
}
/***************************************************************************
- Handle the interpretation of the vfs object parameter.
-*************************************************************************/
-
-static BOOL handle_vfs_object(char *pszParmValue, char **ptr)
-{
- /* Set string value */
-
- string_set(ptr, pszParmValue);
-
- /* Do any other initialisation required for vfs. Note that
- anything done here may have linking repercussions in nmbd. */
-
- return True;
-}
-
-/***************************************************************************
Handle the include operation.
***************************************************************************/
@@ -3027,39 +3034,51 @@ BOOL lp_do_parameter(int snum, char *psz
pstring vfskey;
char *sep;
param_opt_struct *paramo, *data;
- BOOL not_added;
parmnum = map_parameter(pszParmName);
if (parmnum < 0) {
if ((sep=strchr(pszParmName, ':')) != NULL) {
- *sep = 0;
+ *sep = '\0';
ZERO_STRUCT(vfskey);
pstr_sprintf(vfskey, "%s:", pszParmName);
slen = strlen(vfskey);
safe_strcat(vfskey, sep+1, sizeof(pstring));
trim_string(vfskey+slen, " ", " ");
- not_added = True;
data = (snum < 0) ? Globals.param_opt :
ServicePtrs[snum]->param_opt;
/* Traverse destination */
while (data) {
/* If we already have same option, override it */
if (strcmp(data->key, vfskey) == 0) {
- string_free(&data->value);
- data->value = strdup(pszParmValue);
- not_added = False;
+ if (snum < 0){
+ DLIST_REMOVE(Globals.param_opt,data);
+ } else {
+ DLIST_REMOVE(ServicePtrs[snum]->param_opt,data);
+ }
+ talloc_destroy(data->mem_ctx);
break;
}
data = data->next;
}
- if (not_added) {
- paramo = smb_xmalloc(sizeof(param_opt_struct));
- paramo->key = strdup(vfskey);
- paramo->value = strdup(pszParmValue);
- if (snum < 0) {
+ {
+ TALLOC_CTX *mem_ctx = NULL;
+ if ((mem_ctx = talloc_init_named("param options entry"))==NULL) {
+ DEBUG(0,("lp_do_parameter: talloc_init_named failed!\n"));
+ return False;
+ }
+ if ((paramo=(param_opt_struct *)talloc(mem_ctx,sizeof(param_opt_struct)))==NULL) {
+ DEBUG(0,("lp_do_parameter: talloc failed!\n"));
+ return False;
+ }
+ paramo->key = talloc_strdup(mem_ctx,vfskey);
+ paramo->value = talloc_strdup(mem_ctx,pszParmValue);
+ paramo->list = NULL;
+ paramo->list_sep = NULL;
+ paramo->mem_ctx = mem_ctx;
+ if (snum < 0 ) {
DLIST_ADD(Globals.param_opt, paramo);
- } else {
+ } else {
DLIST_ADD(ServicePtrs[snum]->param_opt, paramo);
}
}
@@ -3826,10 +3845,8 @@ BOOL lp_load(const char *pszFname, BOOL
if (Globals.param_opt != NULL) {
data = Globals.param_opt;
while (data) {
- string_free(&data->key);
- string_free(&data->value);
pdata = data->next;
- SAFE_FREE(data);
+ talloc_destroy(data->mem_ctx);
data = pdata;
}
Globals.param_opt = NULL;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/sam/sam_ads.c HEAD-modules/source/sam/sam_ads.c
--- HEAD/source/sam/sam_ads.c Wed Dec 4 07:18:43 2002
+++ HEAD-modules/source/sam/sam_ads.c Tue Dec 10 09:17:37 2002
@@ -1328,10 +1328,10 @@ NTSTATUS sam_init_ads(SAM_METHODS *sam_m
return NT_STATUS_NO_MEMORY;
}
- sam_ads_state->ads_bind_dn = talloc_strdup(sam_ads_state->mem_ctx, lp_parm_string(NULL,"sam_ads","bind as"));
- sam_ads_state->ads_bind_pw = talloc_strdup(sam_ads_state->mem_ctx, lp_parm_string(NULL,"sam_ads","bind pw"));
+ sam_ads_state->ads_bind_dn = talloc_strdup(sam_ads_state->mem_ctx, lp_parm_string(GLOBAL_SECTION_SNUM,"sam_ads","bind as",""));
+ sam_ads_state->ads_bind_pw = talloc_strdup(sam_ads_state->mem_ctx, lp_parm_string(GLOBAL_SECTION_SNUM,"sam_ads","bind pw",""));
- sam_ads_state->bind_plaintext = strequal(lp_parm_string(NULL, "sam_ads", "plaintext bind"), "yes");
+ sam_ads_state->bind_plaintext = lp_parm_bool(GLOBAL_SECTION_SNUM, "sam_ads", "plaintext bind",True);
if (!sam_ads_state->ads_bind_dn || !sam_ads_state->ads_bind_pw) {
DEBUG(0, ("talloc_strdup() failed for bind dn or password\n"));
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/smbd/conn.c HEAD-modules/source/smbd/conn.c
--- HEAD/source/smbd/conn.c Tue Aug 20 12:48:38 2002
+++ HEAD-modules/source/smbd/conn.c Mon Dec 9 07:36:05 2002
@@ -184,27 +184,6 @@ void conn_clear_vuid_cache(uint16 vuid)
void conn_free(connection_struct *conn)
{
- smb_vfs_handle_struct *handle, *thandle;
- void (*done_fptr)(connection_struct *the_conn);
-
- /* Free vfs_connection_struct */
- handle = conn->vfs_private;
- while(handle) {
- /* Close dlopen() handle */
- done_fptr = (void (*)(connection_struct *))sys_dlsym(handle->handle, "vfs_done");
-
- if (done_fptr == NULL) {
- DEBUG(3, ("No vfs_done() symbol found in module with handle %p, ignoring\n", handle->handle));
- } else {
- done_fptr(conn);
- }
- sys_dlclose(handle->handle);
- DLIST_REMOVE(conn->vfs_private, handle);
- thandle = handle->next;
- SAFE_FREE(handle);
- handle = thandle;
- }
-
DLIST_REMOVE(Connections, conn);
if (conn->ngroups && conn->groups) {
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/smbd/server.c HEAD-modules/source/smbd/server.c
--- HEAD/source/smbd/server.c Tue Nov 26 14:11:04 2002
+++ HEAD-modules/source/smbd/server.c Tue Dec 10 16:05:06 2002
@@ -374,8 +374,8 @@ static BOOL open_sockets_smbd(BOOL is_da
}
/* Load DSO's */
- if(lp_modules())
- smb_load_modules(lp_modules());
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPES_SMBD);
return True;
}
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/smbd/service.c HEAD-modules/source/smbd/service.c
--- HEAD/source/smbd/service.c Thu Nov 21 07:34:44 2002
+++ HEAD-modules/source/smbd/service.c Tue Dec 10 15:59:24 2002
@@ -564,16 +564,7 @@ static connection_struct *make_connectio
}
}
}
- /* Initialise VFS function pointers */
- if (!smbd_vfs_init(conn)) {
- DEBUG(0, ("vfs_init failed for service %s\n", lp_servicename(SNUM(conn))));
- conn_free(conn);
- *status = NT_STATUS_UNSUCCESSFUL;
- return NULL;
- }
-
-/* ROOT Activities: */
/* check number of connections */
if (!claim_connection(conn,
lp_servicename(SNUM(conn)),
@@ -583,7 +574,22 @@ static connection_struct *make_connectio
conn_free(conn);
*status = NT_STATUS_INSUFFICIENT_RESOURCES;
return NULL;
- }
+ }
+
+ /* load per share modules */
+ if (lp_modules(SNUM(conn)))
+ smb_load_modules(lp_modules(SNUM(conn)),conn,MODULE_TYPES_PER_SHARE);
+
+ /* Initialise VFS function pointers */
+
+ if (!smbd_vfs_init(conn)) {
+ DEBUG(0, ("vfs_init failed for service %s\n", lp_servicename(SNUM(conn))));
+ conn_free(conn);
+ *status = NT_STATUS_UNSUCCESSFUL;
+ return NULL;
+ }
+
+/* ROOT Activities: */
/* Preexecs are done here as they might make the dir we are to ChDir to below */
/* execute any "root preexec = " line */
@@ -729,8 +735,8 @@ connection_struct *make_connection_with_
*/
if ( conn && vfs_ChDir(conn,conn->connectpath) != 0 ) {
- DEBUG(0,("move_driver_to_download_area: Can't change directory to %s for [print$] (%s)\n",
- conn->connectpath,strerror(errno)));
+ DEBUG(0,("make_connection_with_chdir: Can't change directory to %s for [%s] (%s)\n",
+ conn->connectpath,lp_servicename(SNUM(conn)),strerror(errno)));
yield_connection(conn, lp_servicename(SNUM(conn)));
conn_free(conn);
*status = NT_STATUS_UNSUCCESSFUL;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/smbd/vfs.c HEAD-modules/source/smbd/vfs.c
--- HEAD/source/smbd/vfs.c Wed Dec 4 07:18:44 2002
+++ HEAD-modules/source/smbd/vfs.c Tue Dec 10 16:20:29 2002
@@ -1,9 +1,9 @@
/*
- Unix SMB/Netbios implementation.
- Version 1.9.
+ Unix SMB/CIFS implementation.
VFS initialisation and support functions
- Copyright (C) Tim Potter 1999
- Copyright (C) Alexander Bokovoy 2002
+ Copyright (C) Tim Potter 1999
+ Copyright (C) Alexander Bokovoy 2002
+ Copyright (C) Stefan (metze) Metzmacher 2002
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,11 +35,43 @@ struct vfs_syminfo {
void *fptr;
};
-/*
- Opaque (final) vfs operations. This is a combination of first-met opaque vfs operations
- across all currently processed modules. */
+static struct vfs_object_function_entry *smb_vfs_objects = NULL;
-static vfs_op_tuple vfs_opaque_ops[SMB_VFS_OP_LAST];
+NTSTATUS smb_register_vfs(const char *name, vfs_init_function init, int version)
+{
+ struct vfs_object_function_entry *fn_entry = NULL;
+
+ /* check if the interface version is ok */
+ if (version != SMB_VFS_INTERFACE_VERSION) {
+ DEBUG(0,("smb_register_vfs: vfs object '%s' have VFS_INTERFACE_VERSION %d, samba has VFS_INTERFACE_VERSION %d\n",
+ name,version,SMB_VFS_INTERFACE_VERSION));
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ /* check if a module is allready registered with this name */
+ for (fn_entry=smb_vfs_objects;fn_entry;fn_entry=fn_entry->next) {
+ if (strequal(fn_entry->name,name)) {
+ DEBUG(1,("smb_register_vfs: a module with name '%s' is allready registered!\n",name));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ }
+
+ if ((fn_entry=(struct vfs_object_function_entry *)malloc(sizeof(struct vfs_object_function_entry)))==NULL) {
+ DEBUG(0,("smb_register_vfs: malloc failed!\n"));
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ fn_entry->prev = NULL;
+ fn_entry->next = NULL;
+ fn_entry->name = strdup(name);
+ fn_entry->init = init;
+
+ DLIST_ADD(smb_vfs_objects,fn_entry);
+
+ DEBUG(2,("smb_register_vfs: register module '%s'!\n",name));
+
+ return NT_STATUS_OK;
+}
/* Default vfs hooks. WARNING: The order of these initialisers is
very important. They must be in the same order as defined in
@@ -133,72 +165,49 @@ static struct vfs_ops default_vfs_ops =
static void vfs_init_default(connection_struct *conn)
{
- DEBUG(3, ("Initialising default vfs hooks\n"));
+ DEBUG(5, ("Initialising default vfs hooks\n"));
memcpy(&conn->vfs_ops, &default_vfs_ops, sizeof(struct vfs_ops));
- conn->vfs_private = NULL;
+ memcpy(&conn->vfs_opaque_ops, &default_vfs_ops, sizeof(struct vfs_ops));
+
}
/****************************************************************************
initialise custom vfs hooks
****************************************************************************/
-BOOL vfs_init_custom(connection_struct *conn, const char *vfs_object)
+BOOL vfs_init_custom(connection_struct *conn, const char *vfs_object_name, const char *vfs_object_param)
{
- int vfs_version = -1;
- vfs_op_tuple *ops, *(*init_fptr)(int *, const struct vfs_ops *, struct smb_vfs_handle_struct *);
+ vfs_op_tuple *ops = NULL;
int i;
+ struct vfs_object_function_entry *vfs_object;
- DEBUG(3, ("Initialising custom vfs hooks from %s\n", vfs_object));
-
- /* Open object file */
+ DEBUG(3, ("Initialising custom vfs hooks from '%s' with parameter '%s'\n", vfs_object_name, vfs_object_param));
- if ((conn->vfs_private->handle = sys_dlopen(vfs_object, RTLD_NOW)) == NULL) {
- DEBUG(0, ("Error opening %s: %s\n", vfs_object, sys_dlerror()));
- return False;
+ for(vfs_object = smb_vfs_objects ; vfs_object; vfs_object=vfs_object->next) {
+ if (strequal(vfs_object_name,vfs_object->name)) {
+ ops = vfs_object->init(conn, &conn->vfs_ops, vfs_object_param);
+ break;
+ }
}
- /* Get handle on vfs_init() symbol */
-
- init_fptr = (vfs_op_tuple *(*)(int *, const struct vfs_ops *, struct smb_vfs_handle_struct *))sys_dlsym(conn->vfs_private->handle, "vfs_init");
-
- if (init_fptr == NULL) {
- DEBUG(0, ("No vfs_init() symbol found in %s\n", vfs_object));
+ if (ops == NULL) {
+ DEBUG(0,("vfs_init_custom: don't find a custom vfs module '%s'!\n",vfs_object_name));
return False;
}
- /* Initialise vfs_ops structure */
-
- if ((ops = init_fptr(&vfs_version, &conn->vfs_ops, conn->vfs_private)) == NULL) {
- DEBUG(0, ("vfs_init() function from %s failed\n", vfs_object));
- return False;
- }
-
- if ((vfs_version < SMB_VFS_INTERFACE_CASCADED)) {
- DEBUG(0, ("vfs_init() returned wrong interface version info (was %d, should be no less than %d)\n",
- vfs_version, SMB_VFS_INTERFACE_VERSION ));
- return False;
- }
-
- if ((vfs_version < SMB_VFS_INTERFACE_VERSION)) {
- DEBUG(0, ("Warning: vfs_init() states that module confirms interface version #%d, current interface version is #%d.\n\
-Proceeding in compatibility mode, new operations (since version #%d) will fallback to default ones.\n",
- vfs_version, SMB_VFS_INTERFACE_VERSION, vfs_version ));
- return False;
- }
-
for(i=0; ops[i].op != NULL; i++) {
DEBUG(3, ("Checking operation #%d (type %d, layer %d)\n", i, ops[i].type, ops[i].layer));
if(ops[i].layer == SMB_VFS_LAYER_OPAQUE) {
/* Check whether this operation was already made opaque by different module */
- if(vfs_opaque_ops[ops[i].type].op == ((void**)&default_vfs_ops)[ops[i].type]) {
+ if(((void**)&conn->vfs_opaque_ops)[ops[i].type] == ((void**)&default_vfs_ops)[ops[i].type]) {
/* No, it isn't overloaded yet. Overload. */
- DEBUG(3, ("Making operation type %d opaque [module %s]\n", ops[i].type, vfs_object));
- vfs_opaque_ops[ops[i].type] = ops[i];
+ DEBUG(3, ("Making operation type %d opaque [module %s]\n", ops[i].type, vfs_object_name));
+ ((void**)&conn->vfs_opaque_ops)[ops[i].type] = ops[i].op;
}
}
/* Change current VFS disposition*/
- DEBUG(3, ("Accepting operation type %d from module %s\n", ops[i].type, vfs_object));
+ DEBUG(3, ("Accepting operation type %d from module %s\n", ops[i].type, vfs_object_name));
((void**)&conn->vfs_ops)[ops[i].type] = ops[i].op;
}
@@ -211,74 +220,57 @@ Proceeding in compatibility mode, new op
BOOL smbd_vfs_init(connection_struct *conn)
{
- char **vfs_objects, *vfsobj, *vfs_module, *vfs_path;
- int nobj, i;
- struct smb_vfs_handle_struct *handle;
+ const char **vfs_objects;
+ int i;
/* Normal share - initialise with disk access functions */
vfs_init_default(conn);
- /* Override VFS functions if 'vfs object' was specified*/
- if (*lp_vfsobj(SNUM(conn))) {
- vfsobj = NULL;
- for(i=0; i<SMB_VFS_OP_LAST; i++) {
- vfs_opaque_ops[i].op = ((void**)&default_vfs_ops)[i];
- vfs_opaque_ops[i].type = i;
- vfs_opaque_ops[i].layer = SMB_VFS_LAYER_OPAQUE;
+ /* Override VFS functions if 'vfs objects' was specified*/
+ if (((vfs_objects=lp_vfsobj(SNUM(conn)))!=NULL)&&
+ (*vfs_objects!=NULL)) {
+ for (i=(-1);vfs_objects[i+1]!=NULL;i++) {
+ /* count the objects */
}
- if (string_set(&vfsobj, lp_vfsobj(SNUM(conn)))) {
- /* Parse passed modules specification to array of modules */
- set_first_token(vfsobj);
- /* We are using default separators: ' \t\r\n' */
- vfs_objects = toktocliplist(&nobj, NULL);
- if (vfs_objects) {
- vfs_path = lp_vfs_path(SNUM(conn));
- conn->vfs_private = NULL;
- for(i=nobj-1; i>=0; i--) {
- handle = (struct smb_vfs_handle_struct *) smb_xmalloc(sizeof(smb_vfs_handle_struct));
- /* Loadable object file */
- handle->handle = NULL;
- DLIST_ADD(conn->vfs_private, handle)
- vfs_module = NULL;
- if (vfs_path) {
- asprintf(&vfs_module, "%s/%s", vfs_path, vfs_objects[i]);
- } else {
- asprintf(&vfs_module, "%s", vfs_objects[i]);
- }
- if (!vfs_init_custom(conn, vfs_module)) {
- DEBUG(0, ("smbd_vfs_init: vfs_init_custom failed for %s\n", vfs_module));
- string_free(&vfsobj);
- SAFE_FREE(vfs_module);
- return False;
- }
- SAFE_FREE(vfs_module);
- }
+ for ( ; i>=0; i--) {
+ char *name,*param = NULL,*p;
+
+ /* init vfs_objects in reverse order
+ *
+ * handle:
+ * <modules_name>[:<module_parameter>]
+ *
+ * this can be use for telling a module (e.g. mysql )
+ *
+ * to use parametric options from:
+ * lp_parm_string(SNUM(conn),module_parameter?module_parameter:"vfs_mysql","host","localhost");
+ *
+ */
+
+ if ((name = strdup(vfs_objects[i]))==NULL) {
+ DEBUG(0,("smbd_vfs_init: strdup failed\n"));
+ return False;
+ }
+
+ if ((p = strchr(name, ':'))!=NULL) {
+ *p = '\0';
+ param = p+1;
+ trim_string(param," "," ");
+ }
+ trim_string(name," "," ");
+
+ if (!vfs_init_custom(conn, name, param)) {
+ DEBUG(0, ("smbd_vfs_init: vfs_init_custom failed for '%s' with parameter '%s'\n", name, param));
+ SAFE_FREE(name);
+ return False;
}
- string_free(&vfsobj);
- return True;
+ SAFE_FREE(name);
}
}
return True;
}
/*******************************************************************
- Create vfs_ops reflecting current vfs_opaque_ops
-*******************************************************************/
-
-struct vfs_ops *smb_vfs_get_opaque_ops(void)
-{
- int i;
- struct vfs_ops *ops;
-
- ops = smb_xmalloc(sizeof(struct vfs_ops));
-
- for(i=0; i<SMB_VFS_OP_LAST; i++) {
- ((void**)ops)[i] = vfs_opaque_ops[i].op;
- }
- return ops;
-}
-
-/*******************************************************************
Check if directory exists.
********************************************************************/
@@ -641,7 +633,7 @@ int vfs_ChDir(connection_struct *conn, c
if (*path == '/' && strcsequal(LastDir,path))
return(0);
- DEBUG(3,("vfs_ChDir to %s\n",path));
+ DEBUG(4,("vfs_ChDir to %s\n",path));
res = vfs_chdir(conn,path);
if (!res)
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/utils/net.c HEAD-modules/source/utils/net.c
--- HEAD/source/utils/net.c Wed Nov 13 19:52:41 2002
+++ HEAD-modules/source/utils/net.c Tue Dec 10 16:15:12 2002
@@ -608,7 +608,10 @@ static struct functable net_func[] = {
if (!opt_target_workgroup) {
opt_target_workgroup = strdup(lp_workgroup());
}
-
+
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL, MODULE_TYPES_NET);
+
if (!init_names())
exit(1);
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/utils/pdbedit.c HEAD-modules/source/utils/pdbedit.c
--- HEAD/source/utils/pdbedit.c Wed Nov 13 19:52:42 2002
+++ HEAD-modules/source/utils/pdbedit.c Tue Dec 10 16:15:39 2002
@@ -503,8 +503,8 @@ int main (int argc, char **argv)
exit(1);
}
- if(lp_modules())
- smb_load_modules(lp_modules());
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPES_PDBEDIT);
if (!init_names())
exit(1);
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/utils/smbgroupedit.c HEAD-modules/source/utils/smbgroupedit.c
--- HEAD/source/utils/smbgroupedit.c Wed Nov 13 19:52:42 2002
+++ HEAD-modules/source/utils/smbgroupedit.c Tue Dec 10 16:16:18 2002
@@ -279,6 +279,9 @@ int main (int argc, char **argv)
exit(1);
}
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPES_SMBGROUPEDIT);
+
if (!init_names())
exit(1);
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/utils/smbpasswd.c HEAD-modules/source/utils/smbpasswd.c
--- HEAD/source/utils/smbpasswd.c Wed Nov 13 19:52:43 2002
+++ HEAD-modules/source/utils/smbpasswd.c Tue Dec 10 16:16:36 2002
@@ -579,6 +579,9 @@ int main(int argc, char **argv)
setup_logging("smbpasswd", True);
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPES_SMBPASSWD);
+
/*
* Set the machine NETBIOS name if not already
* set from the config file.
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/wrepld/server.c HEAD-modules/source/wrepld/server.c
--- HEAD/source/wrepld/server.c Wed Nov 13 19:52:43 2002
+++ HEAD-modules/source/wrepld/server.c Tue Dec 10 16:21:11 2002
@@ -661,6 +661,9 @@ static void process(void)
if (!reload_services(False))
return(-1);
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL, MODULE_TYPES_WREPLD);
+
if (!init_names())
return -1;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/torture/cmd_vfs.c HEAD-modules/source/torture/cmd_vfs.c
--- HEAD/source/torture/cmd_vfs.c Sat Nov 23 17:52:50 2002
+++ HEAD-modules/source/torture/cmd_vfs.c Tue Dec 10 16:54:53 2002
@@ -2,8 +2,9 @@
Unix SMB/CIFS implementation.
VFS module functions
- Copyright (C) Simo Sorce 2002
- Copyright (C) Eric Lorimer 2002
+ Copyright (C) Simo Sorce 2002
+ Copyright (C) Eric Lorimer 2002
+ Copyright (C) Stefan (metze) Metzmacher 2002
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,32 +28,55 @@ static char *null_string = "";
static NTSTATUS cmd_load_module(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
{
- struct smb_vfs_handle_struct *handle;
- char *path = lp_vfs_path(0);
- char name[PATH_MAX];
-
- if (argc != 2) {
- printf("Usage: load <module path>\n");
+ if (argc < 2) {
+ printf("Usage: load <module path> {[<module path>]}\n");
return NT_STATUS_OK;
}
- if (path != NULL && *path != '\0') {
- snprintf(name, PATH_MAX, "%s/%s", path, argv[1]);
- } else {
- snprintf(name, PATH_MAX, "%s", argv[1]);
- }
- vfs->conn->vfs_private = NULL;
- handle = (struct smb_vfs_handle_struct *) smb_xmalloc(sizeof(smb_vfs_handle_struct));
- handle->handle = NULL;
- DLIST_ADD(vfs->conn->vfs_private, handle)
- if (!vfs_init_custom(vfs->conn, name)) {
- DEBUG(0, ("load: error=-1 (vfs_init_custom failed for %s)\n", argv[1]));
+ if (!smb_load_modules((const char **)&argv[1],vfs->conn, MODULE_TYPES_PER_SHARE)) {
+ DEBUG(0, ("load: error=-1 (smb_load_modules) failed for %s ...)\n", argv[1]));
return NT_STATUS_UNSUCCESSFUL;
}
printf("load: ok\n");
return NT_STATUS_OK;
}
+static NTSTATUS cmd_load_objects(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
+{
+ int i;
+
+ if (argc < 2) {
+ printf("Usage: objects <vfs object name>[:<vfs object parameter>] {[<vfs object name>[:<vfs object parameter>]]}\n");
+ return NT_STATUS_OK;
+ }
+
+ for (i = argc -1; i>0;i--) {
+ char *name,*param = NULL,*p;
+
+ if ((name = strdup(argv[i]))==NULL) {
+ DEBUG(0,("smbd_vfs_init: strdup failed\n"));
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if ((p = strchr(name, ':'))!=NULL) {
+ *p = '\0';
+ param = p+1;
+ trim_string(param," "," ");
+ }
+ trim_string(name," "," ");
+
+ if (!vfs_init_custom(vfs->conn,name,param)) {
+ DEBUG(0,("objects: vfs_init_custom failed for '%s' with parameter '%s'\n",name,param));
+ SAFE_FREE(name);
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ SAFE_FREE(name);
+ }
+
+ printf("objects: ok\n");
+ return NT_STATUS_OK;
+}
+
static NTSTATUS cmd_populate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, char **argv)
{
char c;
@@ -1011,7 +1035,8 @@ struct cmd_set vfs_commands[] = {
{ "VFS Commands" },
- { "load", cmd_load_module, "Load a module", "load <module.so>" },
+ { "load", cmd_load_module, "Load modulea", "load <module.so> {[</path/to/module2.so>]}" },
+ { "objects", cmd_load_objects, "Specify vfs objects", "objects <module>[:<parameter>] {[<module2>[:<parameter2>]]}" },
{ "populate", cmd_populate, "Populate a data buffer", "populate <char> <size>" },
{ "showdata", cmd_show_data, "Show data currently in data buffer", "show_data [<offset> <len>]"},
{ "connect", cmd_connect, "VFS connect()", "connect" },
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/torture/vfstest.c HEAD-modules/source/torture/vfstest.c
--- HEAD/source/torture/vfstest.c Thu Sep 5 11:40:32 2002
+++ HEAD-modules/source/torture/vfstest.c Tue Dec 10 16:13:19 2002
@@ -527,6 +527,9 @@ int main(int argc, char *argv[])
/* TODO: check output */
reload_services(False);
+
+ if (lp_modules(GLOBAL_SECTION_SNUM))
+ smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPES_VFSTEST);
/* the following functions are part of the Samba debugging
facilities. See lib/debug.c */
More information about the samba-technical
mailing list