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