Bugzilla – Attachment 367 Details for
Bug 252
Patch for use of /etc/default/login
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Update to -current, integrate into configure a little more.
openssh-deflogin.patch (text/plain), 7.25 KB, created by
Darren Tucker
on 2003-08-22 14:14:16 AEST
(
hide
)
Description:
Update to -current, integrate into configure a little more.
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2003-08-22 14:14:16 AEST
Size:
7.25 KB
patch
obsolete
>Index: acconfig.h >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/acconfig.h,v >retrieving revision 1.160 >diff -u -p -r1.160 acconfig.h >--- acconfig.h 2 Aug 2003 12:24:49 -0000 1.160 >+++ acconfig.h 2 Aug 2003 14:21:03 -0000 >@@ -350,6 +350,9 @@ > /* Define in your struct dirent expects you to allocate extra space for d_name */ > #undef BROKEN_ONE_BYTE_DIRENT_D_NAME > >+/* Define if your system has /etc/default/login */ >+#undef HAVE_ETC_DEFAULT_LOGIN >+ > /* Define if your getopt(3) defines and uses optreset */ > #undef HAVE_GETOPT_OPTRESET > >Index: configure.ac >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/configure.ac,v >retrieving revision 1.140 >diff -u -p -r1.140 configure.ac >--- configure.ac 21 Aug 2003 07:58:29 -0000 1.140 >+++ configure.ac 22 Aug 2003 03:50:38 -0000 >@@ -239,6 +239,7 @@ mips-sony-bsd|mips-sony-newsos4) > AC_DEFINE(PAM_TTY_KLUDGE) > # Pushing STREAMS modules will cause sshd to acquire a controlling tty. > AC_DEFINE(SSHD_ACQUIRES_CTTY) >+ external_path_file=/etc/default/login > # hardwire lastlog location (can't detect it on some versions) > conf_lastlog_location="/var/adm/lastlog" > AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x) >@@ -275,6 +276,7 @@ mips-sony-bsd|mips-sony-newsos4) > AC_DEFINE(USE_PIPES) > AC_DEFINE(IP_TOS_IS_BROKEN) > AC_DEFINE(SSHD_ACQUIRES_CTTY) >+ external_path_file=/etc/default/login > # /usr/ucblib/libucb.a no longer needed on ReliantUNIX > # Attention: always take care to bind libsocket and libnsl before libc, > # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog >@@ -2111,27 +2113,35 @@ else > ) > fi > >-dnl BSD systems use /etc/login.conf so --with-default-path= has no effect >+# check for /etc/default/login and use it if present. >+AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ]) >+ >+if test "x$external_path_file" = "x/etc/default/login"; then >+ AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN) >+fi >+ >+dnl BSD systems use /etc/login.conf for path, --with-default-path= has no effect > if test $ac_cv_func_login_getcapbool = "yes" -a \ > $ac_cv_header_login_cap_h = "yes" ; then >- USES_LOGIN_CONF=yes >+ external_path_file=/etc/login.conf > fi >+ > # Whether to mess with the default path > SERVER_PATH_MSG="(default)" > AC_ARG_WITH(default-path, > [ --with-default-path= Specify default \$PATH environment for server], > [ >- if test "$USES_LOGIN_CONF" = "yes" ; then >+ if ! test -z "$external_path_file" ; then > AC_MSG_WARN([ > --with-default-path=PATH has no effect on this system. >-Edit /etc/login.conf instead.]) >+Edit $external_path_file instead.]) > elif test "x$withval" != "xno" ; then > user_path="$withval" > SERVER_PATH_MSG="$withval" > fi > ], >- [ if test "$USES_LOGIN_CONF" = "yes" ; then >- AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf]) >+ [ if test ! -z "$external_path_file" ; then >+ AC_MSG_WARN([Make sure the path to scp is in $external_path_file]) > else > AC_TRY_RUN( > [ >@@ -2188,7 +2198,7 @@ main() > fi > fi ] > ) >-if test "$USES_LOGIN_CONF" != "yes" ; then >+if test ! -z "$external_path_file" ; then > AC_DEFINE_UNQUOTED(USER_PATH, "$user_path") > AC_SUBST(user_path) > fi >@@ -2558,8 +2568,8 @@ echo " Askpass program > echo " Manual pages: $F" > echo " PID file: $G" > echo " Privilege separation chroot path: $H" >-if test "$USES_LOGIN_CONF" = "yes" ; then >-echo " At runtime, sshd will use the path defined in /etc/login.conf" >+if test ! -z "$external_path_file"; then >+echo " At runtime, sshd will use the path defined in $external_path_file" > else > echo " sshd default user PATH: $I" > fi >Index: session.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/session.c,v >retrieving revision 1.246 >diff -u -p -r1.246 session.c >--- session.c 13 Aug 2003 10:31:05 -0000 1.246 >+++ session.c 22 Aug 2003 03:50:38 -0000 >@@ -845,6 +845,27 @@ child_set_env(char ***envp, u_int *envsi > } > > /* >+ * Returns the value of the given variable from the environment. >+ * Returns NULL, if the variable is not found. >+ */ >+static char * >+child_get_env(char **envp, const char *name) >+{ >+ u_int i, namelen; >+ >+ namelen = strlen(name); >+ for (i = 0; envp[i]; i++) { >+ if (strncmp(envp[i], name, namelen) == 0 && >+ envp[i][namelen] == '=') >+ break; >+ } >+ if (envp[i]) >+ return &envp[i][namelen + 1]; >+ >+ return NULL; >+} >+ >+/* > * Reads environment variables from the given file and adds/overrides them > * into the environment. If the file does not exist, this does nothing. > * Otherwise, it must consist of empty lines, comments (line starts with '#') >@@ -889,6 +910,57 @@ read_environment_file(char ***env, u_int > fclose(f); > } > >+#ifdef HAVE_ETC_DEFAULT_LOGIN >+/* >+ * Read /etc/default/login >+ * This file is found and processed by login(1) at least on Solaris >+ * and ReliantUNIX. >+ * >+ * Get PATH environment variable from: >+ * PATH (for mere mortals) >+ * SUPATH (for root) >+ * Get umask setting from UMASK >+ * >+ * XXX There are other reasonable things to process in this file: >+ * i.e. ALTSHELL, CONSOLE, DISABLE_RHOSTS, HZ, IDLEWEEKS, ULIMIT >+ * >+ */ >+static void >+read_etc_default_login(char ***env, u_int *envsize, uid_t uid) >+{ >+ char **edf_env, *edf; >+ u_int i, edf_envsize; >+ mode_t mask; >+ >+ /* >+ * We don't want to copy the whole file to the childs environment, >+ * so we use our own temporary environment here. >+ * envsize=10 should be large enough, but child_set_env will expand >+ * the array if necessary. >+ */ >+ edf_envsize = 10; >+ edf_env = xmalloc(edf_envsize * sizeof(char *)); >+ edf_env[0] = NULL; >+ >+ read_environment_file(&edf_env, &edf_envsize, "/etc/default/login"); >+ >+ if (uid == 0) >+ edf = child_get_env(edf_env, "SUPATH"); >+ else >+ edf = child_get_env(edf_env, "PATH"); >+ if (edf != NULL) >+ child_set_env(env, envsize, "PATH", edf); >+ >+ if ((edf = child_get_env(edf_env, "UMASK")) != NULL) >+ if (sscanf(edf, "%5lo", &mask) == 1) >+ umask(mask); >+ >+ for (i = 0; edf_env[i] != NULL; i++) >+ xfree(edf_env[i]); >+ xfree(edf_env); >+} >+#endif /* HAVE_ETC_DEFAULT_LOGIN */ >+ > void copy_environment(char **source, char ***env, u_int *envsize) > { > char *var_name, *var_val; >@@ -954,15 +1026,25 @@ do_setup_env(Session *s, const char *she > * needed for loading shared libraries. So the path better > * remains intact here. > */ >-# ifdef SUPERUSER_PATH >- child_set_env(&env, &envsize, "PATH", >- s->pw->pw_uid == 0 ? SUPERUSER_PATH : _PATH_STDPATH); >-# else >- child_set_env(&env, &envsize, "PATH", _PATH_STDPATH); >-# endif /* SUPERUSER_PATH */ >+# ifdef HAVE_ETC_DEFAULT_LOGIN >+ read_etc_default_login(&env, &envsize, pw->pw_uid); >+# endif /* HAVE_ETC_DEFAULT_LOGIN */ > # endif /* HAVE_CYGWIN */ > #endif /* HAVE_LOGIN_CAP */ > >+ /* >+ * Paranoia check: set at least a standard path >+ * if none is set yet. >+ */ >+ if (child_get_env(env, "PATH") == NULL) { >+#ifdef SUPERUSER_PATH >+ child_set_env(&env, &envsize, "PATH", >+ s->pw->pw_uid == 0 ? >+ SUPERUSER_PATH : _PATH_STDPATH); >+#else >+ child_set_env(&env, &envsize, "PATH", _PATH_STDPATH); >+#endif /* SUPERUSER_PATH */ >+ } > snprintf(buf, sizeof buf, "%.200s/%.50s", > _PATH_MAILDIR, pw->pw_name); > child_set_env(&env, &envsize, "MAIL", buf);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 252
:
98
|
212
|
367
|
378
|
397
|
398