[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Tue Jun 21 01:06:02 MDT 2011


The branch, master has been updated
       via  cfdeef4 s3-smbd: longer explanation of smbd_shim code
       via  b373d0e s3-build: Provide a run-time shim to work around duplicate symbols
       via  e00b1fa lib/util: Restore CH_UNIX as source charset for d_printf()
       via  bf83b64 lib/util Remove display_cd from d_printf()
       via  c017cbf s4/auth: Trivial spelling fixes.
       via  35a9c23 build: move dynconfig for top level build up
      from  894b027 lib/ccan/tally.h: update for FreeBSD compile.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit cfdeef4c11a75f1051c4b9905a643f61c74437c7
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Jun 21 15:53:36 2011 +1000

    s3-smbd: longer explanation of smbd_shim code
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Tue Jun 21 09:05:37 CEST 2011 on sn-devel-104

commit b373d0e777df8770c24cfcc5cc80bf4808faa815
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue May 31 13:18:37 2011 +1000

    s3-build: Provide a run-time shim to work around duplicate symbols
    
    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 at samba.org>

commit e00b1fa2b032012e741d94f3fe0057d6ea53bf4c
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jun 21 12:53:12 2011 +1000

    lib/util: Restore CH_UNIX as source charset for d_printf()
    
    I'm changed this during the change to use the d_printf() code in
    common, but should not have.
    
    However, there is a puzzle: What is the right source charset?
    Translated strings in our .mo and .msg files are in UTF8, but strings
    such as file names on remote servers are in UNIX (whatever that is).
    I can't see how this actually works properly when either CH_DISPLAY or
    CH_UNIX are other than UTF8!
    
    Andrew Bartlett
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit bf83b641e265a7b1523545294c268c6708999d2a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jun 21 12:51:30 2011 +1000

    lib/util Remove display_cd from d_printf()
    
    The setting of the display charset is now done by
    convert_string_talloc() selecting the right charset based on
    CH_DISPLAY.
    
    Andrew Bartlett
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit c017cbfaa47f6cb7da38a7021427412fe2e62a8d
Author: Brad Hards <bradh at frogmouth.net>
Date:   Fri Jun 17 19:53:11 2011 +1000

    s4/auth: Trivial spelling fixes.
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit 35a9c23a016e76df7b5647e1b9285f70d15db807
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jun 21 12:48:22 2011 +1000

    build: move dynconfig for top level build up
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 {source4/dynconfig => dynconfig}/wscript    |    2 +-
 lib/util/dprintf.c                          |    9 +--
 source3/Makefile.in                         |    3 +-
 source3/lib/dummyroot.c                     |   34 --------
 source3/lib/dummysmbd.c                     |   65 ----------------
 source3/lib/smbd_shim.c                     |  110 +++++++++++++++++++++++++++
 source3/lib/smbd_shim.h                     |   56 ++++++++++++++
 source3/pam_smbpass/wscript_build           |    2 +-
 source3/smbd/blocking.c                     |    6 +-
 source3/smbd/dir.c                          |    4 +-
 source3/smbd/globals.c                      |   16 ++++
 source3/smbd/oplock.c                       |    4 +-
 source3/smbd/proto.h                        |   14 ++++
 source3/smbd/statcache.c                    |    4 +-
 source3/smbd/uid.c                          |    6 +-
 source3/wscript_build                       |   91 +++++++++++-----------
 source4/auth/credentials/credentials_krb5.c |    6 +-
 source4/auth/kerberos/kerberos_util.c       |    6 +-
 wscript                                     |    4 +-
 wscript_build                               |    2 +-
 20 files changed, 267 insertions(+), 177 deletions(-)
 rename {source4/dynconfig => dynconfig}/wscript (99%)
 delete mode 100644 source3/lib/dummyroot.c
 delete mode 100644 source3/lib/dummysmbd.c
 create mode 100644 source3/lib/smbd_shim.c
 create mode 100644 source3/lib/smbd_shim.h


Changeset truncated at 500 lines:

diff --git a/source4/dynconfig/wscript b/dynconfig/wscript
similarity index 99%
rename from source4/dynconfig/wscript
rename to dynconfig/wscript
index 12fc17f..35af13d 100755
--- a/source4/dynconfig/wscript
+++ b/dynconfig/wscript
@@ -108,7 +108,7 @@ Build.BuildContext.dynconfig_cflags = dynconfig_cflags
 def build(bld):
     cflags = bld.dynconfig_cflags()
     bld.SAMBA_SUBSYSTEM('DYNCONFIG',
-                        '../../dynconfig/dynconfig.c',
+                        'dynconfig.c',
                         deps='replace talloc',
                         public_headers=os_path_relpath(os.path.join(Options.launch_dir, 'version.h'), bld.curdir),
                         header_path='samba',
diff --git a/lib/util/dprintf.c b/lib/util/dprintf.c
index c79989b..376eb4c 100644
--- a/lib/util/dprintf.c
+++ b/lib/util/dprintf.c
@@ -34,8 +34,6 @@
 #include "includes.h"
 #include "system/locale.h"
 
-static smb_iconv_t display_cd = (smb_iconv_t)-1;
-
 static int d_vfprintf(FILE *f, const char *format, va_list ap) 
 {
 	char *p, *p2;
@@ -44,18 +42,13 @@ static int d_vfprintf(FILE *f, const char *format, va_list ap)
 	bool cret;
 	va_list ap2;
 
-	/* If there's nothing to convert, take a shortcut */
-	if (display_cd == (smb_iconv_t)-1) {
-		return vfprintf(f, format, ap);
-	}
-
 	va_copy(ap2, ap);
 	ret = vasprintf(&p, format, ap2);
 	va_end(ap2);
 
 	if (ret <= 0) return ret;
 
-	cret = convert_string_talloc(NULL, CH_UTF8, CH_DISPLAY, p, ret, (void **)&p2, &clen);
+	cret = convert_string_talloc(NULL, CH_UNIX, CH_DISPLAY, p, ret, (void **)&p2, &clen);
         if (!cret) {
 		/* the string can't be converted - do the best we can,
 		   filling in non-printing chars with '?' */
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 7a471dd..31d170d 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -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
index 64ea758..0000000
--- a/source3/lib/dummyroot.c
+++ /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;
-}
diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c
deleted file mode 100644
index 541b59e..0000000
--- a/source3/lib/dummysmbd.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-   Unix SMB/CIFS implementation.
-   RPC pipe client
-
-   Copyright (C) Gerald (Jerry) Carter          2004.
-
-   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 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)
-{
-	return NT_STATUS_OK;
-}
-
-bool change_to_root_user(void)
-{
-	return false;
-}
-
-/**
- * The following two functions need to be called from inside the low-level BRL
- * code for oplocks correctness in smbd.  Since other utility binaries also
- * link in some of the brl code directly, these dummy functions are necessary
- * to avoid needing to link in the oplocks code and its dependencies to all of
- * the utility binaries.
- */
-void contend_level2_oplocks_begin(files_struct *fsp,
-				  enum level2_contention_type type)
-{
-	return;
-}
-
-void contend_level2_oplocks_end(files_struct *fsp,
-				enum level2_contention_type type)
-{
-	return;
-}
diff --git a/source3/lib/smbd_shim.c b/source3/lib/smbd_shim.c
new file mode 100644
index 0000000..72ae366
--- /dev/null
+++ b/source3/lib/smbd_shim.c
@@ -0,0 +1,110 @@
+/*
+   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. */
+
+#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;
+}
+
+/**
+ * The following two functions need to be called from inside the low-level BRL
+ * code for oplocks correctness in smbd.  Since other utility binaries also
+ * link in some of the brl code directly, these dummy functions are necessary
+ * to avoid needing to link in the oplocks code and its dependencies to all of
+ * the utility binaries.
+ */
+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
index 0000000..89cae2b
--- /dev/null
+++ b/source3/lib/smbd_shim.h
@@ -0,0 +1,56 @@
+/*
+   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 are used required to allow library code to have
+   references to smbd specific code. The smbd daemon sets up the set
+   of function calls that it wants used by calling
+   set_smbd_shim(). Other executables don't make this call, and get
+   default (dummy) versions of these functions.
+*/
+
+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);
+
+
diff --git a/source3/pam_smbpass/wscript_build b/source3/pam_smbpass/wscript_build
index 8c15d71..200482c 100644
--- a/source3/pam_smbpass/wscript_build
+++ b/source3/pam_smbpass/wscript_build
@@ -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',
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index fd77e3d..d9c1fb2 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -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;
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index c547cd2..fda7c34 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -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;
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index b3cf0bd..2736fa6 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -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);
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 56481e9..284b032 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -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 */
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 6e51527..adeaf68 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -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,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list