static gid_t saved_egid;
#endif
+bool
+rxvt_tainted ()
+{
+#if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(__CYGWIN32__)
+ return getuid () != saved_euid || getgid () != saved_egid;
+#else
+ return false;
+#endif
+}
+
vector<rxvt_term *> rxvt_term::termlist;
static char curlocale[128], savelocale[128];
|| (rs[Rs_perl_ext_2] && *rs[Rs_perl_ext_2])
|| (rs[Rs_perl_eval] && *rs[Rs_perl_eval]))
{
- bool tainted = false;
-
#if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(__CYGWIN32__)
// ignore some perl-related arguments if some bozo installed us set[ug]id
- if (getuid () != saved_euid || getgid () != saved_egid)
+ if (rxvt_tainted ())
{
- tainted = true;
-
if ((rs[Rs_perl_lib] && *rs[Rs_perl_lib])
|| (rs[Rs_perl_eval] && *rs[Rs_perl_eval]))
{
rxvt_warn ("running with elevated privileges: ignoring perl-lib and perl-eval.\n");
- rs[Rs_perl_lib] = 0;
- rs[Rs_perl_eval] = "our $tainted = 1";
+ rs[Rs_perl_lib] = 0;
+ rs[Rs_perl_eval] = 0;
}
}
#endif
- rxvt_perl.init (tainted);
+ rxvt_perl.init ();
HOOK_INVOKE ((this, HOOK_INIT, DT_END));
}
#endif
bool should_invoke[HOOK_NUM];
- void init (bool tainted);
+ void init ();
bool invoke (rxvt_term *term, hook_type htype, ...);
void line_update (rxvt_term *term);
};
}
void
-rxvt_perl_interp::init (bool tainted)
+rxvt_perl_interp::init ()
{
if (!perl)
{
char *argv[] = {
"",
- "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1",
"-T",
+ "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1",
};
perl = perl_alloc ();
perl_construct (perl);
- if (perl_parse (perl, xs_init, 2 + !!tainted, argv, (char **)NULL)
+ if (perl_parse (perl, xs_init, 3, argv, (char **)NULL)
|| perl_run (perl))
{
rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n");