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

Michal Židek mzidek at redhat.com
Fri Sep 14 09:26:15 UTC 2012


On 09/14/2012 05:40 AM, Ariel Barria wrote:
> new patch.
> thanks again.
>
>  > Date: Thu, 13 Sep 2012 19:21:17 +0200
>  > From: mzidek at redhat.com
>  > To: sssd-devel at lists.fedorahosted.org
>  > Subject: Re: [SSSD] [PATCH] 1371-Missing resolv.conf should be non-fatal
>  >
>  > 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
>  > _______________________________________________
>  > sssd-devel mailing list
>  > sssd-devel at lists.fedorahosted.org
>  > https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>
>
> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>

I read your code wrong last time, you checked the return value of stat
correctly. Sorry for the inconvenience.

ACK to the last incarnation of the patch.

Good work Ariel.

Michal




More information about the sssd-devel mailing list