Fix bug #7036 - net rpc getsid fails in hardened windows environments.
authorJeremy Allison <jra@samba.org>
Thu, 14 Jan 2010 23:39:30 +0000 (15:39 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 14 Jan 2010 23:39:30 +0000 (15:39 -0800)
Fix suggested by Dave.Daugherty@Centrify.com.

source3/utils/net_rpc.c

index 762af716f5af5c89b6082eb4538a46ebac185557..3b72506cc83ab2ca20ced114c223e146ebf5a5a6 100644 (file)
@@ -607,6 +607,12 @@ static NTSTATUS rpc_getsid_internals(struct net_context *c,
 
 int net_rpc_getsid(struct net_context *c, int argc, const char **argv)
 {
+       int conn_flags = NET_FLAGS_PDC;
+
+       if (!c->opt_user_specified) {
+               conn_flags |= NET_FLAGS_ANONYMOUS;
+       }
+
        if (c->display_usage) {
                d_printf(_("Usage:\n"
                           "net rpc getsid\n"
@@ -615,7 +621,7 @@ int net_rpc_getsid(struct net_context *c, int argc, const char **argv)
        }
 
        return run_rpc_command(c, NULL, &ndr_table_samr.syntax_id,
-                              NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
+                              conn_flags,
                               rpc_getsid_internals,
                               argc, argv);
 }