[Pkg-ossec-devel] [pkg-ossec] 02/02: Partial fix for the patch as it revers 04 and 05

Javier Fernandez-Sanguino Pen~a jfs at alioth.debian.org
Fri Aug 16 15:38:59 UTC 2013


This is an automated email from the git hooks/post-receive script.

jfs pushed a commit to branch master
in repository pkg-ossec.

commit dd5360dd2f69b2f1171f04546ea1648eb6e67bb5
Author: Javier Fernandez-Sanguino <jfs at debian.org>
Date:   Fri Aug 16 17:36:45 2013 +0200

    Partial fix for the patch as it revers 04 and 05
---
 debian/patches/06-control-return-status-value |  416 -------------------------
 1 file changed, 416 deletions(-)

diff --git a/debian/patches/06-control-return-status-value b/debian/patches/06-control-return-status-value
index dc36d91..613e4a5 100644
--- a/debian/patches/06-control-return-status-value
+++ b/debian/patches/06-control-return-status-value
@@ -1,94 +1,5 @@
 --- a/src/init/ossec-server.sh
 +++ b/src/init/ossec-server.sh
-@@ -5,15 +5,11 @@
- 
- 
- # Getting where we are installed
--[ -e /etc/ossec-init.conf ] && . /etc/ossec-init.conf # Source the configuration file for DIRECTORY
--if [ -z "$DIRECTORY" ]; then
--	echo "ERROR: Cannot determine the value of the OSSEC directory" 
--	[ ! -e "/etc/ossec-init.conf" ] && echo "ERROR: /etc/ossec-init.conf does not exist"
--	exit 1
--fi
- LOCAL=`dirname $0`;
- cd ${LOCAL}
--PLIST="${DIRECTORY}/bin/.process_list"
-+PWD=`pwd`
-+DIR=`dirname $PWD`;
-+PLIST=${DIR}/bin/.process_list;
- 
- 
- ###  Do not modify bellow here ###
-@@ -32,8 +28,8 @@
- 
- 
- ## Locking for the start/stop
--LOCK="${DIRECTORY}/var/run/ossec-hids/"
--LOCK_PID="${LOCK}/start-script-lock.pid"
-+LOCK="${DIR}/var/start-script-lock"
-+LOCK_PID="${LOCK}/pid"
- 
- 
- # This number should be more than enough (even if it is
-@@ -47,11 +43,11 @@
- checkpid()
- {
-     for i in ${DAEMONS}; do
--        for j in `cat ${LOCK}/${i}*.pid 2>/dev/null`; do
-+        for j in `cat ${DIR}/var/run/${i}*.pid 2>/dev/null`; do
-             ps -p $j |grep ossec >/dev/null 2>&1
-             if [ ! $? = 0 ]; then
--                echo "Deleting PID file '${LOCK}/${i}-${j}.pid' not used..."
--                rm ${LOCK}/${i}-${j}.pid
-+                echo "Deleting PID file '${DIR}/var/run/${i}-${j}.pid' not used..."
-+                rm ${DIR}/var/run/${i}-${j}.pid
-             fi    
-         done    
-     done    
-@@ -66,14 +62,9 @@
-     
-     # Providing a lock.
-     while [ 1 ]; do
--	[ ! -e "${LOCK}" ] && mkdir ${LOCK} > /dev/null 2>&1
--	# Ensure we can make the LOCK properly first
--	if [ ! -d "${LOCK}" ] ; then
--		echo "ERROR: The configured lock directory ${LOCK} is not a directory or it does not exist, cannot continue" 
--		exit 1
--	fi
--	# If there is no PIDfile then we can set the pid and break
--	if [ ! -e "${LOCK_PID}" ] ; then
-+        mkdir ${LOCK} > /dev/null 2>&1
-+        MSL=$?
-+        if [ "${MSL}" = "0" ]; then
-             # Lock aquired (setting the pid)
-             echo "$$" > ${LOCK_PID}
-             return;
-@@ -94,6 +85,7 @@
-         if [ "$i" = "${MAX_ITERATION}" ]; then
-             # Unlocking and executing
-             unlock;
-+            mkdir ${LOCK} > /dev/null 2>&1
-             echo "$$" > ${LOCK_PID}
-             return;
-         fi
-@@ -102,15 +94,12 @@
- 
- 
- # Unlock function
--# Just remove the lock file if it is there, keep the lock directory
--# for later. We don't remove the directory (rm -rf is dangerous in a shell script)
- unlock()
- {
--	[ ! -e "${LOCK}" ]  && return 0
--	[ ! -d "${LOCK}" ]  && return 0
--	[ -e "${LOCK_PID}" ] &&  rm -f ${LOCK_PID}
-+    rm -rf ${LOCK}
- }
- 
-+    
- # Help message
- help()
- {
 @@ -198,14 +187,14 @@
              echo "${i} is running..."
          fi
@@ -106,144 +17,8 @@
          if [ $? != 0 ]; then
              echo "${i}: Configuration error. Exiting"
              unlock;
-@@ -220,7 +209,7 @@
-     SDAEMONS="${DB_DAEMON} ${CSYSLOG_DAEMON} ${AGENTLESS_DAEMON} ossec-maild ossec-execd ossec-analysisd ossec-logcollector ossec-remoted ossec-syscheckd ossec-monitord"
-     
-     echo "Starting $NAME $VERSION (by $AUTHOR)..."
--    echo | ${DIRECTORY}/bin/ossec-logtest > /dev/null 2>&1;
-+    echo | ${DIR}/bin/ossec-logtest > /dev/null 2>&1;
-     if [ ! $? = 0 ]; then
-         echo "OSSEC analysisd: Testing rules failed. Configuration error. Exiting."
-         exit 1;
-@@ -233,7 +222,7 @@
-     for i in ${SDAEMONS}; do
-         pstatus ${i};
-         if [ $? = 0 ]; then
--            ${DIRECTORY}/bin/${i} ${DEBUG_CLI};
-+            ${DIR}/bin/${i} ${DEBUG_CLI};
-             if [ $? != 0 ]; then
- 		echo "${i} did not start correctly.";
-                 unlock;
-@@ -264,13 +253,13 @@
-         return 0;
-     fi
-         
--    ls ${LOCK}/${pfile}*.pid > /dev/null 2>&1
-+    ls ${DIR}/var/run/${pfile}*.pid > /dev/null 2>&1
-     if [ $? = 0 ]; then
--        for j in `cat ${LOCK}/${pfile}*.pid 2>/dev/null`; do
-+        for j in `cat ${DIR}/var/run/${pfile}*.pid 2>/dev/null`; do
-             ps -p $j |grep ossec >/dev/null 2>&1
-             if [ ! $? = 0 ]; then
-                 echo "${pfile}: Process $j not used by ossec, removing .."
--                rm -f ${LOCK}/${pfile}-$j.pid
-+                rm -f ${DIR}/var/run/${pfile}-$j.pid
-                 continue;
-             fi
-                 
-@@ -295,12 +284,12 @@
-         if [ $? = 1 ]; then
-             echo "Killing ${i} .. ";
-             
--            kill `cat ${LOCK}/${i}*.pid`;
-+            kill `cat ${DIR}/var/run/${i}*.pid`;
-         else
-             echo "${i} not running .."; 
-         fi
-         
--        rm -f ${LOCK}/${i}*.pid
-+        rm -f ${DIR}/var/run/${i}*.pid
-         
-      done    
-     
 --- a/src/init/ossec-local.sh
 +++ b/src/init/ossec-local.sh
-@@ -5,13 +5,11 @@
- 
- 
- # Getting where we are installed
--[ -e /etc/ossec-init.conf ] && . /etc/ossec-init.conf # Source the configuration file for DIRECTORY
--if [ -z "$DIRECTORY" ]; then
--	echo "ERROR: Cannot determine the value of the OSSEC directory" 
--	[ ! -e "/etc/ossec-init.conf" ] && echo "ERROR: /etc/ossec-init.conf does not exist"
--	exit 1
--fi
--PLIST="${DIRECTORY}/bin/.process_list"
-+LOCAL=`dirname $0`;
-+cd ${LOCAL}
-+PWD=`pwd`
-+DIR=`dirname $PWD`;
-+PLIST=${DIR}/bin/.process_list;
- 
- 
- ###  Do not modify bellow here ###
-@@ -30,8 +28,8 @@
- 
- 
- ## Locking for the start/stop
--LOCK="${DIRECTORY}/var/run/ossec-hids/"
--LOCK_PID="${LOCK}/start-script-lock.pid"
-+LOCK="${DIR}/var/start-script-lock"
-+LOCK_PID="${LOCK}/pid"
- 
- 
- # This number should be more than enough (even if it is
-@@ -45,11 +43,11 @@
- checkpid()
- {
-     for i in ${DAEMONS}; do
--        for j in `cat ${LOCK}/${i}*.pid 2>/dev/null`; do
-+        for j in `cat ${DIR}/var/run/${i}*.pid 2>/dev/null`; do
-             ps -p $j |grep ossec >/dev/null 2>&1
-             if [ ! $? = 0 ]; then
--                echo "Deleting PID file '${LOCK}/${i}-${j}.pid' not used..."
--                rm ${LOCK}/${i}-${j}.pid
-+                echo "Deleting PID file '${DIR}/var/run/${i}-${j}.pid' not used..."
-+                rm ${DIR}/var/run/${i}-${j}.pid
-             fi    
-         done    
-     done    
-@@ -64,14 +62,9 @@
-     
-     # Providing a lock.
-     while [ 1 ]; do
--        [ ! -e "${LOCK}" ] && mkdir -p ${LOCK} > /dev/null 2>&1
--        # Ensure we can make the LOCK properly first
--	if [ ! -d "${LOCK}" ] ; then
--		echo "ERROR: The configured lock directory ${LOCK} is not a directory or it does not exist, cannot continue" 
--		exit 1
--	fi
--	# If there is no PIDfile then we can set the pid and break
--	if [ ! -e "${LOCK_PID}" ] ; then
-+        mkdir ${LOCK} > /dev/null 2>&1
-+        MSL=$?
-+        if [ "${MSL}" = "0" ]; then
-             # Lock aquired (setting the pid)
-             echo "$$" > ${LOCK_PID}
-             return;
-@@ -92,6 +85,7 @@
-         if [ "$i" = "${MAX_ITERATION}" ]; then
-             # Unlocking and executing
-             unlock;
-+            mkdir ${LOCK} > /dev/null 2>&1
-             echo "$$" > ${LOCK_PID}
-             return;
-         fi
-@@ -100,13 +94,9 @@
- 
- 
- # Unlock function
--# Just remove the lock file if it is there, keep the lock directory
--# for later. We don't remove the directory (rm -rf is dangerous in a shell script)
- unlock()
- {
--	[ ! -e "${LOCK}" ]  && return 0
--	[ ! -d "${LOCK}" ]  && return 0
--	[ -e "${LOCK_PID}" ] &&  rm -f ${LOCK_PID}
-+    rm -rf ${LOCK}
- }
- 
-     
 @@ -197,14 +187,14 @@
              echo "${i} is running..."
          fi
@@ -261,194 +36,3 @@
          if [ $? != 0 ]; then
              echo "${i}: Configuration error. Exiting"
              unlock;
-@@ -220,7 +210,7 @@
-     SDAEMONS="${DB_DAEMON} ${CSYSLOG_DAEMON} ${AGENTLESS_DAEMON} ossec-maild ossec-execd ossec-analysisd ossec-logcollector ossec-syscheckd ossec-monitord"
-     
-     echo "Starting $NAME $VERSION (by $AUTHOR)..."
--    echo | ${DIRECTORY}/bin/ossec-logtest > /dev/null 2>&1;
-+    echo | ${DIR}/bin/ossec-logtest > /dev/null 2>&1;
-     if [ ! $? = 0 ]; then
-         echo "ossec-analysisd: Configuration error. Exiting."
-         exit 1;
-@@ -234,7 +224,7 @@
-     for i in ${SDAEMONS}; do
-         pstatus ${i};
-         if [ $? = 0 ]; then
--            ${DIRECTORY}/bin/${i} ${DEBUG_CLI};
-+            ${DIR}/bin/${i} ${DEBUG_CLI};
-             if [ $? != 0 ]; then
- 		echo "${i} did not start correctly.";
-                 unlock;
-@@ -273,13 +263,13 @@
-         return 0;
-     fi
-         
--    ls ${LOCK}/${pfile}*.pid > /dev/null 2>&1
-+    ls ${DIR}/var/run/${pfile}*.pid > /dev/null 2>&1
-     if [ $? = 0 ]; then
--        for j in `cat ${LOCK}/${pfile}*.pid 2>/dev/null`; do
-+        for j in `cat ${DIR}/var/run/${pfile}*.pid 2>/dev/null`; do
-             ps -p $j |grep ossec >/dev/null 2>&1
-             if [ ! $? = 0 ]; then
-                 echo "${pfile}: Process $j not used by ossec, removing .."
--                rm -f ${LOCK}/${pfile}-$j.pid
-+                rm -f ${DIR}/var/run/${pfile}-$j.pid
-                 continue;
-             fi
-                 
-@@ -304,12 +294,12 @@
-         if [ $? = 1 ]; then
-             echo "Killing ${i} .. ";
-             
--            kill `cat ${LOCK}/${i}*.pid`;
-+            kill `cat ${DIR}/var/run/${i}*.pid`;
-         else
-             echo "${i} not running .."; 
-         fi
-         
--        rm -f ${LOCK}/${i}*.pid
-+        rm -f ${DIR}/var/run/${i}*.pid
-         
-      done    
-     
---- a/src/init/ossec-client.sh
-+++ b/src/init/ossec-client.sh
-@@ -4,14 +4,10 @@
- # Author: Daniel B. Cid <daniel.cid at gmail.com>
- 
- 
--[ -e /etc/ossec-init.conf ] && . /etc/ossec-init.conf # Source the configuration file for DIRECTORY
--if [ -z "$DIRECTORY" ]; then
--	echo "ERROR: Cannot determine the value of the OSSEC directory" 
--	[ ! -e "/etc/ossec-init.conf" ] && echo "ERROR: /etc/ossec-init.conf does not exist"
--	exit 1
--fi
- LOCAL=`dirname $0`;
- cd ${LOCAL}
-+PWD=`pwd`
-+DIR=`dirname $PWD`;
- 
- ###  Do not modify bellow here ###
- NAME="OSSEC HIDS"
-@@ -21,8 +17,8 @@
- 
- 
- ## Locking for the start/stop
--LOCK="${DIRECTORY}/var/run/ossec-hids/"
--LOCK_PID="${LOCK}/start-script-lock.pid"
-+LOCK="${DIR}/var/start-script-lock"
-+LOCK_PID="${LOCK}/pid"
- 
- 
- # This number should be more than enough (even if it is
-@@ -36,11 +32,11 @@
- checkpid()
- {
-     for i in ${DAEMONS}; do
--        for j in `cat ${LOCK}/${i}*.pid 2>/dev/null`; do
-+        for j in `cat ${DIR}/var/run/${i}*.pid 2>/dev/null`; do
-             ps -p $j |grep ossec >/dev/null 2>&1
-             if [ ! $? = 0 ]; then
--                echo "Deleting PID file '${LOCK}/${i}-${j}.pid' not used..."
--                rm ${LOCK}/${i}-${j}.pid
-+                echo "Deleting PID file '${DIR}/var/run/${i}-${j}.pid' not used..."
-+                rm ${DIR}/var/run/${i}-${j}.pid
-             fi    
-         done    
-     done    
-@@ -55,14 +51,9 @@
-     
-     # Providing a lock.
-     while [ 1 ]; do
--        [ ! -e "${LOCK}" ] && mkdir -p ${LOCK} > /dev/null 2>&1
--        # Ensure we can make the LOCK properly first
--	if [ ! -d "${LOCK}" ] ; then
--		echo "ERROR: The configured lock directory ${LOCK} is not a directory or it does not exist, cannot continue" 
--		exit 1
--	fi
--	# If there is no PIDfile then we can set the pid and break
--	if [ ! -e "${LOCK_PID}" ] ; then
-+        mkdir ${LOCK} > /dev/null 2>&1
-+        MSL=$?
-+        if [ "${MSL}" = "0" ]; then
-             # Lock aquired (setting the pid)
-             echo "$$" > ${LOCK_PID}
-             return;
-@@ -83,23 +74,21 @@
-         if [ "$i" = "${MAX_ITERATION}" ]; then
-             # Unlocking and executing
-             unlock;
-+            mkdir ${LOCK} > /dev/null 2>&1
-             echo "$$" > ${LOCK_PID}
-             return;
-         fi
-     done
- }
- 
-+
- # Unlock function
--# Just remove the lock file if it is there, keep the lock directory
--# for later. We don't remove the directory (rm -rf is dangerous in a shell script)
- unlock()
- {
--	[ ! -e "${LOCK}" ]  && return 0
--	[ ! -d "${LOCK}" ]  && return 0
--	[ -e "${LOCK_PID}" ] &&  rm -f ${LOCK_PID}
-+    rm -rf ${LOCK}
- }
- 
--
-+    
- # Help message
- help()
- {
-@@ -126,7 +115,7 @@
- {
-     # We first loop to check the config. 
-     for i in ${SDAEMONS}; do
--        ${DIRECTORY}/bin/${i} -t;
-+        ${DIR}/bin/${i} -t;
-         if [ $? != 0 ]; then
-             echo "${i}: Configuration error. Exiting"
-             unlock;
-@@ -149,7 +138,7 @@
-     for i in ${SDAEMONS}; do
-         pstatus ${i};
-         if [ $? = 0 ]; then
--            ${DIRECTORY}/bin/${i};
-+            ${DIR}/bin/${i};
-             if [ $? != 0 ]; then
- 		echo "${i} did not start";
-                 unlock;
-@@ -180,13 +169,13 @@
-         return 0;
-     fi
-         
--    ls ${LOCK}/${pfile}*.pid > /dev/null 2>&1
-+    ls ${DIR}/var/run/${pfile}*.pid > /dev/null 2>&1
-     if [ $? = 0 ]; then
--        for j in `cat ${LOCK}/${pfile}*.pid 2>/dev/null`; do
-+        for j in `cat ${DIR}/var/run/${pfile}*.pid 2>/dev/null`; do
-             ps -p $j |grep ossec >/dev/null 2>&1
-             if [ ! $? = 0 ]; then
-                 echo "${pfile}: Process $j not used by ossec, removing .."
--                rm -f ${LOCK}/${pfile}-$j.pid
-+                rm -f ${DIR}/var/run/${pfile}-$j.pid
-                 continue;
-             fi
-                 
-@@ -211,12 +200,12 @@
-         if [ $? = 1 ]; then
-             echo "Killing ${i} .. ";
-             
--            kill `cat ${LOCK}/${i}*.pid`;
-+            kill `cat ${DIR}/var/run/${i}*.pid`;
-         else
-             echo "${i} not running .."; 
-         fi
-         
--        rm -f ${LOCK}/${i}*.pid
-+        rm -f ${DIR}/var/run/${i}*.pid
-         
-      done    
-     

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ossec/pkg-ossec.git



More information about the Pkg-ossec-devel mailing list