[PATCH 1/3 v2] Cygwin: accounts: Unify nsswitch.conf db_* defaults

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/3 v2] Cygwin: accounts: Unify nsswitch.conf db_* defaults

cygwin-patches mailing list
Signed-off-by: David Macek <[hidden email]>
---
 winsup/cygwin/uinfo.cc | 11 +----------
 winsup/doc/ntsec.xml   | 27 +++++++--------------------
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 57d90189d3..2d5fc488bb 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -626,15 +626,12 @@ cygheap_pwdgrp::init ()
   grp_cache.cygserver.init_grp ();
   grp_cache.file.init_grp ();
   grp_cache.win.init_grp ();
-  /* Default settings:
+  /* Default settings (excluding fallbacks):
 
      passwd: files db
      group:  files db
      db_prefix: auto DISABLED
      db_separator: + DISABLED
-     db_home: cygwin desc
-     db_shell: cygwin desc
-     db_gecos: cygwin desc
      db_enum: cache builtin
   */
   pwd_src = (NSS_SRC_FILES | NSS_SRC_DB);
@@ -831,12 +828,6 @@ cygheap_pwdgrp::nss_init_line (const char *line)
   c += strspn (c, " \t");
   ++idx;
  }
-      /* If nothing has been set, revert to default. */
-      if (scheme[0].method == NSS_SCHEME_FALLBACK)
- {
-  scheme[0].method = NSS_SCHEME_CYGWIN;
-  scheme[1].method = NSS_SCHEME_DESC;
- }
     }
  }
       break;
diff --git a/winsup/doc/ntsec.xml b/winsup/doc/ntsec.xml
index 5287845686..032bebe4dc 100644
--- a/winsup/doc/ntsec.xml
+++ b/winsup/doc/ntsec.xml
@@ -874,9 +874,6 @@ set up to all default values:
   db_prefix:    auto
   db_separator: + -->
   db_enum:  cache builtin
-  db_home:  /home/%U
-  db_shell: /bin/bash
-  db_gecos: &lt;empty&gt;
 </screen>
 
 <sect4 id="ntsec-mapping-nsswitch-syntax"><title id="ntsec-mapping-nsswitch-syntax.title">The <filename>/etc/nsswitch.conf</filename> syntax</title>
@@ -1508,15 +1505,8 @@ of each schema when used with <literal>db_home:</literal>
 
 <para>
 As has been briefly mentioned before, the default setting for
-<literal>db_home:</literal> is
-</para>
-
-<screen>
-  db_home: /home/%U
-</screen>
-
-<para>
-So by default, Cygwin just sets the home dir to
+<literal>db_home:</literal> defines no schemata, which means only the fallback
+option is used, so by default, Cygwin just sets the home dir to
 <filename>/home/$USERNAME</filename>.
 </para>
 
@@ -1591,14 +1581,11 @@ when used with <literal>db_shell:</literal>
 
 <para>
 As for <literal>db_home:</literal>, the default setting for
-<literal>db_shell:</literal> is pretty much a constant
+<literal>db_shell:</literal> defines no schemata, which means only the fallback
+option is used, so by default, Cygwin just sets the home dir to
+<filename>/bin/bash</filename>.
 </para>
 
-<screen>
-  db_shell: /bin/bash
-</screen>
-
-
 </sect4>
 
 <sect4 id="ntsec-mapping-nsswitch-gecos">
@@ -1664,13 +1651,13 @@ The following list describes the meaning of each schema when used with
   <varlistentry>
     <term>Fallback</term>
     <listitem>If none of the schemes given for <literal>db_gecos:</literal>
-      define a non-empty pathname, nothing is added to
+      define a non-empty string, nothing is added to
       <literal>pw_gecos</literal>.</listitem>
   </varlistentry>
 </variablelist>
 
 <para>
-The default setting for <literal>db_gecos:</literal> is the empty string.
+The default setting for <literal>db_gecos:</literal> defines no schemata.
 </para>
 
 </sect4>
--
2.26.1.windows.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/3 v2] Cygwin: accounts: Unify nsswitch.conf db_* defaults

Corinna Vinschen-2
Hi David,

source patch is ok, just the docs...

On Apr 20 19:20, David Macek via Cygwin-patches wrote:

> diff --git a/winsup/doc/ntsec.xml b/winsup/doc/ntsec.xml
> index 5287845686..032bebe4dc 100644
> --- a/winsup/doc/ntsec.xml
> +++ b/winsup/doc/ntsec.xml
> @@ -874,9 +874,6 @@ set up to all default values:
>    db_prefix:    auto
>    db_separator: + -->
>    db_enum:  cache builtin
> -  db_home:  /home/%U
> -  db_shell: /bin/bash
> -  db_gecos: &lt;empty&gt;
>  </screen>

I'm not exactly happy with removing these lines.  While your patch is
*technically* correct in terms of schemata, these *are* the default
values.  The target audience are users.  A simple overview like the
above is helpful to just look up the defaults, while the technical
description below is for the more in-depth view.

So from my POV this hunk should be remove from your patch.

>  <sect4 id="ntsec-mapping-nsswitch-syntax"><title id="ntsec-mapping-nsswitch-syntax.title">The <filename>/etc/nsswitch.conf</filename> syntax</title>
> @@ -1508,15 +1505,8 @@ of each schema when used with <literal>db_home:</literal>
>  
>  <para>
>  As has been briefly mentioned before, the default setting for
> -<literal>db_home:</literal> is
> -</para>
> -
> -<screen>
> -  db_home: /home/%U
> -</screen>
> -
> -<para>
> -So by default, Cygwin just sets the home dir to
> +<literal>db_home:</literal> defines no schemata, which means only the fallback
> +option is used, so by default, Cygwin just sets the home dir to

Just adding text on top and trying to keep the former wording intact
doesn't do justice to the actual change here.  I'd like to suggest a
stronger rephrasing, along the lines of

  <literal>db_home:</literal> defines no default schemata.  If this
  setting is not present in <filename>/etc/nsswitch.conf</filename>,
  the fallback is to set the home directory to
  <filename>/home/$USERNAME</filename>.  This is equivalent to
  a <filename>/etc/nsswitch.conf</filename> settting of

  <screen>
    db_home: /home/%U
  </screen>

Same or similar in the db_shell case.  db_gecos is fine as is.


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/3 v2] Cygwin: accounts: Unify nsswitch.conf db_* defaults

Corinna Vinschen-2
On Apr 21 11:12, Corinna Vinschen wrote:
> Hi David,
>
> source patch is ok, just the docs...

Patch 2 and 3 are ok, they just don't apply cleanly as long as
patch 1 isn't applied.


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer