The branch, v4-0-test has been updated
       via  473ccb5 tests: dnsserver: Add a update test with name set to '.'
       via  e61ee11 s4-rpc: dnsserver: Allow . to be specified for @ record
       via  8dbf363 s3: net time - fix usage and core dump.
       via  2cac0df s3: xml-docs. Ensure users of 'net time' know the remote 
server must be specified with -S.
       via  fb49656 sys_poll_intr: fix timeout arithmetic
       via  6030045 lib: tevent: make TEVENT_SIG_INCREMENT atomic.
      from  03e9c64 VERSION: Bump version up to 4.0.22.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 473ccb5da6fd565292b66d0af9e1b2076b5400eb
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Mon Jul 28 18:09:37 2014 +1000

    tests: dnsserver: Add a update test with name set to '.'
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Stefan Metzmacher <me...@samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <me...@samba.org>
    Autobuild-Date(master): Tue Jul 29 19:33:19 CEST 2014 on sn-devel-104
    
    (cherry picked from commit 6d104182d9667e4f996439d24cfa052f34098ce4)
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10742
    samba-tool dns add 172.31.9.161 s4xdom.base . NS mydns.org. => NO_MEMORY
    
    Autobuild-User(v4-0-test): Karolin Seeger <ksee...@samba.org>
    Autobuild-Date(v4-0-test): Thu Aug 21 18:59:16 CEST 2014 on sn-devel-104

commit e61ee11fb5c1bc97d5da681bfb10582b9b3c504f
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Mon Jul 28 13:07:58 2014 +1000

    s4-rpc: dnsserver: Allow . to be specified for @ record
    
    Windows allow both . and @ to be specified with modifying @ record.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10742
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Stefan Metzmacher <me...@samba.org>
    (cherry picked from commit 4b4e30b780345c74f9983ba77f04c616b3d034b7)

commit 8dbf3636b54a70aac2c1de6cff14ed2c7471049d
Author: Jeremy Allison <j...@samba.org>
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 <j...@samba.org>

commit 2cac0df3c3e73d3d6a32e034f9e8e47d8c4561df
Author: Jeremy Allison <j...@samba.org>
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 <j...@samba.org>

commit fb496563b051757632bc2cb9bee8d08a93d3c903
Author: Daniel Kobras <d.kob...@science-computing.de>
Date:   Mon Jul 21 10:47:53 2014 +0200

    sys_poll_intr: fix timeout arithmetic
    
    Callers of sys_poll_intr() assume timeout to be in milliseconds like
    poll(2) expects, but implementation used nanosecond units. Also make
    sure timeout doesn't become infinite by mistake during time arithmetic.
    
    Signed-off-by: Daniel Kobras <d.kob...@science-computing.de>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10731
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Tue Jul 22 00:12:24 CEST 2014 on sn-devel-104

commit 60300459fe49a28bc151d9ae77c8fb1d388e25e1
Author: Jeremy Allison <j...@samba.org>
Date:   Wed Jul 30 09:58:47 2014 -0700

    lib: tevent: make TEVENT_SIG_INCREMENT atomic.
    
    On arm platforms incrementing a variable is not
    an atomic operation, so may be interrupted by
    signal processing (if a signal interrupts another
    signal handler).
    
    Use compiler built-ins to make this atomic.
    __sync_fetch_and_add() works on gcc, llvm,
    IBM xlC on AIX, and Intel icc (10.1 and
    above).
    
    atomic_add_32() works on Oracle Solaris.
    
    Based on an inital patch from ka...@osstech.co.jp.
    
    Bug #10640 - smbd is not responding - tevent_common_signal_handler() 
increments non-atomic variables
    
    https://bugzilla.samba.org/show_bug.cgi?id=10640
    
    Back-ported from master 536c799f00d7bdd6a574b6bdbc0e9c742eeef8b5
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <volker.lende...@sernet.de>

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

Summary of changes:
 docs-xml/manpages/net.8.xml                     |   15 ++++++--
 lib/replace/replace.h                           |    5 +++
 lib/replace/wscript                             |   25 ++++++++++++++
 lib/tevent/tevent_signal.c                      |    6 +++
 lib/util/select.c                               |   14 +++++++-
 python/samba/tests/dcerpc/dnsserver.py          |   41 ++++++++++++++++++++++-
 source3/utils/net_time.c                        |   30 +++++++++++-----
 source4/rpc_server/dnsserver/dcerpc_dnsserver.c |    4 ++-
 8 files changed, 122 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/net.8.xml b/docs-xml/manpages/net.8.xml
index bd46cff..f048819 100644
--- a/docs-xml/manpages/net.8.xml
+++ b/docs-xml/manpages/net.8.xml
@@ -166,7 +166,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>
@@ -174,21 +175,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/lib/replace/replace.h b/lib/replace/replace.h
index 674a2b4..6dbb4f0 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -871,4 +871,9 @@ int usleep(useconds_t);
 void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
 #endif
 
+/* Needed for Solaris atomic_add_XX functions. */
+#if defined(HAVE_SYS_ATOMIC_H)
+#include <sys/atomic.h>
+#endif
+
 #endif /* _LIBREPLACE_REPLACE_H */
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 61a25ec..59aa2d1 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -102,6 +102,7 @@ struct foo bar = { .y = 'X', .x = 1 };
     conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h')
     conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h malloc.h')
     conf.CHECK_HEADERS('syscall.h sys/syscall.h inttypes.h')
+    conf.CHECK_HEADERS('sys/atomic.h')
 
     conf.CHECK_CODE('''
                     #include <unistd.h>
@@ -209,6 +210,30 @@ struct foo bar = { .y = 'X', .x = 1 };
                        msg="Checking whether we have ucontext_t",
                        headers='signal.h sys/ucontext.h')
 
+    # Check for atomic builtins. */
+    conf.CHECK_CODE('''
+                    int main(void) {
+                        int i;
+                        (void)__sync_fetch_and_add(&i, 1);
+                        return 0;
+                    }
+                    ''',
+                    'HAVE___SYNC_FETCH_AND_ADD',
+                    msg='Checking for __sync_fetch_and_add compiler builtin')
+
+    conf.CHECK_CODE('''
+                    #include <stdint.h>
+                    #include <sys/atomic.h>
+                    int main(void) {
+                        int32_t i;
+                        atomic_add_32(&i, 1);
+                        return 0;
+                    }
+                    ''',
+                    'HAVE_ATOMIC_ADD_32',
+                    headers='stdint.h sys/atomic.h',
+                    msg='Checking for atomic_add_32 compiler builtin')
+
     # these may be builtins, so we need the link=False strategy
     conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy 
strncpy bzero', link=False)
 
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index b5a56ef..6cddc77 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -42,7 +42,13 @@ struct tevent_sigcounter {
        uint32_t seen;
 };
 
+#if defined(HAVE___SYNC_FETCH_AND_ADD)
+#define TEVENT_SIG_INCREMENT(s) __sync_fetch_and_add(&((s).count), 1)
+#elif defined(HAVE_ATOMIC_ADD_32)
+#define TEVENT_SIG_INCREMENT(s) atomic_add_32(&((s).count), 1)
+#else
 #define TEVENT_SIG_INCREMENT(s) (s).count++
+#endif
 #define TEVENT_SIG_SEEN(s, n) (s).seen += (n)
 #define TEVENT_SIG_PENDING(s) ((s).seen != (s).count)
 
diff --git a/lib/util/select.c b/lib/util/select.c
index 5e66344..99cd772 100644
--- a/lib/util/select.c
+++ b/lib/util/select.c
@@ -42,9 +42,19 @@ int sys_poll_intr(struct pollfd *fds, int num_fds, int 
timeout)
                if (errno != EINTR) {
                        break;
                }
+               /* Infinite timeout, no need to adjust. */
+               if (timeout < 0) {
+                       continue;
+               }
                clock_gettime_mono(&now);
-               elapsed = nsec_time_diff(&now, &start);
-               timeout = (orig_timeout - elapsed) / 1000000;
+               elapsed = nsec_time_diff(&now, &start) / 1000000;
+               timeout = orig_timeout - elapsed;
+               /* Unlikely, but might happen eg. when getting traced.
+                * Make sure we're not hanging in this case.
+                */
+               if (timeout < 0) {
+                       timeout = 0;
+               }
        };
        return ret;
 }
diff --git a/python/samba/tests/dcerpc/dnsserver.py 
b/python/samba/tests/dcerpc/dnsserver.py
index 59d6eee..e2c6667 100644
--- a/python/samba/tests/dcerpc/dnsserver.py
+++ b/python/samba/tests/dcerpc/dnsserver.py
@@ -19,7 +19,7 @@
 
 from samba.dcerpc import dnsp, dnsserver
 from samba.tests import RpcInterfaceTestCase, env_get_var_value
-from samba.netcmd.dns import ARecord
+from samba.netcmd.dns import ARecord, NSRecord
 
 class DnsserverTests(RpcInterfaceTestCase):
 
@@ -239,3 +239,42 @@ class DnsserverTests(RpcInterfaceTestCase):
                                         select_flags,
                                         None,
                                         None)
+
+    def test_updaterecords2_soa(self):
+        client_version = dnsserver.DNS_CLIENT_VERSION_LONGHORN
+        record_type = dnsp.DNS_TYPE_NS
+        select_flags = (dnsserver.DNS_RPC_VIEW_AUTHORITY_DATA |
+                        dnsserver.DNS_RPC_VIEW_NO_CHILDREN)
+
+        nameserver = 'ns.example.local'
+        rec = NSRecord(nameserver)
+
+        # Add record
+        add_rec_buf = dnsserver.DNS_RPC_RECORD_BUF()
+        add_rec_buf.rec = rec
+        self.conn.DnssrvUpdateRecord2(client_version,
+                                        0,
+                                        self.server,
+                                        self.zone,
+                                        '.',
+                                        add_rec_buf,
+                                        None)
+
+        buflen, result = self.conn.DnssrvEnumRecords2(client_version,
+                                                        0,
+                                                        self.server,
+                                                        self.zone,
+                                                        '@',
+                                                        None,
+                                                        record_type,
+                                                        select_flags,
+                                                        None,
+                                                        None)
+        self.assertEquals(1, result.count)
+        self.assertEquals(2, result.rec[0].wRecordCount)
+        match = False
+        for i in range(2):
+            self.assertEquals(dnsp.DNS_TYPE_NS, result.rec[0].records[i].wType)
+            if result.rec[0].records[i].data.str.rstrip('.') == nameserver:
+                match = True
+        self.assertEquals(match, True)
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;
        }
 
diff --git a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c 
b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
index 5733a51..d54940a 100644
--- a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
+++ b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
@@ -1853,7 +1853,9 @@ static WERROR dnsserver_update_record(struct 
dnsserver_state *dsstate,
        W_ERROR_HAVE_NO_MEMORY(tmp_ctx);
 
        /* If node_name is @ or zone name, dns record is @ */
-       if (strcmp(node_name, "@") == 0 || strcasecmp(node_name, z->name) == 0) 
{
+       if (strcmp(node_name, "@") == 0 ||
+           strcmp(node_name, ".") == 0 ||
+           strcasecmp(node_name, z->name) == 0) {
                name = talloc_strdup(tmp_ctx, "@");
        } else {
                name = dns_split_node_name(tmp_ctx, node_name, z->name);


-- 
Samba Shared Repository

Reply via email to