[330] in linux-security and linux-alert archive

home help back first fref pref prev next nref lref last post

problem with selection

daemon@ATHENA.MIT.EDU (Thomas Weber)
Mon Aug 28 06:05:36 1995

From: tom@pandemonium.saar.de (Thomas Weber)
To: linux-alert@tarsier.cv.nrao.edu
Date: Sat, 26 Aug 1995 05:07:46 +0200 (MET DST)

-----BEGIN PGP SIGNED MESSAGE-----

Hi there,

after installing selection (1.7) on a new system i noticed a problem with the 
way selection handels it's selection.pid file. 
Because the default is to install it suid-root and the default pid file
rests in /tmp any user can create or destroy any file on the disk
(like selection -k; cd /tmp; ln -s /etc/nologin selection.pid; selection).

This patch seems to fix the problem:

- --- selection-1.7-original/selection.c	Tue Aug  2 07:51:45 1994
+++ selection-1.7/selection.c	Sat Aug 26 02:26:12 1995
@@ -125,6 +125,12 @@
     if (fork())
     	exit(0);
     setsid();
+
+    if (unlink (PIDFILE) && (ENOENT != errno)) {
+	fprintf(stderr, "%s: Could not unlink PID file `%s', terminating.\n",
+	    progname, PIDFILE);
+	exit(1);
+    }
 
     if ((fp = fopen(PIDFILE, "w")) != (FILE *)NULL) {
 	fprintf(fp, "%d\n", getpid());


tschau,
  Tom
- -- 
i feel like a falling leaf / departed from my source of life
dipping into the ground    / to become one with the earth
todessehnsucht - wo bleibt die gerechtigkeit?     -atrocity-

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQCVAgUBMD6P+/PB96Cs1ZNdAQE4HwQAhDoO2E2hv096brzfuulxieW5yT0vuO/y
Rnw94BqBgvyES74NJCBvzBQZOsFqFFt+3plGdUAqaSpWjBxwh9XX2prB3j7i7/j1
N/VGWVfqCVTN6SI6j6Kx7unHuww9dvm5jDw1tR+edzZs7aWzZxpLr1en0Phr2mZn
wXT55gyp3wE=
=TuxG
-----END PGP SIGNATURE-----


home help back first fref pref prev next nref lref last post