summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorGerald (Jerry) Carter <jerry@samba.org>2007-11-20 13:24:03 -0600
committerGerald (Jerry) Carter <jerry@samba.org>2007-11-20 13:27:14 -0600
commit2545457268610ab8fe71911bab167b4aeebc4ca3 (patch)
tree445506dd461c6669a66b97af044acfbd8161607b /source3/winbindd
parent4c6b01b0ef289bb1511c30354ed41b597288c9d7 (diff)
downloadsamba-2545457268610ab8fe71911bab167b4aeebc4ca3.tar.gz
samba-2545457268610ab8fe71911bab167b4aeebc4ca3.tar.bz2
samba-2545457268610ab8fe71911bab167b4aeebc4ca3.zip
Prevent segv in winbindd running on a DC using the "idmap backend" syntax.
The number of domains should be counted as they are added and not assumed to match the loop counter. manually cherry-picked 8ad2826c48a0d4d26abc3bb209860c776f55822f (This used to be commit 99b75cada2c4caaec5d30c8351080f0a41e44bd1)
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/idmap.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c
index e89ad735b6..6756c2a23b 100644
--- a/source3/winbindd/idmap.c
+++ b/source3/winbindd/idmap.c
@@ -387,7 +387,7 @@ NTSTATUS idmap_init(void)
*/
DEBUG(1, ("Initializing idmap domains\n"));
- for (i = 0; dom_list[i]; i++) {
+ for (i=0, num_domains=0; dom_list[i]; i++) {
const char *parm_backend;
char *config_option;
@@ -395,7 +395,7 @@ NTSTATUS idmap_init(void)
if (strequal(dom_list[i], "BUILTIN")
|| strequal(dom_list[i], get_global_sam_name()))
{
- DEBUG(0,("idmap_init: Ignoring invalid domain %s\n",
+ DEBUG(0,("idmap_init: Ignoring domain %s\n",
dom_list[i]));
continue;
}
@@ -503,13 +503,17 @@ NTSTATUS idmap_init(void)
ret = NT_STATUS_NO_MEMORY;
goto done;
}
- idmap_domains[i] = dom;
+ idmap_domains[num_domains] = dom;
/* save default domain position for future uses */
if (dom->default_domain) {
- def_dom_num = i;
+ def_dom_num = num_domains;
}
+ /* Bump counter to next available slot */
+
+ num_domains++;
+
DEBUG(10, ("Domain %s - Backend %s - %sdefault - %sreadonly\n",
dom->name, parm_backend,
dom->default_domain?"":"not ",
@@ -518,9 +522,6 @@ NTSTATUS idmap_init(void)
talloc_free(config_option);
}
- /* save the number of domains we have */
- num_domains = i;
-
/* automatically add idmap_nss backend if needed */
if ((lp_server_role() == ROLE_DOMAIN_MEMBER) &&
( ! pri_dom_is_in_list) &&