1#######################################################
2#
3# Test getgid()
4#
5#######################################################
6
7body common control
8{
9      inputs => { "../../default.cf.sub" };
10      bundlesequence  => { default("$(this.promise_filename)") };
11      version => "1.0";
12}
13
14#######################################################
15
16bundle agent init
17{
18  vars:
19      "dummy" string => "dummy";
20}
21
22#######################################################
23
24bundle agent test
25{
26  meta:
27    "test_skip_needs_work" string => "windows";
28
29  vars:
30    linux|freebsd|solaris|openbsd|hpux::
31      "gid_daemon" int => getgid("daemon");
32      "gid_sys" int => getgid("sys");
33    darwin::
34      "gid_daemon" int => getgid("daemon");
35    aix::
36      "gid_sys" int => getgid("sys");
37    !linux.!freebsd.!solaris.!darwin.!openbsd.!hpux.!aix::
38      "gid_daemon" string => "fixme";
39      "gid_sys" string => "fixme";
40
41    linux|solaris|hpux::
42      "gid_0" int => getgid("root");
43    freebsd|darwin|openbsd::
44      "gid_0" int => getgid("wheel");
45    aix::
46      "gid_0" int => getgid("system");
47    !linux.!freebsd.!solaris.!darwin.!openbsd.!hpux.!aix::
48      "gid_0" string => "fixme";
49
50    archlinux|SuSE|redhat|gentoo::
51      "num_daemon" int => "2";
52    (linux.!archlinux.!SuSE.!redhat.!gentoo)|freebsd|darwin|openbsd::
53      "num_daemon" int => "1";
54    solaris::
55      "num_daemon" int => "12";
56    hpux::
57      "num_daemon" int => "5";
58    !linux.!freebsd.!solaris.!darwin.!openbsd.!hpux.!aix::
59      "num_daemon" string => "fixme";
60
61    linux|freebsd|solaris|openbsd|hpux|aix::
62      "num_sys" int => "3";
63    !linux.!freebsd.!solaris.!darwin.!openbsd.!hpux.!aix::
64      "num_sys" string => "fixme";
65}
66
67#######################################################
68
69bundle agent check
70{
71  classes:
72    darwin::
73      "ok_sys" expression => "any";
74    !darwin::
75      "ok_sys" expression => strcmp("$(test.gid_sys)", "$(test.num_sys)");
76    aix::
77      "ok_daemon" expression => "any";
78    !aix::
79      "ok_daemon" expression => strcmp("$(test.gid_daemon)", "$(test.num_daemon)");
80
81    any::
82      "ok" and => { strcmp("$(test.gid_0)", "0"), "ok_sys", "ok_daemon" };
83
84  reports:
85    DEBUG::
86      "root/wheel is GID $(test.gid_0), expected 0";
87      "daemon is GID $(test.gid_daemon), expected $(test.num_daemon)";
88      "sys is GID $(test.gid_sys), expected $(test.num_sys)";
89    ok::
90      "$(this.promise_filename) Pass";
91    !ok::
92      "$(this.promise_filename) FAIL";
93}
94
95