r26313: Fix more uses of static loadparm.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 6 Dec 2007 15:54:34 +0000 (16:54 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:48:25 +0000 (05:48 +0100)
32 files changed:
source/kdc/kdc.c
source/ldap_server/ldap_server.c
source/lib/socket/interface.c
source/librpc/rpc/dcerpc_connect.c
source/librpc/rpc/dcerpc_secondary.c
source/librpc/rpc/dcerpc_sock.c
source/nbt_server/dgram/netlogon.c
source/nbt_server/dgram/ntlogon.c
source/nbt_server/dgram/request.c
source/nbt_server/nbt_server.c
source/nbt_server/packet.c
source/nbt_server/query.c
source/nbt_server/register.c
source/nbt_server/wins/wins_hook.c
source/nbt_server/wins/winsclient.c
source/nbt_server/wins/winsdb.c
source/nbt_server/wins/winsdb.h
source/nbt_server/wins/winsserver.c
source/ntptr/simple_ldb/ntptr_simple_ldb.c
source/rpc_server/common/server_info.c
source/rpc_server/lsa/lsa_lookup.c
source/rpc_server/netlogon/dcerpc_netlogon.c
source/rpc_server/samr/dcesrv_samr.c
source/rpc_server/service_rpc.c
source/rpc_server/srvsvc/dcesrv_srvsvc.c
source/rpc_server/wkssvc/dcesrv_wkssvc.c
source/smb_server/smb_server.c
source/smbd/service_stream.c
source/web_server/web_server.c
source/winbind/wb_server.c
source/wrepl_server/wrepl_in_connection.c
source/wrepl_server/wrepl_server.c

index 2aa9ddd22e68095627932b36052388dafb91c0d4..7708a76c44659d5840dff9299b4a8a967b7d624d 100644 (file)
@@ -491,7 +491,9 @@ static NTSTATUS kdc_add_socket(struct kdc_server *kdc, const char *address,
 
        status = stream_setup_socket(kdc->task->event_ctx, model_ops, 
                                     &kdc_tcp_stream_ops, 
-                                    "ip", address, &kdc_port, kdc);
+                                    "ip", address, &kdc_port, 
+                                    lp_socket_options(kdc->task->lp_ctx), 
+                                    kdc);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("Failed to bind to %s:%u TCP - %s\n",
                         address, kdc_port, nt_errstr(status)));
@@ -501,7 +503,9 @@ static NTSTATUS kdc_add_socket(struct kdc_server *kdc, const char *address,
 
        status = stream_setup_socket(kdc->task->event_ctx, model_ops, 
                                     &kpasswdd_tcp_stream_ops, 
-                                    "ip", address, &kpasswd_port, kdc);
+                                    "ip", address, &kpasswd_port, 
+                                    lp_socket_options(kdc->task->lp_ctx), 
+                                    kdc);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("Failed to bind to %s:%u TCP - %s\n",
                         address, kpasswd_port, nt_errstr(status)));
index 2898d131c9e8878564447936aa3497eb2952efb7..81988b60f66d330b5cd1b97eb5b1ecb063d62de6 100644 (file)
@@ -454,7 +454,9 @@ static NTSTATUS add_socket(struct event_context *event_context,
        int options;
 
        status = stream_setup_socket(event_context, model_ops, &ldap_stream_ops, 
-                                    "ipv4", address, &port, ldap_service);
+                                    "ipv4", address, &port, 
+                                    lp_socket_options(lp_ctx), 
+                                    ldap_service);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("ldapsrv failed to bind to %s:%u - %s\n",
                         address, port, nt_errstr(status)));
@@ -464,7 +466,9 @@ static NTSTATUS add_socket(struct event_context *event_context,
                /* add ldaps server */
                port = 636;
                status = stream_setup_socket(event_context, model_ops, &ldap_stream_ops, 
-                                            "ipv4", address, &port, ldap_service);
+                                            "ipv4", address, &port, 
+                                            lp_socket_options(lp_ctx), 
+                                            ldap_service);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0,("ldapsrv failed to bind to %s:%u - %s\n",
                                 address, port, nt_errstr(status)));
@@ -495,7 +499,9 @@ static NTSTATUS add_socket(struct event_context *event_context,
        if (options & 0x000000001) {
                port = 3268;
                status = stream_setup_socket(event_context, model_ops, &ldap_stream_ops, 
-                                            "ipv4", address, &port, ldap_service);
+                                            "ipv4", address, &port, 
+                                            lp_socket_options(lp_ctx), 
+                                            ldap_service);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0,("ldapsrv failed to bind to %s:%u - %s\n",
                                 address, port, nt_errstr(status)));
@@ -564,7 +570,9 @@ static void ldapsrv_task_init(struct task_server *task)
        }
 
        status = stream_setup_socket(task->event_ctx, model_ops, &ldap_stream_ops, 
-                                    "unix", ldapi_path, NULL, ldap_service);
+                                    "unix", ldapi_path, NULL, 
+                                    lp_socket_options(task->lp_ctx), 
+                                    ldap_service);
        talloc_free(ldapi_path);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("ldapsrv failed to bind to %s - %s\n",
index c220c4d890f2d7ec75fedab9c8395a1b8e59ec2e..a3f6ccc570a17cbc5f31cd172d4af482bfc6331d 100644 (file)
@@ -181,9 +181,9 @@ static void interpret_interface(const char *token,
 /**
 load the list of network interfaces
 **/
-static void load_interfaces(void)
+static void load_interfaces(const char **interfaces)
 {
-       const char **ptr;
+       const char **ptr = interfaces;
        int i;
        struct iface_struct ifaces[MAX_INTERFACES];
        struct in_addr loopback_ip;
@@ -193,7 +193,6 @@ static void load_interfaces(void)
                return;
        }
 
-       ptr = lp_interfaces(global_loadparm);
        loopback_ip = interpret_addr2("127.0.0.1");
 
        /* probe the kernel for interfaces */
@@ -241,7 +240,7 @@ int iface_count(void)
        int ret = 0;
        struct interface *i;
 
-       load_interfaces();
+       load_interfaces(lp_interfaces(global_loadparm));
 
        for (i=local_interfaces;i;i=i->next)
                ret++;
@@ -255,7 +254,7 @@ const char *iface_n_ip(int n)
 {
        struct interface *i;
   
-       load_interfaces();
+       load_interfaces(lp_interfaces(global_loadparm));
 
        for (i=local_interfaces;i && n;i=i->next)
                n--;
@@ -273,7 +272,7 @@ const char *iface_n_bcast(int n)
 {
        struct interface *i;
   
-       load_interfaces();
+       load_interfaces(lp_interfaces(global_loadparm));
 
        for (i=local_interfaces;i && n;i=i->next)
                n--;
@@ -291,7 +290,7 @@ const char *iface_n_netmask(int n)
 {
        struct interface *i;
   
-       load_interfaces();
+       load_interfaces(lp_interfaces(global_loadparm));
 
        for (i=local_interfaces;i && n;i=i->next)
                n--;
@@ -311,7 +310,7 @@ const char *iface_best_ip(const char *dest)
        struct interface *iface;
        struct in_addr ip;
 
-       load_interfaces();
+       load_interfaces(lp_interfaces(global_loadparm));
 
        ip.s_addr = interpret_addr(dest);
        iface = iface_find(ip, true);
@@ -328,7 +327,7 @@ bool iface_is_local(const char *dest)
 {
        struct in_addr ip;
 
-       load_interfaces();
+       load_interfaces(lp_interfaces(global_loadparm));
 
        ip.s_addr = interpret_addr(dest);
        if (iface_find(ip, true)) {
index 4870b8d54aba8456fcfb330a89e4d39cedbf24fb..b9913106f0b8c4439505517afc439c108a91c1d1 100644 (file)
@@ -444,7 +444,8 @@ static struct composite_context* dcerpc_pipe_connect_ncalrpc_send(TALLOC_CTX *me
        s->io  = *io;
 
        /* send pipe open request */
-       pipe_req = dcerpc_pipe_open_pipe_send(s->io.pipe->conn, s->io.binding->endpoint);
+       pipe_req = dcerpc_pipe_open_pipe_send(s->io.pipe->conn, lp_ncalrpc_dir(global_loadparm), 
+                                             s->io.binding->endpoint);
        composite_continue(c, pipe_req, continue_pipe_open_ncalrpc, c);
        return c;
 }
index 2e6311adbdaa74e6b4412dc7f5b65d74e2473d92..4d3547b60c65f12c7701cd41e6eb1a994b98c7b3 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/events/events.h"
 #include "librpc/rpc/dcerpc.h"
 #include "auth/credentials/credentials.h"
+#include "param/param.h"
 
 
 struct sec_conn_state {
@@ -96,7 +97,7 @@ struct composite_context* dcerpc_secondary_connection_send(struct dcerpc_pipe *p
                return c;
 
        case NCALRPC:
-               pipe_ncalrpc_req = dcerpc_pipe_open_pipe_send(s->pipe2->conn,
+               pipe_ncalrpc_req = dcerpc_pipe_open_pipe_send(s->pipe2->conn, lp_ncalrpc_dir(global_loadparm), 
                                                              s->binding->endpoint);
                composite_continue(c, pipe_ncalrpc_req, continue_open_pipe, c);
                return c;
index f7ae377e7b324998c0abe0a5731e4c266e8d74a5..530885f59c2475470ed837575968387d64b31212 100644 (file)
@@ -597,6 +597,7 @@ static void continue_np_open_socket(struct composite_context *ctx)
   Send pipe open request on ncalrpc
 */
 struct composite_context* dcerpc_pipe_open_pipe_send(struct dcerpc_connection *conn,
+                                                    const char *ncalrpc_dir,
                                                     const char *identifier)
 {
        char *canon = NULL;
@@ -619,7 +620,7 @@ struct composite_context* dcerpc_pipe_open_pipe_send(struct dcerpc_connection *c
        s->conn = conn;
 
        string_replace(canon, '/', '\\');
-       s->full_path = talloc_asprintf(canon, "%s/%s", lp_ncalrpc_dir(global_loadparm), canon);
+       s->full_path = talloc_asprintf(canon, "%s/%s", ncalrpc_dir, canon);
        if (composite_nomem(s->full_path, c)) return c;
 
        /* prepare server address using path and transport name */
@@ -648,8 +649,8 @@ NTSTATUS dcerpc_pipe_open_pipe_recv(struct composite_context *c)
 /*
   Open a rpc pipe on a named pipe - sync version
 */
-NTSTATUS dcerpc_pipe_open_pipe(struct dcerpc_connection *conn, const char *identifier)
+NTSTATUS dcerpc_pipe_open_pipe(struct dcerpc_connection *conn, const char *ncalrpc_dir, const char *identifier)
 {
-       struct composite_context *c = dcerpc_pipe_open_pipe_send(conn, identifier);
+       struct composite_context *c = dcerpc_pipe_open_pipe_send(conn, ncalrpc_dir, identifier);
        return dcerpc_pipe_open_pipe_recv(c);
 }
index 5f0c81f94e37fc3986c0ef3c21f6228a79453dd0..46bfaa9381fbc2f6be3e5d423f45d84392ee195a 100644 (file)
@@ -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);
 }
index 942fc77b9884f597881a07e0809026930c5af1c2..352be34489d1ea8b48fd386e7c4badc3950d6a94 100644 (file)
@@ -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);
 }
index 48d6e4cb3ab2586b2e265d66b215160ea6c560c4..45426c31ba4353b2a12b99a2ea9b64d07f1ab74e 100644 (file)
@@ -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;
        }
 
index e06457f47fb0f0a75d7426fc16fe673ae0ab8133..29715e925f432f1044b3d6afb8bc9288907df503 100644 (file)
@@ -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;
index 6b8e266f6de0fce1b224be3589adcc872e78b418..07a309b6335a3a5b6f65663285af569483b024d9 100644 (file)
@@ -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;
        }
 
index f57cb7bf76b6a7dc2283f17abd07ae7431f23750..dfd742db5a1c60c43891e05f7009bde0fac82479 100644 (file)
@@ -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;
        }
index 4ec70e319b7fcefada3ee12b7806508de6d8c55f..c185001e23d8a2c4a38e9bf518a40bf65b41094a 100644 (file)
@@ -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);
index 768f9477f6a19bffbc90d113d24ff02eac0807ac..ae832774a3d27b579743af36921f1cde0d5b9c69 100644 (file)
@@ -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));
 }
index d1342c3766489510a7988cfe48f62e0a83d34ce4..046be28515364d024c2756b1af167effb582840f 100644 (file)
@@ -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;
index 6ba03638245e59bb2982bddee59237c71e6cac51..438fb12b587881e2a36423220220fe2c43631f3e 100644 (file)
@@ -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);
index 27b745fadb24c23be57cb66240a6410ba21557a9..7c38a2b017f333406844da127471927d5397b666 100644 (file)
@@ -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 {
index bce80702df29dd5ea352a529934f4a9bf997ff7c..98262a2f847176fb93793ba078ed047d649e75b5 100644 (file)
@@ -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;
        }
index f4437b389da90daa7c95515fe6cae217d1a94385..9a9fa626efdaa47ad3ca8719e0f889c9f1ef045b 100644 (file)
@@ -170,9 +170,9 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC
                enum ndr_err_code ndr_err;
                struct spoolss_OSVersion os;
 
-               os.major                = dcesrv_common_get_version_major(mem_ctx, NULL);
-               os.minor                = dcesrv_common_get_version_minor(mem_ctx, NULL);
-               os.build                = dcesrv_common_get_version_build(mem_ctx, NULL);
+               os.major                = dcesrv_common_get_version_major(mem_ctx, global_loadparm);
+               os.minor                = dcesrv_common_get_version_minor(mem_ctx, global_loadparm);
+               os.build                = dcesrv_common_get_version_build(mem_ctx, global_loadparm);
                os.extra_string         = "";
 
                ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &os, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersion);
@@ -188,9 +188,9 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC
                enum ndr_err_code ndr_err;
                struct spoolss_OSVersionEx os_ex;
 
-               os_ex.major             = dcesrv_common_get_version_major(mem_ctx, NULL);
-               os_ex.minor             = dcesrv_common_get_version_minor(mem_ctx, NULL);
-               os_ex.build             = dcesrv_common_get_version_build(mem_ctx, NULL);
+               os_ex.major             = dcesrv_common_get_version_major(mem_ctx, global_loadparm);
+               os_ex.minor             = dcesrv_common_get_version_minor(mem_ctx, global_loadparm);
+               os_ex.build             = dcesrv_common_get_version_build(mem_ctx, global_loadparm);
                os_ex.extra_string              = "";
                os_ex.unknown2          = 0;
                os_ex.unknown3          = 0;
index cf46954c33b72f6bf2cfafb05c0d3550b5d040da..0a44493df58236a1245ffafbd159e8256ec41273 100644 (file)
@@ -64,21 +64,21 @@ const char *dcesrv_common_get_domain_name(TALLOC_CTX *mem_ctx, struct dcesrv_con
 }
 
 /* This hardcoded value should go into a ldb database! */
-_PUBLIC_ uint32_t dcesrv_common_get_version_major(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
+_PUBLIC_ uint32_t dcesrv_common_get_version_major(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
 {
-       return lp_parm_int(dce_ctx ? dce_ctx->lp_ctx : global_loadparm, NULL, "server_info", "version_major", 5);
+       return lp_parm_int(lp_ctx, NULL, "server_info", "version_major", 5);
 }
 
 /* This hardcoded value should go into a ldb database! */
-_PUBLIC_ uint32_t dcesrv_common_get_version_minor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
+_PUBLIC_ uint32_t dcesrv_common_get_version_minor(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
 {
-       return lp_parm_int(dce_ctx ? dce_ctx->lp_ctx : global_loadparm, NULL, "server_info", "version_minor", 2);
+       return lp_parm_int(lp_ctx, NULL, "server_info", "version_minor", 2);
 }
 
 /* This hardcoded value should go into a ldb database! */
-_PUBLIC_ uint32_t dcesrv_common_get_version_build(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
+_PUBLIC_ uint32_t dcesrv_common_get_version_build(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
 {
-       return lp_parm_int(dce_ctx ? dce_ctx->lp_ctx : global_loadparm, NULL, "server_info", "version_build", 3790);
+       return lp_parm_int(lp_ctx, NULL, "server_info", "version_build", 3790);
 }
 
 /* This hardcoded value should go into a ldb database! */
index cb4092355e8b05a09b3441a83d084d24508bf175..bcc2af97a7af2e61c793eaa94386e052df754da6 100644 (file)
@@ -195,7 +195,8 @@ static NTSTATUS lookup_well_known_sids(TALLOC_CTX *mem_ctx,
 /*
   lookup a SID for 1 name
 */
-static NTSTATUS dcesrv_lsa_lookup_name(struct lsa_policy_state *state, TALLOC_CTX *mem_ctx,
+static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
+                                      struct lsa_policy_state *state, TALLOC_CTX *mem_ctx,
                                const char *name, const char **authority_name, 
                                struct dom_sid **sid, enum lsa_SidType *rtype)
 {
@@ -217,7 +218,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct lsa_policy_state *state, TALLOC_CT
                }
                username = p + 1;
        } else if (strchr_m(name, '@')) {
-               status = crack_name_to_nt4_name(mem_ctx, global_loadparm, DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, name, &domain, &username);
+               status = crack_name_to_nt4_name(mem_ctx, lp_ctx, DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, name, &domain, &username);
                if (!NT_STATUS_IS_OK(status)) {
                        return status;
                }
@@ -263,7 +264,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct lsa_policy_state *state, TALLOC_CT
                if (!name) {
                        return NT_STATUS_NO_MEMORY;
                }
-               status = dcesrv_lsa_lookup_name(state, mem_ctx, name, authority_name, sid, rtype);
+               status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
                if (NT_STATUS_IS_OK(status)) {
                        return status;
                }
@@ -273,7 +274,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct lsa_policy_state *state, TALLOC_CT
                if (!name) {
                        return NT_STATUS_NO_MEMORY;
                }
-               status = dcesrv_lsa_lookup_name(state, mem_ctx, name, authority_name, sid, rtype);
+               status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
                if (NT_STATUS_IS_OK(status)) {
                        return status;
                }
@@ -283,7 +284,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct lsa_policy_state *state, TALLOC_CT
                if (!name) {
                        return NT_STATUS_NO_MEMORY;
                }
-               status = dcesrv_lsa_lookup_name(state, mem_ctx, name, authority_name, sid, rtype);
+               status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
                if (NT_STATUS_IS_OK(status)) {
                        return status;
                }
@@ -679,6 +680,7 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
        struct lsa_policy_state *policy_state;
        struct dcesrv_handle *policy_handle;
        int i;
+       struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
 
        DCESRV_PULL_HANDLE(policy_handle, r->in.handle, LSA_HANDLE_POLICY);
 
@@ -719,7 +721,7 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
                r->out.sids->sids[i].sid_index   = 0xFFFFFFFF;
                r->out.sids->sids[i].unknown     = 0;
 
-               status2 = dcesrv_lsa_lookup_name(policy_state, mem_ctx, name, &authority_name, &sid, &rtype);
+               status2 = dcesrv_lsa_lookup_name(lp_ctx, policy_state, mem_ctx, name, &authority_name, &sid, &rtype);
                if (!NT_STATUS_IS_OK(status2) || sid->num_auths == 0) {
                        continue;
                }
@@ -812,6 +814,7 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call,
        struct lsa_policy_state *state;
        struct dcesrv_handle *h;
        int i;
+       struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
 
        r->out.domains = NULL;
 
@@ -851,7 +854,7 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call,
                r->out.sids->sids[i].sid_index   = 0xFFFFFFFF;
                r->out.sids->sids[i].unknown     = 0;
 
-               status2 = dcesrv_lsa_lookup_name(state, mem_ctx, name, 
+               status2 = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, 
                                                 &authority_name, &sid, &rtype);
                if (!NT_STATUS_IS_OK(status2)) {
                        continue;
index 0ddc11c8b8bc575ffd11f19183a524f0e2e0789c..15916a81fc0e23a1853bbe34ad163680ad2b6156 100644 (file)
@@ -246,7 +246,7 @@ static NTSTATUS dcesrv_netr_creds_server_step_check(struct loadparm_context *lp_
        struct ldb_context *ldb;
        int ret;
 
-       ldb = schannel_db_connect(mem_ctx, global_loadparm);
+       ldb = schannel_db_connect(mem_ctx, lp_ctx);
        if (!ldb) {
                return NT_STATUS_ACCESS_DENIED;
        }
@@ -262,7 +262,7 @@ static NTSTATUS dcesrv_netr_creds_server_step_check(struct loadparm_context *lp_
         * update the structure */ 
        
        nt_status = schannel_fetch_session_key_ldb(ldb, ldb, computer_name, 
-                                                  lp_workgroup(global_loadparm),
+                                                  lp_workgroup(lp_ctx),
                                                   &creds);
        if (NT_STATUS_IS_OK(nt_status)) {
                nt_status = creds_server_step_check(creds, 
index dcb1554740b57b8831d30bcfd286a7d33383a4f9..9a6ebe43b7d0b6140ece4d6701896ad6b1e4d420 100644 (file)
@@ -494,9 +494,10 @@ static NTSTATUS dcesrv_samr_info_DomInfo1(struct samr_domain_state *state,
 /*
   return DomInfo2
 */
-static NTSTATUS dcesrv_samr_info_DomInfo2(struct samr_domain_state *state, TALLOC_CTX *mem_ctx,
-                                   struct ldb_message **dom_msgs,
-                                  struct samr_DomInfo2 *info)
+static NTSTATUS dcesrv_samr_info_DomInfo2(struct samr_domain_state *state, 
+                                         TALLOC_CTX *mem_ctx,
+                                         struct ldb_message **dom_msgs,
+                                         struct samr_DomInfo2 *info)
 {
        enum server_role role = lp_server_role(global_loadparm);
 
index e5ed3bd0cf266218d9b696450df9b36486b57a6d..9cce5292381311d22557f0f06cb14ad6821cbf76 100644 (file)
@@ -107,7 +107,7 @@ static void dcesrv_sock_accept(struct stream_connection *srv_conn)
        struct dcesrv_connection *dcesrv_conn = NULL;
        struct auth_session_info *session_info = NULL;
 
-       status = auth_anonymous_session_info(srv_conn, global_loadparm, &session_info);
+       status = auth_anonymous_session_info(srv_conn, dcesrv_sock->dcesrv_ctx->lp_ctx, &session_info);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("dcesrv_sock_accept: auth_anonymous_session_info failed: %s\n", 
                        nt_errstr(status)));
@@ -234,6 +234,7 @@ static NTSTATUS dcesrv_add_ep_unix(struct dcesrv_context *dce_ctx,
 
        status = stream_setup_socket(event_ctx, model_ops, &dcesrv_stream_ops, 
                                     "unix", e->ep_description->endpoint, &port, 
+                                    lp_socket_options(lp_ctx), 
                                     dcesrv_sock);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("service_setup_stream_socket(path=%s) failed - %s\n",
@@ -271,7 +272,9 @@ static NTSTATUS dcesrv_add_ep_ncalrpc(struct dcesrv_context *dce_ctx,
        dcesrv_sock->dcesrv_ctx         = talloc_reference(dcesrv_sock, dce_ctx);
 
        status = stream_setup_socket(event_ctx, model_ops, &dcesrv_stream_ops, 
-                                    "unix", full_path, &port, dcesrv_sock);
+                                    "unix", full_path, &port, 
+                                    lp_socket_options(lp_ctx), 
+                                    dcesrv_sock);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("service_setup_stream_socket(identifier=%s,path=%s) failed - %s\n",
                         e->ep_description->endpoint, full_path, nt_errstr(status)));
@@ -350,7 +353,9 @@ static NTSTATUS add_socket_rpc_tcp_iface(struct dcesrv_context *dce_ctx, struct
        dcesrv_sock->dcesrv_ctx         = talloc_reference(dcesrv_sock, dce_ctx);
 
        status = stream_setup_socket(event_ctx, model_ops, &dcesrv_stream_ops, 
-                                    "ipv4", address, &port, dcesrv_sock);
+                                    "ipv4", address, &port, 
+                                    lp_socket_options(dce_ctx->lp_ctx), 
+                                    dcesrv_sock);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("service_setup_stream_socket(address=%s,port=%u) failed - %s\n", 
                         address, port, nt_errstr(status)));
index d76e83ba17adae1bdc62894739865ee5d09fafa7..55a647b7ef3e1c30633a8036260553bcccaa05d6 100644 (file)
@@ -1496,8 +1496,8 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA
                info101->server_name    = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc);
                W_ERROR_HAVE_NO_MEMORY(info101->server_name);
 
-               info101->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx);
-               info101->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx);
+               info101->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx);
+               info101->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx);
                info101->server_type    = dcesrv_common_get_server_type(mem_ctx, dce_ctx);
                info101->comment        = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx));
                W_ERROR_HAVE_NO_MEMORY(info101->comment);
@@ -1516,8 +1516,8 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA
                info102->server_name    = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc);
                W_ERROR_HAVE_NO_MEMORY(info102->server_name);
 
-               info102->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx);
-               info102->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx);
+               info102->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx);
+               info102->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx);
                info102->server_type    = dcesrv_common_get_server_type(mem_ctx, dce_ctx);
                info102->comment        = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx));
                W_ERROR_HAVE_NO_MEMORY(info102->comment);
index 556272afd52e49dcf57faa730ccab7e08cdfa6f1..cbade288ca314bdea8231ae49a2885c5819add62 100644 (file)
@@ -51,8 +51,8 @@ static WERROR dcesrv_wkssvc_NetWkstaGetInfo(struct dcesrv_call_state *dce_call,
                W_ERROR_HAVE_NO_MEMORY(info100->server_name);
                info100->domain_name    = dcesrv_common_get_domain_name(mem_ctx, dce_ctx);
                W_ERROR_HAVE_NO_MEMORY(info100->domain_name);
-               info100->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx);
-               info100->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx);
+               info100->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx);
+               info100->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx);
 
                r->out.info->info100 = info100;
                return WERR_OK;
@@ -69,8 +69,8 @@ static WERROR dcesrv_wkssvc_NetWkstaGetInfo(struct dcesrv_call_state *dce_call,
                W_ERROR_HAVE_NO_MEMORY(info101->server_name);
                info101->domain_name    = dcesrv_common_get_domain_name(mem_ctx, dce_ctx);
                W_ERROR_HAVE_NO_MEMORY(info101->domain_name);
-               info101->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx);
-               info101->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx);
+               info101->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx);
+               info101->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx);
                info101->lan_root       = dcesrv_common_get_lan_root(mem_ctx, dce_ctx);
 
                r->out.info->info101 = info101;
index 59d9e8f7b3782ad2d562ade74e68c5324b065e66..9c693b772af5056dabf25fc6bc62a4af6d815af5 100644 (file)
@@ -188,7 +188,9 @@ _PUBLIC_ NTSTATUS smbsrv_add_socket(struct event_context *event_context,
                uint16_t port = atoi(ports[i]);
                if (port == 0) continue;
                status = stream_setup_socket(event_context, model_ops, &smb_stream_ops, 
-                                            "ipv4", address, &port, NULL);
+                                            "ipv4", address, &port, 
+                                            lp_socket_options(lp_ctx), 
+                                            NULL);
                NT_STATUS_NOT_OK_RETURN(status);
        }
 
index 2ad2650486583063381944df445b07f85b364af0..8df8c474f5be8756f704b639b5d8a61bef2babbc 100644 (file)
@@ -241,6 +241,7 @@ NTSTATUS stream_setup_socket(struct event_context *event_context,
                             const char *family,
                             const char *sock_addr,
                             uint16_t *port,
+                            const char *socket_options,
                             void *private)
 {
        NTSTATUS status;
@@ -260,9 +261,10 @@ NTSTATUS stream_setup_socket(struct event_context *event_context,
        status = socket_set_option(stream_socket->sock, "SO_KEEPALIVE", NULL);
        NT_STATUS_NOT_OK_RETURN(status);
 
-       status = socket_set_option(stream_socket->sock, lp_socket_options(global_loadparm), 
-                                  NULL);
-       NT_STATUS_NOT_OK_RETURN(status);
+       if (socket_options != NULL) {
+               status = socket_set_option(stream_socket->sock, socket_options, NULL);
+               NT_STATUS_NOT_OK_RETURN(status);
+       }
 
        /* TODO: set socket ACL's here when they're implemented */
 
index be7b6aabdf0770652ae390e55c76f69207fdc42d..e68b967dfdc8dabc35d2c48d6c9f48d80b4f8c35 100644 (file)
@@ -258,14 +258,15 @@ static void websrv_task_init(struct task_server *task)
                        status = stream_setup_socket(task->event_ctx, model_ops, 
                                                     &web_stream_ops, 
                                                     "ipv4", address, 
-                                                    &port, task);
+                                                    &port, lp_socket_options(task->lp_ctx), 
+                                                    task);
                        if (!NT_STATUS_IS_OK(status)) goto failed;
                }
        } else {
                status = stream_setup_socket(task->event_ctx, model_ops, 
                                             &web_stream_ops, 
                                             "ipv4", lp_socket_address(task->lp_ctx), 
-                                            &port, task);
+                                            &port, lp_socket_options(task->lp_ctx), task);
                if (!NT_STATUS_IS_OK(status)) goto failed;
        }
 
index c9c6516732ecc033f2e12df5b9f2194c471ab36d..f27a3bd12d83099cc9d5a750865948207161a2f2 100644 (file)
@@ -161,6 +161,7 @@ static void winbind_task_init(struct task_server *task)
        status = stream_setup_socket(task->event_ctx, model_ops,
                                     &wbsrv_ops, "unix",
                                     listen_socket->socket_path, &port,
+                                    lp_socket_options(task->lp_ctx), 
                                     listen_socket);
        if (!NT_STATUS_IS_OK(status)) goto listen_failed;
 
@@ -176,6 +177,7 @@ static void winbind_task_init(struct task_server *task)
        status = stream_setup_socket(task->event_ctx, model_ops,
                                     &wbsrv_ops, "unix",
                                     listen_socket->socket_path, &port,
+                                    lp_socket_options(task->lp_ctx), 
                                     listen_socket);
        if (!NT_STATUS_IS_OK(status)) goto listen_failed;
 
index 65c8b6118f38389e6f1b3a24b704047b14f918ae..f5d1d82f9d01419529030216a695a9405e4879f3 100644 (file)
@@ -286,7 +286,9 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
                for(i = 0; i < num_interfaces; i++) {
                        address = iface_n_ip(i);
                        status = stream_setup_socket(task->event_ctx, model_ops, &wreplsrv_stream_ops,
-                                                    "ipv4", address, &port, service);
+                                                    "ipv4", address, &port, 
+                                                     lp_socket_options(task->lp_ctx), 
+                                                    service);
                        if (!NT_STATUS_IS_OK(status)) {
                                DEBUG(0,("stream_setup_socket(address=%s,port=%u) failed - %s\n",
                                         address, port, nt_errstr(status)));
@@ -296,7 +298,8 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
        } else {
                address = lp_socket_address(lp_ctx);
                status = stream_setup_socket(task->event_ctx, model_ops, &wreplsrv_stream_ops,
-                                            "ipv4", address, &port, service);
+                                            "ipv4", address, &port, lp_socket_options(task->lp_ctx), 
+                                            service);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0,("stream_setup_socket(address=%s,port=%u) failed - %s\n",
                                 address, port, nt_errstr(status)));
index 7700a6ded775c4185587e2fdd62f75be6a67fa48..7455c57d75f3072489a3286c219a5ef97d4af603 100644 (file)
@@ -74,7 +74,7 @@ failed:
 static NTSTATUS wreplsrv_open_winsdb(struct wreplsrv_service *service, 
                                     struct loadparm_context *lp_ctx)
 {
-       service->wins_db     = winsdb_connect(service, WINSDB_HANDLE_CALLER_WREPL);
+       service->wins_db     = winsdb_connect(service, lp_ctx, WINSDB_HANDLE_CALLER_WREPL);
        if (!service->wins_db) {
                return NT_STATUS_INTERNAL_DB_ERROR;
        }