[SSSD] [PATCH] 1371-Missing resolv.conf should be non-fatal

Michal Židek mzidek at redhat.com
Thu Sep 13 17:21:17 UTC 2012


On 09/13/2012 05:18 AM, Ariel Barria wrote:
>
> hi, new patch :).
>
> Apparently was required also monitor_config_file_fallback().
>
>  > Hi Ariel,
>  >
>  > actually I reread the patch and I think there is a simpler way to fix
>  > the ticket..directly in the monitor_config_file() function, there is
>  > already a stat() call:
>  > 1823 ret = stat(file, &file_stat);
>  > 1824 if (ret < 0) {
>  > 1825 err = errno;
>  > 1826 DEBUG(0, ("Could not stat file [%s]. Error [%d:%s]\n",
>  > 1827 file, err, strerror(err)));
>  > 1828 return err;
>  > 1829 }
>  >
>  >
>  > So I think that simply extending the error handler with special-casing
>  > ENOENT as you had in your patch would work fine:
>  > + if (ret == ENOENT) {
>  > + DEBUG(SSSDBG_MINOR_FAILURE,
>  > + ("file [%s] is missing, but will skip this check.\n",
>  > + RESOLV_CONF_PATH));
>  > + } else {
>  > + DEBUG(SSSDBG_MINOR_FAILURE,("Could not stat file [%s]. Error
> [%d:%s]\n",
>  > + RESOLV_CONF_PATH, ret, strerror(ret)));
>  > + }
>

Hi Ariel,

you should always check the return value of the stat function
and not only if the 'verify_exists_file' is false (also please change
the name of this parameter to something like 'ignore_missing', I find
'verify_exists_file' a bit obfuscated).

If 'ignore_missing' is set to false and the file is missing, SSSD will
exit with error. If it is true, it will tolerate ENOENT and continue
(but still we need to check the return value and print appropriate
debug message). Also ENOENT is not the only possible error and whatever
ignore_missing is set to, we must not allow SSSD continue if they
occur).

In other words. If ignore_missing is set to false, we do not tolerate
any errors, if it is true, we tolerate ENOENT.

Also please add this new parameter to the ifdefed call to the
monitor_config_file (currently on line 2031 in monitor.c).

Thanks
Michal



More information about the sssd-devel mailing list