1 --- gs/src/imainarg.c.orig Mon Dec 6 08:11:52 1999
2 +++ gs/src/imainarg.c Thu Mar 30 23:01:34 2000
7 +/* Change by Torsten Landschoff <torsten@debian.org>:
8 + * We need to store the original rights when run with setuid so we can
9 + * regain privileges when opening the vga library for instance.
10 + * -- Thu, 30 Mar 2000 22:47:22 +0200 */
14 +uid_t privileged_uid;
15 +gid_t privileged_gid;
17 +/* --- end change --- */
19 /* Import operator procedures */
20 extern int zflush(P1(i_ctx_t *));
21 extern int zflushpage(P1(i_ctx_t *));
27 + /* Change by Torsten Landschoff <torsten@debian.org>:
28 + * We want to give up privileges as soon as possible when running suid.
29 + * Right, you would not want to run a piece of software as complex as
30 + * Ghostscript with setuid but you need to if you want to use the
31 + * svgalib as ordinary user.
32 + * -- Thu, 30 Mar 2000 22:46:19 +0200 */
34 + /* save privileges */
35 + privileged_uid = geteuid(); privileged_gid = getegid();
36 + /* give up privileges */
37 + seteuid( getuid() ); setegid( getgid() );
39 + /* --- end change --- */
41 gs_get_real_stdio(stdfiles);
42 arg_init(&args, (const char **)argv, argc,
43 --- gs/src/gdevl256.c.orig Mon Jan 11 07:38:07 1999
44 +++ gs/src/gdevl256.c Thu Mar 30 23:03:57 2000
49 +/* Change by Torsten Landschoff <torsten@debian.org>:
50 + * I changed imainarg.c to drop privileges as soon as possible when
51 + * running setuid. We need to get back elevated rights when we want
52 + * to open the vga library. Declare the two variables from imainarg.c
53 + * holding the privileges and include unistd.h for user management.
54 + * -- Thu, 30 Mar 2000 22:59:53 +0200 */
57 +extern uid_t privileged_uid;
58 +extern gid_t privileged_gid;
60 /* The color map for dynamically assignable colors. */
61 #define first_dc_index 64
62 private int next_dc_index;
67 + /* Change by Torsten Landschoff <torsten@debian.org>:
68 + * We need to restore the privileges we gave up in imainarg.c to open
70 + * -- Thu, 30 Mar 2000 23:03:12 +0200 */
72 + /* re-obtain privileges */
73 + seteuid( privileged_uid ); setegid( privileged_gid );
75 + /* give away privileges */
76 + seteuid( getuid() ); setegid( getgid() );
78 + /* --- end change --- */
80 vgamode = vga_getdefaultmode();
82 vgamode = G320x200x256;