Add context for libcli_resolve.
[samba-svnmirror.git] / source / libnet / libnet_lookup.c
index 6856156734e002fafc5173ed7102b15117310e80..b8c6609d8e3fbf79eed350a2c3ddb51f2ba43b2f 100644 (file)
@@ -34,6 +34,8 @@
 #include "librpc/gen_ndr/lsa.h"
 #include "librpc/gen_ndr/ndr_lsa_c.h"
 
+#include "param/param.h"
+
 struct lookup_state {
        struct nbt_name hostname;
        const char *address;
@@ -55,7 +57,7 @@ struct composite_context *libnet_Lookup_send(struct libnet_context *ctx,
        struct composite_context *c;
        struct lookup_state *s;
        struct composite_context *cresolve_req;
-       const char** methods;
+       struct resolve_context *resolve_ctx;
 
        /* allocate context and state structures */
        c = composite_create(ctx, ctx->event_ctx);
@@ -79,14 +81,14 @@ struct composite_context *libnet_Lookup_send(struct libnet_context *ctx,
        s->hostname.scope  = NULL;
 
        /* name resolution methods */
-       if (io->in.methods) {
-               methods = io->in.methods;
+       if (io->in.resolve_ctx) {
+               resolve_ctx = io->in.resolve_ctx;
        } else {
-               methods = ctx->name_res_methods;
+               resolve_ctx = ctx->resolve_ctx;
        }
 
        /* send resolve request */
-       cresolve_req = resolve_name_send(&s->hostname, c->event_ctx, methods);
+       cresolve_req = resolve_name_send(resolve_ctx, &s->hostname, c->event_ctx);
        if (composite_nomem(cresolve_req, c)) return c;
 
        composite_continue(c, cresolve_req, continue_name_resolved, c);
@@ -189,10 +191,12 @@ struct composite_context* libnet_LookupDCs_send(struct libnet_context *ctx,
                                                struct libnet_LookupDCs *io)
 {
        struct composite_context *c;
-       struct messaging_context *msg_ctx = messaging_client_init(mem_ctx, ctx->event_ctx);
+       struct messaging_context *msg_ctx = 
+               messaging_client_init(mem_ctx, lp_messaging_path(mem_ctx, ctx->lp_ctx), ctx->event_ctx);
 
-       c = finddcs_send(mem_ctx, io->in.domain_name, io->in.name_type,
-                        NULL, ctx->name_res_methods, ctx->event_ctx, msg_ctx);
+       c = finddcs_send(mem_ctx, lp_netbios_name(ctx->lp_ctx),
+                        io->in.domain_name, io->in.name_type,
+                        NULL, ctx->resolve_ctx, ctx->event_ctx, msg_ctx);
        return c;
 }
 
@@ -257,7 +261,7 @@ struct composite_context* libnet_LookupName_send(struct libnet_context *ctx,
        struct composite_context *c;
        struct lookup_name_state *s;
        struct rpc_request *lookup_req;
-       BOOL prereq_met = False;
+       bool prereq_met = false;
 
        c = composite_create(mem_ctx, ctx->event_ctx);
        if (c == NULL) return NULL;