s3-build: Provide a run-time shim to work around duplicate symbols
authorAndrew Bartlett <abartlet@samba.org>
Tue, 31 May 2011 03:18:37 +0000 (13:18 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 21 Jun 2011 05:54:51 +0000 (15:54 +1000)
The become_root() and similar 'smbd' functions that are used widely in
Samba libraries had 'dummy' copies in dummysmbd.c and dummyroot.c.

These have been replaced by a runtime plugin mechanim, which ensures
that standlone binaries still do nothing, while in smbd the correct
function is used.

This avoids having these as duplicate symbols in the smbd binary,
which can cause unpredictable behaviour.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
13 files changed:
source3/Makefile.in
source3/lib/dummyroot.c [deleted file]
source3/lib/smbd_shim.c [moved from source3/lib/dummysmbd.c with 62% similarity]
source3/lib/smbd_shim.h [new file with mode: 0644]
source3/pam_smbpass/wscript_build
source3/smbd/blocking.c
source3/smbd/dir.c
source3/smbd/globals.c
source3/smbd/oplock.c
source3/smbd/proto.h
source3/smbd/statcache.c
source3/smbd/uid.c
source3/wscript_build

index 7a471dde4e488e680974b4852b209baed0904d9c..31d170d34d541db9602af53f8f1e2254fc5f7b78 100644 (file)
@@ -486,7 +486,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \
          ../libcli/security/security_token.o ../libcli/security/util_sid.o \
          ../libcli/smb/util.o
 
-LIB_DUMMY_OBJ = lib/dummysmbd.o lib/dummyparam.o lib/dummyroot.o
+LIB_DUMMY_OBJ = lib/smbd_shim.o lib/dummyparam.o
 LIB_NONSMBD_OBJ = $(LIB_OBJ) $(LIB_DUMMY_OBJ)
 
 READLINE_OBJ = ../libcli/smbreadline/smbreadline.o
@@ -907,6 +907,7 @@ SMBD_OBJ_SRV = smbd/server_reload.o \
               lib/sysquotas.o lib/sysquotas_linux.o \
               lib/sysquotas_xfs.o lib/sysquotas_4A.o \
               lib/sysquotas_nfs.o \
+              lib/smbd_shim.o \
               smbd/fake_file.o \
               smbd/quotas.o smbd/ntquotas.o $(AFS_OBJ) smbd/msdfs.o \
               $(AFS_SETTOKEN_OBJ) smbd/aio.o smbd/statvfs.o \
diff --git a/source3/lib/dummyroot.c b/source3/lib/dummyroot.c
deleted file mode 100644 (file)
index 64ea758..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   RPC pipe client
-
-   Copyright (C) Tim Potter 2003
-
-   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 3 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, see <http://www.gnu.org/licenses/>.
-*/
-
-/* Stupid dummy functions required due to the horrible dependency mess
-   in Samba. */
-
-#include "includes.h"
-
-void become_root(void)
-{
-        return;
-}
-
-void unbecome_root(void)
-{
-        return;
-}
similarity index 62%
rename from source3/lib/dummysmbd.c
rename to source3/lib/smbd_shim.c
index 541b59e0ccda9329f13447cb26de0a036fa7cc23..72ae366ec36e74e3eb30b52fbc710344affe1387 100644 (file)
@@ -3,6 +3,7 @@
    RPC pipe client
 
    Copyright (C) Gerald (Jerry) Carter          2004.
+   Copyright (C) Andrew Bartlett                2011.
 
    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
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-/* Stupid dummy functions required due to the horrible dependency mess
+/* Shim functions required due to the horrible dependency mess
    in Samba. */
 
 #include "includes.h"
+#include "smbd_shim.h"
+#include "smbd/proto.h"
+
+static struct smbd_shim shim;
+
+void set_smbd_shim(const struct smbd_shim *shim_functions)
+{
+       shim = *shim_functions;
+}
 
 void cancel_pending_lock_requests_by_fid(files_struct *fsp,
                        struct byte_range_lock *br_lck,
                        enum file_close_type close_type)
 {
+       if (shim.cancel_pending_lock_requests_by_fid) {
+
+               shim.cancel_pending_lock_requests_by_fid(fsp, br_lck, close_type);
+       }
 }
 
 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
                                    const char *name)
 {
+       if (shim.send_stat_cache_delete_message) {
+               shim.send_stat_cache_delete_message(msg_ctx, name);
+       }
 }
 
 NTSTATUS can_delete_directory(struct connection_struct *conn,
                                const char *dirname)
 {
+       if (shim.can_delete_directory) {
+               return shim.can_delete_directory(conn, dirname);
+       }
        return NT_STATUS_OK;
 }
 
 bool change_to_root_user(void)
 {
+       if (shim.change_to_root_user) {
+               return shim.change_to_root_user();
+       }
        return false;
 }
 
@@ -55,11 +78,33 @@ bool change_to_root_user(void)
 void contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type)
 {
+       if (shim.contend_level2_oplocks_begin) {
+               shim.contend_level2_oplocks_begin(fsp, type);
+       }
        return;
 }
 
 void contend_level2_oplocks_end(files_struct *fsp,
                                enum level2_contention_type type)
 {
+       if (shim.contend_level2_oplocks_end) {
+               shim.contend_level2_oplocks_end(fsp, type);
+       }
+       return;
+}
+
+void become_root(void)
+{
+       if (shim.become_root) {
+               shim.become_root();
+       }
+        return;
+}
+
+void unbecome_root(void)
+{
+       if (shim.unbecome_root) {
+               shim.unbecome_root();
+       }
        return;
 }
diff --git a/source3/lib/smbd_shim.h b/source3/lib/smbd_shim.h
new file mode 100644 (file)
index 0000000..415f81b
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+   Unix SMB/CIFS implementation.
+   RPC pipe client
+
+   Copyright (C) Gerald (Jerry) Carter          2004.
+   Copyright (C) Andrew Bartlett                2011.
+
+   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 3 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, see <http://www.gnu.org/licenses/>.
+*/
+
+/* Shim functions required due to the horrible dependency mess
+   in Samba. */
+
+struct smbd_shim
+{
+       void (*cancel_pending_lock_requests_by_fid)(files_struct *fsp,
+                                                   struct byte_range_lock *br_lck,
+                                                   enum file_close_type close_type);
+       void (*send_stat_cache_delete_message)(struct messaging_context *msg_ctx,
+                                              const char *name);
+
+       NTSTATUS (*can_delete_directory)(struct connection_struct *conn,
+                                        const char *dirname);
+
+       bool (*change_to_root_user)(void);
+
+       void (*contend_level2_oplocks_begin)(files_struct *fsp,
+                                            enum level2_contention_type type);
+       
+       void (*contend_level2_oplocks_end)(files_struct *fsp,
+                                          enum level2_contention_type type);
+
+       void (*become_root)(void);
+
+       void (*unbecome_root)(void);
+};
+
+void set_smbd_shim(const struct smbd_shim *shim_functions);
+
+
index 8c15d71800a50e749c143cd33ba1351ecea66d7b..200482c7cf401b816d3483849d2d9bec4686b115 100644 (file)
@@ -6,7 +6,7 @@ if bld.CONFIG_SET('WITH_PAM_MODULES'):
                   pam_smb_passwd.c
                   pam_smb_acct.c
                   support.c''',
-        deps='''tdb talloc pam PAM_ERRORS wbclient cap asn1util param LIB_NONSMBD passdb SMBLDAP
+        deps='''tdb talloc pam PAM_ERRORS wbclient cap asn1util param passdb SMBLDAP
                 LIBNTLMSSP LIBTSOCKET''',
         cflags='-DLOCALEDIR=\"%s/locale\"' % bld.env.DATADIR,
         realname='pam_smbpass.so',
index fd77e3d15bd74a1f7b722a238c0f4c7745d23fff..d9c1fb2d3b3a2e480dd9be54752fcd67dfb9f0c7 100644 (file)
@@ -574,9 +574,9 @@ static bool blocking_lock_record_process(struct blocking_lock_record *blr)
  Called when a file is closed.
 *****************************************************************************/
 
-void cancel_pending_lock_requests_by_fid(files_struct *fsp,
-                       struct byte_range_lock *br_lck,
-                       enum file_close_type close_type)
+void smbd_cancel_pending_lock_requests_by_fid(files_struct *fsp,
+                                             struct byte_range_lock *br_lck,
+                                             enum file_close_type close_type)
 {
        struct smbd_server_connection *sconn = fsp->conn->sconn;
        struct blocking_lock_record *blr, *blr_cancelled, *next = NULL;
index c547cd2afab29c9d2e4390f2c49787451f76a529..fda7c34c5783306dfcea380fded215c6fb46e482 100644 (file)
@@ -1625,8 +1625,8 @@ bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset)
  Is this directory empty ?
 *****************************************************************/
 
-NTSTATUS can_delete_directory(struct connection_struct *conn,
-                               const char *dirname)
+NTSTATUS smbd_can_delete_directory(struct connection_struct *conn,
+                                  const char *dirname)
 {
        NTSTATUS status = NT_STATUS_OK;
        long dirpos = 0;
index b3cf0bd7d2959edb17207213929e6b972e3f4277..2736fa69d0be7adeb4a35a3ba6cc0239df5956a8 100644 (file)
@@ -20,6 +20,7 @@
 #include "includes.h"
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
+#include "lib/smbd_shim.h"
 #include "memcache.h"
 #include "messages.h"
 #include "tdb_compat.h"
@@ -145,9 +146,24 @@ struct memcache *smbd_memcache(void)
        return smbd_memcache_ctx;
 }
 
+static const struct smbd_shim smbd_shim_fns = 
+{
+       .cancel_pending_lock_requests_by_fid = smbd_cancel_pending_lock_requests_by_fid,
+       .send_stat_cache_delete_message = smbd_send_stat_cache_delete_message,
+       .can_delete_directory = smbd_can_delete_directory,
+       .change_to_root_user = smbd_change_to_root_user,
+       
+       .contend_level2_oplocks_begin = smbd_contend_level2_oplocks_begin,
+       .contend_level2_oplocks_end = smbd_contend_level2_oplocks_end,
+
+       .become_root = smbd_become_root,
+       .unbecome_root = smbd_unbecome_root
+};
 
 void smbd_init_globals(void)
 {
+       set_smbd_shim(&smbd_shim_fns);
+
        ZERO_STRUCT(conn_ctx_stack);
 
        ZERO_STRUCT(sec_ctx_stack);
index 56481e97000fe3d2066e4cf33d56b935269e3478..284b0321aa8102d07a55de831e1530339d7db15d 100644 (file)
@@ -849,7 +849,7 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
        TALLOC_FREE(lck);
 }
 
-void contend_level2_oplocks_begin(files_struct *fsp,
+void smbd_contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type)
 {
        if (koplocks && koplocks->ops->contend_level2_oplocks_begin) {
@@ -860,7 +860,7 @@ void contend_level2_oplocks_begin(files_struct *fsp,
        contend_level2_oplocks_begin_default(fsp, type);
 }
 
-void contend_level2_oplocks_end(files_struct *fsp,
+void smbd_contend_level2_oplocks_end(files_struct *fsp,
                                enum level2_contention_type type)
 {
        /* Only kernel oplocks implement this so far */
index 6e515278b4924c13092e3160076a874c108d4233..adeaf688996ec22dfbb9e2c6a5dff727077a4574 100644 (file)
@@ -110,6 +110,9 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
                uint64_t offset,
                uint64_t count,
                uint64_t blocking_smblctx);
+void smbd_cancel_pending_lock_requests_by_fid(files_struct *fsp,
+                       struct byte_range_lock *br_lck,
+                       enum file_close_type close_type);
 void cancel_pending_lock_requests_by_fid(files_struct *fsp,
                        struct byte_range_lock *br_lck,
                        enum file_close_type close_type);
@@ -236,6 +239,8 @@ void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
 bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
 NTSTATUS can_delete_directory(struct connection_struct *conn,
                                const char *dirname);
+NTSTATUS smbd_can_delete_directory(struct connection_struct *conn,
+                               const char *dirname);
 
 /* The following definitions come from smbd/dmapi.c  */
 
@@ -670,6 +675,10 @@ void contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type);
 void contend_level2_oplocks_end(files_struct *fsp,
                                enum level2_contention_type type);
+void smbd_contend_level2_oplocks_begin(files_struct *fsp,
+                                 enum level2_contention_type type);
+void smbd_contend_level2_oplocks_end(files_struct *fsp,
+                               enum level2_contention_type type);
 void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
 void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
 bool init_oplocks(struct messaging_context *msg_ctx);
@@ -1046,6 +1055,8 @@ bool stat_cache_lookup(connection_struct *conn,
                        char **pp_dirpath,
                        char **pp_start,
                        SMB_STRUCT_STAT *pst);
+void smbd_send_stat_cache_delete_message(struct messaging_context *msg_ctx,
+                                   const char *name);
 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
                                    const char *name);
 void stat_cache_delete(const char *name);
@@ -1106,10 +1117,13 @@ bool change_to_user(connection_struct *conn, uint16 vuid);
 bool change_to_user_by_session(connection_struct *conn,
                               const struct auth_serversupplied_info *session_info);
 bool change_to_root_user(void);
+bool smbd_change_to_root_user(void);
 bool become_authenticated_pipe_user(struct auth_serversupplied_info *session_info);
 bool unbecome_authenticated_pipe_user(void);
 void become_root(void);
 void unbecome_root(void);
+void smbd_become_root(void);
+void smbd_unbecome_root(void);
 bool become_user(connection_struct *conn, uint16 vuid);
 bool become_user_by_session(connection_struct *conn,
                            const struct auth_serversupplied_info *session_info);
index b0904c9ff719dd132e42f4a77d5c18279aaff4ec..963b7c4bc1321bdcebb16ba7294e708cb4d8475d 100644 (file)
@@ -340,8 +340,8 @@ bool stat_cache_lookup(connection_struct *conn,
  Tell all smbd's to delete an entry.
 **************************************************************************/
 
-void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
-                                   const char *name)
+void smbd_send_stat_cache_delete_message(struct messaging_context *msg_ctx,
+                                        const char *name)
 {
 #ifdef DEVELOPER
        message_send_all(msg_ctx,
index fb05a6ce9853bb9252f7e326d1a2e6602b7db597..285b158a191c6af78f58edc166ffe4a75ae57ad5 100644 (file)
@@ -345,7 +345,7 @@ bool change_to_user_by_session(connection_struct *conn,
  but modify the current_user entries.
 ****************************************************************************/
 
-bool change_to_root_user(void)
+bool smbd_change_to_root_user(void)
 {
        set_root_sec_ctx();
 
@@ -441,7 +441,7 @@ static void pop_conn_ctx(void)
  restores the connection context.
 ****************************************************************************/
 
-void become_root(void)
+void smbd_become_root(void)
 {
         /*
          * no good way to handle push_sec_ctx() failing without changing
@@ -456,7 +456,7 @@ void become_root(void)
 
 /* Unbecome the root user */
 
-void unbecome_root(void)
+void smbd_unbecome_root(void)
 {
        pop_sec_ctx();
        pop_conn_ctx();
index 12f5fe99a6bef12707c5525ad08a53e3ba842437..7c914b876e851a5d8544782ed601094ad33bd06c 100755 (executable)
@@ -88,9 +88,6 @@ LIB_SRC = '''
           libads/krb5_errs.c lib/system_smbd.c lib/audit.c
           lib/file_id.c lib/idmap_cache.c'''
 
-LIB_DUMMY_SRC = '''lib/dummysmbd.c lib/dummyroot.c'''
-LIB_NONSMBD_SRC = '''${LIB_DUMMY_SRC}'''
-
 POPT_LIB_SRC = '''lib/popt_common.c'''
 
 PARAM_UTIL_SRC = '''param/util.c'''
@@ -661,7 +658,7 @@ bld.SAMBA3_LIBRARY('rpc_client',
 
 bld.SAMBA3_LIBRARY('netapi',
                     source=LIBNETAPI_SRC,
-                    public_deps='''talloc tdb_compat cap wbclient LIB_NONSMBD LIBSMB KRBCLIENT
+                    public_deps='''talloc tdb_compat cap wbclient smbd_shim LIBSMB KRBCLIENT
                     passdb SMBLDAP PARAM_WITHOUT_REG samba-util
                     LIBMSRPC_GEN msrpc3 ads LIBNET DCUTIL NDR_LIBNETAPI
                     RPC_CLIENT_SCHANNEL smbconf REG_SMBCONF TOKEN_UTIL
@@ -674,7 +671,7 @@ bld.SAMBA3_LIBRARY('netapi',
 
 bld.SAMBA3_LIBRARY('libsmb/smbclient',
                     source=LIBSMBCLIENT_SRC,
-                    public_deps='''talloc tdb_compat wbclient cap param LIB_NONSMBD LIBSMB KRBCLIENT passdb SMBLDAP
+                    public_deps='''talloc tdb_compat wbclient cap param  smbd_shim LIBSMB KRBCLIENT passdb SMBLDAP
                     LIBMSRPC_GEN msrpc3 LIBCLI_LSA3 RPC_NDR_SRVSVC POPT_SAMBA3''',
                     public_headers='include/libsmbclient.h',
                     vnum='0',
@@ -690,7 +687,7 @@ bld.SAMBA3_LIBRARY('smbsharemodes',
 
 bld.SAMBA3_LIBRARY('nss_wins',
                   source=WINBIND_WINS_NSS_SRC,
-                  deps='''winbind-client param LIBSMB LIB_NONSMBD LIBTSOCKET KRBCLIENT
+                  deps='''winbind-client param LIBSMB smbd_shim LIBTSOCKET KRBCLIENT
                   cap wbclient''',
                   realname='libnss_wins.so.2',
                   vnum='2')
@@ -770,7 +767,7 @@ bld.SAMBA3_SUBSYSTEM('REG_API_REGF',
 
 bld.SAMBA3_LIBRARY('smbregistry',
                    source=REG_BASE_SRC,
-                   deps='''LIB_NONSMBD tdb-wrap3 NDR_SECURITY UTIL_TDB talloc
+                   deps='''smbd_shim tdb-wrap3 NDR_SECURITY UTIL_TDB talloc
                    replace util_reg samba-util security
                    errors3 adt_tree dbwrap_util util_str util_sec''',
                    vars=locals(),
@@ -802,9 +799,10 @@ bld.SAMBA3_SUBSYSTEM('samba3core',
                    deps='LIBCRYPTO ndr security NDR_SECURITY samba-util NDR_MESSAGING LIBASYNC_REQ tdb-wrap3 UTIL_TDB UTIL_PW SAMBA_VERSION KRB5_WRAP flag_mapping util_reg PTHREADPOOL interfaces cap string_init param util_str CHARSET3 namearray SECRETS3 dbwrap_util util_sec util_malloc memcache ccan',
                    vars=locals())
 
-bld.SAMBA3_SUBSYSTEM('LIB_NONSMBD',
-                    source=LIB_NONSMBD_SRC,
-                    vars=locals())
+bld.SAMBA3_LIBRARY('smbd_shim',
+                   source='''lib/smbd_shim.c''', 
+                   private_library=True,
+                   allow_undefined_symbols=False)
 
 bld.SAMBA3_SUBSYSTEM('LIBSMB_ERR',
                     source='',
@@ -894,6 +892,7 @@ bld.SAMBA3_LIBRARY('smbd_base',
                     LIBCLI_SAMR LIBCLI_LSA3 LIBRPCCLI_NETLOGON LIBCLI_SPOOLSS
                     RPC_NDR_SRVSVC npa_tstream INIT_NETLOGON INIT_SAMR
                     LIBCLI_SMB_COMMON RPC_SERVER smbd_conn param_service
+                    smbd_shim
                     ''',
                     private_library=True,
                    allow_undefined_symbols=False,
@@ -1116,7 +1115,7 @@ bld.SAMBA3_BINARY('smbd/smbd',
 bld.SAMBA3_BINARY('nmbd/nmbd',
                  source=NMBD_SRC,
                  deps='''talloc tdb_compat tevent z cap wbclient dl
-                 passdb param ldap LIB_NONSMBD LIBSMB
+                 passdb param ldap smbd_shim LIBSMB
                  POPT_SAMBA3 KRBCLIENT NDR_SAMR NDR_LSA PROFILE''',
                  install_path='${SBINDIR}',
                  vars=locals())
@@ -1124,7 +1123,7 @@ bld.SAMBA3_BINARY('nmbd/nmbd',
 bld.SAMBA3_BINARY('winbindd/winbindd',
                  source=WINBINDD_SRC,
                  deps='''talloc tdb_compat tevent cap dl z
-                 wbclient passdb ldap param LIB_NONSMBD LIBSMB
+                 wbclient passdb ldap param smbd_shim LIBSMB
                  POPT_SAMBA3 KRBCLIENT LIBMSRPC_GEN msrpc3 ads LIBADS_SERVER
                  SRV_NDR_WBINT RPC_NDR_WBINT NDR_WBINT LIBAFS
                  LIBAFS_SETTOKEN PROFILE SLCACHE DCUTIL idmap nss_info
@@ -1141,7 +1140,7 @@ bld.SAMBA3_BINARY('winbindd/winbindd',
 bld.SAMBA3_BINARY('web/swat',
                  source=SWAT_SRC,
                  deps='''talloc tevent cap samba3core LIBSMB wbclient param
-                 LIB_NONSMBD passdb POPT_SAMBA3 KRBCLIENT cups
+                 smbd_shim passdb POPT_SAMBA3 KRBCLIENT cups
                  LIBMSRPC_GEN msrpc3 LOCKING PLAINTEXT_AUTH PRINTBASE PRINTING FNAME_UTIL
                  LIBCLI_SAMR INIT_LSA PASSCHANGE''',
                  enabled=bld.env.build_swat,
@@ -1150,7 +1149,7 @@ bld.SAMBA3_BINARY('web/swat',
 
 bld.SAMBA3_BINARY('rpcclient/rpcclient',
                  source=RPCCLIENT_SRC,
-                 deps='''talloc tdb_compat cap POPT_SAMBA3 passdb LIBSMB LIB_NONSMBD
+                 deps='''talloc tdb_compat cap POPT_SAMBA3 passdb LIBSMB smbd_shim
                  PARAM_WITHOUT_REG wbclient param KRBCLIENT LIBMSRPC_GEN msrpc3
                  ads SMBREADLINE DCUTIL RPC_NDR_WINREG RPC_NDR_ECHO
                  RPC_CLIENT_SCHANNEL
@@ -1163,7 +1162,7 @@ bld.SAMBA3_BINARY('rpcclient/rpcclient',
 
 bld.SAMBA3_BINARY('client/smbclient' + bld.env.suffix3,
                  source=CLIENT_SRC,
-                 deps='''talloc tdb_compat cap POPT_SAMBA3 passdb LIBSMB LIB_NONSMBD
+                 deps='''talloc tdb_compat cap POPT_SAMBA3 passdb LIBSMB smbd_shim
                  PARAM_WITHOUT_REG wbclient param KRBCLIENT LIBMSRPC_GEN
                  msrpc3 SMBREADLINE libsmb/smbclient RPC_NDR_SRVSVC INIT_LSA
                  LIBCLI_SMB_COMMON''',
@@ -1171,7 +1170,7 @@ bld.SAMBA3_BINARY('client/smbclient' + bld.env.suffix3,
 
 bld.SAMBA3_BINARY('net',
                  source=NET_SRC,
-                 deps='''talloc tdb_compat netapi addns cap intl POPT_SAMBA3 passdb LIBSMB LIB_NONSMBD
+                 deps='''talloc tdb_compat netapi addns cap intl POPT_SAMBA3 passdb LIBSMB smbd_shim
                  PARAM_WITHOUT_REG wbclient param KRBCLIENT LIBMSRPC_GEN msrpc3 LIBGPO ads LIBADS_SERVER LIBADS_PRINTER
                  LIBAFS LIBAFS_SETTOKEN SMBREADLINE PASSWD_UTIL LIBNET
                  LIBNET_DSSYNC LIBNET_SAMSYNC LIBEVENTLOG DCUTIL
@@ -1185,56 +1184,56 @@ bld.SAMBA3_BINARY('net',
 
 bld.SAMBA3_BINARY('profiles',
                  source=PROFILES_SRC,
-                 deps='''talloc tdb_compat cap tevent POPT_SAMBA3 param samba3core LIBSMB_ERR LIB_NONSMBD REGFIO''',
+                 deps='''talloc tdb_compat cap tevent POPT_SAMBA3 param samba3core LIBSMB_ERR smbd_shim REGFIO''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbspool',
                  source=CUPS_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient POPT_SAMBA3 param LIBSMB LIB_NONSMBD samba3core
+                 deps='''talloc tdb_compat tevent cap wbclient POPT_SAMBA3 param LIBSMB smbd_shim samba3core
                  KRBCLIENT asn1util LIBTSOCKET NDR_SAMR NDR_LSA''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('testparm',
                  source=TESTPARM_SRC,
                  deps='''talloc tevent ldap cap 
-                 wbclient asn1util LIBTSOCKET passdb param LIB_NONSMBD
+                 wbclient asn1util LIBTSOCKET passdb param smbd_shim
                  LIBSMB_ERR POPT_SAMBA3''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbta-util',
                  source=SMBTA_UTIL_SRC,
-                 deps='''talloc tdb_compat tevent cap param POPT_SAMBA3 LIB_NONSMBD
+                 deps='''talloc tdb_compat tevent cap param POPT_SAMBA3 smbd_shim
                  LIBSMB_ERR''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbstatus',
                  source=STATUS_SRC,
-                 deps='''talloc tdb_compat tevent cap param POPT_SAMBA3 LIB_NONSMBD
+                 deps='''talloc tdb_compat tevent cap param POPT_SAMBA3 smbd_shim
                  LIBSMB_ERR LOCKING PROFILE FNAME_UTIL''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbcontrol',
                  source=SMBCONTROL_SRC,
-                 deps='''talloc tdb_compat tevent cap param LIB_NONSMBD LIBSMB_ERR POPT_SAMBA3 PRINTBASE''',
+                 deps='''talloc tdb_compat tevent cap param smbd_shim LIBSMB_ERR POPT_SAMBA3 PRINTBASE''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbtree',
                  source=SMBTREE_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param LIB_NONSMBD
+                 deps='''talloc tdb_compat tevent cap wbclient param smbd_shim
                  LIBSMB LIBSMB_ERR POPT_SAMBA3 KRBCLIENT passdb SMBLDAP LIBMSRPC_GEN msrpc3 PROFILE
                  RPC_NDR_SRVSVC''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbpasswd',
                  source=SMBPASSWD_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param LIB_NONSMBD
+                 deps='''talloc tdb_compat tevent cap wbclient param smbd_shim
                  LIBSMB LIBSMB_ERR POPT_SAMBA3 KRBCLIENT passdb SMBLDAP LIBMSRPC_GEN msrpc3 PASSWD_UTIL
                  LIBCLI_SAMR INIT_LSA PASSCHANGE''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('pdbedit',
                  source=PDBEDIT_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param LIB_NONSMBD
+                 deps='''talloc tdb_compat tevent cap wbclient param smbd_shim
                  LIBNTLMSSP LIBSMB_ERR POPT_SAMBA3 passdb SMBLDAP
                  PASSWD_UTIL cli-ldap-common''',
                  vars=locals())
@@ -1246,18 +1245,18 @@ bld.SAMBA3_BINARY('smbget',
 
 bld.SAMBA3_BINARY('nmblookup' + bld.env.suffix3,
                  source=NMBLOOKUP_SRC,
-                 deps='''talloc tdb_compat tevent cap param LIB_NONSMBD POPT_SAMBA3 LIBSMB_ERR LIBNMB''',
+                 deps='''talloc tdb_compat tevent cap param smbd_shim POPT_SAMBA3 LIBSMB_ERR LIBNMB''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3,
                  source=SMBTORTURE_SRC,
                  deps='''talloc tdb_compat tevent cap wbclient param LIBSMB KRBCLIENT TLDAP
-                 LIB_NONSMBD POPT_SAMBA3 asn1util LIBTSOCKET NDR_LSA msrpc3 LIBMSRPC_GEN RPC_NDR_ECHO WB_REQTRANS''',
+                 smbd_shim POPT_SAMBA3 asn1util LIBTSOCKET NDR_LSA msrpc3 LIBMSRPC_GEN RPC_NDR_ECHO WB_REQTRANS''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbconftort',
                  source=SMBCONFTORT_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param LIB_NONSMBD LIBSMB_ERR POPT_SAMBA3''',
+                 deps='''talloc tdb_compat tevent cap wbclient param smbd_shim LIBSMB_ERR POPT_SAMBA3''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('replacetort',
@@ -1267,25 +1266,25 @@ bld.SAMBA3_BINARY('replacetort',
 
 bld.SAMBA3_BINARY('masktest' + bld.env.suffix3,
                  source=MASKTEST_SRC,
-                 deps='''talloc tdb_compat cap wbclient param LIB_NONSMBD LIBSMB KRBCLIENT
+                 deps='''talloc tdb_compat cap wbclient param smbd_shim LIBSMB KRBCLIENT
                  asn1util LIBTSOCKET NDR_SAMR NDR_LSA''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('msgtest',
                  source=MSGTEST_SRC,
-                 deps='''talloc tdb_compat tevent cap param LIBSMB_ERR LIB_NONSMBD''',
+                 deps='''talloc tdb_compat tevent cap param LIBSMB_ERR smbd_shim''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbcacls',
                  source=SMBCACLS_SRC,
                  deps='''talloc tdb_compat cap wbclient param LIBSMB KRBCLIENT
-                 LIB_NONSMBD passdb POPT_SAMBA3 SMBLDAP LIBMSRPC_GEN
+                 smbd_shim passdb POPT_SAMBA3 SMBLDAP LIBMSRPC_GEN
                  msrpc3 LIBCLI_LSA3''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('smbcquotas',
                  source=SMBCQUOTAS_SRC,
-                 deps='''talloc tdb_compat cap wbclient param LIB_NONSMBD LIBSMB KRBCLIENT
+                 deps='''talloc tdb_compat cap wbclient param  smbd_shim LIBSMB KRBCLIENT
                  POPT_SAMBA3 passdb SMBLDAP LIBMSRPC_GEN msrpc3
                  LIBCLI_LSA3''',
                  vars=locals())
@@ -1293,23 +1292,23 @@ bld.SAMBA3_BINARY('smbcquotas',
 bld.SAMBA3_BINARY('eventlogadm',
                  source=EVTLOGADM_SRC,
                  deps='''talloc tevent cap POPT_SAMBA3 samba3core param
-                 LIB_NONSMBD LIBSMB_ERR passdb wbclient LIBEVENTLOG''',
+                 smbd_shim LIBSMB_ERR passdb wbclient LIBEVENTLOG''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('sharesec',
                  source=SHARESEC_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param LIB_NONSMBD LIBSMB_ERR POPT_SAMBA3''',
+                 deps='''talloc tdb_compat tevent cap wbclient param smbd_shim LIBSMB_ERR POPT_SAMBA3''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('locktest' + bld.env.suffix3,
                  source=LOCKTEST_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param KRBCLIENT LIBSMB LIB_NONSMBD
+                 deps='''talloc tdb_compat tevent cap wbclient param KRBCLIENT LIBSMB smbd_shim
                  asn1util LIBTSOCKET NDR_SAMR NDR_LSA LOCKING FNAME_UTIL''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('pdbtest',
                  source=PDBTEST_SRC,
-                 deps='''talloc tdb_compat cap wbclient param LIBSMB KRBCLIENT LIB_NONSMBD passdb
+                 deps='''talloc tdb_compat cap wbclient param LIBSMB KRBCLIENT smbd_shim passdb
                  SMBLDAP POPT_SAMBA3 NDR_SAMR NDR_LSA''',
                  vars=locals())
 
@@ -1320,7 +1319,7 @@ bld.SAMBA3_BINARY('vfstest',
 
 bld.SAMBA3_BINARY('smbiconv',
                  source=SMBICONV_SRC,
-                 deps='''talloc tdb_compat tevent cap param LIB_NONSMBD POPT_SAMBA3 LIBSMB_ERR''',
+                 deps='''talloc tdb_compat tevent cap param smbd_shim POPT_SAMBA3 LIBSMB_ERR''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('log2pcap',
@@ -1330,7 +1329,7 @@ bld.SAMBA3_BINARY('log2pcap',
 
 bld.SAMBA3_BINARY('locktest2',
                  source=LOCKTEST2_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param KRBCLIENT LIBSMB LIB_NONSMBD
+                 deps='''talloc tdb_compat tevent cap wbclient param KRBCLIENT LIBSMB smbd_shim
                  asn1util LIBTSOCKET NDR_SAMR NDR_LSA LOCKING FNAME_UTIL''',
                  vars=locals())
 
@@ -1341,7 +1340,7 @@ bld.SAMBA3_BINARY('debug2html',
 
 bld.SAMBA3_BINARY('smbfilter',
                  source=SMBFILTER_SRC,
-                 deps='''talloc tevent cap wbclient param LIBSMB LIB_NONSMBD KRBCLIENT asn1util LIBTSOCKET
+                 deps='''talloc tevent cap wbclient param LIBSMB smbd_shim KRBCLIENT asn1util LIBTSOCKET
                  NDR_SAMR NDR_LSA''',
                  vars=locals())
 
@@ -1353,13 +1352,13 @@ bld.SAMBA3_BINARY('versiontest',
 bld.SAMBA3_BINARY('wbinfo' + bld.env.suffix3,
                  source=WBINFO_SRC,
                  deps='''talloc wbclient tevent cap
-                 asn1util LIBTSOCKET passdb ldap param LIB_NONSMBD
+                 asn1util LIBTSOCKET passdb ldap param smbd_shim
                  LIBNTLMSSP POPT_SAMBA3 LIBAFS_SETTOKEN''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('ntlm_auth' + bld.env.suffix3,
                  source=NTLM_AUTH_SRC,
-                 deps='''tdb_compat talloc cap KRB5_WRAP k5crypto wbclient param LIB_NONSMBD
+                 deps='''tdb_compat talloc cap KRB5_WRAP k5crypto wbclient param smbd_shim
                  samba3core LIBNTLMSSP POPT_SAMBA3 asn1util LIBTSOCKET
                  passdb SMBLDAP winbind-client LIBINIPARSER LIBADS_SERVER
                  NDR_SAMR NDR_LSA NDR_NETLOGON cli-ldap-common LIBNMB SLCACHE SPNEGO_PARSE KRBCLIENT''',
@@ -1371,29 +1370,29 @@ bld.SAMBA3_BINARY('timelimit',
 
 bld.SAMBA3_BINARY('rpc_open_tcp',
                  source=RPC_OPEN_TCP_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient KRBCLIENT param samba3core LIBSMB LIB_NONSMBD
+                 deps='''talloc tdb_compat tevent cap wbclient KRBCLIENT param samba3core LIBSMB smbd_shim
                  LIBSMB_ERR asn1util LIBTSOCKET LIBMSRPC_GEN msrpc3''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('test_lp_load',
                  source=TEST_LP_LOAD_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param LIB_NONSMBD POPT_SAMBA3 LIBNTLMSSP''',
+                 deps='''talloc tdb_compat tevent cap wbclient param  smbd_shim POPT_SAMBA3 LIBNTLMSSP''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('dbwrap_tool',
                  source=DBWRAP_TOOL_SRC,
-                 deps='''talloc tdb_compat tevent cap param LIB_NONSMBD LIBSMB_ERR''',
+                 deps='''talloc tdb_compat tevent cap param smbd_shim LIBSMB_ERR''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('dbwrap_torture',
                  source=DBWRAP_TORTURE_SRC,
-                 deps='''talloc tdb_compat tevent cap param LIB_NONSMBD LIBSMB_ERR
+                 deps='''talloc tdb_compat tevent cap param  smbd_shim LIBSMB_ERR
                  POPT_SAMBA3''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('split_tokens',
                  source=SPLIT_TOKENS_SRC,
-                 deps='''talloc tdb_compat tevent cap wbclient param LIB_NONSMBD POPT_SAMBA3
+                 deps='''talloc tdb_compat tevent cap wbclient param smbd_shim POPT_SAMBA3
                  LIBNTLMSSP''',
                  vars=locals())