comparison svr-chansession.c @ 1824:1edf4f143e12

keep LANG env variable for child process (#111)
author fidomax <adobegitler@gmail.com>
date Thu, 19 Aug 2021 18:49:52 +0300
parents 5120e22882de
children c32976db772f
comparison
equal deleted inserted replaced
1823:401d7d8c8a79 1824:1edf4f143e12
929 /* Clean up, drop to user privileges, set up the environment and execute 929 /* Clean up, drop to user privileges, set up the environment and execute
930 * the command/shell. This function does not return. */ 930 * the command/shell. This function does not return. */
931 static void execchild(const void *user_data) { 931 static void execchild(const void *user_data) {
932 const struct ChanSess *chansess = user_data; 932 const struct ChanSess *chansess = user_data;
933 char *usershell = NULL; 933 char *usershell = NULL;
934 char *cp = NULL;
935 char *envcp = getenv("LANG");
936 if (envcp != NULL) {
937 cp = m_strdup(envcp);
938 }
934 939
935 /* with uClinux we'll have vfork()ed, so don't want to overwrite the 940 /* with uClinux we'll have vfork()ed, so don't want to overwrite the
936 * hostkey. can't think of a workaround to clear it */ 941 * hostkey. can't think of a workaround to clear it */
937 #if !DROPBEAR_VFORK 942 #if !DROPBEAR_VFORK
938 /* wipe the hostkey */ 943 /* wipe the hostkey */
989 addnewvar("USER", ses.authstate.pw_name); 994 addnewvar("USER", ses.authstate.pw_name);
990 addnewvar("LOGNAME", ses.authstate.pw_name); 995 addnewvar("LOGNAME", ses.authstate.pw_name);
991 addnewvar("HOME", ses.authstate.pw_dir); 996 addnewvar("HOME", ses.authstate.pw_dir);
992 addnewvar("SHELL", get_user_shell()); 997 addnewvar("SHELL", get_user_shell());
993 addnewvar("PATH", DEFAULT_PATH); 998 addnewvar("PATH", DEFAULT_PATH);
999 if (cp != NULL) {
1000 addnewvar("LANG", cp);
1001 m_free(cp);
1002 }
994 if (chansess->term != NULL) { 1003 if (chansess->term != NULL) {
995 addnewvar("TERM", chansess->term); 1004 addnewvar("TERM", chansess->term);
996 } 1005 }
997 1006
998 if (chansess->tty) { 1007 if (chansess->tty) {