cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# CDDL HEADER START
cbc61fcb33b370d049c16a3c44568b4deb4e2b33Timo Sirainen# The contents of this file are subject to the terms of the
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# Common Development and Distribution License (the "License").
00d58fcfe8191d6ce7efa801d289a5c0fe88d1aeTimo Sirainen# You may not use this file except in compliance with the License.
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# See the License for the specific language governing permissions
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# and limitations under the License.
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# When distributing Covered Code, include this CDDL HEADER in each
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen# If applicable, add the following below this CDDL HEADER, with the
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen# fields enclosed by brackets "[]" replaced with your own identifying
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen# information: Portions Copyright [yyyy] [name of copyright owner]
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# CDDL HEADER END
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
e07bf3772a2bc075de4915ad0961beb8d083c22dTimo Sirainentypeset -r VARDATADIR=/var/openldap/openldap-data
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainentypeset -r SLAPD="/usr/lib/slapd -u ${LDAPUSR} -g ${LDAPGRP} -f ${CONF_FILE}"
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainentypeset -r SLAPD_DIR="/usr/lib/slapd -u ${LDAPUSR} -g ${LDAPGRP} -F ${CONF_DIR}"
cbc61fcb33b370d049c16a3c44568b4deb4e2b33Timo Sirainentypeset -r LDAPSERVERCFG="/usr/sbin/ldapservercfg"
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainentypeset -r DO_LDAPSERVERCFG="pfexec ${LDAPSERVERCFG} -a openldap"
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainentypeset -r FLAG_STR='olcConfigFile: /tmp/dscfg.'
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen svc:/network/ldap/server:openldap 2>/dev/null`
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen if [[ -x ${LDAPSERVERCFG} ]]; then
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen grep -q "${FLAG_STR}" ${CONF_DIR}/cn\=config.ldif
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen [[ $? -eq 0 ]] && exec ${SLAPD_DIR} -h "$urls" 2>&1
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen [[ -f ${CONF_FILE} ]] || exit $SMF_EXIT_ERR_CONFIG
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen # Use the actual contract, not ${PIDFILE}
73b50eecfc31750a312e2f940023f522eb07178cTimo Sirainen print "Usage: $0 {start|stop}"