1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 01_umask.dpatch by Jonas Meurer <mejo@debian.org>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Allow to configure umask
9
diff -rNu lurker-2.1/ChangeLog lurker-2.1.umask/ChangeLog
10
--- lurker-2.1/ChangeLog 2006-03-05 18:27:48.000000000 +0100
11
+++ lurker-2.1.umask/ChangeLog 2006-03-12 14:14:14.000000000 +0100
14
+ Added support for specifying a umask for the database
15
+ Removed idiotic/wrong use of 'sg' in INSTALL's import example
18
lurker.cgi uses the environment to provide location information:
19
LURKER_CONFIG over-rides the default config file
20
diff -rNu lurker-2.1/INSTALL lurker-2.1.umask/INSTALL
21
--- lurker-2.1/INSTALL 2006-03-05 18:29:27.000000000 +0100
22
+++ lurker-2.1.umask/INSTALL 2006-03-12 14:14:14.000000000 +0100
24
* ^X-Mailing-List: <debian-japanese@lists.debian.org>.*
25
| lurker-index -l japanese -m
27
- Or with a lurker group:
30
- * ^X-Mailing-List: <debian-japanese@lists.debian.org>.*
31
- | sg lurker -c "lurker-index -l japanese -m"
32
+ If you have a lurker group:
33
+ Set 'db_umask = 002' in the lurker.conf file.
34
+ chmod 02775 /usr/local/var/lib/lurker
36
- In the this example 'sg' is used to change to the lurker group.
37
- The UMASK setting also tells procmail to make the files group writeable.
39
5 Feed archived mail through lurker-index.
41
lurker-index -l devel < debian-devel.mbox
42
diff -rNu lurker-2.1/common/ConfigFile.cpp lurker-2.1.umask/common/ConfigFile.cpp
43
--- lurker-2.1/common/ConfigFile.cpp 2006-03-05 19:09:24.000000000 +0100
44
+++ lurker-2.1.umask/common/ConfigFile.cpp 2006-03-12 14:15:15.000000000 +0100
46
-/* $Id: ConfigFile.cpp,v 1.23 2006/03/01 14:02:51 terpstra Exp $
47
+/* $Id: ConfigFile.cpp,v 1.25 2006/03/10 00:47:22 terpstra Exp $
49
* ConfigFile.cpp - Knows how to load the config file
52
: list(0), frontend(0), group(""), error(), lists(), groups(),
63
+ else if (key == "db_umask")
67
+ error << "db_umask cannot be localized" << endl;
72
+ db_umask = strtol(val.c_str(), &e, 8);
73
+ if (val.length() == 0 || *e != 0)
75
+ error << "db_mask must be given an octal number, not '" << val << "'" << endl;
79
else if (key == "admin_name")
81
admin_name.translate(lc, val);
82
diff -rNu lurker-2.1/common/ConfigFile.h lurker-2.1.umask/common/ConfigFile.h
83
--- lurker-2.1/common/ConfigFile.h 2006-03-05 17:56:29.000000000 +0100
84
+++ lurker-2.1.umask/common/ConfigFile.h 2006-03-12 14:14:57.000000000 +0100
86
-/* $Id: ConfigFile.h,v 1.13 2006/02/25 01:05:40 terpstra Exp $
87
+/* $Id: ConfigFile.h,v 1.15 2006/03/10 00:47:22 terpstra Exp $
89
* ConfigFile.h - Knows how to load the config file
93
// never localize paths, commands, or addresses
97
string delete_message;
99
diff -rNu lurker-2.1/index/lurker-params.1 lurker-2.1.umask/index/lurker-params.1
100
--- lurker-2.1/index/lurker-params.1 2006-02-27 16:01:12.000000000 +0100
101
+++ lurker-2.1.umask/index/lurker-params.1 2006-03-12 14:14:14.000000000 +0100
103
lurker\-params \(em parses parameters from the config file
106
-\fBlurker\-params\fR [\-c <config-file>] [\-f <locale>] [\-d \-a \-n \-e \-x \-m \-i \-k \-w \-h \-r]
107
+\fBlurker\-params\fR [\-c <config-file>] [\-f <locale>] [\-d \-u \-a \-n \-e \-x \-m \-i \-k \-w \-h \-r]
110
\fBlurker\-params\fR outputs various lurker settings
112
(it defaults to selecting the fallback case for each field).
114
Output only the dbdir parameter
116
+Output only the db_umask parameter
118
Output only the archive parameter
121
still present in the latest official release. If the problem persists,
122
then send mail with instructions describing how to reproduce the bug to
123
<lurker\-users@lists.sourceforge.net>.
124
-.\" created by instant / docbook-to-man, Mon 27 Feb 2006, 02:54
125
+.\" created by instant / docbook-to-man, Fri 10 Mar 2006, 01:49
126
diff -rNu lurker-2.1/index/lurker-params.sgml lurker-2.1.umask/index/lurker-params.sgml
127
--- lurker-2.1/index/lurker-params.sgml 2006-02-27 02:49:21.000000000 +0100
128
+++ lurker-2.1.umask/index/lurker-params.sgml 2006-03-12 14:14:14.000000000 +0100
130
<command>&dhpackage;</command>
131
<arg>\-c <config-file></arg>
132
<arg>\-f <locale></arg>
133
- <arg>\-d \-a \-n \-e \-x \-m \-i \-k \-w \-h \-r</arg>
134
+ <arg>\-d \-u \-a \-n \-e \-x \-m \-i \-k \-w \-h \-r</arg>
142
+ <term><option>\-u</option></term>
144
+ <para>Output only the db_umask parameter</para>
148
<term><option>\-a</option></term>
150
<para>Output only the archive parameter</para>
151
diff -rNu lurker-2.1/index/main.cpp lurker-2.1.umask/index/main.cpp
152
--- lurker-2.1/index/main.cpp 2006-03-01 15:11:05.000000000 +0100
153
+++ lurker-2.1.umask/index/main.cpp 2006-03-12 14:14:14.000000000 +0100
155
-/* $Id: main.cpp,v 1.49 2006/03/01 14:11:05 terpstra Exp $
156
+/* $Id: main.cpp,v 1.50 2006/03/10 00:47:22 terpstra Exp $
158
* main.cpp - Read the fed data into our database
164
+ if (cfg.db_umask != -1) umask(cfg.db_umask);
166
string dbname = cfg.dbdir + "/db";
167
ESort::Parameters params(synced);
168
// work around g++ 2.95 borkage
169
diff -rNu lurker-2.1/index/params.cpp lurker-2.1.umask/index/params.cpp
170
--- lurker-2.1/index/params.cpp 2006-02-27 02:45:29.000000000 +0100
171
+++ lurker-2.1.umask/index/params.cpp 2006-03-12 14:14:14.000000000 +0100
173
-/* $Id: params.cpp,v 1.16 2006/02/26 14:09:07 terpstra Exp $
174
+/* $Id: params.cpp,v 1.17 2006/03/10 00:47:22 terpstra Exp $
176
* params.cpp - Parse the config file for helper scripts
179
cerr << "Lurker-params (v" << VERSION << ") parses params from the config file.\n";
181
cerr << "Usage: " << name << " [-c <config-file>] [-f <locale>]\n";
182
- cerr << " [-d -a -n -e -x -m -i -k -w -h -r]\n";
183
+ cerr << " [-d -u -a -n -e -x -m -i -k -w -h -r]\n";
185
cerr << "\t-c <config-file> Use this config file for lurker settings\n";
186
cerr << "\t-f <locale> Output the fields for this locale\n";
187
cerr << "\t-d Output only the dbdir parameter\n";
188
+ cerr << "\t-u Output only the db_umask parameter\n";
189
cerr << "\t-a Output only the archive parameter\n";
190
cerr << "\t-n Output only the administrator name\n";
191
cerr << "\t-e Output only the administrator email address\n";
193
const char* config = DEFAULT_CONFIG_FILE;
196
+ bool db_umask = false;
197
bool archive = false;
198
bool admin_name = false;
199
bool admin_address = false;
201
bool raw_email = false;
204
- while ((c = getopt(argc, (char*const*)argv, "c:f:danexmikwhr?")) != -1)
205
+ while ((c = getopt(argc, (char*const*)argv, "c:f:duanexmikwhr?")) != -1)
220
@@ -163,14 +169,18 @@
224
- if (!fields || dbdir) cout << cfg.dbdir << "\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 || dbdir) cout << cfg.dbdir << "\n";
233
+ if (!fields || db_umask)
234
+ if (cfg.db_umask == -1)
235
+ cout << "user" << "\n";
236
+ else cout << "0" << oct << cfg.db_umask << "\n";
237
+ if (!fields || archive) cout << cfg.archive(lc) << "\n";
238
+ if (!fields || admin_name) cout << cfg.admin_name(lc) << "\n";
239
+ if (!fields || admin_address) cout << cfg.admin_address << "\n";
240
+ if (!fields || xslt) cout << cfg.xslt << "\n";
241
+ if (!fields || pgpv_mime) cout << cfg.pgpv_mime << "\n";
242
+ if (!fields || pgpv_inline) cout << cfg.pgpv_inline << "\n";
243
+ if (!fields || delete_message)cout << cfg.delete_message << "\n";
244
if (!fields || web_cache) cout << (cfg.web_cache?"on":"off") << "\n";
245
if (!fields || hide_email) cout << (cfg.hide_email?"on":"off") << "\n";
246
if (!fields || raw_email) cout << (cfg.raw_email?"on":"off") << "\n";
247
diff -rNu lurker-2.1/index/search.cpp lurker-2.1.umask/index/search.cpp
248
--- lurker-2.1/index/search.cpp 2006-02-27 02:53:55.000000000 +0100
249
+++ lurker-2.1.umask/index/search.cpp 2006-03-12 14:14:14.000000000 +0100
251
-/* $Id: search.cpp,v 1.12 2006/02/27 01:53:55 terpstra Exp $
252
+/* $Id: search.cpp,v 1.13 2006/03/10 00:47:22 terpstra Exp $
254
* search.cpp - Search for messages in lurker database (optionally delete)
260
+#include <sys/stat.h>
261
+#include <sys/types.h>
270
if (verbose) cerr << "opening " << cfg.dbdir << "/db read-write" << endl;
271
// Work around g++ 2.95 bug
272
+ if (cfg.db_umask != -1) umask(cfg.db_umask);
273
auto_ptr<ESort::Writer> w
274
(ESort::Writer::opendb(cfg.dbdir + "/db"));
276
diff -rNu lurker-2.1/lurker.conf.in lurker-2.1.umask/lurker.conf.in
277
--- lurker-2.1/lurker.conf.in 2006-02-27 20:54:32.000000000 +0100
278
+++ lurker-2.1.umask/lurker.conf.in 2006-03-12 14:14:14.000000000 +0100
280
# The substitution %c denotes the config file of the database to affect.
281
# The substitution %i is the lurker message ID of the target email.
282
# The recommended setup is to have a 'lurker' group owning /var/lib/lurker
283
-# Then for the example command to work, you must set 'gpasswd lurker'.
284
-# On some systems this is 'passwd -g lurker', there may be other variants.
285
+# Then for the example command to work, you must set 'gpasswd lurker'.
286
+# On some systems this is 'passwd -g lurker', there may be other variants.
287
+# Alternately, you can make the lurker db writable by the CGI.
288
+# Then use the second alternative after changing 'password'.
290
delete_message = sg lurker -c "@BINDIR@/lurker-search -d -f -q -i -c %c %i"
291
+# delete_message = if test "password" = "`cat`"; then @BINDIR@/lurker-search -d -f -q -i -c %c %i; fi
293
# The commands lurker uses to verify signatures.
297
dbdir = @LOCALSTATEDIR@/lib/@PACKAGE@
299
+# The umask to use when creating files in the database.
301
+# If this is unset, the umask from the environment of the user is used.
302
+# You would want to set this to make sure that permissions stay correct.
303
+# If you want a group writable db, use 002 and a setgid dbdir (rwxrwsr-x).
304
+# If you want a user only db, use 022 and a dbdir with rwxr-xr-x.
308
# Include another file for additional configuration.
310
# If you have a large number of mailing lists it may help to group them.