summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-09-17 16:15:40 +1000
committerMichael Adam <obnox@samba.org>2008-09-29 14:01:00 +0200
commitb8c9daac6eb8a2bcdb14c71c1ddfbfeba4b9b54d (patch)
treeceda91811211dbe6b874d3b601e5aa8fd6695279
parent4fa4a524de0647644abc842f34a926b458388b09 (diff)
downloadsamba-b8c9daac6eb8a2bcdb14c71c1ddfbfeba4b9b54d.tar.gz
samba-b8c9daac6eb8a2bcdb14c71c1ddfbfeba4b9b54d.tar.bz2
samba-b8c9daac6eb8a2bcdb14c71c1ddfbfeba4b9b54d.zip
fixed segv on startup with trusted domains
With some setups, idmap_tdb2_allocate_id can be called before the allocate backend is initialised, leading to a segv. This change ensures that the db is opened in all paths that use it
-rw-r--r--source3/winbindd/idmap_tdb2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 3066db6f3b..911f80c6a3 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -187,6 +187,10 @@ static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid)
uint32_t high_hwm;
uint32_t hwm;
int res;
+ NTSTATUS status;
+
+ status = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(status);
/* Get current high water mark */
switch (xid->type) {
@@ -264,6 +268,10 @@ static NTSTATUS idmap_tdb2_get_hwm(struct unixid *xid)
const char *hwmtype;
uint32_t hwm;
uint32_t high_hwm;
+ NTSTATUS status;
+
+ status = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(status);
/* Get current high water mark */
switch (xid->type) {
@@ -451,6 +459,10 @@ static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_tdb2_context *ctx, struct id_m
NTSTATUS ret;
TDB_DATA data;
char *keystr;
+ NTSTATUS status;
+
+ status = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(status);
if (!ctx || !map) {
return NT_STATUS_INVALID_PARAMETER;
@@ -546,6 +558,10 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m
TDB_DATA data;
char *keystr;
unsigned long rec_id = 0;
+ NTSTATUS status;
+
+ status = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(status);
if ((keystr = sid_string_talloc(ctx, map->sid)) == NULL) {
DEBUG(0, ("Out of memory!\n"));