diff options
Diffstat (limited to 'daemons')
-rw-r--r-- | daemons/ipa-kdb/ipa_kdb_mspac.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/daemons/ipa-kdb/ipa_kdb_mspac.c b/daemons/ipa-kdb/ipa_kdb_mspac.c index bc82db6ba..ccff27b1b 100644 --- a/daemons/ipa-kdb/ipa_kdb_mspac.c +++ b/daemons/ipa-kdb/ipa_kdb_mspac.c @@ -784,18 +784,25 @@ static int read_group_sids_from_env(TALLOC_CTX *memctx, size_t *_ipa_group_sids_count, struct dom_sid **_ipa_group_sids) { + char *dummy; char *env; char *s; + char *endptr; int ret; size_t ipa_group_sids_count = 0; struct dom_sid *ipa_group_sids = NULL; size_t c; - env = getenv("IPA_GROUP_SIDS_FOR_PAC_TESTING"); - if (env == NULL) { + dummy = getenv("IPA_GROUP_SIDS_FOR_PAC_TESTING"); + if (dummy == NULL) { ret = 0; goto done; } + env = talloc_strdup(memctx, dummy); + if (env == NULL) { + ret = ENOMEM; + goto done; + } s = env; while((s = strchr(s, ',')) != NULL) { @@ -813,17 +820,20 @@ static int read_group_sids_from_env(TALLOC_CTX *memctx, c = 0; s = env; do { + endptr = strchr(s, ','); + if (endptr != NULL) { + *endptr = '\0'; + } ret = string_to_sid(s, &ipa_group_sids[c]); if (ret != 0) { + krb5_klog_syslog(LOG_ERR, "string_to_sid failed for [%s]", s); goto done; } c++; - s = strchr(s, ','); - if (s != NULL) { - s++; - } - } while(s != NULL); + s = endptr; + s++; + } while(endptr != NULL); ret = 0; |