summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtul Kulkarni <atul.kulkarni@in.ibm.com>2013-08-30 13:49:10 +0530
committerMichael Adam <obnox@samba.org>2013-10-02 00:06:19 +0200
commitf8767cd9d838b726b40271668f18199ee11a3791 (patch)
treee53f053897f916ea8f9a5909f10eb4d5251724ca
parent7cacc48563f6d16a74669bf572437b13f6f54250 (diff)
downloadsamba-f8767cd9d838b726b40271668f18199ee11a3791.tar.gz
samba-f8767cd9d838b726b40271668f18199ee11a3791.tar.bz2
samba-f8767cd9d838b726b40271668f18199ee11a3791.zip
idmap_autorid: remove fstring keystr from autorid_range_config
This is just used to change the behaviour of the function. Making it more suitable to be used at other places. Signed-off-by: Atul Kulkarni <atul.kulkarni@in.ibm.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
-rw-r--r--source3/include/idmap_autorid_tdb.h1
-rw-r--r--source3/winbindd/idmap_autorid_tdb.c23
2 files changed, 16 insertions, 8 deletions
diff --git a/source3/include/idmap_autorid_tdb.h b/source3/include/idmap_autorid_tdb.h
index f4286f0315..f39062f0e4 100644
--- a/source3/include/idmap_autorid_tdb.h
+++ b/source3/include/idmap_autorid_tdb.h
@@ -46,7 +46,6 @@ struct autorid_global_config {
struct autorid_range_config {
fstring domsid;
- fstring keystr;
uint32_t rangenum;
uint32_t domain_range_index;
uint32_t low_id;
diff --git a/source3/winbindd/idmap_autorid_tdb.c b/source3/winbindd/idmap_autorid_tdb.c
index daeb1c3758..bb5f497842 100644
--- a/source3/winbindd/idmap_autorid_tdb.c
+++ b/source3/winbindd/idmap_autorid_tdb.c
@@ -33,10 +33,18 @@ static NTSTATUS idmap_autorid_get_domainrange_action(struct db_context *db,
char *numstr;
struct autorid_range_config *range;
struct autorid_global_config *globalcfg;
+ fstring keystr;
range = (struct autorid_range_config *)private_data;
- ret = dbwrap_fetch_uint32_bystring(db, range->keystr,
+ if (range->domain_range_index > 0) {
+ snprintf(keystr, FSTRING_LEN, "%s#%"PRIu32,
+ range->domsid, range->domain_range_index);
+ } else {
+ fstrcpy(keystr, range->domsid);
+ }
+
+ ret = dbwrap_fetch_uint32_bystring(db, keystr,
&(range->rangenum));
if (NT_STATUS_IS_OK(ret)) {
@@ -80,7 +88,7 @@ static NTSTATUS idmap_autorid_get_domainrange_action(struct db_context *db,
}
/* store away the new mapping in both directions */
- ret = dbwrap_store_uint32_bystring(db, range->keystr, rangenum);
+ ret = dbwrap_store_uint32_bystring(db, keystr, rangenum);
if (!NT_STATUS_IS_OK(ret)) {
DEBUG(1, ("Fatal error while storing new "
"domain->range assignment!\n"));
@@ -94,7 +102,7 @@ static NTSTATUS idmap_autorid_get_domainrange_action(struct db_context *db,
}
ret = dbwrap_store_bystring(db, numstr,
- string_term_tdb_data(range->keystr), TDB_INSERT);
+ string_term_tdb_data(keystr), TDB_INSERT);
talloc_free(numstr);
if (!NT_STATUS_IS_OK(ret)) {
@@ -103,7 +111,7 @@ static NTSTATUS idmap_autorid_get_domainrange_action(struct db_context *db,
goto error;
}
DEBUG(5, ("Acquired new range #%d for domain %s "
- "(domain_range_index=%"PRIu32")\n", rangenum, range->keystr,
+ "(domain_range_index=%"PRIu32")\n", rangenum, keystr,
range->domain_range_index));
range->rangenum = rangenum;
@@ -121,6 +129,7 @@ NTSTATUS idmap_autorid_get_domainrange(struct db_context *db,
{
NTSTATUS ret;
struct autorid_global_config *globalcfg;
+ fstring keystr;
/*
* try to find mapping without locking the database,
@@ -128,13 +137,13 @@ NTSTATUS idmap_autorid_get_domainrange(struct db_context *db,
* read-only mode has been set
*/
if (range->domain_range_index > 0) {
- snprintf(range->keystr, FSTRING_LEN, "%s#%"PRIu32,
+ snprintf(keystr, FSTRING_LEN, "%s#%"PRIu32,
range->domsid, range->domain_range_index);
} else {
- fstrcpy(range->keystr, range->domsid);
+ fstrcpy(keystr, range->domsid);
}
- ret = dbwrap_fetch_uint32_bystring(db, range->keystr,
+ ret = dbwrap_fetch_uint32_bystring(db, keystr,
&(range->rangenum));
if (!NT_STATUS_IS_OK(ret)) {