From: Steve Dickson <SteveD@redhat.com>
To: Sami Wagiaalla <swagiaal@redhat.com>,
libtirpc-devel@lists.sourceforge.net
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfs: Add '--with-nss-modules' configure option to specify nss modules.
Date: Mon, 10 Nov 2014 12:37:35 -0500 [thread overview]
Message-ID: <5460F7DF.6090307@RedHat.com> (raw)
In-Reply-To: <545D34F6.8080703@redhat.com>
On 11/07/2014 04:09 PM, Sami Wagiaalla wrote:
> From: Sami Wagiaalla <swagiaal@redhat.com>
>
> I was having trouble setting up NFS on Atomic Host. It turns out
> there is an issue when rpcbind is trying to find the uid of the
> rpc user. OSTree based operating systems store user information
> for system users such as the rpc user in /usr/lib/passwd and
> leaves /etc/passwd for humans users. This is enabled by the use
> of the nss module nss-altfiles which allows one to specify
> additional files to be added the the passwd database. rpcbind
> however overrides the rule added to /etc/nsswitch.conf and removes
> "altfiles" from the list of modules by doing the following:
>
> __nss_configure_lookup("passwd", "files");
>
> This was added in commit 77f7556878d1fe03dc ("[...]use
> __nss_configure_lookup() to restrict the [rpc user] lookup") to
> remove "nis" form the list of modules and prevent rpcbind from
> having a circular dependency on itself. In an OSTree based
> operating system however this prevents rpcbind from finding the rpc
> user and the service cannot start.
>
> This patch adds an option --with-nss-modules which allows one
> to specify the nss modules which should be searched for user
> information. The default setting is "files" which preserves the
> current behavior, but this enables one to add other modules to
> the search path.
>
> Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
Committed....
steved.
> ---
> Makefile.am | 1 +
> configure.ac | 7 +++++++
> src/rpcbind.c | 10 ++++++++--
> 3 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index d10c906..e0bc4b4 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -6,6 +6,7 @@ AM_CPPFLAGS = \
> -DINET6 \
> -DRPCBIND_STATEDIR="\"$(statedir)\"" \
> -DRPCBIND_USER="\"$(rpcuser)\"" \
> + -DNSS_MODULES="\"$(nss_modules)\"" \
> -D_GNU_SOURCE \
> $(TIRPC_CFLAGS)
>
> diff --git a/configure.ac b/configure.ac
> index 39181f0..5a88cc7 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -27,6 +27,13 @@ AC_ARG_WITH([rpcuser],
> ,, [with_rpcuser=root])
> AC_SUBST([rpcuser], [$with_rpcuser])
>
> +AC_ARG_WITH([nss_modules],
> + AS_HELP_STRING([--with-nss-modules=NSS_MODULES]
> + , [Sets the nss module search list to the given space-delimited string.
> + For example --with-nss-modules="files altfiles" @<:@default=files@:>@])
> + ,, [with_nss_modules=files])
> +AC_SUBST([nss_modules], [$with_nss_modules])
> +
> PKG_CHECK_MODULES([TIRPC], [libtirpc])
>
> AS_IF([test x$enable_libwrap = xyes], [
> diff --git a/src/rpcbind.c b/src/rpcbind.c
> index 924aca1..e3462e3 100644
> --- a/src/rpcbind.c
> +++ b/src/rpcbind.c
> @@ -91,6 +91,12 @@ char *rpcbinduser = RPCBIND_USER;
> char *rpcbinduser = NULL;
> #endif
>
> +#ifdef NSS_MODULES
> +char *nss_modules = NSS_MODULES;
> +#else
> +char *nss_modules = "files";
> +#endif
> +
> /* who to suid to if -s is given */
> #define RUN_AS "daemon"
>
> @@ -165,7 +171,7 @@ main(int argc, char *argv[])
> * Make sure we use the local service file
> * for service lookkups
> */
> - __nss_configure_lookup("services", "files");
> + __nss_configure_lookup("services", nss_modules);
>
> nc_handle = setnetconfig(); /* open netconfig file */
> if (nc_handle == NULL) {
> @@ -231,7 +237,7 @@ main(int argc, char *argv[])
> * Make sure we use the local password file
> * for these lookups.
> */
> - __nss_configure_lookup("passwd", "files");
> + __nss_configure_lookup("passwd", nss_modules);
>
> if((p = getpwnam(id)) == NULL) {
> syslog(LOG_ERR, "cannot get uid of '%s': %m", id);
>
prev parent reply other threads:[~2014-11-10 17:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 21:09 [PATCH] nfs: Add '--with-nss-modules' configure option to specify nss modules Sami Wagiaalla
2014-11-10 17:37 ` Steve Dickson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5460F7DF.6090307@RedHat.com \
--to=steved@redhat.com \
--cc=libtirpc-devel@lists.sourceforge.net \
--cc=linux-nfs@vger.kernel.org \
--cc=swagiaal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox