--- usermode-1.85/userhelper.c.environment 2005-08-14 13:37:06.000000000 +0200 +++ usermode-1.85/userhelper.c 2007-03-23 19:07:14.000000000 +0100 @@ -1747,7 +1747,11 @@ char *env_home, *env_term, *env_desktop_startup_id; char *env_display, *env_shell; char *env_lang, *env_language, *env_lcall, *env_lcmsgs; - char *env_xauthority; + char *env_xauthority, *env_iceauthority; + char *env_secure_level, *env_rpm_install_lang; + char *env_lcctype, *env_lcnumeric, *env_lctime, *env_lccollate; + char *env_lcmonetary, *env_browser, *env_session_manager; + char *env_columns, *env_lines; int session, tryagain, gui, retval; struct stat sbuf; struct passwd *pwd; @@ -1770,7 +1774,19 @@ env_lcmsgs = getenv("LC_MESSAGES"); env_shell = getenv("SHELL"); env_term = getenv("TERM"); + env_columns = getenv("COLUMNS"); + env_lines = getenv("LINES"); env_xauthority = getenv("XAUTHORITY"); + env_rpm_install_lang = getenv("RPM_INSTALL_LANG"); + env_secure_level = getenv("SECURE_LEVEL"); + env_lcctype = getenv("LC_CTYPE"); + env_lcnumeric = getenv("LC_NUMERIC"); + env_lctime = getenv("LC_TIME"); + env_lccollate = getenv("LC_COLLATE"); + env_lcmonetary = getenv("LC_MONETARY"); + env_browser = getenv("BROWSER"); + env_session_manager = getenv("SESSION_MANAGER"); + env_iceauthority = getenv("ICEAUTHORITY"); /* Sanity-check the environment variables as best we can: those * which aren't path names shouldn't contain "/", and none of @@ -1811,10 +1827,69 @@ (strstr(env_term, "..") || strchr(env_term, '%'))) env_term = "dumb"; + if (env_columns&& + (strstr(env_columns, "/") || + strstr(env_columns, "..") || + strchr(env_columns, '%'))) + env_columns = "80"; + if (env_lines&& + (strstr(env_lines, "/") || + strstr(env_lines, "..") || + strchr(env_lines, '%'))) + env_lines = "25"; if (env_xauthority && (strstr(env_xauthority , "..") || strchr(env_xauthority , '%'))) env_xauthority = NULL; + if (env_rpm_install_lang && + (strstr(env_rpm_install_lang, "/") || + strstr(env_rpm_install_lang, "..") || + strchr(env_rpm_install_lang, '%'))) + env_rpm_install_lang = NULL; + if (env_secure_level && + (strstr(env_secure_level, "/") || + strstr(env_secure_level, "..") || + strchr(env_secure_level, '%'))) + env_secure_level = NULL; + if (env_lcctype && + (strstr(env_lcctype, "/") || + strstr(env_lcctype, "..") || + strchr(env_lcctype, '%'))) + env_lcctype = NULL; + if (env_lcnumeric && + (strstr(env_lcnumeric, "/") || + strstr(env_lcnumeric, "..") || + strchr(env_lcnumeric, '%'))) + env_lcnumeric = NULL; + if (env_lctime && + (strstr(env_lctime, "/") || + strstr(env_lctime, "..") || + strchr(env_lctime, '%'))) + env_lctime = NULL; + if (env_lccollate && + (strstr(env_lccollate, "/") || + strstr(env_lccollate, "..") || + strchr(env_lccollate, '%'))) + env_lccollate = NULL; + if (env_lcmonetary && + (strstr(env_lcmonetary, "/") || + strstr(env_lcmonetary, "..") || + strchr(env_lcmonetary, '%'))) + env_lcmonetary= NULL; + if (env_browser && + (strstr(env_browser, "/") || + strstr(env_browser, "..") || + strchr(env_browser, '%'))) + env_browser= NULL; + if (env_session_manager && + (strstr(env_session_manager, "..") || + strchr(env_session_manager, '%'))) + env_session_manager = NULL; + if (env_iceauthority && + (strstr(env_iceauthority , "..") || + strchr(env_iceauthority , '%'))) + env_iceauthority = NULL; + /* Wipe out the current environment. */ environ_save = environ; @@ -1836,6 +1911,17 @@ if (env_lcmsgs) setenv("LC_MESSAGES", env_lcmsgs, 1); if (env_shell) setenv("SHELL", env_shell, 1); if (env_term) setenv("TERM", env_term, 1); + if (env_columns) setenv("COLUMNS", env_columns, 1); + if (env_lines) setenv("LINES", env_lines, 1); + if (env_rpm_install_lang) setenv("RPM_INSALL_LANG", env_rpm_install_lang, 1); + if (env_secure_level) setenv("SECURE_LEVEL", env_secure_level, 1); + if (env_lcctype) setenv("LC_CTYPE", env_lcctype, 1); + if (env_lcnumeric) setenv("LC_NUMERIC", env_lcnumeric, 1); + if (env_lctime) setenv("LC_TIME", env_lctime, 1); + if (env_lccollate) setenv("LC_COLLATE", env_lccollate, 1); + if (env_lcmonetary) setenv("LC_MONETARY", env_lcmonetary, 1); + if (env_browser) setenv("BROWSER", env_browser, 1); + if (env_session_manager) setenv("SESSION_MANAGER", env_session_manager, 1); /* Set the PATH to a reasonaly safe list of directories. */ setenv("PATH", @@ -2125,6 +2211,10 @@ setenv("XAUTHORITY", env_xauthority, 1); } + if (env_iceauthority) { + setenv("ICEAUTHORITY", env_iceauthority, 1); + } + /* Open a session. */ retval = pam_open_session(data->pamh, 0); if (retval != PAM_SUCCESS) {