diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-02 21:32:08 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:47:13 +0100 |
commit | 934e932387ea5668ec000bcefe4ec86935297339 (patch) | |
tree | b101a7e8ff027df768ef9612ca9a7b84f12a7b8a | |
parent | 7e298580e06a5b9a0c1210937af47f277849080e (diff) | |
download | samba-934e932387ea5668ec000bcefe4ec86935297339.tar.gz samba-934e932387ea5668ec000bcefe4ec86935297339.tar.bz2 samba-934e932387ea5668ec000bcefe4ec86935297339.zip |
r26235: Avoid global_loadparm.
(This used to be commit e9039782204389cc827e76da319d5ccf6d33be46)
-rw-r--r-- | source4/auth/system_session.c | 8 | ||||
-rw-r--r-- | source4/cldap_server/cldap_server.c | 17 | ||||
-rw-r--r-- | source4/dsdb/samdb/samdb.c | 2 | ||||
-rw-r--r-- | source4/torture/smb2/connect.c | 8 | ||||
-rw-r--r-- | source4/web_server/http.c | 10 | ||||
-rw-r--r-- | source4/winbind/wb_cmd_getpwnam.c | 4 | ||||
-rw-r--r-- | source4/winbind/wb_name2domain.c | 3 | ||||
-rw-r--r-- | source4/winbind/wb_samba3_cmd.c | 4 | ||||
-rw-r--r-- | source4/winbind/wb_utils.c | 7 |
9 files changed, 34 insertions, 29 deletions
diff --git a/source4/auth/system_session.c b/source4/auth/system_session.c index affce26d2e..b50ce1f1bd 100644 --- a/source4/auth/system_session.c +++ b/source4/auth/system_session.c @@ -163,6 +163,7 @@ _PUBLIC_ struct auth_session_info *system_session(TALLOC_CTX *mem_ctx) } static NTSTATUS _auth_system_session_info(TALLOC_CTX *parent_ctx, + struct loadparm_context *lp_ctx, bool anonymous_credentials, struct auth_session_info **_session_info) { @@ -171,7 +172,7 @@ static NTSTATUS _auth_system_session_info(TALLOC_CTX *parent_ctx, struct auth_session_info *session_info = NULL; TALLOC_CTX *mem_ctx = talloc_new(parent_ctx); - nt_status = auth_system_server_info(mem_ctx, lp_netbios_name(global_loadparm), + nt_status = auth_system_server_info(mem_ctx, lp_netbios_name(lp_ctx), &server_info); if (!NT_STATUS_IS_OK(nt_status)) { talloc_free(mem_ctx); @@ -189,7 +190,7 @@ static NTSTATUS _auth_system_session_info(TALLOC_CTX *parent_ctx, return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(session_info->credentials, global_loadparm); + cli_credentials_set_conf(session_info->credentials, lp_ctx); if (anonymous_credentials) { cli_credentials_set_anonymous(session_info->credentials); @@ -208,7 +209,7 @@ _PUBLIC_ struct auth_session_info *system_session_anon(TALLOC_CTX *mem_ctx) { NTSTATUS nt_status; struct auth_session_info *session_info = NULL; - nt_status = _auth_system_session_info(mem_ctx, false, &session_info); + nt_status = _auth_system_session_info(mem_ctx, global_loadparm, false, &session_info); if (!NT_STATUS_IS_OK(nt_status)) { return NULL; } @@ -221,6 +222,7 @@ _PUBLIC_ NTSTATUS auth_system_session_info(TALLOC_CTX *parent_ctx, struct auth_session_info **_session_info) { return _auth_system_session_info(parent_ctx, + global_loadparm, lp_parm_bool(global_loadparm, NULL, "system", "anonymous", false), _session_info); } diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c index d43669a9e1..b43137c8df 100644 --- a/source4/cldap_server/cldap_server.c +++ b/source4/cldap_server/cldap_server.c @@ -84,7 +84,8 @@ static void cldapd_request_handler(struct cldap_socket *cldap, /* start listening on the given address */ -static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *address) +static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, struct loadparm_context *lp_ctx, + const char *address) { struct cldap_socket *cldapsock; struct socket_address *socket_address; @@ -95,7 +96,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *addr NT_STATUS_HAVE_NO_MEMORY(cldapsock); socket_address = socket_address_from_strings(cldapsock, cldapsock->sock->backend_name, - address, lp_cldap_port(global_loadparm)); + address, lp_cldap_port(lp_ctx)); if (!socket_address) { talloc_free(cldapsock); return NT_STATUS_NO_MEMORY; @@ -104,7 +105,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *addr status = socket_listen(cldapsock->sock, socket_address, 0, 0); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to bind to %s:%d - %s\n", - address, lp_cldap_port(global_loadparm), nt_errstr(status))); + address, lp_cldap_port(lp_ctx), nt_errstr(status))); talloc_free(cldapsock); return status; } @@ -120,7 +121,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *addr /* setup our listening sockets on the configured network interfaces */ -static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd) +static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct loadparm_context *lp_ctx) { int num_interfaces = iface_count(); TALLOC_CTX *tmp_ctx = talloc_new(cldapd); @@ -128,15 +129,15 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd) /* if we are allowing incoming packets from any address, then we need to bind to the wildcard address */ - if (!lp_bind_interfaces_only(global_loadparm)) { - status = cldapd_add_socket(cldapd, "0.0.0.0"); + if (!lp_bind_interfaces_only(lp_ctx)) { + status = cldapd_add_socket(cldapd, lp_ctx, "0.0.0.0"); NT_STATUS_NOT_OK_RETURN(status); } else { int i; for (i=0; i<num_interfaces; i++) { const char *address = talloc_strdup(tmp_ctx, iface_n_ip(i)); - status = cldapd_add_socket(cldapd, address); + status = cldapd_add_socket(cldapd, lp_ctx, address); NT_STATUS_NOT_OK_RETURN(status); } } @@ -187,7 +188,7 @@ static void cldapd_task_init(struct task_server *task) } /* start listening on the configured network interfaces */ - status = cldapd_startup_interfaces(cldapd); + status = cldapd_startup_interfaces(cldapd, task->lp_ctx); if (!NT_STATUS_IS_OK(status)) { task_server_terminate(task, "cldapd failed to setup interfaces"); return; diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 36f4a8816d..b3ed41a752 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -727,7 +727,7 @@ int samdb_copy_template(struct ldb_context *ldb, return LDB_ERR_OPERATIONS_ERROR; } - templates_ldb = ldb_wrap_connect(ldb, global_loadparm, + templates_ldb = ldb_wrap_connect(ldb, (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm"), templates_ldb_path, NULL, NULL, 0, NULL); talloc_free(templates_ldb_path); diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 796b180ddf..d01c138ef8 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -65,7 +65,7 @@ static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle ha /* test writing */ -static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle handle) +static NTSTATUS torture_smb2_write(struct torture_context *tctx, struct smb2_tree *tree, struct smb2_handle handle) { struct smb2_write w; struct smb2_read r; @@ -74,9 +74,9 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha DATA_BLOB data; int i; - if (lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { + if (torture_setting_bool(tctx, "dangerous", false)) { data = data_blob_talloc(tree, NULL, 160000); - } else if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { + } else if (torture_setting_bool(tctx, "samba4", false)) { data = data_blob_talloc(tree, NULL, UINT16_MAX); } else { data = data_blob_talloc(tree, NULL, 120000); @@ -202,7 +202,7 @@ bool torture_smb2_connect(struct torture_context *torture) h1 = torture_smb2_create(tree, "test9.dat"); h2 = torture_smb2_create(tree, "test9.dat"); - status = torture_smb2_write(tree, h1); + status = torture_smb2_write(torture, tree, h1); if (!NT_STATUS_IS_OK(status)) { printf("Write failed - %s\n", nt_errstr(status)); return false; diff --git a/source4/web_server/http.c b/source4/web_server/http.c index 67329fba7e..db2021a16c 100644 --- a/source4/web_server/http.c +++ b/source4/web_server/http.c @@ -388,7 +388,7 @@ static void http_simple_request(struct websrv_context *web) const char *path; struct stat st; - path = http_local_path(web, url, lp_swat_directory(global_loadparm)); + path = http_local_path(web, url, lp_swat_directory(web->task->lp_ctx)); if (path == NULL) goto invalid; /* looks ok */ @@ -470,7 +470,7 @@ static void http_setup_arrays(struct esp_state *esp) talloc_asprintf(esp, "%u", socket_address->port)); } - SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_swat_directory(global_loadparm)); + SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_swat_directory(esp->web->task->lp_ctx)); SETVAR(ESP_SERVER_OBJ, "SERVER_PROTOCOL", tls_enabled(web->conn->socket)?"https":"http"); SETVAR(ESP_SERVER_OBJ, "SERVER_SOFTWARE", "SAMBA"); SETVAR(ESP_SERVER_OBJ, "GATEWAY_INTERFACE", "CGI/1.1"); @@ -515,7 +515,7 @@ static void esp_request(struct esp_state *esp, const char *url) int res; char *emsg = NULL, *buf; - if (http_readFile(web, &buf, &size, url, lp_swat_directory(global_loadparm)) != 0) { + if (http_readFile(web, &buf, &size, url, lp_swat_directory(esp->web->task->lp_ctx)) != 0) { http_error_unix(web, url); return; } @@ -547,7 +547,7 @@ static bool http_preauth(struct esp_state *esp) { const char *path = http_local_path(esp->web, HTTP_PREAUTH_URI, - lp_swat_directory(global_loadparm)); + lp_swat_directory(esp->web->task->lp_ctx)); int i; if (path == NULL) { http_error(esp->web, 500, "Internal server error"); @@ -734,7 +734,7 @@ static void http_setup_session(struct esp_state *esp) s->data = NULL; s->te = NULL; s->edata = edata; - s->lifetime = lp_parm_int(global_loadparm, NULL, "web", "sessiontimeout", 900); + s->lifetime = lp_parm_int(esp->web->task->lp_ctx, NULL, "web", "sessiontimeout", 900); DLIST_ADD(edata->sessions, s); talloc_set_destructor(s, session_destructor); if (!generated_key) { diff --git a/source4/winbind/wb_cmd_getpwnam.c b/source4/winbind/wb_cmd_getpwnam.c index 653b598ac3..5029e168a2 100644 --- a/source4/winbind/wb_cmd_getpwnam.c +++ b/source4/winbind/wb_cmd_getpwnam.c @@ -23,10 +23,10 @@ #include "libcli/composite/composite.h" #include "winbind/wb_server.h" #include "winbind/wb_async_helpers.h" +#include "param/param.h" #include "winbind/wb_helper.h" #include "smbd/service_task.h" #include "libnet/libnet_proto.h" -#include "param/param.h" #include "libcli/security/proto.h" struct cmd_getpwnam_state { @@ -86,7 +86,7 @@ static void cmd_getpwnam_recv_domain(struct composite_context *ctx) user_info = talloc(state, struct libnet_UserInfo); if (composite_nomem(user_info, state->ctx)) return; - ok= wb_samba3_split_username(state, state->name, &user_dom, &user_name); + ok= wb_samba3_split_username(state, global_loadparm, state->name, &user_dom, &user_name); if(!ok){ composite_error(state->ctx, NT_STATUS_OBJECT_NAME_INVALID); return; diff --git a/source4/winbind/wb_name2domain.c b/source4/winbind/wb_name2domain.c index b100709223..60fe18b5b9 100644 --- a/source4/winbind/wb_name2domain.c +++ b/source4/winbind/wb_name2domain.c @@ -24,6 +24,7 @@ #include "winbind/wb_server.h" #include "smbd/service_task.h" #include "winbind/wb_helper.h" +#include "param/param.h" struct name2domain_state { struct composite_context *ctx; @@ -54,7 +55,7 @@ struct composite_context *wb_name2domain_send(TALLOC_CTX *mem_ctx, result->private_data = state; state->service = service; - ok = wb_samba3_split_username(state, name, &user_dom, &user_name); + ok = wb_samba3_split_username(state, global_loadparm, name, &user_dom, &user_name); if(!ok) { composite_error(state->ctx, NT_STATUS_OBJECT_NAME_INVALID); return result; diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c index 4c8a9f9355..041284e307 100644 --- a/source4/winbind/wb_samba3_cmd.c +++ b/source4/winbind/wb_samba3_cmd.c @@ -23,13 +23,13 @@ #include "includes.h" #include "winbind/wb_server.h" #include "winbind/wb_async_helpers.h" +#include "param/param.h" #include "winbind/wb_helper.h" #include "libcli/composite/composite.h" #include "version.h" #include "librpc/gen_ndr/netlogon.h" #include "libcli/security/security.h" #include "auth/pam_errors.h" -#include "param/param.h" /* Send off the reply to an async Samba3 query, handling filling in the PAM, NTSTATUS and string errors. @@ -545,7 +545,7 @@ NTSTATUS wbsrv_samba3_pam_auth(struct wbsrv_samba3_call *s3call) s3call->wbconn->listen_socket->service; char *user, *domain; - if (!wb_samba3_split_username(s3call, + if (!wb_samba3_split_username(s3call, global_loadparm, s3call->request.data.auth.user, &domain, &user)) { return NT_STATUS_NO_SUCH_USER; diff --git a/source4/winbind/wb_utils.c b/source4/winbind/wb_utils.c index dfd09a98fe..43effc3028 100644 --- a/source4/winbind/wb_utils.c +++ b/source4/winbind/wb_utils.c @@ -27,13 +27,14 @@ * as one string. * TODO: We probably will need to handle other formats later. */ -bool wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser, +bool wb_samba3_split_username(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, + const char *domuser, char **domain, char **user) { - char *p = strchr(domuser, *lp_winbind_separator(global_loadparm)); + char *p = strchr(domuser, *lp_winbind_separator(lp_ctx)); if (p == NULL) { - *domain = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm)); + *domain = talloc_strdup(mem_ctx, lp_workgroup(lp_ctx)); } else { *domain = talloc_strndup(mem_ctx, domuser, PTR_DIFF(p, domuser)); |