~ubuntu-branches/ubuntu/precise/netatalk/precise

« back to all changes in this revision

Viewing changes to debian/patches/002_fix_cnid_maint_symlink_attack.patch

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2010-01-23 05:08:37 UTC
  • mfrom: (8.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100123050837-rh5465ophfkjpsn2
Tags: 2.0.5-3
* Fix replace/drop bogus and/or obsolete configure options:
  + Use --without-ssl-dir/--with-ssl-dir (not --with-openssl-dir/
    --without-openssl-dir). Closes: bug#565969, thanks to Fabian
    Greffrath.
  + Use --enable-tcp-wrappers (not --with-tcp-wrappers).
  + Use --disable-srvloc (not --disable-slp).
  + Drop --disable-logger (obsolete since 2.0.1).
  + Drop --with-mangling (apparently obsolete since 2.0 alpha 1).
  + Drop --with-nls-dir and --without-xfs (apparently obsolete).
* Autoreconfigure during build (since upstream does not enable
  maintainer-mode). Disable autotools-related patches. Build-depend on
  libtool, automake1.11 and autoconf. Closes: bug#559060, thanks to
  Cyril Brulebois and others.
* Add safety-check to fail build if accidentally linked against
  libssl. Thanks to Fabian Greffrath (see bug#565969).
* Disable atalkd by default, to not require supported network active
  at daemon start time. Closes: bug#565568, thanks to Kurt Roeckx.
  Add NEWS entry about the change.
* Build-depend on and enable hardening-includes.
* Fix adjust "See also" of manpages referring to afile or achfile.
* Set urgency=medium as earlier lack of explicit disabling openssl
  caused the package to violate licensing for some architectures, also
  affecting testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Author: Frank Lahm <franklahm@googlemail.com>
 
2
Date:   Thu Nov 26 10:41:43 2009 +0000
 
3
 
 
4
    Fix a symlink attack problem and a race condition in cnid_maint script. From SATOH Fumiyasu.
 
5
 
 
6
diff --git a/bin/cnid/cnid_maint.in b/bin/cnid/cnid_maint.in
 
7
index b622caf..c8bf467 100755
 
8
--- a/bin/cnid/cnid_maint.in
 
9
+++ b/bin/cnid/cnid_maint.in
 
10
@@ -3,11 +3,12 @@
 
11
 #
 
12
 # cnid_maint: A script to maintain the consistency of CNID databases.
 
13
 #
 
14
-# $Id: cnid_maint.in,v 1.15 2003/02/17 02:32:45 jmarcus Exp $
 
15
+# $Id: cnid_maint.in,v 1.15.8.1 2009/11/26 10:41:43 franklahm Exp $
 
16
 #
 
17
 
 
18
 use strict;
 
19
 use Getopt::Std;
 
20
+use IO::File;
 
21
 use vars qw(
 
22
     $APPLE_VOLUMES_FILE
 
23
     $STOP_CMD
 
24
@@ -20,6 +21,7 @@ use vars qw(
 
25
     $VERSION
 
26
     $START_NETATALK
 
27
     $LOCK_FILE
 
28
+    $LOCK
 
29
     $HOLDING_LOCK
 
30
 );
 
31
 
 
32
@@ -86,10 +88,13 @@ if (-f $LOCK_FILE) {
 
33
         end();
 
34
 }
 
35
 
 
36
-unless (open(LOCK, ">" . $LOCK_FILE)) {
 
37
+$LOCK = IO::File->new($LOCK_FILE, O_RDWR|O_CREAT|O_EXCL, 0600);
 
38
+unless (defined($LOCK)) {
 
39
         error(2, "Unable to create $LOCK_FILE: $!");
 
40
 }
 
41
-flock(LOCK, LOCK_EX);
 
42
+unless (flock($LOCK, LOCK_EX|LOCK_NB)) {
 
43
+        error(2, "Unable to obtain lock: $LOCK_FILE: $!");
 
44
+}
 
45
 $HOLDING_LOCK = 1;
 
46
 
 
47
 # Check to see if the AppleVolumes.default file exists.  We will use this file
 
48
@@ -314,8 +319,8 @@ sub end {
 
49
                 }
 
50
         }
 
51
         if ($HOLDING_LOCK) {
 
52
-                close(LOCK);
 
53
                 unlink($LOCK_FILE);
 
54
+                close($LOCK);
 
55
         }
 
56
         print "\nRun of CNID DB Maintenance script ended at "
 
57
             . scalar(localtime) . ".\n";