[PATCH] libnfsidmap: Don't fail when no domain is set
J. Bruce Fields
bfields at fieldses.org
Fri Jul 11 15:30:54 EDT 2008
On Fri, Jul 11, 2008 at 06:12:54AM -0400, Steve Dickson wrote:
>
> A while back I had a complaint that idmapper *always* gets
> the uid/gid mapping wrong because the default value defined
> in the 'Domain' field (in /etc/idmapd.conf) is never correct.
>
> The person also noticed that by commenting out the Domain
> fields caused the mappings to be correct, since DNS was used
> to obtain the domain.
>
> But then it was noticed when the domain can not be gotten from
> the idmapd.conf or DNS, idmapper crashes which does seem too
> robust... imho...
>
> The first patch comments out the 'Domain' field in idmapd.conf.
> The second patch sets the 'default_domain' variable in libnfsidmap.c to
> "localdomain" when there is not a domain defined in /etc/idmapd.conf
> and a domain name can not be obtained from DNS.
Seems reasonable, but you probably want to apply those patches in the
other order. (Fix the bug before changing the configuration in a way
that may trigger the bug.)
--b.
> Of course using
> "localdomain" as the domain will cause all mapping to be map to
> the 'Nobody-User' user but better than having idmapper crash, imho...
>
> So these patches do two things, allows mappings to be correct "right out of the box"
> when DNS is set up correctly and stops idmapper from dying when there
> is no domain name set.
>
> Signed-off-by: Steve Dickson <steved at redhat.com>
>
> diff -up libnfsidmap-0.20/idmapd.conf.orig libnfsidmap-0.20/idmapd.conf
> --- libnfsidmap-0.20/idmapd.conf.orig 2006-08-14 17:19:45.000000000 -0400
>
> +++ libnfsidmap-0.20/idmapd.conf 2008-07-11 05:37:58.000000000 -0400
>
> @@ -1,7 +1,7 @@
>
> [General]
>
> #Verbosity = 0
>
> -# The following should be set to the local NFSv4 domain name (REQUIRED)
>
> -Domain = local.domain.edu
>
> +# The following should be set to the local NFSv4 domain name
>
> +#Domain = local.domain.edu
>
>
>
> [Mapping]
>
>
>
> diff -up libnfsidmap/libnfsidmap.c.orig libnfsidmap/libnfsidmap.c
> --- libnfsidmap/libnfsidmap.c.orig 2006-09-05 10:09:00.000000000 -0400
> +++ libnfsidmap/libnfsidmap.c 2008-07-11 05:16:45.000000000 -0400
> @@ -54,6 +54,10 @@
> /* forward declarations */
> int set_trans_method(char *);
>
> +#ifndef IDMAPD_DEFAULT_DOMAIN
> +#define IDMAPD_DEFAULT_DOMAIN "localdomain"
> +#endif
> +
> static char *default_domain;
>
> #ifndef PATH_IDMAPDCONF
> @@ -109,10 +113,12 @@ int nfs4_init_name_mapping(char *conffil
> dflt = 1;
> ret = domain_from_dns(&default_domain);
> if (ret) {
> - IDMAP_LOG(0, ("libnfsidmap: Unable to determine "
> - "a default nfsv4 domain; consider "
> - "specifying one in idmapd.conf\n"));
> - return ret;
> + IDMAP_LOG(1, ("libnfsidmap: Unable to determine "
> + "the NFSv4 domain; Using '%s' as the NFSv4 domain "
> + "which means UIDs will be mapped to the 'Nobody-User' "
> + "user defined in %s\n",
> + IDMAPD_DEFAULT_DOMAIN, PATH_IDMAPDCONF));
> + default_domain = IDMAPD_DEFAULT_DOMAIN;
> }
> }
> IDMAP_LOG(1, ("libnfsidmap: using%s domain: %s\n",
> _______________________________________________
> NFSv4 mailing list
> NFSv4 at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/nfsv4
More information about the NFSv4
mailing list