diff options
author | Andrew Bartlett <abartlet@samba.org> | 2017-09-14 15:02:36 +1200 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2017-09-20 02:25:30 +0200 |
commit | c1e41d489d8b199ad1f7f1546ae50461cda0fbce (patch) | |
tree | ec7631263ad46fff0d7ba2bcf24882f862b49d81 /source3 | |
parent | 6c28abc249f83a1083a71b2d526098d42c4f5c14 (diff) | |
download | samba-c1e41d489d8b199ad1f7f1546ae50461cda0fbce.tar.gz |
samdb: Rework samdb_connect_url() to return LDB error code and an error string
This allows debugging of why the LDB failed to start up.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/passdb/pdb_samba_dsdb.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/source3/passdb/pdb_samba_dsdb.c b/source3/passdb/pdb_samba_dsdb.c index cfa492b442a..58168d843aa 100644 --- a/source3/passdb/pdb_samba_dsdb.c +++ b/source3/passdb/pdb_samba_dsdb.c @@ -3023,6 +3023,8 @@ static NTSTATUS pdb_init_samba_dsdb(struct pdb_methods **pdb_method, struct pdb_methods *m; struct pdb_samba_dsdb_state *state; NTSTATUS status; + char *errstring = NULL; + int ret; if ( !NT_STATUS_IS_OK(status = make_pdb_method( &m )) ) { return status; @@ -3048,21 +3050,20 @@ static NTSTATUS pdb_init_samba_dsdb(struct pdb_methods **pdb_method, goto nomem; } - if (location) { - state->ldb = samdb_connect_url(state, - state->ev, - state->lp_ctx, - system_session(state->lp_ctx), - 0, location); - } else { - state->ldb = samdb_connect(state, - state->ev, - state->lp_ctx, - system_session(state->lp_ctx), 0); + if (location == NULL) { + location = "sam.ldb"; } + ret = samdb_connect_url(state, + state->ev, + state->lp_ctx, + system_session(state->lp_ctx), + 0, location, + &state->ldb, &errstring); + if (!state->ldb) { - DEBUG(0, ("samdb_connect failed\n")); + DEBUG(0, ("samdb_connect failed: %s: %s\n", + errstring, ldb_strerror(ret))); status = NT_STATUS_INTERNAL_ERROR; goto fail; } |