read environment from _PATH_ETC_ENVIRONMENT
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21988 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		
							
								
								
									
										22
									
								
								appl/su/su.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								appl/su/su.c
									
									
									
									
									
								
							| @@ -65,13 +65,7 @@ RCSID("$Id$"); | |||||||
| #include <roken.h> | #include <roken.h> | ||||||
| #include <getarg.h> | #include <getarg.h> | ||||||
|  |  | ||||||
| #ifndef _PATH_DEFPATH | #include "supaths.h" | ||||||
| #define _PATH_DEFPATH "/usr/bin:/bin" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #ifndef _PATH_BSHELL |  | ||||||
| #define _PATH_BSHELL "/bin/sh" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| int kerberos_flag = 1; | int kerberos_flag = 1; | ||||||
| int csh_f_flag; | int csh_f_flag; | ||||||
| @@ -541,11 +535,23 @@ main(int argc, char **argv) | |||||||
|     if(!env_flag) { |     if(!env_flag) { | ||||||
| 	if(full_login) { | 	if(full_login) { | ||||||
| 	    char *t = getenv ("TERM"); | 	    char *t = getenv ("TERM"); | ||||||
|  | 	    char **newenv = NULL; | ||||||
|  | 	    int i, j; | ||||||
|  |  | ||||||
| 	    environ = malloc (10 * sizeof (char *)); | 	    i = read_environment(_PATH_ETC_ENVIRONMENT, &newenv); | ||||||
|  |  | ||||||
|  | 	    environ = malloc ((10 + i) * sizeof (char *)); | ||||||
| 	    if (environ == NULL) | 	    if (environ == NULL) | ||||||
| 		err (1, "malloc"); | 		err (1, "malloc"); | ||||||
| 	    environ[0] = NULL; | 	    environ[0] = NULL; | ||||||
|  |  | ||||||
|  | 	    for (j = 0; j < i; j++) { | ||||||
|  | 		char *p = strchr(newenv[j], '='); | ||||||
|  | 		*p++ = 0; | ||||||
|  | 		esetenv (newenv[j], p, 1); | ||||||
|  | 	    } | ||||||
|  | 	    free(newenv); | ||||||
|  |  | ||||||
| 	    esetenv ("PATH", _PATH_DEFPATH, 1); | 	    esetenv ("PATH", _PATH_DEFPATH, 1); | ||||||
| 	    if (t) | 	    if (t) | ||||||
| 		esetenv ("TERM", t, 1); | 		esetenv ("TERM", t, 1); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand