This makes smbcacls a bit easier to use and debug.
authorAndrew Bartlett <abartlet@samba.org>
Sat, 13 Jul 2002 09:03:41 +0000 (09:03 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 13 Jul 2002 09:03:41 +0000 (09:03 +0000)
Allow connection in the form of //server/share instead of just \\server\share
and show the reason for failure from cli_full_connection().

Andrew Bartlett
(This used to be commit 4687fac69d995e49a0f3701fb170d64af1ba4a47)

source3/utils/smbcacls.c

index aa00eab42c9f9ff0a079d2aacc0ab0cc373b8e14..b6a13180a377715e836405db1aa79ee6eb53d257 100644 (file)
@@ -155,7 +155,6 @@ static BOOL StringToSid(DOM_SID *sid, const char *str)
        }
 
        sid_copy(sid, &sids[0]);
-
  done:
 
        return result;
@@ -708,6 +707,7 @@ static struct cli_state *connect_one(char *share)
 {
        struct cli_state *c;
        struct in_addr ip;
+       NTSTATUS nt_status;
        zero_ip(&ip);
        
        if (!got_pass) {
@@ -718,13 +718,14 @@ static struct cli_state *connect_one(char *share)
                }
        }
 
-       if (NT_STATUS_IS_OK(cli_full_connection(&c, global_myname, server, 
-                                               &ip, 0,
-                                               share, "?????",  
-                                               username, global_myworkgroup,
-                                               password, 0))) {
+       if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname, server, 
+                                                           &ip, 0,
+                                                           share, "?????",  
+                                                           username, global_myworkgroup,
+                                                           password, 0))) {
                return c;
        } else {
+               DEBUG(0,("cli_full_connection failed! (%s)\n", nt_errstr(nt_status)));
                return NULL;
        }
 }
@@ -875,7 +876,7 @@ You can string acls together with spaces, commas or newlines\n\
 
        argc -= optind;
        argv += optind;
-       
+
        if (argc > 0) {
                usage();
                talloc_destroy(ctx);
@@ -886,7 +887,13 @@ You can string acls together with spaces, commas or newlines\n\
 
        fstrcpy(server,share+2);
        share = strchr_m(server,'\\');
-       if (!share) return -1;
+       if (!share) {
+               share = strchr_m(server,'/');
+               if (!share) {
+                       return -1;
+               }
+       }
+
        *share = 0;
        share++;