[Initscripts-ng-commits] r824 - in /trunk/src/insserv/debian: changelog patches/00list patches/91_xlstat_initddir_to_detect_illegal_symlink.dpatch run-testsuite

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Tue Jul 29 07:45:27 UTC 2008


Author: kelmo-guest
Date: Tue Jul 29 07:45:26 2008
New Revision: 824

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=824
Log:
* Add test_initd_symlink() test suite function to test if illegal
  symlinks in /etc/init.d/ cause problems.
* Add 91_xlstat_initddir_to_detect_illegal_symlink.dpatch to detect
  and avoid illegal symlinks to other script in /etc/init.d/.
  (Closes: #485045)

Added:
    trunk/src/insserv/debian/patches/91_xlstat_initddir_to_detect_illegal_symlink.dpatch
Modified:
    trunk/src/insserv/debian/changelog
    trunk/src/insserv/debian/patches/00list
    trunk/src/insserv/debian/run-testsuite

Modified: trunk/src/insserv/debian/changelog
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=824&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Tue Jul 29 07:45:26 2008
@@ -55,8 +55,13 @@
   * Now we have no overrides to install by default, but we may in future,
     modify debian/rules to only install overrides from ./debian/overrides/* if
     they are present, but not fail otherwise.
-
- -- Kel Modderman <kel at otaku42.de>  Sun, 27 Jul 2008 16:04:07 +1000
+  * Add test_initd_symlink() test suite function to test if illegal
+    symlinks in /etc/init.d/ cause problems.
+  * Add 91_xlstat_initddir_to_detect_illegal_symlink.dpatch to detect
+    and avoid illegal symlinks to other script in /etc/init.d/.
+    (Closes: #485045)
+
+ -- Kel Modderman <kel at otaku42.de>  Tue, 29 Jul 2008 17:43:02 +1000
 
 insserv (1.11.0-9) unstable; urgency=low
 

Modified: trunk/src/insserv/debian/patches/00list
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/00list?rev=824&op=diff
==============================================================================
--- trunk/src/insserv/debian/patches/00list (original)
+++ trunk/src/insserv/debian/patches/00list Tue Jul 29 07:45:26 2008
@@ -2,3 +2,4 @@
 31_debian_conf
 81_debian_default_start_stop_warnings
 90_fix_bashism_in_makefile
+91_xlstat_initddir_to_detect_illegal_symlink

Added: trunk/src/insserv/debian/patches/91_xlstat_initddir_to_detect_illegal_symlink.dpatch
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/91_xlstat_initddir_to_detect_illegal_symlink.dpatch?rev=824&op=file
==============================================================================
--- trunk/src/insserv/debian/patches/91_xlstat_initddir_to_detect_illegal_symlink.dpatch (added)
+++ trunk/src/insserv/debian/patches/91_xlstat_initddir_to_detect_illegal_symlink.dpatch Tue Jul 29 07:45:26 2008
@@ -1,0 +1,29 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 91_xlstat_initddir_to_detect_illegal_symlink.dpatch by Kel Modderman <kel at otaku42.de>
+##
+## DP: Purpose: When inserting script, use lstat instead of stat to detect
+## DP:          illegal symlinks.
+## DP: Fixes:   #485045
+## DP: Status:  Submitted upstream.
+
+ at DPATCH@
+--- a/insserv.c
++++ b/insserv.c
+@@ -2436,7 +2436,7 @@
+ 
+ 
+ 	/* d_type seems not to work, therefore use stat(2) */
+-	if (stat(d->d_name, &st_script) < 0) {
++	if (xlstat(dfd, d->d_name, &st_script) < 0) {
+ 	    warn("can not stat(%s)\n", d->d_name);
+ 	    continue;
+ 	}
+@@ -2444,7 +2444,7 @@
+ 	    !(S_IXUSR & st_script.st_mode))
+ 	{
+ 	    if (chkfor(d->d_name, argv, argc))
+-		warn("script %s is not executable, skipped!\n", d->d_name);
++		warn("script %s is not an executable regular file, skipped!\n", d->d_name);
+ 	    continue;
+ 	}
+ 

Modified: trunk/src/insserv/debian/run-testsuite
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/run-testsuite?rev=824&op=diff
==============================================================================
--- trunk/src/insserv/debian/run-testsuite (original)
+++ trunk/src/insserv/debian/run-testsuite Tue Jul 29 07:45:26 2008
@@ -1456,6 +1456,41 @@
 check_script_not_present 0 nodefstop
 check_script_not_present 1 nodefstop
 check_script_not_present 6 nodefstop
+}
+##########################################################################
+test_initd_symlink() {
+echo
+echo "info: test that a symlink in /etc/init.d/ to another script does not cause problems"
+echo
+
+initdir_purge
+
+addscript symlinked <<'EOF'
+### BEGIN INIT INFO
+# Provides:          symlinked
+# Required-Start:
+# Required-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      1
+### END INIT INFO
+EOF
+
+# Now make an illegal symlink to see if it causes problems, #485045
+ln -s symlinked ${initddir}/symlink
+
+# First try to insert service provided by symlink. It should be ignored.
+insserv_reg symlink || true
+
+# Now insert the symlink target, the actual script.
+insserv_reg symlinked || true
+
+list_rclinks
+
+check_script_present 1 symlinked
+check_script_present 2 symlinked
+check_script_present 3 symlinked
+check_script_present 4 symlinked
+check_script_present 5 symlinked
 }
 ##########################################################################
 
@@ -1488,3 +1523,4 @@
 test_noprovides_header
 test_no_default_start
 test_no_default_stop
+test_initd_symlink




More information about the Initscripts-ng-commits mailing list