1
## 01_umask.dpatch by Jonas Meurer <mejo@debian.org>
3
## Allow to configure umask
9
+ Added support for specifying a umask for the database
10
+ Removed idiotic/wrong use of 'sg' in INSTALL's import example
13
lurker.cgi uses the environment to provide location information:
14
LURKER_CONFIG over-rides the default config file
18
* ^X-Mailing-List: <debian-japanese@lists.debian.org>.*
19
| lurker-index -l japanese -m
21
- Or with a lurker group:
24
- * ^X-Mailing-List: <debian-japanese@lists.debian.org>.*
25
- | sg lurker -c "lurker-index -l japanese -m"
26
+ If you have a lurker group:
27
+ Set 'db_umask = 002' in the lurker.conf file.
28
+ chmod 02775 /usr/local/var/lib/lurker
30
- In the this example 'sg' is used to change to the lurker group.
31
- The UMASK setting also tells procmail to make the files group writeable.
33
5 Feed archived mail through lurker-index.
35
lurker-index -l devel < debian-devel.mbox
36
--- a/common/ConfigFile.cpp
37
+++ b/common/ConfigFile.cpp
39
-/* $Id: ConfigFile.cpp,v 1.23 2006/03/01 14:02:51 terpstra Exp $
40
+/* $Id: ConfigFile.cpp,v 1.25 2006/03/10 00:47:22 terpstra Exp $
42
* ConfigFile.cpp - Knows how to load the config file
45
: list(0), frontend(0), group(""), error(), lists(), groups(),
56
+ else if (key == "db_umask")
60
+ error << "db_umask cannot be localized" << endl;
65
+ db_umask = strtol(val.c_str(), &e, 8);
66
+ if (val.length() == 0 || *e != 0)
68
+ error << "db_mask must be given an octal number, not '" << val << "'" << endl;
72
else if (key == "admin_name")
74
admin_name.translate(lc, val);
75
--- a/common/ConfigFile.h
76
+++ b/common/ConfigFile.h
78
-/* $Id: ConfigFile.h,v 1.13 2006/02/25 01:05:40 terpstra Exp $
79
+/* $Id: ConfigFile.h,v 1.15 2006/03/10 00:47:22 terpstra Exp $
81
* ConfigFile.h - Knows how to load the config file
85
// never localize paths, commands, or addresses
89
string delete_message;
91
--- a/index/lurker-params.1
92
+++ b/index/lurker-params.1
94
lurker\-params \(em parses parameters from the config file
97
-\fBlurker\-params\fR [\-c <config-file>] [\-f <locale>] [\-d \-a \-n \-e \-x \-m \-i \-k \-w \-h \-r]
98
+\fBlurker\-params\fR [\-c <config-file>] [\-f <locale>] [\-d \-u \-a \-n \-e \-x \-m \-i \-k \-w \-h \-r]
101
\fBlurker\-params\fR outputs various lurker settings
103
(it defaults to selecting the fallback case for each field).
105
Output only the dbdir parameter
107
+Output only the db_umask parameter
109
Output only the archive parameter
112
still present in the latest official release. If the problem persists,
113
then send mail with instructions describing how to reproduce the bug to
114
<lurker\-users@lists.sourceforge.net>.
115
-.\" created by instant / docbook-to-man, Mon 27 Feb 2006, 02:54
116
+.\" created by instant / docbook-to-man, Fri 10 Mar 2006, 01:49
117
--- a/index/lurker-params.sgml
118
+++ b/index/lurker-params.sgml
120
<command>&dhpackage;</command>
121
<arg>\-c <config-file></arg>
122
<arg>\-f <locale></arg>
123
- <arg>\-d \-a \-n \-e \-x \-m \-i \-k \-w \-h \-r</arg>
124
+ <arg>\-d \-u \-a \-n \-e \-x \-m \-i \-k \-w \-h \-r</arg>
132
+ <term><option>\-u</option></term>
134
+ <para>Output only the db_umask parameter</para>
138
<term><option>\-a</option></term>
140
<para>Output only the archive parameter</para>
144
-/* $Id: main.cpp,v 1.49 2006/03/01 14:11:05 terpstra Exp $
145
+/* $Id: main.cpp,v 1.50 2006/03/10 00:47:22 terpstra Exp $
147
* main.cpp - Read the fed data into our database
153
+ if (cfg.db_umask != -1) umask(cfg.db_umask);
155
string dbname = cfg.dbdir + "/db";
156
ESort::Parameters params(synced);
157
// work around g++ 2.95 borkage
158
--- a/index/params.cpp
159
+++ b/index/params.cpp
161
-/* $Id: params.cpp,v 1.16 2006/02/26 14:09:07 terpstra Exp $
162
+/* $Id: params.cpp,v 1.17 2006/03/10 00:47:22 terpstra Exp $
164
* params.cpp - Parse the config file for helper scripts
167
cerr << "Lurker-params (v" << VERSION << ") parses params from the config file.\n";
169
cerr << "Usage: " << name << " [-c <config-file>] [-f <locale>]\n";
170
- cerr << " [-d -a -n -e -x -m -i -k -w -h -r]\n";
171
+ cerr << " [-d -u -a -n -e -x -m -i -k -w -h -r]\n";
173
cerr << "\t-c <config-file> Use this config file for lurker settings\n";
174
cerr << "\t-f <locale> Output the fields for this locale\n";
175
cerr << "\t-d Output only the dbdir parameter\n";
176
+ cerr << "\t-u Output only the db_umask parameter\n";
177
cerr << "\t-a Output only the archive parameter\n";
178
cerr << "\t-n Output only the administrator name\n";
179
cerr << "\t-e Output only the administrator email address\n";
181
const char* config = DEFAULT_CONFIG_FILE;
184
+ bool db_umask = false;
185
bool archive = false;
186
bool admin_name = false;
187
bool admin_address = false;
189
bool raw_email = false;
192
- while ((c = getopt(argc, (char*const*)argv, "c:f:danexmikwhr?")) != -1)
193
+ while ((c = getopt(argc, (char*const*)argv, "c:f:duanexmikwhr?")) != -1)
208
@@ -163,14 +169,18 @@
212
- if (!fields || dbdir) cout << cfg.dbdir << "\n";
213
- if (!fields || archive) cout << cfg.archive(lc) << "\n";
214
- if (!fields || admin_name) cout << cfg.admin_name(lc)<< "\n";
215
- if (!fields || admin_address) cout << cfg.admin_address << "\n";
216
- if (!fields || xslt) cout << cfg.xslt << "\n";
217
- if (!fields || pgpv_mime) cout << cfg.pgpv_mime << "\n";
218
- if (!fields || pgpv_inline) cout << cfg.pgpv_inline << "\n";
219
- if (!fields || delete_message)cout << cfg.delete_message<< "\n";
220
+ if (!fields || dbdir) cout << cfg.dbdir << "\n";
221
+ if (!fields || db_umask)
222
+ if (cfg.db_umask == -1)
223
+ cout << "user" << "\n";
224
+ else cout << "0" << oct << cfg.db_umask << "\n";
225
+ if (!fields || archive) cout << cfg.archive(lc) << "\n";
226
+ if (!fields || admin_name) cout << cfg.admin_name(lc) << "\n";
227
+ if (!fields || admin_address) cout << cfg.admin_address << "\n";
228
+ if (!fields || xslt) cout << cfg.xslt << "\n";
229
+ if (!fields || pgpv_mime) cout << cfg.pgpv_mime << "\n";
230
+ if (!fields || pgpv_inline) cout << cfg.pgpv_inline << "\n";
231
+ if (!fields || delete_message)cout << cfg.delete_message << "\n";
232
if (!fields || web_cache) cout << (cfg.web_cache?"on":"off") << "\n";
233
if (!fields || hide_email) cout << (cfg.hide_email?"on":"off") << "\n";
234
if (!fields || raw_email) cout << (cfg.raw_email?"on":"off") << "\n";
235
--- a/index/search.cpp
236
+++ b/index/search.cpp
238
-/* $Id: search.cpp,v 1.12 2006/02/27 01:53:55 terpstra Exp $
239
+/* $Id: search.cpp,v 1.13 2006/03/10 00:47:22 terpstra Exp $
241
* search.cpp - Search for messages in lurker database (optionally delete)
247
+#include <sys/stat.h>
248
+#include <sys/types.h>
257
if (verbose) cerr << "opening " << cfg.dbdir << "/db read-write" << endl;
258
// Work around g++ 2.95 bug
259
+ if (cfg.db_umask != -1) umask(cfg.db_umask);
260
auto_ptr<ESort::Writer> w
261
(ESort::Writer::opendb(cfg.dbdir + "/db"));
266
# The substitution %c denotes the config file of the database to affect.
267
# The substitution %i is the lurker message ID of the target email.
268
# The recommended setup is to have a 'lurker' group owning /var/lib/lurker
269
-# Then for the example command to work, you must set 'gpasswd lurker'.
270
-# On some systems this is 'passwd -g lurker', there may be other variants.
271
+# Then for the example command to work, you must set 'gpasswd lurker'.
272
+# On some systems this is 'passwd -g lurker', there may be other variants.
273
+# Alternately, you can make the lurker db writable by the CGI.
274
+# Then use the second alternative after changing 'password'.
276
delete_message = sg lurker -c "@BINDIR@/lurker-search -d -f -q -i -c %c %i"
277
+# delete_message = if test "password" = "`cat`"; then @BINDIR@/lurker-search -d -f -q -i -c %c %i; fi
279
# The commands lurker uses to verify signatures.
283
dbdir = @LOCALSTATEDIR@/lib/@PACKAGE@
285
+# The umask to use when creating files in the database.
287
+# If this is unset, the umask from the environment of the user is used.
288
+# You would want to set this to make sure that permissions stay correct.
289
+# If you want a group writable db, use 002 and a setgid dbdir (rwxrwsr-x).
290
+# If you want a user only db, use 022 and a dbdir with rwxr-xr-x.
294
# Include another file for additional configuration.
296
# If you have a large number of mailing lists it may help to group them.