Problem with enabling /etc/default(s)/login on Cygwin

Corinna Vinschen vinschen at redhat.com
Thu Aug 14 22:15:54 EST 2014


Hi,


below is a patch which simply removes a Cygwin-specific piece of code
from OpenSSH.  Input from a system admin educated me how useful this
option could be on Cygwin as well.  However, way back when the call to
read_etc_default_login got disabled on Cygwin hardcoded in session.c,
rather than just setting --disable-etc-default-login when building the
Cygwin version of OpenSSH.  So, here's the patch which simply re-enables
reading /etc/default/login on Cygwin.

However, even when removing this Cygwin-specific patch, there's still a
problem.  On Cygwin the path is not /etc/default, but /etc/defaults.
Note the trailing "s".  The problem is, the path to the default login
file is not configurable.  Would it be much of a problem to make the
path to this file configurable?

I'm also wondering if the configure test for /etc/default/login is
really doing the right thing.  What happens is:

- If --disable-etc-default-login is set, no support for /etc/default/login

- If nothing is given on the command line, check for /etc/default/login.
  If it's available support it, otherwise don't.

So far, so good, but this one is a problem IMHO:

- If --enable-etc-default-login is set, configure *still* checks for
  /etc/default/login.

That's not correct, AFAICS.  Even if the package maintainer *explicitely*
enabled /etc/default/login support, the configure script makes the
sshd code only supports /etc/default/login if the file existed on the
maintainer's machine at configure time.  This is very unreliable and
the result is puzzeling.

Shouldn't configure.ac be changed like this:

  if --disable-etc-default-login is given
    etc_default_login=no
  else if --enable-etc-default-login is given
    etc_default_login=yes
    external_path_file=/etc/default/login
    AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1], ...
  else if cross_compiling
    etc_default_login=no
  else if AC_CHECK_FILE(["/etc/default/login"]
    etc_default_login=yes
  else
    etc_default_login=no

???


Thanks,
Corinna


Index: session.c
===================================================================
RCS file: /cvs/openssh/session.c,v
retrieving revision 1.434
diff -u -p -r1.434 session.c
--- session.c	18 Jul 2014 04:11:26 -0000	1.434
+++ session.c	14 Aug 2014 11:29:58 -0000
@@ -1188,13 +1188,6 @@ do_setup_env(Session *s, const char *she
 		else
 			child_set_env(&env, &envsize, "PATH", getenv("PATH"));
 #else /* HAVE_LOGIN_CAP */
-# ifndef HAVE_CYGWIN
-		/*
-		 * There's no standard path on Windows. The path contains
-		 * important components pointing to the system directories,
-		 * needed for loading shared libraries. So the path better
-		 * remains intact here.
-		 */
 #  ifdef HAVE_ETC_DEFAULT_LOGIN
 		read_etc_default_login(&env, &envsize, pw->pw_uid);
 		path = child_get_env(env, "PATH");
@@ -1204,7 +1197,6 @@ do_setup_env(Session *s, const char *she
 			    s->pw->pw_uid == 0 ?
 				SUPERUSER_PATH : _PATH_STDPATH);
 		}
-# endif /* HAVE_CYGWIN */
 #endif /* HAVE_LOGIN_CAP */
 
 		snprintf(buf, sizeof buf, "%.200s/%.50s",



-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20140814/25d030db/attachment.bin>


More information about the openssh-unix-dev mailing list