summaryrefslogtreecommitdiffstats
path: root/source/winbindd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-09-29 11:24:00 -0700
committerKarolin Seeger <kseeger@samba.org>2008-10-06 13:00:38 +0200
commit8b41be0c7080edaf9fb33e583c66f2ef50a91643 (patch)
tree3bb42c074f49f3dbd64006432420d4abb02627ee /source/winbindd
parenta48d591ef5d839159f600a8c7e2966211450c00b (diff)
downloadsamba-8b41be0c7080edaf9fb33e583c66f2ef50a91643.tar.gz
samba-8b41be0c7080edaf9fb33e583c66f2ef50a91643.tar.xz
samba-8b41be0c7080edaf9fb33e583c66f2ef50a91643.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 (cherry picked from commit 3a2a70996919a7ee08fea40b8e5f1cf2e3bd7caf)
Diffstat (limited to 'source/winbindd')
-rw-r--r--source/winbindd/idmap_tdb2.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/source/winbindd/idmap_tdb2.c b/source/winbindd/idmap_tdb2.c
index ab89e615f78..ffb10b4d346 100644
--- a/source/winbindd/idmap_tdb2.c
+++ b/source/winbindd/idmap_tdb2.c
@@ -235,7 +235,9 @@ static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid)
NTSTATUS status;
status = idmap_tdb2_open_perm_db();
- NT_STATUS_NOT_OK_RETURN(status);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
/* Get current high water mark */
switch (xid->type) {
@@ -297,6 +299,12 @@ 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_perm_db();
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
/* Get current high water mark */
switch (xid->type) {
@@ -552,6 +560,12 @@ 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_perm_db();
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
if (!ctx || !map) {
return NT_STATUS_INVALID_PARAMETER;
@@ -647,6 +661,12 @@ 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_perm_db();
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
if ((keystr = sid_string_talloc(ctx, map->sid)) == NULL) {
DEBUG(0, ("Out of memory!\n"));