/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to init.d-mandos

  • Committer: Teddy Hogeborn
  • Date: 2021-02-03 23:10:42 UTC
  • Revision ID: teddy@recompile.se-20210203231042-2z3egrvpo1zt7nej
mandos-ctl: Fix bad test for command.Remove and related minor issues

The test for command.Remove removes all clients from the spy server,
and then loops over all clients, looking for the corresponding Remove
command as recorded by the spy server.  But since since there aren't
any clients left after they were removed, no assertions are made, and
the test therefore does nothing.  Fix this.

In tests for command.Approve and command.Deny, add checks that clients
were not somehow removed by the command (in which case, likewise, no
assertions are made).

Add related checks to TestPropertySetterCmd.runTest; i.e. test that a
sequence is not empty before looping over it and making assertions.

* mandos-ctl (TestBaseCommands.test_Remove): Save a copy of the
  original "clients" dict, and loop over those instead.  Add assertion
  that all clients were indeed removed.  Also fix the code which looks
  for the Remove command, which now needs to actually work.
  (TestBaseCommands.test_Approve, TestBaseCommands.test_Deny): Add
  assertion that there are still clients before looping over them.
  (TestPropertySetterCmd.runTest): Add assertion that the list of
  values to get is not empty before looping over them.  Also add check
  that there are still clients before looping over clients.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
2
### BEGIN INIT INFO
3
3
# Provides:          mandos
4
 
# Required-Start:    $remote_fs $syslog avahi
5
 
# Required-Stop:     $remote_fs $syslog avahi
 
4
# Required-Start:    $remote_fs $syslog avahi-daemon
 
5
# Required-Stop:     $remote_fs $syslog avahi-daemon
6
6
# Default-Start:     2 3 4 5
7
7
# Default-Stop:      0 1 6
8
8
# Short-Description: Mandos server
11
11
 
12
12
# Author: Teddy Hogeborn <teddy@recompile.se>
13
13
# Author: Björn Påhlsson <belorn@recompile.se>
14
 
#
15
 
# Please remove the "Author" lines above and replace them
16
 
# with your own name if you copy and modify this script.
17
14
 
18
15
# Do NOT "set -e"
19
16
 
44
41
. /lib/init/vars.sh
45
42
 
46
43
# Define LSB log_* functions.
47
 
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present.
 
44
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
 
45
# and status_of_proc is working.
48
46
. /lib/lsb/init-functions
49
47
 
50
48
#
122
120
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
123
121
        esac
124
122
        ;;
 
123
  status)
 
124
        status_of_proc "$DAEMON" "$NAME" -p "$PIDFILE" && exit 0 || exit $?
 
125
        ;;
125
126
  #reload|force-reload)
126
127
        #
127
128
        # If do_reload() is not implemented then leave this commented out
148
149
                esac
149
150
                ;;
150
151
          *)
151
 
                # Failed to stop
 
152
                # Failed to stop
152
153
                log_end_msg 1
153
154
                ;;
154
155
        esac
155
156
        ;;
156
 
  status)
157
 
        status_of_proc "$DAEMON" "$NAME" -p "$PIDFILE"
158
 
        ;;
159
157
  *)
160
158
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
161
 
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
 
159
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
162
160
        exit 3
163
161
        ;;
164
162
esac