diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-09-17 16:15:40 +1000 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-09-29 14:01:00 +0200 |
commit | b8c9daac6eb8a2bcdb14c71c1ddfbfeba4b9b54d (patch) | |
tree | ceda91811211dbe6b874d3b601e5aa8fd6695279 | |
parent | 4fa4a524de0647644abc842f34a926b458388b09 (diff) | |
download | samba-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.c | 16 |
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")); |