summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-09-10 18:27:46 +0200
committerMichael Adam <obnox@samba.org>2013-10-02 00:06:18 +0200
commit65d7df105587fe14d057c3fa84c889f2c8c4500e (patch)
treec182d134bd962f13425d15143d85828a259f7b3d /source3/winbindd
parent65881c3118044e101d4b04737c471725802a4e09 (diff)
downloadsamba-65d7df105587fe14d057c3fa84c889f2c8c4500e.tar.gz
samba-65d7df105587fe14d057c3fa84c889f2c8c4500e.tar.bz2
samba-65d7df105587fe14d057c3fa84c889f2c8c4500e.zip
idmap_autorid: improve idmap_autorid_saveconfig() by adding a talloc stackframe
Pair-Programmed-With: Atul Kulkarni <atul.kulkarni@in.ibm.com> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Atul Kulkarni <atul.kulkarni@in.ibm.com> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/idmap_autorid_tdb.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/source3/winbindd/idmap_autorid_tdb.c b/source3/winbindd/idmap_autorid_tdb.c
index 048c1761a8..95fb048095 100644
--- a/source3/winbindd/idmap_autorid_tdb.c
+++ b/source3/winbindd/idmap_autorid_tdb.c
@@ -329,6 +329,7 @@ NTSTATUS idmap_autorid_saveconfig(struct db_context *db,
TDB_DATA data;
char *cfgstr;
uint32_t hwm;
+ TALLOC_CTX *frame = talloc_stackframe();
DEBUG(10, ("New configuration provided for storing is "
"minvalue:%d rangesize:%d maxranges:%d\n",
@@ -345,7 +346,7 @@ NTSTATUS idmap_autorid_saveconfig(struct db_context *db,
goto done;
}
- status = idmap_autorid_loadconfig(db, talloc_tos(), &storedconfig);
+ status = idmap_autorid_loadconfig(db, frame, &storedconfig);
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
DEBUG(5, ("No configuration found. Storing initial "
"configuration.\n"));
@@ -361,13 +362,10 @@ NTSTATUS idmap_autorid_saveconfig(struct db_context *db,
DEBUG(1, ("New configuration values for rangesize or "
"minimum uid value conflict with previously "
"used values! Not storing new config.\n"));
- TALLOC_FREE(storedconfig);
status = NT_STATUS_INVALID_PARAMETER;
goto done;
}
- TALLOC_FREE(storedconfig);
-
status = dbwrap_fetch_uint32_bystring(db, HWM, &hwm);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Fatal error while fetching current "
@@ -388,19 +386,20 @@ NTSTATUS idmap_autorid_saveconfig(struct db_context *db,
}
cfgstr =
- talloc_asprintf(talloc_tos(),
+ talloc_asprintf(frame,
"minvalue:%u rangesize:%u maxranges:%u",
cfg->minvalue, cfg->rangesize, cfg->maxranges);
- if (!cfgstr) {
- return NT_STATUS_NO_MEMORY;
+ if (cfgstr == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
}
data = string_tdb_data(cfgstr);
status = dbwrap_trans_store_bystring(db, CONFIGKEY, data, TDB_REPLACE);
- TALLOC_FREE(cfgstr);
-
+done:
+ TALLOC_FREE(frame);
return status;
}