#!/bin/sh
#
#    Copyright (c) 1996-2014 Brocade Communications Systems, Inc.
#    All rights reserved.
#
#    Initialization script to start/stop slpd.
#

# Source common library
. /etc/init.d/functions

SLPD=/sbin/slpd
MACS="Macs=hmac-sha1"

case "$1" in

'start')
    $ECHO "Service Location Protocol Daemom:\c"
	if $CHECK slpd; then
	    ${KILLALL} slpd
	fi
         cd /etc/
         openssl dsaparam -out dsaparam.pem 2048 > /dev/null 2>&1
         openssl gendsa -out dsa_priv_key.pem dsaparam.pem > /dev/null 2>&1
         openssl dsa -in dsa_priv_key.pem -pubout -out dsa_pub_key.pem > /dev/null 2>&1
         $SLPD -d -p /tmp/slpd.pid &

    ;;

'stop')
    ${KILLALL} slpd
    ;;    

*)
    echo "usage: $0 {start | stop}"
    ;;

esac
