1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
# DP: fix UserParameter execution with gid 0.
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
10
struct sigaction phan;
11
+ char user[7] = "zabbix";
13
/* running as root ?*/
14
if((0 == allow_root) && (0 == getuid() || 0 == getgid()))
16
- pwd = getpwnam("zabbix");
17
+ pwd = getpwnam(user);
20
zbx_error("User zabbix does not exist.");
21
zbx_error("Cannot run as root !");
24
- if( (setgid(pwd->pw_gid) ==-1) || (setuid(pwd->pw_uid) == -1) )
25
+ if( (setgid(pwd->pw_gid) ==-1) )
27
- zbx_error("Cannot setgid or setuid to zabbix [%s].", strerror(errno));
28
+ zbx_error("Cannot setgid to zabbix [%s].", strerror(errno));
32
+ if( (initgroups(user, pwd->pw_gid) == -1) )
34
+ zbx_error("Cannot initgroups to zabbix [%s].", strerror(errno));
38
+ if( (setuid(pwd->pw_uid) ==-1) )
40
+ zbx_error("Cannot setuid to zabbix [%s].", strerror(errno));