*** empty log message ***
authorroot <root>
Tue, 17 Jan 2006 16:22:41 +0000 (16:22 +0000)
committerroot <root>
Tue, 17 Jan 2006 16:22:41 +0000 (16:22 +0000)
18 files changed:
Changes
README.FAQ
README.configure
doc/rxvt.7.html
doc/rxvt.7.man.in
doc/rxvt.7.pod
doc/rxvt.7.txt
doc/rxvtperl.3.html
doc/rxvtperl.3.man.in
doc/rxvtperl.3.txt
src/main.C
src/perl/mark-urls
src/perl/selection
src/perl/selection-autotransform
src/perl/selection-popup
src/rxvtlib.h.in
src/rxvtperl.xs
src/urxvt.pm

diff --git a/Changes b/Changes
index c7ed78cc848ea4f7af4c794862cc63401a3e9dcd..8dae42d07b16ce4c2890662a8fb3d73d352b279b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -13,6 +13,12 @@ WISH: just for fun, do shade and tint with XRender.
 WISH: support tex fonts
 
 9.0
+        - improved security of setuid/setgid operation, which is now
+          encouraged, by moving privileged operations into a separate
+          process and permanently dropping privileges within the
+          terminal. This makes it possible to remove security checks from
+          the perl code and gives a much safer feeling when urxvt needs to
+          run with special privileges.
         - implemented perl:selection:remote-pastebin command in perl/selection
        - use the scrollback buffer even when the scroll region doesn't
           span the whole screen, as long as it starts at row 0.
index 7622ccc211207be0257d5a6cd7958cf40dec636f..fa901b141fb459ca8f24b193bd7aa8eb41a63526 100644 (file)
@@ -167,24 +167,21 @@ FREQUENTLY ASKED QUESTIONS
 
     I need to make it setuid/setgid to support utmp/ptys on my OS, is this
     safe?
-        Likely not. While I honestly try to make it secure, and am probably
-        not bad at it, I think it is simply unreasonable to expect all of
-        freetype + fontconfig + xft + xlib + perl + ... + rxvt-unicode
-        itself to all be secure. Also, rxvt-unicode disables some options
-        when it detects that it runs setuid or setgid, which is not nice.
-        Besides, with the embedded perl interpreter the possibility for
-        security problems easily multiplies.
-
-        Elevated privileges are only required for utmp and pty operations on
-        some systems (for example, GNU/Linux doesn't need any extra
-        privileges for ptys, but some need it for utmp support). It is
-        planned to mvoe this into a forked handler process, but this is not
-        yet done.
-
-        So, while setuid/setgid operation is supported and not a problem on
-        your typical single-user-no-other-logins unix desktop, always
-        remember that its an awful lot of code, most of which isn't checked
-        for security issues regularly.
+        It should be, starting with release 7.1. You are encouraged to
+        properly install urxvt with privileges necessary for your OS now.
+
+        When rxvt-unicode detects that it runs setuid or setgid, it will
+        fork into a helper process for privileged operations (pty handling
+        on some systems, utmp/wtmp/lastlog handling on others) and drop
+        privileges immediately. This is much safer than most other terminals
+        that keep privileges while running (but is more relevant to urxvt,
+        as it contains things as perl interpreters, which might be "helpful"
+        to attackers).
+
+        This forking is done as the very first within main(), which is very
+        early and reduces possible bugs to initialisation code run before
+        main(), or things like the dynamic loader of your system, which
+        should result in very little risk.
 
     When I log-in to another system it tells me about missing terminfo data?
         The terminal description used by rxvt-unicode is not as widely
index a6dadd9e432706912dfe55fd1b61b87427c2d7fc..64c537361a9ffa10d04d527cd3e47705a86c3e23 100644 (file)
@@ -135,10 +135,6 @@ CONFIGURE OPTIONS
         the favourite of the rxvt-unicode author, having used it for many
         years.
 
-    --enable-half-shadow (default: off)
-        Make shadows on the scrollbar only half the normal width & height.
-        only applicable to rxvt scrollbars.
-
     --enable-ttygid (default: off)
         Change tty device setting to group "tty" - only use this if your
         system uses this type of security.
index a1464c72aba10015dd3f89c62fea135d221c3311..c7c3b1279121d731f7eba8179f416d07f1ac8dad 100644 (file)
@@ -283,24 +283,22 @@ encodings built-in that increase download times and are rarely used).</p>
 <dt><strong><a name="item_i_need_to_make_it_setuid_2fsetgid_to_support_utmp_">I need to make it setuid/setgid to support utmp/ptys on my OS, is this safe?</a></strong><br />
 </dt>
 <dd>
-Likely not. While I honestly try to make it secure, and am probably not
-bad at it, I think it is simply unreasonable to expect all of freetype
-+ fontconfig + xft + xlib + perl + ... + rxvt-unicode itself to all be
-secure. Also, rxvt-unicode disables some options when it detects that it
-runs setuid or setgid, which is not nice. Besides, with the embedded perl
-interpreter the possibility for security problems easily multiplies.
+It should be, starting with release 7.1. You are encouraged to properly
+install urxvt with privileges necessary for your OS now.
 </dd>
 <dd>
-<p>Elevated privileges are only required for utmp and pty operations on some
-systems (for example, GNU/Linux doesn't need any extra privileges for
-ptys, but some need it for utmp support). It is planned to mvoe this into
-a forked handler process, but this is not yet done.</p>
+<p>When rxvt-unicode detects that it runs setuid or setgid, it will fork
+into a helper process for privileged operations (pty handling on some
+systems, utmp/wtmp/lastlog handling on others) and drop privileges
+immediately. This is much safer than most other terminals that keep
+privileges while running (but is more relevant to urxvt, as it contains
+things as perl interpreters, which might be ``helpful'' to attackers).</p>
 </dd>
 <dd>
-<p>So, while setuid/setgid operation is supported and not a problem on your
-typical single-user-no-other-logins unix desktop, always remember that
-its an awful lot of code, most of which isn't checked for security issues
-regularly.</p>
+<p>This forking is done as the very first within main(), which is very early
+and reduces possible bugs to initialisation code run before main(), or
+things like the dynamic loader of your system, which should result in very
+little risk.</p>
 </dd>
 <p></p>
 <dt><strong><a name="item_when_i_log_2din_to_another_system_it_tells_me_abou">When I log-in to another system it tells me about missing terminfo data?</a></strong><br />
@@ -2362,13 +2360,6 @@ is the favourite of the rxvt-unicode author, having used it for
 many years.
 </dd>
 <p></p>
-<dt><strong><a name="item_shadow">--enable-half-shadow (default: off)</a></strong><br />
-</dt>
-<dd>
-Make shadows on the scrollbar only half the normal width &amp; height.
-only applicable to rxvt scrollbars.
-</dd>
-<p></p>
 <dt><strong><a name="item_ttygid">--enable-ttygid (default: off)</a></strong><br />
 </dt>
 <dd>
index 4721ad3d4d74614737458ac11590e3671a527ce8..d563d13626e4163917c79936d31dd8afc90b69a5 100644 (file)
 .\" ========================================================================
 .\"
 .IX Title "rxvt 7"
-.TH rxvt 7 "2006-01-16" "7.0" "RXVT-UNICODE"
+.TH rxvt 7 "2006-01-17" "7.1" "RXVT-UNICODE"
 .SH "NAME"
 RXVT REFERENCE \- FAQ, command sequences and other background information
 .SH "SYNOPSIS"
@@ -334,22 +334,20 @@ one with \f(CW\*(C`\-\-disable\-everything\*(C'\fR (very useful) and a maximal o
 encodings built-in that increase download times and are rarely used).
 .IP "I need to make it setuid/setgid to support utmp/ptys on my \s-1OS\s0, is this safe?" 4
 .IX Item "I need to make it setuid/setgid to support utmp/ptys on my OS, is this safe?"
-Likely not. While I honestly try to make it secure, and am probably not
-bad at it, I think it is simply unreasonable to expect all of freetype
-+ fontconfig + xft + xlib + perl + ... + rxvt-unicode itself to all be
-secure. Also, rxvt-unicode disables some options when it detects that it
-runs setuid or setgid, which is not nice. Besides, with the embedded perl
-interpreter the possibility for security problems easily multiplies.
-.Sp
-Elevated privileges are only required for utmp and pty operations on some
-systems (for example, GNU/Linux doesn't need any extra privileges for
-ptys, but some need it for utmp support). It is planned to mvoe this into
-a forked handler process, but this is not yet done.
-.Sp
-So, while setuid/setgid operation is supported and not a problem on your
-typical single-user-no-other-logins unix desktop, always remember that
-its an awful lot of code, most of which isn't checked for security issues
-regularly.
+It should be, starting with release 7.1. You are encouraged to properly
+install urxvt with privileges necessary for your \s-1OS\s0 now.
+.Sp
+When rxvt-unicode detects that it runs setuid or setgid, it will fork
+into a helper process for privileged operations (pty handling on some
+systems, utmp/wtmp/lastlog handling on others) and drop privileges
+immediately. This is much safer than most other terminals that keep
+privileges while running (but is more relevant to urxvt, as it contains
+things as perl interpreters, which might be \*(L"helpful\*(R" to attackers).
+.Sp
+This forking is done as the very first within \fImain()\fR, which is very early
+and reduces possible bugs to initialisation code run before \fImain()\fR, or
+things like the dynamic loader of your system, which should result in very
+little risk.
 .IP "When I log-in to another system it tells me about missing terminfo data?" 4
 .IX Item "When I log-in to another system it tells me about missing terminfo data?"
 The terminal description used by rxvt-unicode is not as widely available
@@ -2129,10 +2127,6 @@ Add support for an Xterm-like scrollbar.
 Add support for a very unobtrusive, plain-looking scrollbar that
 is the favourite of the rxvt-unicode author, having used it for
 many years.
-.IP "\-\-enable\-half\-shadow (default: off)" 4
-.IX Item "--enable-half-shadow (default: off)"
-Make shadows on the scrollbar only half the normal width & height.
-only applicable to rxvt scrollbars.
 .IP "\-\-enable\-ttygid (default: off)" 4
 .IX Item "--enable-ttygid (default: off)"
 Change tty device setting to group \*(L"tty\*(R" \- only use this if
index 156274da194814f5cb4a6eecc2abf51bee60c1f9..570e00a160b14b07db6ce442adbd2120e0b36201 100644 (file)
@@ -196,22 +196,20 @@ encodings built-in that increase download times and are rarely used).
 
 =item I need to make it setuid/setgid to support utmp/ptys on my OS, is this safe?
 
-Likely not. While I honestly try to make it secure, and am probably not
-bad at it, I think it is simply unreasonable to expect all of freetype
-+ fontconfig + xft + xlib + perl + ... + rxvt-unicode itself to all be
-secure. Also, rxvt-unicode disables some options when it detects that it
-runs setuid or setgid, which is not nice. Besides, with the embedded perl
-interpreter the possibility for security problems easily multiplies.
-
-Elevated privileges are only required for utmp and pty operations on some
-systems (for example, GNU/Linux doesn't need any extra privileges for
-ptys, but some need it for utmp support). It is planned to mvoe this into
-a forked handler process, but this is not yet done.
-
-So, while setuid/setgid operation is supported and not a problem on your
-typical single-user-no-other-logins unix desktop, always remember that
-its an awful lot of code, most of which isn't checked for security issues
-regularly.
+It should be, starting with release 7.1. You are encouraged to properly
+install urxvt with privileges necessary for your OS now.
+
+When rxvt-unicode detects that it runs setuid or setgid, it will fork
+into a helper process for privileged operations (pty handling on some
+systems, utmp/wtmp/lastlog handling on others) and drop privileges
+immediately. This is much safer than most other terminals that keep
+privileges while running (but is more relevant to urxvt, as it contains
+things as perl interpreters, which might be "helpful" to attackers).
+
+This forking is done as the very first within main(), which is very early
+and reduces possible bugs to initialisation code run before main(), or
+things like the dynamic loader of your system, which should result in very
+little risk.
 
 =item When I log-in to another system it tells me about missing terminfo data?
 
index b805c7c967c7d75ef362e172b2e2cd51bb02e154..810fab1adb588eec7508df2cb6cffd26adcce23d 100644 (file)
@@ -188,24 +188,21 @@ FREQUENTLY ASKED QUESTIONS
 
     I need to make it setuid/setgid to support utmp/ptys on my OS, is this
     safe?
-        Likely not. While I honestly try to make it secure, and am probably
-        not bad at it, I think it is simply unreasonable to expect all of
-        freetype + fontconfig + xft + xlib + perl + ... + rxvt-unicode
-        itself to all be secure. Also, rxvt-unicode disables some options
-        when it detects that it runs setuid or setgid, which is not nice.
-        Besides, with the embedded perl interpreter the possibility for
-        security problems easily multiplies.
-
-        Elevated privileges are only required for utmp and pty operations on
-        some systems (for example, GNU/Linux doesn't need any extra
-        privileges for ptys, but some need it for utmp support). It is
-        planned to mvoe this into a forked handler process, but this is not
-        yet done.
-
-        So, while setuid/setgid operation is supported and not a problem on
-        your typical single-user-no-other-logins unix desktop, always
-        remember that its an awful lot of code, most of which isn't checked
-        for security issues regularly.
+        It should be, starting with release 7.1. You are encouraged to
+        properly install urxvt with privileges necessary for your OS now.
+
+        When rxvt-unicode detects that it runs setuid or setgid, it will
+        fork into a helper process for privileged operations (pty handling
+        on some systems, utmp/wtmp/lastlog handling on others) and drop
+        privileges immediately. This is much safer than most other terminals
+        that keep privileges while running (but is more relevant to urxvt,
+        as it contains things as perl interpreters, which might be "helpful"
+        to attackers).
+
+        This forking is done as the very first within main(), which is very
+        early and reduces possible bugs to initialisation code run before
+        main(), or things like the dynamic loader of your system, which
+        should result in very little risk.
 
     When I log-in to another system it tells me about missing terminfo data?
         The terminal description used by rxvt-unicode is not as widely
@@ -1648,10 +1645,6 @@ CONFIGURE OPTIONS
         the favourite of the rxvt-unicode author, having used it for many
         years.
 
-    --enable-half-shadow (default: off)
-        Make shadows on the scrollbar only half the normal width & height.
-        only applicable to rxvt scrollbars.
-
     --enable-ttygid (default: off)
         Change tty device setting to group "tty" - only use this if your
         system uses this type of security.
index 658bbd482d16ec466ad34038623c582e8ee42145..ea805bce3eb594a4c8822d7c84d093c8f6897453 100644 (file)
@@ -122,7 +122,7 @@ between two vertical bars:</p>
 interesting uses, such as parsing a line from beginning to end.</p>
 </dd>
 <dd>
-<p>This extension also offers the following bindable keyboard command:</p>
+<p>This extension also offers following bindable keyboard commands:</p>
 </dd>
 <dl>
 <dt><strong><a name="item_rot13">rot13</a></strong><br />
@@ -134,6 +134,33 @@ Rot-13 the selection when activated. Used via keyboard trigger:
 <pre>
    URxvt.keysym.C-M-r: perl:selection:rot13</pre>
 </dd>
+<p></p>
+<dt><strong><a name="item_remote_2dpastebin">remote-pastebin</a></strong><br />
+</dt>
+<dd>
+Upload the selection as textfile to a remote site.
+</dd>
+<dd>
+<pre>
+   URxvt.keysym.C-M-e: perl:selection:remote-pastebin</pre>
+</dd>
+<dd>
+<p>To set the command to upload the file set this resource:</p>
+</dd>
+<dd>
+<pre>
+   URxvt.selection-pastebin-cmd: rsync -apP % ruth:/var/www/www.ta-sa.org/files/txt/.</pre>
+</dd>
+<dd>
+<p>The % is the placeholder for the textfile. The name of the textfile is the hex encoded 
+md5 sum of the selection.
+After an successful upload the selection will be replaced by the following url 
+(the % is the placeholder for the filename):</p>
+</dd>
+<dd>
+<pre>
+   URxvt.selection-pastebin-url: <a href="http://www.ta-sa.org/files/txt/%">http://www.ta-sa.org/files/txt/%</a></pre>
+</dd>
 <p></p></dl>
 <dt><strong><a name="item_popup">option-popup (enabled by default)</a></strong><br />
 </dt>
@@ -604,14 +631,6 @@ correct place, e.g. on stderr of the connecting urxvtc client.</p>
 <p>Messages have a size limit of 1023 bytes currently.</p>
 </dd>
 <p></p>
-<dt><strong><a name="item__24is_safe__3d_urxvt_3a_3asafe">$is_safe = urxvt::safe</a></strong><br />
-</dt>
-<dd>
-Returns true when it is safe to do potentially unsafe things, such as
-evaluating perl code specified by the user. This is true when urxvt was
-started setuid or setgid.
-</dd>
-<p></p>
 <dt><strong><a name="item__24time__3d_urxvt_3a_3anow">$time = urxvt::NOW</a></strong><br />
 </dt>
 <dd>
index 78488f4dde64fdefcc6bb72e553590395ebef677..6eb92a0caf0a4281f48cab52c79818ad228cab67 100644 (file)
 .\" ========================================================================
 .\"
 .IX Title "rxvt 3"
-.TH rxvt 3 "2006-01-16" "7.0" "RXVT-UNICODE"
+.TH rxvt 3 "2006-01-17" "7.1" "RXVT-UNICODE"
 .SH "NAME"
 @@RXVT_NAME@@perl \- rxvt\-unicode's embedded perl interpreter
 .SH "SYNOPSIS"
@@ -205,7 +205,7 @@ between two vertical bars:
 You can look at the source of the selection extension to see more
 interesting uses, such as parsing a line from beginning to end.
 .Sp
-This extension also offers the following bindable keyboard command:
+This extension also offers following bindable keyboard commands:
 .RS 4
 .IP "rot13" 4
 .IX Item "rot13"
@@ -214,6 +214,28 @@ Rot\-13 the selection when activated. Used via keyboard trigger:
 .Vb 1
 \&   URxvt.keysym.C-M-r: perl:selection:rot13
 .Ve
+.IP "remote-pastebin" 4
+.IX Item "remote-pastebin"
+Upload the selection as textfile to a remote site.
+.Sp
+.Vb 1
+\&   URxvt.keysym.C-M-e: perl:selection:remote-pastebin
+.Ve
+.Sp
+To set the command to upload the file set this resource:
+.Sp
+.Vb 1
+\&   URxvt.selection-pastebin-cmd: rsync -apP % ruth:/var/www/www.ta-sa.org/files/txt/.
+.Ve
+.Sp
+The % is the placeholder for the textfile. The name of the textfile is the hex encoded 
+md5 sum of the selection.
+After an successful upload the selection will be replaced by the following url 
+(the % is the placeholder for the filename):
+.Sp
+.Vb 1
+\&   URxvt.selection-pastebin-url: http://www.ta-sa.org/files/txt/%
+.Ve
 .RE
 .RS 4
 .RE
@@ -580,11 +602,6 @@ Using this function has the advantage that its output ends up in the
 correct place, e.g. on stderr of the connecting urxvtc client.
 .Sp
 Messages have a size limit of 1023 bytes currently.
-.IP "$is_safe = urxvt::safe" 4
-.IX Item "$is_safe = urxvt::safe"
-Returns true when it is safe to do potentially unsafe things, such as
-evaluating perl code specified by the user. This is true when urxvt was
-started setuid or setgid.
 .IP "$time = urxvt::NOW" 4
 .IX Item "$time = urxvt::NOW"
 Returns the \*(L"current time\*(R" (as per the event loop).
index d36bf8c9409cfd64ec1163563f1ee2560f778268..e64f51b5aafd84c0dc8573425633fc1181ff90b8 100644 (file)
@@ -59,13 +59,29 @@ PREPACKAGED EXTENSIONS
         You can look at the source of the selection extension to see more
         interesting uses, such as parsing a line from beginning to end.
 
-        This extension also offers the following bindable keyboard command:
+        This extension also offers following bindable keyboard commands:
 
         rot13
             Rot-13 the selection when activated. Used via keyboard trigger:
 
                URxvt.keysym.C-M-r: perl:selection:rot13
 
+        remote-pastebin
+            Upload the selection as textfile to a remote site.
+
+               URxvt.keysym.C-M-e: perl:selection:remote-pastebin
+
+            To set the command to upload the file set this resource:
+
+               URxvt.selection-pastebin-cmd: rsync -apP % ruth:/var/www/www.ta-sa.org/files/txt/.
+
+            The % is the placeholder for the textfile. The name of the
+            textfile is the hex encoded md5 sum of the selection. After an
+            successful upload the selection will be replaced by the
+            following url (the % is the placeholder for the filename):
+
+               URxvt.selection-pastebin-url: http://www.ta-sa.org/files/txt/%
+
     option-popup (enabled by default)
         Binds a popup menu to Ctrl-Button2 that lets you toggle (some)
         options at runtime.
@@ -387,11 +403,6 @@ API DOCUMENTATION
 
         Messages have a size limit of 1023 bytes currently.
 
-    $is_safe = urxvt::safe
-        Returns true when it is safe to do potentially unsafe things, such
-        as evaluating perl code specified by the user. This is true when
-        urxvt was started setuid or setgid.
-
     $time = urxvt::NOW
         Returns the "current time" (as per the event loop).
 
index f8fd9795e11040f5af7c92d053fa22bee2fbb098..c58b094e72cadaf85d722cd71d55549b3e9ca78e 100644 (file)
 # include <termios.h>
 #endif
 
-#if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(__CYGWIN32__)
-static uid_t saved_euid;
-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];
@@ -489,19 +474,6 @@ rxvt_term::init (int argc, const char *const *argv)
       || (rs[Rs_perl_ext_2] && *rs[Rs_perl_ext_2])
       || (rs[Rs_perl_eval] && *rs[Rs_perl_eval]))
     {
-#if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(__CYGWIN32__)
-      // ignore some perl-related arguments if some bozo installed us set[ug]id
-      if (rxvt_tainted ())
-        {
-          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] = 0;
-            }
-        }
-#endif
       rxvt_perl.init (this);
       HOOK_INVOKE ((this, HOOK_INIT, DT_END));
     }
@@ -632,16 +604,6 @@ rxvt_init ()
 
   rxvt_environ = environ;
 
-  /*
-   * Save and then give up any super-user privileges
-   * If we need privileges in any area then we must specifically request it.
-   * We should only need to be root in these cases:
-   *  1.  write utmp entries on some systems
-   *  2.  chown tty on some systems
-   */
-  rxvt_privileges (SAVE);
-  rxvt_privileges (IGNORE);
-
   signal (SIGHUP,  SIG_IGN);
   signal (SIGPIPE, SIG_IGN);
 
@@ -695,56 +657,6 @@ rxvt_realloc (void *ptr, size_t size)
   return p;
 }
 
-/* ------------------------------------------------------------------------- *
- *                            PRIVILEGED OPERATIONS                          *
- * ------------------------------------------------------------------------- */
-/* take care of suid/sgid super-user (root) privileges */
-void
-rxvt_privileges (rxvt_privaction action)
-{
-#if ! defined(__CYGWIN32__)
-# if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
-  /* setreuid () is the poor man's setuid (), seteuid () */
-#  define seteuid(a)    setreuid(-1, (a))
-#  define setegid(a)    setregid(-1, (a))
-#  define HAVE_SETEUID
-# endif
-# ifdef HAVE_SETEUID
-  switch (action)
-    {
-      case IGNORE:
-        /*
-         * change effective uid/gid - not real uid/gid - so we can switch
-         * back to root later, as required
-         */
-        setegid (getgid ());
-        seteuid (getuid ());
-        break;
-      case SAVE:
-        saved_egid = getegid ();
-        saved_euid = geteuid ();
-        break;
-      case RESTORE:
-        setegid (saved_egid);
-        seteuid (saved_euid);
-        break;
-    }
-# else
-  switch (action)
-    {
-      case IGNORE:
-        setgid (getgid ());
-        setuid (getuid ());
-        /* FALLTHROUGH */
-      case SAVE:
-        /* FALLTHROUGH */
-      case RESTORE:
-        break;
-    }
-# endif
-#endif
-}
-
 /*----------------------------------------------------------------------*/
 /*
  * window size/position calculcations for XSizeHint and other storage.
index 68fea189d891759ea3914955cf477f89234f4367..d1245903b56521c513954e667ad92f51103d0365 100644 (file)
@@ -10,7 +10,7 @@ my $url =
 sub on_start {
    my ($self) = @_;
 
-   $self->{browser} = urxvt::untaint $self->x_resource ("urlLauncher") || "x-www-browser";
+   $self->{browser} = $self->x_resource ("urlLauncher") || "x-www-browser";
 
    ()
 }
index a87c6d6721219541bba45adc3334236ab369b0f2..26f5277c4a6ad0770e7b9302736b9152af24d7eb 100644 (file)
@@ -7,12 +7,10 @@ my $pastebin_url;
 
 sub on_start {
    my ($self) = @_;
-   $pastebin_cmd =
-      (urxvt::untaint $self->x_resource ("selection-pastebin-cmd"))
+   $pastebin_cmd = $self->x_resource ("selection-pastebin-cmd")
       or "scp -p % ruth:/var/www/www.ta-sa.org/files/txt/";
 
-   $pastebin_url = 
-      (urxvt::untaint $self->x_resource ("selection-pastebin-url"))
+   $pastebin_url = $self->x_resource ("selection-pastebin-url")
       or "http://www.ta-sa.org/files/txt/";
    ();
 }
index 22d5bbb68528c7967a86932e80eccfe51f9ff204..6bc3a3f5e66b38498968898681191881c753b476 100644 (file)
@@ -14,12 +14,7 @@ sub msg {
 sub on_init {
    my ($self) = @_;
 
-   unless (urxvt::safe) {
-      warn "running with elevated privileges, ignoring selection-autotransform patterns";
-      return;
-   }
-
-   for (my $idx = 0; defined (my $res = urxvt::untaint $self->x_resource ("selection-autotransform.$idx")); $idx++) {
+   for (my $idx = 0; defined (my $res = $self->x_resource ("selection-autotransform.$idx")); $idx++) {
       $res = $self->locale_decode ($res);
       my $transform = eval "sub { $res }";
 
index 825dfaa9821521847ff1d69f96953dabedfa3811..c50d520ca80363bf568b017684f8798a844128ca 100644 (file)
@@ -14,7 +14,7 @@ sub msg {
 sub on_start {
    my ($self) = @_;
 
-   $self->{browser} = urxvt::untaint $self->x_resource ("urlLauncher") || "x-www-browser";
+   $self->{browser} = $self->x_resource ("urlLauncher") || "x-www-browser";
 
    $self->grab_button (3, urxvt::ControlMask);
 
@@ -57,9 +57,7 @@ sub on_button_press {
 
       for ($text) {
          $add_button->("rot13" => sub { y/A-Za-z/N-ZA-Mn-za-m/ });
-
-         urxvt::safe
-            and $add_button->("eval perl expression" => sub { no warnings; $_ = eval urxvt::untaint $_ });
+         $add_button->("eval perl expression" => sub { no warnings; $_ = eval $_ });
 
          /^(\S+):(\d+):?$/
             and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ });
index 6e8db26896a42dc8f73156a590e59bf8a36f7ea3..1ee48fff0e758089daf18d4f3e989813a3a7584e 100644 (file)
@@ -254,7 +254,6 @@ struct rxvt_vars : TermWin_t {
 };
 
 void rxvt_init ();
-bool rxvt_tainted ();
 
 #endif                          /* _RXVTLIB_H_ */
 
index 4693af34896c3cc042f5d6e91999f5eac26811e8..975a5eb3b362049102d1075582e499563a732aff 100644 (file)
 
 /////////////////////////////////////////////////////////////////////////////
 
-static SV *
-taint (SV *sv)
-{
-  SvTAINT (sv);
-  return sv;
-}
-
-static SV *
-taint_if (SV *sv, SV *src)
-{
-  if (SvTAINTED (src))
-    SvTAINT (sv);
-
-  return sv;
-}
-
 static wchar_t *
 sv2wcs (SV *sv)
 {
@@ -420,14 +404,13 @@ rxvt_perl_interp::init (rxvt_term *term)
 
       char *argv[] = {
         "",
-        "-T",
         "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1",
       };
 
       perl = perl_alloc ();
       perl_construct (perl);
 
-      if (perl_parse (perl, xs_init, 3, argv, (char **)NULL)
+      if (perl_parse (perl, xs_init, 2, argv, (char **)NULL)
           || perl_run (perl))
         {
           rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n");
@@ -520,7 +503,7 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
                 break;
 
               case DT_STR:
-                XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0))));
+                XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0)));
                 break;
 
               case DT_STR_LEN:
@@ -528,7 +511,7 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
                   char *str = va_arg (ap, char *);
                   int len = va_arg (ap, int);
 
-                  XPUSHs (taint (sv_2mortal (newSVpvn (str, len))));
+                  XPUSHs (sv_2mortal (newSVpvn (str, len)));
                 }
                 break;
 
@@ -537,7 +520,7 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
                   wchar_t *wstr = va_arg (ap, wchar_t *);
                   int wlen = va_arg (ap, int);
 
-                  XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen))));
+                  XPUSHs (sv_2mortal (wcs2sv (wstr, wlen)));
                 }
                break;
 
@@ -784,24 +767,9 @@ fatal (const char *msg)
        CODE:
         rxvt_fatal ("%s", msg);
 
-SV *
-untaint (SV *sv)
-       CODE:
-        RETVAL = newSVsv (sv);
-        SvTAINTED_off (RETVAL);
-        OUTPUT:
-        RETVAL
-
 void
 _exit (int status)
 
-bool
-safe ()
-       CODE:
-        RETVAL = !rxvt_tainted ();
-        OUTPUT:
-        RETVAL
-
 NV
 NOW ()
        CODE:
@@ -1076,7 +1044,7 @@ rxvt_term::locale_encode (SV *str)
 
         free (wstr);
 
-        RETVAL = taint_if (newSVpv (mbstr, 0), str);
+        RETVAL = newSVpv (mbstr, 0);
         free (mbstr);
 }
        OUTPUT:
@@ -1093,7 +1061,7 @@ rxvt_term::locale_decode (SV *octets)
         wchar_t *wstr = rxvt_mbstowcs (data, len);
         rxvt_pop_locale ();
 
-        RETVAL = taint_if (wcs2sv (wstr), octets);
+        RETVAL = wcs2sv (wstr);
         free (wstr);
 }
        OUTPUT:
@@ -1255,7 +1223,7 @@ rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start
             for (int col = 0; col < THIS->ncol; col++)
               wstr [col] = l.t [col];
 
-            XPUSHs (taint (sv_2mortal (wcs2sv (wstr, THIS->ncol))));
+            XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol)));
 
             delete [] wstr;
           }
@@ -1386,7 +1354,7 @@ rxvt_term::special_encode (SV *string)
 
        rxvt_pop_locale ();
 
-        RETVAL = taint_if (wcs2sv (rstr, r - rstr), string);
+        RETVAL = wcs2sv (rstr, r - rstr);
 
         delete [] rstr;
 }
@@ -1422,7 +1390,7 @@ rxvt_term::special_decode (SV *text)
           else
             *r++ = *s;
 
-        RETVAL = taint_if (wcs2sv (rstr, r - rstr), text);
+        RETVAL = wcs2sv (rstr, r - rstr);
 
         delete [] rstr;
 }
@@ -1454,7 +1422,7 @@ rxvt_term::_resource (char *name, int index, SV *newval = 0)
           croak ("requested out-of-bound resource %s+%d,", name, index - rs->value);
 
         if (GIMME_V != G_VOID)
-          XPUSHs (THIS->rs [index] ? sv_2mortal (taint (newSVpv (THIS->rs [index], 0))) : &PL_sv_undef);
+          XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef);
 
         if (newval)
           {
@@ -1471,8 +1439,6 @@ rxvt_term::_resource (char *name, int index, SV *newval = 0)
 
 const char *
 rxvt_term::x_resource (const char *name)
-       CLEANUP:
-        SvTAINTED_on (ST (0));
 
 bool
 rxvt_term::option (U32 optval, int set = -1)
@@ -1576,7 +1542,7 @@ rxvt_term::selection (SV *newtext = 0)
 {
         if (GIMME_V != G_VOID)
           XPUSHs (THIS->selection.text
-                  ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)))
+                  ? sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))
                   : &PL_sv_undef);
 
         if (newtext)
index 368a3dae456d623451ce7c364173812c7f5fb2bd..f2cadb826a7d74a91869387e81f31b2b0b30de23 100644 (file)
@@ -500,12 +500,6 @@ correct place, e.g. on stderr of the connecting urxvtc client.
 
 Messages have a size limit of 1023 bytes currently.
 
-=item $is_safe = urxvt::safe
-
-Returns true when it is safe to do potentially unsafe things, such as
-evaluating perl code specified by the user. This is true when urxvt was
-started setuid or setgid.
-
 =item $time = urxvt::NOW
 
 Returns the "current time" (as per the event loop).
@@ -630,7 +624,7 @@ sub extension_package($) {
       open my $fh, "<:raw", $path
          or die "$path: $!";
 
-      my $source = untaint
+      my $source =
          "package $pkg; use strict; use utf8;\n"
          . "use base urxvt::term::extension::;\n"
          . "#line 1 \"$path\"\n{\n"