[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Fri Mar 18 09:31:01 MDT 2011
The branch, master has been updated
via 8ae1f32 s3:autorid make sure we set the mapping status correct on early exit
via 5006dcf idmap-autorid: Slightly simplify idmap_autorid_get_domainrange
via 3947845 idmap-autorid: Slightly simplify idmap_autorid_get_domainrange
via 6e9fb07 idmap-autorid: Remove an unused variable
via 10953c6 idmap-autorid: Use talloc_tos() in idmap_autorid_id_to_sid
via 6ba85be idmap-autorid: Remove an else branch
via 6ab0d8b idmap-autorid: Remove an unused variable
via d1970a8 idmap-autorid: Remove an unused parameter
via f0abb3f idmap-autorid: Use talloc_tos() in idmap_autorid_sids_to_unixids
via db3f8ae idmap-autorid: Not necessary to talloc domaincfg
via a94cc22 idmap-autorid: Not necessary to talloc domainsid
from 3e4879f s3: Cope with 192.168.1.1/24 in smbcontrol ip-dropped
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8ae1f32229cf960f212235e7d792513a395643cb
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date: Fri Mar 18 14:46:47 2011 +0100
s3:autorid make sure we set the mapping status correct on early exit
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
Autobuild-User: Volker Lendecke <vlendec at samba.org>
Autobuild-Date: Fri Mar 18 16:30:36 CET 2011 on sn-devel-104
commit 5006dcff4e15b7f840093e0c6c4e6f46a4088120
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:55:58 2011 +0100
idmap-autorid: Slightly simplify idmap_autorid_get_domainrange
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit 39478450418cc65f6c4f753ffa08dca7f7f7ebeb
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:53:22 2011 +0100
idmap-autorid: Slightly simplify idmap_autorid_get_domainrange
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit 6e9fb079583fb2781987ee40eda47a956a5c4e82
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:48:44 2011 +0100
idmap-autorid: Remove an unused variable
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit 10953c60bdf247d030b088c155346a5af470567a
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:47:41 2011 +0100
idmap-autorid: Use talloc_tos() in idmap_autorid_id_to_sid
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit 6ba85beeec7ab11baba548c7443e904d9ea31944
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:45:02 2011 +0100
idmap-autorid: Remove an else branch
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit 6ab0d8b9981e9e2ab07993069139ec8f9fca9696
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:38:21 2011 +0100
idmap-autorid: Remove an unused variable
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit d1970a8da9aef3e379bba38bf7d8820cce0d1e6a
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:36:54 2011 +0100
idmap-autorid: Remove an unused parameter
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit f0abb3f3f81f213c543b857a74451d84434cdd21
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:33:58 2011 +0100
idmap-autorid: Use talloc_tos() in idmap_autorid_sids_to_unixids
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit db3f8ae2bfe03dc67a76398f54845f0ef348971c
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:25:40 2011 +0100
idmap-autorid: Not necessary to talloc domaincfg
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
commit a94cc222bd8e38d05d162a7884692d45ba2d5092
Author: Volker Lendecke <vl at samba.org>
Date: Tue Mar 8 21:17:37 2011 +0100
idmap-autorid: Not necessary to talloc domainsid
Signed-off-by: Christian Ambach <christian.ambach at de.ibm.com>
-----------------------------------------------------------------------
Summary of changes:
source3/winbindd/idmap_autorid.c | 115 ++++++++++++++------------------------
1 files changed, 43 insertions(+), 72 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index f720a46..ff33a5d 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -54,15 +54,12 @@ static NTSTATUS idmap_autorid_get_domainrange(struct db_context *db,
{
NTSTATUS ret;
uint32_t domainnum, hwm;
- char *sidstr, *numstr;
+ fstring sidstr;
+ char *numstr;
struct autorid_domain_config *cfg;
cfg = (struct autorid_domain_config *)private_data;
- sidstr = dom_sid_string(talloc_tos(), &(cfg->sid));
-
- if (!sidstr) {
- return NT_STATUS_NO_MEMORY;
- }
+ dom_sid_string_buf(&(cfg->sid), sidstr, sizeof(sidstr));
if (!dbwrap_fetch_uint32(db, sidstr, &domainnum)) {
DEBUG(10, ("Acquiring new range for domain %s\n", sidstr));
@@ -107,13 +104,12 @@ static NTSTATUS idmap_autorid_get_domainrange(struct db_context *db,
ret = dbwrap_trans_store_bystring(db, numstr,
string_term_tdb_data(sidstr),
TDB_INSERT);
+ talloc_free(numstr);
if (!NT_STATUS_IS_OK(ret)) {
- talloc_free(numstr);
DEBUG(1, ("Fatal error while storing "
"new domain->range assignment!\n"));
goto error;
}
- talloc_free(numstr);
DEBUG(5, ("Acquired new range #%d for domain %s\n",
domainnum, sidstr));
}
@@ -121,17 +117,14 @@ static NTSTATUS idmap_autorid_get_domainrange(struct db_context *db,
DEBUG(10, ("Using range #%d for domain %s\n", domainnum, sidstr));
cfg->domainnum = domainnum;
- talloc_free(sidstr);
return NT_STATUS_OK;
error:
- talloc_free(sidstr);
return ret;
}
-static NTSTATUS idmap_autorid_id_to_sid(TALLOC_CTX * memctx,
- struct autorid_global_config *cfg,
+static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg,
struct id_map *map)
{
uint32_t range;
@@ -157,30 +150,34 @@ static NTSTATUS idmap_autorid_id_to_sid(TALLOC_CTX * memctx,
/* determine the range of this uid */
range = ((map->xid.id - cfg->minvalue) / cfg->rangesize);
- keystr = talloc_asprintf(memctx, "%u", range);
+ keystr = talloc_asprintf(talloc_tos(), "%u", range);
if (!keystr) {
return NT_STATUS_NO_MEMORY;
}
- data = dbwrap_fetch_bystring(autorid_db, memctx, keystr);
+ data = dbwrap_fetch_bystring(autorid_db, talloc_tos(), keystr);
+ TALLOC_FREE(keystr);
if (!data.dptr) {
DEBUG(4, ("id %d belongs to range %d which does not have "
"domain mapping, ignoring mapping request\n",
map->xid.id, range));
- } else {
- string_to_sid(&sid, (const char *)data.dptr);
+ map->status = ID_UNKNOWN;
+ return NT_STATUS_OK;
+ }
- sid_compose(map->sid, &sid,
- (map->xid.id - cfg->minvalue -
- range * cfg->rangesize));
+ string_to_sid(&sid, (const char *)data.dptr);
+ TALLOC_FREE(data.dptr);
- /* We **really** should have some way of validating
- the SID exists and is the correct type here. But
- that is a deficiency in the idmap_rid design. */
+ sid_compose(map->sid, &sid,
+ (map->xid.id - cfg->minvalue -
+ range * cfg->rangesize));
- map->status = ID_MAPPED;
- }
+ /* We **really** should have some way of validating
+ the SID exists and is the correct type here. But
+ that is a deficiency in the idmap_rid design. */
+
+ map->status = ID_MAPPED;
return NT_STATUS_OK;
}
@@ -188,8 +185,7 @@ static NTSTATUS idmap_autorid_id_to_sid(TALLOC_CTX * memctx,
Single sid to id lookup function.
**********************************/
-static NTSTATUS idmap_autorid_sid_to_id(TALLOC_CTX * memctx,
- struct autorid_global_config *global,
+static NTSTATUS idmap_autorid_sid_to_id(struct autorid_global_config *global,
struct autorid_domain_config *domain,
struct id_map *map)
{
@@ -224,7 +220,6 @@ static NTSTATUS idmap_autorid_unixids_to_sids(struct idmap_domain *dom,
struct id_map **ids)
{
struct autorid_global_config *globalcfg;
- TALLOC_CTX *ctx;
NTSTATUS ret;
int i;
@@ -236,15 +231,9 @@ static NTSTATUS idmap_autorid_unixids_to_sids(struct idmap_domain *dom,
globalcfg = talloc_get_type(dom->private_data,
struct autorid_global_config);
- ctx = talloc_new(dom);
- if (!ctx) {
- DEBUG(0, ("Out of memory!\n"));
- return NT_STATUS_NO_MEMORY;
- }
-
for (i = 0; ids[i]; i++) {
- ret = idmap_autorid_id_to_sid(ctx, globalcfg, ids[i]);
+ ret = idmap_autorid_id_to_sid(globalcfg, ids[i]);
if ((!NT_STATUS_IS_OK(ret)) &&
(!NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED))) {
@@ -254,14 +243,10 @@ static NTSTATUS idmap_autorid_unixids_to_sids(struct idmap_domain *dom,
goto failure;
}
}
-
- talloc_free(ctx);
return NT_STATUS_OK;
failure:
- talloc_free(ctx);
return ret;
-
}
/**********************************
@@ -272,29 +257,9 @@ static NTSTATUS idmap_autorid_sids_to_unixids(struct idmap_domain *dom,
struct id_map **ids)
{
struct autorid_global_config *global;
- struct autorid_domain_config *domaincfg;
- struct dom_sid *domainsid;
- struct winbindd_tdc_domain *domain;
- uint32_t rid;
- TALLOC_CTX *ctx;
NTSTATUS ret;
int i;
- ctx = talloc_new(dom);
- domainsid = talloc(ctx, struct dom_sid);
- if (!ctx || !domainsid) {
- DEBUG(0, ("Out of memory!\n"));
- ret = NT_STATUS_NO_MEMORY;
- goto failure;
- }
-
- if ((domaincfg = TALLOC_ZERO_P(ctx,
- struct autorid_domain_config)) == NULL) {
- DEBUG(0, ("Out of memory!\n"));
- ret = NT_STATUS_NO_MEMORY;
- goto failure;
- }
-
/* initialize the status to avoid surprise */
for (i = 0; ids[i]; i++) {
ids[i]->status = ID_UNKNOWN;
@@ -304,28 +269,37 @@ static NTSTATUS idmap_autorid_sids_to_unixids(struct idmap_domain *dom,
struct autorid_global_config);
for (i = 0; ids[i]; i++) {
- ZERO_STRUCTP(domainsid);
- sid_copy(domainsid, ids[i]->sid);
- if (!sid_split_rid(domainsid, &rid)) {
+ struct winbindd_tdc_domain *domain;
+ struct autorid_domain_config domaincfg;
+ uint32_t rid;
+
+ ZERO_STRUCT(domaincfg);
+
+ sid_copy(&domaincfg.sid, ids[i]->sid);
+ if (!sid_split_rid(&domaincfg.sid, &rid)) {
DEBUG(4, ("Could not determine domain SID from %s, "
"ignoring mapping request\n",
sid_string_dbg(ids[i]->sid)));
continue;
}
- domain = wcache_tdc_fetch_domainbysid(ctx, domainsid);
+ /*
+ * Check if the domain is around
+ */
+ domain = wcache_tdc_fetch_domainbysid(talloc_tos(),
+ &domaincfg.sid);
if (domain == NULL) {
DEBUG(10, ("Ignoring unknown domain sid %s\n",
- sid_string_dbg(domainsid)));
+ sid_string_dbg(&domaincfg.sid)));
continue;
}
+ TALLOC_FREE(domain);
- ZERO_STRUCTP(domaincfg);
- domaincfg->sid = domain->sid;
- domaincfg->globalcfg = global;
+ domaincfg.globalcfg = global;
- ret = dbwrap_trans_do(autorid_db, idmap_autorid_get_domainrange,
- domaincfg);
+ ret = dbwrap_trans_do(autorid_db,
+ idmap_autorid_get_domainrange,
+ &domaincfg);
if (!NT_STATUS_IS_OK(ret)) {
DEBUG(3, ("Could not determine range for domain, "
@@ -333,7 +307,7 @@ static NTSTATUS idmap_autorid_sids_to_unixids(struct idmap_domain *dom,
goto failure;
}
- ret = idmap_autorid_sid_to_id(ctx, global, domaincfg, ids[i]);
+ ret = idmap_autorid_sid_to_id(global, &domaincfg, ids[i]);
if ((!NT_STATUS_IS_OK(ret)) &&
(!NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED))) {
@@ -343,12 +317,9 @@ static NTSTATUS idmap_autorid_sids_to_unixids(struct idmap_domain *dom,
goto failure;
}
}
-
- talloc_free(ctx);
return NT_STATUS_OK;
failure:
- talloc_free(ctx);
return ret;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list