Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 418351 | Differences between
and this patch

Collapse All | Expand All

(-)a/ulogd.c (-2 / +31 lines)
Lines 87-92 Link Here
87
#define ULOGD_CONFIGFILE	"/etc/ulogd.conf"
87
#define ULOGD_CONFIGFILE	"/etc/ulogd.conf"
88
#endif
88
#endif
89
89
90
/* default user to run as or "" */
91
#ifndef ULOGD_USER_DEFAULT
92
#define ULOGD_USER_DEFAULT	""
93
#endif
94
90
/* global variables */
95
/* global variables */
91
static struct ipulog_handle *libulog_h;	/* our libipulog handle */
96
static struct ipulog_handle *libulog_h;	/* our libipulog handle */
92
static unsigned char* libulog_buf;	/* the receive buffer */
97
static unsigned char* libulog_buf;	/* the receive buffer */
Lines 545-551 static config_entry_t nlgroup_ce = { &plugin_ce, "nlgroup", CONFIG_TYPE_INT, Link Here
545
static config_entry_t loglevel_ce = { &nlgroup_ce, "loglevel", CONFIG_TYPE_INT,
550
static config_entry_t loglevel_ce = { &nlgroup_ce, "loglevel", CONFIG_TYPE_INT,
546
				      CONFIG_OPT_NONE, 0, 
551
				      CONFIG_OPT_NONE, 0, 
547
				      { value: ULOGD_NOTICE } };
552
				      { value: ULOGD_NOTICE } };
548
static config_entry_t rmem_ce = { &loglevel_ce, "rmem", CONFIG_TYPE_INT,
553
554
static config_entry_t user_ce = { &loglevel_ce, "user", CONFIG_TYPE_STRING,
555
				  CONFIG_OPT_NONE, 0,
556
				  { string: ULOGD_USER_DEFAULT } };
557
558
static config_entry_t rmem_ce = { &user_ce, "rmem", CONFIG_TYPE_INT,
549
				  CONFIG_OPT_NONE, 0, 
559
				  CONFIG_OPT_NONE, 0, 
550
				  { value: ULOGD_RMEM_DEFAULT } };
560
				  { value: ULOGD_RMEM_DEFAULT } };
551
561
Lines 695-708 int main(int argc, char* argv[]) Link Here
695
		case 'u':
705
		case 'u':
696
			change_uid = 1;
706
			change_uid = 1;
697
			user = strdup(optarg);
707
			user = strdup(optarg);
708
			setpwent();
698
			pw = getpwnam(user);
709
			pw = getpwnam(user);
699
			if (!pw) {
710
			if (!pw) {
700
				printf("Unknown user %s.\n", user);
711
				printf("Unknown user %s.\n", user);
712
				endpwent();
701
				free(user);
713
				free(user);
702
				exit(1);
714
				exit(1);
703
			}
715
			}
704
			uid = pw->pw_uid;
716
			uid = pw->pw_uid;
705
			gid = pw->pw_gid;
717
			gid = pw->pw_gid;
718
			endpwent();
706
			break;
719
			break;
707
		}
720
		}
708
	}
721
	}
Lines 740-746 int main(int argc, char* argv[]) Link Here
740
		exit(1);
753
		exit(1);
741
	}
754
	}
742
755
743
756
	/* if no -u cmd line option set, read the user option from config. */
757
	if (!change_uid && strlen(user_ce.u.string))
758
	{
759
		change_uid = 1;
760
		user = strdup(user_ce.u.string);
761
		setpwent();
762
		pw = getpwnam(user);
763
		if (!pw) {
764
			printf("Unknown user %s.\n", user);
765
			endpwent();
766
			free(user);
767
			exit(1);
768
		}
769
		uid = pw->pw_uid;
770
		gid = pw->pw_gid;
771
		endpwent();
772
	}
744
	if (change_uid) {
773
	if (change_uid) {
745
		ulogd_log(ULOGD_NOTICE, "Changing UID / GID\n");
774
		ulogd_log(ULOGD_NOTICE, "Changing UID / GID\n");
746
		if (setgid(gid)) {
775
		if (setgid(gid)) {
(-)a/ulogd.conf.in (+3 lines)
Lines 7-12 Link Here
7
# GLOBAL OPTIONS
7
# GLOBAL OPTIONS
8
######################################################################
8
######################################################################
9
9
10
# username to run as (runs as root if not set)
11
user=ulogd
12
10
# netlink multicast group (the same as the iptables --ulog-nlgroup param)
13
# netlink multicast group (the same as the iptables --ulog-nlgroup param)
11
nlgroup=1
14
nlgroup=1
12
15

Return to bug 418351