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

Samba Server: update vendor to 3.6.0

Location:
vendor/current/source4/nbt_server
Files:
1 added
1 deleted
18 edited

Legend:

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

    r414 r740  
    6565        if (!NT_STATUS_IS_OK(status)) goto failed;
    6666
    67         DEBUG(2,("Browse %s (Op %d) on '%s' '%s' from %s:%d\n",
     67        DEBUG(4,("Browse %s (Op %d) on '%s' '%s' from %s:%d\n",
    6868                nbt_browse_opcode_string(browse->opcode), browse->opcode,
    6969                nbt_name_string(browse, name), dgmslot->mailslot_name,
  • vendor/current/source4/nbt_server/dgram/netlogon.c

    r414 r740  
    2424#include "nbt_server/nbt_server.h"
    2525#include "lib/socket/socket.h"
    26 #include "lib/ldb/include/ldb.h"
     26#include <ldb.h>
    2727#include "dsdb/samdb/samdb.h"
    2828#include "auth/auth.h"
    29 #include "../lib/util/util_ldb.h"
    3029#include "param/param.h"
    3130#include "smbd/service_task.h"
     
    5655        samctx = iface->nbtsrv->sam_ctx;
    5756
    58         if (lp_server_role(iface->nbtsrv->task->lp_ctx) != ROLE_DOMAIN_CONTROLLER
     57        if (lpcfg_server_role(iface->nbtsrv->task->lp_ctx) != ROLE_DOMAIN_CONTROLLER
    5958            || !samdb_is_pdc(samctx)) {
    6059                DEBUG(2, ("Not a PDC, so not processing LOGON_PRIMARY_QUERY\n"));
     
    6261        }
    6362
    64         if (strcasecmp_m(name->name, lp_workgroup(iface->nbtsrv->task->lp_ctx)) != 0) {
     63        if (strcasecmp_m(name->name, lpcfg_workgroup(iface->nbtsrv->task->lp_ctx)) != 0) {
    6564                DEBUG(5,("GetDC requested for a domian %s that we don't host\n", name->name));
    6665                return;
     
    7372
    7473        pdc->command = NETLOGON_RESPONSE_FROM_PDC;
    75         pdc->pdc_name         = lp_netbios_name(iface->nbtsrv->task->lp_ctx);
     74        pdc->pdc_name         = lpcfg_netbios_name(iface->nbtsrv->task->lp_ctx);
    7675        pdc->unicode_pdc_name = pdc->pdc_name;
    77         pdc->domain_name      = lp_workgroup(iface->nbtsrv->task->lp_ctx);
     76        pdc->domain_name      = lpcfg_workgroup(iface->nbtsrv->task->lp_ctx);
    7877        pdc->nt_version       = 1;
    7978        pdc->lmnt_token       = 0xFFFF;
     
    8281        dgram_mailslot_netlogon_reply(reply_iface->dgmsock,
    8382                                      packet,
    84                                       lp_netbios_name(iface->nbtsrv->task->lp_ctx),
     83                                      lpcfg_netbios_name(iface->nbtsrv->task->lp_ctx),
    8584                                      netlogon->req.pdc.mailslot_name,
    8685                                      &netlogon_response);
     
    125124        status = fill_netlogon_samlogon_response(samctx, packet, NULL, name->name, sid, NULL,
    126125                                                 netlogon->req.logon.user_name, netlogon->req.logon.acct_control, src->addr,
    127                                                  netlogon->req.logon.nt_version, iface->nbtsrv->task->lp_ctx, &netlogon_response.data.samlogon);
     126                                                 netlogon->req.logon.nt_version, iface->nbtsrv->task->lp_ctx, &netlogon_response.data.samlogon, false);
    128127        if (!NT_STATUS_IS_OK(status)) {
    129128                DEBUG(2,("NBT netlogon query failed domain=%s sid=%s version=%d - %s\n",
     
    138137        dgram_mailslot_netlogon_reply(reply_iface->dgmsock,
    139138                                      packet,
    140                                       lp_netbios_name(iface->nbtsrv->task->lp_ctx),
     139                                      lpcfg_netbios_name(iface->nbtsrv->task->lp_ctx),
    141140                                      netlogon->req.logon.mailslot_name,
    142141                                      &netlogon_response);
  • vendor/current/source4/nbt_server/dgram/ntlogon.c

    r414 r740  
    5252
    5353        logon->server           = talloc_asprintf(packet, "\\\\%s",
    54                                                   lp_netbios_name(iface->nbtsrv->task->lp_ctx));
     54                                                  lpcfg_netbios_name(iface->nbtsrv->task->lp_ctx));
    5555        logon->user_name        = ntlogon->req.logon.user_name;
    56         logon->domain           = lp_workgroup(iface->nbtsrv->task->lp_ctx);
     56        logon->domain           = lpcfg_workgroup(iface->nbtsrv->task->lp_ctx);
    5757        logon->nt_version       = 1;
    5858        logon->lmnt_token       = 0xFFFF;
     
    6363        dgram_mailslot_ntlogon_reply(reply_iface->dgmsock,
    6464                                     packet,
    65                                      lp_netbios_name(iface->nbtsrv->task->lp_ctx),
     65                                     lpcfg_netbios_name(iface->nbtsrv->task->lp_ctx),
    6666                                     ntlogon->req.logon.mailslot_name,
    6767                                     &reply);
  • vendor/current/source4/nbt_server/dgram/request.c

    r414 r740  
    7676        if (strcmp("0.0.0.0", iface->netmask) != 0) {
    7777                /* listen for broadcasts on port 138 */
    78                 bcast_dgmsock = nbt_dgram_socket_init(iface,
    79                                                       nbtsrv->task->event_ctx,
    80                                                       lp_iconv_convenience(nbtsrv->task->lp_ctx));
     78                bcast_dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx);
    8179                if (!bcast_dgmsock) {
    8280                        talloc_free(tmp_ctx);
     
    8684                bcast_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name,
    8785                                                         iface->bcast_address,
    88                                                          lp_dgram_port(iface->nbtsrv->task->lp_ctx));
     86                                                         lpcfg_dgram_port(iface->nbtsrv->task->lp_ctx));
    8987                if (!bcast_addr) {
    9088                        talloc_free(tmp_ctx);
     
    9694                        talloc_free(tmp_ctx);
    9795                        DEBUG(0,("Failed to bind to %s:%d - %s\n",
    98                                  iface->bcast_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx),
     96                                 iface->bcast_address, lpcfg_dgram_port(iface->nbtsrv->task->lp_ctx),
    9997                                 nt_errstr(status)));
    10098                        return status;
     
    105103
    106104        /* listen for unicasts on port 138 */
    107         iface->dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx,
    108                                                lp_iconv_convenience(nbtsrv->task->lp_ctx));
     105        iface->dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx);
    109106        if (!iface->dgmsock) {
    110107                talloc_free(tmp_ctx);
     
    113110
    114111        bind_addr = socket_address_from_strings(tmp_ctx, iface->dgmsock->sock->backend_name,
    115                                                 bind_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx));
     112                                                bind_address, lpcfg_dgram_port(iface->nbtsrv->task->lp_ctx));
    116113        if (!bind_addr) {
    117114                talloc_free(tmp_ctx);
     
    123120                talloc_free(tmp_ctx);
    124121                DEBUG(0,("Failed to bind to %s:%d - %s\n",
    125                          bind_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx), nt_errstr(status)));
     122                         bind_address, lpcfg_dgram_port(iface->nbtsrv->task->lp_ctx), nt_errstr(status)));
    126123                return status;
    127124        }
  • vendor/current/source4/nbt_server/interfaces.c

    r414 r740  
    3030#include "lib/socket/netif.h"
    3131#include "param/param.h"
     32#include "lib/util/util_net.h"
    3233
    3334
     
    186187
    187188                /* listen for broadcasts on port 137 */
    188                 bcast_nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx, lp_iconv_convenience(nbtsrv->task->lp_ctx));
     189                bcast_nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx);
    189190                if (!bcast_nbtsock) {
    190191                        talloc_free(iface);
     
    193194
    194195                bcast_address = socket_address_from_strings(bcast_nbtsock, bcast_nbtsock->sock->backend_name,
    195                                                             bcast, lp_nbt_port(lp_ctx));
     196                                                            bcast, lpcfg_nbt_port(lp_ctx));
    196197                if (!bcast_address) {
    197198                        talloc_free(iface);
     
    202203                if (!NT_STATUS_IS_OK(status)) {
    203204                        DEBUG(0,("Failed to bind to %s:%d - %s\n",
    204                                  bcast, lp_nbt_port(lp_ctx), nt_errstr(status)));
     205                                 bcast, lpcfg_nbt_port(lp_ctx), nt_errstr(status)));
    205206                        talloc_free(iface);
    206207                        return status;
     
    212213
    213214        /* listen for unicasts on port 137 */
    214         iface->nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx,
    215                                               lp_iconv_convenience(nbtsrv->task->lp_ctx));
     215        iface->nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx);
    216216        if (!iface->nbtsock) {
    217217                talloc_free(iface);
     
    221221        unicast_address = socket_address_from_strings(iface->nbtsock,
    222222                                                      iface->nbtsock->sock->backend_name,
    223                                                       bind_address, lp_nbt_port(lp_ctx));
     223                                                      bind_address, lpcfg_nbt_port(lp_ctx));
    224224
    225225        status = socket_listen(iface->nbtsock->sock, unicast_address, 0, 0);
    226226        if (!NT_STATUS_IS_OK(status)) {
    227227                DEBUG(0,("Failed to bind to %s:%d - %s\n",
    228                          bind_address, lp_nbt_port(lp_ctx), nt_errstr(status)));
     228                         bind_address, lpcfg_nbt_port(lp_ctx), nt_errstr(status)));
    229229                talloc_free(iface);
    230230                return status;
     
    284284        /* if we are allowing incoming packets from any address, then
    285285           we also need to bind to the wildcard address */
    286         if (!lp_bind_interfaces_only(lp_ctx)) {
     286        if (!lpcfg_bind_interfaces_only(lp_ctx)) {
    287287                const char *primary_address;
    288288
     
    294294                } else {
    295295                        primary_address = inet_ntoa(interpret_addr2(
    296                                                         lp_netbios_name(lp_ctx)));
     296                                                        lpcfg_netbios_name(lp_ctx)));
    297297                }
    298298                primary_address = talloc_strdup(tmp_ctx, primary_address);
     
    319319                netmask = talloc_strdup(tmp_ctx, iface_n_netmask(ifaces, i));
    320320
    321                 status = nbtd_add_socket(nbtsrv, lp_ctx, 
     321                status = nbtd_add_socket(nbtsrv, lp_ctx,
    322322                                         address, address, bcast, netmask);
    323323                NT_STATUS_NOT_OK_RETURN(status);
    324324        }
    325325
    326         if (lp_wins_server_list(lp_ctx)) {
     326        if (lpcfg_wins_server_list(lp_ctx)) {
    327327                status = nbtd_add_wins_socket(nbtsrv);
    328328                NT_STATUS_NOT_OK_RETURN(status);
  • vendor/current/source4/nbt_server/irpc.c

    r414 r740  
    8686        }
    8787
    88         p = netlogon.data.samlogon.data.nt4.server;
     88        p = netlogon.data.samlogon.data.nt4.pdc_name;
    8989
    9090        DEBUG(10, ("NTLOGON_SAM_LOGON_REPLY: server: %s, user: %s, "
    9191                   "domain: %s\n", p,
    9292                   netlogon.data.samlogon.data.nt4.user_name,
    93                    netlogon.data.samlogon.data.nt4.domain));
     93                   netlogon.data.samlogon.data.nt4.domain_name));
    9494
    9595        if (*p == '\\') p += 1;
  • vendor/current/source4/nbt_server/nbt_server.c

    r414 r740  
    4040        struct interface *ifaces;
    4141
    42         load_interfaces(task, lp_interfaces(task->lp_ctx), &ifaces);
     42        load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
    4343
    4444        if (iface_count(ifaces) == 0) {
     
    6767        }
    6868
    69         nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->event_ctx, task->lp_ctx, system_session(nbtsrv, task->lp_ctx));
     69        nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->event_ctx, task->lp_ctx, system_session(task->lp_ctx), 0);
    7070        if (nbtsrv->sam_ctx == NULL) {
    7171                task_server_terminate(task, "nbtd failed to open samdb", true);
  • vendor/current/source4/nbt_server/nodestatus.c

    r414 r740  
    5555        packet->name_trn_id = request_packet->name_trn_id;
    5656        packet->ancount = 1;
    57         packet->operation = NBT_OPCODE_QUERY | NBT_FLAG_REPLY | NBT_FLAG_AUTHORITIVE;
     57        packet->operation = NBT_OPCODE_QUERY | NBT_FLAG_REPLY | NBT_FLAG_AUTHORITATIVE;
    5858
    5959        packet->answers = talloc_array(packet, struct nbt_res_rec, 1);
  • vendor/current/source4/nbt_server/packet.c

    r414 r740  
    8080       
    8181        /* if its not from the nbt port, then it wasn't a broadcast from us */
    82         if (src->port != lp_nbt_port(iface->nbtsrv->task->lp_ctx)) {
     82        if (src->port != lpcfg_nbt_port(iface->nbtsrv->task->lp_ctx)) {
    8383                return false;
    8484        }
     
    122122        packet->name_trn_id = request_packet->name_trn_id;
    123123        packet->ancount = 1;
    124         packet->operation = 
    125                 NBT_FLAG_REPLY | 
    126                 NBT_OPCODE_QUERY | 
    127                 NBT_FLAG_AUTHORITIVE |
     124        packet->operation =
     125                NBT_FLAG_REPLY |
     126                NBT_OPCODE_QUERY |
     127                NBT_FLAG_AUTHORITATIVE |
    128128                NBT_FLAG_RECURSION_DESIRED |
    129129                NBT_FLAG_RECURSION_AVAIL;
     
    178178        packet->name_trn_id = request_packet->name_trn_id;
    179179        packet->ancount = 1;
    180         packet->operation = 
    181                 NBT_FLAG_REPLY | 
    182                 NBT_OPCODE_QUERY | 
    183                 NBT_FLAG_AUTHORITIVE |
     180        packet->operation =
     181                NBT_FLAG_REPLY |
     182                NBT_OPCODE_QUERY |
     183                NBT_FLAG_AUTHORITATIVE |
    184184                NBT_RCODE_NAM;
    185185
     
    222222        packet->name_trn_id = request_packet->name_trn_id;
    223223        packet->ancount = 1;
    224         packet->operation = 
    225                 NBT_FLAG_REPLY | 
     224        packet->operation =
     225                NBT_FLAG_REPLY |
    226226                NBT_OPCODE_REGISTER |
    227                 NBT_FLAG_AUTHORITIVE |
     227                NBT_FLAG_AUTHORITATIVE |
    228228                NBT_FLAG_RECURSION_DESIRED |
    229229                NBT_FLAG_RECURSION_AVAIL |
     
    270270        packet->name_trn_id = request_packet->name_trn_id;
    271271        packet->ancount = 1;
    272         packet->operation = 
    273                 NBT_FLAG_REPLY | 
     272        packet->operation =
     273                NBT_FLAG_REPLY |
    274274                NBT_OPCODE_RELEASE |
    275                 NBT_FLAG_AUTHORITIVE |
     275                NBT_FLAG_AUTHORITATIVE |
    276276                rcode;
    277277       
     
    316316        packet->name_trn_id = request_packet->name_trn_id;
    317317        packet->ancount = 1;
    318         packet->operation = 
    319                 NBT_FLAG_REPLY | 
     318        packet->operation =
     319                NBT_FLAG_REPLY |
    320320                NBT_OPCODE_WACK |
    321                 NBT_FLAG_AUTHORITIVE;
     321                NBT_FLAG_AUTHORITATIVE;
    322322       
    323323        packet->answers = talloc_array(packet, struct nbt_res_rec, 1);
  • vendor/current/source4/nbt_server/query.c

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

    r414 r740  
    9494        io.in.name            = iname->name;
    9595        io.in.dest_addr       = iface->bcast_address;
    96         io.in.dest_port       = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
     96        io.in.dest_port       = lpcfg_nbt_port(iface->nbtsrv->task->lp_ctx);
    9797        io.in.address         = iface->ip_address;
    9898        io.in.nb_flags        = iname->nb_flags;
     
    119119{
    120120        uint32_t refresh_time;
    121         uint32_t max_refresh_time = lp_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "max_refresh_time", 7200);
     121        uint32_t max_refresh_time = lpcfg_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "max_refresh_time", 7200);
    122122
    123123        refresh_time = MIN(max_refresh_time, iname->ttl/2);
     
    129129}
    130130
     131struct nbtd_register_name_state {
     132        struct nbtd_iface_name *iname;
     133        struct nbt_name_register_bcast io;
     134};
    131135
    132136/*
    133137  a name registration has completed
    134138*/
    135 static void nbtd_register_handler(struct composite_context *creq)
    136 {
    137         struct nbtd_iface_name *iname = talloc_get_type(creq->async.private_data,
    138                                                         struct nbtd_iface_name);
     139static void nbtd_register_name_handler(struct tevent_req *subreq)
     140{
     141        struct nbtd_register_name_state *state =
     142                tevent_req_callback_data(subreq,
     143                struct nbtd_register_name_state);
     144        struct nbtd_iface_name *iname = state->iname;
    139145        NTSTATUS status;
    140         TALLOC_CTX *tmp_ctx = talloc_new(iname);
    141 
    142         status = nbt_name_register_bcast_recv(creq);
     146
     147        status = nbt_name_register_bcast_recv(subreq);
     148        TALLOC_FREE(subreq);
    143149        if (NT_STATUS_IS_OK(status)) {
    144150                /* good - nobody complained about our registration */
    145151                iname->nb_flags |= NBT_NM_ACTIVE;
    146152                DEBUG(3,("Registered %s with %s on interface %s\n",
    147                          nbt_name_string(tmp_ctx, &iname->name),
     153                         nbt_name_string(state, &iname->name),
    148154                         iname->iface->ip_address, iname->iface->bcast_address));
    149155                iname->registration_time = timeval_current();
    150                 talloc_free(tmp_ctx);
     156                talloc_free(state);
    151157                nbtd_start_refresh_timer(iname);
    152158                return;
     
    157163
    158164        DEBUG(1,("Error registering %s with %s on interface %s - %s\n",
    159                  nbt_name_string(tmp_ctx, &iname->name),
     165                 nbt_name_string(state, &iname->name),
    160166                 iname->iface->ip_address, iname->iface->bcast_address,
    161167                 nt_errstr(status)));
    162         talloc_free(tmp_ctx);
     168        talloc_free(state);
    163169}
    164170
     
    172178{
    173179        struct nbtd_iface_name *iname;
    174         const char *scope = lp_netbios_scope(iface->nbtsrv->task->lp_ctx);
    175         struct nbt_name_register_bcast io;
    176         struct composite_context *creq;
     180        const char *scope = lpcfg_netbios_scope(iface->nbtsrv->task->lp_ctx);
     181        struct nbtd_register_name_state *state;
     182        struct tevent_req *subreq;
    177183        struct nbtd_server *nbtsrv = iface->nbtsrv;
    178184
     
    189195        }
    190196        iname->nb_flags          = nb_flags;
    191         iname->ttl               = lp_parm_int(iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "bcast_ttl", 300000);
     197        iname->ttl               = lpcfg_parm_int(iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "bcast_ttl", 300000);
    192198        iname->registration_time = timeval_zero();
    193199        iname->wins_server       = NULL;
     
    209215        }
    210216
     217        state = talloc_zero(iname, struct nbtd_register_name_state);
     218        if (state == NULL) {
     219                return;
     220        }
     221
     222        state->iname = iname;
     223
    211224        /* setup a broadcast name registration request */
    212         io.in.name            = iname->name;
    213         io.in.dest_addr      = iface->bcast_address;
    214         io.in.dest_port       = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
    215         io.in.address         = iface->ip_address;
    216         io.in.nb_flags        = nb_flags;
    217         io.in.ttl             = iname->ttl;
     225        state->io.in.name      = iname->name;
     226        state->io.in.dest_addr = iface->bcast_address;
     227        state->io.in.dest_port = lpcfg_nbt_port(iface->nbtsrv->task->lp_ctx);
     228        state->io.in.address   = iface->ip_address;
     229        state->io.in.nb_flags  = nb_flags;
     230        state->io.in.ttl       = iname->ttl;
    218231
    219232        nbtsrv->stats.total_sent++;
    220         creq = nbt_name_register_bcast_send(iface->nbtsock, &io);
    221         if (creq == NULL) return;
    222 
    223         creq->async.fn = nbtd_register_handler;
    224         creq->async.private_data = iname;
     233
     234        subreq = nbt_name_register_bcast_send(state, nbtsrv->task->event_ctx,
     235                                              iface->nbtsock, &state->io);
     236        if (subreq == NULL) {
     237                return;
     238        }
     239
     240        tevent_req_set_callback(subreq, nbtd_register_name_handler, state);
    225241}
    226242
     
    263279        /* note that we don't initially mark the names "ACTIVE". They are
    264280           marked active once registration is successful */
    265         nbtd_register_name(nbtsrv, lp_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_CLIENT, nb_flags);
    266         nbtd_register_name(nbtsrv, lp_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_USER,   nb_flags);
    267         nbtd_register_name(nbtsrv, lp_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_SERVER, nb_flags);
    268 
    269         aliases = lp_netbios_aliases(nbtsrv->task->lp_ctx);
     281        nbtd_register_name(nbtsrv, lpcfg_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_CLIENT, nb_flags);
     282        nbtd_register_name(nbtsrv, lpcfg_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_USER,   nb_flags);
     283        nbtd_register_name(nbtsrv, lpcfg_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_SERVER, nb_flags);
     284
     285        aliases = lpcfg_netbios_aliases(nbtsrv->task->lp_ctx);
    270286        while (aliases && aliases[0]) {
    271287                nbtd_register_name(nbtsrv, aliases[0], NBT_NAME_CLIENT, nb_flags);
     
    274290        }
    275291
    276         if (lp_server_role(nbtsrv->task->lp_ctx) == ROLE_DOMAIN_CONTROLLER)     {
     292        if (lpcfg_server_role(nbtsrv->task->lp_ctx) == ROLE_DOMAIN_CONTROLLER)  {
    277293                bool is_pdc = samdb_is_pdc(nbtsrv->sam_ctx);
    278294                if (is_pdc) {
    279                         nbtd_register_name(nbtsrv, lp_workgroup(nbtsrv->task->lp_ctx),
     295                        nbtd_register_name(nbtsrv, lpcfg_workgroup(nbtsrv->task->lp_ctx),
    280296                                           NBT_NAME_PDC, nb_flags);
    281297                }
    282                 nbtd_register_name(nbtsrv, lp_workgroup(nbtsrv->task->lp_ctx),
     298                nbtd_register_name(nbtsrv, lpcfg_workgroup(nbtsrv->task->lp_ctx),
    283299                                   NBT_NAME_LOGON, nb_flags | NBT_NM_GROUP);
    284300        }
    285301
    286302        nb_flags |= NBT_NM_GROUP;
    287         nbtd_register_name(nbtsrv, lp_workgroup(nbtsrv->task->lp_ctx), NBT_NAME_CLIENT, nb_flags);
     303        nbtd_register_name(nbtsrv, lpcfg_workgroup(nbtsrv->task->lp_ctx), NBT_NAME_CLIENT, nb_flags);
    288304
    289305        nb_flags |= NBT_NM_PERMANENT;
  • vendor/current/source4/nbt_server/wins/wins_hook.c

    r414 r740  
    6262                              rec->name->name,
    6363                              rec->name->type,
    64                               rec->expire_time);
     64                              (long int) rec->expire_time);
    6565        if (!cmd) goto failed;
    6666
  • vendor/current/source4/nbt_server/wins/wins_ldb.c

    r414 r740  
    3232#include "nbt_server/nbt_server.h"
    3333#include "nbt_server/wins/winsdb.h"
    34 #include "lib/ldb/include/ldb_module.h"
     34#include <ldb_module.h>
    3535#include "system/network.h"
    3636#include "lib/socket/netif.h"
     
    9090        ldb_module_set_private(module, NULL);
    9191
    92         owner = lp_parm_string(lp_ctx, NULL, "winsdb", "local_owner");
     92        owner = lpcfg_parm_string(lp_ctx, NULL, "winsdb", "local_owner");
    9393        if (!owner) {
    9494                struct interface *ifaces;
    95                 load_interfaces(module, lp_interfaces(lp_ctx), &ifaces);
     95                load_interfaces(module, lpcfg_interfaces(lp_ctx), &ifaces);
    9696                owner = iface_n_ip(ifaces, 0);
    9797                if (!owner) {
     
    114114}
    115115
    116 _PUBLIC_ const struct ldb_module_ops ldb_wins_ldb_module_ops = {
     116static const struct ldb_module_ops ldb_wins_ldb_module_ops = {
    117117        .name          = "wins_ldb",
    118118        .add           = wins_ldb_verify,
     
    120120        .init_context  = wins_ldb_init
    121121};
     122
     123int ldb_wins_ldb_module_init(const char *version)
     124{
     125        LDB_MODULE_CHECK_VERSION(version);
     126        return ldb_register_module(&ldb_wins_ldb_module_ops);
     127}
  • vendor/current/source4/nbt_server/wins/winsclient.c

    r414 r740  
    2929#include "param/param.h"
    3030
    31 static void nbtd_wins_refresh_handler(struct composite_context *c);
    32 
    3331/* we send WINS client requests using our primary network interface
    3432*/
     
    5957{
    6058        uint32_t refresh_time;
    61         uint32_t max_refresh_time = lp_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "max_refresh_time", 7200);
     59        uint32_t max_refresh_time = lpcfg_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "max_refresh_time", 7200);
    6260
    6361        refresh_time = MIN(max_refresh_time, iname->ttl/2);
     
    6967}
    7068
     69struct nbtd_wins_refresh_state {
     70        struct nbtd_iface_name *iname;
     71        struct nbt_name_refresh_wins io;
     72};
     73
    7174/*
    7275  called when a wins name refresh has completed
    7376*/
    74 static void nbtd_wins_refresh_handler(struct composite_context *c)
     77static void nbtd_wins_refresh_handler(struct tevent_req *subreq)
    7578{
    7679        NTSTATUS status;
    77         struct nbt_name_refresh_wins io;
    78         struct nbtd_iface_name *iname = talloc_get_type(c->async.private_data,
    79                                                         struct nbtd_iface_name);
    80         TALLOC_CTX *tmp_ctx = talloc_new(iname);
    81 
    82         status = nbt_name_refresh_wins_recv(c, tmp_ctx, &io);
     80        struct nbtd_wins_refresh_state *state =
     81                tevent_req_callback_data(subreq,
     82                struct nbtd_wins_refresh_state);
     83        struct nbtd_iface_name *iname = state->iname;
     84
     85        status = nbt_name_refresh_wins_recv(subreq, state, &state->io);
     86        TALLOC_FREE(subreq);
    8387        if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
    8488                /* our WINS server is dead - start registration over
    8589                   from scratch */
    8690                DEBUG(2,("Failed to refresh %s with WINS server %s\n",
    87                          nbt_name_string(tmp_ctx, &iname->name), iname->wins_server));
    88                 talloc_free(tmp_ctx);
     91                         nbt_name_string(state, &iname->name), iname->wins_server));
     92                talloc_free(state);
    8993                nbtd_winsclient_register(iname);
    9094                return;
     
    9397        if (!NT_STATUS_IS_OK(status)) {
    9498                DEBUG(1,("Name refresh failure with WINS for %s - %s\n",
    95                          nbt_name_string(tmp_ctx, &iname->name), nt_errstr(status)));
    96                 talloc_free(tmp_ctx);
    97                 return;
    98         }
    99 
    100         if (io.out.rcode != 0) {
     99                         nbt_name_string(state, &iname->name), nt_errstr(status)));
     100                talloc_free(state);
     101                return;
     102        }
     103
     104        if (state->io.out.rcode != 0) {
    101105                DEBUG(1,("WINS server %s rejected name refresh of %s - %s\n",
    102                          io.out.wins_server, nbt_name_string(tmp_ctx, &iname->name),
    103                          nt_errstr(nbt_rcode_to_ntstatus(io.out.rcode))));
     106                         state->io.out.wins_server,
     107                         nbt_name_string(state, &iname->name),
     108                         nt_errstr(nbt_rcode_to_ntstatus(state->io.out.rcode))));
    104109                iname->nb_flags |= NBT_NM_CONFLICT;
    105                 talloc_free(tmp_ctx);
     110                talloc_free(state);
    106111                return;
    107112        }       
    108113
    109114        DEBUG(4,("Refreshed name %s with WINS server %s\n",
    110                  nbt_name_string(tmp_ctx, &iname->name), iname->wins_server));
     115                 nbt_name_string(state, &iname->name), iname->wins_server));
    111116        /* success - start a periodic name refresh */
    112117        iname->nb_flags |= NBT_NM_ACTIVE;
     
    116121                 * so steal it into the tmp context
    117122                 */
    118                 talloc_steal(tmp_ctx, iname->wins_server);
    119         }
    120         iname->wins_server = talloc_steal(iname, io.out.wins_server);
    121 
     123                talloc_steal(state, iname->wins_server);
     124        }
     125        iname->wins_server = talloc_move(iname, &state->io.out.wins_server);
    122126        iname->registration_time = timeval_current();
     127
     128        talloc_free(state);
     129
    123130        nbtd_wins_start_refresh_timer(iname);
    124 
    125         talloc_free(tmp_ctx);
    126131}
    127132
     
    135140        struct nbtd_iface_name *iname = talloc_get_type(private_data, struct nbtd_iface_name);
    136141        struct nbtd_interface *iface = iname->iface;
    137         struct nbt_name_refresh_wins io;
    138         struct composite_context *c;
    139         TALLOC_CTX *tmp_ctx = talloc_new(iname);
     142        struct nbt_name_socket *nbtsock = wins_socket(iface);
     143        struct tevent_req *subreq;
     144        struct nbtd_wins_refresh_state *state;
     145
     146        state = talloc_zero(iname, struct nbtd_wins_refresh_state);
     147        if (state == NULL) {
     148                return;
     149        }
     150
     151        state->iname = iname;
    140152
    141153        /* setup a wins name refresh request */
    142         io.in.name            = iname->name;
    143         io.in.wins_servers    = (const char **)str_list_make_single(tmp_ctx, iname->wins_server);
    144         io.in.wins_port       = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
    145         io.in.addresses       = nbtd_address_list(iface, tmp_ctx);
    146         io.in.nb_flags        = iname->nb_flags;
    147         io.in.ttl             = iname->ttl;
    148 
    149         if (!io.in.addresses) {
    150                 talloc_free(tmp_ctx);
    151                 return;
    152         }
    153 
    154         c = nbt_name_refresh_wins_send(wins_socket(iface), &io);
    155         if (c == NULL) {
    156                 talloc_free(tmp_ctx);
    157                 return;
    158         }
    159         talloc_steal(c, io.in.addresses);
    160 
    161         c->async.fn = nbtd_wins_refresh_handler;
    162         c->async.private_data = iname;
    163 
    164         talloc_free(tmp_ctx);
    165 }
    166 
     154        state->io.in.name            = iname->name;
     155        state->io.in.wins_servers    = (const char **)str_list_make_single(state, iname->wins_server);
     156        state->io.in.wins_port       = lpcfg_nbt_port(iface->nbtsrv->task->lp_ctx);
     157        state->io.in.addresses       = nbtd_address_list(iface, state);
     158        state->io.in.nb_flags        = iname->nb_flags;
     159        state->io.in.ttl             = iname->ttl;
     160
     161        if (!state->io.in.addresses) {
     162                talloc_free(state);
     163                return;
     164        }
     165
     166        subreq = nbt_name_refresh_wins_send(state, ev, nbtsock, &state->io);
     167        if (subreq == NULL) {
     168                talloc_free(state);
     169                return;
     170        }
     171
     172        tevent_req_set_callback(subreq, nbtd_wins_refresh_handler, state);
     173}
     174
     175struct nbtd_wins_register_state {
     176        struct nbtd_iface_name *iname;
     177        struct nbt_name_register_wins io;
     178};
    167179
    168180/*
    169181  called when a wins name register has completed
    170182*/
    171 static void nbtd_wins_register_handler(struct composite_context *c)
     183static void nbtd_wins_register_handler(struct tevent_req *subreq)
    172184{
    173185        NTSTATUS status;
    174         struct nbt_name_register_wins io;
    175         struct nbtd_iface_name *iname = talloc_get_type(c->async.private_data,
    176                                                         struct nbtd_iface_name);
    177         TALLOC_CTX *tmp_ctx = talloc_new(iname);
    178 
    179         status = nbt_name_register_wins_recv(c, tmp_ctx, &io);
     186        struct nbtd_wins_register_state *state =
     187                tevent_req_callback_data(subreq,
     188                struct nbtd_wins_register_state);
     189        struct nbtd_iface_name *iname = state->iname;
     190
     191        status = nbt_name_register_wins_recv(subreq, state, &state->io);
     192        TALLOC_FREE(subreq);
    180193        if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
    181194                /* none of the WINS servers responded - try again
    182195                   periodically */
    183                 int wins_retry_time = lp_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "wins_retry", 300);
     196                int wins_retry_time = lpcfg_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "wins_retry", 300);
    184197                event_add_timed(iname->iface->nbtsrv->task->event_ctx,
    185198                                iname,
     
    187200                                nbtd_wins_register_retry,
    188201                                iname);
    189                 talloc_free(tmp_ctx);
     202                talloc_free(state);
    190203                return;
    191204        }
     
    193206        if (!NT_STATUS_IS_OK(status)) {
    194207                DEBUG(1,("Name register failure with WINS for %s - %s\n",
    195                          nbt_name_string(tmp_ctx, &iname->name), nt_errstr(status)));
    196                 talloc_free(tmp_ctx);
     208                         nbt_name_string(state, &iname->name), nt_errstr(status)));
     209                talloc_free(state);
    197210                return;
    198211        }       
    199212
    200         if (io.out.rcode != 0) {
     213        if (state->io.out.rcode != 0) {
    201214                DEBUG(1,("WINS server %s rejected name register of %s - %s\n",
    202                          io.out.wins_server, nbt_name_string(tmp_ctx, &iname->name),
    203                          nt_errstr(nbt_rcode_to_ntstatus(io.out.rcode))));
     215                         state->io.out.wins_server,
     216                         nbt_name_string(state, &iname->name),
     217                         nt_errstr(nbt_rcode_to_ntstatus(state->io.out.rcode))));
    204218                iname->nb_flags |= NBT_NM_CONFLICT;
    205                 talloc_free(tmp_ctx);
     219                talloc_free(state);
    206220                return;
    207221        }       
     
    214228                 * so steal it into the tmp context
    215229                 */
    216                 talloc_steal(tmp_ctx, iname->wins_server);
    217         }
    218         iname->wins_server = talloc_steal(iname, io.out.wins_server);
     230                talloc_steal(state, iname->wins_server);
     231        }
     232        iname->wins_server = talloc_move(iname, &state->io.out.wins_server);
    219233
    220234        iname->registration_time = timeval_current();
     235
     236        DEBUG(3,("Registered %s with WINS server %s\n",
     237                 nbt_name_string(state, &iname->name), iname->wins_server));
     238
     239        talloc_free(state);
     240
    221241        nbtd_wins_start_refresh_timer(iname);
    222 
    223         DEBUG(3,("Registered %s with WINS server %s\n",
    224                  nbt_name_string(tmp_ctx, &iname->name), iname->wins_server));
    225 
    226         talloc_free(tmp_ctx);
    227242}
    228243
     
    233248{
    234249        struct nbtd_interface *iface = iname->iface;
    235         struct nbt_name_register_wins io;
    236         struct composite_context *c;
     250        struct nbt_name_socket *nbtsock = wins_socket(iface);
     251        struct nbtd_wins_register_state *state;
     252        struct tevent_req *subreq;
     253
     254        state = talloc_zero(iname, struct nbtd_wins_register_state);
     255        if (state == NULL) {
     256                return;
     257        }
     258
     259        state->iname = iname;
    237260
    238261        /* setup a wins name register request */
    239         io.in.name            = iname->name;
    240         io.in.wins_port       = lp_nbt_port(iname->iface->nbtsrv->task->lp_ctx);
    241         io.in.wins_servers    = lp_wins_server_list(iname->iface->nbtsrv->task->lp_ctx);
    242         io.in.addresses       = nbtd_address_list(iface, iname);
    243         io.in.nb_flags        = iname->nb_flags;
    244         io.in.ttl             = iname->ttl;
    245 
    246         if (!io.in.addresses) {
    247                 return;
    248         }
    249 
    250         c = nbt_name_register_wins_send(wins_socket(iface), &io);
    251         if (c == NULL) {
    252                 talloc_free(io.in.addresses);
    253                 return;
    254         }
    255         talloc_steal(c, io.in.addresses);
    256 
    257         c->async.fn = nbtd_wins_register_handler;
    258         c->async.private_data = iname;
    259 }
     262        state->io.in.name         = iname->name;
     263        state->io.in.wins_port    = lpcfg_nbt_port(iface->nbtsrv->task->lp_ctx);
     264        state->io.in.wins_servers = lpcfg_wins_server_list(iface->nbtsrv->task->lp_ctx);
     265        state->io.in.addresses    = nbtd_address_list(iface, state);
     266        state->io.in.nb_flags     = iname->nb_flags;
     267        state->io.in.ttl          = iname->ttl;
     268
     269        if (state->io.in.addresses == NULL) {
     270                talloc_free(state);
     271                return;
     272        }
     273
     274        subreq = nbt_name_register_wins_send(state, iface->nbtsrv->task->event_ctx,
     275                                             nbtsock, &state->io);
     276        if (subreq == NULL) {
     277                talloc_free(state);
     278                return;
     279        }
     280
     281        tevent_req_set_callback(subreq, nbtd_wins_register_handler, state);
     282}
  • vendor/current/source4/nbt_server/wins/winsdb.c

    r414 r740  
    2424#include "nbt_server/nbt_server.h"
    2525#include "nbt_server/wins/winsdb.h"
    26 #include "lib/ldb/include/ldb.h"
    27 #include "lib/ldb/include/ldb_errors.h"
     26#include <ldb.h>
     27#include <ldb_errors.h>
    2828#include "librpc/gen_ndr/ndr_nbt.h"
    2929#include "system/time.h"
     
    101101
    102102        ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE, NULL);
    103         if (ret != 0) goto failed;
     103        if (ret != LDB_SUCCESS) goto failed;
    104104        ret = ldb_msg_add_string(msg, "objectClass", "winsMaxVersion");
    105         if (ret != 0) goto failed;
     105        if (ret != LDB_SUCCESS) goto failed;
    106106        ret = ldb_msg_add_empty(msg, "maxVersion", LDB_FLAG_MOD_REPLACE, NULL);
    107         if (ret != 0) goto failed;
     107        if (ret != LDB_SUCCESS) goto failed;
    108108        ret = ldb_msg_add_fmt(msg, "maxVersion", "%llu", (long long)newMaxVersion);
    109         if (ret != 0) goto failed;
     109        if (ret != LDB_SUCCESS) goto failed;
    110110
    111111        ret = ldb_modify(wins_db, msg);
    112         if (ret != 0) ret = ldb_add(wins_db, msg);
    113         if (ret != 0) goto failed;
     112        if (ret != LDB_SUCCESS) ret = ldb_add(wins_db, msg);
     113        if (ret != LDB_SUCCESS) goto failed;
    114114
    115115        trans = ldb_transaction_commit(wins_db);
     
    260260        }
    261261
    262         *p = '\0';p++;
     262        *p = '\0'; p++;
    263263        addr->address = talloc_strdup(addr, address);
    264264        if (!addr->address) {
     
    320320                                   const char *attr_name, struct winsdb_addr *addr)
    321321{
    322         struct ldb_val val;
    323322        const char *str;
    324323
    325324        if (rec->is_static) {
    326325                str = talloc_strdup(msg, addr->address);
    327                 if (!str) return -1;
     326                if (!str) return LDB_ERR_OPERATIONS_ERROR;
    328327        } else {
    329328                char *expire_time;
    330329                expire_time = ldb_timestring(msg, addr->expire_time);
    331                 if (!expire_time) return -1;
     330                if (!expire_time) return LDB_ERR_OPERATIONS_ERROR;
    332331                str = talloc_asprintf(msg, "%s;winsOwner:%s;expireTime:%s;",
    333332                                      addr->address, addr->wins_owner,
    334333                                      expire_time);
    335334                talloc_free(expire_time);
    336                 if (!str) return -1;
    337         }
    338 
    339         val.data = discard_const_p(uint8_t, str);
    340         val.length = strlen(str);
    341 
    342         return ldb_msg_add_value(msg, attr_name, &val, NULL);
     335                if (!str) return LDB_ERR_OPERATIONS_ERROR;
     336        }
     337
     338        return ldb_msg_add_string(msg, attr_name, str);
    343339}
    344340
     
    508504        addresses[len+1] = NULL;
    509505
    510         ldb_qsort(addresses, len+1 , sizeof(addresses[0]), h, (ldb_qsort_cmp_fn_t)winsdb_addr_sort_list);
     506        LDB_TYPESAFE_QSORT(addresses, len+1, h, winsdb_addr_sort_list);
    511507
    512508        return addresses;
     
    751747                                          TALLOC_CTX *mem_ctx)
    752748{
    753         int i, ret=0;
     749        int i, ret;
    754750        size_t addr_count;
    755751        const char *expire_time;
     
    773769        msg->dn = winsdb_dn(msg, ldb, rec->name);
    774770        if (msg->dn == NULL) goto failed;
    775         ret |= ldb_msg_add_fmt(msg, "type", "0x%02X", rec->name->type);
     771        ret = ldb_msg_add_fmt(msg, "type", "0x%02X", rec->name->type);
    776772        if (rec->name->name && *rec->name->name) {
    777773                ret |= ldb_msg_add_string(msg, "name", rec->name->name);
     
    795791                ret |= ldb_msg_add_winsdb_addr(msg, rec, "address", rec->addresses[i]);
    796792        }
    797         ret |= ldb_msg_add_empty(msg, "registeredBy", 0, NULL);
    798793        if (rec->registered_by) {
     794                ret |= ldb_msg_add_empty(msg, "registeredBy", 0, NULL);
    799795                ret |= ldb_msg_add_string(msg, "registeredBy", rec->registered_by);
    800                 if (ret != 0) goto failed;
    801         }
     796        }
     797        if (ret != LDB_SUCCESS) goto failed;
    802798        return msg;
    803799
     
    816812        TALLOC_CTX *tmp_ctx = talloc_new(wins_db);
    817813        int trans = -1;
    818         int ret = 0;
     814        int ret;
    819815
    820816        trans = ldb_transaction_start(wins_db);
     
    833829        if (msg == NULL) goto failed;
    834830        ret = ldb_add(wins_db, msg);
    835         if (ret != 0) goto failed;
     831        if (ret != LDB_SUCCESS) goto failed;
    836832
    837833        trans = ldb_transaction_commit(wins_db);
     
    860856        int trans;
    861857        int ret;
    862         int i;
     858        unsigned int i;
    863859
    864860        trans = ldb_transaction_start(wins_db);
     
    882878
    883879        ret = ldb_modify(wins_db, msg);
    884         if (ret != 0) goto failed;
     880        if (ret != LDB_SUCCESS) goto failed;
    885881
    886882        trans = ldb_transaction_commit(wins_db);
     
    917913
    918914        ret = ldb_delete(wins_db, dn);
    919         if (ret != 0) goto failed;
     915        if (ret != LDB_SUCCESS) goto failed;
    920916
    921917        trans = ldb_transaction_commit(wins_db);
     
    963959
    964960        ret = ldb_msg_add_string(msg, "@LIST", "wins_ldb");
    965         if (ret != 0) goto failed;
     961        if (ret != LDB_SUCCESS) goto failed;
    966962
    967963        ret = ldb_add(h->ldb, msg);
    968         if (ret != 0) goto failed;
     964        if (ret != LDB_SUCCESS) goto failed;
    969965
    970966        trans = ldb_transaction_commit(h->ldb);
     
    976972        h->ldb = NULL;
    977973
    978         if (lp_parm_bool(lp_ctx, NULL,"winsdb", "nosync", false)) {
     974        if (lpcfg_parm_bool(lp_ctx, NULL,"winsdb", "nosync", false)) {
    979975                flags |= LDB_FLG_NOSYNC;
    980976        }
    981977
    982         h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
    983                                   NULL, NULL, flags, NULL);
     978        h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)),
     979                                  NULL, NULL, flags);
    984980        if (!h->ldb) goto failed;
    985981
     
    10121008        if (!h) return NULL;
    10131009
    1014         if (lp_parm_bool(lp_ctx, NULL,"winsdb", "nosync", false)) {
     1010        if (lpcfg_parm_bool(lp_ctx, NULL,"winsdb", "nosync", false)) {
    10151011                flags |= LDB_FLG_NOSYNC;
    10161012        }
    10171013
    1018         h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
    1019                                   NULL, NULL, flags, NULL);
    1020         if (!h->ldb) goto failed;       
     1014        h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)),
     1015                                  NULL, NULL, flags);
     1016        if (!h->ldb) goto failed;
    10211017
    10221018        h->caller = caller;
    1023         h->hook_script = lp_wins_hook(lp_ctx);
     1019        h->hook_script = lpcfg_wins_hook(lp_ctx);
    10241020
    10251021        h->local_owner = talloc_strdup(h, owner);
     
    10381034        return NULL;
    10391035}
     1036
  • vendor/current/source4/nbt_server/wins/winsserver.c

    r414 r740  
    3333#include "lib/socket/socket.h"
    3434#include "lib/socket/netif.h"
    35 #include "lib/ldb/include/ldb.h"
     35#include <ldb.h>
    3636#include "param/param.h"
    3737#include "libcli/resolve/resolve.h"
     38#include "lib/util/util_net.h"
    3839
    3940/*
     
    282283
    283284        /*
    284          * now remove all addresses that're the client doesn't hold anymore
    285          * and update the time stamp and owner for the ownes that are still there
     285         * now remove all addresses that the client doesn't hold anymore
     286         * and update the time stamp and owner for the ones that are still there
    286287         */
    287288        for (i=0; rec->addresses[i]; i++) {
     
    415416
    416417        s->io.in.nbtd_server    = iface->nbtsrv;
    417         s->io.in.nbt_port       = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
     418        s->io.in.nbt_port       = lpcfg_nbt_port(iface->nbtsrv->task->lp_ctx);
    418419        s->io.in.event_ctx      = iface->nbtsrv->task->event_ctx;
    419420        s->io.in.name           = rec->name;
     
    497498        }
    498499
     500        if (name->scope && strlen(name->scope) > 237) {
     501                rcode = NBT_RCODE_SVR;
     502                goto done;
     503        }
     504
    499505        duplicate_packet = wins_check_wack_queue(iface, packet, src);
    500506        if (duplicate_packet) {
     
    665671
    666672        /* first sort the addresses depending on the matching to the client */
    667         ldb_qsort(addresses, num_addrs , sizeof(addresses[0]),
    668                   src, (ldb_qsort_cmp_fn_t)nbtd_wins_randomize1Clist_sort);
    669 
    670         mask = lp_parm_string(lp_ctx, NULL, "nbtd", "wins_randomize1Clist_mask");
     673        LDB_TYPESAFE_QSORT(addresses, num_addrs, src, nbtd_wins_randomize1Clist_sort);
     674
     675        mask = lpcfg_parm_string(lp_ctx, NULL, "nbtd", "wins_randomize1Clist_mask");
    671676        if (!mask) {
    672677                mask = "255.255.255.0";
     
    746751         */
    747752        if (name->type == NBT_NAME_LOGON &&
    748             lp_parm_bool(lp_ctx, NULL, "nbtd", "wins_prepend1Bto1Cqueries", true)) {
     753            lpcfg_parm_bool(lp_ctx, NULL, "nbtd", "wins_prepend1Bto1Cqueries", true)) {
    749754                struct nbt_name name_1b;
    750755
     
    760765        status = winsdb_lookup(winssrv->wins_db, name, packet, &rec);
    761766        if (!NT_STATUS_IS_OK(status)) {
    762                 if (!lp_wins_dns_proxy(lp_ctx)) {
     767                if (!lpcfg_wins_dns_proxy(lp_ctx)) {
    763768                        goto notfound;
    764769                }
     
    842847         */
    843848        if (name->type == NBT_NAME_LOGON &&
    844             lp_parm_bool(lp_ctx, NULL, "nbtd", "wins_randomize1Clist", false)) {
     849            lpcfg_parm_bool(lp_ctx, NULL, "nbtd", "wins_randomize1Clist", false)) {
    845850                nbtd_wins_randomize1Clist(lp_ctx, addresses, src);
    846851        }
     
    872877
    873878        if (name->type == NBT_NAME_MASTER) {
     879                goto done;
     880        }
     881
     882        if (name->scope && strlen(name->scope) > 237) {
    874883                goto done;
    875884        }
     
    951960                        modify_flags = WINSDB_FLAG_ALLOC_VERSION | WINSDB_FLAG_TAKE_OWNERSHIP;
    952961                }
    953                 if (lp_parm_bool(iface->nbtsrv->task->lp_ctx, NULL, "wreplsrv", "propagate name releases", false)) {
     962                if (lpcfg_parm_bool(iface->nbtsrv->task->lp_ctx, NULL, "wreplsrv", "propagate name releases", false)) {
    954963                        /*
    955964                         * We have an option to propagate every name release,
     
    10301039        const char *owner;
    10311040
    1032         if (!lp_wins_support(nbtsrv->task->lp_ctx)) {
     1041        if (!lpcfg_wins_support(nbtsrv->task->lp_ctx)) {
    10331042                nbtsrv->winssrv = NULL;
    10341043                return NT_STATUS_OK;
     
    10381047        NT_STATUS_HAVE_NO_MEMORY(nbtsrv->winssrv);
    10391048
    1040         nbtsrv->winssrv->config.max_renew_interval = lp_max_wins_ttl(nbtsrv->task->lp_ctx);
    1041         nbtsrv->winssrv->config.min_renew_interval = lp_min_wins_ttl(nbtsrv->task->lp_ctx);
    1042         tmp = lp_parm_int(nbtsrv->task->lp_ctx, NULL, "wreplsrv", "tombstone_interval", 6*24*60*60);
     1049        nbtsrv->winssrv->config.max_renew_interval = lpcfg_max_wins_ttl(nbtsrv->task->lp_ctx);
     1050        nbtsrv->winssrv->config.min_renew_interval = lpcfg_min_wins_ttl(nbtsrv->task->lp_ctx);
     1051        tmp = lpcfg_parm_int(nbtsrv->task->lp_ctx, NULL, "wreplsrv", "tombstone_interval", 6*24*60*60);
    10431052        nbtsrv->winssrv->config.tombstone_interval = tmp;
    1044         tmp = lp_parm_int(nbtsrv->task->lp_ctx, NULL, "wreplsrv"," tombstone_timeout", 1*24*60*60);
     1053        tmp = lpcfg_parm_int(nbtsrv->task->lp_ctx, NULL, "wreplsrv"," tombstone_timeout", 1*24*60*60);
    10451054        nbtsrv->winssrv->config.tombstone_timeout = tmp;
    10461055
    1047         owner = lp_parm_string(nbtsrv->task->lp_ctx, NULL, "winsdb", "local_owner");
     1056        owner = lpcfg_parm_string(nbtsrv->task->lp_ctx, NULL, "winsdb", "local_owner");
    10481057
    10491058        if (owner == NULL) {
    10501059                struct interface *ifaces;
    1051                 load_interfaces(nbtsrv->task, lp_interfaces(nbtsrv->task->lp_ctx), &ifaces);
     1060                load_interfaces(nbtsrv->task, lpcfg_interfaces(nbtsrv->task->lp_ctx), &ifaces);
    10521061                owner = iface_n_ip(ifaces, 0);
    10531062        }
  • vendor/current/source4/nbt_server/wins/winsserver.h

    r414 r740  
    6464};
    6565
     66struct composite_context;
    6667#include "nbt_server/wins/winsserver_proto.h"
  • vendor/current/source4/nbt_server/wins/winswack.c

    r414 r740  
    164164                        struct nbtd_interface *iface;
    165165
    166                         state->release.in.dest_port = lp_nbt_port(state->io->in.nbtd_server->task->lp_ctx);
     166                        state->release.in.dest_port = lpcfg_nbt_port(state->io->in.nbtd_server->task->lp_ctx);
    167167                        state->release.in.dest_addr = state->io->in.addresses[state->current_address];
    168168                        state->release.in.address   = state->release.in.dest_addr;
     
    224224         */
    225225        state->release.in.name        = *state->io->in.name;
    226         state->release.in.dest_port   = lp_nbt_port(state->io->in.nbtd_server->task->lp_ctx);
     226        state->release.in.dest_port   = lpcfg_nbt_port(state->io->in.nbtd_server->task->lp_ctx);
    227227        state->release.in.dest_addr   = state->io->in.addresses[state->current_address];
    228228        state->release.in.address     = state->release.in.dest_addr;
     
    307307
    308308        s->io.in.nbtd_server    = nbtd_server;
    309         s->io.in.nbt_port       = lp_nbt_port(nbtd_server->task->lp_ctx);
     309        s->io.in.nbt_port       = lpcfg_nbt_port(nbtd_server->task->lp_ctx);
    310310        s->io.in.event_ctx      = msg->ev;
    311311        s->io.in.name           = &req->in.name;
Note: See TracChangeset for help on using the changeset viewer.