diff --git a/INSTALL b/INSTALL index cfc3937ef..f1267e944 100644 --- a/INSTALL +++ b/INSTALL @@ -341,6 +341,10 @@ Optional features: (SSSD) as a sudoers data source. For more information on SSD, see http://fedorahosted.org/sssd/ + --with-sssd-conf=PATH + Specify the path to the SSSD configuration file, if different + from the default value of /etc/sssd/sssd.conf. + --with-sssd-lib=PATH Specify the path to the SSSD shared library, which is loaded at run-time. diff --git a/configure b/configure index 36ea9ce21..36c334c0a 100755 --- a/configure +++ b/configure @@ -852,6 +852,7 @@ with_bsm_audit with_linux_audit with_solaris_audit with_sssd +with_sssd_conf with_sssd_lib with_incpath with_libpath @@ -1653,6 +1654,7 @@ Optional Packages: --with-linux-audit enable Linux audit support --with-solaris-audit enable Solaris audit support --with-sssd enable SSSD support + --with-sssd-conf path to the SSSD config file --with-sssd-lib path to the SSSD library --with-incpath additional places to look for include files --with-libpath additional places to look for libraries @@ -4371,6 +4373,19 @@ fi +# Check whether --with-sssd-conf was given. +if test "${with_sssd_conf+set}" = set; then : + withval=$with_sssd_conf; +fi + +sssd_conf="/etc/sssd/sssd.conf" +test -n "$with_sssd_conf" && sssd_conf="$with_sssd_conf" +cat >>confdefs.h <domainname = NULL; + handle->host = user_runhost; + handle->shost = user_srunhost; handle->pw = sudo_user.pw; nss->handle = handle; + /* + * If runhost is the same as the local host, check for ipa_hostname + * in sssd.conf and use it in preference to user_runhost. + */ + if (strcmp(user_runhost, user_host) == 0) { + if (get_ipa_hostname(&handle->shost, &handle->host) == -1) { + sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory")); + free(handle); + debug_return_int(ENOMEM); + } + } + sudo_debug_printf(SUDO_DEBUG_DEBUG, "handle=%p", handle); debug_return_int(0); @@ -544,8 +616,8 @@ sudo_sss_check_runas_user(struct sudo_sss_handle *handle, struct sss_sudo_rule * switch (val[0]) { case '+': sudo_debug_printf(SUDO_DEBUG_DEBUG, "netgr_"); - if (netgr_matches(val, def_netgroup_tuple ? user_runhost : NULL, - def_netgroup_tuple ? user_srunhost : NULL, runas_pw->pw_name)) { + if (netgr_matches(val, def_netgroup_tuple ? handle->host : NULL, + def_netgroup_tuple ? handle->shost : NULL, runas_pw->pw_name)) { sudo_debug_printf(SUDO_DEBUG_DEBUG, "=> match"); ret = true; } @@ -674,9 +746,9 @@ sudo_sss_check_host(struct sudo_sss_handle *handle, struct sss_sudo_rule *rule) /* match any or address or netgroup or hostname */ if (strcmp(val, "ALL") == 0 || addr_matches(val) || - netgr_matches(val, user_runhost, user_srunhost, + netgr_matches(val, handle->host, handle->shost, def_netgroup_tuple ? handle->pw->pw_name : NULL) || - hostname_matches(user_srunhost, user_runhost, val)) + hostname_matches(handle->shost, handle->host, val)) ret = true; sudo_debug_printf(SUDO_DEBUG_INFO, @@ -729,8 +801,8 @@ sudo_sss_check_user(struct sudo_sss_handle *handle, struct sss_sudo_rule *rule) switch (*val) { case '+': /* Netgroup spec found, check membership. */ - if (netgr_matches(val, def_netgroup_tuple ? user_runhost : NULL, - def_netgroup_tuple ? user_srunhost : NULL, handle->pw->pw_name)) { + if (netgr_matches(val, def_netgroup_tuple ? handle->host : NULL, + def_netgroup_tuple ? handle->shost : NULL, handle->pw->pw_name)) { matched = !negated; } break;