Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/source4/nbt_server
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/nbt_server/dgram/netlogon.c

    r740 r988  
    2929#include "param/param.h"
    3030#include "smbd/service_task.h"
    31 #include "cldap_server/cldap_server.h"
     31#include "dsdb/samdb/ldb_modules/util.h"
    3232#include "libcli/security/security.h"
    3333#include "nbt_server/dgram/proto.h"
     34#include "libds/common/roles.h"
    3435
    3536/*
     
    5556        samctx = iface->nbtsrv->sam_ctx;
    5657
    57         if (lpcfg_server_role(iface->nbtsrv->task->lp_ctx) != ROLE_DOMAIN_CONTROLLER
     58        if (lpcfg_server_role(iface->nbtsrv->task->lp_ctx) != ROLE_ACTIVE_DIRECTORY_DC
    5859            || !samdb_is_pdc(samctx)) {
    5960                DEBUG(2, ("Not a PDC, so not processing LOGON_PRIMARY_QUERY\n"));
     
    169170        }
    170171
    171         DEBUG(2,("netlogon request to %s from %s:%d\n",
     172        DEBUG(5,("netlogon request to %s from %s:%d\n",
    172173                 nbt_name_string(netlogon, name), src->addr, src->port));
    173174        status = dgram_mailslot_netlogon_parse_request(dgmslot, netlogon, packet, netlogon);
  • vendor/current/source4/nbt_server/interfaces.c

    r740 r988  
    277277                                 struct interface *ifaces)
    278278{
    279         int num_interfaces = iface_count(ifaces);
     279        int num_interfaces = iface_list_count(ifaces);
    280280        int i;
    281281        TALLOC_CTX *tmp_ctx = talloc_new(nbtsrv);
     
    287287                const char *primary_address;
    288288
     289                primary_address = iface_list_first_v4(ifaces);
     290
    289291                /* the primary address is the address we will return
    290292                   for non-WINS queries not made on a specific
    291293                   interface */
    292                 if (num_interfaces > 0) {
    293                         primary_address = iface_n_ip(ifaces, 0);
    294                 } else {
     294                if (primary_address == NULL) {
    295295                        primary_address = inet_ntoa(interpret_addr2(
    296                                                         lpcfg_netbios_name(lp_ctx)));
    297                 }
     296                                                            lpcfg_netbios_name(lp_ctx)));
     297                }
     298
    298299                primary_address = talloc_strdup(tmp_ctx, primary_address);
    299300                NT_STATUS_HAVE_NO_MEMORY(primary_address);
     
    309310
    310311        for (i=0; i<num_interfaces; i++) {
    311                 const char *bcast = iface_n_bcast(ifaces, i);
     312                const char *bcast;
    312313                const char *address, *netmask;
    313314
     315                if (!iface_list_n_is_v4(ifaces, i)) {
     316                        /* v4 only for NBT protocol */
     317                        continue;
     318                }
     319
     320                bcast = iface_list_n_bcast(ifaces, i);
    314321                /* we can't assume every interface is broadcast capable */
    315322                if (bcast == NULL) continue;
    316323
    317                 address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
     324                address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
    318325                bcast   = talloc_strdup(tmp_ctx, bcast);
    319                 netmask = talloc_strdup(tmp_ctx, iface_n_netmask(ifaces, i));
     326                netmask = talloc_strdup(tmp_ctx, iface_list_n_netmask(ifaces, i));
    320327
    321328                status = nbtd_add_socket(nbtsrv, lp_ctx,
     
    347354
    348355        if (iface->ip_address) {
    349                 is_loopback = iface_same_net(iface->ip_address, "127.0.0.1", "255.0.0.0");
     356                is_loopback = iface_list_same_net(iface->ip_address, "127.0.0.1", "255.0.0.0");
    350357                ret = str_list_add(ret, iface->ip_address);
    351358        }
     
    357364
    358365                if (!is_loopback) {
    359                         if (iface_same_net(iface2->ip_address, "127.0.0.1", "255.0.0.0")) {
     366                        if (iface_list_same_net(iface2->ip_address, "127.0.0.1", "255.0.0.0")) {
    360367                                continue;
    361368                        }
     
    381388        /* try to find a exact match */
    382389        for (cur=nbtd_server->interfaces;cur;cur=cur->next) {
    383                 if (iface_same_net(address, cur->ip_address, cur->netmask)) {
     390                if (iface_list_same_net(address, cur->ip_address, cur->netmask)) {
    384391                        DEBUG(10,("find interface for dst[%s] ip: %s/%s (iface[%p])\n",
    385392                                  address, cur->ip_address, cur->netmask, cur));
  • vendor/current/source4/nbt_server/nbt_server.c

    r740 r988  
    3131#include "param/param.h"
    3232
     33NTSTATUS server_service_nbtd_init(void);
     34
    3335/*
    3436  startup the nbtd task
     
    4042        struct interface *ifaces;
    4143
    42         load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
     44        load_interface_list(task, task->lp_ctx, &ifaces);
    4345
    44         if (iface_count(ifaces) == 0) {
     46        if (iface_list_count(ifaces) == 0) {
    4547                task_server_terminate(task, "nbtd: no network interfaces configured", false);
     48                return;
     49        }
     50
     51        if (lpcfg_disable_netbios(task->lp_ctx)) {
     52                task_server_terminate(task, "nbtd: 'disable netbios = yes' set in smb.conf, shutting down nbt server", false);
    4653                return;
    4754        }
  • vendor/current/source4/nbt_server/query.c

    r740 r988  
    8383           (packet->operation & NBT_FLAG_RECURSION_DESIRED) &&
    8484           (iname->nb_flags & NBT_NM_GROUP) &&
    85            lpcfg_wins_support(iface->nbtsrv->task->lp_ctx)) {
     85           lpcfg_we_are_a_wins_server(iface->nbtsrv->task->lp_ctx)) {
    8686                nbtd_winsserver_request(nbtsock, packet, src);
    8787                return;
  • vendor/current/source4/nbt_server/register.c

    r740 r988  
    3131#include "dsdb/samdb/samdb.h"
    3232#include "param/param.h"
     33#include "libds/common/roles.h"
    3334
    3435static void nbtd_start_refresh_timer(struct nbtd_iface_name *iname);
     
    123124        refresh_time = MIN(max_refresh_time, iname->ttl/2);
    124125       
    125         event_add_timed(iname->iface->nbtsrv->task->event_ctx,
     126        tevent_add_timer(iname->iface->nbtsrv->task->event_ctx,
    126127                        iname,
    127128                        timeval_add(&iname->registration_time, refresh_time, 0),
     
    199200        iname->wins_server       = NULL;
    200201
    201         DLIST_ADD_END(iface->names, iname, struct nbtd_iface_name *);
     202        DLIST_ADD_END(iface->names, iname);
    202203
    203204        if (nb_flags & NBT_NM_PERMANENT) {
     
    290291        }
    291292
    292         if (lpcfg_server_role(nbtsrv->task->lp_ctx) == ROLE_DOMAIN_CONTROLLER)  {
     293        if (lpcfg_server_role(nbtsrv->task->lp_ctx) == ROLE_ACTIVE_DIRECTORY_DC)        {
    293294                bool is_pdc = samdb_is_pdc(nbtsrv->sam_ctx);
    294295                if (is_pdc) {
  • vendor/current/source4/nbt_server/wins/wins_dns_proxy.c

    r414 r988  
    2828#include "smbd/service_task.h"
    2929#include "libcli/resolve/resolve.h"
     30#include "lib/socket/socket.h"
    3031
    3132struct wins_dns_proxy_state {
     
    7980        s->nbtsock      = nbtsock;
    8081        s->packet       = talloc_steal(s, packet);
    81         s->src          = src;
    82         if (!talloc_reference(s, src)) {
     82        s->src          = socket_address_copy(s, src);
     83        if (s->src == NULL) {
    8384                goto failed;
    8485        }
  • vendor/current/source4/nbt_server/wins/wins_ldb.c

    r740 r988  
    9393        if (!owner) {
    9494                struct interface *ifaces;
    95                 load_interfaces(module, lpcfg_interfaces(lp_ctx), &ifaces);
    96                 owner = iface_n_ip(ifaces, 0);
     95                load_interface_list(module, lp_ctx, &ifaces);
     96                owner = iface_list_first_v4(ifaces);
    9797                if (!owner) {
    9898                        owner = "0.0.0.0";
  • vendor/current/source4/nbt_server/wins/winsclient.c

    r740 r988  
    6161        refresh_time = MIN(max_refresh_time, iname->ttl/2);
    6262       
    63         event_add_timed(iname->iface->nbtsrv->task->event_ctx,
     63        tevent_add_timer(iname->iface->nbtsrv->task->event_ctx,
    6464                        iname,
    6565                        timeval_add(&iname->registration_time, refresh_time, 0),
     
    143143        struct tevent_req *subreq;
    144144        struct nbtd_wins_refresh_state *state;
     145        char **l;
    145146
    146147        state = talloc_zero(iname, struct nbtd_wins_refresh_state);
     
    153154        /* setup a wins name refresh request */
    154155        state->io.in.name            = iname->name;
    155         state->io.in.wins_servers    = (const char **)str_list_make_single(state, iname->wins_server);
     156        l = str_list_make_single(state, iname->wins_server);
     157        state->io.in.wins_servers    = discard_const_p(const char *, l);
    156158        state->io.in.wins_port       = lpcfg_nbt_port(iface->nbtsrv->task->lp_ctx);
    157159        state->io.in.addresses       = nbtd_address_list(iface, state);
     
    195197                   periodically */
    196198                int wins_retry_time = lpcfg_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "wins_retry", 300);
    197                 event_add_timed(iname->iface->nbtsrv->task->event_ctx,
     199                tevent_add_timer(iname->iface->nbtsrv->task->event_ctx,
    198200                                iname,
    199201                                timeval_current_ofs(wins_retry_time, 0),
  • vendor/current/source4/nbt_server/wins/winsdb.c

    r740 r988  
    125125}
    126126
    127 uint64_t winsdb_get_seqnumber(struct winsdb_handle *h)
    128 {
    129         int ret;
    130         struct ldb_context *ldb = h->ldb;
    131         struct ldb_dn *dn;
    132         struct ldb_result *res = NULL;
    133         TALLOC_CTX *tmp_ctx = talloc_new(ldb);
    134         uint64_t seqnumber = 0;
    135 
    136         dn = ldb_dn_new(tmp_ctx, ldb, "@BASEINFO");
    137         if (!dn) goto failed;
    138 
    139         /* find the record in the WINS database */
    140         ret = ldb_search(ldb, tmp_ctx, &res, dn, LDB_SCOPE_BASE, NULL, NULL);
    141         if (ret != LDB_SUCCESS) goto failed;
    142         if (res->count > 1) goto failed;
    143 
    144         if (res->count == 1) {
    145                 seqnumber = ldb_msg_find_attr_as_uint64(res->msgs[0], "sequenceNumber", 0);
    146         }
    147 
    148 failed:
    149         talloc_free(tmp_ctx);
    150         return seqnumber;
    151 }
    152 
    153127/*
    154128  return a DN for a nbt_name
     
    250224                /* support old entries, with only the address */
    251225                addr->address           = (const char *)talloc_steal(addr, val->data);
    252                 addr->wins_owner        = talloc_reference(addr, rec->wins_owner);
     226                addr->wins_owner        = talloc_strdup(addr, rec->wins_owner);
    253227                if (!addr->wins_owner) {
    254228                        status = NT_STATUS_NO_MEMORY;
     
    930904
    931905static bool winsdb_check_or_add_module_list(struct tevent_context *ev_ctx,
    932                                             struct loadparm_context *lp_ctx, struct winsdb_handle *h)
     906                                            struct loadparm_context *lp_ctx, struct winsdb_handle *h,
     907                                            const char *wins_path)
    933908{
    934909        int trans;
     
    976951        }
    977952
    978         h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)),
     953        h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, wins_path,
    979954                                  NULL, NULL, flags);
    980955        if (!h->ldb) goto failed;
     
    1004979        bool ret;
    1005980        int ldb_err;
     981        char *wins_path;
    1006982
    1007983        h = talloc_zero(mem_ctx, struct winsdb_handle);
    1008984        if (!h) return NULL;
    1009985
     986        wins_path = lpcfg_state_path(h, lp_ctx, "wins.ldb");
     987
    1010988        if (lpcfg_parm_bool(lp_ctx, NULL,"winsdb", "nosync", false)) {
    1011989                flags |= LDB_FLG_NOSYNC;
    1012990        }
    1013991
    1014         h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)),
     992        h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, wins_path,
    1015993                                  NULL, NULL, flags);
    1016994        if (!h->ldb) goto failed;
    1017995
    1018996        h->caller = caller;
    1019         h->hook_script = lpcfg_wins_hook(lp_ctx);
     997        h->hook_script = lpcfg_wins_hook(lp_ctx, h);
    1020998
    1021999        h->local_owner = talloc_strdup(h, owner);
     
    10231001
    10241002        /* make sure the module list is available and used */
    1025         ret = winsdb_check_or_add_module_list(ev_ctx, lp_ctx, h);
     1003        ret = winsdb_check_or_add_module_list(ev_ctx, lp_ctx, h, wins_path);
    10261004        if (!ret) goto failed;
    10271005
  • vendor/current/source4/nbt_server/wins/winsserver.c

    r740 r988  
    412412        s->reg_address          = packet->additional[0].rdata.netbios.addresses[0].ipaddr;
    413413        s->new_type             = new_type;
    414         s->src                  = src;
    415         if (talloc_reference(s, src) == NULL) goto failed;
     414        s->src                  = socket_address_copy(s, src);
     415        if (s->src == NULL) goto failed;
    416416
    417417        s->io.in.nbtd_server    = iface->nbtsrv;
     
    423423        if (s->io.in.addresses == NULL) goto failed;
    424424
    425         DLIST_ADD_END(iface->wack_queue, s, struct nbtd_wins_wack_state *);
     425        DLIST_ADD_END(iface->wack_queue, s);
    426426
    427427        talloc_set_destructor(s, nbtd_wins_wack_state_destructor);
     
    680680        /*
    681681         * choose a random address to be the first in the response to the client,
    682          * preferr the addresses inside the nbtd:wins_randomize1Clist_mask netmask
     682         * prefer the addresses inside the nbtd:wins_randomize1Clist_mask netmask
    683683         */
    684684        r = random();
     
    689689
    690690                /* if the current one is in the same subnet, use it */
    691                 same = iface_same_net(addresses[idx], src->addr, mask);
     691                same = iface_list_same_net(addresses[idx], src->addr, mask);
    692692                if (same) {
    693693                        sidx = idx;
     
    10391039        const char *owner;
    10401040
    1041         if (!lpcfg_wins_support(nbtsrv->task->lp_ctx)) {
     1041        if (!lpcfg_we_are_a_wins_server(nbtsrv->task->lp_ctx)) {
    10421042                nbtsrv->winssrv = NULL;
    10431043                return NT_STATUS_OK;
     
    10581058        if (owner == NULL) {
    10591059                struct interface *ifaces;
    1060                 load_interfaces(nbtsrv->task, lpcfg_interfaces(nbtsrv->task->lp_ctx), &ifaces);
    1061                 owner = iface_n_ip(ifaces, 0);
     1060                load_interface_list(nbtsrv->task, nbtsrv->task->lp_ctx, &ifaces);
     1061                owner = iface_list_first_v4(ifaces);
    10621062        }
    10631063
  • vendor/current/source4/nbt_server/wins/winswack.c

    r740 r988  
    308308        s->io.in.nbtd_server    = nbtd_server;
    309309        s->io.in.nbt_port       = lpcfg_nbt_port(nbtd_server->task->lp_ctx);
    310         s->io.in.event_ctx      = msg->ev;
     310        s->io.in.event_ctx      = nbtd_server->task->event_ctx;
    311311        s->io.in.name           = &req->in.name;
    312312        s->io.in.num_addresses  = req->in.num_addrs;
     
    367367
    368368        s->io.in.nbtd_server    = nbtd_server;
    369         s->io.in.event_ctx      = msg->ev;
     369        s->io.in.event_ctx      = nbtd_server->task->event_ctx;
    370370        s->io.in.name           = &req->in.name;
    371371        s->io.in.num_addresses  = req->in.num_addrs;
  • vendor/current/source4/nbt_server/wscript_build

    r740 r988  
    44        source='wins/winsdb.c wins/wins_hook.c',
    55        autoproto='wins/winsdb_proto.h',
    6         public_deps='ldb ldbsamba'
     6        public_deps='ldb ldbsamba',
     7        enabled=bld.AD_DC_BUILD_IS_ENABLED()
    78        )
    89
     
    1516        deps='ldb netif samba-hostconfig samba-util',
    1617        internal_module=False,
     18        enabled=bld.AD_DC_BUILD_IS_ENABLED()
    1719        )
    1820
     
    2123        source='wins/winsserver.c wins/winsclient.c wins/winswack.c wins/wins_dns_proxy.c',
    2224        autoproto='wins/winsserver_proto.h',
    23         deps='cli-nbt WINSDB'
     25        deps='cli-nbt WINSDB',
     26        enabled=bld.AD_DC_BUILD_IS_ENABLED()
    2427        )
    2528
     
    2831        source='dgram/request.c dgram/netlogon.c dgram/browse.c',
    2932        autoproto='dgram/proto.h',
    30         deps='LIBCLI_DGRAM CLDAPD'
     33        deps='LIBCLI_DGRAM DSDB_MODULE_HELPERS',
     34        enabled=bld.AD_DC_BUILD_IS_ENABLED()
    3135        )
    3236
     
    3539        source='interfaces.c register.c query.c nodestatus.c defense.c packet.c irpc.c',
    3640        autoproto='nbt_server_proto.h',
    37         deps='cli-nbt NBTD_WINS NBTD_DGRAM'
     41        deps='cli-nbt NBTD_WINS NBTD_DGRAM service',
     42        enabled=bld.AD_DC_BUILD_IS_ENABLED()
    3843        )
    3944
     
    4550        deps='NBT_SERVER process_model',
    4651        internal_module=False,
     52        enabled=bld.AD_DC_BUILD_IS_ENABLED()
    4753        )
    4854
Note: See TracChangeset for help on using the changeset viewer.