[Pkg-sysvinit-commits] r1079 - in sysvinit/trunk/debian: . sysv-rc/sbin

pere at alioth.debian.org pere at alioth.debian.org
Sat Dec 22 16:42:56 UTC 2007


Author: pere
Date: 2007-12-22 16:42:56 +0000 (Sat, 22 Dec 2007)
New Revision: 1079

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
Log:
  * Modify update-rc.d to refuse to install init.d scripts with illegal
    characters in the names.  Only accept [a-zA-Z0-9+.-] to match the
    limits on package names.  Correct handling of init.d scripts with
    + in their name (Closes: #431224).

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2007-12-06 09:00:16 UTC (rev 1078)
+++ sysvinit/trunk/debian/changelog	2007-12-22 16:42:56 UTC (rev 1079)
@@ -36,6 +36,10 @@
     David Härdeman.
   * Do not mount gfs2 as a local file system.  It is a network file system.
     Patch from  Guido Guenther (Closes: #454468).
+  * Modify update-rc.d to refuse to install init.d scripts with illegal
+    characters in the names.  Only accept [a-zA-Z0-9+.-] to match the
+    limits on package names.  Correct handling of init.d scripts with
+    + in their name (Closes: #431224).
 
   [ Henrique de Moraes Holschuh ]
   * libata shutdown handling fixes:

Modified: sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
===================================================================
--- sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d	2007-12-06 09:00:16 UTC (rev 1078)
+++ sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d	2007-12-22 16:42:56 UTC (rev 1079)
@@ -44,6 +44,12 @@
 
 &usage() if ($#ARGV < 1);
 my $bn = shift @ARGV;
+
+unless ($bn =~ m/[a-zA-Z0-9+.-]+/) {
+    print STDERR "update-rc.d: illegal character in name '$bn'\n";
+    exit (1);
+}
+
 if ($ARGV[0] ne 'remove') {
     if (! -f "$initd/$bn") {
 	print STDERR "update-rc.d: $initd/$bn: file does not exist\n";
@@ -103,8 +109,10 @@
 	    die("update-rc.d: chdir $etcd$i.d: $!\n");
 	}
 	opendir(DIR, ".");
+	my $saveBN=$bn;
+	$saveBN =~ s/\+/\\+/g;
 	foreach $_ (readdir(DIR)) {
-	    next unless (/^[SK]\d\d$bn$/);
+	    next unless (/^[SK]\d\d$saveBN$/);
 	    $fn = "$etcd$i.d/$_";
 	    $found = 1;
 	    $islnk = &is_link ($_[0], $fn, $bn);




More information about the Pkg-sysvinit-commits mailing list