diff options
Diffstat (limited to 'source4/nbt_server')
-rw-r--r-- | source4/nbt_server/dgram/netlogon.c | 21 | ||||
-rw-r--r-- | source4/nbt_server/dgram/ntlogon.c | 7 | ||||
-rw-r--r-- | source4/nbt_server/dgram/request.c | 8 | ||||
-rw-r--r-- | source4/nbt_server/nbt_server.c | 2 | ||||
-rw-r--r-- | source4/nbt_server/packet.c | 3 | ||||
-rw-r--r-- | source4/nbt_server/query.c | 3 | ||||
-rw-r--r-- | source4/nbt_server/register.c | 22 | ||||
-rw-r--r-- | source4/nbt_server/wins/wins_hook.c | 9 | ||||
-rw-r--r-- | source4/nbt_server/wins/winsclient.c | 6 | ||||
-rw-r--r-- | source4/nbt_server/wins/winsdb.c | 24 | ||||
-rw-r--r-- | source4/nbt_server/wins/winsdb.h | 3 | ||||
-rw-r--r-- | source4/nbt_server/wins/winsserver.c | 31 |
12 files changed, 75 insertions, 64 deletions
diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c index 5f0c81f94e..46bfaa9381 100644 --- a/source4/nbt_server/dgram/netlogon.c +++ b/source4/nbt_server/dgram/netlogon.c @@ -28,6 +28,7 @@ #include "util/util_ldb.h" #include "librpc/gen_ndr/ndr_nbt.h" #include "param/param.h" +#include "smbd/service_task.h" /* reply to a GETDC request @@ -53,7 +54,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot, return; } - samctx = samdb_connect(packet, global_loadparm, anonymous_session(packet, global_loadparm)); + samctx = samdb_connect(packet, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->lp_ctx)); if (samctx == NULL) { DEBUG(2,("Unable to open sam in getdc reply\n")); return; @@ -75,7 +76,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot, reply.command = NETLOGON_RESPONSE_FROM_PDC; pdc = &reply.req.response; - pdc->pdc_name = lp_netbios_name(global_loadparm); + pdc->pdc_name = lp_netbios_name(iface->nbtsrv->task->lp_ctx); pdc->unicode_pdc_name = pdc->pdc_name; pdc->domain_name = samdb_result_string(ref_res[0], "nETBIOSName", name->name);; pdc->nt_version = 1; @@ -87,7 +88,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot, dgram_mailslot_netlogon_reply(reply_iface->dgmsock, packet, - lp_netbios_name(global_loadparm), + lp_netbios_name(iface->nbtsrv->task->lp_ctx), netlogon->req.pdc.mailslot_name, &reply); } @@ -111,7 +112,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, const char *dom_attrs[] = {"objectGUID", NULL}; struct ldb_message **ref_res, **dom_res; int ret; - const char **services = lp_server_services(global_loadparm); + const char **services = lp_server_services(iface->nbtsrv->task->lp_ctx); const char *my_ip = reply_iface->ip_address; struct ldb_dn *partitions_basedn; if (!my_ip) { @@ -124,7 +125,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, return; } - samctx = samdb_connect(packet, global_loadparm, anonymous_session(packet, global_loadparm)); + samctx = samdb_connect(packet, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->lp_ctx)); if (samctx == NULL) { DEBUG(2,("Unable to open sam in getdc reply\n")); return; @@ -185,17 +186,17 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, pdc->domain_uuid = samdb_result_guid(dom_res[0], "objectGUID"); pdc->forest = samdb_result_string(ref_res[0], "dnsRoot", - lp_realm(global_loadparm)); + lp_realm(iface->nbtsrv->task->lp_ctx)); pdc->dns_domain = samdb_result_string(ref_res[0], "dnsRoot", - lp_realm(global_loadparm)); + lp_realm(iface->nbtsrv->task->lp_ctx)); /* TODO: get our full DNS name from somewhere else */ pdc->pdc_dns_name = talloc_asprintf(packet, "%s.%s", strlower_talloc(packet, - lp_netbios_name(global_loadparm)), + lp_netbios_name(iface->nbtsrv->task->lp_ctx)), pdc->dns_domain); pdc->domain = samdb_result_string(ref_res[0], "nETBIOSName", name->name);; - pdc->pdc_name = lp_netbios_name(global_loadparm); + pdc->pdc_name = lp_netbios_name(iface->nbtsrv->task->lp_ctx); pdc->user_name = netlogon->req.pdc2.user_name; /* TODO: we need to make sure these are in our DNS zone */ pdc->server_site = "Default-First-Site-Name"; @@ -211,7 +212,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, dgram_mailslot_netlogon_reply(reply_iface->dgmsock, packet, - lp_netbios_name(global_loadparm), + lp_netbios_name(iface->nbtsrv->task->lp_ctx), netlogon->req.pdc2.mailslot_name, &reply); } diff --git a/source4/nbt_server/dgram/ntlogon.c b/source4/nbt_server/dgram/ntlogon.c index 942fc77b98..352be34489 100644 --- a/source4/nbt_server/dgram/ntlogon.c +++ b/source4/nbt_server/dgram/ntlogon.c @@ -21,6 +21,7 @@ #include "includes.h" #include "nbt_server/nbt_server.h" +#include "smbd/service_task.h" #include "lib/socket/socket.h" #include "librpc/gen_ndr/ndr_nbt.h" #include "param/param.h" @@ -50,9 +51,9 @@ static void nbtd_ntlogon_sam_logon(struct dgram_mailslot_handler *dgmslot, logon = &reply.req.reply; logon->server = talloc_asprintf(packet, "\\\\%s", - lp_netbios_name(global_loadparm)); + lp_netbios_name(iface->nbtsrv->task->lp_ctx)); logon->user_name = ntlogon->req.logon.user_name; - logon->domain = lp_workgroup(global_loadparm); + logon->domain = lp_workgroup(iface->nbtsrv->task->lp_ctx); logon->nt_version = 1; logon->lmnt_token = 0xFFFF; logon->lm20_token = 0xFFFF; @@ -61,7 +62,7 @@ static void nbtd_ntlogon_sam_logon(struct dgram_mailslot_handler *dgmslot, dgram_mailslot_ntlogon_reply(reply_iface->dgmsock, packet, - lp_netbios_name(global_loadparm), + lp_netbios_name(iface->nbtsrv->task->lp_ctx), ntlogon->req.logon.mailslot_name, &reply); } diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 48d6e4cb3a..45426c31ba 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -81,7 +81,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address bcast_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, iface->bcast_address, - lp_dgram_port(global_loadparm)); + lp_dgram_port(iface->nbtsrv->task->lp_ctx)); if (!bcast_addr) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -91,7 +91,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", - iface->bcast_address, lp_dgram_port(global_loadparm), + iface->bcast_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx), nt_errstr(status))); return status; } @@ -107,7 +107,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address } bind_addr = socket_address_from_strings(tmp_ctx, iface->dgmsock->sock->backend_name, - bind_address, lp_dgram_port(global_loadparm)); + bind_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx)); if (!bind_addr) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -117,7 +117,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", - bind_address, lp_dgram_port(global_loadparm), nt_errstr(status))); + bind_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx), nt_errstr(status))); return status; } diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c index e06457f47f..29715e925f 100644 --- a/source4/nbt_server/nbt_server.c +++ b/source4/nbt_server/nbt_server.c @@ -63,7 +63,7 @@ static void nbtd_task_init(struct task_server *task) return; } - nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->lp_ctx, anonymous_session(nbtsrv, global_loadparm)); + nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->lp_ctx, anonymous_session(nbtsrv, task->lp_ctx)); if (nbtsrv->sam_ctx == NULL) { task_server_terminate(task, "nbtd failed to open samdb"); return; diff --git a/source4/nbt_server/packet.c b/source4/nbt_server/packet.c index 6b8e266f6d..07a309b633 100644 --- a/source4/nbt_server/packet.c +++ b/source4/nbt_server/packet.c @@ -21,6 +21,7 @@ #include "includes.h" #include "nbt_server/nbt_server.h" +#include "smbd/service_task.h" #include "lib/socket/socket.h" #include "librpc/gen_ndr/ndr_nbt.h" #include "param/param.h" @@ -78,7 +79,7 @@ bool nbtd_self_packet(struct nbt_name_socket *nbtsock, struct nbtd_server *nbtsrv = iface->nbtsrv; /* if its not from the nbt port, then it wasn't a broadcast from us */ - if (src->port != lp_nbt_port(global_loadparm)) { + if (src->port != lp_nbt_port(iface->nbtsrv->task->lp_ctx)) { return false; } diff --git a/source4/nbt_server/query.c b/source4/nbt_server/query.c index f57cb7bf76..dfd742db5a 100644 --- a/source4/nbt_server/query.c +++ b/source4/nbt_server/query.c @@ -24,6 +24,7 @@ #include "system/network.h" #include "nbt_server/nbt_server.h" #include "nbt_server/wins/winsserver.h" +#include "smbd/service_task.h" #include "librpc/gen_ndr/ndr_nbt.h" #include "lib/socket/socket.h" #include "param/param.h" @@ -81,7 +82,7 @@ void nbtd_request_query(struct nbt_name_socket *nbtsock, if (!(packet->operation & NBT_FLAG_BROADCAST) && (packet->operation & NBT_FLAG_RECURSION_DESIRED) && (iname->nb_flags & NBT_NM_GROUP) && - lp_wins_support(global_loadparm)) { + lp_wins_support(iface->nbtsrv->task->lp_ctx)) { nbtd_winsserver_request(nbtsock, packet, src); return; } diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c index 4ec70e319b..c185001e23 100644 --- a/source4/nbt_server/register.c +++ b/source4/nbt_server/register.c @@ -117,7 +117,7 @@ static void name_refresh_handler(struct event_context *ev, struct timed_event *t static void nbtd_start_refresh_timer(struct nbtd_iface_name *iname) { uint32_t refresh_time; - uint32_t max_refresh_time = lp_parm_int(global_loadparm, NULL, "nbtd", "max_refresh_time", 7200); + uint32_t max_refresh_time = lp_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "max_refresh_time", 7200); refresh_time = MIN(max_refresh_time, iname->ttl/2); @@ -170,7 +170,7 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface, uint16_t nb_flags) { struct nbtd_iface_name *iname; - const char *scope = lp_netbios_scope(global_loadparm); + const char *scope = lp_netbios_scope(iface->nbtsrv->task->lp_ctx); struct nbt_name_register_bcast io; struct composite_context *creq; struct nbtd_server *nbtsrv = iface->nbtsrv; @@ -187,7 +187,7 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface, iname->name.scope = NULL; } iname->nb_flags = nb_flags; - iname->ttl = lp_parm_int(global_loadparm, NULL, "nbtd", "bcast_ttl", 300000); + iname->ttl = lp_parm_int(iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "bcast_ttl", 300000); iname->registration_time = timeval_zero(); iname->wins_server = NULL; @@ -260,29 +260,29 @@ void nbtd_register_names(struct nbtd_server *nbtsrv) /* note that we don't initially mark the names "ACTIVE". They are marked active once registration is successful */ - nbtd_register_name(nbtsrv, lp_netbios_name(global_loadparm), NBT_NAME_CLIENT, nb_flags); - nbtd_register_name(nbtsrv, lp_netbios_name(global_loadparm), NBT_NAME_USER, nb_flags); - nbtd_register_name(nbtsrv, lp_netbios_name(global_loadparm), NBT_NAME_SERVER, nb_flags); + nbtd_register_name(nbtsrv, lp_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_CLIENT, nb_flags); + nbtd_register_name(nbtsrv, lp_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_USER, nb_flags); + nbtd_register_name(nbtsrv, lp_netbios_name(nbtsrv->task->lp_ctx), NBT_NAME_SERVER, nb_flags); - aliases = lp_netbios_aliases(global_loadparm); + aliases = lp_netbios_aliases(nbtsrv->task->lp_ctx); while (aliases && aliases[0]) { nbtd_register_name(nbtsrv, aliases[0], NBT_NAME_CLIENT, nb_flags); nbtd_register_name(nbtsrv, aliases[0], NBT_NAME_SERVER, nb_flags); aliases++; } - if (lp_server_role(global_loadparm) == ROLE_DOMAIN_CONTROLLER) { + if (lp_server_role(nbtsrv->task->lp_ctx) == ROLE_DOMAIN_CONTROLLER) { bool is_pdc = samdb_is_pdc(nbtsrv->sam_ctx); if (is_pdc) { - nbtd_register_name(nbtsrv, lp_workgroup(global_loadparm), + nbtd_register_name(nbtsrv, lp_workgroup(nbtsrv->task->lp_ctx), NBT_NAME_PDC, nb_flags); } - nbtd_register_name(nbtsrv, lp_workgroup(global_loadparm), + nbtd_register_name(nbtsrv, lp_workgroup(nbtsrv->task->lp_ctx), NBT_NAME_LOGON, nb_flags | NBT_NM_GROUP); } nb_flags |= NBT_NM_GROUP; - nbtd_register_name(nbtsrv, lp_workgroup(global_loadparm), NBT_NAME_CLIENT, nb_flags); + nbtd_register_name(nbtsrv, lp_workgroup(nbtsrv->task->lp_ctx), NBT_NAME_CLIENT, nb_flags); nb_flags |= NBT_NM_PERMANENT; nbtd_register_name(nbtsrv, "__SAMBA__", NBT_NAME_CLIENT, nb_flags); diff --git a/source4/nbt_server/wins/wins_hook.c b/source4/nbt_server/wins/wins_hook.c index 768f9477f6..ae832774a3 100644 --- a/source4/nbt_server/wins/wins_hook.c +++ b/source4/nbt_server/wins/wins_hook.c @@ -38,15 +38,14 @@ static const char *wins_hook_action_string(enum wins_hook_action action) } void wins_hook(struct winsdb_handle *h, const struct winsdb_record *rec, - enum wins_hook_action action) + enum wins_hook_action action, const char *wins_hook_script) { - const char *script = lp_wins_hook(global_loadparm); uint32_t i, length; int child; char *cmd = NULL; TALLOC_CTX *tmp_mem = NULL; - if (!script || !script[0]) return; + if (!wins_hook_script || !wins_hook_script[0]) return; tmp_mem = talloc_new(h); if (!tmp_mem) goto failed; @@ -59,7 +58,7 @@ void wins_hook(struct winsdb_handle *h, const struct winsdb_record *rec, cmd = talloc_asprintf(tmp_mem, "%s %s %s %02x %ld", - script, + wins_hook_script, wins_hook_action_string(action), rec->name->name, rec->name->type, @@ -92,5 +91,5 @@ void wins_hook(struct winsdb_handle *h, const struct winsdb_record *rec, return; failed: talloc_free(tmp_mem); - DEBUG(0,("FAILED: calling wins hook '%s'\n", script)); + DEBUG(0,("FAILED: calling wins hook '%s'\n", wins_hook_script)); } diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index d1342c3766..046be28515 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -58,7 +58,7 @@ static void nbtd_wins_register_retry(struct event_context *ev, struct timed_even static void nbtd_wins_start_refresh_timer(struct nbtd_iface_name *iname) { uint32_t refresh_time; - uint32_t max_refresh_time = lp_parm_int(global_loadparm, NULL, "nbtd", "max_refresh_time", 7200); + uint32_t max_refresh_time = lp_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "max_refresh_time", 7200); refresh_time = MIN(max_refresh_time, iname->ttl/2); @@ -179,7 +179,7 @@ static void nbtd_wins_register_handler(struct composite_context *c) if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { /* none of the WINS servers responded - try again periodically */ - int wins_retry_time = lp_parm_int(global_loadparm, NULL, "nbtd", "wins_retry", 300); + int wins_retry_time = lp_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "wins_retry", 300); event_add_timed(iname->iface->nbtsrv->task->event_ctx, iname, timeval_current_ofs(wins_retry_time, 0), @@ -236,7 +236,7 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname) /* setup a wins name register request */ io.in.name = iname->name; - io.in.wins_servers = lp_wins_server_list(global_loadparm); + io.in.wins_servers = lp_wins_server_list(iname->iface->nbtsrv->task->lp_ctx); io.in.addresses = nbtd_address_list(iface, iname); io.in.nb_flags = iname->nb_flags; io.in.ttl = iname->ttl; diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 6ba0363824..438fb12b58 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -850,7 +850,7 @@ uint8_t winsdb_add(struct winsdb_handle *h, struct winsdb_record *rec, uint32_t trans = ldb_transaction_commit(wins_db); if (trans != LDB_SUCCESS) goto failed; - wins_hook(h, rec, WINS_HOOK_ADD); + wins_hook(h, rec, WINS_HOOK_ADD, h->hook_script); talloc_free(tmp_ctx); return NBT_RCODE_OK; @@ -899,7 +899,7 @@ uint8_t winsdb_modify(struct winsdb_handle *h, struct winsdb_record *rec, uint32 trans = ldb_transaction_commit(wins_db); if (trans != LDB_SUCCESS) goto failed; - wins_hook(h, rec, WINS_HOOK_MODIFY); + wins_hook(h, rec, WINS_HOOK_MODIFY, h->hook_script); talloc_free(tmp_ctx); return NBT_RCODE_OK; @@ -934,7 +934,7 @@ uint8_t winsdb_delete(struct winsdb_handle *h, struct winsdb_record *rec) trans = ldb_transaction_commit(wins_db); if (trans != LDB_SUCCESS) goto failed; - wins_hook(h, rec, WINS_HOOK_DELETE); + wins_hook(h, rec, WINS_HOOK_DELETE, h->hook_script); talloc_free(tmp_ctx); return NBT_RCODE_OK; @@ -945,7 +945,7 @@ failed: return NBT_RCODE_SVR; } -static bool winsdb_check_or_add_module_list(struct winsdb_handle *h) +static bool winsdb_check_or_add_module_list(struct loadparm_context *lp_ctx, struct winsdb_handle *h) { int trans; int ret; @@ -988,11 +988,11 @@ static bool winsdb_check_or_add_module_list(struct winsdb_handle *h) talloc_free(h->ldb); h->ldb = NULL; - if (lp_parm_bool(global_loadparm, NULL,"winsdb", "nosync", false)) { + if (lp_parm_bool(lp_ctx, NULL,"winsdb", "nosync", false)) { flags |= LDB_FLG_NOSYNC; } - h->ldb = ldb_wrap_connect(h, global_loadparm, lock_path(h, global_loadparm, lp_wins_url(global_loadparm)), + h->ldb = ldb_wrap_connect(h, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)), NULL, NULL, flags, NULL); if (!h->ldb) goto failed; @@ -1010,7 +1010,8 @@ failed: return false; } -struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, enum winsdb_handle_caller caller) +struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, + enum winsdb_handle_caller caller) { struct winsdb_handle *h = NULL; const char *owner; @@ -1021,17 +1022,18 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, enum winsdb_handle_cal h = talloc(mem_ctx, struct winsdb_handle); if (!h) return NULL; - if (lp_parm_bool(global_loadparm, NULL,"winsdb", "nosync", false)) { + if (lp_parm_bool(lp_ctx, NULL,"winsdb", "nosync", false)) { flags |= LDB_FLG_NOSYNC; } - h->ldb = ldb_wrap_connect(h, global_loadparm, lock_path(h, global_loadparm, lp_wins_url(global_loadparm)), + h->ldb = ldb_wrap_connect(h, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)), NULL, NULL, flags, NULL); if (!h->ldb) goto failed; h->caller = caller; + h->hook_script = lp_wins_hook(lp_ctx); - owner = lp_parm_string(global_loadparm, NULL, "winsdb", "local_owner"); + owner = lp_parm_string(lp_ctx, NULL, "winsdb", "local_owner"); if (!owner) { owner = iface_n_ip(0); } @@ -1040,7 +1042,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, enum winsdb_handle_cal if (!h->local_owner) goto failed; /* make sure the module list is available and used */ - ret = winsdb_check_or_add_module_list(h); + ret = winsdb_check_or_add_module_list(lp_ctx, h); if (!ret) goto failed; ldb_err = ldb_set_opaque(h->ldb, "winsdb_handle", h); diff --git a/source4/nbt_server/wins/winsdb.h b/source4/nbt_server/wins/winsdb.h index 27b745fadb..7c38a2b017 100644 --- a/source4/nbt_server/wins/winsdb.h +++ b/source4/nbt_server/wins/winsdb.h @@ -65,6 +65,9 @@ struct winsdb_handle { /* local owner address */ const char *local_owner; + + /* wins hook script */ + const char *hook_script; }; enum wins_hook_action { diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c index bce80702df..98262a2f84 100644 --- a/source4/nbt_server/wins/winsserver.c +++ b/source4/nbt_server/wins/winsserver.c @@ -599,7 +599,8 @@ static int nbtd_wins_randomize1Clist_sort(void *p1,/* (const char **) */ return match_bits2 - match_bits1; } -static void nbtd_wins_randomize1Clist(const char **addresses, struct socket_address *src) +static void nbtd_wins_randomize1Clist(struct loadparm_context *lp_ctx, + const char **addresses, struct socket_address *src) { const char *mask; const char *tmp; @@ -615,7 +616,7 @@ static void nbtd_wins_randomize1Clist(const char **addresses, struct socket_addr ldb_qsort(addresses, num_addrs , sizeof(addresses[0]), src, (ldb_qsort_cmp_fn_t)nbtd_wins_randomize1Clist_sort); - mask = lp_parm_string(global_loadparm, NULL, "nbtd", "wins_randomize1Clist_mask"); + mask = lp_parm_string(lp_ctx, NULL, "nbtd", "wins_randomize1Clist_mask"); if (!mask) { mask = "255.255.255.0"; } @@ -662,7 +663,8 @@ static void nbtd_wins_randomize1Clist(const char **addresses, struct socket_addr /* query a name */ -static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock, +static void nbtd_winsserver_query(struct loadparm_context *lp_ctx, + struct nbt_name_socket *nbtsock, struct nbt_name_packet *packet, struct socket_address *src) { @@ -692,7 +694,7 @@ static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock, * Value: 0 = deactivated, 1 = activated */ if (name->type == NBT_NAME_LOGON && - lp_parm_bool(global_loadparm, NULL, "nbtd", "wins_prepend1Bto1Cqueries", true)) { + lp_parm_bool(lp_ctx, NULL, "nbtd", "wins_prepend1Bto1Cqueries", true)) { struct nbt_name name_1b; name_1b = *name; @@ -706,7 +708,7 @@ static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock, status = winsdb_lookup(winssrv->wins_db, name, packet, &rec); if (!NT_STATUS_IS_OK(status)) { - if (!lp_wins_dns_proxy(global_loadparm)) { + if (!lp_wins_dns_proxy(lp_ctx)) { goto notfound; } @@ -788,8 +790,8 @@ static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock, * Value: 0 = deactivated, 1 = activated */ if (name->type == NBT_NAME_LOGON && - lp_parm_bool(global_loadparm, NULL, "nbtd", "wins_randomize1Clist", false)) { - nbtd_wins_randomize1Clist(addresses, src); + lp_parm_bool(lp_ctx, NULL, "nbtd", "wins_randomize1Clist", false)) { + nbtd_wins_randomize1Clist(lp_ctx, addresses, src); } found: @@ -933,7 +935,7 @@ void nbtd_winsserver_request(struct nbt_name_socket *nbtsock, switch (packet->operation & NBT_OPCODE) { case NBT_OPCODE_QUERY: - nbtd_winsserver_query(nbtsock, packet, src); + nbtd_winsserver_query(iface->nbtsrv->task->lp_ctx, nbtsock, packet, src); break; case NBT_OPCODE_REGISTER: @@ -957,7 +959,7 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv) { uint32_t tmp; - if (!lp_wins_support(global_loadparm)) { + if (!lp_wins_support(nbtsrv->task->lp_ctx)) { nbtsrv->winssrv = NULL; return NT_STATUS_OK; } @@ -965,14 +967,15 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv) nbtsrv->winssrv = talloc_zero(nbtsrv, struct wins_server); NT_STATUS_HAVE_NO_MEMORY(nbtsrv->winssrv); - nbtsrv->winssrv->config.max_renew_interval = lp_max_wins_ttl(global_loadparm); - nbtsrv->winssrv->config.min_renew_interval = lp_min_wins_ttl(global_loadparm); - tmp = lp_parm_int(global_loadparm, NULL, "wreplsrv", "tombstone_interval", 6*24*60*60); + nbtsrv->winssrv->config.max_renew_interval = lp_max_wins_ttl(nbtsrv->task->lp_ctx); + nbtsrv->winssrv->config.min_renew_interval = lp_min_wins_ttl(nbtsrv->task->lp_ctx); + tmp = lp_parm_int(nbtsrv->task->lp_ctx, NULL, "wreplsrv", "tombstone_interval", 6*24*60*60); nbtsrv->winssrv->config.tombstone_interval = tmp; - tmp = lp_parm_int(global_loadparm, NULL, "wreplsrv"," tombstone_timeout", 1*24*60*60); + tmp = lp_parm_int(nbtsrv->task->lp_ctx, NULL, "wreplsrv"," tombstone_timeout", 1*24*60*60); nbtsrv->winssrv->config.tombstone_timeout = tmp; - nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv, WINSDB_HANDLE_CALLER_NBTD); + nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->lp_ctx, + WINSDB_HANDLE_CALLER_NBTD); if (!nbtsrv->winssrv->wins_db) { return NT_STATUS_INTERNAL_DB_ERROR; } |