[SSSD] [PATCH] Check flat names when searching for sub-domains as well

Sumit Bose sbose at redhat.com
Mon Sep 3 12:04:16 UTC 2012


Hi,

this patch add support to use short/flat/NetBIOS domain names in a fully
qualifies user name. This becomes important when you want to use samba
in a setup with trusted domains.

Samba isn't very flexible here and looks for user names like
SHORTDOMNAME\username (only the delimiter '\' can be changed). If sssd
is configured with a regular expression like

(?P<domain>[^\\]*?)\\?(?P<name>[^\\]+$)

to match samba's expectation currently only the DNS domain names are
compared with the requested domains and not the flat names.

bye,
Sumit
-------------- next part --------------
From 0b6ac7e81663cac10a5b4c222e68f682a2836485 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Mon, 3 Sep 2012 13:53:55 +0200
Subject: [PATCH] Check flat names when searching for sub-domains as well

---
 src/util/usertools.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/util/usertools.c b/src/util/usertools.c
index adef2b0021170e9bb21e1c0b2e9a57f460141572..ea640fb30a9fd427d1cd90e8873c4e5fff45e403 100644
--- a/src/util/usertools.c
+++ b/src/util/usertools.c
@@ -236,7 +236,9 @@ static struct sss_domain_info * match_any_domain_or_subdomain_name (
         return dom;
 
     for (i = 0; i < dom->subdomain_count; i++) {
-        if (strcasecmp(dom->subdomains[i]->name, dmatch) == 0) {
+        if (strcasecmp(dom->subdomains[i]->name, dmatch) == 0 ||
+            (dom->subdomains[i]->flat_name != NULL &&
+             strcasecmp(dom->subdomains[i]->flat_name, dmatch) == 0)) {
             return dom->subdomains[i];
         }
     }
-- 
1.7.7.6



More information about the sssd-devel mailing list