Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37863356
en ru br
ALT Linux repositórios
S:1.1.3-alt1
5.0: 1.0.2-alt1
4.1: 1.0.1-alt2
4.0: 1.0.1-alt2

Group :: Sistema/X11
RPM: xload

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: xload-1.0.1-setuid.diff
Download


Index: xload.c
===================================================================
RCS file: /cvs/xorg/app/xload/xload.c,v
retrieving revision 1.2
diff -u -r1.2 xload.c
--- xload.c	23 Apr 2004 19:54:57 -0000	1.2
+++ xload.c	19 Jun 2006 21:32:20 -0000
@@ -34,7 +34,7 @@
  * xload - display system load average in a window
  */
 
-
+#include <errno.h>
 #include <stdio.h> 
 #include <stdlib.h>
 #include <unistd.h>
@@ -162,8 +162,17 @@
     /* For security reasons, we reset our uid/gid after doing the necessary
        system initialization and before calling any X routines. */
     InitLoadPoint();
-    setgid(getgid());		/* reset gid first while still (maybe) root */
-    setuid(getuid());
+    /* reset gid first while still (maybe) root */
+    if (setgid(getgid()) == -1) {
+	    fprintf(stderr, "%s: setgid failed: %s\n", 
+		ProgramName, strerror(errno));
+	    exit(1);
+    }
+    if (setuid(getuid()) == -1) {
+	    fprintf(stderr, "%s: setuid failed: %s\n", 
+		ProgramName, strerror(errno));
+	    exit(1);
+    }
 
     XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);
 
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009