Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/libnet/libnet_site.c

    r414 r745  
    2121#include "libnet/libnet.h"
    2222#include "libcli/cldap/cldap.h"
    23 #include "lib/ldb/include/ldb.h"
    24 #include "lib/ldb/include/ldb_errors.h"
    25 #include "librpc/rpc/dcerpc.h"
     23#include <ldb.h>
     24#include <ldb_errors.h>
    2625#include "libcli/resolve/resolve.h"
    2726#include "param/param.h"
     27#include "lib/tsocket/tsocket.h"
    2828
    2929/**
     
    4242        struct cldap_socket *cldap = NULL;
    4343        struct cldap_netlogon search;
     44        int ret;
     45        struct tsocket_address *dest_address;
    4446
    4547        tmp_ctx = talloc_named(ctx, 0, "libnet_FindSite temp context");
     
    5153        /* Resolve the site name. */
    5254        ZERO_STRUCT(search);
    53         search.in.dest_address = r->in.dest_address;
    54         search.in.dest_port = r->in.cldap_port;
     55        search.in.dest_address = NULL;
     56        search.in.dest_port = 0;
    5557        search.in.acct_control = -1;
    5658        search.in.version = NETLOGON_NT_VERSION_5 | NETLOGON_NT_VERSION_5EX;
    5759        search.in.map_response = true;
    5860
     61        ret = tsocket_address_inet_from_strings(tmp_ctx, "ip",
     62                                                r->in.dest_address,
     63                                                r->in.cldap_port,
     64                                                &dest_address);
     65        if (ret != 0) {
     66                r->out.error_string = NULL;
     67                status = map_nt_error_from_unix(errno);
     68                return status;
     69        }
     70
    5971        /* we want to use non async calls, so we're not passing an event context */
    60         status = cldap_socket_init(tmp_ctx, NULL, NULL, NULL, &cldap);//TODO
     72        status = cldap_socket_init(tmp_ctx, NULL, NULL, dest_address, &cldap);
    6173        if (!NT_STATUS_IS_OK(status)) {
    6274                talloc_free(tmp_ctx);
     
    6476                return status;
    6577        }
    66         status = cldap_netlogon(cldap, lp_iconv_convenience(lctx->lp_ctx), tmp_ctx, &search);
     78        status = cldap_netlogon(cldap, tmp_ctx, &search);
    6779        if (!NT_STATUS_IS_OK(status)
    6880            || !search.out.netlogon.data.nt5_ex.client_site) {
     
    157169
    158170        make_nbt_name_client(&name, libnet_r->out.samr_binding->host);
    159         status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx);
     171        status = resolve_name(lpcfg_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx);
    160172        if (!NT_STATUS_IS_OK(status)) {
    161173                libnet_r->out.error_string = NULL;
     
    168180        r->in.netbios_name = libnet_r->in.netbios_name;
    169181        r->in.domain_dn_str = libnet_r->out.domain_dn_str;
    170         r->in.cldap_port = lp_cldap_port(ctx->lp_ctx);
     182        r->in.cldap_port = lpcfg_cldap_port(ctx->lp_ctx);
    171183
    172184        status = libnet_FindSite(tmp_ctx, ctx, r);
     
    192204
    193205        rtn = ldb_msg_add_string(msg, "objectClass", "server");
    194         if (rtn != 0) {
     206        if (rtn != LDB_SUCCESS) {
    195207                libnet_r->out.error_string = NULL;
    196208                talloc_free(tmp_ctx);
     
    198210        }
    199211        rtn = ldb_msg_add_string(msg, "systemFlags", "50000000");
    200         if (rtn != 0) {
     212        if (rtn != LDB_SUCCESS) {
    201213                libnet_r->out.error_string = NULL;
    202214                talloc_free(tmp_ctx);
     
    204216        }
    205217        rtn = ldb_msg_add_string(msg, "serverReference", libnet_r->out.account_dn_str);
    206         if (rtn != 0) {
     218        if (rtn != LDB_SUCCESS) {
    207219                libnet_r->out.error_string = NULL;
    208220                talloc_free(tmp_ctx);
     
    223235        rtn = ldb_add(remote_ldb, msg);
    224236        if (rtn == LDB_ERR_ENTRY_ALREADY_EXISTS) {
    225                 int i;
     237                unsigned int i;
    226238
    227239                /* make a 'modify' msg, and only for serverReference */
     
    235247
    236248                rtn = ldb_msg_add_string(msg, "serverReference",libnet_r->out.account_dn_str);
    237                 if (rtn != 0) {
     249                if (rtn != LDB_SUCCESS) {
    238250                        libnet_r->out.error_string = NULL;
    239251                        talloc_free(tmp_ctx);
     
    248260
    249261                rtn = ldb_modify(remote_ldb, msg);
    250                 if (rtn != 0) {
     262                if (rtn != LDB_SUCCESS) {
    251263                        libnet_r->out.error_string
    252264                                = talloc_asprintf(libnet_r,
     
    257269                        return NT_STATUS_INTERNAL_DB_CORRUPTION;
    258270                }
    259         } else if (rtn != 0) {
     271        } else if (rtn != LDB_SUCCESS) {
    260272                libnet_r->out.error_string
    261273                        = talloc_asprintf(libnet_r,
Note: See TracChangeset for help on using the changeset viewer.