summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-10-25 17:19:03 +1100
committerAndrew Tridgell <tridge@samba.org>2009-10-25 17:19:03 +1100
commit54bd30f70632b8fcbe164133d2479092b7262a29 (patch)
tree588c4019f409b8234a15a53959d908cc9695e606 /source4
parentb55a5adab99f535bb392662d54afbabed116a3b6 (diff)
downloadsamba-54bd30f70632b8fcbe164133d2479092b7262a29.tar.gz
samba-54bd30f70632b8fcbe164133d2479092b7262a29.tar.bz2
samba-54bd30f70632b8fcbe164133d2479092b7262a29.zip
s4-samdb: reduce the number of samdb opens at startup
Using common parameters means that the ldb_wrap code can return a reference rather than a new database
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/kcc/kcc_service.c9
-rw-r--r--source4/dsdb/repl/drepl_service.c9
-rw-r--r--source4/dsdb/samdb/samdb_privilege.c13
-rw-r--r--source4/kdc/hdb-samba4.c6
-rw-r--r--source4/ldap_server/ldap_server.c6
-rw-r--r--source4/smb_server/smb_server.c14
6 files changed, 13 insertions, 44 deletions
diff --git a/source4/dsdb/kcc/kcc_service.c b/source4/dsdb/kcc/kcc_service.c
index 32e09ac989..b088d2ed89 100644
--- a/source4/dsdb/kcc/kcc_service.c
+++ b/source4/dsdb/kcc/kcc_service.c
@@ -40,12 +40,9 @@
*/
static WERROR kccsrv_init_creds(struct kccsrv_service *service)
{
- NTSTATUS status;
-
- status = auth_system_session_info(service, service->task->lp_ctx,
- &service->system_session_info);
- if (!NT_STATUS_IS_OK(status)) {
- return ntstatus_to_werror(status);
+ service->system_session_info = system_session(service->task->lp_ctx);
+ if (!service->system_session_info) {
+ return WERR_NOMEM;
}
return WERR_OK;
diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c
index 34853c85f9..a05ccc8d70 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -35,12 +35,9 @@
static WERROR dreplsrv_init_creds(struct dreplsrv_service *service)
{
- NTSTATUS status;
-
- status = auth_system_session_info(service, service->task->lp_ctx,
- &service->system_session_info);
- if (!NT_STATUS_IS_OK(status)) {
- return ntstatus_to_werror(status);
+ service->system_session_info = system_session(service->task->lp_ctx);
+ if (service->system_session_info == NULL) {
+ return WERR_NOMEM;
}
return WERR_OK;
diff --git a/source4/dsdb/samdb/samdb_privilege.c b/source4/dsdb/samdb/samdb_privilege.c
index dcb96d8c0e..81b9381b22 100644
--- a/source4/dsdb/samdb/samdb_privilege.c
+++ b/source4/dsdb/samdb/samdb_privilege.c
@@ -33,17 +33,8 @@ struct ldb_context *privilege_connect(TALLOC_CTX *mem_ctx,
struct tevent_context *ev_ctx,
struct loadparm_context *lp_ctx)
{
- char *path;
- struct ldb_context *pdb;
-
- path = private_path(mem_ctx, lp_ctx, "privilege.ldb");
- if (!path) return NULL;
-
- pdb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, path,
- NULL, NULL, 0);
- talloc_free(path);
-
- return pdb;
+ return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, "privilege.ldb",
+ NULL, NULL, 0);
}
/*
diff --git a/source4/kdc/hdb-samba4.c b/source4/kdc/hdb-samba4.c
index 4062e13f6c..5fef5908b8 100644
--- a/source4/kdc/hdb-samba4.c
+++ b/source4/kdc/hdb-samba4.c
@@ -1596,9 +1596,9 @@ NTSTATUS hdb_samba4_create_kdc(TALLOC_CTX *mem_ctx,
(*db)->hdb_db = NULL;
(*db)->hdb_capability_flags = 0;
- nt_status = auth_system_session_info(*db, lp_ctx, &session_info);
- if (!NT_STATUS_IS_OK(nt_status)) {
- return nt_status;
+ session_info = system_session(lp_ctx);
+ if (session_info == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
}
/* The idea here is very simple. Using Kerberos to
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index c45a4168f9..63bfc70b2a 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -468,11 +468,9 @@ static void ldapsrv_accept_priv(struct stream_connection *c)
struct ldapsrv_service *ldapsrv_service = talloc_get_type_abort(
c->private_data, struct ldapsrv_service);
struct auth_session_info *session_info;
- NTSTATUS status;
- status = auth_system_session_info(
- c, ldapsrv_service->task->lp_ctx, &session_info);
- if (!NT_STATUS_IS_OK(status)) {
+ session_info = system_session(ldapsrv_service->task->lp_ctx);
+ if (!session_info) {
stream_terminate_connection(c, "failed to setup system "
"session info");
return;
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 9b10f66b2c..b0a37adba0 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -200,18 +200,6 @@ _PUBLIC_ NTSTATUS smbsrv_add_socket(struct tevent_context *event_context,
/*
- pre-open some of our ldb databases, to prevent an explosion of memory usage
- when we fork
- */
-static void smbsrv_preopen_ldb(struct task_server *task)
-{
- /* yes, this looks strange. It is a hack to preload the
- schema. I'd like to share most of the ldb context with the
- child too. That will come later */
- talloc_free(samdb_connect(task, task->event_ctx, task->lp_ctx, NULL));
-}
-
-/*
open the smb server sockets
*/
static void smbsrv_task_init(struct task_server *task)
@@ -245,8 +233,6 @@ static void smbsrv_task_init(struct task_server *task)
if (!NT_STATUS_IS_OK(status)) goto failed;
}
- smbsrv_preopen_ldb(task);
-
return;
failed:
task_server_terminate(task, "Failed to startup smb server task", true);