~ubuntu-dev/ubuntu/lucid/zabbix/lucid-201002110857

« back to all changes in this revision

Viewing changes to debian/patches/CVE-2007-6210.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-06-04 09:22:37 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080604092237-zgwq7kmraj1oohoz
Tags: 1:1.4.5-1ubuntu1
* Merge from debian unstable, remaining changes: 
  + fixing missing pid directory in /var/run
* Added the same patch to debian/zabbix-server-{mysql,pgsql}.zabbix-server.init
  (LP: #172775)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
# DP: fix UserParameter execution with gid 0.
3
 
 
4
 
@DPATCH@
5
 
--- /home/abi/zabbix-1.4.2/src/libs/zbxnix/daemon.c     2007-08-20 21:22:22.000000000 +0200
6
 
+++ zabbix-1.4.2/src/libs/zbxnix/daemon.c       2007-11-25 15:53:31.890046746 +0100
7
 
@@ -90,20 +90,33 @@
8
 
        pid_t                   pid;
9
 
        struct passwd           *pwd;
10
 
        struct sigaction        phan;
11
 
+       char user[7] = "zabbix";
12
 
 
13
 
        /* running as root ?*/
14
 
        if((0 == allow_root) && (0 == getuid() || 0 == getgid()))
15
 
        {
16
 
-               pwd = getpwnam("zabbix");
17
 
+               pwd = getpwnam(user);
18
 
                if (NULL == pwd)
19
 
                {
20
 
                        zbx_error("User zabbix does not exist.");
21
 
                        zbx_error("Cannot run as root !");
22
 
                        exit(FAIL);
23
 
                }
24
 
-               if( (setgid(pwd->pw_gid) ==-1) || (setuid(pwd->pw_uid) == -1) )
25
 
+               if( (setgid(pwd->pw_gid) ==-1) )
26
 
                {
27
 
-                       zbx_error("Cannot setgid or setuid to zabbix [%s].", strerror(errno));
28
 
+                       zbx_error("Cannot setgid to zabbix [%s].", strerror(errno));
29
 
+                       exit(FAIL);
30
 
+               }
31
 
+
32
 
+               if( (initgroups(user, pwd->pw_gid) == -1) ) 
33
 
+               {
34
 
+                       zbx_error("Cannot initgroups to zabbix [%s].", strerror(errno));
35
 
+                       exit(FAIL);
36
 
+               }
37
 
+               
38
 
+               if( (setuid(pwd->pw_uid) ==-1) )
39
 
+               {
40
 
+                       zbx_error("Cannot setuid to zabbix [%s].", strerror(errno));
41
 
                        exit(FAIL);
42
 
                }
43