comparison svr-chansession.c @ 1819:5120e22882de

pass on sever process environment to child processes (option -e) (#118)
author Roland Vollgraf <30869947+rvollgraf@users.noreply.github.com>
date Thu, 19 Aug 2021 17:13:41 +0200
parents f0cd000f3bca
children 1edf4f143e12
comparison
equal deleted inserted replaced
1818:587c76726b5f 1819:5120e22882de
941 941
942 /* overwrite the prng state */ 942 /* overwrite the prng state */
943 seedrandom(); 943 seedrandom();
944 #endif 944 #endif
945 945
946 /* clear environment */ 946 /* clear environment if -e was not set */
947 /* if we're debugging using valgrind etc, we need to keep the LD_PRELOAD 947 /* if we're debugging using valgrind etc, we need to keep the LD_PRELOAD
948 * etc. This is hazardous, so should only be used for debugging. */ 948 * etc. This is hazardous, so should only be used for debugging. */
949 if ( !svr_opts.pass_on_env) {
949 #ifndef DEBUG_VALGRIND 950 #ifndef DEBUG_VALGRIND
950 #ifdef HAVE_CLEARENV 951 #ifdef HAVE_CLEARENV
951 clearenv(); 952 clearenv();
952 #else /* don't HAVE_CLEARENV */ 953 #else /* don't HAVE_CLEARENV */
953 /* Yay for posix. */ 954 /* Yay for posix. */
954 if (environ) { 955 if (environ) {
955 environ[0] = NULL; 956 environ[0] = NULL;
956 } 957 }
957 #endif /* HAVE_CLEARENV */ 958 #endif /* HAVE_CLEARENV */
958 #endif /* DEBUG_VALGRIND */ 959 #endif /* DEBUG_VALGRIND */
960 }
959 961
960 #if DROPBEAR_SVR_MULTIUSER 962 #if DROPBEAR_SVR_MULTIUSER
961 /* We can only change uid/gid as root ... */ 963 /* We can only change uid/gid as root ... */
962 if (getuid() == 0) { 964 if (getuid() == 0) {
963 965