ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/main.C
(Generate patch)

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.195 by root, Sun Jan 22 00:48:13 2006 UTC vs.
Revision 1.196 by root, Sun Jan 22 04:01:52 2006 UTC

474#ifdef HAVE_SCROLLBARS 474#ifdef HAVE_SCROLLBARS
475 if (OPTION (Opt_scrollBar)) 475 if (OPTION (Opt_scrollBar))
476 scrollBar.setIdle (); /* set existence for size calculations */ 476 scrollBar.setIdle (); /* set existence for size calculations */
477#endif 477#endif
478 478
479 pty = ptytty_new (); 479 pty = ptytty::create ();
480 480
481 create_windows (argc, argv); 481 create_windows (argc, argv);
482 482
483 dDisp; 483 dDisp;
484 484
550char **rxvt_environ; // startup environment 550char **rxvt_environ; // startup environment
551 551
552void 552void
553rxvt_init () 553rxvt_init ()
554{ 554{
555 uid_t uid = getuid (); 555 ptytty::init ();
556 gid_t gid = getgid ();
557
558 // before doing anything else, check for setuid/setgid operation,
559 // start the helper process and drop privileges
560 if (uid != geteuid ()
561 || gid != getegid ())
562 {
563#if PTYTTY_HELPER
564 ptytty_server ();
565#else
566 rxvt_warn ("running setuid/setgid without pty helper compiled in, continuing unprivileged.\n");
567#endif
568
569 // drop privileges
570#if HAVE_SETRESUID
571 setresgid (gid, gid, gid);
572 setresuid (uid, uid, uid);
573#elif HAVE_SETREUID
574 setregid (gid, gid);
575 setreuid (uid, uid);
576#elif HAVE_SETUID
577 setgid (gid);
578 setuid (uid);
579#endif
580
581 if (uid != geteuid ()
582 || gid != getegid ())
583 rxvt_fatal ("unable to drop privileges, aborting.\n");
584 }
585 556
586 rxvt_environ = environ; 557 rxvt_environ = environ;
587 558
588 signal (SIGHUP, SIG_IGN); 559 signal (SIGHUP, SIG_IGN);
589 signal (SIGPIPE, SIG_IGN); 560 signal (SIGPIPE, SIG_IGN);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines