summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-10-23 14:39:55 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-10-25 15:31:15 +0200
commit939246537b0b9a4af6862c513d3919501ad57d92 (patch)
treebd624f78883af27fd9cbe32fcdf1c231cae98c26 /src/util
parent648d3ec563fafea7d7daf88b46e28ce0d43b3935 (diff)
downloadsssd-939246537b0b9a4af6862c513d3919501ad57d92.tar.gz
sssd-939246537b0b9a4af6862c513d3919501ad57d92.tar.xz
sssd-939246537b0b9a4af6862c513d3919501ad57d92.zip
find_subdomain_by_sid: skip domains with missing domain_id
Diffstat (limited to 'src/util')
-rw-r--r--src/util/domain_info_utils.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
index 8d07871ec..61efc0b40 100644
--- a/src/util/domain_info_utils.c
+++ b/src/util/domain_info_utils.c
@@ -112,26 +112,34 @@ struct sss_domain_info *find_subdomain_by_sid(struct sss_domain_info *domain,
const char *sid)
{
struct sss_domain_info *dom = domain;
- size_t sid_len = strlen(sid);
+ size_t sid_len;
size_t dom_sid_len;
+ if (sid == NULL) {
+ return NULL;
+ }
+
+ sid_len = strlen(sid);
+
while (dom && dom->disabled) {
dom = get_next_domain(dom, true);
}
while (dom) {
- dom_sid_len = strlen(dom->domain_id);
+ if (dom->domain_id != NULL) {
+ dom_sid_len = strlen(dom->domain_id);
- if (strncasecmp(dom->domain_id, sid, dom_sid_len) == 0) {
- if (dom_sid_len == sid_len) {
- /* sid is domain sid */
- return dom;
- }
+ if (strncasecmp(dom->domain_id, sid, dom_sid_len) == 0) {
+ if (dom_sid_len == sid_len) {
+ /* sid is domain sid */
+ return dom;
+ }
- /* sid is object sid, check if domain sid is align with
- * sid first subauthority component */
- if (sid[dom_sid_len] == '-') {
- return dom;
+ /* sid is object sid, check if domain sid is align with
+ * sid first subauthority component */
+ if (sid[dom_sid_len] == '-') {
+ return dom;
+ }
}
}