~ubuntu-branches/ubuntu/utopic/lurker/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/01_umask.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Meurer
  • Date: 2008-08-26 15:50:06 UTC
  • mfrom: (4.1.3 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080826155006-0iwbunxwoqanlv82
Tags: 2.1-13
* Fix pending l10n issues, thanks to Christian Perrier for coordination:
  - update japanese debconf translation, thanks to Noritada Kobayashi
    (closes: #496064)
  - update spanish debconf translation, thanks to germana (closes: #470307,
    #495861)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## 01_umask.dpatch by Jonas Meurer <mejo@debian.org>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: Allow to configure umask
6
 
 
7
 
@DPATCH@
8
 
 
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
12
 
@@ -1,3 +1,7 @@
13
 
+v2.2:
14
 
+       Added support for specifying a umask for the database
15
 
+       Removed idiotic/wrong use of 'sg' in INSTALL's import example
16
 
+
17
 
 v2.1:
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
23
 
@@ -86,15 +86,10 @@
24
 
        * ^X-Mailing-List: <debian-japanese@lists.debian.org>.*
25
 
        | lurker-index -l japanese -m
26
 
   
27
 
-  Or with a lurker group:
28
 
-       UMASK=002
29
 
-       :0 w
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
35
 
   
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.
38
 
-
39
 
 5 Feed archived mail through lurker-index.
40
 
   
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
45
 
@@ -1,4 +1,4 @@
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 $
48
 
  *  
49
 
  *  ConfigFile.cpp - Knows how to load the config file
50
 
  *  
51
 
@@ -381,6 +381,7 @@
52
 
  : list(0), frontend(0), group(""), error(), lists(), groups(),
53
 
    file(""),
54
 
    dbdir(""), 
55
 
+   db_umask(-1),
56
 
    xslt("cat -"),
57
 
    delete_message(""),
58
 
    pgpv_mime("off"),
59
 
@@ -859,6 +860,22 @@
60
 
                }
61
 
                dbdir = val;
62
 
        }
63
 
+       else if (key == "db_umask")
64
 
+       {
65
 
+               if (lc != "")
66
 
+               {
67
 
+                       error << "db_umask cannot be localized" << endl;
68
 
+                       return -1;
69
 
+               }
70
 
+               
71
 
+               char* e;
72
 
+               db_umask = strtol(val.c_str(), &e, 8);
73
 
+               if (val.length() == 0 || *e != 0)
74
 
+               {
75
 
+                       error << "db_mask must be given an octal number, not '" << val << "'" << endl;
76
 
+                       return -1;
77
 
+               }
78
 
+       }
79
 
        else if (key == "admin_name")
80
 
        {
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
85
 
@@ -1,4 +1,4 @@
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 $
88
 
  *  
89
 
  *  ConfigFile.h - Knows how to load the config file
90
 
  *  
91
 
@@ -152,6 +152,7 @@
92
 
         
93
 
        // never localize paths, commands, or addresses
94
 
        string  dbdir;
95
 
+       int     db_umask;
96
 
        string  xslt;
97
 
        string  delete_message;
98
 
        string  pgpv_mime;
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
102
 
@@ -3,7 +3,7 @@
103
 
 lurker\-params \(em parses parameters from the config file 
104
 
 .SH "SYNOPSIS" 
105
 
 .PP 
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]  
108
 
 .SH "DESCRIPTION" 
109
 
 .PP 
110
 
 \fBlurker\-params\fR outputs various lurker settings 
111
 
@@ -17,6 +17,8 @@
112
 
 (it defaults to selecting the fallback case for each field). 
113
 
 .IP "\fB\-d\fP" 10 
114
 
 Output only the dbdir parameter 
115
 
+.IP "\fB\-u\fP" 10 
116
 
+Output only the db_umask parameter 
117
 
 .IP "\fB\-a\fP" 10 
118
 
 Output only the archive parameter 
119
 
 .IP "\fB\-n\fP" 10 
120
 
@@ -69,4 +71,4 @@
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
129
 
@@ -58,7 +58,7 @@
130
 
       <command>&dhpackage;</command>
131
 
       <arg>\-c &lt;config-file&gt;</arg>
132
 
       <arg>\-f &lt;locale&gt;</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>
135
 
     </cmdsynopsis>
136
 
   </refsynopsisdiv>
137
 
   <refsect1>
138
 
@@ -92,6 +92,12 @@
139
 
         </listitem>
140
 
       </varlistentry>
141
 
       <varlistentry>
142
 
+        <term><option>\-u</option></term>
143
 
+        <listitem>
144
 
+          <para>Output only the db_umask parameter</para>
145
 
+        </listitem>
146
 
+      </varlistentry>
147
 
+      <varlistentry>
148
 
         <term><option>\-a</option></term>
149
 
         <listitem>
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
154
 
@@ -1,4 +1,4 @@
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 $
157
 
  *  
158
 
  *  main.cpp - Read the fed data into our database
159
 
  *  
160
 
@@ -633,6 +633,8 @@
161
 
                return LEX_DATAERR;
162
 
        }
163
 
        
164
 
+       if (cfg.db_umask != -1) umask(cfg.db_umask);
165
 
+       
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
172
 
@@ -1,4 +1,4 @@
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 $
175
 
  *  
176
 
  *  params.cpp - Parse the config file for helper scripts
177
 
  *  
178
 
@@ -38,11 +38,12 @@
179
 
        cerr << "Lurker-params (v" << VERSION << ") parses params from the config file.\n";
180
 
        cerr << "\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";
184
 
        cerr << "\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";
192
 
@@ -66,6 +67,7 @@
193
 
        const char* config        = DEFAULT_CONFIG_FILE;
194
 
        int         fields        = 0;
195
 
        bool        dbdir         = false;
196
 
+       bool        db_umask      = false;
197
 
        bool        archive       = false;
198
 
        bool        admin_name    = false;
199
 
        bool        admin_address = false;
200
 
@@ -78,7 +80,7 @@
201
 
        bool        raw_email     = false;
202
 
        string lc;
203
 
        
204
 
-       while ((c = getopt(argc, (char*const*)argv, "c:f:danexmikwhr?")) != -1)
205
 
+       while ((c = getopt(argc, (char*const*)argv, "c:f:duanexmikwhr?")) != -1)
206
 
        {
207
 
                switch ((char)c)
208
 
                {
209
 
@@ -92,6 +94,10 @@
210
 
                        ++fields;
211
 
                        dbdir = true;
212
 
                        break;
213
 
+               case 'u':
214
 
+                       ++fields;
215
 
+                       db_umask = true;
216
 
+                       break;
217
 
                case 'a':
218
 
                        ++fields;
219
 
                        archive = true;
220
 
@@ -163,14 +169,18 @@
221
 
                return 1;
222
 
        }
223
 
        
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
250
 
@@ -1,4 +1,4 @@
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 $
253
 
  *  
254
 
  *  search.cpp - Search for messages in lurker database (optionally delete)
255
 
  *  
256
 
@@ -28,8 +28,11 @@
257
 
 #include <Keys.h>
258
 
 
259
 
 #include <iostream>
260
 
+#include <sys/stat.h>
261
 
+#include <sys/types.h>
262
 
 #include <assert.h>
263
 
 #include <stdio.h>
264
 
+#include <unistd.h>
265
 
 
266
 
 using namespace std;
267
 
 
268
 
@@ -124,6 +127,7 @@
269
 
        {
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"));
275
 
                db = w.get();
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
279
 
@@ -50,10 +50,13 @@
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'.
289
 
 
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
292
 
 
293
 
 # The commands lurker uses to verify signatures.
294
 
 # 
295
 
@@ -102,6 +105,15 @@
296
 
 
297
 
 dbdir = @LOCALSTATEDIR@/lib/@PACKAGE@
298
 
 
299
 
+# The umask to use when creating files in the database.
300
 
+# 
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.
305
 
306
 
+db_umask = 002
307
 
+
308
 
 # Include another file for additional configuration.
309
 
 # 
310
 
 # If you have a large number of mailing lists it may help to group them.