[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Fri May 28 10:25:22 MDT 2010


The branch, master has been updated
       via  8d6f88b... s3:winbind Kill amusing but un-used winbindd_kill_all_clients
       via  d266f8f... s3:lib s3:lib move get_global_sam_name to util_names.c
       via  539ef13... s3:lib split out global workgroup and netbios name functions.
       via  59422ef... s3:smbd move messaging_context and memcache into globals.c
       via  6f279de... s3:smbd split reload services/printers functions from server.c
       via  8bc3251... s3:smbd split smbd/server.c into smbd/server.c and smbd/server_exit.c
      from  f733362... s3-waf: Support builds with utmp accounting

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


- Log -----------------------------------------------------------------
commit 8d6f88b469cea1aff0d3211f0a9dbd08e6a31497
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu May 13 17:41:33 2010 +1000

    s3:winbind Kill amusing but un-used winbindd_kill_all_clients
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit d266f8fdf17e5583d419c2b4bd9daf30acebfd6b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed May 26 11:11:08 2010 +1000

    s3:lib s3:lib move get_global_sam_name to util_names.c
    
    This doesn't really belong in util_sid.c, and has much more in common
    with the other functions in util_names.c
    
    Andrew Bartlett
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 539ef13bfe950c7c512a4bdafd9a846c04ba5be4
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon May 17 16:25:26 2010 +1000

    s3:lib split out global workgroup and netbios name functions.
    
    Having these in their own file allows easier selective inclusion.
    
    Andrew Bartlett
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 59422efca9734f7e4248f9c7df8b6b823f17999b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed May 26 10:48:15 2010 +1000

    s3:smbd move messaging_context and memcache into globals.c
    
    This helps vfstest, which previously had duplicate copies of these functions.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 6f279de0e672996ff1c142202581e6471ed6e859
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu May 27 07:18:58 2010 +0200

    s3:smbd split reload services/printers functions from server.c
    
    This helps vfstest, as it previously had duplicate copies of these
    functions.
    
    Andrew Bartlett
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 8bc32513da9f0009774b6efce76f26c2177a976a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu May 13 07:48:04 2010 +1000

    s3:smbd split smbd/server.c into smbd/server.c and smbd/server_exit.c
    
    Andrew Bartlett
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 source3/Makefile.in               |    8 +-
 source3/include/proto.h           |   13 +-
 source3/lib/util.c                |   43 +------
 source3/lib/util_names.c          |   85 ++++++++++++
 source3/lib/util_sid.c            |   13 --
 source3/smbd/globals.c            |   27 ++++
 source3/smbd/server.c             |  254 -------------------------------------
 source3/smbd/server_exit.c        |  173 +++++++++++++++++++++++++
 source3/smbd/server_reload.c      |  109 ++++++++++++++++
 source3/torture/vfstest.c         |   80 ------------
 source3/winbindd/winbindd_proto.h |    1 -
 source3/winbindd/winbindd_util.c  |   17 ---
 12 files changed, 408 insertions(+), 415 deletions(-)
 create mode 100644 source3/lib/util_names.c
 create mode 100644 source3/smbd/server_exit.c
 create mode 100644 source3/smbd/server_reload.c


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 72a7315..671bd8e 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -398,7 +398,8 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \
 	  lib/wins_srv.o \
 	  lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o \
 	  lib/util_unistr.o lib/util_file.o \
-	  lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
+	  lib/util.o lib/util_names.o \
+	  lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
 	  lib/substitute.o lib/dbwrap_util.o \
 	  lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
 	  lib/tallocmsg.o lib/dmallocmsg.o \
@@ -776,11 +777,12 @@ AUTH_OBJ = auth/auth.o @AUTH_STATIC@ auth/auth_util.o auth/token_util.o \
 
 MANGLE_OBJ = smbd/mangle.o smbd/mangle_hash.o smbd/mangle_hash2.o
 
-SMBD_OBJ_MAIN = smbd/server.o
+SMBD_OBJ_MAIN = smbd/server.o smbd/server_exit.o
 
 BUILDOPT_OBJ = smbd/build_options.o
 
-SMBD_OBJ_SRV = smbd/files.o smbd/connection.o \
+SMBD_OBJ_SRV = smbd/server_reload.o \
+	       smbd/files.o smbd/connection.o \
 	       smbd/utmp.o smbd/session.o smbd/map_username.o \
                smbd/dfree.o smbd/dir.o smbd/password.o smbd/conn.o \
 	       smbd/share_access.o smbd/fileio.o \
diff --git a/source3/include/proto.h b/source3/include/proto.h
index f53c52c..b018a45 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1125,15 +1125,19 @@ bool nt_time_is_set(const NTTIME *nt);
 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
 
+/* The following definitions come from lib/util_names.c  */
+void gfree_netbios_names(void);
+bool set_global_myname(const char *myname);
+const char *global_myname(void);
+bool set_global_myworkgroup(const char *myworkgroup);
+const char *lp_workgroup(void);
+const char *get_global_sam_name(void);
+
 /* The following definitions come from lib/util.c  */
 
 enum protocol_types get_Protocol(void);
 void set_Protocol(enum protocol_types  p);
 bool all_zero(const uint8_t *ptr, size_t size);
-bool set_global_myname(const char *myname);
-const char *global_myname(void);
-bool set_global_myworkgroup(const char *myworkgroup);
-const char *lp_workgroup(void);
 bool set_global_scope(const char *scope);
 const char *global_scope(void);
 void gfree_names(void);
@@ -1354,7 +1358,6 @@ bool is_setuid_root(void) ;
 
 const char *sid_type_lookup(uint32 sid_type) ;
 NT_USER_TOKEN *get_system_token(void) ;
-const char *get_global_sam_name(void) ;
 char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
 char *sid_string_dbg(const struct dom_sid *sid);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 2339cfc..88e4557 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -73,51 +73,11 @@ static enum remote_arch_types ra_type = RA_UNKNOWN;
  Definitions for all names.
 ***********************************************************************/
 
-static char *smb_myname;
-static char *smb_myworkgroup;
 static char *smb_scope;
 static int smb_num_netbios_names;
 static char **smb_my_netbios_names;
 
 /***********************************************************************
- Allocate and set myname. Ensure upper case.
-***********************************************************************/
-
-bool set_global_myname(const char *myname)
-{
-	SAFE_FREE(smb_myname);
-	smb_myname = SMB_STRDUP(myname);
-	if (!smb_myname)
-		return False;
-	strupper_m(smb_myname);
-	return True;
-}
-
-const char *global_myname(void)
-{
-	return smb_myname;
-}
-
-/***********************************************************************
- Allocate and set myworkgroup. Ensure upper case.
-***********************************************************************/
-
-bool set_global_myworkgroup(const char *myworkgroup)
-{
-	SAFE_FREE(smb_myworkgroup);
-	smb_myworkgroup = SMB_STRDUP(myworkgroup);
-	if (!smb_myworkgroup)
-		return False;
-	strupper_m(smb_myworkgroup);
-	return True;
-}
-
-const char *lp_workgroup(void)
-{
-	return smb_myworkgroup;
-}
-
-/***********************************************************************
  Allocate and set scope. Ensure upper case.
 ***********************************************************************/
 
@@ -184,8 +144,7 @@ static bool set_my_netbios_names(const char *name, int i)
 
 void gfree_names(void)
 {
-	SAFE_FREE( smb_myname );
-	SAFE_FREE( smb_myworkgroup );
+	gfree_netbios_names();
 	SAFE_FREE( smb_scope );
 	free_netbios_names_array();
 	free_local_machine_name();
diff --git a/source3/lib/util_names.c b/source3/lib/util_names.c
new file mode 100644
index 0000000..bd6e5c1
--- /dev/null
+++ b/source3/lib/util_names.c
@@ -0,0 +1,85 @@
+/*
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Andrew Tridgell 1992-1998
+   Copyright (C) Jeremy Allison 2001-2007
+   Copyright (C) Simo Sorce 2001
+   Copyright (C) Jim McDonough <jmcd at us.ibm.com> 2003
+   Copyright (C) James Peach 2006
+   Copyright (C) Andrew Bartlett 2010
+
+   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/>.
+*/
+
+#include "includes.h"
+
+static char *smb_myname;
+static char *smb_myworkgroup;
+
+/***********************************************************************
+ Allocate and set myname. Ensure upper case.
+***********************************************************************/
+
+bool set_global_myname(const char *myname)
+{
+	SAFE_FREE(smb_myname);
+	smb_myname = SMB_STRDUP(myname);
+	if (!smb_myname)
+		return False;
+	strupper_m(smb_myname);
+	return True;
+}
+
+const char *global_myname(void)
+{
+	return smb_myname;
+}
+
+/***********************************************************************
+ Allocate and set myworkgroup. Ensure upper case.
+***********************************************************************/
+
+bool set_global_myworkgroup(const char *myworkgroup)
+{
+	SAFE_FREE(smb_myworkgroup);
+	smb_myworkgroup = SMB_STRDUP(myworkgroup);
+	if (!smb_myworkgroup)
+		return False;
+	strupper_m(smb_myworkgroup);
+	return True;
+}
+
+const char *lp_workgroup(void)
+{
+	return smb_myworkgroup;
+}
+
+/******************************************************************
+ get the default domain/netbios name to be used when dealing
+ with our passdb list of accounts
+******************************************************************/
+
+const char *get_global_sam_name(void)
+{
+	if (IS_DC) {
+		return lp_workgroup();
+	}
+	return global_myname();
+}
+
+void gfree_netbios_names(void)
+{
+	SAFE_FREE( smb_myname );
+	SAFE_FREE( smb_myworkgroup );
+}
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 4cc7bb4..2a77be7 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -155,19 +155,6 @@ NT_USER_TOKEN *get_system_token(void)
 	return &system_token;
 }
 
-/******************************************************************
- get the default domain/netbios name to be used when dealing 
- with our passdb list of accounts
-******************************************************************/
-
-const char *get_global_sam_name(void) 
-{
-	if (IS_DC) {
-		return lp_workgroup();
-	}
-	return global_myname();
-}
-
 /*****************************************************************
  Convert a SID to an ascii string.
 *****************************************************************/
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 10ee5e8..892bc89 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -125,6 +125,33 @@ int num_children = 0;
 
 struct smbd_server_connection *smbd_server_conn = NULL;
 
+struct messaging_context *smbd_messaging_context(void)
+{
+	if (smbd_msg_ctx == NULL) {
+		smbd_msg_ctx = messaging_init(talloc_autofree_context(),
+					      procid_self(),
+					      smbd_event_context());
+	}
+	if (smbd_msg_ctx == NULL) {
+		DEBUG(0, ("Could not init smbd messaging context.\n"));
+	}
+	return smbd_msg_ctx;
+}
+
+struct memcache *smbd_memcache(void)
+{
+	if (!smbd_memcache_ctx) {
+		smbd_memcache_ctx = memcache_init(talloc_autofree_context(),
+						  lp_max_stat_cache_size()*1024);
+	}
+	if (!smbd_memcache_ctx) {
+		smb_panic("Could not init smbd memcache");
+	}
+
+	return smbd_memcache_ctx;
+}
+
+
 void smbd_init_globals(void)
 {
 	ZERO_STRUCT(char_flags);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 7cd6946..184b613 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -58,32 +58,6 @@ struct event_context *smbd_event_context(void)
 	return smbd_event_ctx;
 }
 
-struct messaging_context *smbd_messaging_context(void)
-{
-	if (smbd_msg_ctx == NULL) {
-		smbd_msg_ctx = messaging_init(talloc_autofree_context(),
-					      procid_self(),
-					      smbd_event_context());
-	}
-	if (smbd_msg_ctx == NULL) {
-		DEBUG(0, ("Could not init smbd messaging context.\n"));
-	}
-	return smbd_msg_ctx;
-}
-
-struct memcache *smbd_memcache(void)
-{
-	if (!smbd_memcache_ctx) {
-		smbd_memcache_ctx = memcache_init(talloc_autofree_context(),
-						  lp_max_stat_cache_size()*1024);
-	}
-	if (!smbd_memcache_ctx) {
-		smb_panic("Could not init smbd memcache");
-	}
-
-	return smbd_memcache_ctx;
-}
-
 /*******************************************************************
  What to do when smb.conf is updated.
  ********************************************************************/
@@ -766,234 +740,6 @@ static void smbd_parent_loop(struct smbd_parent_context *parent)
 /* NOTREACHED	return True; */
 }
 
-/****************************************************************************
- Reload printers
-**************************************************************************/
-void reload_printers(void)
-{
-	int snum;
-	int n_services = lp_numservices();
-	int pnum = lp_servicenumber(PRINTERS_NAME);
-	const char *pname;
-
-	pcap_cache_reload();
-
-	/* remove stale printers */
-	for (snum = 0; snum < n_services; snum++) {
-		/* avoid removing PRINTERS_NAME or non-autoloaded printers */
-		if (snum == pnum || !(lp_snum_ok(snum) && lp_print_ok(snum) &&
-		                      lp_autoloaded(snum)))
-			continue;
-
-		pname = lp_printername(snum);
-		if (!pcap_printername_ok(pname)) {
-			DEBUG(3, ("removing stale printer %s\n", pname));
-
-			if (is_printer_published(NULL, snum, NULL))
-				nt_printer_publish(NULL, snum, DSPRINT_UNPUBLISH);
-			del_a_printer(pname);
-			lp_killservice(snum);
-		}
-	}
-
-	load_printers();
-}
-
-/****************************************************************************
- Reload the services file.
-**************************************************************************/
-
-bool reload_services(bool test)
-{
-	bool ret;
-
-	if (lp_loaded()) {
-		char *fname = lp_configfile();
-		if (file_exist(fname) &&
-		    !strcsequal(fname, get_dyn_CONFIGFILE())) {
-			set_dyn_CONFIGFILE(fname);
-			test = False;
-		}
-	}
-
-	reopen_logs();
-
-	if (test && !lp_file_list_changed())
-		return(True);
-
-	lp_killunused(conn_snum_used);
-
-	ret = lp_load(get_dyn_CONFIGFILE(), False, False, True, True);
-
-	reload_printers();
-
-	/* perhaps the config filename is now set */
-	if (!test)
-		reload_services(True);
-
-	reopen_logs();
-
-	load_interfaces();
-
-	if (smbd_server_fd() != -1) {
-		set_socket_options(smbd_server_fd(),"SO_KEEPALIVE");
-		set_socket_options(smbd_server_fd(), lp_socket_options());
-	}
-
-	mangle_reset_cache();
-	reset_stat_cache();
-
-	/* this forces service parameters to be flushed */
-	set_current_service(NULL,0,True);
-
-	return(ret);
-}
-
-static struct files_struct *log_writeable_file_fn(
-	struct files_struct *fsp, void *private_data)
-{
-	bool *found = (bool *)private_data;
-	char *path;
-
-	if (!fsp->can_write) {
-		return NULL;
-	}
-	if (!(*found)) {
-		DEBUG(0, ("Writable files open at exit:\n"));
-		*found = true;
-	}
-
-	path = talloc_asprintf(talloc_tos(), "%s/%s", fsp->conn->connectpath,
-			       smb_fname_str_dbg(fsp->fsp_name));
-	if (path == NULL) {
-		DEBUGADD(0, ("<NOMEM>\n"));
-	}
-
-	DEBUGADD(0, ("%s\n", path));
-
-	TALLOC_FREE(path);
-	return NULL;
-}
-
-/****************************************************************************
- Exit the server.
-****************************************************************************/
-
-/* Reasons for shutting down a server process. */
-enum server_exit_reason { SERVER_EXIT_NORMAL, SERVER_EXIT_ABNORMAL };
-
-static void exit_server_common(enum server_exit_reason how,
-	const char *const reason) _NORETURN_;
-
-static void exit_server_common(enum server_exit_reason how,
-	const char *const reason)
-{
-	bool had_open_conn = false;
-	struct smbd_server_connection *sconn = smbd_server_conn;
-
-	if (!exit_firsttime)
-		exit(0);
-	exit_firsttime = false;
-
-	change_to_root_user();
-
-	if (sconn && sconn->smb1.negprot.auth_context) {
-		struct auth_context *a = sconn->smb1.negprot.auth_context;
-		a->free(&sconn->smb1.negprot.auth_context);
-	}
-
-	if (lp_log_writeable_files_on_exit()) {
-		bool found = false;
-		files_forall(log_writeable_file_fn, &found);
-	}
-
-	if (sconn) {
-		had_open_conn = conn_close_all(sconn);
-		invalidate_all_vuids(sconn);
-	}
-
-	/* 3 second timeout. */
-	print_notify_send_messages(smbd_messaging_context(), 3);
-
-	/* delete our entry in the serverid database. */
-	serverid_deregister_self();
-
-#ifdef WITH_DFS
-	if (dcelogin_atmost_once) {
-		dfs_unlogin();
-	}
-#endif
-
-#ifdef USE_DMAPI
-	/* Destroy Samba DMAPI session only if we are master smbd process */
-	if (am_parent) {
-		if (!dmapi_destroy_session()) {
-			DEBUG(0,("Unable to close Samba DMAPI session\n"));
-		}
-	}
-#endif
-
-	locking_end();
-	printing_end();
-
-	/*
-	 * we need to force the order of freeing the following,
-	 * because smbd_msg_ctx is not a talloc child of smbd_server_conn.
-	 */
-	sconn = NULL;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list