[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Mon Mar 22 05:04:03 MDT 2010


The branch, master has been updated
       via  b2f45f2... s3: Add "log writeable files on exit" parameter
      from  0cf9d62... s4-selftest: fix selftest-vars script.

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


- Log -----------------------------------------------------------------
commit b2f45f20b0108ba6c834f813386ab3d29a729abd
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Mar 22 11:19:10 2010 +0100

    s3: Add "log writeable files on exit" parameter
    
    This boolean option controls whether at exit time the server dumps a list of
    files with debug level 0 that were still open for write. This is an
    administrative aid to find the files that were potentially corrupt if the
    network connection died.

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

Summary of changes:
 .../smbdotconf/misc/logwriteablefilesonexit.xml    |   16 ++++++++++
 source3/include/proto.h                            |    1 +
 source3/param/loadparm.c                           |   13 ++++++++
 source3/smbd/server.c                              |   31 ++++++++++++++++++++
 4 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 docs-xml/smbdotconf/misc/logwriteablefilesonexit.xml


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/misc/logwriteablefilesonexit.xml b/docs-xml/smbdotconf/misc/logwriteablefilesonexit.xml
new file mode 100644
index 0000000..1c75457
--- /dev/null
+++ b/docs-xml/smbdotconf/misc/logwriteablefilesonexit.xml
@@ -0,0 +1,16 @@
+<samba:parameter name="log writeable files on exit"
+		 context="G"
+		 type="boolean"
+		 advanced="1" developer="0"
+		 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+	<para>
+	This boolean option controls whether at exit time the server
+	dumps a list of files with debug level 0 that were still open
+	for write. This is an administrative aid to find the files
+	that were potentially corrupt if the network connection died.
+	</para>
+</description>
+
+<value type="default">no</value>
+</samba:parameter>
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 69fd591..4832a60 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4029,6 +4029,7 @@ bool lp_usershare_allow_guests(void);
 bool lp_usershare_owner_only(void);
 bool lp_disable_netbios(void);
 bool lp_reset_on_zero_vc(void);
+bool lp_log_writeable_files_on_exit(void);
 bool lp_ms_add_printer_wizard(void);
 bool lp_dns_proxy(void);
 bool lp_wins_support(void);
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 579f847..e94c270 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -353,6 +353,7 @@ struct global {
 	int iIdmapCacheTime;
 	int iIdmapNegativeCacheTime;
 	bool bResetOnZeroVC;
+	bool bLogWriteableFilesOnExit;
 	int iKeepalive;
 	int iminreceivefile;
 	struct param_opt_struct *param_opt;
@@ -2078,6 +2079,15 @@ static struct parm_struct parm_table[] = {
 		.flags		= FLAG_ADVANCED,
 	},
 	{
+		.label		= "log writeable files on exit",
+		.type		= P_BOOL,
+		.p_class	= P_GLOBAL,
+		.ptr		= &Globals.bLogWriteableFilesOnExit,
+		.special	= NULL,
+		.enum_list	= NULL,
+		.flags		= FLAG_ADVANCED,
+	},
+	{
 		.label		= "acl compatibility",
 		.type		= P_ENUM,
 		.p_class	= P_GLOBAL,
@@ -5087,6 +5097,7 @@ static void init_globals(bool first_time_only)
 #endif
 	Globals.bUnixExtensions = True;
 	Globals.bResetOnZeroVC = False;
+	Globals.bLogWriteableFilesOnExit = False;
 	Globals.bCreateKrb5Conf = true;
 
 	/* hostname lookups can be very expensive and are broken on
@@ -5483,6 +5494,8 @@ FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
+FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
+	       &Globals.bLogWriteableFilesOnExit)
 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 400edcf..81d75b1 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -847,6 +847,32 @@ bool reload_services(bool test)
 	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.
 ****************************************************************************/
@@ -874,6 +900,11 @@ static void exit_server_common(enum server_exit_reason how,
 		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);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list