[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Tue Jun 26 18:30:02 UTC 2018


The branch, master has been updated
       via  f90f434 s3:tests: Add test for smbclient --quiet
       via  89a8b3e s3:client: Add --quiet option to smbclient
      from  113da7a dsdb audit: Fix timestamp tests

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


- Log -----------------------------------------------------------------
commit f90f434e041461fbea2e101066c79ec8caf35cce
Author: Justin Stephenson <jstephen at redhat.com>
Date:   Mon Jun 25 10:29:28 2018 -0400

    s3:tests: Add test for smbclient --quiet
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13485
    
    Signed-off-by: Justin Stephenson <jstephen at redhat.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Björn Baumbach <bb at sernet.de>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Tue Jun 26 20:29:19 CEST 2018 on sn-devel-144

commit 89a8b3ecd47b6d9a33e66f22d2786f0ae3b4cb72
Author: Justin Stephenson <jstephen at redhat.com>
Date:   Mon Jun 25 09:58:56 2018 -0400

    s3:client: Add --quiet option to smbclient
    
    Add quiet command-line argument to allow suppressing the help log
    message printed automatically after establishing a smbclient connection
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13485
    
    Signed-off-by: Justin Stephenson <jstephen at redhat.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Björn Baumbach <bb at sernet.de>

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

Summary of changes:
 source3/client/client.c                   |  9 +++++++-
 source3/script/tests/test_smbclient_s3.sh | 34 +++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/client.c b/source3/client/client.c
index 8dbf747..f112b8c 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -52,6 +52,7 @@ static int port = 0;
 static char *service;
 static char *desthost;
 static bool grepable = false;
+static bool quiet = false;
 static char *cmdstr = NULL;
 const char *cmd_ptr = NULL;
 
@@ -6066,7 +6067,9 @@ static int process_stdin(void)
 {
 	int rc = 0;
 
-	d_printf("Try \"help\" to get a list of possible commands.\n");
+	if (!quiet) {
+		d_printf("Try \"help\" to get a list of possible commands.\n");
+	}
 
 	while (!finished) {
 		TALLOC_CTX *frame = talloc_stackframe();
@@ -6336,6 +6339,7 @@ int main(int argc,char *argv[])
 		{ "timeout", 't', POPT_ARG_INT, &io_timeout, 'b', "Changes the per-operation timeout", "SECONDS" },
 		{ "port", 'p', POPT_ARG_INT, &port, 'p', "Port to connect to", "PORT" },
 		{ "grepable", 'g', POPT_ARG_NONE, NULL, 'g', "Produce grepable output" },
+		{ "quiet", 'q', POPT_ARG_NONE, NULL, 'q', "Suppress help message" },
                 { "browse", 'B', POPT_ARG_NONE, NULL, 'B', "Browse SMB servers using DNS" },
 		POPT_COMMON_SAMBA
 		POPT_COMMON_CONNECTION
@@ -6458,6 +6462,9 @@ int main(int argc,char *argv[])
 		case 'g':
 			grepable=true;
 			break;
+		case 'q':
+			quiet=true;
+			break;
 		case 'e':
 			smb_encrypt=true;
 			break;
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 96bd5eb..9a5170a 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -1606,6 +1606,36 @@ EOF
     return 0
 }
 
+test_server_quiet_message()
+{
+    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+    cat > $tmpfile <<EOF
+ls
+quit
+EOF
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS --quiet < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=`eval $cmd`
+    ret=$?
+    rm -f $tmpfile
+
+    if [ $ret -ne 0 ] ; then
+       echo "$out"
+       echo "failed to connect error $ret"
+       return 1
+    fi
+
+    echo "$out" | grep 'Try "help" to get a list of possible commands.'
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       echo "$out"
+       echo 'failed - quiet should skip this message.'
+       return 1
+    fi
+
+    return 0
+}
+
 # Test xattr_stream correctly reports mode.
 # BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
 
@@ -1797,6 +1827,10 @@ testit "server os message" \
     test_server_os_message || \
     failed=`expr $failed + 1`
 
+testit "test server quiet message" \
+    test_server_quiet_message || \
+    failed=`expr $failed + 1`
+
 testit "setmode test" \
     test_setmode || \
     failed=`expr $failed + 1`


-- 
Samba Shared Repository



More information about the samba-cvs mailing list