source3/libsmb/clidgram.h: fix licence/copyright
[samba.git] / source4 / libnet / libnet_site.c
index 410fb4b517ca3b44fc24ab8469210c301d378bd8..f49108b28a96dcf7ac6571cbef254e6bda06bea1 100644 (file)
@@ -20,9 +20,8 @@
 #include "includes.h"
 #include "libnet/libnet.h"
 #include "libcli/cldap/cldap.h"
-#include "lib/ldb/include/ldb.h"
-#include "lib/ldb/include/ldb_errors.h"
-#include "librpc/rpc/dcerpc.h"
+#include <ldb.h>
+#include <ldb_errors.h>
 #include "libcli/resolve/resolve.h"
 #include "param/param.h"
 #include "lib/tsocket/tsocket.h"
@@ -76,7 +75,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_context *lctx, struct li
                r->out.error_string = NULL;
                return status;
        }
-       status = cldap_netlogon(cldap, lp_iconv_convenience(lctx->lp_ctx), tmp_ctx, &search);
+       status = cldap_netlogon(cldap, tmp_ctx, &search);
        if (!NT_STATUS_IS_OK(status)
            || !search.out.netlogon.data.nt5_ex.client_site) {
                /*
@@ -169,7 +168,9 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
        }
 
        make_nbt_name_client(&name, libnet_r->out.samr_binding->host);
-       status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx);
+       status = resolve_name_ex(lpcfg_resolve_context(ctx->lp_ctx),
+                                0, 0,
+                                &name, r, &dest_addr, ctx->event_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                libnet_r->out.error_string = NULL;
                talloc_free(tmp_ctx);
@@ -180,7 +181,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
        r->in.dest_address = dest_addr;
        r->in.netbios_name = libnet_r->in.netbios_name;
        r->in.domain_dn_str = libnet_r->out.domain_dn_str;
-       r->in.cldap_port = lp_cldap_port(ctx->lp_ctx);
+       r->in.cldap_port = lpcfg_cldap_port(ctx->lp_ctx);
 
        status = libnet_FindSite(tmp_ctx, ctx, r);
        if (!NT_STATUS_IS_OK(status)) {
@@ -204,19 +205,19 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
        }
 
        rtn = ldb_msg_add_string(msg, "objectClass", "server");
-       if (rtn != 0) {
+       if (rtn != LDB_SUCCESS) {
                libnet_r->out.error_string = NULL;
                talloc_free(tmp_ctx);
                return NT_STATUS_NO_MEMORY;
        }
        rtn = ldb_msg_add_string(msg, "systemFlags", "50000000");
-       if (rtn != 0) {
+       if (rtn != LDB_SUCCESS) {
                libnet_r->out.error_string = NULL;
                talloc_free(tmp_ctx);
                return NT_STATUS_NO_MEMORY;
        }
        rtn = ldb_msg_add_string(msg, "serverReference", libnet_r->out.account_dn_str);
-       if (rtn != 0) {
+       if (rtn != LDB_SUCCESS) {
                libnet_r->out.error_string = NULL;
                talloc_free(tmp_ctx);
                return NT_STATUS_NO_MEMORY;
@@ -235,7 +236,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
 
        rtn = ldb_add(remote_ldb, msg);
        if (rtn == LDB_ERR_ENTRY_ALREADY_EXISTS) {
-               int i;
+               unsigned int i;
 
                /* make a 'modify' msg, and only for serverReference */
                msg = ldb_msg_new(tmp_ctx);
@@ -247,7 +248,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
                msg->dn = server_dn;
 
                rtn = ldb_msg_add_string(msg, "serverReference",libnet_r->out.account_dn_str);
-               if (rtn != 0) {
+               if (rtn != LDB_SUCCESS) {
                        libnet_r->out.error_string = NULL;
                        talloc_free(tmp_ctx);
                        return NT_STATUS_NO_MEMORY;
@@ -260,7 +261,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
                }
 
                rtn = ldb_modify(remote_ldb, msg);
-               if (rtn != 0) {
+               if (rtn != LDB_SUCCESS) {
                        libnet_r->out.error_string
                                = talloc_asprintf(libnet_r,
                                                  "Failed to modify server entry %s: %s: %d",
@@ -269,7 +270,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
                        talloc_free(tmp_ctx);
                        return NT_STATUS_INTERNAL_DB_CORRUPTION;
                }
-       } else if (rtn != 0) {
+       } else if (rtn != LDB_SUCCESS) {
                libnet_r->out.error_string
                        = talloc_asprintf(libnet_r,
                                "Failed to add server entry %s: %s: %d",