2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-04 00:05:11 +00:00

Better martching of ipa_hostname in sssd.conf

This commit is contained in:
Todd C. Miller
2016-06-05 05:40:32 -06:00
parent 9b027676c0
commit c6a21bd53d

View File

@@ -324,10 +324,13 @@ get_ipa_hostname(char **shostp, char **lhostp)
* Match ipa_hostname = foo * Match ipa_hostname = foo
* Note: currently ignores the domain (XXX) * Note: currently ignores the domain (XXX)
*/ */
if (strncmp(cp, "ipa_hostname", 12) == 0 && if (strncmp(cp, "ipa_hostname", 12) == 0) {
(isblank((unsigned char)cp[12]) || cp[12] == '=')) { cp += 12;
cp += 13; while (isblank((unsigned char)*cp))
while (isblank((unsigned char)*cp) || *cp == '=') cp++;
if (*cp++ != '=')
continue;
while (isblank((unsigned char)*cp))
cp++; cp++;
lhost = strdup(cp); lhost = strdup(cp);
if (lhost != NULL && (cp = strchr(lhost, '.')) != NULL) { if (lhost != NULL && (cp = strchr(lhost, '.')) != NULL) {
@@ -336,6 +339,8 @@ get_ipa_hostname(char **shostp, char **lhostp)
shost = lhost; shost = lhost;
} }
if (shost != NULL && lhost != NULL) { if (shost != NULL && lhost != NULL) {
sudo_debug_printf(SUDO_DEBUG_INFO,
"ipa_hostname %s overrides %s", lhost, user_host);
*shostp = shost; *shostp = shost;
*lhostp = lhost; *lhostp = lhost;
ret = true; ret = true;
@@ -344,8 +349,8 @@ get_ipa_hostname(char **shostp, char **lhostp)
free(lhost); free(lhost);
ret = -1; ret = -1;
} }
break;
} }
break;
} }
fclose(fp); fclose(fp);
free(line); free(line);