s4-torture: allow host-only in unc lists in smbtorture
authorAndrew Tridgell <tridge@samba.org>
Tue, 9 Feb 2010 02:18:31 +0000 (13:18 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 9 Feb 2010 03:46:09 +0000 (14:46 +1100)
Allow UNC lists like this:

 192.168.2.1
 192.168.2.2
 192.168.2.3

the share name will be taken from the command line

source4/libcli/cliconnect.c
source4/torture/util_smb.c

index 14935dadbab16c155905cdb8633ef9d751bb7010..1a5bd607b48b2fedbed6d4adffe98c77418b5d88 100644 (file)
@@ -238,13 +238,13 @@ bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx,
 {
        char *p;
 
-       *hostname = *sharename = NULL;
-
        if (strncmp(unc_name, "\\\\", 2) &&
            strncmp(unc_name, "//", 2)) {
                return false;
        }
 
+       *hostname = *sharename = NULL;
+
        *hostname = talloc_strdup(mem_ctx, &unc_name[2]);
        p = terminate_path_at_separator(*hostname);
 
index b35a1cb207697d8c86ac4903d9dca066b0778a81..216927ce70dcc3c527a32d59e38061ccb47ac5d7 100644 (file)
@@ -548,8 +548,11 @@ _PUBLIC_ bool torture_get_conn_index(int conn_index,
                return false;
        }
 
-       if (!smbcli_parse_unc(unc_list[conn_index % num_unc_names],
-                             mem_ctx, host, share)) {
+       p = unc_list[conn_index % num_unc_names];
+       if (p[0] != '/' && p[0] != '\\') {
+               /* allow UNC lists of hosts */
+               (*host) = talloc_strdup(mem_ctx, p);
+       } else if (!smbcli_parse_unc(p, mem_ctx, host, share)) {
                DEBUG(0, ("Failed to parse UNC name %s\n",
                          unc_list[conn_index % num_unc_names]));
                return false;