summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-04-16 14:45:11 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-04-16 14:45:11 +0000
commitddf662d11886189151dca188a2eb4f6bd602caa0 (patch)
tree65a391fd3f9281f65fc1c8098ef1bcab15a5c0ba /source3
parent0abad3ad5cf467649ebc05a190cc34a7616fa271 (diff)
downloadsamba-ddf662d11886189151dca188a2eb4f6bd602caa0.tar.gz
samba-ddf662d11886189151dca188a2eb4f6bd602caa0.tar.bz2
samba-ddf662d11886189151dca188a2eb4f6bd602caa0.zip
More merges from HEAD:
- Stephan Kulow's changes (fixing warnings in libsmbclient) - VFS modules - Seperating libs (This used to be commit 6e9b7802335428c88ecf4e44a0e2395ac58e96b5)
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in194
-rw-r--r--source3/configure.in160
-rw-r--r--source3/include/vfs.h4
-rw-r--r--source3/libsmb/cliquota.c10
-rw-r--r--source3/libsmb/clirap.c2
-rw-r--r--source3/libsmb/libsmb_cache.c8
-rw-r--r--source3/libsmb/libsmbclient.c293
-rw-r--r--source3/modules/vfs_audit.c14
-rw-r--r--source3/modules/vfs_extd_audit.c15
-rw-r--r--source3/modules/vfs_netatalk.c8
-rw-r--r--source3/modules/vfs_recycle.c223
-rw-r--r--source3/smbd/conn.c21
-rw-r--r--source3/smbd/vfs.c233
13 files changed, 689 insertions, 496 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index ee25d3c62c..5ea691f21e 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -23,12 +23,16 @@ WINBIND_NSS_LDSHFLAGS=@WINBIND_NSS_LDSHFLAGS@ @LDFLAGS@ @CFLAGS@
AWK=@AWK@
DYNEXP=@DYNEXP@
PYTHON=@PYTHON@
+PERL=@PERL@
TERMLDFLAGS=@TERMLDFLAGS@
TERMLIBS=@TERMLIBS@
PRINTLIBS=@PRINTLIBS@
AUTHLIBS=@AUTHLIBS@
ACLLIBS=@ACLLIBS@
+PASSDBLIBS=@PASSDBLIBS@
+ADSLIBS=@ADSLIBS@
+KRB5LIBS=@KRB5_LIBS@
LINK=$(CC) $(FLAGS) $(LDFLAGS)
@@ -140,12 +144,12 @@ SCRIPTS = $(srcdir)/script/smbtar $(srcdir)/script/addtosmbpass $(srcdir)/script
QUOTAOBJS=@QUOTAOBJS@
-VFS_MODULES = bin/vfs_audit.@SHLIBEXT@ bin/vfs_extd_audit.@SHLIBEXT@ bin/vfs_recycle.@SHLIBEXT@ bin/vfs_netatalk.@SHLIBEXT@
+VFS_MODULES = @VFS_MODULES@
PDB_MODULES = @PDB_MODULES@
RPC_MODULES = @RPC_MODULES@
-AUTH_MODULES = @AUTH_MODULES@
CHARSET_MODULES = @CHARSET_MODULES@
-MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) $(AUTH_MODULES) $(CHARSET_MODULES)
+AUTH_MODULES = @AUTH_MODULES@
+MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) $(CHARSET_MODULES) $(AUTH_MODULES)
######################################################################
# object file lists
@@ -289,6 +293,11 @@ OPLOCK_OBJ = smbd/oplock.o smbd/oplock_irix.o smbd/oplock_linux.o
NOTIFY_OBJ = smbd/notify.o smbd/notify_hash.o smbd/notify_kernel.o
+VFS_AUDIT_OBJ = modules/vfs_audit.o
+VFS_EXTD_AUDIT_OBJ = modules/vfs_extd_audit.o
+VFS_RECYCLE_OBJ = modules/vfs_recycle.o
+VFS_NETATALK_OBJ = modules/vfs_netatalk.o
+
PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o
UNIGRP_OBJ = libsmb/netlogon_unigrp.o
@@ -302,7 +311,7 @@ AUTH_UNIX_OBJ = auth/auth_unix.o
AUTH_WINBIND_OBJ = auth/auth_winbind.o
AUTH_OBJ = auth/auth.o @AUTH_STATIC@ auth/auth_util.o auth/auth_compat.o \
- auth/auth_ntlmssp.o \
+ auth/auth_ntlmssp.o \
$(PLAINTEXT_AUTH_OBJ) $(UNIGRP_OBJ)
MANGLE_OBJ = smbd/mangle.o smbd/mangle_hash.o smbd/mangle_map.o smbd/mangle_hash2.o
@@ -323,10 +332,10 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \
printing/printfsp.o lib/util_seaccess.o \
smbd/build_options.o \
smbd/change_trust_pw.o \
- $(MANGLE_OBJ)
+ $(MANGLE_OBJ) @VFS_STATIC@
-SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(MSDFS_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) \
- $(RPC_SERVER_OBJ) $(RPC_PARSE_OBJ) $(SECRETS_OBJ) \
+SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(MSDFS_OBJ) $(LIBSMB_OBJ) \
+ $(RPC_SERVER_OBJ) $(RPC_PARSE_OBJ) $(SECRETS_OBJ) $(UBIQX_OBJ) \
$(LOCKING_OBJ) $(PASSDB_OBJ) $(PRINTING_OBJ) $(PROFILE_OBJ) \
$(LIB_OBJ) $(PRINTBACKEND_OBJ) $(QUOTAOBJS) $(OPLOCK_OBJ) \
$(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \
@@ -334,7 +343,6 @@ SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(MSDFS_OBJ) $(LIBSMB_OBJ) $(UBIQX_
$(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \
$(LIB_SMBD_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ)
-
PRINTING_OBJ = printing/pcap.o printing/print_svid.o \
printing/print_cups.o printing/print_generic.o \
printing/lpq_parse.o printing/load.o
@@ -345,7 +353,6 @@ PRINTBACKEND_OBJ = printing/printing.o printing/nt_printing.o printing/notify.o
MSDFS_OBJ = msdfs/msdfs.o
SMBD_OBJ = $(SMBD_OBJ_BASE) $(SMBD_OBJ_MAIN)
-
NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \
nmbd/nmbd_become_lmb.o nmbd/nmbd_browserdb.o \
nmbd/nmbd_browsesync.o nmbd/nmbd_elections.o \
@@ -359,27 +366,27 @@ NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \
nmbd/nmbd_subnetdb.o nmbd/nmbd_winsproxy.o nmbd/nmbd_winsserver.o \
nmbd/nmbd_workgroupdb.o nmbd/nmbd_synclists.o
-NMBD_OBJ = $(PARAM_OBJ) $(NMBD_OBJ1) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(UBIQX_OBJ) \
+NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(UBIQX_OBJ) \
$(PROFILE_OBJ) $(LIB_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ)
WREPL_OBJ1 = wrepld/server.o wrepld/process.o wrepld/parser.o wrepld/socket.o \
wrepld/partners.o
-WREPL_OBJ = $(PARAM_OBJ) $(WREPL_OBJ1) $(UBIQX_OBJ) \
+WREPL_OBJ = $(WREPL_OBJ1) $(PARAM_OBJ) $(UBIQX_OBJ) \
$(PROFILE_OBJ) $(LIB_OBJ) $(POPT_LIB_OBJ)
SWAT_OBJ1 = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \
web/swat.o web/neg_lang.o
-SWAT_OBJ = $(PARAM_OBJ) $(SWAT_OBJ1) $(PRINTING_OBJ) $(LIBSMB_OBJ) $(LOCKING_OBJ) \
- $(PASSDB_OBJ) $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \
+SWAT_OBJ = $(SWAT_OBJ1) $(PARAM_OBJ) $(PRINTING_OBJ) $(LIBSMB_OBJ) \
+ $(LOCKING_OBJ) $(PASSDB_OBJ) $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \
$(UBIQX_OBJ) $(LIB_OBJ) $(GROUPDB_OBJ) $(PLAINTEXT_AUTH_OBJ) \
$(POPT_LIB_OBJ)
-SMBSH_OBJ = $(PARAM_OBJ) smbwrapper/smbsh.o smbwrapper/shared.o \
- $(UBIQX_OBJ) $(LIB_OBJ)
+SMBSH_OBJ = smbwrapper/smbsh.o smbwrapper/shared.o \
+ $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
-STATUS_OBJ = $(PARAM_OBJ) utils/status.o $(LOCKING_OBJ) \
+STATUS_OBJ = utils/status.o $(LOCKING_OBJ) $(PARAM_OBJ) \
$(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ) $(POPT_LIB_OBJ)
SMBCONTROL_OBJ = utils/smbcontrol.o $(LOCKING_OBJ) $(PARAM_OBJ) \
@@ -435,8 +442,8 @@ SMBWRAPPER_OBJ1 = smbwrapper/wrapped.o
SMBWRAPPER_OBJ = $(SMBW_OBJ) $(SMBWRAPPER_OBJ1)
LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o libsmb/libsmb_compat.o \
- libsmb/libsmb_cache.o $(LIB_OBJ) \
- $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ)
+ libsmb/libsmb_cache.o $(PARAM_OBJ) $(LIB_OBJ) \
+ $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(UBIQX_OBJ)
# This shared library is intended for linking with unit test programs
# to test Samba internals. It's called libbigballofmud.so to
@@ -444,7 +451,7 @@ LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o libsmb/libsmb_compat.o \
LIBBIGBALLOFMUD_MAJOR = 0
-LIBBIGBALLOFMUD_OBJ = $(LIB_OBJ) $(UBIQX_OBJ) $(PARAM_OBJ) $(SECRETS_OBJ) \
+LIBBIGBALLOFMUD_OBJ = $(PARAM_OBJ) $(LIB_OBJ) $(UBIQX_OBJ) $(SECRETS_OBJ) \
$(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) \
$(GROUPDB_OBJ) $(KRBCLIENT_OBJ)
@@ -461,9 +468,9 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_ads_cldap.o utils/net_help.o \
utils/net_rpc_join.o utils/net_time.o utils/net_lookup.o \
utils/net_cache.o
-NET_OBJ = $(NET_OBJ1) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
+NET_OBJ = $(NET_OBJ1) $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
$(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
- $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
+ $(KRBCLIENT_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
$(LIBMSRPC_OBJ) $(LIBMSRPC_SERVER_OBJ) \
$(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ)
@@ -483,43 +490,37 @@ NMBLOOKUP_OBJ = utils/nmblookup.o $(PARAM_OBJ) $(UBIQX_OBJ) $(LIBNMB_OBJ) \
SMBTORTURE_OBJ1 = torture/torture.o torture/nbio.o torture/scanner.o torture/utable.o \
torture/denytest.o torture/mangle_test.o
-SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) \
- $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
+SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) \
+ $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
-MASKTEST_OBJ = torture/masktest.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(PARAM_OBJ) \
+MASKTEST_OBJ = torture/masktest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
$(UBIQX_OBJ) $(LIB_OBJ)
-MSGTEST_OBJ = torture/msgtest.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(PARAM_OBJ) \
+MSGTEST_OBJ = torture/msgtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
$(UBIQX_OBJ) $(LIB_OBJ)
-LOCKTEST_OBJ = torture/locktest.o $(LOCKING_OBJ) $(KRBCLIENT_OBJ) $(LIBSMB_OBJ) $(PARAM_OBJ) \
- $(UBIQX_OBJ) $(LIB_OBJ)
+LOCKTEST_OBJ = torture/locktest.o $(PARAM_OBJ) $(LOCKING_OBJ) $(KRBCLIENT_OBJ) \
+ $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
-NSSTEST_OBJ = torture/nsstest.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(PARAM_OBJ) \
+NSSTEST_OBJ = torture/nsstest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
$(UBIQX_OBJ) $(LIB_OBJ)
VFSTEST_OBJ = torture/cmd_vfs.o torture/vfstest.o $(SMBD_OBJ_BASE) $(READLINE_OBJ)
-VFS_AUDIT_OBJ = modules/vfs_audit.o
-VFS_EXTD_AUDIT_OBJ = modules/vfs_extd_audit.o
-VFS_RECYCLE_OBJ = modules/vfs_recycle.o
-VFS_NETATALK_OBJ = modules/vfs_netatalk.o
-
-LOCKTEST2_OBJ = torture/locktest2.o $(LOCKING_OBJ) $(LIBSMB_OBJ) \
- $(KRBCLIENT_OBJ) $(PARAM_OBJ) \
- $(UBIQX_OBJ) $(LIB_OBJ)
+LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \
+ $(KRBCLIENT_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
-SMBCACLS_OBJ = utils/smbcacls.o $(LOCKING_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
- $(PARAM_OBJ) \
- $(UBIQX_OBJ) $(LIB_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_GET_SET_OBJ) \
- $(LIBMSRPC_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ)
+SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \
+ $(KRBCLIENT_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) $(RPC_PARSE_OBJ) \
+ $(PASSDB_GET_SET_OBJ) $(LIBMSRPC_OBJ) $(SECRETS_OBJ) \
+ $(POPT_LIB_OBJ)
SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LOCKING_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
- $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_GET_SET_OBJ) \
+ $(PARAM_OBJ) \
+ $(UBIQX_OBJ) $(LIB_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_GET_SET_OBJ) \
$(LIBMSRPC_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ)
-
-TALLOCTORT_OBJ = lib/talloctort.o $(LIB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ)
+TALLOCTORT_OBJ = lib/talloctort.o $(PARAM_OBJ) $(LIB_OBJ) $(UBIQX_OBJ)
RPCTORTURE_OBJ = torture/rpctorture.o \
rpcclient/display.o \
@@ -533,7 +534,7 @@ RPCTORTURE_OBJ = torture/rpctorture.o \
DEBUG2HTML_OBJ = utils/debug2html.o ubiqx/debugparse.o
-SMBFILTER_OBJ = utils/smbfilter.o $(LIBSMB_OBJ) $(PARAM_OBJ) \
+SMBFILTER_OBJ = utils/smbfilter.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
$(UBIQX_OBJ) $(LIB_OBJ) $(KRBCLIENT_OBJ)
PROTO_OBJ = $(SMBD_OBJ_MAIN) \
@@ -714,45 +715,45 @@ bin/.dummy:
bin/smbd@EXEEXT@: $(SMBD_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINTLIBS) \
- $(AUTHLIBS) $(ACLLIBS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(ADSLIBS) $(LDFLAGS) $(DYNEXP) $(PRINTLIBS) \
+ $(AUTHLIBS) $(ACLLIBS) $(PASSDBLIBS) $(LIBS) @POPTLIBS@
bin/nmbd@EXEEXT@: $(NMBD_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS)
bin/wrepld@EXEEXT@: $(WREPL_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(WREPL_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(WREPL_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@
bin/swat@EXEEXT@: $(SWAT_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINTLIBS) \
- $(AUTHLIBS) $(LIBS) @BUILD_POPT@
+ $(AUTHLIBS) $(LIBS) $(PASSDBLIBS) @POPTLIBS@ $(KRB5LIBS)
bin/rpcclient@EXEEXT@: $(RPCCLIENT_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(PASSDBLIBS) $(RPCCLIENT_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ $(ADSLIBS)
bin/smbclient@EXEEXT@: $(CLIENT_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ $(KRB5LIBS)
bin/net@EXEEXT@: $(NET_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(ADSLIBS)
-bin/profiles@EXEEXT@: utils/profiles.o @BUILD_POPT@ bin/.dummy
+bin/profiles@EXEEXT@: $(PROFILES_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ utils/profiles.o $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(PROFILES_OBJ) $(LDFLAGS) $(LIBS) @POPTLIBS@
bin/smbspool@EXEEXT@: $(CUPS_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(CUPS_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(CUPS_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/smbmount@EXEEXT@: $(MOUNT_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(MOUNT_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(MOUNT_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/smbmnt@EXEEXT@: $(MNT_OBJ) bin/.dummy
@echo Linking $@
@@ -764,43 +765,47 @@ bin/smbumount@EXEEXT@: $(UMOUNT_OBJ) bin/.dummy
bin/testparm@EXEEXT@: $(TESTPARM_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(TESTPARM_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(TESTPARM_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@
bin/testprns@EXEEXT@: $(TESTPRNS_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(TESTPRNS_OBJ) $(LDFLAGS) $(PRINTLIBS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(TESTPRNS_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINTLIBS) $(LIBS)
bin/smbstatus@EXEEXT@: $(STATUS_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(STATUS_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(STATUS_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@
bin/smbcontrol@EXEEXT@: $(SMBCONTROL_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) -DUSING_SMBCONTROL $(FLAGS) -o $@ $(SMBCONTROL_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) -DUSING_SMBCONTROL $(FLAGS) -o $@ $(SMBCONTROL_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@
bin/smbtree@EXEEXT@: $(SMBTREE_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS)
bin/smbpasswd@EXEEXT@: $(SMBPASSWD_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(PASSDBLIBS) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS)
bin/pdbedit@EXEEXT@: $(PDBEDIT_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(PASSDBLIBS) $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@
+
+bin/samtest@EXEEXT@: $(SAMTEST_OBJ) @BUILD_POPT@ bin/.dummy
+ @echo Linking $@
+ @$(CC) $(FLAGS) -o $@ $(SAMTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(PASSDBLIBS) $(ADSLIBS)
bin/smbgroupedit@EXEEXT@: $(SMBGROUPEDIT_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBGROUPEDIT_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(SMBGROUPEDIT_OBJ) $(PASSDBLIBS) $(LDFLAGS) $(DYNEXP) $(LIBS)
bin/nmblookup@EXEEXT@: $(NMBLOOKUP_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(NMBLOOKUP_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(NMBLOOKUP_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@
bin/smbtorture@EXEEXT@: $(SMBTORTURE_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS)
bin/talloctort@EXEEXT@: $(TALLOCTORT_OBJ) bin/.dummy
@echo Linking $@
@@ -808,39 +813,39 @@ bin/talloctort@EXEEXT@: $(TALLOCTORT_OBJ) bin/.dummy
bin/masktest@EXEEXT@: $(MASKTEST_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(MASKTEST_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(MASKTEST_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/msgtest@EXEEXT@: $(MSGTEST_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(MSGTEST_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(MSGTEST_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/smbcacls@EXEEXT@: $(SMBCACLS_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS)
bin/smbcquotas@EXEEXT@: $(SMBCQUOTAS_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @BUILD_POPT@ $(KRB5LIBS)
+ @$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS)
bin/locktest@EXEEXT@: $(LOCKTEST_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCKTEST_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(LOCKTEST_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/nsstest@EXEEXT@: $(NSSTEST_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(NSSTEST_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(NSSTEST_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/vfstest@EXEEXT@: $(VFSTEST_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINTLIBS) $(AUTHLIBS) $(ACLLIBS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINTLIBS) $(AUTHLIBS) $(ACLLIBS) $(LIBS) @POPTLIBS@ $(ADSLIBS)
bin/locktest2@EXEEXT@: $(LOCKTEST2_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCKTEST2_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(LOCKTEST2_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/rpctorture@EXEEXT@: $(RPCTORTURE_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(RPCTORTURE_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(RPCTORTURE_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/debug2html@EXEEXT@: $(DEBUG2HTML_OBJ) bin/.dummy
@echo Linking $@
@@ -848,39 +853,41 @@ bin/debug2html@EXEEXT@: $(DEBUG2HTML_OBJ) bin/.dummy
bin/smbfilter@EXEEXT@: $(SMBFILTER_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBFILTER_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(SMBFILTER_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/smbw_sample@EXEEXT@: $(SMBW_OBJ) utils/smbw_sample.o bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBW_OBJ) utils/smbw_sample.o $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(SMBW_OBJ) utils/smbw_sample.o $(LDFLAGS) $(LIBS) $(KRB5LIBS)
bin/smbsh@EXEEXT@: $(SMBSH_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SMBSH_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(SMBSH_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS)
bin/smbwrapper.@SHLIBEXT@: $(PICOBJS) bin/.dummy
@echo Linking shared library $@
@$(SHLD) $(LDSHFLAGS) -o $@ $(PICOBJS) $(LIBS) \
- @SONAMEFLAG@`basename $@`
+ @SONAMEFLAG@`basename $@` $(KRB5LIBS)
bin/smbwrapper.32.@SHLIBEXT@: $(PICOBJS32)
@echo Linking shared library $@
@$(SHLD) -32 $(LDSHFLAGS) -o $@ $(PICOBJS32) $(LIBS) \
- @SONAMEFLAG@`basename $@`
+ @SONAMEFLAG@`basename $@` $(KRB5LIBS)
bin/libsmbclient.@SHLIBEXT@: $(LIBSMBCLIENT_PICOBJS)
@echo Linking libsmbclient shared library $@
@$(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBCLIENT_PICOBJS) $(LDFLAGS) $(LIBS) \
- @SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR)
+ $(KRB5LIBS) @SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR)
bin/libsmbclient.a: $(LIBSMBCLIENT_PICOBJS)
@echo Linking libsmbclient non-shared library $@
@-$(AR) -rc $@ $(LIBSMBCLIENT_PICOBJS)
+# This is probably wrong for anything other than the GNU linker.
bin/libbigballofmud.@SHLIBEXT@: $(LIBBIGBALLOFMUD_PICOBJS)
@echo Linking bigballofmud shared library $@
@$(SHLD) $(LDSHFLAGS) -o $@ $(LIBBIGBALLOFMUD_PICOBJS) $(LIBS) \
- @SONAMEFLAG@`basename $@`.$(LIBBIGBALLOFMUD_MAJOR)
+ @SONAMEFLAG@`basename $@`.$(LIBBIGBALLOFMUD_MAJOR) $(PASSDBLIBS) $(ADSLIBS)
+ ln -snf libbigballofmud.so bin/libbigballofmud.so.0
# It would be nice to build a static bigballofmud too, but when I try
# I get linker errors about dl_open and similar things. I'm not sure
@@ -932,7 +939,7 @@ bin/librpc_netdfs.@SHLIBEXT@: $(RPC_DFS_OBJ)
bin/librpc_echo.@SHLIBEXT@: $(RPC_ECHO_OBJ)
@echo "Linking $@"
@$(SHLD) $(LDSHFLAGS) -o $@ $(RPC_ECHO_OBJ) -lc \
- @SONAMEFLAG@`basename $@`
+ @SONAMEFLAG@`basename $@`
nsswitch/libnss_wins.@SHLIBEXT@: $(NSS_OBJ)
@echo "Linking $@"
@@ -941,7 +948,8 @@ nsswitch/libnss_wins.@SHLIBEXT@: $(NSS_OBJ)
bin/winbindd@EXEEXT@: $(WINBINDD_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
- @$(LINK) -o $@ $(WINBINDD_OBJ) $(DYNEXP) $(LIBS) @BUILD_POPT@
+ @$(LINK) -o $@ $(WINBINDD_OBJ) $(DYNEXP) $(LIBS) @POPTLIBS@ $(ADSLIBS) \
+ @LDAP_LIBS@
nsswitch/@WINBIND_NSS@.@SHLIBEXT@: $(WINBIND_NSS_PICOBJS)
@echo "Linking $@"
@@ -1041,22 +1049,17 @@ bin/netatalk.@SHLIBEXT@: $(VFS_NETATALK_OBJ)
@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_NETATALK_OBJ) \
@SONAMEFLAG@`basename $@`
-bin/fake_perms.@SHLIBEXT@: $(VFS_FAKE_PERMS_OBJ)
- @echo "Building plugin $@"
- @$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_FAKE_PERMS_OBJ) \
- @SONAMEFLAG@`basename $@`
-
bin/wbinfo@EXEEXT@: $(WBINFO_OBJ) $(PARAM_OBJ) $(LIB_OBJ) \
$(UBIQX_OBJ) $(SECRETS_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
@$(LINK) -o $@ $(WBINFO_OBJ) $(PARAM_OBJ) $(LIB_OBJ) \
- $(UBIQX_OBJ) $(SECRETS_OBJ) $(LIBS) @BUILD_POPT@
+ $(UBIQX_OBJ) $(SECRETS_OBJ) $(LIBS) @POPTLIBS@
bin/ntlm_auth@EXEEXT@: $(NTLM_AUTH_OBJ) $(PARAM_OBJ) $(LIB_OBJ) \
$(UBIQX_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
@$(LINK) -o $@ $(NTLM_AUTH_OBJ) $(PARAM_OBJ) $(LIB_OBJ) \
- $(UBIQX_OBJ) $(LIBS) @BUILD_POPT@
+ $(UBIQX_OBJ) $(LIBS) @POPTLIBS@
bin/pam_smbpass.@SHLIBEXT@: $(PAM_SMBPASS_PICOOBJ)
@echo "Linking shared library $@"
@@ -1102,14 +1105,13 @@ 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/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(RPC_MODULES)
-installmodules: modules installdirs
+installmodules: all modules installdirs
@$(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)$(RPCLIBDIR) $(RPC_MODULES)
- @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(AUTH_MODULES)
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSETLIBDIR) $(CHARSET_MODULES)
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(AUTH_MODULES)
installscripts: installdirs
@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
@@ -1190,8 +1192,8 @@ uninstallmodules:
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(DESTDIR)$(VFS_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(DESTDIR)$(PDB_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(DESTDIR)$(RPC_MODULES)
- @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(DESTDIR)$(AUTH_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSETLIBDIR) $(DESTDIR)$(CHARSET_MODULES)
+ @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(DESTDIR)$(AUTH_MODULES)
uninstallscripts:
@$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
@@ -1204,7 +1206,7 @@ clean: delheaders python_clean
$(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(MODULES) $(TORTURE_PROGS) \
$(LIBSMBCLIENT) $(EVERYTHING_PROGS) .headers.stamp
-# This is quite ugly actually.. But we need to make
+# This is quite ugly actually.. But we need to make
# sure the changes to include/config.h are used.
modules_clean:
@-rm -f @MODULES_CLEAN@ auth/auth.o passdb/pdb_interface.o rpc_server/srv_pipe_hnd.o lib/iconv.o smbd/vfs.o
diff --git a/source3/configure.in b/source3/configure.in
index 0dd73efb26..9d51c16466 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -153,53 +153,16 @@ AC_SUBST(LIBSMBCLIENT)
AC_SUBST(PRINTLIBS)
AC_SUBST(AUTHLIBS)
AC_SUBST(ACLLIBS)
+AC_SUBST(ADSLIBS)
+AC_SUBST(PASSDBLIBS)
+AC_SUBST(KRB5_LIBS)
+AC_SUBST(LDAP_LIBS)
+AC_SUBST(LDAP_OBJ)
AC_SUBST(SHLIB_PROGS)
AC_SUBST(SMBWRAPPER)
AC_SUBST(EXTRA_BIN_PROGS)
AC_SUBST(EXTRA_SBIN_PROGS)
AC_SUBST(EXTRA_ALL_TARGETS)
-dnl For the DYNAMIC RPC stuff
-dnl The complicated _YES and _NO stuff allows us to avoid a dependency
-dnl on GNU Make.
-AC_SUBST(LSA_DYNAMIC_YES)
-AC_SUBST(LSA_DYNAMIC_NO)
-LSA_DYNAMIC_YES="#"
-LSA_DYNAMIC_NO=
-AC_SUBST(NETLOG_DYNAMIC_YES)
-AC_SUBST(NETLOG_DYNAMIC_NO)
-NETLOG_DYNAMIC_YES="#"
-NETLOG_DYNAMIC_NO=
-AC_SUBST(SAMR_DYNAMIC_YES)
-AC_SUBST(SAMR_DYNAMIC_NO)
-SAMR_DYNAMIC_YES="#"
-SAMR_DYNAMIC_NO=
-AC_SUBST(SVC_DYNAMIC_YES)
-AC_SUBST(SVC_DYNAMIC_NO)
-SVC_DYNAMIC_YES="#"
-SVC_DYNAMIC_NO=
-AC_SUBST(WKS_DYNAMIC_YES)
-AC_SUBST(WKS_DYNAMIC_NO)
-WKS_DYNAMIC_YES="#"
-WKS_DYNAMIC_NO=
-AC_SUBST(REG_DYNAMIC_YES)
-AC_SUBST(REG_DYNAMIC_NO)
-REG_DYNAMIC_YES="#"
-REG_DYNAMIC_NO=
-AC_SUBST(SPOOLSS_DYNAMIC_YES)
-AC_SUBST(SPOOLSS_DYNAMIC_NO)
-SPOOLSS_DYNAMIC_YES="#"
-SPOOLSS_DYNAMIC_NO=
-AC_SUBST(DFS_DYNAMIC_YES)
-AC_SUBST(DFS_DYNAMIC_NO)
-DFS_DYNAMIC_YES="#"
-DFS_DYNAMIC_NO=
-AC_SUBST(ECHO_DYNAMIC_YES)
-AC_SUBST(ECHO_DYNAMIC_NO)
-ECHO_DYNAMIC_YES="#"
-ECHO_DYNAMIC_NO=
-
-# compile with optimization and without debugging by default
-CFLAGS="-O ${CFLAGS}"
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on compiler debugging information (default=no)],
@@ -227,71 +190,19 @@ then
LIBS="$LIBS -ldmalloc"
fi
-AC_ARG_ENABLE(dynrpc, [ --enable-dynrpc Enable dynamic RPC modules [default=no]])
-
-if test x$enable_dynrpc = xyes
-then
- enable_dynrpc=lsa,samr,reg,wks,netlog,dfs
-fi
-
-if test x$enable_dynrpc != xno
-then
- for i in `echo $enable_dynrpc | sed -e's/,/ /g'`
- do case $i in lsa)
- LSA_DYNAMIC_YES=
- LSA_DYNAMIC_NO="#"
- AC_DEFINE(RPC_LSA_DYNAMIC, 1,
- [Define to make the LSA pipe dynamic])
- ;; samr)
- SAMR_DYNAMIC_YES=
- SAMR_DYNAMIC_NO="#"
- AC_DEFINE(RPC_SAMR_DYNAMIC, 1,
- [Define to make the SAMR pipe dynamic])
- ;; svc)
- SVC_DYNAMIC_YES=
- SVC_DYNAMIC_NO="#"
- AC_DEFINE(RPC_SVC_DYNAMIC, 1,
- [Define to make the SRVSVC pipe dynamic])
- ;; wks)
- WKS_DYNAMIC_YES=
- WKS_DYNAMIC_NO="#"
- AC_DEFINE(RPC_WKS_DYNAMIC, 1,
- [Define to make the WKSSVC pipe dynamic])
- ;; netlog)
- NETLOG_DYNAMIC_YES=
- NETLOG_DYNAMIC_NO="#"
- AC_DEFINE(RPC_NETLOG_DYNAMIC, 1,
- [Define to make the NETLOGON pipe dynamic])
- ;; reg)
- REG_DYNAMIC_YES=
- REG_DYNAMIC_NO="#"
- AC_DEFINE(RPC_REG_DYNAMIC, 1,
- [Define to make the WINREG pipe dynamic])
- ;; spoolss)
- SPOOLSS_DYNAMIC_YES=
- SPOOLSS_DYNAMIC_NO="#"
- AC_DEFINE(RPC_SPOOLSS_DYNAMIC, 1,
- [Define to make the SPOOLSS pipe dynamic])
- ;; dfs)
- DFS_DYNAMIC_YES=
- DFS_DYNAMIC_NO="#"
- AC_DEFINE(RPC_DFS_DYNAMIC, 1,
- [Define to make the NETDFS pipe dynamic])
- ;; echo)
- ECHO_DYNAMIC_YES=
- ECHO_DYNAMIC_NO="#"
- AC_DEFINE(RPC_ECHO_DYNAMIC, 1,
- [Define to make the ECHO pipe dynamic])
- ;; esac
- done
-fi
-
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_AWK
AC_PATH_PROG(PERL, perl)
+# compile with optimization and without debugging by default, but
+# allow people to set their own preference.
+if test "x$CFLAGS" = x
+then
+ CFLAGS="-O ${CFLAGS}"
+fi
+
dnl Check if we use GNU ld
LD=ld
AC_PROG_LD_GNU
@@ -341,7 +252,7 @@ if test "x$enable_developer" = xyes; then
fi
dnl These are preferably build shared, and static if dlopen() is not available
-default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_fake_perms vfs_netatalk"
+default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_netatalk"
#
# Config CPPFLAG settings for strange OS's that must be set
@@ -574,7 +485,7 @@ AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/i
AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
-AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h ldap.h lber.h dlfcn.h)
+AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
AC_CHECK_HEADERS(sys/syslog.h syslog.h execinfo.h)
# In valgrind 1.0.x, it's just valgrind.h. In 1.9.x+ there's a
@@ -1085,7 +996,7 @@ if test "$enable_shared" = "yes"; then
;;
*aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
BLDSHARED="true"
- LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
+ LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
DYNEXP="-Wl,-brtl,-bexpall"
PICFLAG="-O2"
if test "${GCC}" != "yes"; then
@@ -2161,8 +2072,14 @@ fi
AC_MSG_RESULT($with_ads_support)
FOUND_KRB5=no
+KRB5_LIBS=""
if test x"$with_ads_support" = x"yes"; then
+ac_save_CFLAGS="$CFLAGS"
+ac_save_LIBS="$LIBS"
+CFLAGS=""
+LIBS=""
+
#################################################
# check for krb5-config from recent MIT and Heimdal kerberos 5
AC_PATH_PROG(KRB5_CONFIG, krb5-config)
@@ -2319,19 +2236,22 @@ fi
########################################################
# now see if we can find the krb5 libs in standard paths
# or as specified above
- AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
+ AC_CHECK_LIB(krb5, krb5_mk_req_extended, [KRB5_LIBS="$LIBS -lkrb5";
+ KRB5_CFLAGS="$CFLAGS";
AC_DEFINE(HAVE_KRB5,1,[Whether KRB5 is available])])
########################################################
# now see if we can find the gssapi libs in standard paths
- AC_CHECK_LIB(gssapi_krb5, gss_display_status, [LIBS="$LIBS -lgssapi_krb5";
+ AC_CHECK_LIB(gssapi_krb5, gss_display_status, [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5";
AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available])])
+LIBS="$ac_save_LIBS"; CFLAGS="$ac_save_CFLAGS"
fi
########################################################
# Compile with LDAP support?
+LDAP_OBJ=""
with_ldap_support=yes
AC_MSG_CHECKING([whether to use LDAP])
@@ -2346,6 +2266,8 @@ AC_ARG_WITH(ldap,
AC_MSG_RESULT($with_ldap_support)
if test x"$with_ldap_support" = x"yes"; then
+ac_save_LIBS="$LIBS"
+LIBS=""
##################################################################
# we might need the lber lib on some systems. To avoid link errors
@@ -2356,7 +2278,9 @@ if test x"$with_ldap_support" = x"yes"; then
# now see if we can find the ldap libs in standard paths
if test x$have_ldap != xyes; then
AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
+ LDAP_OBJ=lib/ldap.o;
AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])])
+ AC_CHECK_HEADERS([ldap.h lber.h], [default_static_modules="$default_static_modules pdb_ldap"])
########################################################
# If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
@@ -2368,19 +2292,29 @@ if test x"$with_ldap_support" = x"yes"; then
#include <ldap.h>], [ldap_set_rebind_proc(0, 0, 0);], [pam_ldap_cv_ldap_set_rebind_proc=3], [pam_ldap_cv_ldap_set_rebind_proc=2]) ])
AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $pam_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
fi
+
+LDAP_LIBS="$LIBS";
+LIBS="$ac_save_LIBS";
+else
+ # Can't have ADS support without LDAP
+ if test x"$with_ads_support" = x"yes"; then
+ AC_MSG_ERROR(Active directory support requires LDAP)
+ fi
+fi
+
+if test x"$with_ads_support" = x"yes"; then
+ ADSLIBS="$LDAP_LIBS $KRB5_LIBS"
fi
########################################################
# Compile with MySQL support?
-AM_PATH_MYSQL([0.11.0],[MODULE_MYSQL="bin/pdb_mysql.$SHLIBEXT"],[MODULE_MYSQL=])
+AM_PATH_MYSQL([0.11.0],[default_shared_modules="$default_shared_modules pdb_mysql"],[])
CFLAGS="$CFLAGS $MYSQL_CFLAGS"
-AC_SUBST(MODULE_MYSQL)
########################################################
# Compile with XML support?
-AM_PATH_XML2([2.0.0],[MODULE_XML="bin/pdb_xml.$SHLIBEXT"],[MODULE_XML=])
+AM_PATH_XML2([2.0.0],[default_shared_modules="$default_shared_modules pdb_xml"],[])
CFLAGS="$CFLAGS $XML_CFLAGS"
-AC_SUBST(MODULE_XML)
#################################################
# check for automount support
@@ -3427,12 +3361,15 @@ AC_MSG_CHECKING(whether to use included popt)
if test x"$INCLUDED_POPT" = x"yes"; then
AC_MSG_RESULT(yes)
BUILD_POPT='$(POPT_OBJS)'
+ POPTLIBS='$(POPT_OBJS)'
FLAGS1="-I$srcdir/popt"
else
AC_MSG_RESULT(no)
- LIBS="$LIBS -lpopt"
+ BUILD_POPT=""
+ POPTLIBS="-lpopt"
fi
AC_SUBST(BUILD_POPT)
+AC_SUBST(POPTLIBS)
AC_SUBST(FLAGS1)
#################################################
@@ -3540,7 +3477,6 @@ SMB_SUBSYSTEM(AUTH)
SMB_MODULE(vfs_recycle, \$(VFS_RECYCLE_OBJ), "bin/recycle.$SHLIBEXT", VFS)
SMB_MODULE(vfs_audit, \$(VFS_AUDIT_OBJ), "bin/audit.$SHLIBEXT", VFS)
SMB_MODULE(vfs_extd_audit, \$(VFS_EXTD_AUDIT_OBJ), "bin/extd_audit.$SHLIBEXT", VFS)
-SMB_MODULE(vfs_fake_perms, \$(VFS_FAKE_PERMS_OBJ), "bin/fake_perms.$SHLIBEXT", VFS)
SMB_MODULE(vfs_netatalk, \$(VFS_NETATALK_OBJ), "bin/netatalk.$SHLIBEXT", VFS)
SMB_SUBSYSTEM(VFS)
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 9a06764371..756e417814 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -48,7 +48,7 @@
#define SMB_VFS_INTERFACE_VERSION 5
-/* Version of supported cascaded interface backward copmatibility.
+/* Version of supported cascaded interface backward compatibility.
(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.
@@ -77,7 +77,7 @@
is unloaded from smbd process using sys_dlclose().
Prototypes:
- vfs_op_tuple *vfs_init(int *vfs_version, const struct vfs_ops *def_vfs_ops,
+ vfs_op_tuple *vfs_init(const struct vfs_ops *def_vfs_ops,
struct smb_vfs_handle_struct *vfs_handle);
void vfs_done(connection_struct *conn);
diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c
index a56a6bd674..ed808aa1f5 100644
--- a/source3/libsmb/cliquota.c
+++ b/source3/libsmb/cliquota.c
@@ -85,7 +85,7 @@ static BOOL parse_user_quota_record(const char *rdata, unsigned int rdata_count,
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,20) != 0)&&
((qt.usedspace != 0xFFFFFFFF)||
- (IVAL(rdata,20)!=0xFFFFFFFF)))) {
+ (IVAL(rdata,20)!=0xFFFFFFFF))) {
/* more than 32 bits? */
return False;
}
@@ -98,7 +98,7 @@ static BOOL parse_user_quota_record(const char *rdata, unsigned int rdata_count,
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,28) != 0)&&
((qt.softlim != 0xFFFFFFFF)||
- (IVAL(rdata,28)!=0xFFFFFFFF)))) {
+ (IVAL(rdata,28)!=0xFFFFFFFF))) {
/* more than 32 bits? */
return False;
}
@@ -111,7 +111,7 @@ static BOOL parse_user_quota_record(const char *rdata, unsigned int rdata_count,
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,36) != 0)&&
((qt.hardlim != 0xFFFFFFFF)||
- (IVAL(rdata,36)!=0xFFFFFFFF)))) {
+ (IVAL(rdata,36)!=0xFFFFFFFF))) {
/* more than 32 bits? */
return False;
}
@@ -459,7 +459,7 @@ BOOL cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,28) != 0)&&
((qt.softlim != 0xFFFFFFFF)||
- (IVAL(rdata,28)!=0xFFFFFFFF)))) {
+ (IVAL(rdata,28)!=0xFFFFFFFF))) {
/* more than 32 bits? */
goto cleanup;
}
@@ -472,7 +472,7 @@ BOOL cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,36) != 0)&&
((qt.hardlim != 0xFFFFFFFF)||
- (IVAL(rdata,36)!=0xFFFFFFFF)))) {
+ (IVAL(rdata,36)!=0xFFFFFFFF))) {
/* more than 32 bits? */
goto cleanup;
}
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 224c37046c..f05a65762b 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -233,7 +233,7 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
SIVAL(p,0,stype);
p += 4;
- p += push_pstring_base(p, workgroup, param);
+ push_ascii(p, workgroup, sizeof(pstring)-PTR_DIFF(p,param)-1, STR_TERMINATE|STR_UPPER);
if (cli_api(cli,
param, PTR_DIFF(p,param), 8, /* params, length, max */
diff --git a/source3/libsmb/libsmb_cache.c b/source3/libsmb/libsmb_cache.c
index b1620042f3..67dc686b48 100644
--- a/source3/libsmb/libsmb_cache.c
+++ b/source3/libsmb/libsmb_cache.c
@@ -50,8 +50,8 @@ struct smbc_server_cache {
* This function is only used if the external cache is not enabled
*/
static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * new,
- char * server, char * share,
- char * workgroup, char * username)
+ const char * server, const char * share,
+ const char * workgroup, const char * username)
{
struct smbc_server_cache * srvcache = NULL;
@@ -108,8 +108,8 @@ static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * new,
* returns server_fd on success, -1 on error (not found)
* This function is only used if the external cache is not enabled
*/
-static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, char * server,
- char * share, char * workgroup, char * user)
+static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, const char * server,
+ const char * share, const char * workgroup, const char * user)
{
struct smbc_server_cache * srv = NULL;
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 92353d8c30..69c4d8f7a7 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -52,6 +52,87 @@ extern BOOL in_client;
*/
static int smbc_initialized = 0;
+static int
+hex2int( unsigned int _char )
+{
+ if ( _char >= 'A' && _char <='F')
+ return _char - 'A' + 10;
+ if ( _char >= 'a' && _char <='f')
+ return _char - 'a' + 10;
+ if ( _char >= '0' && _char <='9')
+ return _char - '0';
+ return -1;
+}
+
+static void
+decode_urlpart(char *segment, size_t sizeof_segment)
+{
+ int old_length = strlen(segment);
+ int new_length = 0;
+ int new_length2 = 0;
+ int i = 0;
+ pstring new_segment;
+ char *new_usegment = 0;
+
+ if ( !old_length ) {
+ return;
+ }
+
+ /* make a copy of the old one */
+ new_usegment = (char*)malloc( old_length * 3 + 1 );
+
+ while( i < old_length ) {
+ int bReencode = False;
+ unsigned char character = segment[ i++ ];
+ if ((character <= ' ') || (character > 127))
+ bReencode = True;
+
+ new_usegment [ new_length2++ ] = character;
+ if (character == '%' ) {
+ int a = i+1 < old_length ? hex2int( segment[i] ) : -1;
+ int b = i+1 < old_length ? hex2int( segment[i+1] ) : -1;
+ if ((a == -1) || (b == -1)) { /* Only replace if sequence is valid */
+ /* Contains stray %, make sure to re-encode! */
+ bReencode = True;
+ } else {
+ /* Valid %xx sequence */
+ character = a * 16 + b; /* Replace with value of %dd */
+ if (!character)
+ break; /* Stop at %00 */
+
+ new_usegment [ new_length2++ ] = (unsigned char) segment[i++];
+ new_usegment [ new_length2++ ] = (unsigned char) segment[i++];
+ }
+ }
+ if (bReencode) {
+ unsigned int c = character / 16;
+ new_length2--;
+ new_usegment [ new_length2++ ] = '%';
+
+ c += (c > 9) ? ('A' - 10) : '0';
+ new_usegment[ new_length2++ ] = c;
+
+ c = character % 16;
+ c += (c > 9) ? ('A' - 10) : '0';
+ new_usegment[ new_length2++ ] = c;
+ }
+
+ new_segment [ new_length++ ] = character;
+ }
+ new_segment [ new_length ] = 0;
+
+ free(new_usegment);
+
+ /* realloc it with unix charset */
+ pull_utf8_allocate((void**)&new_usegment, new_segment);
+
+ /* this assumes (very safely) that removing %aa sequences
+ only shortens the string */
+ strncpy(segment, new_usegment, sizeof_segment);
+
+ free(new_usegment);
+}
+
/*
* Function to parse a path and turn it into components
*
@@ -97,7 +178,7 @@ smbc_parse_path(SMBCCTX *context, const char *fname, char *server, char *share,
p += 2; /* Skip the // or \\ */
if (*p == (char)0)
- return 0;
+ goto decoding;
if (*p == '/') {
@@ -158,7 +239,7 @@ smbc_parse_path(SMBCCTX *context, const char *fname, char *server, char *share,
}
- if (*p == (char)0) return 0; /* That's it ... */
+ if (*p == (char)0) goto decoding; /* That's it ... */
if (!next_token(&p, share, "/", sizeof(fstring))) {
@@ -167,9 +248,16 @@ smbc_parse_path(SMBCCTX *context, const char *fname, char *server, char *share,
}
pstrcpy(path, p);
-
+
all_string_sub(path, "/", "\\", 0);
+ decoding:
+ decode_urlpart(path, sizeof(pstring));
+ decode_urlpart(server, sizeof(fstring));
+ decode_urlpart(share, sizeof(fstring));
+ decode_urlpart(user, sizeof(fstring));
+ decode_urlpart(password, sizeof(fstring));
+
return 0;
}
@@ -267,15 +355,16 @@ int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv)
*/
SMBCSRV *smbc_server(SMBCCTX *context,
- char *server, char *share,
- char *workgroup, char *username,
- char *password)
+ const char *server, const char *share,
+ fstring workgroup, fstring username,
+ fstring password)
{
SMBCSRV *srv=NULL;
int auth_called = 0;
struct cli_state c;
struct nmb_name called, calling;
- char *p, *server_n = server;
+ char *p;
+ const char *server_n = server;
fstring group;
pstring ipenv;
struct in_addr ip;
@@ -729,27 +818,6 @@ static int smbc_close_ctx(SMBCCTX *context, SMBCFILE *file)
}
- if (!file->file) {
-
- return context->closedir(context, file);
-
- }
-
- if (!cli_close(&file->srv->cli, file->cli_fd)) {
- DEBUG(3, ("cli_close failed on %s. purging server.\n",
- file->fname));
- /* Deallocate slot and remove the server
- * from the server cache if unused */
- errno = smbc_errno(context, &file->srv->cli);
- srv = file->srv;
- DLIST_REMOVE(context->internal->_files, file);
- SAFE_FREE(file->fname);
- SAFE_FREE(file);
- context->callbacks.remove_unused_server_fn(context, srv);
-
- return -1;
- }
-
DLIST_REMOVE(context->internal->_files, file);
SAFE_FREE(file->fname);
SAFE_FREE(file);
@@ -1003,12 +1071,16 @@ static off_t smbc_lseek_ctx(SMBCCTX *context, SMBCFILE *file, off_t offset, int
case SEEK_END:
if (!cli_qfileinfo(&file->srv->cli, file->cli_fd, NULL, &size, NULL, NULL,
- NULL, NULL, NULL) &&
- !cli_getattrE(&file->srv->cli, file->cli_fd, NULL, &size, NULL, NULL,
- NULL)) {
-
+ NULL, NULL, NULL))
+ {
+ SMB_BIG_UINT b_size = size;
+ if (!cli_getattrE(&file->srv->cli, file->cli_fd, NULL, &b_size, NULL, NULL,
+ NULL))
+ {
errno = EINVAL;
return -1;
+ } else
+ size = b_size;
}
file->offset = size + offset;
break;
@@ -1206,12 +1278,15 @@ static int smbc_fstat_ctx(SMBCCTX *context, SMBCFILE *file, struct stat *st)
}
if (!cli_qfileinfo(&file->srv->cli, file->cli_fd,
- &mode, &size, &c_time, &a_time, &m_time, NULL, &ino) &&
- !cli_getattrE(&file->srv->cli, file->cli_fd,
- &mode, &size, &c_time, &a_time, &m_time)) {
+ &mode, &size, &c_time, &a_time, &m_time, NULL, &ino)) {
+ SMB_BIG_UINT b_size = size;
+ if (!cli_getattrE(&file->srv->cli, file->cli_fd,
+ &mode, &b_size, &c_time, &a_time, &m_time)) {
errno = EINVAL;
return -1;
+ } else
+ size = b_size;
}
@@ -1264,6 +1339,13 @@ static int add_dirent(SMBCFILE *dir, const char *name, const char *comment, uint
{
struct smbc_dirent *dirent;
int size;
+ char *u_name = NULL, *u_comment = NULL;
+ size_t u_name_len = 0, u_comment_len = 0;
+
+ if (name)
+ u_name_len = push_utf8_allocate(&u_name, name);
+ if (comment)
+ u_comment_len = push_utf8_allocate(&u_comment, comment);
/*
* Allocate space for the dirent, which must be increased by the
@@ -1271,8 +1353,7 @@ static int add_dirent(SMBCFILE *dir, const char *name, const char *comment, uint
* The null on the name is already accounted for.
*/
- size = sizeof(struct smbc_dirent) + (name?strlen(name):0) +
- (comment?strlen(comment):0) + 1;
+ size = sizeof(struct smbc_dirent) + u_name_len + u_comment_len + 1;
dirent = malloc(size);
@@ -1321,14 +1402,17 @@ static int add_dirent(SMBCFILE *dir, const char *name, const char *comment, uint
dir->dir_end->dirent = dirent;
dirent->smbc_type = type;
- dirent->namelen = (name?strlen(name):0);
- dirent->commentlen = (comment?strlen(comment):0);
+ dirent->namelen = u_name_len;
+ dirent->commentlen = u_comment_len;
dirent->dirlen = size;
- strncpy(dirent->name, (name?name:""), dirent->namelen + 1);
+ strncpy(dirent->name, (u_name?u_name:""), dirent->namelen + 1);
dirent->comment = (char *)(&dirent->name + dirent->namelen + 1);
- strncpy(dirent->comment, (comment?comment:""), dirent->commentlen + 1);
+ strncpy(dirent->comment, (u_comment?u_comment:""), dirent->commentlen + 1);
+
+ SAFE_FREE(u_comment);
+ SAFE_FREE(u_name);
return 0;
@@ -1394,7 +1478,8 @@ dir_list_fn(file_info *finfo, const char *mask, void *state)
static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
{
- fstring server, share, user, password, workgroup;
+ fstring server, share, user, password;
+ pstring workgroup;
pstring path;
SMBCSRV *srv = NULL;
SMBCFILE *dir = NULL;
@@ -1402,29 +1487,29 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
if (!context || !context->internal ||
!context->internal->_initialized) {
-
+ DEBUG(4, ("no valid context\n"));
errno = EINVAL;
return NULL;
}
if (!fname) {
-
+ DEBUG(4, ("no valid fname\n"));
errno = EINVAL;
return NULL;
-
}
if (smbc_parse_path(context, fname, server, share, path, user, password)) {
-
+ DEBUG(4, ("no valid path\n"));
errno = EINVAL;
return NULL;
-
}
+ DEBUG(4, ("parsed path: fname='%s' server='%s' share='%s' path='%s'\n", fname, server, share, path));
+
if (user[0] == (char)0) fstrcpy(user, context->user);
- fstrcpy(workgroup, context->workgroup);
+ pstrcpy(workgroup, context->workgroup);
dir = malloc(sizeof(*dir));
@@ -1445,64 +1530,74 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
dir->dir_list = dir->dir_next = dir->dir_end = NULL;
if (server[0] == (char)0) {
-
+ struct in_addr server_ip;
if (share[0] != (char)0 || path[0] != (char)0) {
-
+
errno = EINVAL;
if (dir) {
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
return NULL;
-
}
/* We have server and share and path empty ... so list the workgroups */
/* first try to get the LMB for our workgroup, and if that fails, */
/* try the DMB */
- if (!(resolve_name(context->workgroup, &rem_ip, 0x1d) ||
- resolve_name(context->workgroup, &rem_ip, 0x1b))) {
-
- errno = EINVAL; /* Something wrong with smb.conf? */
- return NULL;
-
- }
+ pstrcpy(workgroup, lp_workgroup());
- dir->dir_type = SMBC_WORKGROUP;
+ if (!find_master_ip(workgroup, &server_ip)) {
+ struct user_auth_info u_info;
+ struct cli_state *cli;
- /* find the name of the server ... */
+ DEBUG(4, ("Unable to find master browser for workgroup %s\n",
+ workgroup));
- if (!name_status_find("*", 0, 0, rem_ip, server)) {
+ /* find the name of the server ... */
+ pstrcpy(u_info.username, user);
+ pstrcpy(u_info.password, password);
- DEBUG(0,("Could not get the name of local/domain master browser for server %s\n", server));
- errno = EINVAL;
+ if (!(cli = get_ipc_connect_master_ip_bcast(workgroup, &u_info))) {
+ DEBUG(4, ("Unable to find master browser by "
+ "broadcast\n"));
+ errno = ENOENT;
return NULL;
+ }
- }
-
- /*
- * Get a connection to IPC$ on the server if we do not already have one
- */
+ fstrcpy(server, cli->desthost);
- srv = smbc_server(context, server, "IPC$", workgroup, user, password);
+ cli_shutdown(cli);
+ } else {
+ if (!name_status_find("*", 0, 0, server_ip, server)) {
+ errno = ENOENT;
+ return NULL;
+ }
+ }
- if (!srv) {
+ DEBUG(4, ("using workgroup %s %s\n", workgroup, server));
- if (dir) {
- SAFE_FREE(dir->fname);
- SAFE_FREE(dir);
- }
-
- return NULL;
+ /*
+ * Get a connection to IPC$ on the server if we do not already have one
+ */
- }
+ srv = smbc_server(context, server, "IPC$", workgroup, user, password);
+ if (!srv) {
+
+ if (dir) {
+ SAFE_FREE(dir->fname);
+ SAFE_FREE(dir);
+ }
+ return NULL;
+ }
+
dir->srv = srv;
+ dir->dir_type = SMBC_WORKGROUP;
/* Now, list the stuff ... */
- if (!cli_NetServerEnum(&srv->cli, workgroup, 0x80000000, list_fn,
+ if (!cli_NetServerEnum(&srv->cli, workgroup, SV_TYPE_DOMAIN_ENUM, list_fn,
(void *)dir)) {
if (dir) {
@@ -1560,7 +1655,7 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
srv = smbc_server(context, buserver, "IPC$", workgroup, user, password);
if (!srv) {
-
+ DEBUG(0, ("got no contact to IPC$\n"));
if (dir) {
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
@@ -2058,6 +2153,7 @@ static int smbc_rmdir_ctx(SMBCCTX *context, const char *fname)
static off_t smbc_telldir_ctx(SMBCCTX *context, SMBCFILE *dir)
{
+ off_t ret_val; /* Squash warnings about cast */
if (!context || !context->internal ||
!context->internal->_initialized) {
@@ -2081,7 +2177,11 @@ static off_t smbc_telldir_ctx(SMBCCTX *context, SMBCFILE *dir)
}
- return (off_t) dir->dir_next;
+ /*
+ * We return the pointer here as the offset
+ */
+ ret_val = (int)dir->dir_next;
+ return ret_val;
}
@@ -2121,8 +2221,9 @@ struct smbc_dir_list *smbc_check_dir_ent(struct smbc_dir_list *list,
static int smbc_lseekdir_ctx(SMBCCTX *context, SMBCFILE *dir, off_t offset)
{
- struct smbc_dirent *dirent = (struct smbc_dirent *)offset;
- struct smbc_dir_list *list_ent = NULL;
+ long int l_offset = offset; /* Handle problems of size */
+ struct smbc_dirent *dirent = (struct smbc_dirent *)l_offset;
+ struct smbc_dir_list *list_ent = (struct smbc_dir_list *)NULL;
if (!context || !context->internal ||
!context->internal->_initialized) {
@@ -2569,10 +2670,10 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
if (!smbc_initialized) {
/* Do some library wide intialisations the first time we get called */
- /* Do we still need this ? */
- DEBUGLEVEL = 10;
+ /* Set this to what the user wants */
+ DEBUGLEVEL = context->debug;
- setup_logging( "libsmbclient", False);
+ setup_logging( "libsmbclient", True);
/* Here we would open the smb.conf file if needed ... */
@@ -2587,13 +2688,16 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
if (!lp_load(conf, True, False, False)) {
/*
- * Hmmm, what the hell do we do here ... we could not parse the
- * config file ... We must return an error ... and keep info around
- * about why we failed
+ * Well, if that failed, try the dyn_CONFIGFILE
+ * Which points to the standard locn, and if that
+ * fails, silently ignore it and use the internal
+ * defaults ...
*/
-
- errno = ENOENT; /* FIXME: Figure out the correct error response */
- return NULL;
+
+ if (!lp_load(dyn_CONFIGFILE, True, False, False)) {
+ DEBUG(5, ("Could not load either config file: %s or %s\n",
+ conf, dyn_CONFIGFILE));
+ }
}
reopen_logs(); /* Get logging working ... */
@@ -2640,8 +2744,8 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
slprintf(context->netbios_name, 16, "smbc%s%d", context->user, pid);
}
}
- DEBUG(0,("Using netbios name %s.\n", context->netbios_name));
-
+
+ DEBUG(1, ("Using netbios name %s.\n", context->netbios_name));
if (!context->workgroup) {
if (lp_workgroup()) {
@@ -2652,7 +2756,8 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
context->workgroup = strdup("samba");
}
}
- DEBUG(0,("Using workgroup %s.\n", context->workgroup));
+
+ DEBUG(1, ("Using workgroup %s.\n", context->workgroup));
/* shortest timeout is 1 second */
if (context->timeout > 0 && context->timeout < 1000)
diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c
index 1944c98e53..fa9bf67a67 100644
--- a/source3/modules/vfs_audit.c
+++ b/source3/modules/vfs_audit.c
@@ -98,10 +98,9 @@ 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,
+static vfs_op_tuple *audit_init(const struct vfs_ops *def_vfs_ops,
struct smb_vfs_handle_struct *vfs_handle)
{
- *vfs_version = SMB_VFS_INTERFACE_VERSION;
memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops));
audit_handle = vfs_handle;
@@ -111,12 +110,6 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
return audit_ops;
}
-/* VFS finalization function. */
-void vfs_done(connection_struct *conn)
-{
- syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n");
-}
-
/* Implementation of vfs_ops. Pass everything on to the default
operation but log event first. */
@@ -276,3 +269,8 @@ static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode)
return result;
}
+
+int vfs_audit_init(void)
+{
+ return smb_register_vfs("audit", audit_init, SMB_VFS_INTERFACE_VERSION);
+}
diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c
index c75dc1d09c..f60acab36a 100644
--- a/source3/modules/vfs_extd_audit.c
+++ b/source3/modules/vfs_extd_audit.c
@@ -99,10 +99,9 @@ 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,
+static vfs_op_tuple *audit_init(const struct vfs_ops *def_vfs_ops,
struct smb_vfs_handle_struct *vfs_handle)
{
- *vfs_version = SMB_VFS_INTERFACE_VERSION;
memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops));
audit_handle = vfs_handle;
@@ -113,13 +112,6 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
return audit_ops;
}
-/* VFS finalization function. */
-
-void vfs_done(connection_struct *conn)
-{
- syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n");
-}
-
/* Implementation of vfs_ops. Pass everything on to the default
operation but log event first. */
@@ -317,3 +309,8 @@ static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode)
return result;
}
+
+int vfs_extd_audit_init(void)
+{
+ return smb_register_vfs("extd_audit", audit_init, SMB_VFS_INTERFACE_VERSION);
+}
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index b69a900e14..c9e3cde621 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -410,10 +410,9 @@ 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,
+static vfs_op_tuple *netatalk_init(const struct vfs_ops *def_vfs_ops,
struct smb_vfs_handle_struct *vfs_handle)
{
- *vfs_version = SMB_VFS_INTERFACE_VERSION;
memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops));
atalk_handle = vfs_handle;
@@ -422,8 +421,7 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
return atalk_ops;
}
-/* VFS finalization function. */
-void vfs_done(connection_struct *conn)
+int vfs_netatalk_init(void)
{
- DEBUG(3, ("ATALK: vfs module unloaded\n"));
+ return smb_register_vfs("netatalk", netatalk_init, SMB_VFS_INTERFACE_VERSION);
}
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index fd4675cb96..3a23e1a365 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -37,7 +37,7 @@ static const char *delimiter = "|"; /* delimiter for options */
typedef struct recycle_bin_struct
{
- TALLOC_CTX *ctx;
+ 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 */
@@ -48,6 +48,19 @@ typedef struct recycle_bin_struct
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 {
+ 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 */
@@ -69,26 +82,17 @@ static vfs_op_tuple recycle_ops[] = {
{NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
};
-static BOOL check_bool_param(const char *value)
-{
- if (strwicmp(value, "yes") == 0 ||
- strwicmp(value, "true") == 0 ||
- strwicmp(value, "1") == 0)
- return True;
-
- return False;
-}
-
/**
* VFS initialisation function.
*
* @retval initialised vfs_op_tuple array
**/
-vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
+static vfs_op_tuple *recycle_init(const 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) {
@@ -98,41 +102,55 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
DEBUG(0, ("vfs_recycle: Debug class number of 'vfs_recycle': %d\n", vfs_recycle_debug_level));
}
- return recycle_ops;
-}
+ recycle_bin_private_handle = vfs_handle;
+ if (!(mem_ctx = talloc_init("recycle bin data"))) {
+ DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
+ return NULL;
+ }
-/**
- * VFS finalization function.
- *
- **/
-void vfs_done(connection_struct *conn)
-{
- DEBUG(10,("Called for connection %d\n", SNUM(conn)));
+ 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;
+ }
+ ((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;
}
static int recycle_connect(struct connection_struct *conn, const char *service, const char *user)
{
TALLOC_CTX *ctx = NULL;
recycle_bin_struct *recbin;
- char *servicename;
+ recycle_bin_connections *recconn;
+ recycle_bin_connections *recconnbase;
+ recycle_bin_private_data *recdata;
char *tmp_str;
DEBUG(10, ("Called for service %s (%d) as user %s\n", service, SNUM(conn), user));
- if (!(ctx = talloc_init("recycle bin"))) {
+ 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;
+ }
+
+ if (!(ctx = talloc_init("recycle bin connection"))) {
DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
- return 0;
+ return -1;
}
- recbin = talloc(ctx,sizeof(recycle_bin_struct));
- if ( recbin == NULL) {
+ 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->ctx = ctx;
+ recbin->mem_ctx = ctx;
/* Set defaults */
- recbin->repository = talloc_strdup(ctx, ".recycle");
+ recbin->repository = talloc_strdup(recbin->mem_ctx, ".recycle");
ALLOC_CHECK(recbin->repository, error);
recbin->keep_dir_tree = False;
recbin->versions = False;
@@ -143,55 +161,61 @@ static int recycle_connect(struct connection_struct *conn, const char *service,
recbin->maxsize = 0;
/* parse configuration options */
- servicename = talloc_strdup(recbin->ctx, lp_servicename(SNUM(conn)));
- DEBUG(10, ("servicename = %s\n",servicename));
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "repository")) != NULL) {
- recbin->repository = talloc_sub_conn(ctx, conn, tmp_str);
+ 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));
}
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "keeptree")) != NULL) {
- if (check_bool_param(tmp_str) == True)
- recbin->keep_dir_tree = True;
- DEBUG(5, ("recycle.bin: keeptree = %s\n", tmp_str));
- }
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "versions")) != NULL) {
- if (check_bool_param(tmp_str) == True)
- recbin->versions = True;
- DEBUG(5, ("recycle.bin: versions = %s\n", tmp_str));
- }
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "touch")) != NULL) {
- if (check_bool_param(tmp_str) == True)
- recbin->touch = True;
- DEBUG(5, ("recycle.bin: touch = %s\n", tmp_str));
- }
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "maxsize")) != NULL) {
- recbin->maxsize = strtoul(tmp_str, NULL, 10);
- if (recbin->maxsize == 0) {
- recbin->maxsize = -1;
- DEBUG(5, ("recycle.bin: maxsize = -infinite-\n"));
- } else {
- DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize));
- }
+
+ 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"));
+ } else {
+ DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize));
}
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "exclude")) != NULL) {
- recbin->exclude = talloc_strdup(ctx, tmp_str);
+
+ 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(servicename,"vfs_recycle_bin", "exclude_dir")) != NULL) {
- recbin->exclude_dir = talloc_strdup(ctx, tmp_str);
+ 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(servicename,"vfs_recycle_bin", "noversions")) != NULL) {
- recbin->noversions = talloc_strdup(ctx, tmp_str);
+ 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));
}
- conn->vfs_private = (void *)recbin;
+ 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;
+ }
return default_vfs_ops.connect(conn, service, user);
error:
@@ -201,10 +225,35 @@ error:
static void recycle_disconnect(struct connection_struct *conn)
{
+ recycle_bin_private_data *recdata;
+ recycle_bin_connections *recconn;
+
DEBUG(10, ("Disconnecting VFS module recycle bin\n"));
- if (conn->vfs_private) {
- talloc_destroy(((recycle_bin_struct *)conn->vfs_private)->ctx);
- conn->vfs_private = NULL;
+
+ if (recycle_bin_private_handle)
+ recdata = (recycle_bin_private_data *)(recycle_bin_private_handle->data);
+ else {
+ DEBUG(0, ("Recycle bin not initialized!\n"));
+ 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);
}
@@ -389,26 +438,35 @@ static void recycle_touch(connection_struct *conn, const char *fname)
/**
* Check if file should be recycled
**/
-static int recycle_unlink(connection_struct *conn, const char *inname)
+static int recycle_unlink(connection_struct *conn, const char *file_name)
{
+ 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;
+ const char *base;
int i;
- SMB_BIG_UINT dfree, dsize, bsize;
- SMB_OFF_T file_size, space_avail;
+/* SMB_BIG_UINT dfree, dsize, bsize; */
+ SMB_OFF_T file_size; /* space_avail; */
BOOL exist;
int rc = -1;
- file_name = strdup(inname);
- ALLOC_CHECK(file_name, done);
-
- if (conn->vfs_private)
- recbin = (recycle_bin_struct *)conn->vfs_private;
- else {
+ 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;
@@ -514,10 +572,9 @@ static int recycle_unlink(connection_struct *conn, const char *inname)
}
}
- final_name = (char *)malloc(PATH_MAX);
+ asprintf(&final_name, "%s/%s", temp_name, base);
ALLOC_CHECK(final_name, done);
- snprintf(final_name, PATH_MAX, "%s/%s", temp_name, base);
- DEBUG(10, ("recycle.bin: recycled file name%s\n", temp_name)); /* new filename with path */
+ DEBUG(10, ("recycle.bin: recycled file name: %s\n", temp_name)); /* new filename with path */
/* check if we should delete file from recycle bin */
if (recycle_file_exist(conn, final_name)) {
@@ -548,9 +605,13 @@ static int recycle_unlink(connection_struct *conn, const char *inname)
recycle_touch(conn, final_name);
done:
- SAFE_FREE(file_name);
SAFE_FREE(path_name);
SAFE_FREE(temp_name);
SAFE_FREE(final_name);
return rc;
}
+
+int vfs_recycle_init(void)
+{
+ return smb_register_vfs("recycle", recycle_init, SMB_VFS_INTERFACE_VERSION);
+}
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 38fa2e0237..b6c7aa1076 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -201,15 +201,18 @@ void conn_free(connection_struct *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);
+ /* Only call dlclose for the old modules */
+ if (handle->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);
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 533c64b229..06aca51322 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -27,6 +27,13 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
+struct vfs_init_function_entry {
+ char *name;
+ vfs_op_tuple *ops, *(*init)(const struct vfs_ops *, struct smb_vfs_handle_struct *);
+ struct vfs_init_function_entry *prev, *next;
+};
+
+static struct vfs_init_function_entry *backends = NULL;
/* Some structures to help us initialise the vfs operations table */
@@ -128,6 +135,59 @@ static struct vfs_ops default_vfs_ops = {
};
/****************************************************************************
+ maintain the list of available backends
+****************************************************************************/
+
+static struct vfs_init_function_entry *vfs_find_backend_entry(const char *name)
+{
+ struct vfs_init_function_entry *entry = backends;
+ pstring stripped;
+
+ module_path_get_name(name, stripped);
+
+ while(entry) {
+ if (strequal(entry->name, stripped)) return entry;
+ entry = entry->next;
+ }
+
+ return NULL;
+}
+
+BOOL smb_register_vfs(const char *name, vfs_op_tuple *(*init)(const struct vfs_ops *, struct smb_vfs_handle_struct *), int version)
+{
+ struct vfs_init_function_entry *entry = backends;
+
+ if ((version < SMB_VFS_INTERFACE_CASCADED)) {
+ DEBUG(0, ("vfs_init() returned wrong interface version info (was %d, should be no less than %d)\n",
+ version, SMB_VFS_INTERFACE_VERSION ));
+ return False;
+ }
+
+ if ((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",
+ version, SMB_VFS_INTERFACE_VERSION, version ));
+ return False;
+ }
+
+ while(entry) {
+ if (strequal(entry->name, name)) {
+ DEBUG(0,("VFS module %s already loaded!\n", name));
+ return False;
+ }
+ entry = entry->next;
+ }
+
+ entry = smb_xmalloc(sizeof(struct vfs_init_function_entry));
+ entry->name = smb_xstrdup(name);
+ entry->init = init;
+
+ DLIST_ADD(backends, entry);
+ DEBUG(5, ("Successfully added vfs backend '%s'\n", name));
+ return True;
+}
+
+/****************************************************************************
initialise default vfs hooks
****************************************************************************/
@@ -139,23 +199,19 @@ static void vfs_init_default(connection_struct *conn)
conn->vfs_private = NULL;
}
-/****************************************************************************
- initialise custom vfs hooks
-****************************************************************************/
+/***************************************************************************
+ Function to load old VFS modules. Should go away after a while.
+ **************************************************************************/
-BOOL vfs_init_custom(connection_struct *conn, const char *vfs_object)
+static vfs_op_tuple *vfs_load_old_plugin(connection_struct *conn, const char *vfs_object)
{
int vfs_version = -1;
- vfs_op_tuple *ops, *(*init_fptr)(int *, const struct vfs_ops *, struct smb_vfs_handle_struct *);
- int i;
-
- DEBUG(3, ("Initialising custom vfs hooks from %s\n", vfs_object));
-
+ vfs_op_tuple *ops, *(*init_fptr)(int *, const struct vfs_ops *, struct smb_vfs_handle_struct *);
/* Open object file */
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;
+ return NULL;
}
/* Get handle on vfs_init() symbol */
@@ -165,32 +221,73 @@ BOOL vfs_init_custom(connection_struct *conn, const char *vfs_object)
if (init_fptr == NULL) {
DEBUG(0, ("No vfs_init() symbol found in %s\n", vfs_object));
sys_dlclose(conn->vfs_private->handle);
- return False;
+ return NULL;
}
/* 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));
+ if ((ops = init_fptr(&vfs_version, &conn->vfs_ops, conn->vfs_private)) == NULL) {
+ DEBUG(0, ("vfs_init() function from %s failed\n", vfs_object));
sys_dlclose(conn->vfs_private->handle);
- 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 NULL;
+ }
+
+ 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 ));
sys_dlclose(conn->vfs_private->handle);
- 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 NULL;
+ }
+
+ 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 ));
sys_dlclose(conn->vfs_private->handle);
- return False;
- }
-
+ return NULL;
+ }
+
+ return ops;
+}
+
+
+
+/****************************************************************************
+ initialise custom vfs hooks
+ ****************************************************************************/
+
+BOOL vfs_init_custom(connection_struct *conn, const char *vfs_object)
+{
+ vfs_op_tuple *ops;
+ int i;
+ struct vfs_init_function_entry *entry;
+
+ DEBUG(3, ("Initialising custom vfs hooks from %s\n", vfs_object));
+
+ if(!backends) static_init_vfs;
+
+ /* First, try to load the module with the new module system */
+ if((entry = vfs_find_backend_entry(vfs_object)) ||
+ (smb_probe_module("vfs", vfs_object) &&
+ (entry = vfs_find_backend_entry(vfs_object)))) {
+
+ DEBUG(3,("Successfully loaded %s with the new modules system\n", vfs_object));
+
+ if ((ops = entry->init(&conn->vfs_ops, conn->vfs_private)) == NULL) {
+ DEBUG(0, ("vfs init function from %s failed\n", vfs_object));
+ return False;
+ }
+ } else {
+ /* If that doesn't work, fall back to the old system
+ * (This part should go away after a while, it's only here
+ * for backwards compatibility) */
+ DEBUG(2, ("Can't load module %s with new modules system, falling back to compatibility\n",
+ vfs_object));
+ if ((ops = vfs_load_old_plugin(conn, vfs_object)) == NULL) {
+ DEBUG(0, ("vfs init function from %s failed\n", vfs_object));
+ 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) {
@@ -215,54 +312,50 @@ Proceeding in compatibility mode, new operations (since version #%d) will fallba
BOOL smbd_vfs_init(connection_struct *conn)
{
- char **vfs_objects, *vfsobj, *vfs_module, *vfs_path;
- int nobj, i;
+ const char **vfs_objects;
+ char *vfs_module, *vfs_path;
+ unsigned int i = 0;
+ int j = 0;
struct smb_vfs_handle_struct *handle;
/* Normal share - initialise with disk access functions */
vfs_init_default(conn);
+ vfs_objects = lp_vfsobj(SNUM(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;
+ if (!vfs_objects)
+ return True;
+
+ 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;
+ }
+
+ vfs_path = lp_vfs_path(SNUM(conn));
+
+ for (i=0; vfs_objects[i]; i++); /* count passed modules */
+
+ for (j=i-1; j >= 0; j--) {
+ conn->vfs_private = NULL;
+ 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 && *vfs_path) {
+ asprintf(&vfs_module, "%s/%s", vfs_path, vfs_objects[j]);
+ } else {
+ asprintf(&vfs_module, "%s", vfs_objects[j]);
}
- 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);
- DLIST_REMOVE(conn->vfs_private, handle);
- SAFE_FREE(handle);
- return False;
- }
- SAFE_FREE(vfs_module);
- }
- }
- string_free(&vfsobj);
- return True;
+ if (!vfs_init_custom(conn, vfs_module)) {
+ DEBUG(0, ("smbd_vfs_init: vfs_init_custom failed for %s\n", vfs_module));
+ SAFE_FREE(vfs_module);
+ DLIST_REMOVE(conn->vfs_private, handle);
+ SAFE_FREE(handle);
+ return False;
}
+ SAFE_FREE(vfs_module);
}
return True;
}