1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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.
This commit is contained in:
Jeremy Allison 2010-11-13 20:28:41 -08:00
parent 7cb0f95bf2
commit 781c4aabb8
7 changed files with 24 additions and 23 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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());
struct messaging_context *msg_ctx = server_messaging_context();
if (likely(msg_ctx != NULL)) {
return msg_ctx;
}
if (ctx == NULL) {
DEBUG(0, ("Could not init nmbd messaging context.\n"));
}
return ctx;
smb_panic("Could not init nmbd's messaging context.\n");
return NULL;
}
/**************************************************************************** **

View File

@ -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)

View File

@ -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)

View File

@ -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 */