]> granicus.if.org Git - shadow/commitdiff
* src/su.c, man/su.1.xml: The default behavior (without -p or
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 11 Jun 2009 20:01:21 +0000 (20:01 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 11 Jun 2009 20:01:21 +0000 (20:01 +0000)
--login) is to copy most of the environment variables. Revert a
previous change and update the documentation.

ChangeLog
man/su.1.xml
src/su.c

index 32ddf0b47c1924b2854fcb1ea94f7d1a26d06f68..615ea53724dd06cdc1c1bd5307016a304bd55912 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-06  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/su.c, man/su.1.xml: The default behavior (without -p or
+       --login) is to copy most of the environment variables. Revert a
+       previous change and update the documentation.
+
 2009-06-06  Nicolas François  <nicolas.francois@centraliens.net>
 
        * man/passwd.5.xml, man/shadow.5.xml: Document the passwd- and
index 41bfe2df48a1a58e6c9bc9ae1b1d6f0f762e30ae..d965705faa95538d490eefe21e6fca36ef052c16 100644 (file)
                  </para>
                </listitem>
              </varlistentry>
+             <varlistentry><term></term><listitem>
+                 <para>
+                   If <option>--login</option> is not used, the
+                   environment is copied, except for the variables above.
+                 </para>
+               </listitem>
+             </varlistentry>
              <varlistentry><term></term><listitem>
                  <para>
                    If <option>--login</option> is used, the
                    <envar>$TERM</envar>, <envar>$COLORTERM</envar>,
                    <envar>$DISPLAY</envar>, and
                    <envar>$XAUTHORITY</envar> environment variables are
-                   kept if they were set.
+                   copied if they were set.
                  </para>
                </listitem>
              </varlistentry>
                  </para>
                </listitem>
              </varlistentry>
-             <varlistentry><term></term><listitem>
+             <varlistentry condition="no_pam"><term></term><listitem>
+                 <para>
+                   If <option>--login</option> is used, other environment
+                   variables might be set by the
+                   <option>ENVIRON_FILE</option> file (see below).
+                 </para>
+               </listitem>
+             </varlistentry>
+             <varlistentry condition="pam"><term></term><listitem>
                  <para>
-                   Other environment variables are deleted, but might be
-                   set by <phrase condition="no_pam">the
-                   <option>ENVIRON_FILE</option> file (see
-                   below)</phrase><phrase condition="pam">PAM
-                   modules</phrase>.
+                   Other environment might be set by PAM modules.
                  </para>
                </listitem>
              </varlistentry>
index 9f81dbed66432f08259933791db60b1188c4250a..876b46051576e360e843da5f4b022641f04fc017 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -559,8 +559,7 @@ int main (int argc, char **argv)
         * (note: in the case of a subsystem, the shell will be restricted,
         *        and this won't be executed on the first pass)
         */
-       if (change_environment) {
-               if (fakelogin) {
+       if (change_environment && fakelogin) {
                /*
                 * The terminal type will be left alone if it is present in
                 * the environment already.
@@ -610,7 +609,6 @@ int main (int argc, char **argv)
                if (NULL != cp) {
                        addenv ("XAUTHORITY", cp);
                }
-               }
        } else {
                while (NULL != *envp) {
                        addenv (*envp, NULL);