Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/libsmb/dsgetdcname.c

    r414 r740  
    2222
    2323#include "includes.h"
    24 
    25 #define DSGETDCNAME_FMT "DSGETDCNAME/DOMAIN/%s"
     24#include "libads/sitename_cache.h"
     25#include "../librpc/gen_ndr/ndr_netlogon.h"
     26#include "libads/cldap.h"
     27#include "libads/dns.h"
     28#include "libsmb/clidgram.h"
     29
    2630/* 15 minutes */
    2731#define DSGETDCNAME_CACHE_TTL   60*15
     
    123127        }
    124128
    125         return talloc_asprintf_strupper_m(mem_ctx, DSGETDCNAME_FMT, domain);
     129        return talloc_asprintf_strupper_m(mem_ctx, "DSGETDCNAME/DOMAIN/%s",
     130                                          domain);
    126131}
    127132
     
    190195        r->sockaddr.pdc_ip = talloc_strdup(mem_ctx, addr);
    191196
    192         ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, r,
     197        ndr_err = ndr_push_struct_blob(&blob, mem_ctx, r,
    193198                       (ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX);
    194199        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    196201        }
    197202
    198         if (r->domain) {
    199                 status = dsgetdcname_cache_store(mem_ctx, r->domain, &blob);
     203        if (r->domain_name) {
     204                status = dsgetdcname_cache_store(mem_ctx, r->domain_name, &blob);
    200205                if (!NT_STATUS_IS_OK(status)) {
    201206                        goto done;
    202207                }
    203208                if (r->client_site) {
    204                         sitename_store(r->domain, r->client_site);
     209                        sitename_store(r->domain_name, r->client_site);
    205210                }
    206211        }
     
    341346        }
    342347
    343         ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, &r,
     348        ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
    344349                      (ndr_pull_flags_fn_t)ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX);
    345350
     
    497502        dclist = TALLOC_ZERO_ARRAY(mem_ctx, struct ip_service_name, count);
    498503        if (!dclist) {
     504                SAFE_FREE(iplist);
    499505                return NT_STATUS_NO_MEMORY;
    500506        }
     
    512518                r->hostname = talloc_strdup(mem_ctx, addr);
    513519                if (!r->hostname) {
     520                        SAFE_FREE(iplist);
    514521                        return NT_STATUS_NO_MEMORY;
    515522                }
     
    519526        *returned_dclist = dclist;
    520527        *returned_count = count;
     528        SAFE_FREE(iplist);
    521529
    522530        return NT_STATUS_OK;
     
    622630                 * anything about the DC's   -- jerry */
    623631
    624                 if (!is_zero_addr((struct sockaddr *)(void *)&r->ss)) {
     632                if (!is_zero_addr(&r->ss)) {
    625633                        count++;
    626634                        continue;
     
    687695                info->forest_name = talloc_strdup(mem_ctx, forest_name);
    688696                NT_STATUS_HAVE_NO_MEMORY(info->forest_name);
    689                 flags |= DS_DNS_FOREST;
     697                flags |= DS_DNS_FOREST_ROOT;
    690698        }
    691699
     
    783791        map_dc_and_domain_names(flags,
    784792                                r->pdc_name,
    785                                 r->domain,
     793                                r->domain_name,
    786794                                r->pdc_dns_name,
    787795                                r->dns_domain,
     
    892900/****************************************************************
    893901****************************************************************/
    894 
    895 static struct event_context *ev_context(void)
    896 {
    897         static struct event_context *ctx;
    898 
    899         if (!ctx && !(ctx = event_context_init(NULL))) {
    900                 smb_panic("Could not init event context");
    901         }
    902         return ctx;
    903 }
    904 
    905 /****************************************************************
    906 ****************************************************************/
    907 
    908 static struct messaging_context *msg_context(TALLOC_CTX *mem_ctx)
    909 {
    910         static struct messaging_context *ctx;
    911 
    912         if (!ctx && !(ctx = messaging_init(mem_ctx, server_id_self(),
    913                                            ev_context()))) {
    914                 smb_panic("Could not init messaging context");
    915         }
    916         return ctx;
    917 }
    918902
    919903/****************************************************************
     
    941925                              NETLOGON_NT_VERSION_5EX_WITH_IP;
    942926
    943         if (!msg_ctx) {
    944                 msg_ctx = msg_context(mem_ctx);
     927        if (msg_ctx == NULL) {
     928                return NT_STATUS_INVALID_PARAMETER;
    945929        }
    946930
     
    954938
    955939        for (i=0; i<num_dcs; i++) {
     940                uint16_t val;
     941                int dgm_id;
     942
     943                generate_random_buffer((uint8_t *)&val, 2);
     944                dgm_id = val;
    956945
    957946                ip_list.ss = dclist[i].ss;
     
    962951                }
    963952
    964                 if (send_getdc_request(mem_ctx, msg_ctx,
    965                                        &dclist[i].ss, domain_name,
    966                                        NULL, nt_version))
    967                 {
    968                         int k;
    969                         smb_msleep(300);
    970                         for (k=0; k<5; k++) {
    971                                 if (receive_getdc_response(mem_ctx,
    972                                                            &dclist[i].ss,
    973                                                            domain_name,
    974                                                            &nt_version,
    975                                                            &dc_name,
    976                                                            &r)) {
    977                                         store_cache = true;
    978                                         namecache_store(dc_name, NBT_NAME_SERVER, 1, &ip_list);
    979                                         goto make_reply;
    980                                 }
    981                                 smb_msleep(1500);
    982                         }
     953                status = nbt_getdc(msg_ctx, &dclist[i].ss, domain_name,
     954                                   NULL, nt_version,
     955                                   mem_ctx, &nt_version, &dc_name, &r);
     956                if (NT_STATUS_IS_OK(status)) {
     957                        store_cache = true;
     958                        namecache_store(dc_name, NBT_NAME_SERVER, 1, &ip_list);
     959                        goto make_reply;
    983960                }
    984961
     
    999976
    1000977                        logon1.nt_version = nt_version;
    1001                         logon1.server = tmp_dc_name;
    1002                         logon1.domain = talloc_strdup_upper(mem_ctx, domain_name);
    1003                         NT_STATUS_HAVE_NO_MEMORY(logon1.domain);
     978                        logon1.pdc_name = tmp_dc_name;
     979                        logon1.domain_name = talloc_strdup_upper(mem_ctx, domain_name);
     980                        NT_STATUS_HAVE_NO_MEMORY(logon1.domain_name);
    1004981
    1005982                        r->data.nt4 = logon1;
Note: See TracChangeset for help on using the changeset viewer.