summaryrefslogtreecommitdiff
path: root/poldek-su-sigsev.patch
blob: 740d6804231c1103fbbef88a88b22661070571c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Index: conf.c
===================================================================
RCS file: /cvsroot/poldek/poldek/conf.c,v
retrieving revision 1.84
diff -u -r1.84 conf.c
--- conf.c	27 Jun 2007 21:47:43 -0000	1.84
+++ conf.c	28 Jun 2007 15:47:04 -0000
@@ -944,6 +944,9 @@
         addparam_flags |= ADD_PARAM_FOREIGN;
     }
 
+    if (flags & POLDEK_LDCONF_NOVALIDATE)
+        validate = 0;
+
     if (flags & POLDEK_LDCONF_UPDATE)
         update = 1;
 
Index: conf.h
===================================================================
RCS file: /cvsroot/poldek/poldek/conf.h,v
retrieving revision 1.18
diff -u -r1.18 conf.h
--- conf.h	27 Jun 2007 00:44:47 -0000	1.18
+++ conf.h	28 Jun 2007 15:47:04 -0000
@@ -6,10 +6,11 @@
 #include <trurl/narray.h>
 #include <trurl/nhash.h>
 
-#define POLDEK_LDCONF_FOREIGN     (1 << 0) /* not a poldek file */
-#define POLDEK_LDCONF_UPDATE      (1 << 1) /* resync with remote config */
-#define POLDEK_LDCONF_NOINCLUDE   (1 << 2) /* ignore %include directives */
-#define POLDEK_LDCONF_GLOBALONLY  (1 << 9) /* for early cachedir setup */
+#define POLDEK_LDCONF_FOREIGN     (1 << 0) /* not a poldek config file */
+#define POLDEK_LDCONF_NOVALIDATE  (1 << 1) /* do not validate config variables */
+#define POLDEK_LDCONF_UPDATE      (1 << 2) /* resync with remote config */
+#define POLDEK_LDCONF_NOINCLUDE   (1 << 3) /* ignore %include directives */
+#define POLDEK_LDCONF_GLOBALONLY  (1 << 4) /* for early cachedir setup */
 
 /* default localization is used if path is NULL */
 tn_hash *poldek_conf_load(const char *path, unsigned flags);
Index: cli/main.c
===================================================================
RCS file: /cvsroot/poldek/poldek/cli/main.c,v
retrieving revision 1.56
diff -u -r1.56 main.c
--- cli/main.c	27 Jun 2007 00:44:47 -0000	1.56
+++ cli/main.c	28 Jun 2007 15:47:05 -0000
@@ -587,7 +587,8 @@
     } else if (noautosu == 0 && getuid() == 0) {  /* check config's runas */
         tn_hash *cnf;
         
-        cnf = poldek_conf_load_default(POLDEK_LDCONF_NOINCLUDE | POLDEK_LDCONF_FOREIGN);
+        cnf = poldek_conf_load_default(POLDEK_LDCONF_GLOBALONLY |
+                                       POLDEK_LDCONF_NOVALIDATE);
         if (cnf) {
             tn_hash *global;
             const char *u;
Index: tests/sh/04-conf
===================================================================
RCS file: /cvsroot/poldek/poldek/tests/sh/04-conf,v
retrieving revision 1.2
diff -u -r1.2 04-conf
--- tests/sh/04-conf	27 Jun 2007 21:47:42 -0000	1.2
+++ tests/sh/04-conf	28 Jun 2007 15:47:05 -0000
@@ -28,12 +28,43 @@
 
     is_verbose_mode && $poldek_l
 
-    n=$($poldek_l | grep -vE '^dbg:' | wc -l)
+    n=$($poldek_l | grep 'test://' | wc -l)
     assertEquals "2 sources expected" "$n" "2"
 
     n=$($poldek_l | grep -E '^test[12] ' | wc -l)
     assertEquals "2 sources expected, but not those" "$n" "2"
 }
+
+testConfAsRoot() 
+{
+    create_local_conf
+    msgn "--conf"
+    poldek_l="$POLDEK --conf $TMPDIR/poldek.conf -q  -l"
+
+    is_verbose_mode && $poldek_l
+
+    n=$(fakeroot $poldek_l | grep 'test://' | wc -l)
+    assertEquals "2 sources expected" "$n" "2"
+
+    n=$(fakeroot $poldek_l | grep -E '^test[12] ' | wc -l)
+    assertEquals "2 sources expected, but not those" "$n" "2"
+
+    msgn "default conf"
+    mkdir $TMPDIR/home || fail "mkdir"
+    mv -f $TMPDIR/poldek.conf $TMPDIR/home/.poldekrc
+    HOME=$TMPDIR/home
+    export HOME
+
+    poldek_l="$POLDEK -q -l"
+    is_verbose_mode && $poldek_l
+
+    n=$(fakeroot $poldek_l | grep 'test://' | wc -l)
+    assertEquals "2 sources expected" "$n" "2"
+
+    n=$(fakeroot $poldek_l | grep -E '^test[12] ' | wc -l)
+    assertEquals "2 sources expected, but not those" "$n" "2"
+}
+
 
 testConfInclude() 
 {