xref: /illumos-gate/usr/src/cmd/nscd/svc-nscd (revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e)
17c478bd9Sstevel@tonic-gate#!/sbin/sh
27c478bd9Sstevel@tonic-gate#
3*45916cd2Sjpk#
47c478bd9Sstevel@tonic-gate# CDDL HEADER START
57c478bd9Sstevel@tonic-gate#
67c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
7*45916cd2Sjpk# Common Development and Distribution License (the "License").
8*45916cd2Sjpk# You may not use this file except in compliance with the License.
97c478bd9Sstevel@tonic-gate#
107c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
117c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
127c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
137c478bd9Sstevel@tonic-gate# and limitations under the License.
147c478bd9Sstevel@tonic-gate#
157c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
167c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
177c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
187c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
197c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate# CDDL HEADER END
227c478bd9Sstevel@tonic-gate#
23*45916cd2Sjpk# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh
297c478bd9Sstevel@tonic-gate
30*45916cd2Sjpk# Trusted Extensions non-global zones need special handling
31*45916cd2Sjpk
32*45916cd2Sjpkif (smf_is_system_labeled); then
33*45916cd2Sjpk	if (smf_is_nonglobalzone); then
34*45916cd2Sjpk
35*45916cd2Sjpk        	# If needed create a door to the global zone daemon.
36*45916cd2Sjpk        	if [ ! -L /var/run/name_service_door ]; then
37*45916cd2Sjpk                	ln -s /var/tsol/doors/name_service_door /var/run || \
38*45916cd2Sjpk                    	exit $SMF_EXIT_ERR_FATAL
39*45916cd2Sjpk        	fi
40*45916cd2Sjpk
41*45916cd2Sjpk        	# If current service duration is not "transient", create
42*45916cd2Sjpk        	# a dummy background process to preserve contract lifetime.
43*45916cd2Sjpk        	duration=""
44*45916cd2Sjpk        	if /bin/svcprop -q -c -p startd/duration $SMF_FMRI ; then
45*45916cd2Sjpk                	duration=`/bin/svcprop -c -p startd/duration $SMF_FMRI`
46*45916cd2Sjpk        	fi
47*45916cd2Sjpk        	if [ "$duration" != "transient" ]; then
48*45916cd2Sjpk                	( while true ; do sleep 3600 ; done ) &
49*45916cd2Sjpk        	fi
50*45916cd2Sjpk
51*45916cd2Sjpk        	# The real daemon is not started in non-global zones,
52*45916cd2Sjpk		# so exit now.
53*45916cd2Sjpk        	exit $SMF_EXIT_OK
54*45916cd2Sjpk	fi
55*45916cd2Sjpk
56*45916cd2Sjpkfi
57*45916cd2Sjpk
587c478bd9Sstevel@tonic-gateif [ -f /etc/nscd.conf -a -f /usr/sbin/nscd ]; then
597c478bd9Sstevel@tonic-gate	secure=""
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate	if egrep -s "^(passwd|passwd_compat):.*nisplus" /etc/nsswitch.conf
627c478bd9Sstevel@tonic-gate	then
637c478bd9Sstevel@tonic-gate		/usr/lib/nscd_nischeck passwd || secure=" -S passwd,yes"
647c478bd9Sstevel@tonic-gate	fi
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gate	/usr/sbin/nscd$secure < /dev/null > /dev/msglog 2>&1 &
677c478bd9Sstevel@tonic-gateelse
687c478bd9Sstevel@tonic-gate	echo "No /etc/nscd.conf or no /usr/sbin/nscd"
697c478bd9Sstevel@tonic-gate	exit $SMF_EXIT_ERR_CONFIG
707c478bd9Sstevel@tonic-gatefi
71