Merge commit 'release-4-0-0alpha15' into master4-tmp
[kai/samba-autobuild/.git] / source3 / utils / netlookup.c
index dd0efa4142299755f8ede7d5cacc789be55842ed..5d81d43634ed58c68c5514426b1621647a6cb1e9 100644 (file)
 
 #include "includes.h"
 #include "utils/net.h"
+#include "rpc_client/cli_pipe.h"
+#include "../librpc/gen_ndr/ndr_lsa.h"
+#include "rpc_client/cli_lsarpc.h"
+#include "libsmb/libsmb.h"
 
 /********************************************************
  Connection cachine struct. Goes away when ctx destroyed.
@@ -74,7 +78,7 @@ static struct con_struct *create_cs(struct net_context *c,
                return cs;
        }
 
-       cs = TALLOC_P(ctx, struct con_struct);
+       cs = talloc(ctx, struct con_struct);
        if (!cs) {
                *perr = NT_STATUS_NO_MEMORY;
                return NULL;
@@ -94,7 +98,7 @@ static struct con_struct *create_cs(struct net_context *c,
        }
 #endif
 
-       nt_status = cli_full_connection(&cs->cli, global_myname(), global_myname(),
+       nt_status = cli_full_connection(&cs->cli, lp_netbios_name(), lp_netbios_name(),
                                        &loopback_ss, 0,
                                        "IPC$", "IPC",
 #if 0
@@ -107,8 +111,7 @@ static struct con_struct *create_cs(struct net_context *c,
                                        "",
 #endif
                                        0,
-                                       Undefined,
-                                       NULL);
+                                       Undefined);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(2,("create_cs: Connect failed. Error was %s\n", nt_errstr(nt_status)));
@@ -131,7 +134,7 @@ static struct con_struct *create_cs(struct net_context *c,
        }
 
        nt_status = rpccli_lsa_open_policy(cs->lsapipe, ctx, true,
-                               SEC_RIGHTS_MAXIMUM_ALLOWED,
+                               SEC_FLAG_MAXIMUM_ALLOWED,
                                &cs->pol);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
@@ -155,7 +158,7 @@ static struct con_struct *create_cs(struct net_context *c,
 
 NTSTATUS net_lookup_name_from_sid(struct net_context *c,
                                TALLOC_CTX *ctx,
-                               DOM_SID *psid,
+                               struct dom_sid *psid,
                                const char **ppdomain,
                                const char **ppname)
 {
@@ -197,11 +200,11 @@ NTSTATUS net_lookup_name_from_sid(struct net_context *c,
 ********************************************************/
 
 NTSTATUS net_lookup_sid_from_name(struct net_context *c, TALLOC_CTX *ctx,
-                                 const char *full_name, DOM_SID *pret_sid)
+                                 const char *full_name, struct dom_sid *pret_sid)
 {
        NTSTATUS nt_status;
        struct con_struct *csp = NULL;
-       DOM_SID *sids = NULL;
+       struct dom_sid *sids = NULL;
        enum lsa_SidType *types = NULL;
 
        csp = create_cs(c, ctx, &nt_status);