[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Oct 19 02:58:02 UTC 2017


The branch, master has been updated
       via  f7cdd39 rpc_client: Fix wording in a DEBUG statement
       via  267cd25 Removed unused 'oplock contention limit' config parameter
       via  44bcb08 s3: tests: Add smbclient test for utimes command.
       via  0030ce9 s3:Add a utimes command to smbclient so we can set the Windows times.
      from  962a1b3 dbcheck: Allow removal of one-way links to missing objects

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


- Log -----------------------------------------------------------------
commit f7cdd396abfc4a5ff3c99e03398f28aa7342af69
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 18 13:26:07 2017 +0200

    rpc_client: Fix wording in a DEBUG statement
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Oct 19 04:57:44 CEST 2017 on sn-devel-144

commit 267cd25290c2a378a81c8733c8559c4f210dc07e
Author: Christof Schmitt <cs at samba.org>
Date:   Tue Oct 17 14:49:17 2017 -0700

    Removed unused 'oplock contention limit' config parameter
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 44bcb08f83ead449851d8aeb92329cdb00cc2db4
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 18 13:54:22 2017 -0700

    s3: tests: Add smbclient test for utimes command.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>

commit 0030ce900afcb6a4297c4a4dcf95bce51930d235
Author: Richard Sharpe <realrichardsharpe at gmail.com>
Date:   Mon Oct 16 13:51:51 2017 -0700

    s3:Add a utimes command to smbclient so we can set the Windows times.
    
    Add an update to the smbclient man page.
    
    Signed-off-by: Richard Sharpe <realrichardsharpe at gmail.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 WHATSNEW.txt                                       |   1 +
 docs-xml/manpages/smbclient.1.xml                  |   8 ++
 .../smbdotconf/locking/oplockcontentionlimit.xml   |  26 -----
 examples/scripts/shares/python/smbparm.py          |   1 -
 lib/param/loadparm.c                               |   2 -
 source3/client/client.c                            | 122 +++++++++++++++++++++
 source3/param/loadparm.c                           |   1 -
 source3/rpc_client/cli_netlogon.c                  |   2 +-
 source3/script/tests/test_smbclient_s3.sh          |  67 +++++++++++
 9 files changed, 199 insertions(+), 31 deletions(-)
 delete mode 100644 docs-xml/smbdotconf/locking/oplockcontentionlimit.xml


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 2f2f2f6..cc03f20 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -40,6 +40,7 @@ smb.conf changes
 
   Parameter Name                     Description             Default
   --------------                     -----------             -------
+  oplock contention limit            Removed
 
 NT4-style replication based net commands removed
 ================================================
diff --git a/docs-xml/manpages/smbclient.1.xml b/docs-xml/manpages/smbclient.1.xml
index 432f60d..0325982 100644
--- a/docs-xml/manpages/smbclient.1.xml
+++ b/docs-xml/manpages/smbclient.1.xml
@@ -1175,6 +1175,14 @@
 		</para></listitem>
 		</varlistentry>
 
+		<varlistentry>
+		<term>utimes <filename> <create time> <access time> <write time> <
+		change time></term>
+		<listitem><para>Changes the timestamps on a file by name.
+		Times should be specified in the format YY:MM:DD-HH:MM:SS or -1 for no change.
+		</para></listitem>
+		</varlistentry>
+
 	</variablelist>
 </refsect1>
 
diff --git a/docs-xml/smbdotconf/locking/oplockcontentionlimit.xml b/docs-xml/smbdotconf/locking/oplockcontentionlimit.xml
deleted file mode 100644
index edaa7d7..0000000
--- a/docs-xml/smbdotconf/locking/oplockcontentionlimit.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<samba:parameter name="oplock contention limit"
-                 context="S"
-                 type="integer"
-                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
-<description>
-	<para>
-	This is a <emphasis>very</emphasis> advanced <citerefentry><refentrytitle>smbd</refentrytitle>
-	<manvolnum>8</manvolnum></citerefentry> tuning option to improve the efficiency of the 
-	granting of oplocks under multiple client contention for the same file.
-	</para>
-		
-	<para>
-	In brief it specifies a number, which causes <citerefentry><refentrytitle>smbd</refentrytitle>
-	<manvolnum>8</manvolnum></citerefentry>not to grant an oplock even when requested if the 
-	approximate number of clients contending for an oplock on the same file goes over this 
-	limit. This causes <command moreinfo="none">smbd</command> to behave in a similar 
-	way to Windows NT.
-	</para>
-
-	<warning><para>
-	DO NOT CHANGE THIS PARAMETER UNLESS YOU HAVE READ AND UNDERSTOOD THE SAMBA OPLOCK CODE.
-	</para></warning>
-
-</description>
-<value type="default">2</value>
-</samba:parameter>
diff --git a/examples/scripts/shares/python/smbparm.py b/examples/scripts/shares/python/smbparm.py
index f182f57..e0786a4 100644
--- a/examples/scripts/shares/python/smbparm.py
+++ b/examples/scripts/shares/python/smbparm.py
@@ -173,7 +173,6 @@ parm_table = {
 	"PASSWDCHATDEBUG"        : ("passwd chat debug", SambaParmBool, P_GLOBAL, "No"),
 	"SMBPASSWDFILE"          : ("smb passwd file", SambaParmString, P_GLOBAL, "/etc/samba/private/smbpasswd"),
 	"GETQUOTACOMMAND"        : ("get quota command", SambaParmString, P_GLOBAL, ""),
-	"OPLOCKCONTENTIONLIMIT"  : ("oplock contention limit", SambaParmString, P_LOCAL, "2"),
 	"DOMAINMASTER"           : ("domain master", SambaParmString, P_GLOBAL, "Auto"),
 	"DELETESHARECOMMAND"     : ("delete share command", SambaParmString, P_GLOBAL, ""),
 	"INVALIDUSERS"           : ("invalid users", SambaParmString, P_LOCAL, ""),
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index b91f965..a74a873 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2935,8 +2935,6 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
 	lpcfg_do_global_parameter(lp_ctx, "blocking locks", "yes");
 
-	lpcfg_do_global_parameter(lp_ctx, "oplock contention limit", "2");
-
 	lpcfg_do_global_parameter(lp_ctx, "load printers", "yes");
 
 	lpcfg_do_global_parameter(lp_ctx, "idmap cache time", "604800");
diff --git a/source3/client/client.c b/source3/client/client.c
index 5ef9ad5..df16496 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4941,6 +4941,126 @@ static int cmd_show_connect( void )
 }
 
 /**
+ * set_remote_times - set times of a remote file
+ * @filename: path to the file name
+ * @create_time: New create time
+ * @access_time: New access time
+ * @write_time: New write time
+ * @change_time: New metadata change time
+ *
+ * Update the file times with the ones provided.
+ */
+static int set_remote_times(const char *filename, time_t create_time,
+			time_t access_time, time_t write_time,
+			time_t change_time)
+{
+	extern struct cli_state *cli;
+	NTSTATUS status;
+
+	status = cli_setpathinfo_basic(cli, filename, create_time,
+					access_time, write_time,
+					change_time, -1);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("cli_setpathinfo_basic failed: %s\n",
+			 nt_errstr(status));
+		return 1;
+	}
+
+	return 0;
+}
+
+/**
+ * cmd_utimes - interactive command to set the four times
+ *
+ * Read a filename and four times from the client command line and update
+ * the file times. A value of -1 for a time means don't change.
+ */
+static int cmd_utimes(void)
+{
+	const extern char *cmd_ptr;
+	char *buf;
+	char *fname = NULL;
+	time_t times[4] = {0, 0, 0, 0};
+	int time_count = 0;
+	int err = 0;
+	bool ok;
+	TALLOC_CTX *ctx = talloc_new(NULL);
+	if (ctx == NULL) {
+		return 1;
+	}
+
+	ok = next_token_talloc(ctx, &cmd_ptr, &buf, NULL);
+	if (!ok) {
+		d_printf("utimes <filename> <create-time> <access-time> "
+			 "<write-time> <change-time>\n");
+		d_printf("Dates should be in YY:MM:DD-HH:MM:SS format "
+			"or -1 for no change\n");
+		err = 1;
+		goto out;
+	}
+
+	fname = talloc_asprintf(ctx,
+				"%s%s",
+				client_get_cur_dir(),
+				buf);
+	if (fname == NULL) {
+		err = 1;
+		goto out;
+	}
+
+	while (next_token_talloc(ctx, &cmd_ptr, &buf, NULL) &&
+		time_count < 4) {
+		const char *s = buf;
+		struct tm tm = {0,};
+		char *ret;
+
+		if (strlen(s) == 2 && strcmp(s, "-1") == 0) {
+			times[time_count] = 0;
+			time_count++;
+			continue;
+		} else {
+			ret = strptime(s, "%y:%m:%d-%H:%M:%S", &tm);
+		}
+
+		/* We could not match all the chars, so print error */
+		if (ret == NULL || *ret != 0) {
+			d_printf("Invalid date format: %s\n", s);
+			d_printf("utimes <filename> <create-time> "
+				"<access-time> <write-time> <change-time>\n");
+			d_printf("Dates should be in YY:MM:DD-HH:MM:SS format "
+				"or -1 for no change\n");
+			err = 1;
+			goto out;
+		}
+
+		/* Convert tm to a time_t */
+		times[time_count] = mktime(&tm);
+		time_count++;
+	}
+
+	if (time_count < 4) {
+		d_printf("Insufficient dates: %d\n", time_count);
+		d_printf("utimes <filename> <create-time> <access-time> "
+			"<write-time> <change-time>\n");
+		d_printf("Dates should be in YY:MM:DD-HH:MM:SS format "
+			"or -1 for no change\n");
+		err = 1;
+		goto out;
+	}
+
+	DEBUG(10, ("times\nCreate: %sAccess: %s Write: %sChange: %s\n",
+		talloc_strdup(ctx, ctime(&times[0])),
+		talloc_strdup(ctx, ctime(&times[1])),
+		talloc_strdup(ctx, ctime(&times[2])),
+		talloc_strdup(ctx, ctime(&times[3]))));
+
+	set_remote_times(fname, times[0], times[1], times[2], times[3]);
+out:
+	talloc_free(ctx);
+	return err;
+}
+
+/**
  * set_remote_attr - set DOS attributes of a remote file
  * @filename: path to the file name
  * @new_attr: attribute bit mask to use
@@ -5254,6 +5374,8 @@ static struct {
   {"tcon",cmd_tcon,"connect to a share" ,{COMPL_NONE,COMPL_NONE}},
   {"tdis",cmd_tdis,"disconnect from a share",{COMPL_NONE,COMPL_NONE}},
   {"tid",cmd_tid,"show or set the current tid (tree-id)",{COMPL_NONE,COMPL_NONE}},
+  {"utimes", cmd_utimes,"<file name> <create_time> <access_time> <mod_time> "
+	"<ctime> set times", {COMPL_REMOTE,COMPL_NONE}},
   {"logoff",cmd_logoff,"log off (close the session)",{COMPL_NONE,COMPL_NONE}},
   {"..",cmd_cd_oneup,"change the remote directory (up one level)",{COMPL_REMOTE,COMPL_NONE}},
 
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 42e579e..02c3eb6 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -168,7 +168,6 @@ static struct loadparm_service sDefault =
 	.max_connections = 0,
 	.default_case = CASE_LOWER,
 	.printing = DEFAULT_PRINTING,
-	.oplock_contention_limit = 2,
 	.csc_policy = 0,
 	.block_size = 1024,
 	.dfree_cache_time = 0,
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index 19b81a5..616523e 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -368,7 +368,7 @@ again:
 
 	if (cli_credentials_is_anonymous(trust_creds)) {
 		DBG_WARNING("get_trust_credential for %s only gave anonymous,"
-			    "unable to make get NETLOGON credentials\n",
+			    "unable to negotiate NETLOGON credentials\n",
 			    netlogon_creds_cli_debug_string(
 				    creds_ctx, frame));
 		status = NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 5d05a1a5..e402a2c 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -1414,6 +1414,69 @@ EOF
     fi
 }
 
+# Test smbclient utimes command
+test_utimes()
+{
+    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+
+    cat > $tmpfile <<EOF
+del utimes_test
+put ${SMBCLIENT} utimes_test
+allinfo utimes_test
+utimes utimes_test -1 17:01:01-05:10:20 -1 -1
+allinfo utimes_test
+del utimes_test
+quit
+EOF
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=`eval $cmd`
+    ret=$?
+
+    if [ $ret != 0 ] ; then
+	echo "$out"
+	echo "failed utimes test with output $ret"
+	false
+	return
+    fi
+
+    # Now, we should have 2 identical create_time, write_time, change_time
+    # values, but one access_time of Jan  1 05:10:20 AM.
+    out=`echo "$out" | sort | uniq`
+    num_create=`echo "$out" | grep 'create_time:' | wc -l`
+    num_access=`echo "$out" | grep 'access_time:' | wc -l`
+    num_write=`echo "$out" | grep 'write_time:' | wc -l`
+    num_change=`echo "$out" | grep 'change_time:' | wc -l`
+    if [ "$num_create" != "1" ]; then
+        echo "failed - should only get one create_time $out"
+        false
+        return
+    fi
+    if [ "$num_access" != "2" ]; then
+        echo "failed - should get two access_time $out"
+        false
+        return
+    fi
+    if [ "$num_write" != "1" ]; then
+        echo "failed - should only get one write_time $out"
+        false
+        return
+    fi
+    if [ "$num_change" != "1" ]; then
+        echo "failed - should only get one change_time $out"
+        false
+        return
+    fi
+    echo "$out" | grep 'access_time:.*Sun Jan.*1 05:10:20 AM 2017'
+    ret=$?
+    if [ $ret -ne 0 ] ; then
+       echo "$out"
+       echo "failed - should get access_time:    Sun Jan  1 05:10:20 AM 2017"
+       false
+       return
+    fi
+}
+
 
 test_server_os_message()
 {
@@ -1564,6 +1627,10 @@ testit "setmode test" \
     test_setmode || \
     failed=`expr $failed + 1`
 
+testit "utimes" \
+    test_utimes || \
+    failed=`expr $failed + 1`
+
 testit "rm -rf $LOGDIR" \
     rm -rf $LOGDIR || \
     failed=`expr $failed + 1`


-- 
Samba Shared Repository



More information about the samba-cvs mailing list