The branch, master has been updated
       via  6abeff5 s3: net time - fix usage and core dump.
       via  9919c90 s3: xml-docs. Ensure users of 'net time' know the remote 
server must be specified with -S.
      from  ff13e28 tests: dnsserver: Remove duplicate empty test function

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


- Log -----------------------------------------------------------------
commit 6abeff5f46d2d46332a36018370b69ebb547799f
Author: Jeremy Allison <[email protected]>
Date:   Tue Jul 29 14:12:31 2014 -0700

    s3: net time - fix usage and core dump.
    
    Bug 10728 - 'net time system' segfaults
    
    https://bugzilla.samba.org/show_bug.cgi?id=10728
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: David Disseldorp <[email protected]>
    
    Autobuild-User(master): David Disseldorp <[email protected]>
    Autobuild-Date(master): Wed Jul 30 13:32:47 CEST 2014 on sn-devel-104

commit 9919c90ca8622ef4c9bb3753518a9bffd0c4f3b9
Author: Jeremy Allison <[email protected]>
Date:   Tue Jul 29 12:29:37 2014 -0700

    s3: xml-docs. Ensure users of 'net time' know the remote server must be 
specified with -S.
    
    Bug 10728 - 'net time system' segfaults
    
    https://bugzilla.samba.org/show_bug.cgi?id=10728
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: David Disseldorp <[email protected]>

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

Summary of changes:
 docs-xml/manpages/net.8.xml |   15 +++++++++++----
 source3/utils/net_time.c    |   30 ++++++++++++++++++++----------
 2 files changed, 31 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/net.8.xml b/docs-xml/manpages/net.8.xml
index 8524d1f..d497e66 100644
--- a/docs-xml/manpages/net.8.xml
+++ b/docs-xml/manpages/net.8.xml
@@ -404,7 +404,8 @@ YOU HAVE BEEN WARNED.
 <title>TIME</title>
 
 <para>Without any options, the <command>NET TIME</command> command 
-displays the time on the remote server.
+displays the time on the remote server. The remote server must be
+specified with the -S option.
 </para>
 
 </refsect3>
@@ -412,21 +413,27 @@ displays the time on the remote server.
 <refsect3>
 <title>TIME SYSTEM</title>
 
-<para>Displays the time on the remote server in a format ready for 
<command>/bin/date</command>.</para>
+<para>Displays the time on the remote server in a format ready for 
<command>/bin/date</command>.
+The remote server must be specified with the -S option.
+</para>
 
 </refsect3>
 
 <refsect3>
 <title>TIME SET</title>
 <para>Tries to set the date and time of the local server to that on 
-the remote server using <command>/bin/date</command>. </para>
+the remote server using <command>/bin/date</command>.
+The remote server must be specified with the -S option.
+</para>
 
 </refsect3>
 
 <refsect3>
 <title>TIME ZONE</title>
 
-<para>Displays the timezone in hours from GMT on the remote computer.</para>
+<para>Displays the timezone in hours from GMT on the remote server.
+The remote server must be specified with the -S option.
+</para>
 
 </refsect3>
 </refsect2>
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c
index 847b4fe..56ce8f7 100644
--- a/source3/utils/net_time.c
+++ b/source3/utils/net_time.c
@@ -84,10 +84,10 @@ static const char *systime(time_t t)
 int net_time_usage(struct net_context *c, int argc, const char **argv)
 {
        d_printf(_(
-"net time\n\tdisplays time on a server\n\n"
-"net time system\n\tdisplays time on a server in a format ready for 
/bin/date\n\n"
-"net time set\n\truns /bin/date with the time from the server\n\n"
-"net time zone\n\tdisplays the timezone in hours from GMT on the remote 
computer\n\n"
+"net time\n\tdisplays time on a server (-S server)\n\n"
+"net time system\n\tdisplays time on a server (-S server) in a format ready 
for /bin/date\n\n"
+"net time set\n\truns /bin/date with the time from the server (-S server)\n\n"
+"net time zone\n\tdisplays the timezone in hours from GMT on the remote server 
(-S server)\n\n"
 "\n"));
        net_common_flags_usage(c, argc, argv);
        return -1;
@@ -99,6 +99,16 @@ static int net_time_set(struct net_context *c, int argc, 
const char **argv)
        struct timeval tv;
        int result;
 
+       if (c->display_usage || c->opt_host == NULL) {
+               d_printf(  "%s\n"
+                          "net time set\n"
+                          "    %s\n",
+                        _("Usage:"),
+                        _("Set local time to that of remote time "
+                               "server (-S server) "));
+               return 0;
+       }
+
        tv.tv_sec = nettime(c, NULL);
        tv.tv_usec=0;
 
@@ -118,13 +128,13 @@ static int net_time_system(struct net_context *c, int 
argc, const char **argv)
 {
        time_t t;
 
-       if (c->display_usage) {
+       if (c->display_usage || c->opt_host == NULL) {
                d_printf(  "%s\n"
                           "net time system\n"
                           "    %s\n",
                         _("Usage:"),
-                        _("Output remote time server time in a format "
-                          "ready for /bin/date"));
+                        _("Output remote time server (-S server) "
+                               "time in a format ready for /bin/date"));
                return 0;
        }
 
@@ -144,13 +154,13 @@ static int net_time_zone(struct net_context *c, int argc, 
const char **argv)
        char zsign;
        time_t t;
 
-       if (c->display_usage) {
+       if (c->display_usage || c->opt_host == NULL) {
                d_printf(  "%s\n"
                           "net time zone\n"
                           "   %s\n",
                         _("Usage:"),
-                        _("Display the remote time server's offset to "
-                          "UTC"));
+                        _("Display the remote time server's (-S server) "
+                               "offset to UTC"));
                return 0;
        }
 


-- 
Samba Shared Repository

Reply via email to