summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-11-13 20:28:41 -0800
committerJeremy Allison <jra@samba.org>2010-11-14 04:39:05 +0000
commit781c4aabb87e63df77c76a360b6ed5f6a20e6d58 (patch)
treee53eb195b8116ab29b73c34c3f00474b9c137d0c /source3
parent7cb0f95bf28c24c45955d6df52f505019341ef31 (diff)
downloadsamba-781c4aabb87e63df77c76a360b6ed5f6a20e6d58.tar.gz
samba-781c4aabb87e63df77c76a360b6ed5f6a20e6d58.tar.bz2
samba-781c4aabb87e63df77c76a360b6ed5f6a20e6d58.zip
Move error reporting of messaging context creation fail into
the daemons themselves. Allows client utilities to silently fail to create a messaging context due to access denied on the messaging tdb (which I need for the following patch). Jeremy.
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/messages.c4
-rw-r--r--source3/lib/messages_local.c2
-rw-r--r--source3/lib/server_contexts.c3
-rw-r--r--source3/nmbd/nmbd.c21
-rw-r--r--source3/smbd/globals.c6
-rw-r--r--source3/winbindd/winbindd.c10
-rw-r--r--source3/winbindd/winbindd.h1
7 files changed, 24 insertions, 23 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 11dc931f0f..41f67d07db 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -194,7 +194,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
status = messaging_tdb_init(ctx, ctx, &ctx->local);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("messaging_tdb_init failed: %s\n",
+ DEBUG(2, ("messaging_tdb_init failed: %s\n",
nt_errstr(status)));
TALLOC_FREE(ctx);
return NULL;
@@ -205,7 +205,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
status = messaging_ctdbd_init(ctx, ctx, &ctx->remote);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("messaging_ctdb_init failed: %s\n",
+ DEBUG(2, ("messaging_ctdb_init failed: %s\n",
nt_errstr(status)));
TALLOC_FREE(ctx);
return NULL;
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c
index bad577cc35..8cc060b9e2 100644
--- a/source3/lib/messages_local.c
+++ b/source3/lib/messages_local.c
@@ -108,7 +108,7 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
if (!ctx->tdb) {
NTSTATUS status = map_nt_error_from_unix(errno);
- DEBUG(0, ("ERROR: Failed to initialise messages database: "
+ DEBUG(2, ("ERROR: Failed to initialise messages database: "
"%s\n", strerror(errno)));
TALLOC_FREE(result);
return status;
diff --git a/source3/lib/server_contexts.c b/source3/lib/server_contexts.c
index 5e48b7986d..f8fe9dceac 100644
--- a/source3/lib/server_contexts.c
+++ b/source3/lib/server_contexts.c
@@ -57,9 +57,6 @@ struct messaging_context *server_messaging_context(void)
procid_self(),
server_event_context());
}
- if (server_msg_ctx == NULL) {
- DEBUG(0, ("Could not init server's messaging context.\n"));
- }
return server_msg_ctx;
}
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 2bae5f7b27..d6943b19e6 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -43,26 +43,17 @@ time_t StartupTime = 0;
struct event_context *nmbd_event_context(void)
{
- static struct event_context *ctx;
-
- if (!ctx && !(ctx = event_context_init(NULL))) {
- smb_panic("Could not init nmbd event context");
- }
- return ctx;
+ return server_event_context();
}
struct messaging_context *nmbd_messaging_context(void)
{
- static struct messaging_context *ctx;
-
- if (ctx == NULL) {
- ctx = messaging_init(NULL, procid_self(),
- nmbd_event_context());
- }
- if (ctx == NULL) {
- DEBUG(0, ("Could not init nmbd messaging context.\n"));
+ struct messaging_context *msg_ctx = server_messaging_context();
+ if (likely(msg_ctx != NULL)) {
+ return msg_ctx;
}
- return ctx;
+ smb_panic("Could not init nmbd's messaging context.\n");
+ return NULL;
}
/**************************************************************************** **
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 4642328b46..aac30ea9c1 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -117,7 +117,11 @@ struct smbd_server_connection *msg_ctx_to_sconn(struct messaging_context *msg_ct
struct messaging_context *smbd_messaging_context(void)
{
- return server_messaging_context();
+ struct messaging_context *msg_ctx = server_messaging_context();
+ if (likely(msg_ctx != NULL)) {
+ return msg_ctx;
+ }
+ smb_panic("Could not init smbd's messaging context.\n");
}
struct memcache *smbd_memcache(void)
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index c831c94221..43cbd50d15 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -44,6 +44,16 @@ static bool interactive = False;
extern bool override_logfile;
+struct messaging_context *winbind_messaging_context(void)
+{
+ struct messaging_context *msg_ctx = server_messaging_context();
+ if (likely(msg_ctx != NULL)) {
+ return msg_ctx;
+ }
+ smb_panic("Could not init winbindd's messaging context.\n");
+ return NULL;
+}
+
/* Reload configuration */
static bool reload_services_file(const char *lfile)
diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h
index 1ba24b5d0a..d276b86947 100644
--- a/source3/winbindd/winbindd.h
+++ b/source3/winbindd/winbindd.h
@@ -388,6 +388,5 @@ struct WINBINDD_CCACHE_ENTRY {
#define DOM_SEQUENCE_NONE ((uint32)-1)
#define winbind_event_context server_event_context
-#define winbind_messaging_context server_messaging_context
#endif /* _WINBINDD_H */