diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-06 16:54:34 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:48:25 +0100 |
commit | 2f5ca872a80ad872ab864061f0c6982d8605393f (patch) | |
tree | 061592e4ae1e79adc57cd5d99ff2fd6f3b8c2549 | |
parent | fb29325f1d4feba6c3f52b690d3da5d492618c4f (diff) | |
download | samba-2f5ca872a80ad872ab864061f0c6982d8605393f.tar.gz samba-2f5ca872a80ad872ab864061f0c6982d8605393f.tar.bz2 samba-2f5ca872a80ad872ab864061f0c6982d8605393f.zip |
r26313: Fix more uses of static loadparm.
(This used to be commit 6fd0d9d3b75546d08c24c513e05b1843d5777608)
32 files changed, 172 insertions, 128 deletions
diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c index 2aa9ddd22e..7708a76c44 100644 --- a/source4/kdc/kdc.c +++ b/source4/kdc/kdc.c @@ -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))); diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 2898d131c9..81988b60f6 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -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", diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c index c220c4d890..a3f6ccc570 100644 --- a/source4/lib/socket/interface.c +++ b/source4/lib/socket/interface.c @@ -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)) { diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index 4870b8d54a..b9913106f0 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -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; } diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c index 2e6311adbd..4d3547b60c 100644 --- a/source4/librpc/rpc/dcerpc_secondary.c +++ b/source4/librpc/rpc/dcerpc_secondary.c @@ -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; diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c index f7ae377e7b..530885f59c 100644 --- a/source4/librpc/rpc/dcerpc_sock.c +++ b/source4/librpc/rpc/dcerpc_sock.c @@ -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); } 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; } diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c index f4437b389d..9a9fa626ef 100644 --- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c +++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c @@ -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; diff --git a/source4/rpc_server/common/server_info.c b/source4/rpc_server/common/server_info.c index cf46954c33..0a44493df5 100644 --- a/source4/rpc_server/common/server_info.c +++ b/source4/rpc_server/common/server_info.c @@ -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! */ diff --git a/source4/rpc_server/lsa/lsa_lookup.c b/source4/rpc_server/lsa/lsa_lookup.c index cb4092355e..bcc2af97a7 100644 --- a/source4/rpc_server/lsa/lsa_lookup.c +++ b/source4/rpc_server/lsa/lsa_lookup.c @@ -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; diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index 0ddc11c8b8..15916a81fc 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -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, diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index dcb1554740..9a6ebe43b7 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -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); diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c index e5ed3bd0cf..9cce529238 100644 --- a/source4/rpc_server/service_rpc.c +++ b/source4/rpc_server/service_rpc.c @@ -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))); diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index d76e83ba17..55a647b7ef 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -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); diff --git a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c index 556272afd5..cbade288ca 100644 --- a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c +++ b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c @@ -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; diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 59d9e8f7b3..9c693b772a 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -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); } diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index 2ad2650486..8df8c474f5 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -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 */ diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c index be7b6aabdf..e68b967dfd 100644 --- a/source4/web_server/web_server.c +++ b/source4/web_server/web_server.c @@ -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; } diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c index c9c6516732..f27a3bd12d 100644 --- a/source4/winbind/wb_server.c +++ b/source4/winbind/wb_server.c @@ -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; diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c index 65c8b6118f..f5d1d82f9d 100644 --- a/source4/wrepl_server/wrepl_in_connection.c +++ b/source4/wrepl_server/wrepl_in_connection.c @@ -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))); diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c index 7700a6ded7..7455c57d75 100644 --- a/source4/wrepl_server/wrepl_server.c +++ b/source4/wrepl_server/wrepl_server.c @@ -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; } |