debian/0000755000000000000000000000000012075615433007174 5ustar debian/libsanlock-client1.symbols0000644000000000000000000000111711763134432014262 0ustar libsanlock_client.so.1 libsanlock-client1 #MINVER# sanlock_acquire@Base 2.1 sanlock_add_lockspace@Base 2.1 sanlock_align@Base 2.1 sanlock_args_to_state@Base 2.1 sanlock_examine@Base 2.1 sanlock_init@Base 2.1 sanlock_inq_lockspace@Base 2.1 sanlock_inquire@Base 2.1 sanlock_register@Base 2.1 sanlock_release@Base 2.1 sanlock_rem_lockspace@Base 2.1 sanlock_request@Base 2.1 sanlock_res_to_str@Base 2.1 sanlock_restrict@Base 2.1 sanlock_socket_address@Base 2.1 sanlock_state_to_args@Base 2.1 sanlock_str_to_lockspace@Base 2.1 sanlock_str_to_res@Base 2.1 send_command@Base 2.1 debian/sanlock.sanlock.default0000644000000000000000000000026011763134432013621 0ustar # Whether the daemon should be started at boot time. # Set to 1 to start. enabled=1 # options passwd to sanlock # Use -w 0 if you don't have wdmd running sanlock_opts="-w 0" debian/copyright0000644000000000000000000000662711763134432011140 0ustar This package was debianized by David Weber on 24.04.2012 The current Debian maintainer is David Weber It was downloaded from: http://git.fedorahosted.org/git/?p=sanlock.git;a=summary Upstream Authors: Daniel P. Berrange, David Teigland, David Weber, Fabio M. Di Nitto, Federico Simoncelli, Saggi Mizrahi Copyright: 2010-2011 Red Hat, Inc. These files are LGPLv2+ licensed: src/libsanlock_client.so src/sanlock.h src/sanlock_rv.h src/sanlock_admin.h src/sanlock_resource.h src/sanlock_sock.h src/sanlock_sock.c src/client.c wdmd/libwdmd.so wdmd/wdmd.h wdmd/wdmd_sock.h wdmd/wdmd_sock.c wdmd/client.c This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU LIBRARY GENERAL PUBLIC LICENSE Version 2,, can be found in /usr/share/common-licenses/LGPL-2 This file is GPLv2 licensed: src/list.h (copied from linux kernel) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL-2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. On Debian systems, the complete text of the GNU General Public License, version 2, can be found in /usr/share/common-licenses/GPL-2. This an all other original files are GPLv2+ licensd src/crc32c.c (copied from btrfs-progs which copied from linux kernel) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL-2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. On Debian systems, the complete text of the GNU General Public License, version 2, can be found in /usr/share/common-licenses/GPL-2. The Debian packaging is (©) 2012, David Weber and is licensed under the GPL, see above. debian/sanlock.wdmd.default0000644000000000000000000000030111763134432013116 0ustar # Whether the daemon should be started at boot time. # Set to 1 to start. # Enable it if you hava a watchdog device (or softdog kernel module) enabled=0 # options passwd to wdmd wdmd_opts="" debian/libsanlock-dev.install0000644000000000000000000000014411763134432013456 0ustar usr/lib/libsanlock_client.so usr/lib/sanlock/libsanlock.so usr/lib/sanlock/libwdmd.so usr/include/* debian/sanlock.symbols0000644000000000000000000000431111763134432012235 0ustar libsanlock.so.1 sanlock #MINVER# check_mode_block@Base 2.1 client@Base 2.1 close_disks@Base 2.1 close_task_aio@Base 2.1 com@Base 2.1 crc32c@Base 2.1 delta_lease_acquire@Base 2.1 delta_lease_init@Base 2.1 delta_lease_leader_read@Base 2.1 delta_lease_release@Base 2.1 delta_lease_renew@Base 2.1 direct_acquire@Base 2.1 direct_acquire_id@Base 2.1 direct_align@Base 2.1 direct_dump@Base 2.1 direct_init@Base 2.1 direct_live_id@Base 2.1 direct_read_id@Base 2.1 direct_read_leader@Base 2.1 direct_release@Base 2.1 direct_release_id@Base 2.1 direct_renew_id@Base 2.1 external_shutdown@Base 2.1 get_rand@Base 2.1 host_info@Base 2.1 leader_checksum@Base 2.1 lockspace_disk@Base 2.1 log_level@Base 2.1 main_task@Base 2.1 majority_disks@Base 2.1 monotime@Base 2.1 open_disk@Base 2.1 open_disks@Base 2.1 open_disks_fd@Base 2.1 our_host_name_global@Base 2.1 paxos_lease_acquire@Base 2.1 paxos_lease_init@Base 2.1 paxos_lease_leader_read@Base 2.1 paxos_lease_release@Base 2.1 paxos_lease_request_read@Base 2.1 paxos_lease_request_write@Base 2.1 read_iobuf@Base 2.1 read_iobuf_reap@Base 2.1 read_sectors@Base 2.1 sanlock_acquire@Base 2.1 sanlock_add_lockspace@Base 2.1 sanlock_align@Base 2.1 sanlock_args_to_state@Base 2.1 sanlock_direct_align@Base 2.1 sanlock_direct_init@Base 2.1 sanlock_direct_live_id@Base 2.1 sanlock_direct_read_id@Base 2.1 sanlock_examine@Base 2.1 sanlock_init@Base 2.1 sanlock_inq_lockspace@Base 2.1 sanlock_inquire@Base 2.1 sanlock_register@Base 2.1 sanlock_release@Base 2.1 sanlock_rem_lockspace@Base 2.1 sanlock_request@Base 2.1 sanlock_res_to_str@Base 2.1 sanlock_restrict@Base 2.1 sanlock_socket_address@Base 2.1 sanlock_state_to_args@Base 2.1 sanlock_str_to_lockspace@Base 2.1 sanlock_str_to_res@Base 2.1 send_command@Base 2.1 setup_task_aio@Base 2.1 setup_task_timeouts@Base 2.1 spaces@Base 2.1 spaces_add@Base 2.1 spaces_mutex@Base 2.1 spaces_rem@Base 2.1 test_id_bit@Base 2.1 write_iobuf@Base 2.1 write_sector@Base 2.1 write_sectors@Base 2.1 libwdmd.so.1 sanlock #MINVER# wdmd_connect@Base 2.1 wdmd_refcount_clear@Base 2.1 wdmd_refcount_set@Base 2.1 wdmd_register@Base 2.1 wdmd_socket_address@Base 2.1 wdmd_status@Base 2.1 wdmd_test_live@Base 2.1 debian/sanlock.postrm0000644000000000000000000000207211763134432012073 0ustar #!/bin/sh # postrm script for sanlock # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `purge' # * `upgrade' # * `failed-upgrade' # * `abort-install' # * `abort-install' # * `abort-upgrade' # * `disappear' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in purge) if getent group sanlock >/dev/null; then deluser --quiet --system sanlock || true fi if getent group sanlock >/dev/null; then delgroup sanlock || true fi ;; remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 debian/control0000644000000000000000000000240211763134432010573 0ustar Source: sanlock Section: libs Standards-Version: 3.9.3 Priority: optional Homepage: https://fedorahosted.org/sanlock/ Maintainer: David Weber Build-Depends: libaio-dev, libblkid1, libblkid-dev, debhelper (>= 8), Package: sanlock Depends: ${shlibs:Depends}, ${misc:Depends}, adduser Architecture: any Description: shared storage lock manager Sanlock ensures that single disk cannot be used by more than one running VM at a time, across any host in a network. This package contains the binaries and private shared libraries Package: libsanlock-client1 Depends: ${shlibs:Depends}, ${misc:Depends} Architecture: any Description: shared storage lock manager (client library) Sanlock ensures that single disk cannot be used by more than one running VM at a time, across any host in a network. This package contains the pulbic shared library for libvirt Package: libsanlock-dev Depends: ${misc:Depends}, libsanlock-client1 (= ${binary:Version}), sanlock (= ${binary:Version}) Architecture: any Section: libdevel Description: shared storage lock manager (development files) Sanlock ensures that single disk cannot be used by more than one running VM at a time, across any host in a network. This package contains the header files and static libraries. debian/changelog0000644000000000000000000000125112075614714011046 0ustar sanlock (2.2-2) unstable; urgency=low * Fix CVE-2012-5638 sanlock world writable /var/log/sanlock.log. Thanks to Salvatore Bonaccorso (Closes: #696424) Add patches cherry-picked from git repository: - 0001-sanlock-remove-umask-0.patch - 0001-sanlock-use-lockfile-mode-644.patch - 0001-wdmd-use-lockfile-mode-644.patch * Replace restrict field name (Closes: #689696) Add patch cherry-picked from git repository: - restrict.patch -- David Weber Thu, 03 Jan 2013 22:12:33 +0100 sanlock (2.2-1) unstable; urgency=low * Initial release. (Closes: #669102) -- David Weber Tue, 29 May 2012 13:38:45 +0200 debian/sanlock.sanlock.init0000755000000000000000000000731611763134432013154 0ustar #!/bin/sh ### BEGIN INIT INFO # Provides: sanlock # Required-Start: $network $local_fs $remote_fs wdmd # Required-Stop: $remote_fs wdmd # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Lock-Manager for libvirt # Description: Sanlock ensures that single disk cannot be used by more than # one running VM at a time, across any host in a network. ### END INIT INFO # Author: David Weber # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="sanlock lock-manager" # Introduce a short description here NAME=sanlock # Introduce the short server's name here DAEMON=/usr/sbin/sanlock # Introduce the server's location here DAEMON_ARGS="daemon" # Arguments to run the daemon with PIDFILE=/var/run/$NAME/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x $DAEMON ] || exit 0 # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME [ "$enabled" = "1" ] || exit 0 # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # # Function that starts the daemon/service # do_start() { # Return # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $DAEMON_ARGS $sanlock_opts \ || return 2 # Add code here, if necessary, that waits for the process to be ready # to handle requests from services started subsequently which depend # on this one. As a last resort, sleep for some time. } # # Function that stops the daemon/service # do_stop() { # Return # 0 if daemon has been stopped # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 # Wait for children to finish too if this is a daemon that forks # and if the daemon is only ever run from this initscript. # If the above conditions are not satisfied then add some other code # that waits for the process to drop all resources that could be # needed by services started subsequently. A last resort is to # sleep for some time. start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON [ "$?" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE return "$RETVAL" } case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" do_start case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; restart|force-reload) # # If the "reload" option is implemented then remove the # 'force-reload' alias # log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2 exit 3 ;; esac : debian/sanlock.install0000644000000000000000000000023611763134432012215 0ustar usr/sbin/* usr/lib/sanlock/libsanlock.so.1.0 usr/lib/sanlock/libsanlock.so.1 usr/lib/sanlock/libwdmd.so.1 usr/lib/sanlock/libwdmd.so.1.0 usr/share/man/man8/* debian/rules0000755000000000000000000000154011763134432010252 0ustar #!/usr/bin/make -f DEB_BUILDDIR := $(CURDIR)/debian/build LD_LIBRARY_PATH := /usr/lib/sanlock:$(LD_LIBRARY_PATH) #LD_LIBRARY_PATH=/usr/lib/sanlock:${LD_LIBRARY_PATH} #LD_LIBRARY_PATH=/usr/lib/sanlock:$(LD_LIBRARY_PATH) dh_shlibdeps #LD_LIBRARY_PATH := /usr/lib/sanlock override_dh_auto_build: dh_auto_build -D wdmd dh_auto_build -D src override_dh_auto_clean: dh_auto_clean -D wdmd dh_auto_clean -D src override_dh_auto_configure: dh_auto_configure -D wdmd dh_auto_configure -D src override_dh_auto_install: dh_auto_install -D wdmd dh_auto_install -D src override_dh_makeshlibs: dh_makeshlibs -X/usr/lib/sanlock override_dh_auto_test: dh_auto_test -D wdmd dh_auto_test -D src override_dh_installinit: dh_installinit -psanlock --name=wdmd --no-restart-on-upgrade dh_installinit -psanlock --name=sanlock --no-restart-on-upgrade %: dh $@ debian/source/0000755000000000000000000000000011763134432010472 5ustar debian/source/format0000644000000000000000000000001411763134432011700 0ustar 3.0 (quilt) debian/sanlock.wdmd.init0000755000000000000000000000731511763134432012454 0ustar #!/bin/sh ### BEGIN INIT INFO # Provides: wdmd # Required-Start: $network $local_fs $remote_fs # Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: watchdog multiplexing daemon # Description: This daemon opens /dev/watchdog and allows multiple independent sources # to detmermine whether each KEEPALIVE is done. ### END INIT INFO # Author: David Weber # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="watchdog multiplexing daemon" # Introduce a short description here NAME=wdmd # Introduce the short server's name here DAEMON=/usr/sbin/wdmd # Introduce the server's location here DAEMON_ARGS="" # Arguments to run the daemon with PIDFILE=/var/run/$NAME/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x $DAEMON ] || exit 0 # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME [ "$enabled" = "1" ] || exit 0 # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # # Function that starts the daemon/service # do_start() { # Return # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $DAEMON_ARGS $wdmd_opts \ || return 2 # Add code here, if necessary, that waits for the process to be ready # to handle requests from services started subsequently which depend # on this one. As a last resort, sleep for some time. } # # Function that stops the daemon/service # do_stop() { # Return # 0 if daemon has been stopped # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 # Wait for children to finish too if this is a daemon that forks # and if the daemon is only ever run from this initscript. # If the above conditions are not satisfied then add some other code # that waits for the process to drop all resources that could be # needed by services started subsequently. A last resort is to # sleep for some time. start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON [ "$?" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE return "$RETVAL" } case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" do_start case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; restart|force-reload) # # If the "reload" option is implemented then remove the # 'force-reload' alias # log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2 exit 3 ;; esac : debian/compat0000644000000000000000000000000211763134432010370 0ustar 8 debian/libsanlock-client1.install0000644000000000000000000000010111763134432014230 0ustar usr/lib/libsanlock_client.so.1.0 usr/lib/libsanlock_client.so.1 debian/patches/0000755000000000000000000000000012075614620010620 5ustar debian/patches/series0000644000000000000000000000032112075614620012031 0ustar sanlock-SCHED_RESET_ON_FORK-undefined.patch libdir.patch put_libs_into_dir.patch 0001-sanlock-remove-umask-0.patch 0001-sanlock-use-lockfile-mode-644.patch 0001-wdmd-use-lockfile-mode-644.patch restrict.patch debian/patches/put_libs_into_dir.patch0000644000000000000000000000612011763134432015351 0ustar put the private shared libraries into /usr/lib/sanlock diff --git a/src/Makefile b/src/Makefile index d101f30..92d5d9f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,6 +8,8 @@ CMD_TARGET = sanlock HEADER_TARGET = sanlock.h sanlock_rv.h sanlock_resource.h sanlock_admin.h sanlock_direct.h MAN_TARGET = sanlock.8 +LIBDIR_NAME = sanlock + SOMAJOR=1 SOMINOR=0 @@ -72,7 +74,7 @@ CFLAGS += -D_GNU_SOURCE -g \ CMD_CFLAGS = $(CFLAGS) -fPIE -DPIE -CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie +CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie -Wl,-rpath=/usr/lib/sanlock CMD_LDADD += -lpthread -luuid -lrt -laio -lblkid -lsanlock -L../wdmd -lwdmd LIB_ENTIRE_LDFLAGS += -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd @@ -112,14 +114,15 @@ MANDIR=/usr/share/man install: all $(INSTALL) -d $(DESTDIR)/$(BINDIR) $(INSTALL) -d $(DESTDIR)/$(LIBDIR) + $(INSTALL) -d $(DESTDIR)/$(LIBDIR)/$(LIBDIR_NAME) $(INSTALL) -d $(DESTDIR)/$(HEADIR) $(INSTALL) -d $(DESTDIR)/$(MANDIR)/man8 $(INSTALL) -c -m 755 $(CMD_TARGET) $(DESTDIR)/$(BINDIR) - $(INSTALL) -c -m 755 $(LIBSO_ENTIRE_TARGET) $(DESTDIR)/$(LIBDIR) + $(INSTALL) -c -m 755 $(LIBSO_ENTIRE_TARGET) $(DESTDIR)/$(LIBDIR)/$(LIBDIR_NAME) $(INSTALL) -c -m 755 $(LIBSO_CLIENT_TARGET) $(DESTDIR)/$(LIBDIR) - cp -a $(LIB_ENTIRE_TARGET).so $(DESTDIR)/$(LIBDIR) + cp -a $(LIB_ENTIRE_TARGET).so $(DESTDIR)/$(LIBDIR)/$(LIBDIR_NAME) cp -a $(LIB_CLIENT_TARGET).so $(DESTDIR)/$(LIBDIR) - cp -a $(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $(DESTDIR)/$(LIBDIR) + cp -a $(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $(DESTDIR)/$(LIBDIR)/$(LIBDIR_NAME) cp -a $(LIB_CLIENT_TARGET).so.$(SOMAJOR) $(DESTDIR)/$(LIBDIR) $(INSTALL) -c -m 644 $(HEADER_TARGET) $(DESTDIR)/$(HEADIR) $(INSTALL) -m 644 $(MAN_TARGET) $(DESTDIR)/$(MANDIR)/man8/ diff --git a/wdmd/Makefile b/wdmd/Makefile index 205245b..4db2dc1 100644 --- a/wdmd/Makefile +++ b/wdmd/Makefile @@ -10,6 +10,8 @@ HEADER_TARGET = wdmd.h MAN_TARGET = wdmd.8 TEST_TARGET = wdmd_client +LIBDIR_NAME = sanlock + SOMAJOR=1 SOMINOR=0 SHLIB_TARGET = $(LIB_TARGET).so.$(SOMAJOR).$(SOMINOR) @@ -42,7 +44,7 @@ CFLAGS += -D_GNU_SOURCE -g \ -fdiagnostics-show-option \ -fPIE -DPIE -CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie +CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie -Wl,-rpath=/usr/lib/sanlock CMD_LDADD += -lwdmd -lrt LIB_LDFLAGS += -Wl,-z,relro -pie @@ -79,11 +81,12 @@ MANDIR=/usr/share/man install: all $(INSTALL) -d $(DESTDIR)/$(BINDIR) $(INSTALL) -d $(DESTDIR)/$(LIBDIR) + $(INSTALL) -d $(DESTDIR)/$(LIBDIR)/$(LIBDIR_NAME) $(INSTALL) -d $(DESTDIR)/$(HEADIR) $(INSTALL) -d $(DESTDIR)/$(MANDIR)/man8 $(INSTALL) -c -m 755 $(CMD_TARGET) $(DESTDIR)/$(BINDIR) - $(INSTALL) -c -m 755 $(SHLIB_TARGET) $(DESTDIR)/$(LIBDIR) - cp -a $(LIB_TARGET).so $(DESTDIR)/$(LIBDIR) - cp -a $(LIB_TARGET).so.$(SOMAJOR) $(DESTDIR)/$(LIBDIR) + $(INSTALL) -c -m 755 $(SHLIB_TARGET) $(DESTDIR)/$(LIBDIR)/$(LIBDIR_NAME) + cp -a $(LIB_TARGET).so $(DESTDIR)/$(LIBDIR)/$(LIBDIR_NAME) + cp -a $(LIB_TARGET).so.$(SOMAJOR) $(DESTDIR)/$(LIBDIR)/$(LIBDIR_NAME) $(INSTALL) -c -m 644 $(HEADER_TARGET) $(DESTDIR)/$(HEADIR) $(INSTALL) -m 644 $(MAN_TARGET) $(DESTDIR)/$(MANDIR)/man8 debian/patches/0001-sanlock-use-lockfile-mode-644.patch0000644000000000000000000000117512075614620017472 0ustar From 1339694c3bad23055f896e90353c81fd65bd4a7e Mon Sep 17 00:00:00 2001 From: David Teigland Date: Thu, 2 Aug 2012 11:27:54 -0500 Subject: [PATCH] sanlock: use lockfile mode 644 Signed-off-by: David Teigland --- src/lockfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/src/lockfile.c +++ b/src/lockfile.c @@ -47,7 +47,7 @@ snprintf(path, PATH_MAX, "%s/%s", dir, name); - fd = open(path, O_CREAT|O_WRONLY|O_CLOEXEC, 0666); + fd = open(path, O_CREAT|O_WRONLY|O_CLOEXEC, 0644); if (fd < 0) { log_error("lockfile open error %s: %s", path, strerror(errno)); debian/patches/libdir.patch0000644000000000000000000000115211763134432013106 0ustar Sanlock installs to /usr/lib64 by default. This is not right on debian diff --git a/src/Makefile b/src/Makefile index d101f30..fb551c8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -104,7 +104,7 @@ INSTALL=$(shell which install) DESTDIR= BINDIR=/usr/sbin -LIBDIR=/usr/lib64 +LIBDIR=/usr/lib HEADIR=/usr/include MANDIR=/usr/share/man diff --git a/wdmd/Makefile b/wdmd/Makefile index 205245b..2356178 100644 --- a/wdmd/Makefile +++ b/wdmd/Makefile @@ -71,7 +71,7 @@ INSTALL=$(shell which install) DESTDIR= BINDIR=/usr/sbin -LIBDIR=/usr/lib64 +LIBDIR=/usr/lib HEADIR=/usr/include MANDIR=/usr/share/man debian/patches/sanlock-SCHED_RESET_ON_FORK-undefined.patch0000644000000000000000000000121411763134432020234 0ustar Is needed to compile on some systems diff --git a/src/main.c b/src/main.c index 82c39af..898e2a8 100644 --- a/src/main.c +++ b/src/main.c @@ -52,6 +52,10 @@ #define RELEASE_VERSION "2.2" +#ifndef SCHED_RESET_ON_FORK +#define SCHED_RESET_ON_FORK 0 +#endif + struct thread_pool { int num_workers; int max_workers; diff --git a/wdmd/main.c b/wdmd/main.c index bd95f9d..0623b7c 100644 --- a/wdmd/main.c +++ b/wdmd/main.c @@ -43,6 +43,10 @@ #define RELEASE_VERSION "2.2" +#ifndef SCHED_RESET_ON_FORK +#define SCHED_RESET_ON_FORK 0 +#endif + #define DEFAULT_TEST_INTERVAL 10 #define DEFAULT_FIRE_TIMEOUT 60 #define DEFAULT_HIGH_PRIORITY 1 debian/patches/0001-wdmd-use-lockfile-mode-644.patch0000644000000000000000000000122512075614620016767 0ustar From 3a2ba2d0fbe78f4eacd438b708ceff6e96903d37 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Wed, 1 Aug 2012 17:00:53 -0500 Subject: [PATCH] wdmd: use lockfile mode 644 Signed-off-by: David Teigland --- wdmd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/wdmd/main.c +++ b/wdmd/main.c @@ -819,7 +819,7 @@ sprintf(lockfile_path, "%s/wdmd.pid", WDMD_RUN_DIR); - fd = open(lockfile_path, O_CREAT|O_WRONLY|O_CLOEXEC, 0666); + fd = open(lockfile_path, O_CREAT|O_WRONLY|O_CLOEXEC, 0644); if (fd < 0) { log_error("lockfile open error %s: %s", lockfile_path, strerror(errno)); debian/patches/0001-sanlock-remove-umask-0.patch0000644000000000000000000000112612075614620016417 0ustar From 9b13cb12973fac422423eec1c6a91f21b5257c92 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Fri, 3 Aug 2012 14:24:07 -0500 Subject: [PATCH] sanlock: remove umask 0 Remove umask(0) which causes sanlock.log to have mode 666. It's 644 without the umask. Signed-off-by: David Teigland --- src/main.c | 1 - 1 file changed, 1 deletion(-) --- a/src/main.c +++ b/src/main.c @@ -1198,7 +1198,6 @@ log_tool("cannot fork daemon\n"); exit(EXIT_FAILURE); } - umask(0); } /* main task never does disk io, so we don't really need to set debian/patches/restrict.patch0000644000000000000000000000575012075614620013507 0ustar Index: sanlock-2.2/src/cmd.c =================================================================== --- sanlock-2.2.orig/src/cmd.c 2012-05-07 17:43:52.000000000 +0200 +++ sanlock-2.2/src/cmd.c 2013-01-10 10:16:41.452028239 +0100 @@ -302,7 +302,7 @@ token->host_id = space.host_id; token->host_generation = space.host_generation; token->pid = cl_pid; - if (cl->restrict & SANLK_RESTRICT_SIGKILL) + if (cl->restricted & SANLK_RESTRICT_SIGKILL) token->flags |= T_RESTRICT_SIGKILL; /* save a record of what this token_id is for later debugging */ @@ -1278,7 +1278,7 @@ "ci=%d " "fd=%d " "pid=%d " - "restrict=%x " + "restricted=%x " "cmd_active=%d " "cmd_last=%d " "pid_dead=%d " @@ -1289,7 +1289,7 @@ ci, cl->fd, cl->pid, - cl->restrict, + cl->restricted, cl->cmd_active, cl->cmd_last, cl->pid_dead, @@ -1621,7 +1621,7 @@ log_debug("cmd_restrict ci %d fd %d pid %d flags %x", ci, fd, client[ci].pid, h_recv->cmd_flags); - client[ci].restrict = h_recv->cmd_flags; + client[ci].restricted = h_recv->cmd_flags; send_result(fd, h_recv, 0); } Index: sanlock-2.2/src/main.c =================================================================== --- sanlock-2.2.orig/src/main.c 2013-01-10 09:52:54.000000000 +0100 +++ sanlock-2.2/src/main.c 2013-01-10 10:18:24.148033530 +0100 @@ -157,7 +157,7 @@ cl->need_free = 0; cl->kill_count = 0; cl->kill_last = 0; - cl->restrict = 0; + cl->restricted = 0; memset(cl->owner_name, 0, sizeof(cl->owner_name)); cl->workfn = NULL; cl->deadfn = NULL; @@ -481,9 +481,9 @@ fd = cl->fd; pid = cl->pid; - if (cl->restrict & SANLK_RESTRICT_SIGKILL) + if (cl->restricted & SANLK_RESTRICT_SIGKILL) sig = SIGTERM; - else if (cl->restrict & SANLK_RESTRICT_SIGTERM) + else if (cl->restricted & SANLK_RESTRICT_SIGTERM) sig = SIGKILL; else if (cl->kill_count <= main_task.kill_count_term) sig = SIGTERM; @@ -990,7 +990,7 @@ ci, rv, h.magic, SM_MAGIC); goto dead; } - if (client[ci].restrict & SANLK_RESTRICT_ALL) { + if (client[ci].restricted & SANLK_RESTRICT_ALL) { log_error("ci %d fd %d pid %d cmd %d restrict all", ci, client[ci].fd, client[ci].pid, h.cmd); goto dead; Index: sanlock-2.2/src/sanlock_internal.h =================================================================== --- sanlock-2.2.orig/src/sanlock_internal.h 2012-05-07 17:43:52.000000000 +0200 +++ sanlock-2.2/src/sanlock_internal.h 2013-01-10 10:18:58.000030946 +0100 @@ -67,7 +67,7 @@ * 'struct resource' keeps track of resources globally, resources list */ -#define T_RESTRICT_SIGKILL 0x00000001 /* inherited from client->restrict */ +#define T_RESTRICT_SIGKILL 0x00000001 /* inherited from client->restricted */ #define T_LS_DEAD 0x00000002 /* don't bother trying to release if ls is dead */ struct token { @@ -492,7 +492,7 @@ int suspend; int need_free; int kill_count; - uint32_t restrict; + uint32_t restricted; uint64_t kill_last; char owner_name[SANLK_NAME_LEN+1]; pthread_mutex_t mutex; debian/README.Source0000644000000000000000000000042711763134432011314 0ustar There aren't any official tarballs. How to create one for debian: -Download the tagged version via gitweb[1] -Extract the archive -Rename the directory to sanlock-VERSION -Recompress the directory to a orig tarball [1] http://git.fedorahosted.org/git/?p=sanlock.git;a=summary debian/sanlock.postinst0000644000000000000000000000311112075614620012424 0ustar #!/bin/sh # postinst script for libvirt-bin # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package add_statoverrides() { # Fix permission from old sanlock versions, see #696424 if [ -f /run/sanlock/sanlock.pid ] && [ `stat -c %a /run/sanlock/sanlock.pid` -ne "644" ] then chmod -f 644 /run/sanlock/sanlock.pid fi if [ -f /var/log/sanlock.log ] && [ `stat -c %a /var/log/sanlock.log` -ne "644" ] then chmod -f 644 /var/log/sanlock.log fi } case "$1" in configure) add_statoverrides if ! getent group sanlock >/dev/null; then addgroup --quiet --system sanlock fi if ! getent passwd sanlock >/dev/null; then adduser --quiet \ --system \ --ingroup sanlock \ --quiet \ --disabled-login \ --disabled-password \ --no-create-home \ -gecos "sanlock" \ sanlock fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0