On Fri, May 26, 2017 at 04:53:31PM +0200, Tomas Mraz wrote:
[...]
> Why errors opening files in access.d subdirectory are treated
> differently?
As there is higher potential for administrator mistake putting a file
in the subdirectory with incorrect access rights or SELinux context I
wanted to make the errors opening them non-fatal so that only error
message is logged but the sysadmin is not prevented from logging in
again to correct the mistake. Do you think this different handling is
not needed?
In other two modules (pam_limits and pam_namespace) that use glob(3)
there are no such differences in error handling so I don't think
users would expect it in pam_access.
If in doubt, make it configurable.
> [...]
> > @@ -892,6 +899,24 @@ pam_sm_authenticate (pam_handle_t *pamh, int
> > flags UNUSED,
> >
> > rv = login_access(pamh, &loginfo);
> >
> > + if (rv == NOMATCH && strcmp(loginfo.config_file,
> > PAM_ACCESS_CONFIG) != 0) {
> > + glob_t globbuf;
> > + int i, glob_rv;
> > +
> > + loginfo.subfile = 1;
> > + glob_rv = glob(ACCESS_CONF_GLOB, GLOB_ERR, NULL,
> > &globbuf);
> > + if (!glob_rv) {
>
> In two other places where we use glob(3) there is a dance with
> LC_COLLATE,
> we might want to repeat it here as well.
Unfortunately manipulating locale is not thread safe and pam_access can
be in auth which we attempt to keep thread safe. Perhaps I should add
comment here? Also I wrote that in the documentation that system locale
is used.
That's true. For now let's add a comment.
I hope we'll switch to use uselocale(3) some day.
--
ldv