start-method revision 4173
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# CDDL HEADER START
c1a883f2e04d94e99c433b1f6cfd0c0338f4ed85Mark Andrews# The contents of this file are subject to the terms of the
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Common Development and Distribution License (the "License").
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# You may not use this file except in compliance with the License.
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# or http://www.opensolaris.org/os/licensing.
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# See the License for the specific language governing permissions
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# and limitations under the License.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
f5d30e2864e048a42c4dc1134993ae7efdb5d6c3Mark Andrews# CDDL HEADER END
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# Copyright (c) 1991, 2015, Oracle and/or its affiliates. All rights reserved.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinSWITCH_FMRI=svc:/system/name-service/switch:default
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein aliasprop=$(/usr/bin/svcprop -p config/alias $SWITCH_FMRI 2>/dev/null)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # On systems with NIS, the default is to search the local alias
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # All Solaris systems ship "with NIS", but unless NIS is configured for
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # aliases, this will cause problems, so check and tweak the default if
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [[ $alias_maps == "hash:/etc/mail/aliases, nis:mail.aliases" ]]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [[ "$aliasprop" == "${aliasprop/nis}" ]]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # NIS is not configured, so change the Postfix setting.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # Check for LDAP: if configured via the switch, then (if needed)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # create $LDAP_ALIASES and configure in alias_maps.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [[ $aliasprop != ${aliasprop/ldap} ]]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [[ ! -f $LDAP_ALIASES ]]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # $LDAP_ALIASES does not exist yet, so create it.
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson grep NS_LDAP_SEARCH_BASEDN | sed -e 's/^.*= //')
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "result_attribute = mgrpRFC822MailMember" >> \
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson if [[ "$alias_maps" == "${alias_maps/ldap:}" ]]; then
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson # No "ldap:" entry yet in alias_maps, so add one.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # Sendmail in Solaris 11 is linked with an old Berkeley DB version.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# First, make sure we have a valid domain name.
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson # Fully qualified: we're set.
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson # Unqualified; fall back to postconf.
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson mydomain=$(/usr/sbin/postconf -h mydomain)
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson # Fully qualified: we're set.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "Domain name cannot be determined."
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "Either set hostname to a fully-qualified value,"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "or run '/usr/sbin/postconf mydomain=YOUR.DOMAIN'."
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Second, tweak aliases for NIS and LDAP as needed.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinauto=`/usr/bin/svcprop -c -p config/automatic $SMF_FMRI 2>/dev/null`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinif [[ $auto == true ]]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Finally, start the daemon.