util_sd: Make server conncection optional
authorChristof Schmitt <cs@samba.org>
Fri, 24 Apr 2015 16:49:23 +0000 (09:49 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 24 Apr 2015 22:04:24 +0000 (00:04 +0200)
If cli is not set, only attempt numeric conversions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11237

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/util_sd.c

index 7f5badf876e0cd99a7b576d7415047ecd3e538f6..810053927f261c390ca8ac5ffa0d3d9426bc9738 100644 (file)
@@ -141,7 +141,7 @@ void SidToString(struct cli_state *cli, fstring str, const struct dom_sid *sid,
 
        sid_to_fstring(str, sid);
 
-       if (numeric) {
+       if (numeric || cli == NULL) {
                return;
        }
 
@@ -218,6 +218,10 @@ bool StringToSid(struct cli_state *cli, struct dom_sid *sid, const char *str)
                return true;
        }
 
+       if (cli == NULL) {
+               return false;
+       }
+
        return NT_STATUS_IS_OK(cli_lsa_lookup_name(cli, str, &type, sid));
 }