10Sstevel@tonic-gate#! /usr/bin/ksh 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# CDDL HEADER START 40Sstevel@tonic-gate# 50Sstevel@tonic-gate# The contents of this file are subject to the terms of the 64040Sgww# Common Development and Distribution License (the "License"). 74040Sgww# You may not use this file except in compliance with the License. 80Sstevel@tonic-gate# 90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate# See the License for the specific language governing permissions 120Sstevel@tonic-gate# and limitations under the License. 130Sstevel@tonic-gate# 140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate# 200Sstevel@tonic-gate# CDDL HEADER END 210Sstevel@tonic-gate# 220Sstevel@tonic-gate# 23*13083SBenjamin.Chang@Oracle.COM# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 24*13083SBenjamin.Chang@Oracle.COM# 25*13083SBenjamin.Chang@Oracle.COM 260Sstevel@tonic-gate# 270Sstevel@tonic-gate# inityp2l -- Utility to generate YP (NIS) to LDAP 280Sstevel@tonic-gate# configuration file (/etc/default/ypserv) 290Sstevel@tonic-gate# and mapping file (/var/yp/NISLDAPmapping) 300Sstevel@tonic-gate# 310Sstevel@tonic-gate 320Sstevel@tonic-gate 330Sstevel@tonic-gate 340Sstevel@tonic-gate# 350Sstevel@tonic-gate# Displays message corresponding to the argument tag passed. 360Sstevel@tonic-gate# 370Sstevel@tonic-gatedisplay_msg() 380Sstevel@tonic-gate{ 390Sstevel@tonic-gate case "$1" in 400Sstevel@tonic-gate usage) cat <<EOF 410Sstevel@tonic-gate 420Sstevel@tonic-gate $PROG: [ -m mapping_file ] [ -c config_file ] 430Sstevel@tonic-gate m <mapping_file> Name of the generated NISLDAP mapping file 440Sstevel@tonic-gate Default is /var/yp/NISLDAPmapping 450Sstevel@tonic-gate c <config_file> Name of the generated ypserv configuration file 460Sstevel@tonic-gate Default is /etc/default/ypserv 470Sstevel@tonic-gate 480Sstevel@tonic-gateEOF 490Sstevel@tonic-gate ;; 500Sstevel@tonic-gate no_config_file_name_specified) cat <<EOF 510Sstevel@tonic-gate 520Sstevel@tonic-gateYou have not specified the config file name. You still have the 530Sstevel@tonic-gateoption to skip creating this file, specify a config file name, or 540Sstevel@tonic-gatecontinue creating it with the default file name (${CONFIG_FILE}). 550Sstevel@tonic-gate 560Sstevel@tonic-gateEOF 570Sstevel@tonic-gate ;; 580Sstevel@tonic-gate no_mapping_file_name_specified) cat <<EOF 590Sstevel@tonic-gate 600Sstevel@tonic-gateYou have not specified the mapping file name. You still have the 610Sstevel@tonic-gateoption to skip creating this file, specify a mapping file name, or 620Sstevel@tonic-gatecontinue creating it with the default file name (${MAP_FILE}). 630Sstevel@tonic-gate 640Sstevel@tonic-gateEOF 650Sstevel@tonic-gate ;; 660Sstevel@tonic-gate new_config_file_name_help) cat <<EOF 670Sstevel@tonic-gate 680Sstevel@tonic-gateYou can either specify a new file name, or accept the default 690Sstevel@tonic-gateconfig file name (${CONFIG_FILE}). 700Sstevel@tonic-gate 710Sstevel@tonic-gateIt is recommended not to use the default file name since this 720Sstevel@tonic-gatescript just helps with rapid creation of a config file. You 730Sstevel@tonic-gateshould examine it's content before using it. 740Sstevel@tonic-gate 750Sstevel@tonic-gateEOF 760Sstevel@tonic-gate ;; 770Sstevel@tonic-gate new_mapping_file_name_help) cat <<EOF 780Sstevel@tonic-gate 790Sstevel@tonic-gateYou can either specify a new file name, or accept the default 800Sstevel@tonic-gatemapping file name (${MAP_FILE}). 810Sstevel@tonic-gate 820Sstevel@tonic-gateIt is recommended not to use the default file name since this 830Sstevel@tonic-gatescript just helps with rapid creation of a mapping file. You 840Sstevel@tonic-gateshould examine it's content before using it. And if there are 850Sstevel@tonic-gatecustom maps, then their entries in the mapping file need to be 860Sstevel@tonic-gatecustomized too. 870Sstevel@tonic-gate 880Sstevel@tonic-gateAlso, creation of default mapping file would cause NIS components 890Sstevel@tonic-gateto work in NIS to LDAP (N2L), rather than traditional NIS, mode 900Sstevel@tonic-gatewhen next restarted. 910Sstevel@tonic-gate 920Sstevel@tonic-gateEOF 930Sstevel@tonic-gate ;; 940Sstevel@tonic-gate backup_config_file) cat <<EOF 950Sstevel@tonic-gate 960Sstevel@tonic-gateThe config file "${CONFIG_FILE}" already exists. It is strongly 970Sstevel@tonic-gaterecommended that you BACKUP this file before running $PROG. 980Sstevel@tonic-gate 990Sstevel@tonic-gateHowever, even if you continue, you would be given the option to 1000Sstevel@tonic-gateback up this file before it gets overwritten. 1010Sstevel@tonic-gate 1020Sstevel@tonic-gateEOF 1030Sstevel@tonic-gate ;; 1040Sstevel@tonic-gate backup_mapping_file) cat <<EOF 1050Sstevel@tonic-gate 1060Sstevel@tonic-gateThe mapping file "${MAP_FILE}" already exists. It is strongly 1070Sstevel@tonic-gaterecommended that you BACKUP this file before running $PROG. 1080Sstevel@tonic-gate 1090Sstevel@tonic-gateHowever, even if you continue, you would be given the option to 1100Sstevel@tonic-gateback up this file before it gets overwritten. 1110Sstevel@tonic-gate 1120Sstevel@tonic-gateEOF 1130Sstevel@tonic-gate ;; 1140Sstevel@tonic-gate warn_n2l_mode) cat <<EOF 1150Sstevel@tonic-gate 1160Sstevel@tonic-gateWarning : Creation of default mapping file (`basename $MAP_FILE`) 1170Sstevel@tonic-gate at default location (`dirname $MAP_FILE`) would cause NIS 1180Sstevel@tonic-gate components to work in NIS to LDAP (N2L) mode, rather than 1190Sstevel@tonic-gate traditional NIS mode, when next restarted. 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate "$PROG" assists with rapid creation of a simple N2L mapping 1220Sstevel@tonic-gate file. The user should examine it's content before using it. 1230Sstevel@tonic-gate For custom maps, this file needs to be customized which can 1240Sstevel@tonic-gate be done using standard text editors. 1250Sstevel@tonic-gate 1260Sstevel@tonic-gateEOF 1270Sstevel@tonic-gate ;; 1280Sstevel@tonic-gate config_auth_method_menu) cat <<EOF 1290Sstevel@tonic-gate The following are the supported Authentication Methods - 1300Sstevel@tonic-gate 1 none 1310Sstevel@tonic-gate 2 simple 1320Sstevel@tonic-gate 3 sasl/cram-md5 1330Sstevel@tonic-gate 4 sasl/digest-md5 1340Sstevel@tonic-gateEOF 1350Sstevel@tonic-gate ;; 1360Sstevel@tonic-gate auth_method_menu) cat <<EOF 1370Sstevel@tonic-gate The following are the supported Authentication Methods - 1380Sstevel@tonic-gate 1 simple 1390Sstevel@tonic-gate 2 sasl/cram-md5 1400Sstevel@tonic-gate 3 sasl/digest-md5 1410Sstevel@tonic-gateEOF 1420Sstevel@tonic-gate ;; 1430Sstevel@tonic-gate tls_method_menu) cat <<EOF 1440Sstevel@tonic-gate The following are the supported TLS Methods - 1450Sstevel@tonic-gate 1 none 1460Sstevel@tonic-gate 2 ssl 1470Sstevel@tonic-gateEOF 1480Sstevel@tonic-gate ;; 1490Sstevel@tonic-gate retrieve_error_action_menu) cat <<EOF 1500Sstevel@tonic-gate The following are the supported actions - 1510Sstevel@tonic-gate 1 use_cached 1520Sstevel@tonic-gate 2 fail 1530Sstevel@tonic-gateEOF 1540Sstevel@tonic-gate ;; 1550Sstevel@tonic-gate store_error_action_menu) cat <<EOF 1560Sstevel@tonic-gate The following are the supported actions - 1570Sstevel@tonic-gate 1 retry 1580Sstevel@tonic-gate 2 fail 1590Sstevel@tonic-gateEOF 1600Sstevel@tonic-gate ;; 1610Sstevel@tonic-gate sorry) cat <<EOF 1620Sstevel@tonic-gate 1630Sstevel@tonic-gateHELP - No help is available for this topic. 1640Sstevel@tonic-gate 1650Sstevel@tonic-gateEOF 1660Sstevel@tonic-gate ;; 1670Sstevel@tonic-gate backup_config_file_cont_help) cat <<EOF 1680Sstevel@tonic-gate 1690Sstevel@tonic-gateHELP - Since $PROG will overwrite the existing config file, it is 1700Sstevel@tonic-gate strongly recommended that you backup this file prior to 1710Sstevel@tonic-gate running this utility. 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate However, even if you continue, you would be given the option 1740Sstevel@tonic-gate to back up this file before it gets overwritten. 1750Sstevel@tonic-gate 1760Sstevel@tonic-gateEOF 1770Sstevel@tonic-gate ;; 1780Sstevel@tonic-gate backup_config_file_help) cat <<EOF 1790Sstevel@tonic-gate 1800Sstevel@tonic-gateHELP - If you choose to backup the existing config file, it would be 1810Sstevel@tonic-gate saved with current date and time suffix in yymmdd.HH.MM.SS format. 1820Sstevel@tonic-gate 1830Sstevel@tonic-gateEOF 1840Sstevel@tonic-gate ;; 1850Sstevel@tonic-gate backup_mapping_file_cont_help) cat <<EOF 1860Sstevel@tonic-gate 1870Sstevel@tonic-gateHELP - Since $PROG will overwrite the existing mapping file, it is 1880Sstevel@tonic-gate strongly recommended that you backup this file prior to running 1890Sstevel@tonic-gate this utility. 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate However, even if you continue, you would be given the option to 1920Sstevel@tonic-gate back up this file before it gets overwritten. 1930Sstevel@tonic-gate 1940Sstevel@tonic-gateEOF 1950Sstevel@tonic-gate ;; 1960Sstevel@tonic-gate backup_mapping_file_help) cat <<EOF 1970Sstevel@tonic-gate 1980Sstevel@tonic-gateHELP - If you choose to backup the existing mapping file, it would be 1990Sstevel@tonic-gate saved with current date and time suffix in yymmdd.HH.MM.SS format. 2000Sstevel@tonic-gate 2010Sstevel@tonic-gateEOF 2020Sstevel@tonic-gate ;; 2030Sstevel@tonic-gate warn_n2l_mode_help) cat <<EOF 2040Sstevel@tonic-gate 2050Sstevel@tonic-gateHELP - It is strongly recommended that the mapping file is created at 2060Sstevel@tonic-gate non-default location (other than `dirname $MAP_FILE`). After this, 2070Sstevel@tonic-gate it's content should be verified, custom maps should be handled, 2080Sstevel@tonic-gate and if NIS components are desired to run in NIS to LDAP (N2L), 2090Sstevel@tonic-gate then only it should be copied at the default location. 2100Sstevel@tonic-gate 2110Sstevel@tonic-gateEOF 2120Sstevel@tonic-gate ;; 2130Sstevel@tonic-gate nisLDAPconfigDN_help) cat <<EOF 2140Sstevel@tonic-gate 2150Sstevel@tonic-gateHELP - The DN which stores the configuration information in LDAP. 2160Sstevel@tonic-gate There is no default value for this field. Leave empty or 2170Sstevel@tonic-gate undefined to get this information from config file (ypserv). 2180Sstevel@tonic-gate 2190Sstevel@tonic-gateEOF 2200Sstevel@tonic-gate ;; 2210Sstevel@tonic-gate nisLDAPconfigPreferredServerList_help) cat <<EOF 2220Sstevel@tonic-gate 2230Sstevel@tonic-gateHELP - List of directory servers to provide the configuration 2240Sstevel@tonic-gate information. There is no default. The preferred servers 2250Sstevel@tonic-gate must be entered IN THE ORDER you wish to have them contacted. 2260Sstevel@tonic-gate The preferred server list is a space separated list of IP 2270Sstevel@tonic-gate addresses. Providing port numbers is optional, and when not 2280Sstevel@tonic-gate supplied, port 389 is assumed. For an LDAP server running 2290Sstevel@tonic-gate on this machine, at port 389, use "127.0.0.1:389". 2300Sstevel@tonic-gate 2310Sstevel@tonic-gateEOF 2320Sstevel@tonic-gate ;; 2330Sstevel@tonic-gate auth_help) cat <<EOF 2340Sstevel@tonic-gate 2350Sstevel@tonic-gateHELP - The authentication method to be used to obtain information 2360Sstevel@tonic-gate from LDAP server. The supported methods are provided in menu. 2370Sstevel@tonic-gate 2380Sstevel@tonic-gateEOF 2390Sstevel@tonic-gate ;; 2400Sstevel@tonic-gate tls_help) cat <<EOF 2410Sstevel@tonic-gate 2420Sstevel@tonic-gateHELP - The transport layer security used for connection to the LDAP 2430Sstevel@tonic-gate server. In order to successfully use transport layer security, 2440Sstevel@tonic-gate the server must also support the chosen values. The supported 2450Sstevel@tonic-gate methods are provided in menu. Default is "$DEF_TLS". 2460Sstevel@tonic-gate 2470Sstevel@tonic-gateEOF 2480Sstevel@tonic-gate ;; 2490Sstevel@tonic-gate TLSCertificateDBPath_help) cat <<EOF 2500Sstevel@tonic-gate 25111989SMilan.Jurik@Sun.COMHELP - The absolute path name of the directory containing the certificate 2520Sstevel@tonic-gate database. The default value is "$DEF_TLSCertificateDBPath" 2530Sstevel@tonic-gate 2540Sstevel@tonic-gateEOF 2550Sstevel@tonic-gate ;; 2560Sstevel@tonic-gate nisLDAPconfigProxyUser_help) cat <<EOF 2570Sstevel@tonic-gate 2580Sstevel@tonic-gateHELP - The bind DN of the proxy user used to obtain configuration 2590Sstevel@tonic-gate information. There is no default value. If the value ends 2600Sstevel@tonic-gate with a comma, the value of the nisLDAPconfigDN attribute 2610Sstevel@tonic-gate is appended. 2620Sstevel@tonic-gate 2630Sstevel@tonic-gateEOF 2640Sstevel@tonic-gate ;; 2650Sstevel@tonic-gate ProxyPassword_warn) cat <<EOF 2660Sstevel@tonic-gate 2670Sstevel@tonic-gateWarning : In order to avoid having this password publicly visible 2680Sstevel@tonic-gate on the machine, the password should appear only in the 2690Sstevel@tonic-gate configuration file, and the file should have an appropriate 2700Sstevel@tonic-gate owner, group, and file mode. 2710Sstevel@tonic-gate 2720Sstevel@tonic-gate So, once this file is ready, please modify appropriately 2730Sstevel@tonic-gate to make sure this file is well protected. 2740Sstevel@tonic-gate 2750Sstevel@tonic-gateEOF 2760Sstevel@tonic-gate ;; 2770Sstevel@tonic-gate preferredServerList_help) cat <<EOF 2780Sstevel@tonic-gate 2790Sstevel@tonic-gateHELP - List of directory servers for mapping data to/from LDAP. 2800Sstevel@tonic-gate There is no default. The preferred servers must be entered 2810Sstevel@tonic-gate IN THE ORDER you wish to have them contacted. The preferred 2820Sstevel@tonic-gate server list is a space separated list of IP addresses. 2830Sstevel@tonic-gate Providing port numbers is optional, and when not supplied, 2840Sstevel@tonic-gate port 389 is assumed. For an LDAP server running on this 2850Sstevel@tonic-gate machine, at port 389, use "127.0.0.1:389". 2860Sstevel@tonic-gate 2870Sstevel@tonic-gateEOF 2880Sstevel@tonic-gate ;; 2890Sstevel@tonic-gate nisLDAPproxyUser_help) cat <<EOF 2900Sstevel@tonic-gate 2910Sstevel@tonic-gateHELP - The bind DN of the proxy user the ypserv to read or write 2920Sstevel@tonic-gate from or to LDAP. Assumed to have the appropriate permission 2930Sstevel@tonic-gate to read and modify LDAP data. There is no default value. If 2940Sstevel@tonic-gate the value ends with a comma, the value of the context for 2950Sstevel@tonic-gate the current domain (as defined by a nisLDAPdomainContext 2960Sstevel@tonic-gate attribute (NISLDAPmapping(4))) is appended. 2970Sstevel@tonic-gate 2980Sstevel@tonic-gateEOF 2990Sstevel@tonic-gate ;; 3000Sstevel@tonic-gate nisLDAPbindTimeout_help) cat <<EOF 3010Sstevel@tonic-gate 3020Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP bind operation 3030Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPbindTimeout seconds. 3040Sstevel@tonic-gate Decimal values are allowed. 3050Sstevel@tonic-gate 3060Sstevel@tonic-gateEOF 3070Sstevel@tonic-gate ;; 3080Sstevel@tonic-gate nisLDAPsearchTimeout_help) cat <<EOF 3090Sstevel@tonic-gate 3100Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP search operation 3110Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPsearchTimeout seconds. 3120Sstevel@tonic-gate Decimal values are allowed. 3130Sstevel@tonic-gate 3140Sstevel@tonic-gateEOF 3150Sstevel@tonic-gate ;; 3160Sstevel@tonic-gate nisLDAPmodifyTimeout_help) cat <<EOF 3170Sstevel@tonic-gate 3180Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP modify operation 3190Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPmodifyTimeout seconds. 3200Sstevel@tonic-gate Decimal values are allowed. 3210Sstevel@tonic-gate 3220Sstevel@tonic-gateEOF 3230Sstevel@tonic-gate ;; 3240Sstevel@tonic-gate nisLDAPaddTimeout_help) cat <<EOF 3250Sstevel@tonic-gate 3260Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP add operation 3270Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPaddTimeout seconds. 3280Sstevel@tonic-gate Decimal values are allowed. 3290Sstevel@tonic-gate 3300Sstevel@tonic-gateEOF 3310Sstevel@tonic-gate ;; 3320Sstevel@tonic-gate nisLDAPdeleteTimeout_help) cat <<EOF 3330Sstevel@tonic-gate 3340Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP delete operation 3350Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPdeleteTimeout seconds. 3360Sstevel@tonic-gate Decimal values are allowed. 3370Sstevel@tonic-gate 3380Sstevel@tonic-gateEOF 3390Sstevel@tonic-gate ;; 3400Sstevel@tonic-gate nisLDAPsearchTimeLimit_help) cat <<EOF 3410Sstevel@tonic-gate 3420Sstevel@tonic-gateHELP - Establish a value for the LDAP_OPT_TIMELIMIT option, which 3430Sstevel@tonic-gate suggests a time limit for the search operation on the LDAP 3440Sstevel@tonic-gate server. The server may impose its own constraints on possible 3450Sstevel@tonic-gate values. See your LDAP server documentation. The default is the 3460Sstevel@tonic-gate nisLDAPsearchTimeout ($DEF_nisLDAPsearchTimeout seconds) value. 3470Sstevel@tonic-gate Only integer values are allowed. 3480Sstevel@tonic-gate 3490Sstevel@tonic-gate Since the nisLDAPsearchTimeout limits the amount of time the 3500Sstevel@tonic-gate client ypserv will wait for completion of a search operation, 3510Sstevel@tonic-gate setting the nisLDAPsearchTimeLimit larger than the 3520Sstevel@tonic-gate nisLDAPsearchTimeout is not recommended. 3530Sstevel@tonic-gate 3540Sstevel@tonic-gateEOF 3550Sstevel@tonic-gate ;; 3560Sstevel@tonic-gate nisLDAPsearchSizeLimit_help) cat <<EOF 3570Sstevel@tonic-gate 3580Sstevel@tonic-gateHELP - Establish a value for the LDAP_OPT_SIZELIMIT option, which 3590Sstevel@tonic-gate suggests a size limit, in bytes, for the search results on 3600Sstevel@tonic-gate the LDAP server. The server may impose its own constraints 3610Sstevel@tonic-gate on possible values. See your LDAP server documentation. The 3620Sstevel@tonic-gate default is $DEF_nisLDAPsearchSizeLimit, which means unlimited. 3630Sstevel@tonic-gate Only integer values are allowed. 3640Sstevel@tonic-gate 3650Sstevel@tonic-gateEOF 3660Sstevel@tonic-gate ;; 3670Sstevel@tonic-gate nisLDAPfollowReferral_help) cat <<EOF 3680Sstevel@tonic-gate 3690Sstevel@tonic-gateHELP - Determines if the ypserv should follow referrals or not. 3700Sstevel@tonic-gate Recognized values are yes and no. Default is $DEF_nisLDAPfollowReferral. 3710Sstevel@tonic-gate 3720Sstevel@tonic-gateEOF 3730Sstevel@tonic-gate ;; 3740Sstevel@tonic-gate nisLDAPretrieveErrorAction_help) cat <<EOF 3750Sstevel@tonic-gate 3760Sstevel@tonic-gateHELP - If an error occurs while trying to retrieve an entry from 3770Sstevel@tonic-gate LDAP, one of the following actions can be selected: 3780Sstevel@tonic-gate 3790Sstevel@tonic-gate use_cached : Retry the retrieval the number of time specified 3800Sstevel@tonic-gate by nisLDAPretrieveErrorAttempts, with the 3810Sstevel@tonic-gate nisLDAPretrieveErrorTimeout value controlling 3820Sstevel@tonic-gate the wait between each attempt. 3830Sstevel@tonic-gate 3840Sstevel@tonic-gate If all attempts fail then log a warning and 3850Sstevel@tonic-gate return the value currently in the cache to the 3860Sstevel@tonic-gate client. This is the default value. 3870Sstevel@tonic-gate 3880Sstevel@tonic-gate fail : Proceed as for 'use_cached' but if all attempts 3890Sstevel@tonic-gate fail return a YPERR_YPERR error to the client. 3900Sstevel@tonic-gate 3910Sstevel@tonic-gateEOF 3920Sstevel@tonic-gate ;; 3930Sstevel@tonic-gate nisLDAPretrieveErrorAttempts_help) cat <<EOF 3940Sstevel@tonic-gate 3950Sstevel@tonic-gateHELP - The number of times a failed retrieval should be retried. 3960Sstevel@tonic-gate The default is unlimited. Note while retries are made, the 3970Sstevel@tonic-gate NIS daemon will be prevented from servicing further requests. 3980Sstevel@tonic-gate Hence, values other than 1 should be used with caution. 3990Sstevel@tonic-gate 4000Sstevel@tonic-gateEOF 4010Sstevel@tonic-gate ;; 4020Sstevel@tonic-gate nisLDAPretrieveErrorTimeout_help) cat <<EOF 4030Sstevel@tonic-gate 4040Sstevel@tonic-gateHELP - The timeout (in seconds) between each new attempt to retrieve 4050Sstevel@tonic-gate LDAP data. Default is $DEF_nisLDAPretrieveErrorTimeout seconds. 4060Sstevel@tonic-gate 4070Sstevel@tonic-gateEOF 4080Sstevel@tonic-gate ;; 4090Sstevel@tonic-gate nisLDAPstoreErrorAction_help) cat <<EOF 4100Sstevel@tonic-gate 4110Sstevel@tonic-gateHELP - If an error occurs while trying to store data to the LDAP 4120Sstevel@tonic-gate repository, one of the following actions can be selected : 4130Sstevel@tonic-gate 4140Sstevel@tonic-gate retry : Retry operation nisLDAPstoreErrorAttempts times with 4150Sstevel@tonic-gate nisLDAPstoreErrorTimeout seconds between each attempt. 4160Sstevel@tonic-gate Note while retries are made the NIS daemon will be 4170Sstevel@tonic-gate prevented from servicing further requests. Use with 4180Sstevel@tonic-gate caution. This is the default value. 4190Sstevel@tonic-gate 4200Sstevel@tonic-gate fail : Return YPERR_YPERR error to the client. 4210Sstevel@tonic-gate 4220Sstevel@tonic-gateEOF 4230Sstevel@tonic-gate ;; 4240Sstevel@tonic-gate nisLDAPstoreErrorAttempts_help) cat <<EOF 4250Sstevel@tonic-gate 4260Sstevel@tonic-gateHELP - The number of times a failed attempt to store data to the 4270Sstevel@tonic-gate LDAP repository should be retried. The default is unlimited. 4280Sstevel@tonic-gate 4290Sstevel@tonic-gate The value for nisLDAPstoreErrorAttempts is ignored unless 4300Sstevel@tonic-gate nisLDAPstoreErrorAction=retry. 4310Sstevel@tonic-gate 4320Sstevel@tonic-gateEOF 4330Sstevel@tonic-gate ;; 4340Sstevel@tonic-gate nisLDAPstoreErrorTimeout_help) cat <<EOF 4350Sstevel@tonic-gate 4360Sstevel@tonic-gateHELP - The timeout (in seconds) between each new attempt to store 4370Sstevel@tonic-gate LDAP data. Default is $DEF_nisLDAPstoreErrorTimeout seconds. 4380Sstevel@tonic-gate 4390Sstevel@tonic-gate The value for nisLDAPstoreErrorTimeout is ignored unless 4400Sstevel@tonic-gate nisLDAPstoreErrorAction=retry. 4410Sstevel@tonic-gate 4420Sstevel@tonic-gateEOF 4430Sstevel@tonic-gate ;; 4440Sstevel@tonic-gate selectDomain4N2L_help) cat <<EOF 4450Sstevel@tonic-gate 4460Sstevel@tonic-gateHELP - Whether this domain needs to be served by YP to LDAP transition 4470Sstevel@tonic-gate solution. The default is no in which case the data in this 4480Sstevel@tonic-gate domain would not be taken care for transitioning to LDAP. 4490Sstevel@tonic-gate 4500Sstevel@tonic-gateEOF 4510Sstevel@tonic-gate ;; 4520Sstevel@tonic-gate generate_comment_info_for_cust_map_help) cat <<EOF 4530Sstevel@tonic-gate 4540Sstevel@tonic-gateHELP - If selected, this script will try to add relevant comments 4550Sstevel@tonic-gate in the mapping file which might help in customizing the 4560Sstevel@tonic-gate mapping information for custom maps. 4570Sstevel@tonic-gate 4580Sstevel@tonic-gateEOF 4590Sstevel@tonic-gate ;; 4600Sstevel@tonic-gate generate_mapping_info_for_cust_map_help) cat <<EOF 4610Sstevel@tonic-gate 4620Sstevel@tonic-gateHELP - If selected, this script will try to generate mapping 4630Sstevel@tonic-gate information for this map assuming it is a "simple" map. 4640Sstevel@tonic-gate 4650Sstevel@tonic-gate A map is assumed to be "simple" if each entry of this map 4660Sstevel@tonic-gate has only one "key value" entry in YP, and if each map entry 4670Sstevel@tonic-gate can be represented as a single DIT string in the LDAP server. 4680Sstevel@tonic-gate 4690Sstevel@tonic-gate If this map is not a simple map and you do want to store it 4700Sstevel@tonic-gate in LDAP, you have two options : 4710Sstevel@tonic-gate 4720Sstevel@tonic-gate 1 - Answer yes, and this script would generate the mapping 4730Sstevel@tonic-gate information for this map assuming it is a simple map. 4740Sstevel@tonic-gate And once the execution of the script is over, you can 4750Sstevel@tonic-gate customize the mapping information by hand editing the 4760Sstevel@tonic-gate mapping file. 4770Sstevel@tonic-gate 4780Sstevel@tonic-gate 2 - Answer no, and this script would not generate mapping 4790Sstevel@tonic-gate info for this map. And once the execution of the script 4800Sstevel@tonic-gate is over, you can include the customized mapping 4810Sstevel@tonic-gate information by hand editing the mapping file. 4820Sstevel@tonic-gate 4830Sstevel@tonic-gateEOF 4840Sstevel@tonic-gate ;; 4850Sstevel@tonic-gate nisLDAPdomainContext_help) cat <<EOF 4860Sstevel@tonic-gate 4870Sstevel@tonic-gateHELP - This parameter defines the context (default location) in 4880Sstevel@tonic-gate the directory tree at which all the name service entries 4890Sstevel@tonic-gate for this particular domain would be stored. 4900Sstevel@tonic-gate 4910Sstevel@tonic-gateEOF 4920Sstevel@tonic-gate ;; 4930Sstevel@tonic-gate nisLDAPyppasswddDomains_help) cat <<EOF 4940Sstevel@tonic-gate 4950Sstevel@tonic-gateHELP - Lists the domains for which password changes should be 4960Sstevel@tonic-gate made. If this is not present then the value returned by 4970Sstevel@tonic-gate 'domainname' will be used. 4980Sstevel@tonic-gate 4990Sstevel@tonic-gate NIS password change requests do not specify the domains in 5000Sstevel@tonic-gate which any given password should be changed. (In traditional 5010Sstevel@tonic-gate NIS this information is effectively hard coded in the NIS 5020Sstevel@tonic-gate makefile.) 5030Sstevel@tonic-gate 5040Sstevel@tonic-gateEOF 5050Sstevel@tonic-gate ;; 5060Sstevel@tonic-gate custom_map_comment_char_help) cat <<EOF 5070Sstevel@tonic-gate 5080Sstevel@tonic-gateHELP - If selected, it will allow you to specify a character which 5090Sstevel@tonic-gate would represent the start of the special 'comment' field in 5100Sstevel@tonic-gate a given NIS map. If this attribute is not present then the 5110Sstevel@tonic-gate default comment character '#' is used. 5120Sstevel@tonic-gate 5130Sstevel@tonic-gate If a map cannot contain comments then the blank comment 5140Sstevel@tonic-gate character ('') should be specified (just hit the return key). 5150Sstevel@tonic-gate 5160Sstevel@tonic-gateEOF 5170Sstevel@tonic-gate ;; 5180Sstevel@tonic-gate same_comment_char_help) cat <<EOF 5190Sstevel@tonic-gate 5200Sstevel@tonic-gateHELP - If selected, for a given map, it will allow you to specify 5210Sstevel@tonic-gate a common comment character for all the domains. 5220Sstevel@tonic-gate 5230Sstevel@tonic-gate Or else by selecting NO, for the same map, you would be 5240Sstevel@tonic-gate given the option to specify different comment character 5250Sstevel@tonic-gate for different domains. 5260Sstevel@tonic-gate 5270Sstevel@tonic-gateEOF 5280Sstevel@tonic-gate ;; 5290Sstevel@tonic-gate secure_flag_on_help) cat <<EOF 5300Sstevel@tonic-gate 5310Sstevel@tonic-gateHELP - Secure flag is set on maps which are generated with 5320Sstevel@tonic-gate "makedbm -s". When converting data from LDAP to YP, 5330Sstevel@tonic-gate it adds YP_SECURE entries. 5340Sstevel@tonic-gate 5350Sstevel@tonic-gateEOF 5360Sstevel@tonic-gate ;; 5370Sstevel@tonic-gate secure_flag_all_domains_help) cat <<EOF 5380Sstevel@tonic-gate 5390Sstevel@tonic-gateHELP - If selected, it will allow you to set the secure flag on 5400Sstevel@tonic-gate for this map for all the domains. 5410Sstevel@tonic-gate 5420Sstevel@tonic-gate Or else by selecting NO, you would be given the option to 5430Sstevel@tonic-gate set this flag, for the same map, on per domain basis. 5440Sstevel@tonic-gate 5450Sstevel@tonic-gateEOF 5460Sstevel@tonic-gate ;; 5470Sstevel@tonic-gate interdomain_flag_on_help) cat <<EOF 5480Sstevel@tonic-gate 5490Sstevel@tonic-gateHELP - Interdomain flag is set on a set of maps which are generated 5500Sstevel@tonic-gate with "makedbm -b". It signals NIS servers to use the domain 5510Sstevel@tonic-gate name resolver for host name and address lookups for hosts 5520Sstevel@tonic-gate not found in the maps. 5530Sstevel@tonic-gate 5540Sstevel@tonic-gate If selected, it adds YP_INTERDOMAIN entries in these maps 5550Sstevel@tonic-gate when converting data from LDAP to YP. 5560Sstevel@tonic-gate 5570Sstevel@tonic-gateEOF 5580Sstevel@tonic-gate ;; 5590Sstevel@tonic-gate interdomain_flag_all_domains_help) cat <<EOF 5600Sstevel@tonic-gate 5610Sstevel@tonic-gateHELP - If selected, it will allow you to set the interdomain flag 5620Sstevel@tonic-gate on for all the domains. 5630Sstevel@tonic-gate 5640Sstevel@tonic-gate Or else by selecting NO, you would be given the option to 5650Sstevel@tonic-gate set this flag on per domain basis. 5660Sstevel@tonic-gate 5670Sstevel@tonic-gateEOF 5680Sstevel@tonic-gate ;; 5690Sstevel@tonic-gate initialTTLlo_help) cat <<EOF 5700Sstevel@tonic-gate 5710Sstevel@tonic-gateHELP - The lower limit for the initial TTL (in seconds) for data 5720Sstevel@tonic-gate read from disk when the ypserv starts. If initialTTLhi also 5730Sstevel@tonic-gate is specified, the actual initialTTL will be randomly selected 5740Sstevel@tonic-gate from the interval initialTTLlo to initialTTLhi (inclusive). 5750Sstevel@tonic-gate 5760Sstevel@tonic-gate Leaving the field empty yields the default value of $DEF_iTTLlo. 5770Sstevel@tonic-gate 5780Sstevel@tonic-gateEOF 5790Sstevel@tonic-gate ;; 5800Sstevel@tonic-gate initialTTLhi_help) cat <<EOF 5810Sstevel@tonic-gate 5820Sstevel@tonic-gateHELP - The upper limit for the initial TTL (in seconds). 5830Sstevel@tonic-gate If left empty, defaults to "$DEF_iTTLhi". 5840Sstevel@tonic-gate 5850Sstevel@tonic-gateEOF 5860Sstevel@tonic-gate ;; 5870Sstevel@tonic-gate runningTTL_help) cat <<EOF 5880Sstevel@tonic-gate 5890Sstevel@tonic-gateHELP - The TTL (in seconds) for data retrieved from LDAP while the 5900Sstevel@tonic-gate ypserv is running. If left empty, defaults to "$DEF_runTTL". 5910Sstevel@tonic-gate 5920Sstevel@tonic-gateEOF 5930Sstevel@tonic-gate ;; 5940Sstevel@tonic-gate default_ttl_help) cat <<EOF 5950Sstevel@tonic-gate 5960Sstevel@tonic-gateHELP - The default TTL value for each map is set to : 5970Sstevel@tonic-gate ${DEF_iTTLlo}:${DEF_iTTLhi}:${DEF_runTTL} 5980Sstevel@tonic-gate 5990Sstevel@tonic-gate Select yes if you want to change the current TTL value. 6000Sstevel@tonic-gate 6010Sstevel@tonic-gateEOF 6020Sstevel@tonic-gate ;; 6030Sstevel@tonic-gate non_default_same_ttl_help) cat <<EOF 6040Sstevel@tonic-gate 6050Sstevel@tonic-gateHELP - Select yes if you want to set a new TTL value, but want 6060Sstevel@tonic-gate to keep it same for all the maps. 6070Sstevel@tonic-gate 6080Sstevel@tonic-gateEOF 6090Sstevel@tonic-gate ;; 6100Sstevel@tonic-gate non_default_different_ttl_help) cat <<EOF 6110Sstevel@tonic-gate 6120Sstevel@tonic-gateHELP - Select yes if you want to set TTL value for each map, but 6130Sstevel@tonic-gate want to keep it same for all the domains. 6140Sstevel@tonic-gate 6150Sstevel@tonic-gateEOF 6160Sstevel@tonic-gate ;; 6170Sstevel@tonic-gate default_different_ttl_help) cat <<EOF 6180Sstevel@tonic-gate 6190Sstevel@tonic-gateHELP - Select yes if you want to accept the default TTL 6200Sstevel@tonic-gate value for this map. 6210Sstevel@tonic-gate 6220Sstevel@tonic-gateEOF 6230Sstevel@tonic-gate ;; 6240Sstevel@tonic-gate same_ttl_across_domains_help) cat <<EOF 6250Sstevel@tonic-gate 6260Sstevel@tonic-gateHELP - Select yes if you want to set TTL value for the map, 6270Sstevel@tonic-gate but want to keep it same for all the domains. 6280Sstevel@tonic-gate 6290Sstevel@tonic-gateEOF 6300Sstevel@tonic-gate ;; 6310Sstevel@tonic-gate 6320Sstevel@tonic-gate esac 6330Sstevel@tonic-gate} 6340Sstevel@tonic-gate 6350Sstevel@tonic-gate# 6360Sstevel@tonic-gate# Echo the message passed only if DEBUG is set. 6370Sstevel@tonic-gate# Reduces the line width significantly. 6380Sstevel@tonic-gate# 6390Sstevel@tonic-gated_echo() 6400Sstevel@tonic-gate{ 6410Sstevel@tonic-gate[ DEBUG -eq 1 ] && echo $@ 6420Sstevel@tonic-gate} 6430Sstevel@tonic-gate 6440Sstevel@tonic-gate 6450Sstevel@tonic-gate# 6460Sstevel@tonic-gate# get_ans(): gets an answer from the user. 6470Sstevel@tonic-gate# $1 instruction/comment/description/question 6480Sstevel@tonic-gate# $2 default value 6490Sstevel@tonic-gate# 6500Sstevel@tonic-gateget_ans() 6510Sstevel@tonic-gate{ 6520Sstevel@tonic-gate if [ -z "$2" ] 6530Sstevel@tonic-gate then 6540Sstevel@tonic-gate echo "$1 \c" 6550Sstevel@tonic-gate else 6560Sstevel@tonic-gate echo "$1 [$2] \c" 6570Sstevel@tonic-gate fi 6580Sstevel@tonic-gate 6590Sstevel@tonic-gate read ANS 6600Sstevel@tonic-gate if [ -z "$ANS" ] 6610Sstevel@tonic-gate then 6620Sstevel@tonic-gate ANS=$2 6630Sstevel@tonic-gate fi 6640Sstevel@tonic-gate} 6650Sstevel@tonic-gate 6660Sstevel@tonic-gate 6670Sstevel@tonic-gate# 6680Sstevel@tonic-gate# get_ans_req(): gets an answer (required) from the user, NULL value not allowed. 6690Sstevel@tonic-gate# $@ instruction/comment/description/question 6700Sstevel@tonic-gate# 6710Sstevel@tonic-gateget_ans_req() 6720Sstevel@tonic-gate{ 6730Sstevel@tonic-gate ANS="" # Set ANS to NULL. 6740Sstevel@tonic-gate while [ "$ANS" = "" ] 6750Sstevel@tonic-gate do 6760Sstevel@tonic-gate get_ans "$@" 6770Sstevel@tonic-gate [ "$ANS" = "" ] && echo "NULL value not allowed!" 6780Sstevel@tonic-gate done 6790Sstevel@tonic-gate} 6800Sstevel@tonic-gate 6810Sstevel@tonic-gate 6820Sstevel@tonic-gate# 6830Sstevel@tonic-gate# get_integer(): Querys and verifies that number entered is integer. 6840Sstevel@tonic-gate# Function will repeat prompt user for integer value. 6850Sstevel@tonic-gate# $1 Message text. 6860Sstevel@tonic-gate# $2 default value. 6870Sstevel@tonic-gate# $3 Help argument. 6880Sstevel@tonic-gate# 6890Sstevel@tonic-gateget_integer() 6900Sstevel@tonic-gate{ 6910Sstevel@tonic-gate ANS="" # Set ANS to NULL. 6920Sstevel@tonic-gate NUM="" 6930Sstevel@tonic-gate 6940Sstevel@tonic-gate get_ans "$1" "$2" 6950Sstevel@tonic-gate 6960Sstevel@tonic-gate # Verify that value is integer. 6970Sstevel@tonic-gate while not_integer $ANS 6980Sstevel@tonic-gate do 6990Sstevel@tonic-gate case "$ANS" in 7000Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${3:-sorry} ;; 7010Sstevel@tonic-gate * ) echo "Invalid value: \"${ANS}\". \c" 7020Sstevel@tonic-gate ;; 7030Sstevel@tonic-gate esac 7040Sstevel@tonic-gate 7050Sstevel@tonic-gate # Get a new value. 7060Sstevel@tonic-gate get_ans "Enter an integer value:" "$2" 7070Sstevel@tonic-gate done 7080Sstevel@tonic-gate NUM=$ANS 7090Sstevel@tonic-gate} 7100Sstevel@tonic-gate 7110Sstevel@tonic-gate 7120Sstevel@tonic-gate# 7130Sstevel@tonic-gate# get_number(): Querys and verifies that number entered is numeric. 7140Sstevel@tonic-gate# Function will repeat prompt user for numeric value. 7150Sstevel@tonic-gate# $1 Message text. 7160Sstevel@tonic-gate# $2 default value. 7170Sstevel@tonic-gate# $3 Help argument. 7180Sstevel@tonic-gate# 7190Sstevel@tonic-gateget_number() 7200Sstevel@tonic-gate{ 7210Sstevel@tonic-gate ANS="" # Set ANS to NULL. 7220Sstevel@tonic-gate NUM="" 7230Sstevel@tonic-gate 7240Sstevel@tonic-gate get_ans "$1" "$2" 7250Sstevel@tonic-gate 7260Sstevel@tonic-gate # Verify that value is numeric. 7270Sstevel@tonic-gate while not_numeric $ANS 7280Sstevel@tonic-gate do 7290Sstevel@tonic-gate case "$ANS" in 7300Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${3:-sorry} ;; 7310Sstevel@tonic-gate * ) echo "Invalid value: \"${ANS}\". \c" 7320Sstevel@tonic-gate ;; 7330Sstevel@tonic-gate esac 7340Sstevel@tonic-gate 7350Sstevel@tonic-gate # Get a new value. 7360Sstevel@tonic-gate get_ans "Enter a numeric value:" "$2" 7370Sstevel@tonic-gate done 7380Sstevel@tonic-gate NUM=$ANS 7390Sstevel@tonic-gate} 7400Sstevel@tonic-gate 7410Sstevel@tonic-gate 7420Sstevel@tonic-gate# 7430Sstevel@tonic-gate# get_pos_int(): Only allows positive integer. 7440Sstevel@tonic-gate# 7450Sstevel@tonic-gate# $1 - Prompt message. 7460Sstevel@tonic-gate# $2 - Default value (require). 7470Sstevel@tonic-gate# $3 - Optional help argument. 7480Sstevel@tonic-gateget_pos_int() 7490Sstevel@tonic-gate{ 7500Sstevel@tonic-gate while : 7510Sstevel@tonic-gate do 7520Sstevel@tonic-gate get_integer "$1" "$2" "$3" 7530Sstevel@tonic-gate 7540Sstevel@tonic-gate if [ $ANS -lt 0 ]; then 7550Sstevel@tonic-gate echo "Invalid number: please enter a positive integer." 7560Sstevel@tonic-gate else 7570Sstevel@tonic-gate break # Positive integer 7580Sstevel@tonic-gate fi 7590Sstevel@tonic-gate done 7600Sstevel@tonic-gate} 7610Sstevel@tonic-gate 7620Sstevel@tonic-gate 7630Sstevel@tonic-gate# 7640Sstevel@tonic-gate# get_pos_num(): Only allows positive number. 7650Sstevel@tonic-gate# 7660Sstevel@tonic-gate# $1 - Prompt message. 7670Sstevel@tonic-gate# $2 - Default value (require). 7680Sstevel@tonic-gate# $3 - Optional help argument. 7690Sstevel@tonic-gateget_pos_num() 7700Sstevel@tonic-gate{ 7710Sstevel@tonic-gate while : 7720Sstevel@tonic-gate do 7730Sstevel@tonic-gate get_number "$1" "$2" "$3" 7740Sstevel@tonic-gate 7750Sstevel@tonic-gate if [ $ANS -lt 0 ]; then 7760Sstevel@tonic-gate echo "Invalid number: please enter a positive number." 7770Sstevel@tonic-gate else 7780Sstevel@tonic-gate break # Positive number 7790Sstevel@tonic-gate fi 7800Sstevel@tonic-gate done 7810Sstevel@tonic-gate} 7820Sstevel@tonic-gate 7830Sstevel@tonic-gate 7840Sstevel@tonic-gate# 7850Sstevel@tonic-gate# 7860Sstevel@tonic-gate# get_passwd(): Reads a password from the user and verify with second. 7870Sstevel@tonic-gate# $@ instruction/comment/description/question 7880Sstevel@tonic-gate# 7890Sstevel@tonic-gateget_passwd() 7900Sstevel@tonic-gate{ 7910Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo "In get_passwd()" 7920Sstevel@tonic-gate 7930Sstevel@tonic-gate # Temporary PASSWD variables 7940Sstevel@tonic-gate _PASS1="" 7950Sstevel@tonic-gate _PASS2="" 7960Sstevel@tonic-gate 7970Sstevel@tonic-gate # Handle signals, so that echo can be turned back on if Ctrl-C. 7980Sstevel@tonic-gate trap "/usr/bin/stty echo; exit" 1 2 3 6 15 7990Sstevel@tonic-gate 8000Sstevel@tonic-gate /usr/bin/stty -echo # Turn echo OFF 8010Sstevel@tonic-gate 8020Sstevel@tonic-gate # Endless loop that continues until passwd and re-entered passwd 8030Sstevel@tonic-gate # match. 8040Sstevel@tonic-gate while : 8050Sstevel@tonic-gate do 8060Sstevel@tonic-gate ANS="" # Set ANS to NULL. 8070Sstevel@tonic-gate 8080Sstevel@tonic-gate # Don't allow NULL for first try. 8090Sstevel@tonic-gate while [ "$ANS" = "" ] 8100Sstevel@tonic-gate do 8110Sstevel@tonic-gate get_ans "$@" 8120Sstevel@tonic-gate [ "$ANS" = "" ] && echo "" && echo "NULL passwd not allowed!" 8130Sstevel@tonic-gate done 8140Sstevel@tonic-gate _PASS1=$ANS # Store first try. 8150Sstevel@tonic-gate 8160Sstevel@tonic-gate # Get second try. 8170Sstevel@tonic-gate echo "" 8180Sstevel@tonic-gate get_ans "Re-enter passwd:" 8190Sstevel@tonic-gate _PASS2=$ANS 8200Sstevel@tonic-gate 8210Sstevel@tonic-gate # Test if passwords are identical. 8220Sstevel@tonic-gate if [ "$_PASS1" = "$_PASS2" ]; then 8230Sstevel@tonic-gate break 8240Sstevel@tonic-gate fi 8250Sstevel@tonic-gate 8260Sstevel@tonic-gate # Move cursor down to next line and print ERROR message. 8270Sstevel@tonic-gate echo "" 8280Sstevel@tonic-gate echo "ERROR: passwords don't match; try again." 8290Sstevel@tonic-gate done 8300Sstevel@tonic-gate 8310Sstevel@tonic-gate /usr/bin/stty echo # Turn echo ON 8320Sstevel@tonic-gate 8330Sstevel@tonic-gate # Removed signal handler 8340Sstevel@tonic-gate trap 1 2 3 6 15 8350Sstevel@tonic-gate 8360Sstevel@tonic-gate echo "" 8370Sstevel@tonic-gate} 8380Sstevel@tonic-gate 8390Sstevel@tonic-gate 8400Sstevel@tonic-gate# 8410Sstevel@tonic-gate# get_passwd_nochk(): Reads a password from the user w/o check. 8420Sstevel@tonic-gate# $@ instruction/comment/description/question 8430Sstevel@tonic-gate# 8440Sstevel@tonic-gateget_passwd_nochk() 8450Sstevel@tonic-gate{ 8460Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo "In get_passwd_nochk()" 8470Sstevel@tonic-gate 8480Sstevel@tonic-gate # Handle signals, so that echo can be turned back on if Ctrl-C. 8490Sstevel@tonic-gate trap "/usr/bin/stty echo; exit" 1 2 3 6 15 8500Sstevel@tonic-gate 8510Sstevel@tonic-gate /usr/bin/stty -echo # Turn echo OFF 8520Sstevel@tonic-gate 8530Sstevel@tonic-gate get_ans "$@" 8540Sstevel@tonic-gate 8550Sstevel@tonic-gate /usr/bin/stty echo # Turn echo ON 8560Sstevel@tonic-gate 8570Sstevel@tonic-gate # Removed signal handler 8580Sstevel@tonic-gate trap 1 2 3 6 15 8590Sstevel@tonic-gate 8600Sstevel@tonic-gate echo "" 8610Sstevel@tonic-gate} 8620Sstevel@tonic-gate 8630Sstevel@tonic-gate 8640Sstevel@tonic-gate# 8650Sstevel@tonic-gate# get_confirm(): Get confirmation from the user. (Y/Yes or N/No) 8660Sstevel@tonic-gate# $1 - Message 8670Sstevel@tonic-gate# $2 - default value. 8680Sstevel@tonic-gate# 8690Sstevel@tonic-gateget_confirm() 8700Sstevel@tonic-gate{ 8710Sstevel@tonic-gate _ANSWER= 8720Sstevel@tonic-gate 8730Sstevel@tonic-gate while : 8740Sstevel@tonic-gate do 8750Sstevel@tonic-gate # Display Internal ERROR if $2 not set. 8760Sstevel@tonic-gate if [ -z "$2" ]; then 8770Sstevel@tonic-gate echo "INTERNAL ERROR: get_confirm requires 2 args, 3rd is optional." 8780Sstevel@tonic-gate exit 2 8790Sstevel@tonic-gate fi 8800Sstevel@tonic-gate 8810Sstevel@tonic-gate # Display prompt. 8820Sstevel@tonic-gate echo "$1 [$2] \c" 8830Sstevel@tonic-gate 8840Sstevel@tonic-gate # Get the ANSWER. 8850Sstevel@tonic-gate read _ANSWER 8860Sstevel@tonic-gate if [ "$_ANSWER" = "" ] && [ -n "$2" ] ; then 8870Sstevel@tonic-gate _ANSWER=$2 8880Sstevel@tonic-gate fi 8890Sstevel@tonic-gate case "$_ANSWER" in 8900Sstevel@tonic-gate [Yy] | yes | Yes | YES) return 1 ;; 8910Sstevel@tonic-gate [Nn] | no | No | NO) return 0 ;; 8920Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${3:-sorry};; 8930Sstevel@tonic-gate * ) echo "Please enter y or n." ;; 8940Sstevel@tonic-gate esac 8950Sstevel@tonic-gate done 8960Sstevel@tonic-gate} 8970Sstevel@tonic-gate 8980Sstevel@tonic-gate 8990Sstevel@tonic-gate# 9000Sstevel@tonic-gate# get_confirm_nodef(): Get confirmation from the user. (Y/Yes or N/No) 9010Sstevel@tonic-gate# No default value supported. Returns 1 for yes. 9020Sstevel@tonic-gate# 9030Sstevel@tonic-gateget_confirm_nodef() 9040Sstevel@tonic-gate{ 9050Sstevel@tonic-gate _ANSWER= 9060Sstevel@tonic-gate 9070Sstevel@tonic-gate while : 9080Sstevel@tonic-gate do 9090Sstevel@tonic-gate echo "$@ \c" 9100Sstevel@tonic-gate read _ANSWER 9110Sstevel@tonic-gate case "$_ANSWER" in 9120Sstevel@tonic-gate [Yy] | yes | Yes | YES) return 1 ;; 9130Sstevel@tonic-gate [Nn] | no | No | NO) return 0 ;; 9140Sstevel@tonic-gate * ) echo "Please enter y or n." ;; 9150Sstevel@tonic-gate esac 9160Sstevel@tonic-gate done 9170Sstevel@tonic-gate} 9180Sstevel@tonic-gate 9190Sstevel@tonic-gate 9200Sstevel@tonic-gate# 9210Sstevel@tonic-gate# is_integer(): Tells if a string is numeric integer. 9220Sstevel@tonic-gate# 0 = Integer 9230Sstevel@tonic-gate# 1 = NOT Integer 9240Sstevel@tonic-gate# 9250Sstevel@tonic-gateis_integer() 9260Sstevel@tonic-gate{ 9270Sstevel@tonic-gate # Check for parameter. 9280Sstevel@tonic-gate if [ $# -ne 1 ]; then 9290Sstevel@tonic-gate return 1 9300Sstevel@tonic-gate fi 9310Sstevel@tonic-gate 9320Sstevel@tonic-gate # Determine if integer. 9330Sstevel@tonic-gate expr "$1" + 1 > /dev/null 2>&1 9340Sstevel@tonic-gate 9350Sstevel@tonic-gate if [ $? -ge 2 ]; then 9360Sstevel@tonic-gate return 1 9370Sstevel@tonic-gate fi 9380Sstevel@tonic-gate 9390Sstevel@tonic-gate # Made it here, it's Numeric. 9400Sstevel@tonic-gate return 0 9410Sstevel@tonic-gate} 9420Sstevel@tonic-gate 9430Sstevel@tonic-gate 9440Sstevel@tonic-gate# 9450Sstevel@tonic-gate# not_integer(): Reverses the return values of is_integer. Useful 9460Sstevel@tonic-gate# for if and while statements that want to test for 9470Sstevel@tonic-gate# non-integer data. 9480Sstevel@tonic-gate# 0 = NOT Integer 9490Sstevel@tonic-gate# 1 = Integer 9500Sstevel@tonic-gate# 9510Sstevel@tonic-gatenot_integer() 9520Sstevel@tonic-gate{ 9530Sstevel@tonic-gate is_integer $1 9540Sstevel@tonic-gate if [ $? -eq 0 ]; then 9550Sstevel@tonic-gate return 1 9560Sstevel@tonic-gate else 9570Sstevel@tonic-gate return 0 9580Sstevel@tonic-gate fi 9590Sstevel@tonic-gate} 9600Sstevel@tonic-gate 9610Sstevel@tonic-gate 9620Sstevel@tonic-gate# 9630Sstevel@tonic-gate# is_numeric(): Tells if a string is numeric. 9640Sstevel@tonic-gate# 0 = Numeric 9650Sstevel@tonic-gate# 1 = NOT Numeric 9660Sstevel@tonic-gate# 9670Sstevel@tonic-gateis_numeric() 9680Sstevel@tonic-gate{ 9690Sstevel@tonic-gate # Check for parameter. 9700Sstevel@tonic-gate if [ $# -ne 1 ]; then 9710Sstevel@tonic-gate return 1 9720Sstevel@tonic-gate fi 9730Sstevel@tonic-gate 9740Sstevel@tonic-gate # Determine if numeric. 9750Sstevel@tonic-gate let _NUM="$1 + 1" > /dev/null 2>&1 9760Sstevel@tonic-gate 9770Sstevel@tonic-gate if [ $? -eq 0 ]; then 9780Sstevel@tonic-gate return 0 9790Sstevel@tonic-gate fi 9800Sstevel@tonic-gate 9810Sstevel@tonic-gate} 9820Sstevel@tonic-gate 9830Sstevel@tonic-gate 9840Sstevel@tonic-gate# 9850Sstevel@tonic-gate# not_numeric(): Reverses the return values of is_numeric. Useful 9860Sstevel@tonic-gate# for if and while statements that want to test for 9870Sstevel@tonic-gate# non-numeric data. 9880Sstevel@tonic-gate# 0 = NOT Numeric 9890Sstevel@tonic-gate# 1 = Numeric 9900Sstevel@tonic-gate# 9910Sstevel@tonic-gatenot_numeric() 9920Sstevel@tonic-gate{ 9930Sstevel@tonic-gate is_numeric $1 9940Sstevel@tonic-gate if [ $? -eq 0 ]; then 9950Sstevel@tonic-gate return 1 9960Sstevel@tonic-gate else 9970Sstevel@tonic-gate return 0 9980Sstevel@tonic-gate fi 9990Sstevel@tonic-gate} 10000Sstevel@tonic-gate 10010Sstevel@tonic-gate 10020Sstevel@tonic-gate# 10030Sstevel@tonic-gate# domain_2_dc(): Convert a domain name into dc string. 10040Sstevel@tonic-gate# $1 .. Domain name. 10050Sstevel@tonic-gate# 10060Sstevel@tonic-gatedomain_2_dc() 10070Sstevel@tonic-gate{ 10080Sstevel@tonic-gate _DOM=$1 # Domain parameter. 10090Sstevel@tonic-gate _DOM_2_DC="" # Return value from function. 10100Sstevel@tonic-gate _FIRST=1 # Flag for first time. 10110Sstevel@tonic-gate 10120Sstevel@tonic-gate export _DOM_2_DC # Make visible for others. 10130Sstevel@tonic-gate 10140Sstevel@tonic-gate # Convert "."'s to spaces for "for" loop. 10150Sstevel@tonic-gate domtmp="`echo ${_DOM} | tr '.' ' '`" 10160Sstevel@tonic-gate for i in $domtmp; do 10170Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 10180Sstevel@tonic-gate _DOM_2_DC="dc=${i}" 10190Sstevel@tonic-gate _FIRST=0 10200Sstevel@tonic-gate else 10210Sstevel@tonic-gate _DOM_2_DC="${_DOM_2_DC},dc=${i}" 10220Sstevel@tonic-gate fi 10230Sstevel@tonic-gate done 10240Sstevel@tonic-gate} 10250Sstevel@tonic-gate 10260Sstevel@tonic-gate 10270Sstevel@tonic-gate# 10280Sstevel@tonic-gate# is_root_user(): Check to see if logged in as super user. 10290Sstevel@tonic-gate# 10300Sstevel@tonic-gateis_root_user() 10310Sstevel@tonic-gate{ 10320Sstevel@tonic-gate case `id` in 10330Sstevel@tonic-gate uid=0\(root\)*) return 0 ;; 10340Sstevel@tonic-gate * ) return 1 ;; 10350Sstevel@tonic-gate esac 10360Sstevel@tonic-gate} 10370Sstevel@tonic-gate 10380Sstevel@tonic-gate 10390Sstevel@tonic-gate# 10400Sstevel@tonic-gate# parse_arg(): Parses the command line arguments and sets the 10410Sstevel@tonic-gate# appropriate variables. 10420Sstevel@tonic-gate# 10430Sstevel@tonic-gateparse_arg() 10440Sstevel@tonic-gate{ 10450Sstevel@tonic-gate while getopts ":dm:c:" ARG 10460Sstevel@tonic-gate do 10470Sstevel@tonic-gate case $ARG in 10480Sstevel@tonic-gate d) DEBUG=1;; 10490Sstevel@tonic-gate 10500Sstevel@tonic-gate m) MAP_FILE=$OPTARG 10510Sstevel@tonic-gate MAPPING_FILE_SPECIFIED=1;; 10520Sstevel@tonic-gate 10530Sstevel@tonic-gate c) CONFIG_FILE=$OPTARG 10540Sstevel@tonic-gate CONFIG_FILE_SPECIFIED=1;; 10550Sstevel@tonic-gate 10560Sstevel@tonic-gate \?) echo "**ERROR: Invalid option '$OPTARG'" 10570Sstevel@tonic-gate display_msg usage 10580Sstevel@tonic-gate exit 1;; 10590Sstevel@tonic-gate esac 10600Sstevel@tonic-gate done 10610Sstevel@tonic-gate 10620Sstevel@tonic-gate shift `expr $OPTIND - 1` 10630Sstevel@tonic-gate if [ $# -gt 0 ]; then 10640Sstevel@tonic-gate echo "**ERROR: wrong usage " 10650Sstevel@tonic-gate display_msg usage 10660Sstevel@tonic-gate exit 1 10670Sstevel@tonic-gate fi 10680Sstevel@tonic-gate} 10690Sstevel@tonic-gate 10700Sstevel@tonic-gate 10710Sstevel@tonic-gate# 10720Sstevel@tonic-gate# present() : Checks if the first argument exists in the 10730Sstevel@tonic-gate# argument list. Returns 0 if found, else 1. 10740Sstevel@tonic-gate# 10750Sstevel@tonic-gatepresent () 10760Sstevel@tonic-gate{ 10770Sstevel@tonic-gate_ELEMENT=$1 10780Sstevel@tonic-gate 10790Sstevel@tonic-gateshift 10800Sstevel@tonic-gateARG_LIST=$@ 10810Sstevel@tonic-gate 10820Sstevel@tonic-gatefor item in $ARG_LIST 10830Sstevel@tonic-gatedo 10840Sstevel@tonic-gate [ "$_ELEMENT" = "$item" ] && return 0 10850Sstevel@tonic-gatedone 10860Sstevel@tonic-gate 10870Sstevel@tonic-gate# If reached here, then the clement does not exist 10880Sstevel@tonic-gatereturn 1 10890Sstevel@tonic-gate} 10900Sstevel@tonic-gate 10910Sstevel@tonic-gate 10920Sstevel@tonic-gate# 10930Sstevel@tonic-gate# remove() : Returns a new string after removing the first 10940Sstevel@tonic-gate# argument in the argument list. 10950Sstevel@tonic-gate# 10960Sstevel@tonic-gateremove () 10970Sstevel@tonic-gate{ 10980Sstevel@tonic-gate_ELEMENT=$1 10990Sstevel@tonic-gate 11000Sstevel@tonic-gateshift 11010Sstevel@tonic-gateARG_LIST=$@ 11020Sstevel@tonic-gate 11030Sstevel@tonic-gateNEW_LIST="" 11040Sstevel@tonic-gate 11050Sstevel@tonic-gatefor item in $ARG_LIST 11060Sstevel@tonic-gatedo 11070Sstevel@tonic-gate [ "$_ELEMENT" != "$item" ] && NEW_LIST="$NEW_LIST $item" 11080Sstevel@tonic-gatedone 11090Sstevel@tonic-gate 11100Sstevel@tonic-gateecho $NEW_LIST 11110Sstevel@tonic-gatereturn 0 11120Sstevel@tonic-gate} 11130Sstevel@tonic-gate 11140Sstevel@tonic-gate 11150Sstevel@tonic-gate# 11160Sstevel@tonic-gate# merge_lists() : Returns a list after merging elements 11170Sstevel@tonic-gate# (uniquely) supplied in the argument list. 11180Sstevel@tonic-gate# 11190Sstevel@tonic-gatemerge_lists() 11200Sstevel@tonic-gate{ 11210Sstevel@tonic-gateMERGED_LIST="" 11220Sstevel@tonic-gate 11230Sstevel@tonic-gatefor _VAR in "$@" 11240Sstevel@tonic-gatedo 11250Sstevel@tonic-gate if ! present $_VAR $MERGED_LIST; then 11260Sstevel@tonic-gate MERGED_LIST="$MERGED_LIST $_VAR" 11270Sstevel@tonic-gate fi 11280Sstevel@tonic-gatedone 11290Sstevel@tonic-gate 11300Sstevel@tonic-gateecho $MERGED_LIST 11310Sstevel@tonic-gatereturn 0 11320Sstevel@tonic-gate} 11330Sstevel@tonic-gate 11340Sstevel@tonic-gate 11350Sstevel@tonic-gate# 11360Sstevel@tonic-gate# init(): initializes variables and options 11370Sstevel@tonic-gate# 11380Sstevel@tonic-gateinit() 11390Sstevel@tonic-gate{ 11400Sstevel@tonic-gate# General variables. 11410Sstevel@tonic-gateDEBUG=0 # Set Debug OFF 11420Sstevel@tonic-gate 11430Sstevel@tonic-gateMAPPING_FILE_SPECIFIED=0 # No file name passed 11440Sstevel@tonic-gateCONFIG_FILE_SPECIFIED=0 # No file name passed 11450Sstevel@tonic-gate 11460Sstevel@tonic-gate# Prevent others from snooping 11470Sstevel@tonic-gateumask 077 11480Sstevel@tonic-gate 11490Sstevel@tonic-gate# Set default config and mapping files. 11500Sstevel@tonic-gateDEFAULT_MAP_FILE="/var/yp/NISLDAPmapping" 11510Sstevel@tonic-gateDEFAULT_CONFIG_FILE="/etc/default/ypserv" 11520Sstevel@tonic-gate 11530Sstevel@tonic-gateMAP_FILE="$DEFAULT_MAP_FILE" 11540Sstevel@tonic-gateCONFIG_FILE="$DEFAULT_CONFIG_FILE" 11550Sstevel@tonic-gate 11560Sstevel@tonic-gate# Set and create TMPDIR. Use a safe place to discourage hackers. 11570Sstevel@tonic-gateTMPDIR="/var/yp/inityp2l" 11580Sstevel@tonic-gate 11590Sstevel@tonic-gate# Temporary file names to be used to prevent system starting in 11600Sstevel@tonic-gate# N2L mode in case something goes wrong during file creation. 11610Sstevel@tonic-gateTMPCONF="ypserv-tmp" 11620Sstevel@tonic-gateTMPMAP="NISLDAPmapping-tmp" 11630Sstevel@tonic-gate 11640Sstevel@tonic-gate# Remove if the temp directory has been leftover 11650Sstevel@tonic-gate[ -d "$TMPDIR" ] && rm -rf $TMPDIR 11660Sstevel@tonic-gatemkdir $TMPDIR 11670Sstevel@tonic-gateif [ $? -ne 0 ]; then 11680Sstevel@tonic-gate echo ERROR : Failed to create temp directory $TMPDIR 11690Sstevel@tonic-gate exit 1 11700Sstevel@tonic-gatefi 11710Sstevel@tonic-gate 11720Sstevel@tonic-gate# Initialize the default NIS maps. 11730Sstevel@tonic-gateDEFAULT_NIS_MAPS="passwd.byname 11740Sstevel@tonic-gate passwd.byuid 11750Sstevel@tonic-gate group.byname 11760Sstevel@tonic-gate group.bygid 11770Sstevel@tonic-gate hosts.byaddr 11780Sstevel@tonic-gate hosts.byname 11790Sstevel@tonic-gate ipnodes.byaddr 11800Sstevel@tonic-gate ipnodes.byname 11810Sstevel@tonic-gate ethers.byaddr 11820Sstevel@tonic-gate ethers.byname 11830Sstevel@tonic-gate networks.byaddr 11840Sstevel@tonic-gate networks.byname 11850Sstevel@tonic-gate rpc.bynumber 11860Sstevel@tonic-gate services.byname 11870Sstevel@tonic-gate services.byservicename 11880Sstevel@tonic-gate printers.conf.byname 11890Sstevel@tonic-gate project.byname 11900Sstevel@tonic-gate project.byprojid 11910Sstevel@tonic-gate protocols.byname 11920Sstevel@tonic-gate protocols.bynumber 11930Sstevel@tonic-gate netgroup 11940Sstevel@tonic-gate netgroup.byuser 11950Sstevel@tonic-gate netgroup.byhost 11960Sstevel@tonic-gate bootparams 11970Sstevel@tonic-gate mail.aliases 11980Sstevel@tonic-gate mail.byaddr 11990Sstevel@tonic-gate publickey.byname 12000Sstevel@tonic-gate netid.byname 12010Sstevel@tonic-gate netmasks.byaddr 12020Sstevel@tonic-gate passwd.adjunct.byname 12030Sstevel@tonic-gate group.adjunct.byname 12040Sstevel@tonic-gate timezone.byname 12050Sstevel@tonic-gate auth_attr 12060Sstevel@tonic-gate exec_attr 12070Sstevel@tonic-gate prof_attr 12080Sstevel@tonic-gate user_attr 12090Sstevel@tonic-gate audit_user 12100Sstevel@tonic-gate auto.master 12110Sstevel@tonic-gate auto.home 12120Sstevel@tonic-gate ypservers" 12130Sstevel@tonic-gate 12140Sstevel@tonic-gateset -A DEF_NIS_MAP_ARRAY $DEFAULT_NIS_MAPS 12150Sstevel@tonic-gate 12160Sstevel@tonic-gate# The default TTL maps in database ID format. 12170Sstevel@tonic-gateDEF_TTL_MAPLIST="audit_user 12180Sstevel@tonic-gate auto.home 12190Sstevel@tonic-gate auto.master 12200Sstevel@tonic-gate auth_attr 12210Sstevel@tonic-gate bootparams 12220Sstevel@tonic-gate ethers 12230Sstevel@tonic-gate exec_attr 12240Sstevel@tonic-gate group 12250Sstevel@tonic-gate group.adjunct.byname 12260Sstevel@tonic-gate keys.host 12270Sstevel@tonic-gate keys.pass 12280Sstevel@tonic-gate keys.nobody 12290Sstevel@tonic-gate hosts 12300Sstevel@tonic-gate multihosts 12310Sstevel@tonic-gate ipnodes 12320Sstevel@tonic-gate multiipnodes 12330Sstevel@tonic-gate netgroup 12340Sstevel@tonic-gate networks 12350Sstevel@tonic-gate passwd 12360Sstevel@tonic-gate passwd.adjunct.byname 12370Sstevel@tonic-gate printers.conf.byname 12380Sstevel@tonic-gate prof_attr 12390Sstevel@tonic-gate project 12400Sstevel@tonic-gate protocols 12410Sstevel@tonic-gate services 12420Sstevel@tonic-gate mail.aliases 12430Sstevel@tonic-gate mail.mapping 12440Sstevel@tonic-gate netid.host 12450Sstevel@tonic-gate netid.pass 12460Sstevel@tonic-gate netmasks.byaddr 12470Sstevel@tonic-gate rpc.bynumber 12480Sstevel@tonic-gate ageing.byname 12490Sstevel@tonic-gate timezone.byname 12500Sstevel@tonic-gate user_attr 12510Sstevel@tonic-gate ypservers" 12520Sstevel@tonic-gate 12530Sstevel@tonic-gate 12540Sstevel@tonic-gate# Initialize default values for config parameters. 12550Sstevel@tonic-gate 12560Sstevel@tonic-gateconfigDN_flag=0 12570Sstevel@tonic-gateDEF_nisLDAPconfigDN="" 12580Sstevel@tonic-gateDEF_TLS=none 125911989SMilan.Jurik@Sun.COMDEF_TLSCertificateDBPath=/var/yp/ 12600Sstevel@tonic-gateDEF_nisLDAPbindTimeout=15 12610Sstevel@tonic-gateDEF_nisLDAPsearchTimeout=180 12620Sstevel@tonic-gateDEF_nisLDAPmodifyTimeout=15 12630Sstevel@tonic-gateDEF_nisLDAPaddTimeout=15 12640Sstevel@tonic-gateDEF_nisLDAPdeleteTimeout=15 12650Sstevel@tonic-gateDEF_nisLDAPsearchTimeLimit=${DEF_nisLDAPsearchTimeout} 12660Sstevel@tonic-gateDEF_nisLDAPsearchSizeLimit=0 12670Sstevel@tonic-gateDEF_nisLDAPfollowReferral=no 12680Sstevel@tonic-gateDEF_nisLDAPretrieveErrorAction=use_cached 12690Sstevel@tonic-gate 12700Sstevel@tonic-gate# The default is unlimited, but since it prevents the NIS daemon, 12710Sstevel@tonic-gate# from servicing further requests, set 1 as the suggested value. 12720Sstevel@tonic-gateSUG_nisLDAPretrieveErrorAttempts=1 12730Sstevel@tonic-gateDEF_nisLDAPretrieveErrorTimeout=15 12740Sstevel@tonic-gateDEF_nisLDAPstoreErrorAction=retry 12750Sstevel@tonic-gate 12760Sstevel@tonic-gate# The default is unlimited, but set 1 as the suggested value. 12770Sstevel@tonic-gateSUG_nisLDAPstoreErrorAttempts=1 12780Sstevel@tonic-gateDEF_nisLDAPstoreErrorTimeout=15 12790Sstevel@tonic-gate 12800Sstevel@tonic-gate# Default TTL values (in seconds) for NIS MAPS for mapping file. 12810Sstevel@tonic-gateDEF_iTTLlo=1800 12820Sstevel@tonic-gateDEF_iTTLhi=5400 12830Sstevel@tonic-gateDEF_runTTL=3600 12840Sstevel@tonic-gate 12850Sstevel@tonic-gate} 12860Sstevel@tonic-gate 12870Sstevel@tonic-gate 12880Sstevel@tonic-gate# 12890Sstevel@tonic-gate# config_auth_menu_handler(): Enter the authentication method 12900Sstevel@tonic-gate# for config server. 12910Sstevel@tonic-gate# 12920Sstevel@tonic-gateconfig_auth_menu_handler() 12930Sstevel@tonic-gate{ 12940Sstevel@tonic-gate # Display Auth menu 12950Sstevel@tonic-gate display_msg config_auth_method_menu 12960Sstevel@tonic-gate 12970Sstevel@tonic-gate # Get a Valid choice. 12980Sstevel@tonic-gate while : 12990Sstevel@tonic-gate do 13000Sstevel@tonic-gate # Display appropriate prompt and get answer. 13010Sstevel@tonic-gate get_ans_req " Choose one Authentication Method (h=help):" 13020Sstevel@tonic-gate 13030Sstevel@tonic-gate # Determine choice. 13040Sstevel@tonic-gate _MENU_CHOICE=$ANS 13050Sstevel@tonic-gate case "$_MENU_CHOICE" in 13060Sstevel@tonic-gate 1) _AUTHMETHOD="none" 13070Sstevel@tonic-gate break ;; 13080Sstevel@tonic-gate 2) _AUTHMETHOD="simple" 13090Sstevel@tonic-gate break ;; 13100Sstevel@tonic-gate 3) _AUTHMETHOD="sasl/cram-md5" 13110Sstevel@tonic-gate break ;; 13120Sstevel@tonic-gate 4) _AUTHMETHOD="sasl/digest-md5" 13130Sstevel@tonic-gate break ;; 13140Sstevel@tonic-gate h) display_msg auth_help ;; 13150Sstevel@tonic-gate *) echo "Please enter 1-4, or h=help." ;; 13160Sstevel@tonic-gate esac 13170Sstevel@tonic-gate done 13180Sstevel@tonic-gate} 13190Sstevel@tonic-gate 13200Sstevel@tonic-gate 13210Sstevel@tonic-gate# 13220Sstevel@tonic-gate# auth_menu_handler(): Enter the Authentication method for LDAP server. 13230Sstevel@tonic-gate# 13240Sstevel@tonic-gateauth_menu_handler() 13250Sstevel@tonic-gate{ 13260Sstevel@tonic-gate # Display Auth menu 13270Sstevel@tonic-gate display_msg auth_method_menu 13280Sstevel@tonic-gate 13290Sstevel@tonic-gate # Get a Valid choice. 13300Sstevel@tonic-gate while : 13310Sstevel@tonic-gate do 13320Sstevel@tonic-gate # Display appropriate prompt and get answer. 13330Sstevel@tonic-gate get_ans_req " Choose one Authentication Method (h=help):" 13340Sstevel@tonic-gate 13350Sstevel@tonic-gate # Determine choice. 13360Sstevel@tonic-gate _MENU_CHOICE=$ANS 13370Sstevel@tonic-gate case "$_MENU_CHOICE" in 13380Sstevel@tonic-gate 1) _AUTHMETHOD="simple" 13390Sstevel@tonic-gate break ;; 13400Sstevel@tonic-gate 2) _AUTHMETHOD="sasl/cram-md5" 13410Sstevel@tonic-gate break ;; 13420Sstevel@tonic-gate 3) _AUTHMETHOD="sasl/digest-md5" 13430Sstevel@tonic-gate break ;; 13440Sstevel@tonic-gate h) display_msg auth_help ;; 13450Sstevel@tonic-gate *) echo "Please enter 1-3, or h=help." ;; 13460Sstevel@tonic-gate esac 13470Sstevel@tonic-gate done 13480Sstevel@tonic-gate} 13490Sstevel@tonic-gate 13500Sstevel@tonic-gate 13510Sstevel@tonic-gate# 13520Sstevel@tonic-gate# tls_menu_handler(): Enter the transport layer security 13530Sstevel@tonic-gate# 13540Sstevel@tonic-gatetls_menu_handler() 13550Sstevel@tonic-gate{ 13560Sstevel@tonic-gate # Display TLS menu 13570Sstevel@tonic-gate display_msg tls_method_menu 13580Sstevel@tonic-gate 13590Sstevel@tonic-gate # Get a Valid choice. 13600Sstevel@tonic-gate while : 13610Sstevel@tonic-gate do 13620Sstevel@tonic-gate # Display appropriate prompt and get answer. 13630Sstevel@tonic-gate # Default value is "none". 13640Sstevel@tonic-gate 13650Sstevel@tonic-gate get_ans " Choose one Transport Layer Security Method (h=help):" "1" 13660Sstevel@tonic-gate 13670Sstevel@tonic-gate # Determine choice. 13680Sstevel@tonic-gate _MENU_CHOICE=$ANS 13690Sstevel@tonic-gate case "$_MENU_CHOICE" in 13700Sstevel@tonic-gate 1) _TLSMETHOD="none" 13710Sstevel@tonic-gate break ;; 13720Sstevel@tonic-gate 2) _TLSMETHOD="ssl" 13730Sstevel@tonic-gate break ;; 13740Sstevel@tonic-gate h) display_msg tls_help ;; 13750Sstevel@tonic-gate *) echo "Please enter 1, 2, or h=help." ;; 13760Sstevel@tonic-gate esac 13770Sstevel@tonic-gate done 13780Sstevel@tonic-gate} 13790Sstevel@tonic-gate 13800Sstevel@tonic-gate 13810Sstevel@tonic-gate# 13820Sstevel@tonic-gate# retrieve_error_action_menu_handler(): Enter the retrieve error action 13830Sstevel@tonic-gate# 13840Sstevel@tonic-gateretrieve_error_action_menu_handler() 13850Sstevel@tonic-gate{ 13860Sstevel@tonic-gate # Display retrieve error action menu 13870Sstevel@tonic-gate display_msg retrieve_error_action_menu 13880Sstevel@tonic-gate 13890Sstevel@tonic-gate # Get a Valid choice. 13900Sstevel@tonic-gate while : 13910Sstevel@tonic-gate do 13920Sstevel@tonic-gate # Display appropriate prompt and get answer. use_cached is default 13930Sstevel@tonic-gate get_ans " Choose one retrieval error action (h=help):" "1" 13940Sstevel@tonic-gate 13950Sstevel@tonic-gate # Determine choice. 13960Sstevel@tonic-gate _MENU_CHOICE=$ANS 13970Sstevel@tonic-gate case "$_MENU_CHOICE" in 13980Sstevel@tonic-gate 1) _RET_ERR_ACT="use_cached" 13990Sstevel@tonic-gate break ;; 14000Sstevel@tonic-gate 2) _RET_ERR_ACT="fail" 14010Sstevel@tonic-gate break ;; 14020Sstevel@tonic-gate h) display_msg nisLDAPretrieveErrorAction_help ;; 14030Sstevel@tonic-gate *) echo "Please enter 1, 2, or h=help." ;; 14040Sstevel@tonic-gate esac 14050Sstevel@tonic-gate done 14060Sstevel@tonic-gate} 14070Sstevel@tonic-gate 14080Sstevel@tonic-gate 14090Sstevel@tonic-gate# 14100Sstevel@tonic-gate# store_error_action_menu_handler(): Enter the store error action 14110Sstevel@tonic-gate# 14120Sstevel@tonic-gatestore_error_action_menu_handler() 14130Sstevel@tonic-gate{ 14140Sstevel@tonic-gate # Display store error action menu 14150Sstevel@tonic-gate display_msg store_error_action_menu 14160Sstevel@tonic-gate 14170Sstevel@tonic-gate # Get a Valid choice. 14180Sstevel@tonic-gate while : 14190Sstevel@tonic-gate do 14200Sstevel@tonic-gate # Display appropriate prompt and get answer. retry is default 14210Sstevel@tonic-gate get_ans " Choose one store error action (h=help):" "1" 14220Sstevel@tonic-gate 14230Sstevel@tonic-gate # Determine choice. 14240Sstevel@tonic-gate _MENU_CHOICE=$ANS 14250Sstevel@tonic-gate case "$_MENU_CHOICE" in 14260Sstevel@tonic-gate 1) _STOR_ERR_ACT="retry" 14270Sstevel@tonic-gate break ;; 14280Sstevel@tonic-gate 2) _STOR_ERR_ACT="fail" 14290Sstevel@tonic-gate break ;; 14300Sstevel@tonic-gate h) display_msg nisLDAPstoreErrorAction_help ;; 14310Sstevel@tonic-gate *) echo "Please enter 1, 2, or h=help." ;; 14320Sstevel@tonic-gate esac 14330Sstevel@tonic-gate done 14340Sstevel@tonic-gate} 14350Sstevel@tonic-gate 14360Sstevel@tonic-gate 14370Sstevel@tonic-gate# 14380Sstevel@tonic-gate# cleanup(): Remove the TMPDIR and all files in it. 14390Sstevel@tonic-gate# 14400Sstevel@tonic-gatecleanup() 14410Sstevel@tonic-gate{ 14420Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo "In cleanup()" 14430Sstevel@tonic-gate 14440Sstevel@tonic-gate# Leave the temp directory if debug is set 14450Sstevel@tonic-gate[ $DEBUG -eq 0 ] && rm -rf $TMPDIR 14460Sstevel@tonic-gate} 14470Sstevel@tonic-gate 14480Sstevel@tonic-gate 14490Sstevel@tonic-gate# Save existing config file if elected 14500Sstevel@tonic-gatecheck_back_config_file() 14510Sstevel@tonic-gate{ 14520Sstevel@tonic-gateif [ -f $CONFIG_FILE ]; then 14530Sstevel@tonic-gate display_msg backup_config_file 14540Sstevel@tonic-gate 14550Sstevel@tonic-gate get_confirm "Do you wish to continue (y/n/h)?" \ 14560Sstevel@tonic-gate "n" "backup_config_file_cont_help" 14570Sstevel@tonic-gate 14580Sstevel@tonic-gate if [ $? -eq 0 ]; then # if No, cleanup and exit. 14590Sstevel@tonic-gate cleanup ; exit 1 14600Sstevel@tonic-gate fi 14610Sstevel@tonic-gate 14620Sstevel@tonic-gate get_confirm "Do you wish to backup the config file "${CONFIG_FILE}" (y/n/h)?" \ 14630Sstevel@tonic-gate "y" "backup_config_file_help" 14640Sstevel@tonic-gate 14650Sstevel@tonic-gate if [ $? -eq 1 ]; then # Save the old config file with timestamp 14660Sstevel@tonic-gate 14670Sstevel@tonic-gate # SCCS converts '% H %' (without spaces) in current date during putback. 14680Sstevel@tonic-gate # So use some other combination. 14690Sstevel@tonic-gate SUFFIX=`date '+%d%h%Y.%H:%M:%S'` 14700Sstevel@tonic-gate 14710Sstevel@tonic-gate cp -p $CONFIG_FILE ${CONFIG_FILE}-${SUFFIX} 14720Sstevel@tonic-gate echo " Saved existing $CONFIG_FILE as ${CONFIG_FILE}-${SUFFIX}" 14730Sstevel@tonic-gate fi 14740Sstevel@tonic-gatefi 14750Sstevel@tonic-gate} 14760Sstevel@tonic-gate 14770Sstevel@tonic-gate 14780Sstevel@tonic-gate# Save existing mapping file if elected 14790Sstevel@tonic-gatecheck_back_mapping_file() 14800Sstevel@tonic-gate{ 14810Sstevel@tonic-gateif [ -f $MAP_FILE ]; then 14820Sstevel@tonic-gate display_msg backup_mapping_file 14830Sstevel@tonic-gate 14840Sstevel@tonic-gate get_confirm "Do you wish to continue (y/n/h)?" \ 14850Sstevel@tonic-gate "n" "backup_mapping_file_cont_help" 14860Sstevel@tonic-gate 14870Sstevel@tonic-gate if [ $? -eq 0 ]; then # if No, cleanup and exit. 14880Sstevel@tonic-gate cleanup ; exit 1 14890Sstevel@tonic-gate fi 14900Sstevel@tonic-gate 14910Sstevel@tonic-gate get_confirm "Do you wish to backup the map file "${MAP_FILE}" (y/n/h)?" \ 14920Sstevel@tonic-gate "y" "backup_mapping_file_help" 14930Sstevel@tonic-gate 14940Sstevel@tonic-gate if [ $? -eq 1 ]; then # if Yes, save the old map file with timestamp 14950Sstevel@tonic-gate 14960Sstevel@tonic-gate # SCCS converts '% H %' (without spaces) in current date during putback. 14970Sstevel@tonic-gate # So use some other combination. 14980Sstevel@tonic-gate SUFFIX=`date '+%d%h%Y.%H:%M:%S'` 14990Sstevel@tonic-gate 15000Sstevel@tonic-gate cp -p $MAP_FILE ${MAP_FILE}-${SUFFIX} 15010Sstevel@tonic-gate echo " Saved existing $MAP_FILE as ${MAP_FILE}-${SUFFIX}" 15020Sstevel@tonic-gate fi 15030Sstevel@tonic-gate 15040Sstevel@tonic-gateelse 15050Sstevel@tonic-gate if [ "$MAP_FILE" = "$DEFAULT_MAP_FILE" ]; then 15060Sstevel@tonic-gate display_msg warn_n2l_mode 15070Sstevel@tonic-gate 15080Sstevel@tonic-gate get_confirm "Do you wish to continue (y/n/h)?" \ 15090Sstevel@tonic-gate "n" "warn_n2l_mode_help" 15100Sstevel@tonic-gate 15110Sstevel@tonic-gate if [ $? -eq 0 ]; then 15120Sstevel@tonic-gate cleanup ; exit 1 15130Sstevel@tonic-gate fi 15140Sstevel@tonic-gate fi 15150Sstevel@tonic-gatefi 15160Sstevel@tonic-gate} 15170Sstevel@tonic-gate 15180Sstevel@tonic-gate 15190Sstevel@tonic-gateput_config_file_copyright_info() 15200Sstevel@tonic-gate{ 15210Sstevel@tonic-gate 1522*13083SBenjamin.Chang@Oracle.COM# Start with an empty file, so don't append, but overwrite here. 15230Sstevel@tonic-gate# Just change the name, but keep the same date and version number 15240Sstevel@tonic-gate# as in the ident string of this script. 15250Sstevel@tonic-gate 15260Sstevel@tonic-gategrep "ident \"@(#)$PROG" $ABS_PROG | \ 15270Sstevel@tonic-gate sed "s/${PROG}/${NEW_NAME}/g" > $CONFIG_FILE 15280Sstevel@tonic-gate 15290Sstevel@tonic-gateecho "\ 15300Sstevel@tonic-gate# 1531*13083SBenjamin.Chang@Oracle.COM# CDDL HEADER START 1532*13083SBenjamin.Chang@Oracle.COM# 1533*13083SBenjamin.Chang@Oracle.COM# The contents of this file are subject to the terms of the 1534*13083SBenjamin.Chang@Oracle.COM# Common Development and Distribution License (the "License"). 1535*13083SBenjamin.Chang@Oracle.COM# You may not use this file except in compliance with the License. 1536*13083SBenjamin.Chang@Oracle.COM# 1537*13083SBenjamin.Chang@Oracle.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 1538*13083SBenjamin.Chang@Oracle.COM# or http://www.opensolaris.org/os/licensing. 1539*13083SBenjamin.Chang@Oracle.COM# See the License for the specific language governing permissions 1540*13083SBenjamin.Chang@Oracle.COM# and limitations under the License. 1541*13083SBenjamin.Chang@Oracle.COM# 1542*13083SBenjamin.Chang@Oracle.COM# When distributing Covered Code, include this CDDL HEADER in each 1543*13083SBenjamin.Chang@Oracle.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1544*13083SBenjamin.Chang@Oracle.COM# If applicable, add the following below this CDDL HEADER, with the 1545*13083SBenjamin.Chang@Oracle.COM# fields enclosed by brackets "[]" replaced with your own identifying 1546*13083SBenjamin.Chang@Oracle.COM# information: Portions Copyright [yyyy] [name of copyright owner] 1547*13083SBenjamin.Chang@Oracle.COM# 1548*13083SBenjamin.Chang@Oracle.COM# CDDL HEADER END 1549*13083SBenjamin.Chang@Oracle.COM# 1550*13083SBenjamin.Chang@Oracle.COM# 1551*13083SBenjamin.Chang@Oracle.COM# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 15520Sstevel@tonic-gate#\ 15530Sstevel@tonic-gate" >> $MAP_FILE 15540Sstevel@tonic-gate} 15550Sstevel@tonic-gate 15560Sstevel@tonic-gate 15570Sstevel@tonic-gateget_nisLDAPconfigDN() 15580Sstevel@tonic-gate{ 15590Sstevel@tonic-gatewhile : 15600Sstevel@tonic-gatedo 15610Sstevel@tonic-gate 15620Sstevel@tonic-gateget_ans "DN for configuration information (h=help):" 15630Sstevel@tonic-gate 15640Sstevel@tonic-gate# If help continue, otherwise break. 15650Sstevel@tonic-gatecase "$ANS" in 15660Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPconfigDN_help ;; 15670Sstevel@tonic-gate * ) break ;; 15680Sstevel@tonic-gateesac 15690Sstevel@tonic-gatedone 15700Sstevel@tonic-gate 15710Sstevel@tonic-gatenisLDAPconfigDN="${ANS}" 15720Sstevel@tonic-gate 15730Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 15740Sstevel@tonic-gateif [ "$ANS" != "${DEF_nisLDAPconfigDN}" ]; then 15750Sstevel@tonic-gate echo "nisLDAPconfigDN=${ANS}" >> $CONFIG_FILE 15760Sstevel@tonic-gatefi 15770Sstevel@tonic-gate 15780Sstevel@tonic-gate# Ask remaining config server related questions only if this 15790Sstevel@tonic-gate# DN is set. So, if a value is specified, set a flag. 15800Sstevel@tonic-gate 15810Sstevel@tonic-gate[ "$ANS" != "" ] && configDN_flag=1 15820Sstevel@tonic-gate} 15830Sstevel@tonic-gate 15840Sstevel@tonic-gate 15850Sstevel@tonic-gateget_nisLDAPconfigPreferredServerList() 15860Sstevel@tonic-gate{ 15870Sstevel@tonic-gatewhile : 15880Sstevel@tonic-gatedo 15890Sstevel@tonic-gate 15900Sstevel@tonic-gateget_ans_req "Preferred server list for configuration information (h=help):" 15910Sstevel@tonic-gate 15920Sstevel@tonic-gate# If help continue, otherwise break. 15930Sstevel@tonic-gatecase "$ANS" in 15940Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPconfigPreferredServerList_help ;; 15950Sstevel@tonic-gate * ) break ;; 15960Sstevel@tonic-gateesac 15970Sstevel@tonic-gatedone 15980Sstevel@tonic-gate 15990Sstevel@tonic-gatenisLDAPconfigPreferredServerList=${ANS} 16000Sstevel@tonic-gateecho "nisLDAPconfigPreferredServerList=${ANS}" >> $CONFIG_FILE 16010Sstevel@tonic-gate} 16020Sstevel@tonic-gate 16030Sstevel@tonic-gate 16040Sstevel@tonic-gateget_nisLDAPconfigAuthenticationMethod() 16050Sstevel@tonic-gate{ 16060Sstevel@tonic-gate_AUTHMETHOD="" 16070Sstevel@tonic-gate 16080Sstevel@tonic-gateecho "Select the Authentication Method for configuration server :" 16090Sstevel@tonic-gateconfig_auth_menu_handler 16100Sstevel@tonic-gate 16110Sstevel@tonic-gatenisLDAPconfigAuthenticationMethod=${_AUTHMETHOD} 16120Sstevel@tonic-gateecho "nisLDAPconfigAuthenticationMethod=${_AUTHMETHOD}" >> $CONFIG_FILE 16130Sstevel@tonic-gate} 16140Sstevel@tonic-gate 16150Sstevel@tonic-gate 16160Sstevel@tonic-gateget_nisLDAPconfigTLS() 16170Sstevel@tonic-gate{ 16180Sstevel@tonic-gate_TLSMETHOD="" 16190Sstevel@tonic-gate 16200Sstevel@tonic-gateecho "Select the Transport Layer Security (TLS) for configuration server :" 16210Sstevel@tonic-gatetls_menu_handler 16220Sstevel@tonic-gate 16230Sstevel@tonic-gatenisLDAPconfigTLS=${_TLSMETHOD} 16240Sstevel@tonic-gate 16250Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 16260Sstevel@tonic-gateif [ "${_TLSMETHOD}" != "${DEF_TLS}" ]; then 16270Sstevel@tonic-gate echo "nisLDAPconfigTLS=${_TLSMETHOD}" >> $CONFIG_FILE 16280Sstevel@tonic-gatefi 16290Sstevel@tonic-gate} 16300Sstevel@tonic-gate 16310Sstevel@tonic-gate 16320Sstevel@tonic-gateget_nisLDAPconfigTLSCertificateDBPath() 16330Sstevel@tonic-gate{ 16340Sstevel@tonic-gatewhile : 16350Sstevel@tonic-gatedo 16360Sstevel@tonic-gate 163711989SMilan.Jurik@Sun.COMget_ans "Path with TLS Certificate DB for configuration server (h=help):"\ 16380Sstevel@tonic-gate "${DEF_TLSCertificateDBPath}" 16390Sstevel@tonic-gate 16400Sstevel@tonic-gate# If help continue, otherwise break. 16410Sstevel@tonic-gatecase "$ANS" in 16420Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg TLSCertificateDBPath_help ;; 16430Sstevel@tonic-gate * ) break ;; 16440Sstevel@tonic-gateesac 16450Sstevel@tonic-gatedone 16460Sstevel@tonic-gate 16470Sstevel@tonic-gatenisLDAPconfigTLSCertificateDBPath=${ANS} 16480Sstevel@tonic-gate 16490Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 16500Sstevel@tonic-gateif [ "$ANS" != "${DEF_TLSCertificateDBPath}" ]; then 16510Sstevel@tonic-gate echo "nisLDAPconfigTLSCertificateDBPath=${ANS}" >> $CONFIG_FILE 16520Sstevel@tonic-gatefi 16530Sstevel@tonic-gate} 16540Sstevel@tonic-gate 16550Sstevel@tonic-gate 16560Sstevel@tonic-gateget_nisLDAPconfigProxyUser() 16570Sstevel@tonic-gate{ 16580Sstevel@tonic-gatewhile : 16590Sstevel@tonic-gatedo 16600Sstevel@tonic-gate 16610Sstevel@tonic-gateget_ans_req "Proxy user bind DN to obtain configuration information (h=help):" 16620Sstevel@tonic-gate# If help continue, otherwise break. 16630Sstevel@tonic-gatecase "$ANS" in 16640Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPconfigProxyUser_help ;; 16650Sstevel@tonic-gate * ) break ;; 16660Sstevel@tonic-gateesac 16670Sstevel@tonic-gatedone 16680Sstevel@tonic-gate 16690Sstevel@tonic-gatenisLDAPconfigProxyUser=${ANS} 16700Sstevel@tonic-gateecho "nisLDAPconfigProxyUser=${ANS}" >> $CONFIG_FILE 16710Sstevel@tonic-gate} 16720Sstevel@tonic-gate 16730Sstevel@tonic-gate 16740Sstevel@tonic-gateget_nisLDAPconfigProxyPassword() 16750Sstevel@tonic-gate{ 16760Sstevel@tonic-gateget_passwd "Proxy user password to obtain configuration information :" 16770Sstevel@tonic-gatenisLDAPconfigProxyPassword=${ANS} 16780Sstevel@tonic-gate 16790Sstevel@tonic-gateecho "nisLDAPconfigProxyPassword=${ANS}" >> $CONFIG_FILE 16800Sstevel@tonic-gate 16810Sstevel@tonic-gatedisplay_msg ProxyPassword_warn 16820Sstevel@tonic-gate} 16830Sstevel@tonic-gate 16840Sstevel@tonic-gate 16850Sstevel@tonic-gateget_preferredServerList() 16860Sstevel@tonic-gate{ 16870Sstevel@tonic-gatewhile : 16880Sstevel@tonic-gatedo 16890Sstevel@tonic-gate 16900Sstevel@tonic-gateget_ans_req "Preferred server list for mapping data to/from LDAP (h=help):" 16910Sstevel@tonic-gate 16920Sstevel@tonic-gate# If help continue, otherwise break. 16930Sstevel@tonic-gatecase "$ANS" in 16940Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg preferredServerList_help ;; 16950Sstevel@tonic-gate * ) break ;; 16960Sstevel@tonic-gateesac 16970Sstevel@tonic-gatedone 16980Sstevel@tonic-gate 16990Sstevel@tonic-gatepreferredServerList=${ANS} 17000Sstevel@tonic-gateecho "preferredServerList=${ANS}" >> $CONFIG_FILE 17010Sstevel@tonic-gate} 17020Sstevel@tonic-gate 17030Sstevel@tonic-gate 17040Sstevel@tonic-gateget_authenticationMethod() 17050Sstevel@tonic-gate{ 17060Sstevel@tonic-gate_AUTHMETHOD="" 17070Sstevel@tonic-gate 17080Sstevel@tonic-gateecho "Select the Authentication Method for mapping data to/from LDAP :" 17090Sstevel@tonic-gateauth_menu_handler 17100Sstevel@tonic-gate 17110Sstevel@tonic-gateauthenticationMethod=${_AUTHMETHOD} 17120Sstevel@tonic-gateecho "authenticationMethod=${_AUTHMETHOD}" >> $CONFIG_FILE 17130Sstevel@tonic-gate} 17140Sstevel@tonic-gate 17150Sstevel@tonic-gate 17160Sstevel@tonic-gateget_nisLDAPTLS() 17170Sstevel@tonic-gate{ 17180Sstevel@tonic-gate_TLSMETHOD="" 17190Sstevel@tonic-gate 17200Sstevel@tonic-gateecho "Select the Transport Layer Security (TLS) for mapping data to/from LDAP :" 17210Sstevel@tonic-gatetls_menu_handler 17220Sstevel@tonic-gate 17230Sstevel@tonic-gatenisLDAPTLS=${_TLSMETHOD} 17240Sstevel@tonic-gate 17250Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 17260Sstevel@tonic-gateif [ "${_TLSMETHOD}" != "${DEF_TLS}" ]; then 17270Sstevel@tonic-gate echo "nisLDAPTLS=${_TLSMETHOD}" >> $CONFIG_FILE 17280Sstevel@tonic-gatefi 17290Sstevel@tonic-gate} 17300Sstevel@tonic-gate 17310Sstevel@tonic-gate 17320Sstevel@tonic-gateget_nisLDAPTLSCertificateDBPath() 17330Sstevel@tonic-gate{ 17340Sstevel@tonic-gatewhile : 17350Sstevel@tonic-gatedo 17360Sstevel@tonic-gate 173711989SMilan.Jurik@Sun.COMget_ans "Path with TLS Certificate DB for LDAP data server (h=help):"\ 17380Sstevel@tonic-gate "${DEF_nisLDAPTLSCertificateDBPath}" 17390Sstevel@tonic-gate 17400Sstevel@tonic-gate# If help continue, otherwise break. 17410Sstevel@tonic-gatecase "$ANS" in 17420Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg TLSCertificateDBPath_help ;; 17430Sstevel@tonic-gate * ) break ;; 17440Sstevel@tonic-gateesac 17450Sstevel@tonic-gatedone 17460Sstevel@tonic-gate 17470Sstevel@tonic-gatenisLDAPTLSCertificateDBPath=${ANS} 17480Sstevel@tonic-gate 17490Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 17500Sstevel@tonic-gateif [ "$ANS" != "${DEF_TLSCertificateDBPath}" ]; then 17510Sstevel@tonic-gate echo "nisLDAPTLSCertificateDBPath=${ANS}" >> $CONFIG_FILE 17520Sstevel@tonic-gatefi 17530Sstevel@tonic-gate} 17540Sstevel@tonic-gate 17550Sstevel@tonic-gate 17560Sstevel@tonic-gateget_nisLDAPproxyUser() 17570Sstevel@tonic-gate{ 17580Sstevel@tonic-gatewhile : 17590Sstevel@tonic-gatedo 17600Sstevel@tonic-gate 17610Sstevel@tonic-gateget_ans_req "Proxy user bind DN to read/write data from/to LDAP (h=help):" 17620Sstevel@tonic-gate 17630Sstevel@tonic-gate# If help continue, otherwise break. 17640Sstevel@tonic-gatecase "$ANS" in 17650Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPproxyUser_help ;; 17660Sstevel@tonic-gate * ) break ;; 17670Sstevel@tonic-gateesac 17680Sstevel@tonic-gatedone 17690Sstevel@tonic-gate 17700Sstevel@tonic-gatenisLDAPproxyUser=${ANS} 17710Sstevel@tonic-gateecho "nisLDAPproxyUser=${ANS}" >> $CONFIG_FILE 17720Sstevel@tonic-gate} 17730Sstevel@tonic-gate 17740Sstevel@tonic-gate 17750Sstevel@tonic-gateget_nisLDAPproxyPassword() 17760Sstevel@tonic-gate{ 17770Sstevel@tonic-gateget_passwd "Proxy user password to read/write data from/to LDAP :" 17780Sstevel@tonic-gatenisLDAPproxyPassword=${ANS} 17790Sstevel@tonic-gate 17800Sstevel@tonic-gateecho "nisLDAPproxyPassword=${ANS}" >> $CONFIG_FILE 17810Sstevel@tonic-gate 17820Sstevel@tonic-gatedisplay_msg ProxyPassword_warn 17830Sstevel@tonic-gate} 17840Sstevel@tonic-gate 17850Sstevel@tonic-gate 17860Sstevel@tonic-gateget_nisLDAPbindTimeout() 17870Sstevel@tonic-gate{ 17880Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP bind operation (h=help):" \ 17890Sstevel@tonic-gate "${DEF_nisLDAPbindTimeout}" "nisLDAPbindTimeout_help" 17900Sstevel@tonic-gate 17910Sstevel@tonic-gatenisLDAPbindTimeout=${NUM} 17920Sstevel@tonic-gate 17930Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 17940Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPbindTimeout} ]; then 17950Sstevel@tonic-gate echo "nisLDAPbindTimeout=${NUM}" >> $CONFIG_FILE 17960Sstevel@tonic-gatefi 17970Sstevel@tonic-gate} 17980Sstevel@tonic-gate 17990Sstevel@tonic-gate 18000Sstevel@tonic-gateget_nisLDAPsearchTimeout() 18010Sstevel@tonic-gate{ 18020Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP search operation (h=help):" \ 18030Sstevel@tonic-gate "${DEF_nisLDAPsearchTimeout}" "nisLDAPsearchTimeout_help" 18040Sstevel@tonic-gate 18050Sstevel@tonic-gatenisLDAPsearchTimeout=${NUM} 18060Sstevel@tonic-gate 18070Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18080Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPsearchTimeout} ]; then 18090Sstevel@tonic-gate echo "nisLDAPsearchTimeout=${NUM}" >> $CONFIG_FILE 18100Sstevel@tonic-gatefi 18110Sstevel@tonic-gate} 18120Sstevel@tonic-gate 18130Sstevel@tonic-gate 18140Sstevel@tonic-gateget_nisLDAPmodifyTimeout() 18150Sstevel@tonic-gate{ 18160Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP modify operation (h=help):" \ 18170Sstevel@tonic-gate "${DEF_nisLDAPmodifyTimeout}" "nisLDAPmodifyTimeout_help" 18180Sstevel@tonic-gate 18190Sstevel@tonic-gatenisLDAPmodifyTimeout=${NUM} 18200Sstevel@tonic-gate 18210Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18220Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPmodifyTimeout} ]; then 18230Sstevel@tonic-gate echo "nisLDAPmodifyTimeout=${NUM}" >> $CONFIG_FILE 18240Sstevel@tonic-gatefi 18250Sstevel@tonic-gate} 18260Sstevel@tonic-gate 18270Sstevel@tonic-gate 18280Sstevel@tonic-gateget_nisLDAPaddTimeout() 18290Sstevel@tonic-gate{ 18300Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP add operation (h=help):" \ 18310Sstevel@tonic-gate "${DEF_nisLDAPaddTimeout}" "nisLDAPaddTimeout_help" 18320Sstevel@tonic-gate 18330Sstevel@tonic-gatenisLDAPaddTimeout=${NUM} 18340Sstevel@tonic-gate 18350Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18360Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPaddTimeout} ]; then 18370Sstevel@tonic-gate echo "nisLDAPaddTimeout=${NUM}" >> $CONFIG_FILE 18380Sstevel@tonic-gatefi 18390Sstevel@tonic-gate} 18400Sstevel@tonic-gate 18410Sstevel@tonic-gate 18420Sstevel@tonic-gateget_nisLDAPdeleteTimeout() 18430Sstevel@tonic-gate{ 18440Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP delete operation (h=help):" \ 18450Sstevel@tonic-gate "${DEF_nisLDAPdeleteTimeout}" "nisLDAPdeleteTimeout_help" 18460Sstevel@tonic-gate 18470Sstevel@tonic-gatenisLDAPdeleteTimeout=${NUM} 18480Sstevel@tonic-gate 18490Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18500Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPdeleteTimeout} ]; then 18510Sstevel@tonic-gate echo "nisLDAPdeleteTimeout=${NUM}" >> $CONFIG_FILE 18520Sstevel@tonic-gatefi 18530Sstevel@tonic-gate} 18540Sstevel@tonic-gate 18550Sstevel@tonic-gate 18560Sstevel@tonic-gateget_nisLDAPsearchTimeLimit() 18570Sstevel@tonic-gate{ 18580Sstevel@tonic-gateget_pos_int "Time limit (in seconds) for search operation on LDAP server (h=help):" \ 18590Sstevel@tonic-gate "${DEF_nisLDAPsearchTimeLimit}" "nisLDAPsearchTimeLimit_help" 18600Sstevel@tonic-gate 18610Sstevel@tonic-gatenisLDAPsearchTimeLimit=${NUM} 18620Sstevel@tonic-gate 18630Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18640Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPsearchTimeLimit} ]; then 18650Sstevel@tonic-gate echo "nisLDAPsearchTimeLimit=${NUM}" >> $CONFIG_FILE 18660Sstevel@tonic-gatefi 18670Sstevel@tonic-gate} 18680Sstevel@tonic-gate 18690Sstevel@tonic-gate 18700Sstevel@tonic-gateget_nisLDAPsearchSizeLimit() 18710Sstevel@tonic-gate{ 18720Sstevel@tonic-gateget_pos_int "Size limit (in bytes) for search operation on LDAP server (h=help):" \ 18730Sstevel@tonic-gate "${DEF_nisLDAPsearchSizeLimit}" "nisLDAPsearchSizeLimit_help" 18740Sstevel@tonic-gate 18750Sstevel@tonic-gatenisLDAPsearchSizeLimit=${NUM} 18760Sstevel@tonic-gate 18770Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18780Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPsearchSizeLimit} ]; then 18790Sstevel@tonic-gate echo "nisLDAPsearchSizeLimit=${NUM}" >> $CONFIG_FILE 18800Sstevel@tonic-gatefi 18810Sstevel@tonic-gate} 18820Sstevel@tonic-gate 18830Sstevel@tonic-gate 18840Sstevel@tonic-gateget_nisLDAPfollowReferral() 18850Sstevel@tonic-gate{ 18860Sstevel@tonic-gateget_confirm "Should the ypserv follow LDAP referrals (y/n/h):" \ 18870Sstevel@tonic-gate "n" "nisLDAPfollowReferral_help" 18880Sstevel@tonic-gate 18890Sstevel@tonic-gateif [ $? -eq 1 ]; then 18900Sstevel@tonic-gate _ANS="yes" 18910Sstevel@tonic-gateelse 18920Sstevel@tonic-gate _ANS="no" 18930Sstevel@tonic-gatefi 18940Sstevel@tonic-gate 18950Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18960Sstevel@tonic-gateif [ "${_ANS}" != "${DEF_nisLDAPfollowReferral}" ]; then 18970Sstevel@tonic-gate echo "nisLDAPfollowReferral=${_ANS}" >> $CONFIG_FILE 18980Sstevel@tonic-gatefi 18990Sstevel@tonic-gate} 19000Sstevel@tonic-gate 19010Sstevel@tonic-gate 19020Sstevel@tonic-gateget_nisLDAPretrieveErrorAction() 19030Sstevel@tonic-gate{ 19040Sstevel@tonic-gate_RET_ERR_ACT="" 19050Sstevel@tonic-gate 19060Sstevel@tonic-gateecho "Select the action to be taken in case of LDAP retrieval error :" 19070Sstevel@tonic-gateretrieve_error_action_menu_handler 19080Sstevel@tonic-gate 19090Sstevel@tonic-gatenisLDAPretrieveErrorAction=${_RET_ERR_ACT} 19100Sstevel@tonic-gate 19110Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 19120Sstevel@tonic-gateif [ "${_RET_ERR_ACT}" != "${DEF_nisLDAPretrieveErrorAction}" ]; then 19130Sstevel@tonic-gate echo "nisLDAPretrieveErrorAction=${_RET_ERR_ACT}" >> $CONFIG_FILE 19140Sstevel@tonic-gatefi 19150Sstevel@tonic-gate} 19160Sstevel@tonic-gate 19170Sstevel@tonic-gate 19180Sstevel@tonic-gateget_nisLDAPretrieveErrorAttempts() 19190Sstevel@tonic-gate{ 19200Sstevel@tonic-gate 19210Sstevel@tonic-gateget_pos_int "Number of attempts in case of LDAP retrieval error (h=help):" \ 19220Sstevel@tonic-gate "$SUG_nisLDAPretrieveErrorAttempts" \ 19230Sstevel@tonic-gate "nisLDAPretrieveErrorAttempts_help" 19240Sstevel@tonic-gate 19250Sstevel@tonic-gatenisLDAPretrieveErrorAttempts=${NUM} 19260Sstevel@tonic-gate 19270Sstevel@tonic-gateecho "nisLDAPretrieveErrorAttempts=${NUM}" >> $CONFIG_FILE 19280Sstevel@tonic-gate} 19290Sstevel@tonic-gate 19300Sstevel@tonic-gate 19310Sstevel@tonic-gateget_nisLDAPretrieveErrorTimeout() 19320Sstevel@tonic-gate{ 19330Sstevel@tonic-gate# if nisLDAPretrieveErrorAttempts=0, then no point in asking 19340Sstevel@tonic-gate# for timeout vales as it is ignored anyway. 19350Sstevel@tonic-gate 19360Sstevel@tonic-gate[ $nisLDAPretrieveErrorAttempts -eq 0 ] && return 0 19370Sstevel@tonic-gate 19380Sstevel@tonic-gateget_pos_int "Timeout (in seconds) between each new attempt to retrieve LDAP data (h=help):"\ 19390Sstevel@tonic-gate "${DEF_nisLDAPretrieveErrorTimeout}" \ 19400Sstevel@tonic-gate "nisLDAPretrieveErrorTimeout_help" 19410Sstevel@tonic-gate 19420Sstevel@tonic-gatenisLDAPretrieveErrorTimeout=${NUM} 19430Sstevel@tonic-gate 19440Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 19450Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPretrieveErrorTimeout} ]; then 19460Sstevel@tonic-gate echo "nisLDAPretrieveErrorTimeout=${NUM}" >> $CONFIG_FILE 19470Sstevel@tonic-gatefi 19480Sstevel@tonic-gate} 19490Sstevel@tonic-gate 19500Sstevel@tonic-gate 19510Sstevel@tonic-gateget_nisLDAPstoreErrorAction() 19520Sstevel@tonic-gate{ 19530Sstevel@tonic-gate_STOR_ERR_ACT="" 19540Sstevel@tonic-gate 19550Sstevel@tonic-gateecho "Select the action to be taken in case of LDAP store error :" 19560Sstevel@tonic-gatestore_error_action_menu_handler 19570Sstevel@tonic-gate 19580Sstevel@tonic-gatenisLDAPstoreErrorAction=${_STOR_ERR_ACT} 19590Sstevel@tonic-gate 19600Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 19610Sstevel@tonic-gateif [ "${_STOR_ERR_ACT}" != "${DEF_nisLDAPstoreErrorAction}" ]; then 19620Sstevel@tonic-gate echo "nisLDAPstoreErrorAction=${_STOR_ERR_ACT}" >> $CONFIG_FILE 19630Sstevel@tonic-gatefi 19640Sstevel@tonic-gate} 19650Sstevel@tonic-gate 19660Sstevel@tonic-gate 19670Sstevel@tonic-gateget_nisLDAPstoreErrorAttempts() 19680Sstevel@tonic-gate{ 19690Sstevel@tonic-gate 19700Sstevel@tonic-gate# if nisLDAPstoreErrorAction="fail", then no point in asking 19710Sstevel@tonic-gate# for no. of attempts or timeout vales as they are ignored. 19720Sstevel@tonic-gate 19730Sstevel@tonic-gate[ "$nisLDAPstoreErrorAction" = "fail" ] && return 0 19740Sstevel@tonic-gate 19750Sstevel@tonic-gateget_pos_int "Number of attempts in case of LDAP store error (h=help):" \ 19760Sstevel@tonic-gate "$SUG_nisLDAPstoreErrorAttempts" \ 19770Sstevel@tonic-gate "nisLDAPstoreErrorAttempts_help" 19780Sstevel@tonic-gate 19790Sstevel@tonic-gatenisLDAPstoreErrorAttempts=${NUM} 19800Sstevel@tonic-gate 19810Sstevel@tonic-gateecho "nisLDAPstoreErrorAttempts=${NUM}" >> $CONFIG_FILE 19820Sstevel@tonic-gate} 19830Sstevel@tonic-gate 19840Sstevel@tonic-gate 19850Sstevel@tonic-gateget_nisLDAPstoreErrorTimeout() 19860Sstevel@tonic-gate{ 19870Sstevel@tonic-gate 19880Sstevel@tonic-gate# if nisLDAPstoreErrorAction="fail", then no point in asking 19890Sstevel@tonic-gate# for no. of attempts or timeout vales as they are ignored. 19900Sstevel@tonic-gate 19910Sstevel@tonic-gate[ "$nisLDAPstoreErrorAction" = "fail" ] && return 0 19920Sstevel@tonic-gate 19930Sstevel@tonic-gate# Similarly, if nisLDAPstoreErrorAttempts=0, ignore this question. 19940Sstevel@tonic-gate 19950Sstevel@tonic-gate[ $nisLDAPstoreErrorAttempts -eq 0 ] && return 0 19960Sstevel@tonic-gate 19970Sstevel@tonic-gateget_pos_int "Timeout (in seconds) between each new attempt to write LDAP data (h=help):"\ 19980Sstevel@tonic-gate "${DEF_nisLDAPstoreErrorTimeout}" \ 19990Sstevel@tonic-gate "nisLDAPstoreErrorTimeout_help" 20000Sstevel@tonic-gate 20010Sstevel@tonic-gatenisLDAPstoreErrorTimeout=${NUM} 20020Sstevel@tonic-gate 20030Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 20040Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPstoreErrorTimeout} ]; then 20050Sstevel@tonic-gate echo "nisLDAPstoreErrorTimeout=${NUM}" >> $CONFIG_FILE 20060Sstevel@tonic-gatefi 20070Sstevel@tonic-gate} 20080Sstevel@tonic-gate 20090Sstevel@tonic-gate 20100Sstevel@tonic-gate 20110Sstevel@tonic-gatecreate_config_file() 20120Sstevel@tonic-gate{ 20130Sstevel@tonic-gate 20140Sstevel@tonic-gate# To prevent from leaving a partial config file in case some error or 20150Sstevel@tonic-gate# signal takes place, store the output being generated in a temporary 20160Sstevel@tonic-gate# file first, and move it at the final destination only at the end if 20170Sstevel@tonic-gate# everything goes fine. 20180Sstevel@tonic-gate 20190Sstevel@tonic-gate_CONFIG_FILE=$CONFIG_FILE 20200Sstevel@tonic-gateCONFIG_FILE=${TMPDIR}/${TMPCONF}.$$ 20210Sstevel@tonic-gate 20220Sstevel@tonic-gateecho "Generating config file temporarily as \"${CONFIG_FILE}\"" 20230Sstevel@tonic-gate 20240Sstevel@tonic-gate# Truncate the file before we append anything. 20250Sstevel@tonic-gate# Place copyright information 20260Sstevel@tonic-gateput_config_file_copyright_info 20270Sstevel@tonic-gate 20280Sstevel@tonic-gate# Filter out all the YP domains in /var/yp 20290Sstevel@tonic-gate# The list of domains is stored in list "VARYP_DMN_LIST" 20300Sstevel@tonic-gate 20310Sstevel@tonic-gateecho "\ 20320Sstevel@tonic-gate# 20330Sstevel@tonic-gate# Configuration file for ypserv(1M); see ypserv(4) for more information, 20340Sstevel@tonic-gate# and NISLDAPmapping(4) for configuration of NIS to LDAP mapping. 20350Sstevel@tonic-gate 20360Sstevel@tonic-gate# Unless otherwise noted, commented lines show default values. 20370Sstevel@tonic-gate" >> $CONFIG_FILE 20380Sstevel@tonic-gate 20390Sstevel@tonic-gateecho "\ 20400Sstevel@tonic-gate# Where to look for configuration information in LDAP. Leave empty or 20410Sstevel@tonic-gate# undefined to use this file, in which case the values of the other 20420Sstevel@tonic-gate# 'nisLdapConfig*' attributes are ignored. 20430Sstevel@tonic-gate# 20440Sstevel@tonic-gate#nisLDAPconfigDN=\ 20450Sstevel@tonic-gate" >> $CONFIG_FILE 20460Sstevel@tonic-gate 20470Sstevel@tonic-gateget_nisLDAPconfigDN 20480Sstevel@tonic-gate 20490Sstevel@tonic-gateecho " 20500Sstevel@tonic-gate 20510Sstevel@tonic-gate# Server(s) for configuration information. There is no default; 20520Sstevel@tonic-gate# use the value on the line below for an LDAP server running on 20530Sstevel@tonic-gate# this machine, at port 389. 20540Sstevel@tonic-gate#nisLDAPconfigPreferredServerList=127.0.0.1:389\ 20550Sstevel@tonic-gate" >> $CONFIG_FILE 20560Sstevel@tonic-gate 20570Sstevel@tonic-gate[ $configDN_flag -eq 1 ] && get_nisLDAPconfigPreferredServerList 20580Sstevel@tonic-gate 20590Sstevel@tonic-gateecho " 20600Sstevel@tonic-gate 20610Sstevel@tonic-gate# Authentication method(s) to obtain configuration information. 20620Sstevel@tonic-gate#\ 20630Sstevel@tonic-gate" >> $CONFIG_FILE 20640Sstevel@tonic-gate 20650Sstevel@tonic-gate[ $configDN_flag -eq 1 ] && get_nisLDAPconfigAuthenticationMethod 20660Sstevel@tonic-gate 20670Sstevel@tonic-gateecho " 20680Sstevel@tonic-gate 20690Sstevel@tonic-gate# Transport layer security for configuration information 20700Sstevel@tonic-gate# 20710Sstevel@tonic-gate#nisLDAPconfigTLS=${DEF_TLS}\ 20720Sstevel@tonic-gate" >> $CONFIG_FILE 20730Sstevel@tonic-gate 20740Sstevel@tonic-gate[ $configDN_flag -eq 1 ] && get_nisLDAPconfigTLS 20750Sstevel@tonic-gate 20760Sstevel@tonic-gateecho " 20770Sstevel@tonic-gate 20780Sstevel@tonic-gate# Certificate DB for transport layer security 20790Sstevel@tonic-gate# 20800Sstevel@tonic-gate#nisLDAPconfigTLSCertificateDBPath=${DEF_TLSCertificateDBPath}\ 20810Sstevel@tonic-gate" >> $CONFIG_FILE 20820Sstevel@tonic-gate 20830Sstevel@tonic-gate# ask for Certificate DB only if SSL is set 20840Sstevel@tonic-gateif [ "${nisLDAPconfigTLS}" = "ssl" ]; then 20850Sstevel@tonic-gate [ $configDN_flag -eq 1 ] && get_nisLDAPconfigTLSCertificateDBPath 20860Sstevel@tonic-gatefi 20870Sstevel@tonic-gate 20880Sstevel@tonic-gateecho " 20890Sstevel@tonic-gate 20900Sstevel@tonic-gate# Proxy user(s) to obtain configuration information. The line below 20910Sstevel@tonic-gate# is an example of the format. 20920Sstevel@tonic-gate# 20930Sstevel@tonic-gate#nisLDAPconfigProxyUser=cn=nisAdmin,ou=People,\ 20940Sstevel@tonic-gate" >> $CONFIG_FILE 20950Sstevel@tonic-gate 20960Sstevel@tonic-gate# Ask proxy user bind DN only if needed. 20970Sstevel@tonic-gateif [ "${nisLDAPconfigAuthenticationMethod}" != "none" ]; then 20980Sstevel@tonic-gate [ $configDN_flag -eq 1 ] && get_nisLDAPconfigProxyUser 20990Sstevel@tonic-gatefi 21000Sstevel@tonic-gate 21010Sstevel@tonic-gateecho " 21020Sstevel@tonic-gate 21030Sstevel@tonic-gate# Password for proxy user. Must be supplied if the authentication method 21040Sstevel@tonic-gate# requires a password. If a password appears in this file, it should be 21050Sstevel@tonic-gate# protected appropriately against access by unauthorized users. 21060Sstevel@tonic-gate# 21070Sstevel@tonic-gate#nisLDAPconfigProxyPassword=\ 21080Sstevel@tonic-gate" >> $CONFIG_FILE 21090Sstevel@tonic-gate 21100Sstevel@tonic-gateif [ "${nisLDAPconfigAuthenticationMethod}" != "none" ]; then 21110Sstevel@tonic-gate [ $configDN_flag -eq 1 ] && get_nisLDAPconfigProxyPassword 21120Sstevel@tonic-gatefi 21130Sstevel@tonic-gate 21140Sstevel@tonic-gateecho " 21150Sstevel@tonic-gate 21160Sstevel@tonic-gate# Server list for mapping data to/from LDAP. There is no default; 21170Sstevel@tonic-gate# use the value on the line below for an LDAP server running on 21180Sstevel@tonic-gate# this machine, at port 389. 21190Sstevel@tonic-gate#preferredServerList=127.0.0.1:389\ 21200Sstevel@tonic-gate" >> $CONFIG_FILE 21210Sstevel@tonic-gate 21220Sstevel@tonic-gateget_preferredServerList 21230Sstevel@tonic-gate 21240Sstevel@tonic-gateecho " 21250Sstevel@tonic-gate 21260Sstevel@tonic-gate# Authentication method for mapping data to/from LDAP 21270Sstevel@tonic-gate#\ 21280Sstevel@tonic-gate" >> $CONFIG_FILE 21290Sstevel@tonic-gate 21300Sstevel@tonic-gateget_authenticationMethod 21310Sstevel@tonic-gate 21320Sstevel@tonic-gateecho " 21330Sstevel@tonic-gate 21340Sstevel@tonic-gate# Transport layer security for mapping data to/from LDAP. 21350Sstevel@tonic-gate# 21360Sstevel@tonic-gate#nisLDAPTLS=${DEF_TLS}\ 21370Sstevel@tonic-gate" >> $CONFIG_FILE 21380Sstevel@tonic-gate 21390Sstevel@tonic-gateget_nisLDAPTLS 21400Sstevel@tonic-gate 21410Sstevel@tonic-gateecho " 21420Sstevel@tonic-gate 21430Sstevel@tonic-gate# Certificate DB for transport layer security 21440Sstevel@tonic-gate# 21450Sstevel@tonic-gate#nisLDAPTLSCertificateDBPath=${DEF_TLSCertificateDBPath}\ 21460Sstevel@tonic-gate" >> $CONFIG_FILE 21470Sstevel@tonic-gate 21480Sstevel@tonic-gate# ask for Certificate DB only if SSL is set 21490Sstevel@tonic-gateif [ "${nisLDAPTLS}" = "ssl" ]; then 21500Sstevel@tonic-gate get_nisLDAPTLSCertificateDBPath 21510Sstevel@tonic-gatefi 21520Sstevel@tonic-gate 21530Sstevel@tonic-gateecho " 21540Sstevel@tonic-gate 21550Sstevel@tonic-gate# Proxy user for ypserv. Assumed to have appropriate permission to read 21560Sstevel@tonic-gate# and/or create or modify LDAP data. The line below is an example of the 21570Sstevel@tonic-gate# format. 21580Sstevel@tonic-gate# 21590Sstevel@tonic-gate#nisLDAPproxyUser=cn=nisAdmin,ou=People,\ 21600Sstevel@tonic-gate" >> $CONFIG_FILE 21610Sstevel@tonic-gate 21620Sstevel@tonic-gate# Ask proxy user bind DN only if needed. 21630Sstevel@tonic-gateif [ "${authenticationMethod}" != "none" ]; then 21640Sstevel@tonic-gate get_nisLDAPproxyUser 21650Sstevel@tonic-gatefi 21660Sstevel@tonic-gate 21670Sstevel@tonic-gateecho " 21680Sstevel@tonic-gate 21690Sstevel@tonic-gate# Password for proxy user. Must be supplied if the authentication method 21700Sstevel@tonic-gate# requires a password. If a password appears in this file, it should be 21710Sstevel@tonic-gate# protected appropriately against unauthorized access. 21720Sstevel@tonic-gate# 21730Sstevel@tonic-gate#nisLDAPproxyPassword=\ 21740Sstevel@tonic-gate" >> $CONFIG_FILE 21750Sstevel@tonic-gate 21760Sstevel@tonic-gateif [ "${authenticationMethod}" != "none" ]; then 21770Sstevel@tonic-gate get_nisLDAPproxyPassword 21780Sstevel@tonic-gatefi 21790Sstevel@tonic-gate 21800Sstevel@tonic-gateecho " 21810Sstevel@tonic-gate 21820Sstevel@tonic-gate# Timeouts and time/size limits for LDAP operations. 21830Sstevel@tonic-gate# 21840Sstevel@tonic-gate#nisLDAPbindTimeout=${DEF_nisLDAPbindTimeout}\ 21850Sstevel@tonic-gate" >> $CONFIG_FILE 21860Sstevel@tonic-gate 21870Sstevel@tonic-gateget_nisLDAPbindTimeout 21880Sstevel@tonic-gate 21890Sstevel@tonic-gateecho " 21900Sstevel@tonic-gate#nisLDAPsearchTimeout=${DEF_nisLDAPsearchTimeout}\ 21910Sstevel@tonic-gate" >> $CONFIG_FILE 21920Sstevel@tonic-gate 21930Sstevel@tonic-gateget_nisLDAPsearchTimeout 21940Sstevel@tonic-gate 21950Sstevel@tonic-gateecho " 21960Sstevel@tonic-gate#nisLDAPmodifyTimeout=${DEF_nisLDAPmodifyTimeout}\ 21970Sstevel@tonic-gate" >> $CONFIG_FILE 21980Sstevel@tonic-gate 21990Sstevel@tonic-gateget_nisLDAPmodifyTimeout 22000Sstevel@tonic-gate 22010Sstevel@tonic-gateecho " 22020Sstevel@tonic-gate#nisLDAPaddTimeout=${DEF_nisLDAPaddTimeout}\ 22030Sstevel@tonic-gate" >> $CONFIG_FILE 22040Sstevel@tonic-gate 22050Sstevel@tonic-gateget_nisLDAPaddTimeout 22060Sstevel@tonic-gate 22070Sstevel@tonic-gateecho " 22080Sstevel@tonic-gate#nisLDAPdeleteTimeout=${DEF_nisLDAPdeleteTimeout}\ 22090Sstevel@tonic-gate" >> $CONFIG_FILE 22100Sstevel@tonic-gate 22110Sstevel@tonic-gateget_nisLDAPdeleteTimeout 22120Sstevel@tonic-gate 22130Sstevel@tonic-gateecho " 22140Sstevel@tonic-gate#nisLDAPsearchTimeLimit=${DEF_nisLDAPsearchTimeLimit}\ 22150Sstevel@tonic-gate" >> $CONFIG_FILE 22160Sstevel@tonic-gate 22170Sstevel@tonic-gateget_nisLDAPsearchTimeLimit 22180Sstevel@tonic-gate 22190Sstevel@tonic-gateecho " 22200Sstevel@tonic-gate#nisLDAPsearchSizeLimit=${DEF_nisLDAPsearchSizeLimit}\ 22210Sstevel@tonic-gate" >> $CONFIG_FILE 22220Sstevel@tonic-gate 22230Sstevel@tonic-gateget_nisLDAPsearchSizeLimit 22240Sstevel@tonic-gate 22250Sstevel@tonic-gateecho " 22260Sstevel@tonic-gate 22270Sstevel@tonic-gate# Should the ypserv follow LDAP referrals ? 22280Sstevel@tonic-gate# 22290Sstevel@tonic-gate#nisLDAPfollowReferral=${DEF_nisLDAPfollowReferral}\ 22300Sstevel@tonic-gate" >> $CONFIG_FILE 22310Sstevel@tonic-gate 22320Sstevel@tonic-gateget_nisLDAPfollowReferral 22330Sstevel@tonic-gate 22340Sstevel@tonic-gateecho " 22350Sstevel@tonic-gate 22360Sstevel@tonic-gate# Action, number of attempts, and timeout following an LDAP retrieval error 22370Sstevel@tonic-gate# 22380Sstevel@tonic-gate#nisLDAPretrieveErrorAction=${DEF_nisLDAPretrieveErrorAction}\ 22390Sstevel@tonic-gate" >> $CONFIG_FILE 22400Sstevel@tonic-gate 22410Sstevel@tonic-gateget_nisLDAPretrieveErrorAction 22420Sstevel@tonic-gate 22430Sstevel@tonic-gateecho " 22440Sstevel@tonic-gate#nisLDAPretrieveErrorAttempts=\ 22450Sstevel@tonic-gate" >> $CONFIG_FILE 22460Sstevel@tonic-gate 22470Sstevel@tonic-gateget_nisLDAPretrieveErrorAttempts 22480Sstevel@tonic-gate 22490Sstevel@tonic-gateecho " 22500Sstevel@tonic-gate#nisLDAPretrieveErrorTimeout=${DEF_nisLDAPretrieveErrorTimeout}\ 22510Sstevel@tonic-gate" >> $CONFIG_FILE 22520Sstevel@tonic-gate 22530Sstevel@tonic-gateget_nisLDAPretrieveErrorTimeout 22540Sstevel@tonic-gate 22550Sstevel@tonic-gateecho " 22560Sstevel@tonic-gate 22570Sstevel@tonic-gate# Action, number of attempts, and timeout following an LDAP store error 22580Sstevel@tonic-gate# 22590Sstevel@tonic-gate#nisLDAPstoreErrorAction=${DEF_nisLDAPstoreErrorAction}\ 22600Sstevel@tonic-gate" >> $CONFIG_FILE 22610Sstevel@tonic-gate 22620Sstevel@tonic-gateget_nisLDAPstoreErrorAction 22630Sstevel@tonic-gate 22640Sstevel@tonic-gateecho " 22650Sstevel@tonic-gate#nisLDAPstoreErrorAttempts=\ 22660Sstevel@tonic-gate" >> $CONFIG_FILE 22670Sstevel@tonic-gate 22680Sstevel@tonic-gateget_nisLDAPstoreErrorAttempts 22690Sstevel@tonic-gate 22700Sstevel@tonic-gateecho " 22710Sstevel@tonic-gate#nisLDAPstoreErrorTimeout=${DEF_nisLDAPstoreErrorTimeout}\ 22720Sstevel@tonic-gate" >> $CONFIG_FILE 22730Sstevel@tonic-gate 22740Sstevel@tonic-gateget_nisLDAPstoreErrorTimeout 22750Sstevel@tonic-gate 22760Sstevel@tonic-gate 22770Sstevel@tonic-gate# We are done, so move back the config file from temp. location 22780Sstevel@tonic-gate# to actual location. 22790Sstevel@tonic-gate# In case the config file name has a directory component which does 22800Sstevel@tonic-gate# not exist, then create it now, otherwise 'mv' will return error. 22810Sstevel@tonic-gate 22820Sstevel@tonic-gateDIR_TO_CREATE=`dirname ${_CONFIG_FILE}` 22830Sstevel@tonic-gatemkdir -p ${DIR_TO_CREATE} 22840Sstevel@tonic-gate 22850Sstevel@tonic-gateecho "Moving output from temporary file ($CONFIG_FILE) to actual file ($_CONFIG_FILE)" 22860Sstevel@tonic-gatemv $CONFIG_FILE $_CONFIG_FILE 22870Sstevel@tonic-gate 22880Sstevel@tonic-gate# Revert back the config file name in case needed. 22890Sstevel@tonic-gateCONFIG_FILE=$_CONFIG_FILE 22900Sstevel@tonic-gateecho "Finished creation of config file ( $_CONFIG_FILE )" 22910Sstevel@tonic-gate 22920Sstevel@tonic-gate} 22930Sstevel@tonic-gate 22940Sstevel@tonic-gate 22950Sstevel@tonic-gateput_mapping_file_copyright_info() 22960Sstevel@tonic-gate{ 22970Sstevel@tonic-gate 22980Sstevel@tonic-gate# Start with an emptty file, so don't append, but overwrite here. 22990Sstevel@tonic-gate# Just change the name and add the word pragma, but keep the same 23000Sstevel@tonic-gate# date and version number as in the ident string of this script. 23010Sstevel@tonic-gate 23020Sstevel@tonic-gategrep "ident \"@(#)$PROG" $ABS_PROG | \ 23030Sstevel@tonic-gate sed "s/ ident/pragma ident/g" | \ 23040Sstevel@tonic-gate sed "s/${PROG}/${NEW_NAME}/g" > $MAP_FILE 23050Sstevel@tonic-gate 23060Sstevel@tonic-gateecho "\ 23070Sstevel@tonic-gate# 2308*13083SBenjamin.Chang@Oracle.COM# CDDL HEADER START 2309*13083SBenjamin.Chang@Oracle.COM# 2310*13083SBenjamin.Chang@Oracle.COM# The contents of this file are subject to the terms of the 2311*13083SBenjamin.Chang@Oracle.COM# Common Development and Distribution License (the "License"). 2312*13083SBenjamin.Chang@Oracle.COM# You may not use this file except in compliance with the License. 2313*13083SBenjamin.Chang@Oracle.COM# 2314*13083SBenjamin.Chang@Oracle.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 2315*13083SBenjamin.Chang@Oracle.COM# or http://www.opensolaris.org/os/licensing. 2316*13083SBenjamin.Chang@Oracle.COM# See the License for the specific language governing permissions 2317*13083SBenjamin.Chang@Oracle.COM# and limitations under the License. 2318*13083SBenjamin.Chang@Oracle.COM# 2319*13083SBenjamin.Chang@Oracle.COM# When distributing Covered Code, include this CDDL HEADER in each 2320*13083SBenjamin.Chang@Oracle.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 2321*13083SBenjamin.Chang@Oracle.COM# If applicable, add the following below this CDDL HEADER, with the 2322*13083SBenjamin.Chang@Oracle.COM# fields enclosed by brackets "[]" replaced with your own identifying 2323*13083SBenjamin.Chang@Oracle.COM# information: Portions Copyright [yyyy] [name of copyright owner] 2324*13083SBenjamin.Chang@Oracle.COM# 2325*13083SBenjamin.Chang@Oracle.COM# CDDL HEADER END 2326*13083SBenjamin.Chang@Oracle.COM# 2327*13083SBenjamin.Chang@Oracle.COM# 2328*13083SBenjamin.Chang@Oracle.COM# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 23290Sstevel@tonic-gate# 23300Sstevel@tonic-gate#------------------------------------------------------------------- 23310Sstevel@tonic-gate#\ 23320Sstevel@tonic-gate" >> $MAP_FILE 23330Sstevel@tonic-gate} 23340Sstevel@tonic-gate 23350Sstevel@tonic-gate 23360Sstevel@tonic-gate# 23370Sstevel@tonic-gate# Filter out all the YP domains in /var/yp 23380Sstevel@tonic-gate# The list of domains is stored in list "VARYP_DMN_LIST" 23390Sstevel@tonic-gate# 23400Sstevel@tonic-gatecreate_all_var_yp_domain_list() 23410Sstevel@tonic-gate{ 23420Sstevel@tonic-gateVARYP_DMN_LIST="" 23430Sstevel@tonic-gate 23440Sstevel@tonic-gatefor entry in /var/yp/* 23450Sstevel@tonic-gatedo 23460Sstevel@tonic-gate DMN=`basename $entry` 23470Sstevel@tonic-gate if [ -d "/var/yp/$DMN" ] && [ -f "/var/yp/binding/$DMN/ypservers" ] 23480Sstevel@tonic-gate then 23490Sstevel@tonic-gate VARYP_DMN_LIST="$VARYP_DMN_LIST $DMN" 23500Sstevel@tonic-gate fi 23510Sstevel@tonic-gatedone 23520Sstevel@tonic-gate 23530Sstevel@tonic-gate# d_echo VARYP_DMN_LIST = "$VARYP_DMN_LIST" 23540Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo VARYP_DMN_LIST = "$VARYP_DMN_LIST" 23550Sstevel@tonic-gate} 23560Sstevel@tonic-gate 23570Sstevel@tonic-gate 23580Sstevel@tonic-gate# 23590Sstevel@tonic-gate# Ask user which domains would be served by N2L 23600Sstevel@tonic-gate# The list of N2L domains is stored in global array 23610Sstevel@tonic-gate# "N2L_DMN_LIST" and number of domains in N2L_DMN_CNT 23620Sstevel@tonic-gate# 23630Sstevel@tonic-gatecreate_n2l_domain_list() 23640Sstevel@tonic-gate{ 23650Sstevel@tonic-gate# First make a list of all the domains in /var/yp 23660Sstevel@tonic-gatecreate_all_var_yp_domain_list 23670Sstevel@tonic-gate 23680Sstevel@tonic-gate# Now identify those to be served by N2L 23690Sstevel@tonic-gatelet count=0 23700Sstevel@tonic-gate 23710Sstevel@tonic-gatefor DMN in $VARYP_DMN_LIST 23720Sstevel@tonic-gatedo 23730Sstevel@tonic-gate get_confirm "Do you want to store maps from ${DMN} domain to LDAP (y/n/h):" \ 23740Sstevel@tonic-gate "n" "selectDomain4N2L_help" 23750Sstevel@tonic-gate 23760Sstevel@tonic-gate if [ $? -eq 1 ]; then 23770Sstevel@tonic-gate N2L_DMN_LIST[count]=$DMN 23780Sstevel@tonic-gate let count="count + 1" 23790Sstevel@tonic-gate fi 23800Sstevel@tonic-gate 23810Sstevel@tonic-gatedone 23820Sstevel@tonic-gateN2L_DMN_CNT=$count 23830Sstevel@tonic-gate 23840Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo N2L_DMN_LIST=${N2L_DMN_LIST[*]} 23850Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo N2L_DMN_CNT=$N2L_DMN_CNT 23860Sstevel@tonic-gate} 23870Sstevel@tonic-gate 23880Sstevel@tonic-gate 23890Sstevel@tonic-gate# 23900Sstevel@tonic-gate# Make various lists for different types of maps for each N2L domain 23910Sstevel@tonic-gate# and ask user if mapping information and comments need to be generated 23920Sstevel@tonic-gate# for custom maps. 23930Sstevel@tonic-gate# 23940Sstevel@tonic-gate# This function looks big, but since KSH does not support 2-D arrays, or 23950Sstevel@tonic-gate# two level of dereferencing, it forced to have so many lists and arrays. 23960Sstevel@tonic-gate# Lists are better for adding or removing elements, and arrays are better 23970Sstevel@tonic-gate# for accessing with index and in knowing the no. of elements. 23980Sstevel@tonic-gate# 23990Sstevel@tonic-gatecreate_map_lists() 24000Sstevel@tonic-gate{ 24010Sstevel@tonic-gate# Initialize them with no maps. 24020Sstevel@tonic-gateALL_DMN_ALL_MAPLIST="" 24030Sstevel@tonic-gateALL_DMN_DEF_MAPLIST="" 24040Sstevel@tonic-gateALL_DMN_CUST_MAPLIST="" 24050Sstevel@tonic-gateALL_DMN_AUTO_CUST_MAPLIST="" 24060Sstevel@tonic-gate 24070Sstevel@tonic-gate# Default to don't generate custom mapping info or comment info. 24080Sstevel@tonic-gateCUST_MAP_NEEDED=0 24090Sstevel@tonic-gateCUST_CMT_NEEDED=0 24100Sstevel@tonic-gate 24110Sstevel@tonic-gatelet count=0 24120Sstevel@tonic-gate 24130Sstevel@tonic-gatewhile (( $count < $N2L_DMN_CNT )) 24140Sstevel@tonic-gatedo 24150Sstevel@tonic-gate DMN=${N2L_DMN_LIST[count]} 24160Sstevel@tonic-gate MAPDIR=/var/yp/${DMN} 24170Sstevel@tonic-gate 24180Sstevel@tonic-gate # Initialize per domain lists to NULL. 24190Sstevel@tonic-gate ALL_MAPLIST="" 24200Sstevel@tonic-gate DEF_MAPLIST="" 24210Sstevel@tonic-gate CUST_MAPLIST="" 24220Sstevel@tonic-gate AUTO_CUST_MAPLIST="" 24230Sstevel@tonic-gate 24240Sstevel@tonic-gate for dbmfile in $MAPDIR/*.dir 24250Sstevel@tonic-gate do 24260Sstevel@tonic-gate MAP=`basename $dbmfile .dir` 24270Sstevel@tonic-gate 24280Sstevel@tonic-gate # Ignore N2L maps (those with "LDAP_" prefix and ageing.byname) 24290Sstevel@tonic-gate if [[ $MAP != LDAP_* ]] && [[ $MAP != "" ]] && \ 24300Sstevel@tonic-gate [ -f $MAPDIR/${MAP}.pag ] && [[ $MAP != ageing.byname ]] 24310Sstevel@tonic-gate then 24320Sstevel@tonic-gate ALL_MAPLIST="$ALL_MAPLIST $MAP" 24330Sstevel@tonic-gate 24340Sstevel@tonic-gate if present $MAP $DEFAULT_NIS_MAPS 24350Sstevel@tonic-gate then 24360Sstevel@tonic-gate DEF_MAPLIST="$DEF_MAPLIST $MAP" 24370Sstevel@tonic-gate 24380Sstevel@tonic-gate elif [[ $MAP = auto.* ]] 24390Sstevel@tonic-gate then 24400Sstevel@tonic-gate AUTO_CUST_MAPLIST="$AUTO_CUST_MAPLIST $MAP" 24410Sstevel@tonic-gate 24420Sstevel@tonic-gate else 24430Sstevel@tonic-gate # If we reached here, means it is custom map. 24440Sstevel@tonic-gate get_confirm "Do you want the mapping information to be generated for \"$MAP\" map of $DMN domain (y/n/h)?" \ 24450Sstevel@tonic-gate "n" "generate_mapping_info_for_cust_map_help" 24460Sstevel@tonic-gate 24470Sstevel@tonic-gate if [ $? -eq 1 ] 24480Sstevel@tonic-gate then 24490Sstevel@tonic-gate CUST_MAPLIST="$CUST_MAPLIST $MAP" 24500Sstevel@tonic-gate else 24510Sstevel@tonic-gate # If a customer map is not desired, then delete it from 24520Sstevel@tonic-gate # all maplist too. 24530Sstevel@tonic-gate ALL_MAPLIST=$(remove $MAP $ALL_MAPLIST) 24540Sstevel@tonic-gate fi 24550Sstevel@tonic-gate 24560Sstevel@tonic-gate fi 24570Sstevel@tonic-gate 24580Sstevel@tonic-gate fi 24590Sstevel@tonic-gate 24600Sstevel@tonic-gate done 24610Sstevel@tonic-gate 24620Sstevel@tonic-gate # Make ALL_DMN lists as they are very helpful in checking if a map exists. 24630Sstevel@tonic-gate ALL_DMN_ALL_MAPLIST=$(merge_lists $ALL_DMN_ALL_MAPLIST $ALL_MAPLIST) 24640Sstevel@tonic-gate ALL_DMN_DEF_MAPLIST=$(merge_lists $ALL_DMN_DEF_MAPLIST $DEF_MAPLIST) 24650Sstevel@tonic-gate ALL_DMN_CUST_MAPLIST=$(merge_lists $ALL_DMN_CUST_MAPLIST $CUST_MAPLIST) 24660Sstevel@tonic-gate ALL_DMN_AUTO_CUST_MAPLIST=$(merge_lists $ALL_DMN_AUTO_CUST_MAPLIST \ 24670Sstevel@tonic-gate $AUTO_CUST_MAPLIST) 24680Sstevel@tonic-gate 24690Sstevel@tonic-gate # Store per domain lists in arrays. 24700Sstevel@tonic-gate ALL_MAPS[$count]="$ALL_MAPLIST" 24710Sstevel@tonic-gate DEF_MAPS[$count]="$DEF_MAPLIST" 24720Sstevel@tonic-gate CUST_MAPS[$count]="$CUST_MAPLIST" 24730Sstevel@tonic-gate AUTO_CUST_MAPS[$count]="$AUTO_CUST_MAPLIST" 24740Sstevel@tonic-gate 24750Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo ALL_MAPS[$DMN] = ${ALL_MAPS[$count]} 24760Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo DEF_MAPS[$DMN] = ${DEF_MAPS[$count]} 24770Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo CUST_MAPS[$DMN] = ${CUST_MAPS[$count]} 24780Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo AUTO_CUST_MAPS[$DMN] = ${AUTO_CUST_MAPS[$count]} 24790Sstevel@tonic-gate 24800Sstevel@tonic-gate let count="count + 1" 24810Sstevel@tonic-gatedone 24820Sstevel@tonic-gate 24830Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo ALL_DMN_ALL_MAPLIST = $ALL_DMN_ALL_MAPLIST 24840Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo ALL_DMN_DEF_MAPLIST = $ALL_DMN_DEF_MAPLIST 24850Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo ALL_DMN_CUST_MAPLIST = $ALL_DMN_CUST_MAPLIST 24860Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo ALL_DMN_AUTO_CUST_MAPLIST = $ALL_DMN_AUTO_CUST_MAPLIST 24870Sstevel@tonic-gate 24880Sstevel@tonic-gate# Store all domain lists in array too. 24890Sstevel@tonic-gateset -A ALL_DMN_ALL_MAPS $ALL_DMN_ALL_MAPLIST 24900Sstevel@tonic-gateset -A ALL_DMN_DEF_MAPS $ALL_DMN_DEF_MAPLIST 24910Sstevel@tonic-gateset -A ALL_DMN_CUST_MAPS $ALL_DMN_CUST_MAPLIST 24920Sstevel@tonic-gateset -A ALL_DMN_AUTO_CUST_MAPS $ALL_DMN_AUTO_CUST_MAPLIST 24930Sstevel@tonic-gate 24940Sstevel@tonic-gate# A positive customer map count implies custom mapping information 24950Sstevel@tonic-gate# is required. Set this flag. 24960Sstevel@tonic-gate[ ${#ALL_DMN_CUST_MAPS[*]} -gt 0 ] && CUST_MAP_NEEDED=1 24970Sstevel@tonic-gate 24980Sstevel@tonic-gate# Give bit of info, and ask if comments need to be placed in mapping file 24990Sstevel@tonic-gateecho " 25000Sstevel@tonic-gate This script can place relevant information regarding custom 25010Sstevel@tonic-gate maps at appropriate places in the mapping file which can be 25020Sstevel@tonic-gate helpful in customizing this file. 25030Sstevel@tonic-gate" 25040Sstevel@tonic-gate 25050Sstevel@tonic-gateget_confirm "Do you want such information to be generated (y/n/h)?" \ 25060Sstevel@tonic-gate "n" "generate_comment_info_for_cust_map_help" 25070Sstevel@tonic-gate 25080Sstevel@tonic-gate[ $? -eq 1 ] && CUST_CMT_NEEDED=1 25090Sstevel@tonic-gate 25100Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo CUST_MAP_NEEDED = $CUST_MAP_NEEDED 25110Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo CUST_CMT_NEEDED = $CUST_CMT_NEEDED 25120Sstevel@tonic-gate 25130Sstevel@tonic-gate} 25140Sstevel@tonic-gate 25150Sstevel@tonic-gate 25160Sstevel@tonic-gate# 25170Sstevel@tonic-gate# Ask user the context for each (N2l) domain 25180Sstevel@tonic-gate# 25190Sstevel@tonic-gateget_nisLDAPdomainContext() 25200Sstevel@tonic-gate{ 25210Sstevel@tonic-gateecho " 25220Sstevel@tonic-gate# List domains and contexts 25230Sstevel@tonic-gate" >> $MAP_FILE 25240Sstevel@tonic-gate 25250Sstevel@tonic-gatefor DMN in ${N2L_DMN_LIST[*]} 25260Sstevel@tonic-gatedo 25270Sstevel@tonic-gate while : 25280Sstevel@tonic-gate do 25290Sstevel@tonic-gate # Convert to domain in dc format for default choice 25300Sstevel@tonic-gate domain_2_dc $DMN 25310Sstevel@tonic-gate 25320Sstevel@tonic-gate get_ans "Enter the naming context for $DMN domain (h=help):"\ 25330Sstevel@tonic-gate "$_DOM_2_DC" 25340Sstevel@tonic-gate 25350Sstevel@tonic-gate # If help continue, otherwise break. 25360Sstevel@tonic-gate case "$ANS" in 25370Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPdomainContext_help ;; 25380Sstevel@tonic-gate * ) break ;; 25390Sstevel@tonic-gate esac 25400Sstevel@tonic-gate done 25410Sstevel@tonic-gate 25420Sstevel@tonic-gate # If a value is specified, set it, and save in mapping file too. 25430Sstevel@tonic-gate if [ "$ANS" != "" ]; then 25440Sstevel@tonic-gate echo "nisLDAPdomainContext $DMN : ${ANS}" >> $MAP_FILE 25450Sstevel@tonic-gate fi 25460Sstevel@tonic-gate 25470Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo "nisLDAPdomainContext $DMN : ${ANS}" 25480Sstevel@tonic-gatedone 25490Sstevel@tonic-gate} 25500Sstevel@tonic-gate 25510Sstevel@tonic-gate 25520Sstevel@tonic-gate# 25530Sstevel@tonic-gate# Ask user the domains for which passwords should be changed 25540Sstevel@tonic-gate# 25550Sstevel@tonic-gateget_nisLDAPyppasswddDomains() 25560Sstevel@tonic-gate{ 25570Sstevel@tonic-gate 25580Sstevel@tonic-gateecho " 25590Sstevel@tonic-gate# List domains for which passwords should be changed. If this is not 25600Sstevel@tonic-gate# present then the value returned by 'domainname' will be used. 25610Sstevel@tonic-gate" >> $MAP_FILE 25620Sstevel@tonic-gate 25630Sstevel@tonic-gatefor DMN in ${N2L_DMN_LIST[*]} 25640Sstevel@tonic-gatedo 25650Sstevel@tonic-gate get_confirm "Enable password changes for ${DMN} domain (y/n/h)? " \ 25660Sstevel@tonic-gate "n" "nisLDAPyppasswddDomains_help" 25670Sstevel@tonic-gate 25680Sstevel@tonic-gate if [ $? -eq 1 ]; then 25690Sstevel@tonic-gate echo "nisLDAPyppasswddDomains $DMN" >> $MAP_FILE 25700Sstevel@tonic-gate fi 25710Sstevel@tonic-gatedone 25720Sstevel@tonic-gate 25730Sstevel@tonic-gateecho " 25740Sstevel@tonic-gate# 25750Sstevel@tonic-gate#------------------------------------------------------------------- 25760Sstevel@tonic-gate#\ 25770Sstevel@tonic-gate" >> $MAP_FILE 25780Sstevel@tonic-gate} 25790Sstevel@tonic-gate 25800Sstevel@tonic-gate 25810Sstevel@tonic-gate# 25820Sstevel@tonic-gate# Create NIS databaseId mappings (aliases) 25830Sstevel@tonic-gate# 25840Sstevel@tonic-gatecreate_nisLDAPdatabaseIdMapping() 25850Sstevel@tonic-gate{ 25860Sstevel@tonic-gateecho ' 25870Sstevel@tonic-gate# Associate map names with databaseIds (aliases) 25880Sstevel@tonic-gate 25890Sstevel@tonic-gate# Standard maps 25900Sstevel@tonic-gatenisLDAPdatabaseIdMapping ethers: ethers.byaddr ethers.byname 25910Sstevel@tonic-gatenisLDAPdatabaseIdMapping group: group.bygid group.byname 25920Sstevel@tonic-gatenisLDAPdatabaseIdMapping hosts:[addr="[0-9]*.[0-9]*.[0-9]*.[0-9]*"] \ 25930Sstevel@tonic-gate hosts.byaddr hosts.byname 25940Sstevel@tonic-gate# Special mapping to handle the YP_MULTI cases 25950Sstevel@tonic-gatenisLDAPdatabaseIdMapping multihosts: \ 25960Sstevel@tonic-gate [addr="[0-9]*.[0-9]*.[0-9]*.[0-9]*,*"] \ 25970Sstevel@tonic-gate hosts.byname 25980Sstevel@tonic-gatenisLDAPdatabaseIdMapping networks: networks.byaddr networks.byname 25990Sstevel@tonic-gatenisLDAPdatabaseIdMapping project: project.byname project.byprojid 26000Sstevel@tonic-gatenisLDAPdatabaseIdMapping protocols: protocols.byname protocols.bynumber 26010Sstevel@tonic-gatenisLDAPdatabaseIdMapping services: services.byname services.byservicename 26020Sstevel@tonic-gate 26030Sstevel@tonic-gate# netid.byname is built up from the hosts and passwd files using different 26040Sstevel@tonic-gate# mappings. It thus has two associated nisLDAPdatabaseIdMappings. 26050Sstevel@tonic-gatenisLDAPdatabaseIdMapping netid.host:[number="0"] netid.byname 26060Sstevel@tonic-gatenisLDAPdatabaseIdMapping netid.pass:[number="[1-9]*"] netid.byname 26070Sstevel@tonic-gate 26080Sstevel@tonic-gate# The next two are special databaseIds. They associate maps with databaseIds 26090Sstevel@tonic-gate# but additionally identify which maps contain password and password adjunct 26100Sstevel@tonic-gate# information for yppasswdd. 26110Sstevel@tonic-gatenisLDAPdatabaseIdMapping passwd: passwd.byname passwd.byuid 26120Sstevel@tonic-gate 26130Sstevel@tonic-gate# mail.byaddr needs to select entries of the form x@y or x!y 26140Sstevel@tonic-gatenisLDAPdatabaseIdMapping mail.mapping:[rf_key="*@*", rf_key="*!*"] \ 26150Sstevel@tonic-gate mail.byaddr 26160Sstevel@tonic-gate 26170Sstevel@tonic-gate# publickey.byname 26180Sstevel@tonic-gate# Each entry in publickey map consists of a network user name which 26190Sstevel@tonic-gate# may refer to a host or a user. It also contains a default entry for nobody. 26200Sstevel@tonic-gate# Hence, we need three nisLDAPdatabaseIdmappings to support the three 26210Sstevel@tonic-gate# different types of keys. 26220Sstevel@tonic-gatenisLDAPdatabaseIdMapping keys.host:[rf_key="unix.[a-zA-Z]*@*"] \ 26230Sstevel@tonic-gate publickey.byname 26240Sstevel@tonic-gatenisLDAPdatabaseIdMapping keys.pass:[rf_key="unix.[0-9]*@*"] \ 26250Sstevel@tonic-gate publickey.byname 26260Sstevel@tonic-gatenisLDAPdatabaseIdMapping keys.nobody:[rf_key="nobody"] publickey.byname 26270Sstevel@tonic-gate 26280Sstevel@tonic-gate# Single standard maps. No point aliasing. 26290Sstevel@tonic-gate# mail.aliases 26300Sstevel@tonic-gate# netmasks.byaddr 26310Sstevel@tonic-gate# rpc.bynumber 26320Sstevel@tonic-gate# ypservers 26330Sstevel@tonic-gate 26340Sstevel@tonic-gate# Other maps 26350Sstevel@tonic-gate# ipnodes looks identical to hosts but maps to a different context. 26360Sstevel@tonic-gatenisLDAPdatabaseIdMapping ipnodes:[addr="*:*"] \ 26370Sstevel@tonic-gate ipnodes.byaddr ipnodes.byname 26380Sstevel@tonic-gate# Special mapping to handle the YP_MULTI cases 26390Sstevel@tonic-gatenisLDAPdatabaseIdMapping multiipnodes: \ 26400Sstevel@tonic-gate [addr="*:*,*"] \ 26410Sstevel@tonic-gate ipnodes.byname 26420Sstevel@tonic-gate 26430Sstevel@tonic-gate# Other single maps. No point aliasing 26440Sstevel@tonic-gate# audit_user 26450Sstevel@tonic-gate# auth_attr 26460Sstevel@tonic-gate# exec_attr 26470Sstevel@tonic-gate# prof_attr 26480Sstevel@tonic-gate# user_attr 26490Sstevel@tonic-gate# auto.home 26500Sstevel@tonic-gate# auto.master 26510Sstevel@tonic-gate# bootparams 26520Sstevel@tonic-gate# timezone.byname 26530Sstevel@tonic-gate# printers.conf.byname 26540Sstevel@tonic-gate# passwd.adjunct.byname 26550Sstevel@tonic-gate# group.adjunct.byname 26560Sstevel@tonic-gate' >> $MAP_FILE 26570Sstevel@tonic-gate 26580Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && \ 26590Sstevel@tonic-gateecho " 26600Sstevel@tonic-gate# If any custom map needs to be aliased, then it should be listed 26610Sstevel@tonic-gate# here in the following format : 26620Sstevel@tonic-gate# nisLDAPdatabaseIdMapping databaseId ":" ["["indexlist"]"] mapname[" "...] 26630Sstevel@tonic-gate" >> $MAP_FILE 26640Sstevel@tonic-gate 26650Sstevel@tonic-gate[ CUST_MAP_NEEDED -eq 1 ] && \ 26660Sstevel@tonic-gateecho "\ 26670Sstevel@tonic-gate# Not aliasing non-default/custom maps as they are assumed to be 26680Sstevel@tonic-gate# simple, single maps.\ 26690Sstevel@tonic-gate" >> $MAP_FILE 26700Sstevel@tonic-gate 26710Sstevel@tonic-gatefor MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} ${ALL_DMN_CUST_MAPS[*]} 26720Sstevel@tonic-gatedo 26730Sstevel@tonic-gate echo "# $MAP" >> $MAP_FILE 26740Sstevel@tonic-gatedone 26750Sstevel@tonic-gate 26760Sstevel@tonic-gateecho "\ 26770Sstevel@tonic-gate# 26780Sstevel@tonic-gate#------------------------------------------------------------------------------ 26790Sstevel@tonic-gate# 26800Sstevel@tonic-gate" >> $MAP_FILE 26810Sstevel@tonic-gate} 26820Sstevel@tonic-gate 26830Sstevel@tonic-gate 26840Sstevel@tonic-gate# 26850Sstevel@tonic-gate# Finds the domains in which the given map exists in the supplied list. 26860Sstevel@tonic-gate# Sets result in PRESENT_COUNT and PRESENT_IN_DOMAINS. These fields are 26870Sstevel@tonic-gate# set globally, so they can be accessed from any where. 26880Sstevel@tonic-gate# Input : $1 - map, $2 - list name (just name, not the value) 26890Sstevel@tonic-gate# 26900Sstevel@tonic-gatefind_domains() 26910Sstevel@tonic-gate{ 26920Sstevel@tonic-gate_MAP=$1 26930Sstevel@tonic-gate_ARRAY=$2 26940Sstevel@tonic-gate 26950Sstevel@tonic-gatelet PRESENT_COUNT=0 26960Sstevel@tonic-gatePRESENT_IN_DOMAINS="" 26970Sstevel@tonic-gate 26980Sstevel@tonic-gatelet count=0 26990Sstevel@tonic-gate 27000Sstevel@tonic-gatewhile (( $count < $N2L_DMN_CNT )) 27010Sstevel@tonic-gatedo 27020Sstevel@tonic-gate 27030Sstevel@tonic-gate # Quick and dirty way to get around unavailability of 2D array 27040Sstevel@tonic-gate case "$_ARRAY" in 27050Sstevel@tonic-gate ALL_MAPS ) _LIST=${ALL_MAPS[$count]} ;; 27060Sstevel@tonic-gate DEF_MAPS ) _LIST=${DEF_MAPS[$count]} ;; 27070Sstevel@tonic-gate CUST_MAPS ) _LIST=${CUST_MAPS[$count]} ;; 27080Sstevel@tonic-gate AUTO_CUST_MAPS ) _LIST=${AUTO_CUST_MAPS[$count]} ;; 27090Sstevel@tonic-gate * ) echo "Invalid value: \"${_ARRAY}\". \c" 27100Sstevel@tonic-gate ;; 27110Sstevel@tonic-gate esac 27120Sstevel@tonic-gate 27130Sstevel@tonic-gate if present $_MAP $_LIST 27140Sstevel@tonic-gate then 27150Sstevel@tonic-gate let PRESENT_COUNT="$PRESENT_COUNT + 1" 27160Sstevel@tonic-gate PRESENT_IN_DOMAINS="$PRESENT_IN_DOMAINS ${N2L_DMN_LIST[count]}" 27170Sstevel@tonic-gate fi 27180Sstevel@tonic-gate let count="count + 1" 27190Sstevel@tonic-gatedone 27200Sstevel@tonic-gate 27210Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo "PRESENT_COUNT = $PRESENT_COUNT" 27220Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo "PRESENT_IN_DOMAINS = $PRESENT_IN_DOMAINS" 27230Sstevel@tonic-gate 27240Sstevel@tonic-gatereturn 0 27250Sstevel@tonic-gate} 27260Sstevel@tonic-gate 27270Sstevel@tonic-gate 27280Sstevel@tonic-gate# 27290Sstevel@tonic-gate# For a given map, find out which list it belongs to (PRESENT_IN_LIST), 27300Sstevel@tonic-gate# and in how many domains this map shows up (PRESENT_COUNT), and in 27310Sstevel@tonic-gate# which ones (PRESENT_IN_DOMAINS). These fields are set globally, so 27320Sstevel@tonic-gate# they can be accessed from any where. 27330Sstevel@tonic-gate# 27340Sstevel@tonic-gatefind_map_presence_details() 27350Sstevel@tonic-gate{ 27360Sstevel@tonic-gate_MAP=$1 27370Sstevel@tonic-gate 27380Sstevel@tonic-gatelet PRESENT_COUNT=0 27390Sstevel@tonic-gatePRESENT_IN_LIST="" 27400Sstevel@tonic-gatePRESENT_IN_DOMAINS="" 27410Sstevel@tonic-gate 27420Sstevel@tonic-gate# If the map does not exist, return right away, else 27430Sstevel@tonic-gate# find which list it belongs to. 27440Sstevel@tonic-gate# If a map exists in def or auto or cust lists, then 27450Sstevel@tonic-gate# it also exists in "all" list. 27460Sstevel@tonic-gate 27470Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_ALL_MAPLIST 27480Sstevel@tonic-gatethen 27490Sstevel@tonic-gate return 1 27500Sstevel@tonic-gate 27510Sstevel@tonic-gateelif present $_MAP $ALL_DMN_DEF_MAPLIST 27520Sstevel@tonic-gatethen 27530Sstevel@tonic-gate PRESENT_IN_LIST="DEF_MAPS" 27540Sstevel@tonic-gate 27550Sstevel@tonic-gateelif present $_MAP $ALL_DMN_CUST_MAPLIST 27560Sstevel@tonic-gatethen 27570Sstevel@tonic-gate PRESENT_IN_LIST="CUST_MAPS" 27580Sstevel@tonic-gate 27590Sstevel@tonic-gateelse 27600Sstevel@tonic-gate # If map exists, and not in previous two lists, 27610Sstevel@tonic-gate # then it has to be here only. 27620Sstevel@tonic-gate PRESENT_IN_LIST="AUTO_CUST_MAPS" 27630Sstevel@tonic-gatefi 27640Sstevel@tonic-gate 27650Sstevel@tonic-gate# Now we know which list the map belongs to. So, we need to 27660Sstevel@tonic-gate# find which are the domains in which this map exists. 27670Sstevel@tonic-gate 27680Sstevel@tonic-gatefind_domains $_MAP $PRESENT_IN_LIST 27690Sstevel@tonic-gate 27700Sstevel@tonic-gate# Since the above function sets the values of PRESENT_COUNT and 27710Sstevel@tonic-gate# PRESENT_IN_DOMAINS fields, we don't need to do anything else. 27720Sstevel@tonic-gate 27730Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo "PRESENT_IN_LIST = $PRESENT_IN_LIST" 27740Sstevel@tonic-gate 27750Sstevel@tonic-gatereturn 0 27760Sstevel@tonic-gate} 27770Sstevel@tonic-gate 27780Sstevel@tonic-gate 27790Sstevel@tonic-gate# 27800Sstevel@tonic-gate# Check if the comment char is a single character, return 0 on success. 27810Sstevel@tonic-gate# Input is passed via global variable "COMMENT_CHAR" 27820Sstevel@tonic-gate# 27830Sstevel@tonic-gatevalid_comment_char() 27840Sstevel@tonic-gate{ 27850Sstevel@tonic-gateCOMMENT_CHAR_LENGTH=`echo "${COMMENT_CHAR}" | wc -c` 27860Sstevel@tonic-gate 27870Sstevel@tonic-gate# echo adds new line character, so adjust length appropriately 27880Sstevel@tonic-gateif [ $COMMENT_CHAR_LENGTH -gt 2 ]; then 27890Sstevel@tonic-gate echo " Comment character has to be a blank or single character; try again." 27900Sstevel@tonic-gate return 1 27910Sstevel@tonic-gateelse 27920Sstevel@tonic-gate return 0 27930Sstevel@tonic-gatefi 27940Sstevel@tonic-gate} 27950Sstevel@tonic-gate 27960Sstevel@tonic-gate 27970Sstevel@tonic-gate# 27980Sstevel@tonic-gate# Read the comment character for a MAP. Append in mapping file if valid. 27990Sstevel@tonic-gate# Input - $1 : MAP name 28000Sstevel@tonic-gate# 28010Sstevel@tonic-gateget_comment_char() 28020Sstevel@tonic-gate{ 28030Sstevel@tonic-gate_MAP=$1 28040Sstevel@tonic-gate 28050Sstevel@tonic-gatewhile : 28060Sstevel@tonic-gatedo 28070Sstevel@tonic-gate get_ans "Specify the comment character for $_MAP :" 28080Sstevel@tonic-gate COMMENT_CHAR=$ANS 28090Sstevel@tonic-gate 28100Sstevel@tonic-gate if valid_comment_char; then 28110Sstevel@tonic-gate break 28120Sstevel@tonic-gate fi 28130Sstevel@tonic-gatedone 28140Sstevel@tonic-gate 28150Sstevel@tonic-gateecho "nisLDAPcommentChar $_MAP : '${COMMENT_CHAR}'" >> $MAP_FILE 28160Sstevel@tonic-gate} 28170Sstevel@tonic-gate 28180Sstevel@tonic-gate 28190Sstevel@tonic-gate# 28200Sstevel@tonic-gate# Read a seperate comment character for a MAP for each domain and 28210Sstevel@tonic-gate# update this information in mapping file. 28220Sstevel@tonic-gate# Input - $1 : MAP name, $@ : list of domains 28230Sstevel@tonic-gate# 28240Sstevel@tonic-gateget_comment_char_per_domain() 28250Sstevel@tonic-gate{ 28260Sstevel@tonic-gate_MAP=$1 28270Sstevel@tonic-gateshift 28280Sstevel@tonic-gate_DOMAIN_LIST="$@" 28290Sstevel@tonic-gate 28300Sstevel@tonic-gatefor _DMN in $_DOMAIN_LIST 28310Sstevel@tonic-gatedo 28320Sstevel@tonic-gate 28330Sstevel@tonic-gate while : 28340Sstevel@tonic-gate do 28350Sstevel@tonic-gate 28360Sstevel@tonic-gate get_ans "Specify the comment character for $_MAP,${_DMN} :" 28370Sstevel@tonic-gate COMMENT_CHAR=$ANS 28380Sstevel@tonic-gate 28390Sstevel@tonic-gate if valid_comment_char; then 28400Sstevel@tonic-gate break 28410Sstevel@tonic-gate fi 28420Sstevel@tonic-gate 28430Sstevel@tonic-gate done 28440Sstevel@tonic-gate echo "nisLDAPcommentChar $_MAP,${_DMN} : '${COMMENT_CHAR}'" >> $MAP_FILE 28450Sstevel@tonic-gate 28460Sstevel@tonic-gatedone 28470Sstevel@tonic-gate} 28480Sstevel@tonic-gate 28490Sstevel@tonic-gate 28500Sstevel@tonic-gate# 28510Sstevel@tonic-gate# This function generates custom comment entries. The output is 28520Sstevel@tonic-gate# appended in the mapping file. 28530Sstevel@tonic-gate# 28540Sstevel@tonic-gateget_custom_nisLDAPcommentChar() 28550Sstevel@tonic-gate{ 28560Sstevel@tonic-gate 28570Sstevel@tonic-gate# All the auto mounter maps are assumed to have '#' as the default comment 28580Sstevel@tonic-gate# char. But still list the non-default auto map entries here anyway. This 28590Sstevel@tonic-gate# will make it very easy in case these entries need to be changed. 28600Sstevel@tonic-gate 28610Sstevel@tonic-gatefor MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} 28620Sstevel@tonic-gatedo 28630Sstevel@tonic-gate echo "nisLDAPcommentChar $MAP : '#'" >> $MAP_FILE 28640Sstevel@tonic-gatedone 28650Sstevel@tonic-gate 28660Sstevel@tonic-gateif [ CUST_MAP_NEEDED -eq 1 ]; then 28670Sstevel@tonic-gate get_confirm "Do you wish to specify the comment character for any custom map (y/n/h)?" \ 28680Sstevel@tonic-gate "n" "custom_map_comment_char_help" 28690Sstevel@tonic-gate 28700Sstevel@tonic-gate if [ $? -eq 1 ]; then 28710Sstevel@tonic-gate for MAP in ${ALL_DMN_CUST_MAPS[*]} 28720Sstevel@tonic-gate do 28730Sstevel@tonic-gate 28740Sstevel@tonic-gate get_confirm "Do you wish to specify comment character for \"$MAP\" (y/n/h)?" \ 28750Sstevel@tonic-gate "n" "custom_map_comment_char_help" 28760Sstevel@tonic-gate 28770Sstevel@tonic-gate if [ $? -eq 1 ]; then 28780Sstevel@tonic-gate find_domains $MAP CUST_MAPS 28790Sstevel@tonic-gate if [ $PRESENT_COUNT -gt 1 ]; then 28800Sstevel@tonic-gate echo "Map \"$MAP\" is present in these domains : $PRESENT_IN_DOMAINS" 28810Sstevel@tonic-gate 28820Sstevel@tonic-gate get_confirm "For \"$MAP\", should the same comment character be set for all the domains (y/n/h)?" \ 28830Sstevel@tonic-gate "y" "same_comment_char_help" 28840Sstevel@tonic-gate 28850Sstevel@tonic-gate if [ $? -eq 1 ]; then 28860Sstevel@tonic-gate get_comment_char $MAP 28870Sstevel@tonic-gate else 28880Sstevel@tonic-gate get_comment_char_per_domain $MAP "$PRESENT_IN_DOMAINS" 28890Sstevel@tonic-gate fi 28900Sstevel@tonic-gate 28910Sstevel@tonic-gate else 28920Sstevel@tonic-gate get_comment_char $MAP 28930Sstevel@tonic-gate fi 28940Sstevel@tonic-gate 28950Sstevel@tonic-gate fi 28960Sstevel@tonic-gate done 28970Sstevel@tonic-gate fi 28980Sstevel@tonic-gatefi 28990Sstevel@tonic-gate 29000Sstevel@tonic-gate} 29010Sstevel@tonic-gate 29020Sstevel@tonic-gate 29030Sstevel@tonic-gate# List comment character (if any) for maps 29040Sstevel@tonic-gatecreate_nisLDAPcommentChar() 29050Sstevel@tonic-gate{ 29060Sstevel@tonic-gate 29070Sstevel@tonic-gateecho "\ 29080Sstevel@tonic-gate# Specify the character representing the start of comments. 29090Sstevel@tonic-gate" >> $MAP_FILE 29100Sstevel@tonic-gate 29110Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo "\ 29120Sstevel@tonic-gate# The comment character represents the start of the special 'comment' 29130Sstevel@tonic-gate# field in a given NIS map. If this attribute is not present then the 29140Sstevel@tonic-gate# default comment character '#' is used. If a map cannot contain comments 29150Sstevel@tonic-gate# then the NULL ('') comment character should be specified. The format to 29160Sstevel@tonic-gate# specify the comment character is : 29170Sstevel@tonic-gate# nisLDAPcommentChar MAP[,DOMAIN] : 'single_comment_char' 29180Sstevel@tonic-gate" >> $MAP_FILE 29190Sstevel@tonic-gate 29200Sstevel@tonic-gateecho "\ 29210Sstevel@tonic-gatenisLDAPcommentChar group : '' 29220Sstevel@tonic-gatenisLDAPcommentChar passwd : '' 29230Sstevel@tonic-gatenisLDAPcommentChar ageing.byname : '' 29240Sstevel@tonic-gatenisLDAPcommentChar audit_user : '' 29250Sstevel@tonic-gatenisLDAPcommentChar auth_attr : '' 29260Sstevel@tonic-gatenisLDAPcommentChar exec_attr : '' 29270Sstevel@tonic-gatenisLDAPcommentChar user_attr : '' 29280Sstevel@tonic-gatenisLDAPcommentChar bootparams : '' 29290Sstevel@tonic-gate" >> $MAP_FILE 29300Sstevel@tonic-gate 29310Sstevel@tonic-gate# Need to handle passwd.adjunct.byname map for multiple domain. 29320Sstevel@tonic-gate_MAP=passwd.adjunct.byname 29330Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 29340Sstevel@tonic-gatethen 29350Sstevel@tonic-gate # Just put the syntax in comment form 29360Sstevel@tonic-gate echo "#nisLDAPcommentChar passwd.adjunct.byname: ''" >> $MAP_FILE 29370Sstevel@tonic-gateelse 29380Sstevel@tonic-gate # Find the domains in which this map exists. 29390Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 29400Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 29410Sstevel@tonic-gate then 29420Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 29430Sstevel@tonic-gate echo "nisLDAPcommentChar passwd.adjunct.byname: ''" >> $MAP_FILE 29440Sstevel@tonic-gate else 29450Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 29460Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 29470Sstevel@tonic-gate do 29480Sstevel@tonic-gate echo "nisLDAPcommentChar passwd.adjunct.byname,${_DMN}: ''" >> $MAP_FILE 29490Sstevel@tonic-gate done 29500Sstevel@tonic-gate fi 29510Sstevel@tonic-gatefi 29520Sstevel@tonic-gate# passwd.adjunct.byname done 29530Sstevel@tonic-gate 29540Sstevel@tonic-gate 29550Sstevel@tonic-gate# Need to handle group.adjunct.byname map for multiple domain. 29560Sstevel@tonic-gate_MAP=group.adjunct.byname 29570Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 29580Sstevel@tonic-gatethen 29590Sstevel@tonic-gate # Just put the syntax in comment form 29600Sstevel@tonic-gate echo "#nisLDAPcommentChar group.adjunct.byname: ''" >> $MAP_FILE 29610Sstevel@tonic-gateelse 29620Sstevel@tonic-gate # Find the domains in which this map exists. 29630Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 29640Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 29650Sstevel@tonic-gate then 29660Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 29670Sstevel@tonic-gate echo "nisLDAPcommentChar group.adjunct.byname: ''" >> $MAP_FILE 29680Sstevel@tonic-gate else 29690Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 29700Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 29710Sstevel@tonic-gate do 29720Sstevel@tonic-gate echo "nisLDAPcommentChar group.adjunct.byname,${_DMN}: ''" >> $MAP_FILE 29730Sstevel@tonic-gate done 29740Sstevel@tonic-gate fi 29750Sstevel@tonic-gatefi 29760Sstevel@tonic-gate# group.adjunct.byname done 29770Sstevel@tonic-gate 29780Sstevel@tonic-gateecho "" >> $MAP_FILE 29790Sstevel@tonic-gate 29800Sstevel@tonic-gate# Ask user for comment char for custom maps 29810Sstevel@tonic-gateget_custom_nisLDAPcommentChar 29820Sstevel@tonic-gate 29830Sstevel@tonic-gateecho " 29840Sstevel@tonic-gate# 29850Sstevel@tonic-gate#------------------------------------------------------------------------------ 29860Sstevel@tonic-gate# 29870Sstevel@tonic-gate" >> $MAP_FILE 29880Sstevel@tonic-gate} 29890Sstevel@tonic-gate 29900Sstevel@tonic-gate 29910Sstevel@tonic-gate# 29920Sstevel@tonic-gate# Generate secure flag entries 29930Sstevel@tonic-gate# 29940Sstevel@tonic-gatecreate_secure_flag_entries() 29950Sstevel@tonic-gate{ 29960Sstevel@tonic-gateecho "\ 29970Sstevel@tonic-gate# Specify YP_SECURE flags 29980Sstevel@tonic-gate" >> $MAP_FILE 29990Sstevel@tonic-gate 30000Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo "\ 30010Sstevel@tonic-gate# If a map is secure, then it needs to be mentioned here 30020Sstevel@tonic-gate# in the following format : 30030Sstevel@tonic-gate# nisLDAPmapFlags mapname : s 30040Sstevel@tonic-gate">> $MAP_FILE 30050Sstevel@tonic-gate 30060Sstevel@tonic-gate# Need to handle passwd.adjunct.byname map for multiple domain. 30070Sstevel@tonic-gate_MAP=passwd.adjunct.byname 30080Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 30090Sstevel@tonic-gatethen 30100Sstevel@tonic-gate # Just put the syntax in comment form 30110Sstevel@tonic-gate echo "#nisLDAPmapFlags passwd.adjunct.byname : s" >> $MAP_FILE 30120Sstevel@tonic-gateelse 30130Sstevel@tonic-gate # Find the domains in which this map exists. 30140Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 30150Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 30160Sstevel@tonic-gate then 30170Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 30180Sstevel@tonic-gate echo "nisLDAPmapFlags passwd.adjunct.byname : s" >> $MAP_FILE 30190Sstevel@tonic-gate else 30200Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 30210Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 30220Sstevel@tonic-gate do 30230Sstevel@tonic-gate echo "nisLDAPmapFlags passwd.adjunct.byname,${_DMN} : s" >> $MAP_FILE 30240Sstevel@tonic-gate done 30250Sstevel@tonic-gate fi 30260Sstevel@tonic-gatefi 30270Sstevel@tonic-gate 30280Sstevel@tonic-gate# Need to handle group.adjunct.byname map for multiple domain. 30290Sstevel@tonic-gate_MAP=group.adjunct.byname 30300Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 30310Sstevel@tonic-gatethen 30320Sstevel@tonic-gate # Just put the syntax in comment form 30330Sstevel@tonic-gate echo "#nisLDAPmapFlags group.adjunct.byname : s" >> $MAP_FILE 30340Sstevel@tonic-gateelse 30350Sstevel@tonic-gate # Find the domains in which this map exists. 30360Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 30370Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 30380Sstevel@tonic-gate then 30390Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 30400Sstevel@tonic-gate echo "nisLDAPmapFlags group.adjunct.byname : s" >> $MAP_FILE 30410Sstevel@tonic-gate else 30420Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 30430Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 30440Sstevel@tonic-gate do 30450Sstevel@tonic-gate echo "nisLDAPmapFlags group.adjunct.byname,${_DMN} : s" >> $MAP_FILE 30460Sstevel@tonic-gate done 30470Sstevel@tonic-gate fi 30480Sstevel@tonic-gatefi 30490Sstevel@tonic-gate 30500Sstevel@tonic-gateecho "" >> $MAP_FILE 30510Sstevel@tonic-gate 30520Sstevel@tonic-gateSTR="any" # Just to make the question look better. 30530Sstevel@tonic-gatewhile : 30540Sstevel@tonic-gatedo 30550Sstevel@tonic-gate get_confirm "Do you wish to set the secure flag for $STR map (y/n/h)?" \ 30560Sstevel@tonic-gate "n" "secure_flag_on_help" 30570Sstevel@tonic-gate 30580Sstevel@tonic-gate if [ $? -eq 0 ]; then 30590Sstevel@tonic-gate return 0 30600Sstevel@tonic-gate 30610Sstevel@tonic-gate else 30620Sstevel@tonic-gate get_ans "Enter the MAP name :" 30630Sstevel@tonic-gate MAP=$ANS 30640Sstevel@tonic-gate 30650Sstevel@tonic-gate if [[ $MAP = "" ]]; then 30660Sstevel@tonic-gate echo " Error : BLANK map name not allowed; try again" 30670Sstevel@tonic-gate continue 30680Sstevel@tonic-gate fi 30690Sstevel@tonic-gate 30700Sstevel@tonic-gate # Check if the supplied map name exists, and if yes, then 30710Sstevel@tonic-gate # set the PRESENT attributes for further processing 30720Sstevel@tonic-gate 30730Sstevel@tonic-gate find_map_presence_details $MAP 30740Sstevel@tonic-gate 30750Sstevel@tonic-gate case $PRESENT_COUNT in 30760Sstevel@tonic-gate 30770Sstevel@tonic-gate 0 ) echo " Error : $MAP not found in any domain; try again" 30780Sstevel@tonic-gate ;; 30790Sstevel@tonic-gate 30800Sstevel@tonic-gate 1 ) # The map exists in only one domain. 30810Sstevel@tonic-gate echo "nisLDAPmapFlags $MAP : s" >> $MAP_FILE 30820Sstevel@tonic-gate STR="another" # Just to make the question look better. 30830Sstevel@tonic-gate ;; 30840Sstevel@tonic-gate 30850Sstevel@tonic-gate * ) # The map exists in multiple domain. Ask if this flag needs 30860Sstevel@tonic-gate # to be set for all domains, or some specific ones. 30870Sstevel@tonic-gate 30880Sstevel@tonic-gate echo "Map \"$MAP\" is present in these domains : $PRESENT_IN_DOMAINS" 30890Sstevel@tonic-gate get_confirm "For this map, do you wish to set this flag for all the domains (y/n/h)?" \ 30900Sstevel@tonic-gate "y" "secure_flag_all_domains_help" 30910Sstevel@tonic-gate 30920Sstevel@tonic-gate if [ $? -eq 1 ]; then 30930Sstevel@tonic-gate echo "nisLDAPmapFlags $MAP : s" >> $MAP_FILE 30940Sstevel@tonic-gate else 30950Sstevel@tonic-gate 30960Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 30970Sstevel@tonic-gate do 30980Sstevel@tonic-gate 30990Sstevel@tonic-gate get_confirm_nodef "Set secure flag for $MAP,${_DMN} (y/n)?" 31000Sstevel@tonic-gate 31010Sstevel@tonic-gate if [ $? -eq 1 ]; then 31020Sstevel@tonic-gate echo "nisLDAPmapFlags $MAP,${_DMN} : s" >> $MAP_FILE 31030Sstevel@tonic-gate fi 31040Sstevel@tonic-gate 31050Sstevel@tonic-gate done 31060Sstevel@tonic-gate fi 31070Sstevel@tonic-gate STR="another" # Just to make the question look better. 31080Sstevel@tonic-gate ;; 31090Sstevel@tonic-gate 31100Sstevel@tonic-gate esac 31110Sstevel@tonic-gate 31120Sstevel@tonic-gate fi 31130Sstevel@tonic-gatedone 31140Sstevel@tonic-gate} 31150Sstevel@tonic-gate 31160Sstevel@tonic-gate 31170Sstevel@tonic-gate# 31180Sstevel@tonic-gate# Generate interdomain flag entries 31190Sstevel@tonic-gate# 31200Sstevel@tonic-gatecreate_interdomain_flag_entries() 31210Sstevel@tonic-gate{ 31220Sstevel@tonic-gate 31230Sstevel@tonic-gateINTERDOMAIN_MAP_LIST="ipnodes 31240Sstevel@tonic-gate multiipnodes 31250Sstevel@tonic-gate hosts 31260Sstevel@tonic-gate multihosts 31270Sstevel@tonic-gate services.byservicename" 31280Sstevel@tonic-gate 31290Sstevel@tonic-gate# 31300Sstevel@tonic-gate# Simple function to avoid duplication of code 31310Sstevel@tonic-gate# 31320Sstevel@tonic-gateprint_interdomain_entries() 31330Sstevel@tonic-gate{ 31340Sstevel@tonic-gatefor _MAP in $INTERDOMAIN_MAP_LIST 31350Sstevel@tonic-gatedo 31360Sstevel@tonic-gate echo "nisLDAPmapFlags ${_MAP} : b" >> $MAP_FILE 31370Sstevel@tonic-gatedone 31380Sstevel@tonic-gate} 31390Sstevel@tonic-gate 31400Sstevel@tonic-gateecho " 31410Sstevel@tonic-gate# Specify YP_INTERDOMAIN flags 31420Sstevel@tonic-gate" >> $MAP_FILE 31430Sstevel@tonic-gate 31440Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo "\ 31450Sstevel@tonic-gate# It is used to indicate NIS servers to use the domain name resolver for 31460Sstevel@tonic-gate# host name and address lookups for hosts not found in the maps. 31470Sstevel@tonic-gate# If set, it adds YP_INTERDOMAIN entries in these maps when converting 31480Sstevel@tonic-gate# data from LDAP to YP. It needs to be set in the following format : 31490Sstevel@tonic-gate# nisLDAPmapFlags mapname : b 31500Sstevel@tonic-gate" >> $MAP_FILE 31510Sstevel@tonic-gate 31520Sstevel@tonic-gate# List one set of entries in commented form anyway as it might help 31530Sstevel@tonic-gate# user understand what it means. 31540Sstevel@tonic-gate 31550Sstevel@tonic-gateecho "\ 31560Sstevel@tonic-gate# If \$B is set in /var/yp/Makefile, then this flag should be 31570Sstevel@tonic-gate# set for following maps :\ 31580Sstevel@tonic-gate" >> $MAP_FILE 31590Sstevel@tonic-gate 31600Sstevel@tonic-gatefor _MAP in $INTERDOMAIN_MAP_LIST 31610Sstevel@tonic-gatedo 31620Sstevel@tonic-gate echo "# nisLDAPmapFlags ${_MAP} : b" >> $MAP_FILE 31630Sstevel@tonic-gatedone 31640Sstevel@tonic-gate 31650Sstevel@tonic-gate# Put a blank line for indentation purpose 31660Sstevel@tonic-gateecho >> $MAP_FILE 31670Sstevel@tonic-gate 31680Sstevel@tonic-gateget_confirm "Do you wish to set the \"interdomain\" flag for any domain (y/n/h)?" \ 31690Sstevel@tonic-gate "n" "interdomain_flag_on_help" 31700Sstevel@tonic-gate 31710Sstevel@tonic-gateif [ $? -eq 1 ]; then 31720Sstevel@tonic-gate 31730Sstevel@tonic-gate if [ $N2L_DMN_CNT -gt 1 ]; then 31740Sstevel@tonic-gate 31750Sstevel@tonic-gate get_confirm "Should \"interdomain\" flag be set for all domain (y/n/h)?" \ 31760Sstevel@tonic-gate "y" "interdomain_flag_all_domains_help" 31770Sstevel@tonic-gate 31780Sstevel@tonic-gate if [ $? -eq 1 ]; then 31790Sstevel@tonic-gate print_interdomain_entries 31800Sstevel@tonic-gate else 31810Sstevel@tonic-gate 31820Sstevel@tonic-gate for _DMN in ${N2L_DMN_LIST[*]} 31830Sstevel@tonic-gate do 31840Sstevel@tonic-gate get_confirm_nodef "Set interdomain flag for ${_DMN} (y/n)?" 31850Sstevel@tonic-gate 31860Sstevel@tonic-gate if [ $? -eq 1 ]; then 31870Sstevel@tonic-gate for _MAP in $INTERDOMAIN_MAP_LIST 31880Sstevel@tonic-gate do 31890Sstevel@tonic-gate echo "nisLDAPmapFlags ${_MAP},${_DMN} : b" >> $MAP_FILE 31900Sstevel@tonic-gate done 31910Sstevel@tonic-gate fi 31920Sstevel@tonic-gate 31930Sstevel@tonic-gate done 31940Sstevel@tonic-gate fi 31950Sstevel@tonic-gate 31960Sstevel@tonic-gate else 31970Sstevel@tonic-gate print_interdomain_entries 31980Sstevel@tonic-gate fi 31990Sstevel@tonic-gatefi 32000Sstevel@tonic-gate 32010Sstevel@tonic-gateecho " 32020Sstevel@tonic-gate# 32030Sstevel@tonic-gate#------------------------------------------------------------------------------ 32040Sstevel@tonic-gate# 32050Sstevel@tonic-gate" >> $MAP_FILE 32060Sstevel@tonic-gate 32070Sstevel@tonic-gatereturn 0 32080Sstevel@tonic-gate} 32090Sstevel@tonic-gate 32100Sstevel@tonic-gate 32110Sstevel@tonic-gate# 32120Sstevel@tonic-gate# List SECURE and INTERDOMAIN flags 32130Sstevel@tonic-gate# 32140Sstevel@tonic-gatecreate_nisLDAPmapFlags() 32150Sstevel@tonic-gate{ 32160Sstevel@tonic-gatecreate_secure_flag_entries 32170Sstevel@tonic-gatecreate_interdomain_flag_entries 32180Sstevel@tonic-gate} 32190Sstevel@tonic-gate 32200Sstevel@tonic-gate 32210Sstevel@tonic-gate# 32220Sstevel@tonic-gate# Print one Map TTL entry in mapping file using supplied TTL. 32230Sstevel@tonic-gate# 32240Sstevel@tonic-gateprint_one_map_ttl_entry() 32250Sstevel@tonic-gate{ 32260Sstevel@tonic-gate_Map=$1 32270Sstevel@tonic-gate_iTtlLo=$2 32280Sstevel@tonic-gate_iTtlHi=$3 32290Sstevel@tonic-gate_runTtl=$4 32300Sstevel@tonic-gate 32310Sstevel@tonic-gateecho "\ 32320Sstevel@tonic-gatenisLDAPentryTtl ${_Map}:${_iTtlLo}:${_iTtlHi}:${_runTtl}\ 32330Sstevel@tonic-gate" >> $MAP_FILE 32340Sstevel@tonic-gate 32350Sstevel@tonic-gatereturn 0 32360Sstevel@tonic-gate} 32370Sstevel@tonic-gate 32380Sstevel@tonic-gate 32390Sstevel@tonic-gate# 32400Sstevel@tonic-gate# Print all the maps TTL entries of same TTL 32410Sstevel@tonic-gate# values using the supplied TTL triplet. 32420Sstevel@tonic-gate# 32430Sstevel@tonic-gateprint_all_same_ttl_entries() 32440Sstevel@tonic-gate{ 32450Sstevel@tonic-gate_iTTLlo=$1 32460Sstevel@tonic-gate_iTTLhi=$2 32470Sstevel@tonic-gate_runTTL=$3 32480Sstevel@tonic-gate 32490Sstevel@tonic-gatefor _MAP in ${DEF_TTL_MAPLIST} ${ALL_DMN_CUST_MAPS[*]} \ 32500Sstevel@tonic-gate ${ALL_DMN_AUTO_CUST_MAPS[*]} 32510Sstevel@tonic-gatedo 32520Sstevel@tonic-gate 32530Sstevel@tonic-gate if [ "$_MAP" != "passwd.adjunct.byname" ] && \ 32540Sstevel@tonic-gate [ "$_MAP" != "group.adjunct.byname" ] 32550Sstevel@tonic-gate then 32560Sstevel@tonic-gate print_one_map_ttl_entry $_MAP $_iTTLlo $_iTTLhi $_runTTL 32570Sstevel@tonic-gate 32580Sstevel@tonic-gate else 32590Sstevel@tonic-gate 32600Sstevel@tonic-gate # adjunct maps might not exist in all the domains. 32610Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 32620Sstevel@tonic-gate 32630Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 32640Sstevel@tonic-gate then 32650Sstevel@tonic-gate 32660Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 32670Sstevel@tonic-gate print_one_map_ttl_entry $_MAP $_iTTLlo $_iTTLhi $_runTTL 32680Sstevel@tonic-gate 32690Sstevel@tonic-gate else 32700Sstevel@tonic-gate 32710Sstevel@tonic-gate for _DMN_ in $PRESENT_IN_DOMAINS 32720Sstevel@tonic-gate do 32730Sstevel@tonic-gate _STR="${_MAP},${_DMN_}" 32740Sstevel@tonic-gate print_one_map_ttl_entry $_STR $_iTTLlo $_iTTLhi $_runTTL 32750Sstevel@tonic-gate done 32760Sstevel@tonic-gate 32770Sstevel@tonic-gate fi 32780Sstevel@tonic-gate fi 32790Sstevel@tonic-gatedone 32800Sstevel@tonic-gate 32810Sstevel@tonic-gatereturn 0 32820Sstevel@tonic-gate} 32830Sstevel@tonic-gate 32840Sstevel@tonic-gate# 32850Sstevel@tonic-gate# Read the initialTTLlo. Set the value in global variable. 32860Sstevel@tonic-gate# 32870Sstevel@tonic-gateget_ittl_lo() 32880Sstevel@tonic-gate{ 32890Sstevel@tonic-gateget_pos_int "Lower limit for initial TTL (in seconds) (h=help):" \ 32900Sstevel@tonic-gate "$DEF_iTTLlo" "initialTTLlo_help" 32910Sstevel@tonic-gate 32920Sstevel@tonic-gateiTTLlo=${NUM} 32930Sstevel@tonic-gate} 32940Sstevel@tonic-gate 32950Sstevel@tonic-gate 32960Sstevel@tonic-gate# 32970Sstevel@tonic-gate# Read the initialTTLhi. Set the value in global variable. 32980Sstevel@tonic-gate# 32990Sstevel@tonic-gateget_ittl_hi() 33000Sstevel@tonic-gate{ 33010Sstevel@tonic-gateget_pos_int "Higher limit for initial TTL (in seconds) (h=help):" \ 33020Sstevel@tonic-gate "$DEF_iTTLhi" "initialTTLhi_help" 33030Sstevel@tonic-gate 33040Sstevel@tonic-gateiTTLhi=${NUM} 33050Sstevel@tonic-gate} 33060Sstevel@tonic-gate 33070Sstevel@tonic-gate 33080Sstevel@tonic-gate# 33090Sstevel@tonic-gate# Read the initialTTLhi. Set the value in global variable. 33100Sstevel@tonic-gate# 33110Sstevel@tonic-gateget_run_ttl() 33120Sstevel@tonic-gate{ 33130Sstevel@tonic-gateget_pos_int "Runtime TTL (in seconds) (h=help):" \ 33140Sstevel@tonic-gate "$DEF_runTTL" "runningTTL_help" 33150Sstevel@tonic-gate 33160Sstevel@tonic-gaterunTTL=${NUM} 33170Sstevel@tonic-gate} 33180Sstevel@tonic-gate 33190Sstevel@tonic-gate 33200Sstevel@tonic-gate# 33210Sstevel@tonic-gate# Read one TTL triplet. Set the result in global variables. 33220Sstevel@tonic-gate# 33230Sstevel@tonic-gateread_one_ttl_triplet() 33240Sstevel@tonic-gate{ 33250Sstevel@tonic-gate# Just call the individual functions for each TTL. 33260Sstevel@tonic-gate 33270Sstevel@tonic-gate get_ittl_lo 33280Sstevel@tonic-gate get_ittl_hi 33290Sstevel@tonic-gate get_run_ttl 33300Sstevel@tonic-gate 33310Sstevel@tonic-gate[ $DEBUG -eq 1 ] && \ 33320Sstevel@tonic-gate echo "TTL = ${iTTLlo}:${iTTLhi}:${runTTL}" 33330Sstevel@tonic-gate 33340Sstevel@tonic-gatereturn 0 33350Sstevel@tonic-gate} 33360Sstevel@tonic-gate 33370Sstevel@tonic-gate# 33380Sstevel@tonic-gate# Takes MAP name (with or without domain name) as argument, asks 33390Sstevel@tonic-gate# user for TTL values, and appends the entry in the mapping file. 33400Sstevel@tonic-gate# 33410Sstevel@tonic-gateprocess_one_map_ttl_value() 33420Sstevel@tonic-gate{ 33430Sstevel@tonic-gate 33440Sstevel@tonic-gate_Map_="$1" 33450Sstevel@tonic-gate 33460Sstevel@tonic-gateget_confirm "Retain the default TTL values [$DEF_iTTLlo:$DEF_iTTLhi:$DEF_runTTL] for \"$_Map_\" (y/n/h) ?" \ 33470Sstevel@tonic-gate "y" "default_different_ttl_help" 33480Sstevel@tonic-gate 33490Sstevel@tonic-gateif [ $? -eq 1 ]; then 33500Sstevel@tonic-gate print_one_map_ttl_entry $_Map_ $DEF_iTTLlo $DEF_iTTLhi $DEF_runTTL 33510Sstevel@tonic-gateelse 33520Sstevel@tonic-gate 33530Sstevel@tonic-gate echo "Reading TTL values for $_Map_ :" 33540Sstevel@tonic-gate read_one_ttl_triplet 33550Sstevel@tonic-gate print_one_map_ttl_entry $_Map_ $iTTLlo $iTTLhi $runTTL 33560Sstevel@tonic-gate 33570Sstevel@tonic-gatefi 33580Sstevel@tonic-gatereturn 0 33590Sstevel@tonic-gate} 33600Sstevel@tonic-gate 33610Sstevel@tonic-gate 33620Sstevel@tonic-gate# 33630Sstevel@tonic-gate# Read only one TTL triplet for each existing MAP without asking 33640Sstevel@tonic-gate# different values for each domain and update the mapping file. 33650Sstevel@tonic-gate# 33660Sstevel@tonic-gateread_all_maps_ttl_values_no_multiple_domain_issue() 33670Sstevel@tonic-gate{ 33680Sstevel@tonic-gate 33690Sstevel@tonic-gate# Need to read only one TTL triplet for each existing MAP. 33700Sstevel@tonic-gate 33710Sstevel@tonic-gatefor _MAP in ${DEF_TTL_MAPLIST} ${ALL_DMN_CUST_MAPS[*]} \ 33720Sstevel@tonic-gate ${ALL_DMN_AUTO_CUST_MAPS[*]} 33730Sstevel@tonic-gatedo 33740Sstevel@tonic-gate 33750Sstevel@tonic-gate if [ "$_MAP" != "passwd.adjunct.byname" ] && \ 33760Sstevel@tonic-gate [ "$_MAP" != "group.adjunct.byname" ] 33770Sstevel@tonic-gate then 33780Sstevel@tonic-gate process_one_map_ttl_value $_MAP 33790Sstevel@tonic-gate 33800Sstevel@tonic-gate else 33810Sstevel@tonic-gate 33820Sstevel@tonic-gate # adjunct maps might not exist in all the domains. 33830Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 33840Sstevel@tonic-gate 33850Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 33860Sstevel@tonic-gate then 33870Sstevel@tonic-gate 33880Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 33890Sstevel@tonic-gate process_one_map_ttl_value $_MAP 33900Sstevel@tonic-gate 33910Sstevel@tonic-gate else 33920Sstevel@tonic-gate 33930Sstevel@tonic-gate for _DMN_ in $PRESENT_IN_DOMAINS 33940Sstevel@tonic-gate do 33950Sstevel@tonic-gate _STR="${_MAP},${_DMN_}" 33960Sstevel@tonic-gate process_one_map_ttl_value $_STR 33970Sstevel@tonic-gate done 33980Sstevel@tonic-gate 33990Sstevel@tonic-gate fi 34000Sstevel@tonic-gate fi 34010Sstevel@tonic-gatedone 34020Sstevel@tonic-gate 34030Sstevel@tonic-gatereturn 0 34040Sstevel@tonic-gate} 34050Sstevel@tonic-gate 34060Sstevel@tonic-gate 34070Sstevel@tonic-gate# 34080Sstevel@tonic-gate# Read TTL triplet for each default MAP (in database ID form) while 34090Sstevel@tonic-gate# taking care of multiple domains issue and update the mapping file. 34100Sstevel@tonic-gate# 34110Sstevel@tonic-gateread_default_maps_ttl_values_with_multi_domain_issue() 34120Sstevel@tonic-gate{ 34130Sstevel@tonic-gate 34140Sstevel@tonic-gatefor _MAP_ in ${DEF_TTL_MAPLIST} 34150Sstevel@tonic-gatedo 34160Sstevel@tonic-gate if [ "$_MAP_" != "passwd.adjunct.byname" ] && \ 34170Sstevel@tonic-gate [ "$_MAP_" != "group.adjunct.byname" ] 34180Sstevel@tonic-gate then 34190Sstevel@tonic-gate 34200Sstevel@tonic-gate for _DMN_ in ${N2L_DMN_LIST[*]} 34210Sstevel@tonic-gate do 34220Sstevel@tonic-gate _STR_="${_MAP_},${_DMN_}" 34230Sstevel@tonic-gate # Now process each combination one at a time. 34240Sstevel@tonic-gate process_one_map_ttl_value "$_STR_" 34250Sstevel@tonic-gate done 34260Sstevel@tonic-gate 34270Sstevel@tonic-gate else 34280Sstevel@tonic-gate # List only those domains in which adjunct.byname exists. 34290Sstevel@tonic-gate find_domains $_MAP_ DEF_MAPS 34300Sstevel@tonic-gate for _DMN_ in $PRESENT_IN_DOMAINS 34310Sstevel@tonic-gate do 34320Sstevel@tonic-gate _STR_="${_MAP_},${_DMN_}" 34330Sstevel@tonic-gate process_one_map_ttl_value "$_STR_" 34340Sstevel@tonic-gate done 34350Sstevel@tonic-gate fi 34360Sstevel@tonic-gatedone 34370Sstevel@tonic-gate 34380Sstevel@tonic-gatereturn 0 34390Sstevel@tonic-gate} 34400Sstevel@tonic-gate 34410Sstevel@tonic-gate 34420Sstevel@tonic-gate# 34430Sstevel@tonic-gate# Read TTL triplet for each existing custom MAP while taking 34440Sstevel@tonic-gate# care of multiple domains issue and update the mapping file. 34450Sstevel@tonic-gate# 34460Sstevel@tonic-gateread_custom_maps_ttl_values_with_multi_domain_issue() 34470Sstevel@tonic-gate{ 34480Sstevel@tonic-gate 34490Sstevel@tonic-gatefor _MAP_ in ${ALL_DMN_CUST_MAPS[*]} ${ALL_DMN_AUTO_CUST_MAPS[*]} 34500Sstevel@tonic-gatedo 34510Sstevel@tonic-gate 34520Sstevel@tonic-gate find_map_presence_details $_MAP_ 34530Sstevel@tonic-gate 34540Sstevel@tonic-gate if [ $PRESENT_COUNT -eq 1 ]; then 34550Sstevel@tonic-gate 34560Sstevel@tonic-gate # This map exists in only one domain. 34570Sstevel@tonic-gate # So, no need to ask for multiple domains. 34580Sstevel@tonic-gate 34590Sstevel@tonic-gate process_one_map_ttl_value $_MAP_ 34600Sstevel@tonic-gate 34610Sstevel@tonic-gate else 34620Sstevel@tonic-gate 34630Sstevel@tonic-gate # Handle multiple domains. 34640Sstevel@tonic-gate 34650Sstevel@tonic-gate echo "Map \"${_MAP_}\" is present in these domains : $PRESENT_IN_DOMAINS" 34660Sstevel@tonic-gate 34670Sstevel@tonic-gate get_confirm "For this map, do you wish to use the same TTL values for all the domains (y/n/h) ?" \ 34680Sstevel@tonic-gate "y" "same_ttl_across_domains_help" 34690Sstevel@tonic-gate 34700Sstevel@tonic-gate if [ $? -eq 1 ]; then 34710Sstevel@tonic-gate 34720Sstevel@tonic-gate # Need to read only one TTL triplet for this MAP. 34730Sstevel@tonic-gate process_one_map_ttl_value $_MAP_ 34740Sstevel@tonic-gate 34750Sstevel@tonic-gate else 34760Sstevel@tonic-gate 34770Sstevel@tonic-gate # Need to ask for each domain 34780Sstevel@tonic-gate 34790Sstevel@tonic-gate for _DMN_ in $PRESENT_IN_DOMAINS 34800Sstevel@tonic-gate do 34810Sstevel@tonic-gate _STR="${_MAP_},${_DMN_}" 34820Sstevel@tonic-gate 34830Sstevel@tonic-gate # Now process each combination one at a time. 34840Sstevel@tonic-gate process_one_map_ttl_value "$_STR" 34850Sstevel@tonic-gate 34860Sstevel@tonic-gate done 34870Sstevel@tonic-gate fi 34880Sstevel@tonic-gate fi 34890Sstevel@tonic-gatedone 34900Sstevel@tonic-gate 34910Sstevel@tonic-gatereturn 0 34920Sstevel@tonic-gate} 34930Sstevel@tonic-gate 34940Sstevel@tonic-gate 34950Sstevel@tonic-gate# 34960Sstevel@tonic-gate# List the TTL values for various MAPs 34970Sstevel@tonic-gate# 34980Sstevel@tonic-gatecreate_nisLDAPentryTtl() 34990Sstevel@tonic-gate{ 35000Sstevel@tonic-gate 35010Sstevel@tonic-gateecho "\ 35020Sstevel@tonic-gate# Associate TTLs with NIS entries derived from LDAP 35030Sstevel@tonic-gate" >> $MAP_FILE 35040Sstevel@tonic-gate 35050Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo "\ 35060Sstevel@tonic-gate# Each map has three TTL values which are specified in seconds. 35070Sstevel@tonic-gate# 1. initialTTLlo (default $DEF_iTTLlo sec) The lower limit for the initial 35080Sstevel@tonic-gate# TTL (in seconds) for data read from disk when the ypserv starts. 35090Sstevel@tonic-gate# 35100Sstevel@tonic-gate# 2. initialTTLhi (default $DEF_iTTLhi sec) The upper limit for initial TTL. 35110Sstevel@tonic-gate# 35120Sstevel@tonic-gate# 3. runningTTL (default $DEF_runTTL sec) The TTL (in seconds) for data 35130Sstevel@tonic-gate# retrieved from LDAP while the ypserv is running. 35140Sstevel@tonic-gate# 35150Sstevel@tonic-gate# If any value is not specified, then default value is used. 35160Sstevel@tonic-gate# The format of TTL entry is : 35170Sstevel@tonic-gate# nisLDAPentryTtl MAP[,DOMAIN]:initialTTLlo:initialTTLhi:runningTTL 35180Sstevel@tonic-gate" >> $MAP_FILE 35190Sstevel@tonic-gate 35200Sstevel@tonic-gate# If no maps are present, just return. 35210Sstevel@tonic-gate[ ${#ALL_DMN_ALL_MAPS[*]} -eq 0 ] && return 0 35220Sstevel@tonic-gate 35230Sstevel@tonic-gateecho "The default TTL for each map is set to ${DEF_iTTLlo}:${DEF_iTTLhi}:${DEF_runTTL}" 35240Sstevel@tonic-gateget_confirm "Do you wish to change the TTL values for any map (y/n/h) ?" \ 35250Sstevel@tonic-gate "n" "default_ttl_help" 35260Sstevel@tonic-gate 35270Sstevel@tonic-gateif [ $? -eq 0 ]; then 35280Sstevel@tonic-gate # Default values accepted for all the maps. 35290Sstevel@tonic-gate # So, just print all the maps with default TTL values. 35300Sstevel@tonic-gate 35310Sstevel@tonic-gate print_all_same_ttl_entries $DEF_iTTLlo $DEF_iTTLhi $DEF_runTTL 35320Sstevel@tonic-gate 35330Sstevel@tonic-gateelse 35340Sstevel@tonic-gate echo "You would be allowed to enter the new TTL values." 35350Sstevel@tonic-gate get_confirm "Do you wish to use the same TTL values for all the maps (y/n/h) ?" \ 35360Sstevel@tonic-gate "y" "non_default_same_ttl_help" 35370Sstevel@tonic-gate 35380Sstevel@tonic-gate if [ $? -eq 1 ]; then 35390Sstevel@tonic-gate # Need to read only one TTL triplet. 35400Sstevel@tonic-gate # Print all the maps with new TTL triplet. 35410Sstevel@tonic-gate 35420Sstevel@tonic-gate # read one ttl triplet 35430Sstevel@tonic-gate echo "Enter the new TTL values :" 35440Sstevel@tonic-gate 35450Sstevel@tonic-gate read_one_ttl_triplet 35460Sstevel@tonic-gate 35470Sstevel@tonic-gate print_all_same_ttl_entries $iTTLlo $iTTLhi $runTTL 35480Sstevel@tonic-gate 35490Sstevel@tonic-gate else 35500Sstevel@tonic-gate if [ $N2L_DMN_CNT -eq 1 ]; then 35510Sstevel@tonic-gate 35520Sstevel@tonic-gate # TTL values are different now. But we haev only one domain. 35530Sstevel@tonic-gate # So, no need to worry about multiple domains. Need to read 35540Sstevel@tonic-gate # only one TTL triplet for each existing MAP. 35550Sstevel@tonic-gate 35560Sstevel@tonic-gate read_all_maps_ttl_values_no_multiple_domain_issue 35570Sstevel@tonic-gate 35580Sstevel@tonic-gate else 35590Sstevel@tonic-gate 35600Sstevel@tonic-gate # TTL values are different now. And we have multiple domains 35610Sstevel@tonic-gate # too. Check if MAPS are going to have same TTL across domains. 35620Sstevel@tonic-gate # This is just to avoid asking too many TTL triplet inputs 35630Sstevel@tonic-gate 35640Sstevel@tonic-gate echo "You would be allowed to enter different TTL values for each map." 35650Sstevel@tonic-gate 35660Sstevel@tonic-gate get_confirm "For a given map, do you wish to use the same TTL values for all the domains (y/n/h) ?" \ 35670Sstevel@tonic-gate "y" "non_default_different_ttl_help" 35680Sstevel@tonic-gate 35690Sstevel@tonic-gate if [ $? -eq 1 ]; then 35700Sstevel@tonic-gate 35710Sstevel@tonic-gate # Need to read only one TTL triplet for each existing MAP. 35720Sstevel@tonic-gate read_all_maps_ttl_values_no_multiple_domain_issue 35730Sstevel@tonic-gate 35740Sstevel@tonic-gate else 35750Sstevel@tonic-gate 35760Sstevel@tonic-gate # We have hit the worst case scenario. TTLs could be 35770Sstevel@tonic-gate # different per map and per domain. 35780Sstevel@tonic-gate 35790Sstevel@tonic-gate read_default_maps_ttl_values_with_multi_domain_issue 35800Sstevel@tonic-gate read_custom_maps_ttl_values_with_multi_domain_issue 35810Sstevel@tonic-gate fi 35820Sstevel@tonic-gate fi 35830Sstevel@tonic-gate fi 35840Sstevel@tonic-gatefi 35850Sstevel@tonic-gate 35860Sstevel@tonic-gateecho " 35870Sstevel@tonic-gate# 35880Sstevel@tonic-gate#------------------------------------------------------------------------------ 35890Sstevel@tonic-gate# 35900Sstevel@tonic-gate" >> $MAP_FILE 35910Sstevel@tonic-gate 35920Sstevel@tonic-gatereturn 0 35930Sstevel@tonic-gate} 35940Sstevel@tonic-gate 35950Sstevel@tonic-gate 35960Sstevel@tonic-gate# 35970Sstevel@tonic-gate# The custom maps for which we do not have enough 35980Sstevel@tonic-gate# information to be able to generate specific entries, 35990Sstevel@tonic-gate# we just log the message that the user needs to take 36000Sstevel@tonic-gate# care of those entries manually. 36010Sstevel@tonic-gate# 36020Sstevel@tonic-gateask_user_to_update_the_custom_map_entries_too() 36030Sstevel@tonic-gate{ 36040Sstevel@tonic-gate 36050Sstevel@tonic-gateif [ ${#ALL_DMN_CUST_MAPS[*]} -gt 0 ]; then 36060Sstevel@tonic-gate 36070Sstevel@tonic-gate echo " 36080Sstevel@tonic-gate# Similar entries need to be created 36090Sstevel@tonic-gate# for following custom maps too :\ 36100Sstevel@tonic-gate" >> $MAP_FILE 36110Sstevel@tonic-gate 36120Sstevel@tonic-gate for _MAP in ${ALL_DMN_CUST_MAPS[*]} 36130Sstevel@tonic-gate do 36140Sstevel@tonic-gate echo "# $_MAP" >> $MAP_FILE 36150Sstevel@tonic-gate done 36160Sstevel@tonic-gatefi 36170Sstevel@tonic-gate} 36180Sstevel@tonic-gate 36190Sstevel@tonic-gate 36200Sstevel@tonic-gateput_default_nisLDAPnameFields() 36210Sstevel@tonic-gate{ 36220Sstevel@tonic-gateecho ' 36230Sstevel@tonic-gate# Associate names with fields in the maps. Must be same for all domains. 36240Sstevel@tonic-gatenisLDAPnameFields audit_user: \ 36250Sstevel@tonic-gate ("%s:%s:%s", name, alwaysAuditFlags, neverAuditFlags) 36260Sstevel@tonic-gate 36270Sstevel@tonic-gatenisLDAPnameFields auto.home: \ 36280Sstevel@tonic-gate ("%s",value) 36290Sstevel@tonic-gate 36300Sstevel@tonic-gatenisLDAPnameFields auto.master: \ 36310Sstevel@tonic-gate ("%s",value) 36320Sstevel@tonic-gate 36330Sstevel@tonic-gatenisLDAPnameFields auth_attr: \ 36340Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s", \ 36350Sstevel@tonic-gate name, res1, res2, short_desc, long_desc, attrs ) 36360Sstevel@tonic-gate 36370Sstevel@tonic-gatenisLDAPnameFields bootparams: \ 36380Sstevel@tonic-gate ("%s", params) 36390Sstevel@tonic-gate 36400Sstevel@tonic-gatenisLDAPnameFields ethers: \ 36410Sstevel@tonic-gate ("%s %s", addr, name) 36420Sstevel@tonic-gate 36430Sstevel@tonic-gatenisLDAPnameFields exec_attr: \ 36440Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s:%s", \ 36450Sstevel@tonic-gate name, policy, type, res1, res2, id, attrs) 36460Sstevel@tonic-gate 36470Sstevel@tonic-gatenisLDAPnameFields group: \ 36480Sstevel@tonic-gate ("%s:%s:%s:%s", name, passwd, gid, users) 36490Sstevel@tonic-gate' >> $MAP_FILE 36500Sstevel@tonic-gate 36510Sstevel@tonic-gate# Need to handle group.adjunct.byname map for multiple domain. 36520Sstevel@tonic-gate 36530Sstevel@tonic-gate_MAP=group.adjunct.byname 36540Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 36550Sstevel@tonic-gatethen 36560Sstevel@tonic-gate # Just put the syntax in comment form 36570Sstevel@tonic-gate echo '#nisLDAPnameFields group.adjunct.byname: \ 36580Sstevel@tonic-gate# ("%s:%s", name, passwd) 36590Sstevel@tonic-gate' >> $MAP_FILE 36600Sstevel@tonic-gateelse 36610Sstevel@tonic-gate # Find the domains in which this map exists. 36620Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 36630Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 36640Sstevel@tonic-gate then 36650Sstevel@tonic-gate 36660Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 36670Sstevel@tonic-gate echo 'nisLDAPnameFields group.adjunct.byname: \ 36680Sstevel@tonic-gate ("%s:%s", name, passwd) 36690Sstevel@tonic-gate' >> $MAP_FILE 36700Sstevel@tonic-gate else 36710Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 36720Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 36730Sstevel@tonic-gate do 36740Sstevel@tonic-gate echo "nisLDAPnameFields group.adjunct.byname,${_DMN}: \\ 36750Sstevel@tonic-gate (\"%s:%s\", name, passwd) 36760Sstevel@tonic-gate" >> $MAP_FILE 36770Sstevel@tonic-gate done 36780Sstevel@tonic-gate fi 36790Sstevel@tonic-gatefi 36800Sstevel@tonic-gate 36810Sstevel@tonic-gateecho 'nisLDAPnameFields keys.host: \ 36820Sstevel@tonic-gate ("%s:%s", publicKey ,secretKey) 36830Sstevel@tonic-gate 36840Sstevel@tonic-gatenisLDAPnameFields keys.pass: \ 36850Sstevel@tonic-gate ("%s:%s", publicKey ,secretKey) 36860Sstevel@tonic-gate 36870Sstevel@tonic-gatenisLDAPnameFields keys.nobody: \ 36880Sstevel@tonic-gate ("%s:%s", publicKey ,secretKey) 36890Sstevel@tonic-gate 36900Sstevel@tonic-gatenisLDAPnameFields hosts: \ 36910Sstevel@tonic-gate ("%a %s %s", addr, canonicalName, aliases) 36920Sstevel@tonic-gate 36930Sstevel@tonic-gatenisLDAPnameFields multihosts: \ 36940Sstevel@tonic-gate ("%a %s %s", addr, canonicalName, aliases) 36950Sstevel@tonic-gate 36960Sstevel@tonic-gatenisLDAPnameFields ipnodes: \ 36970Sstevel@tonic-gate ("%a %s %s", addr, canonicalName, aliases) 36980Sstevel@tonic-gate 36990Sstevel@tonic-gatenisLDAPnameFields multiipnodes: \ 37000Sstevel@tonic-gate ("%a %s %s", addr, canonicalName, aliases) 37010Sstevel@tonic-gate 37020Sstevel@tonic-gatenisLDAPnameFields mail.aliases: \ 37030Sstevel@tonic-gate ("%s", addresses) 37040Sstevel@tonic-gate 37050Sstevel@tonic-gatenisLDAPnameFields mail.mapping: \ 37060Sstevel@tonic-gate ("%s", address) 37070Sstevel@tonic-gate 37080Sstevel@tonic-gate# memberTriples is split into sub-fields by a latter nisLDAPsplitField 37090Sstevel@tonic-gate# attribute. 37100Sstevel@tonic-gatenisLDAPnameFields netgroup: \ 37110Sstevel@tonic-gate ("%s", memberTriples) 37120Sstevel@tonic-gate 37130Sstevel@tonic-gatenisLDAPnameFields netid.host: \ 37140Sstevel@tonic-gate ("%s:%s", number, data) 37150Sstevel@tonic-gate 37160Sstevel@tonic-gatenisLDAPnameFields netid.pass: \ 37170Sstevel@tonic-gate ("%s:%s", number, data) 37180Sstevel@tonic-gate 37190Sstevel@tonic-gatenisLDAPnameFields netmasks.byaddr: \ 37200Sstevel@tonic-gate ("%a", mask) 37210Sstevel@tonic-gate 37220Sstevel@tonic-gatenisLDAPnameFields networks: \ 37230Sstevel@tonic-gate ("%s %s %s", name, number, aliases) 37240Sstevel@tonic-gate 37250Sstevel@tonic-gatenisLDAPnameFields project: \ 37260Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s", \ 37270Sstevel@tonic-gate name, projID, comment, users, groups, attrs) 37280Sstevel@tonic-gate 37290Sstevel@tonic-gatenisLDAPnameFields protocols: \ 37300Sstevel@tonic-gate ("%s %s %s", name, number, aliases) 37310Sstevel@tonic-gate 37320Sstevel@tonic-gatenisLDAPnameFields rpc.bynumber: \ 37330Sstevel@tonic-gate ("%s %s %s", name, number, aliases) 37340Sstevel@tonic-gate 37350Sstevel@tonic-gatenisLDAPnameFields passwd: \ 37360Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s:%s", \ 37370Sstevel@tonic-gate name, passwd, uid, gid, gecos, home, shell) 37380Sstevel@tonic-gate 37390Sstevel@tonic-gate# It is not obvious what the fields in passwd.adjunct are for. They are not 37400Sstevel@tonic-gate# the same as the shadow map. The following is based on information in:- 37410Sstevel@tonic-gate# 37420Sstevel@tonic-gate# lib/libbc/inc/include/pwdadj.h. 37430Sstevel@tonic-gate# 37440Sstevel@tonic-gate# This file implies that these are documented in getpwaent(3) but this man page 37450Sstevel@tonic-gate# does not seem to exist. 37460Sstevel@tonic-gate# 37470Sstevel@tonic-gate# It is believed that 'min','max' and 'def' labels were reserved fields in 37480Sstevel@tonic-gate# SunOS 4.x and are now unused. 'always' and 'never' audit information is 37490Sstevel@tonic-gate# now contained in audit_user(4) so is now unused. 37500Sstevel@tonic-gate# 37510Sstevel@tonic-gate' >> $MAP_FILE 37520Sstevel@tonic-gate 37530Sstevel@tonic-gate# Need to handle passwd.adjunct.byname map for multiple domain. 37540Sstevel@tonic-gate 37550Sstevel@tonic-gate_MAP=passwd.adjunct.byname 37560Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 37570Sstevel@tonic-gatethen 37580Sstevel@tonic-gate # Just put the syntax in comment form 37590Sstevel@tonic-gate echo '#nisLDAPnameFields passwd.adjunct.byname: \ 37600Sstevel@tonic-gate# ("%s:%s:%s:%s:%s:%s:%s", \ 37610Sstevel@tonic-gate# name, passwd, min, max, def, always, \ 37620Sstevel@tonic-gate# never) 37630Sstevel@tonic-gate' >> $MAP_FILE 37640Sstevel@tonic-gateelse 37650Sstevel@tonic-gate # Find the domains in which this map exists. 37660Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 37670Sstevel@tonic-gate 37680Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 37690Sstevel@tonic-gate then 37700Sstevel@tonic-gate 37710Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 37720Sstevel@tonic-gate echo 'nisLDAPnameFields passwd.adjunct.byname: \ 37730Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s:%s", \ 37740Sstevel@tonic-gate name, passwd, min, max, def, always, \ 37750Sstevel@tonic-gate never) 37760Sstevel@tonic-gate' >> $MAP_FILE 37770Sstevel@tonic-gate else 37780Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 37790Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 37800Sstevel@tonic-gate do 37810Sstevel@tonic-gate echo "nisLDAPnameFields passwd.adjunct.byname,${_DMN}: \\ 37820Sstevel@tonic-gate (\"%s:%s:%s:%s:%s:%s:%s\", \\ 37830Sstevel@tonic-gate name, passwd, min, max, def, always, \\ 37840Sstevel@tonic-gate never) 37850Sstevel@tonic-gate" >> $MAP_FILE 37860Sstevel@tonic-gate done 37870Sstevel@tonic-gate fi 37880Sstevel@tonic-gatefi 37890Sstevel@tonic-gate 37900Sstevel@tonic-gateecho ' 37910Sstevel@tonic-gatenisLDAPnameFields printers.conf.byname: \ 37920Sstevel@tonic-gate ("%s:%s", names, values) 37930Sstevel@tonic-gate 37940Sstevel@tonic-gatenisLDAPnameFields prof_attr: \ 37950Sstevel@tonic-gate ("%s:%s:%s:%s:%s", \ 37960Sstevel@tonic-gate name, res1, res2, desc, attrs) 37970Sstevel@tonic-gate 37980Sstevel@tonic-gatenisLDAPnameFields services: \ 37990Sstevel@tonic-gate ("%s %s/%s %s", name, port, protocol, aliases) 38000Sstevel@tonic-gate 38010Sstevel@tonic-gate# This map is never created but yppasswd uses the mapping to extract password 38020Sstevel@tonic-gate# ageing information from the DIT. The password itself is not required by this 38030Sstevel@tonic-gate# mechanism so is not included in the ageing mapping. 38040Sstevel@tonic-gatenisLDAPnameFields ageing.byname: \ 38050Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s:%s:%s", \ 38060Sstevel@tonic-gate name, lastchg, min, max, warn, inactive, \ 38070Sstevel@tonic-gate expire, flag) 38080Sstevel@tonic-gate 38090Sstevel@tonic-gatenisLDAPnameFields timezone.byname: \ 38100Sstevel@tonic-gate ("%s %s", zoneName, hostName) 38110Sstevel@tonic-gate 38120Sstevel@tonic-gatenisLDAPnameFields user_attr: \ 38130Sstevel@tonic-gate ("%s:%s:%s:%s:%s", user, qualifier, res1, res2, attrs) 38140Sstevel@tonic-gate' >> $MAP_FILE 38150Sstevel@tonic-gate} 38160Sstevel@tonic-gate 38170Sstevel@tonic-gate# 38180Sstevel@tonic-gate# List namefields for non-default auto maps and custom maps. 38190Sstevel@tonic-gate# 38200Sstevel@tonic-gateput_auto_and_custom_map_nisLDAPnameFields() 38210Sstevel@tonic-gate{ 38220Sstevel@tonic-gatefor _MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} ${ALL_DMN_CUST_MAPS[*]} 38230Sstevel@tonic-gatedo 38240Sstevel@tonic-gate 38250Sstevel@tonic-gate echo "\ 38260Sstevel@tonic-gatenisLDAPnameFields ${_MAP}: \\ 38270Sstevel@tonic-gate (\"%s\",value) 38280Sstevel@tonic-gate" >> $MAP_FILE 38290Sstevel@tonic-gate 38300Sstevel@tonic-gatedone 38310Sstevel@tonic-gate} 38320Sstevel@tonic-gate 38330Sstevel@tonic-gate 38340Sstevel@tonic-gatecreate_nisLDAPnameFields() 38350Sstevel@tonic-gate{ 38360Sstevel@tonic-gate# Put format information of "nisLDAPnameFields" 38370Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 38380Sstevel@tonic-gate# "nisLDAPnameFields" specifies the content of entries in a NIS map 38390Sstevel@tonic-gate# and how they should be broken into named fields. It is required as, 38400Sstevel@tonic-gate# unlike NIS+, NIS maps do not store information in named fields. 38410Sstevel@tonic-gate# 38420Sstevel@tonic-gate# Following is the syntax for nisLDAPnameFields : 38430Sstevel@tonic-gate# 38440Sstevel@tonic-gate# "nisLDAPnameFields" mapName ":" "(" matchspec "," fieldNames ")" 38450Sstevel@tonic-gate# fieldName = nameOrArrayName[","...] 38460Sstevel@tonic-gate# nameOrArrayName = Name of field or 'array' of repeated fields. 38470Sstevel@tonic-gate# matchspec = \" formatString \" 38480Sstevel@tonic-gate' >> $MAP_FILE 38490Sstevel@tonic-gate 38500Sstevel@tonic-gate# List the default nameField values 38510Sstevel@tonic-gateput_default_nisLDAPnameFields 38520Sstevel@tonic-gate 38530Sstevel@tonic-gate# List the underlying assumption 38540Sstevel@tonic-gateecho "\ 38550Sstevel@tonic-gate# With the assumption that all the custom maps are simple, single 38560Sstevel@tonic-gate# map (single key-value pair type), below is the nisLDAPnameFields 38570Sstevel@tonic-gate# information for all the custom and non-default auto.* maps. If 38580Sstevel@tonic-gate# this assumption is not valid, then refer to the NISLDAPmapping 38590Sstevel@tonic-gate# man page for information on how to customize this section. 38600Sstevel@tonic-gate" >> $MAP_FILE 38610Sstevel@tonic-gate 38620Sstevel@tonic-gate# List namefields for non-default auto maps and custom maps. 38630Sstevel@tonic-gateput_auto_and_custom_map_nisLDAPnameFields 38640Sstevel@tonic-gate 38650Sstevel@tonic-gate 38660Sstevel@tonic-gateecho " 38670Sstevel@tonic-gate# 38680Sstevel@tonic-gate#------------------------------------------------------------------------------ 38690Sstevel@tonic-gate# 38700Sstevel@tonic-gate" >> $MAP_FILE 38710Sstevel@tonic-gate 38720Sstevel@tonic-gatereturn 0 38730Sstevel@tonic-gate} 38740Sstevel@tonic-gate 38750Sstevel@tonic-gate 38760Sstevel@tonic-gate# 38770Sstevel@tonic-gate# List repeated field seperators 38780Sstevel@tonic-gate# 38790Sstevel@tonic-gatecreate_nisLDAPrepeatedFieldSeparators() 38800Sstevel@tonic-gate{ 38810Sstevel@tonic-gate 38820Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo " 38830Sstevel@tonic-gate# nisLDAPrepeatedFieldSeparators : It is a character which separates 38840Sstevel@tonic-gate# the repeatable instnaces of splitable fields. It's format is : 38850Sstevel@tonic-gate# 38860Sstevel@tonic-gate# nisLDAPrepeatedFieldSeparators fieldName \"sepChar[...]\" 38870Sstevel@tonic-gate# sepChar = A separator character. 38880Sstevel@tonic-gate# Default value is space or tab. 38890Sstevel@tonic-gate" >> $MAP_FILE 38900Sstevel@tonic-gate 38910Sstevel@tonic-gateecho "\ 38920Sstevel@tonic-gate#nisLDAPrepeatedFieldSeparators memberTriples: \" \t\" 38930Sstevel@tonic-gate" >> $MAP_FILE 38940Sstevel@tonic-gate 38950Sstevel@tonic-gate} 38960Sstevel@tonic-gate 38970Sstevel@tonic-gate 38980Sstevel@tonic-gate# 38990Sstevel@tonic-gate# List split fields 39000Sstevel@tonic-gate# 39010Sstevel@tonic-gatecreate_nisLDAPsplitField() 39020Sstevel@tonic-gate{ 39030Sstevel@tonic-gate# List the default split fields 39040Sstevel@tonic-gate 39050Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 39060Sstevel@tonic-gate# nisLDAPsplitFields : It defines how a field, or list of fields, 39070Sstevel@tonic-gate# named by nisLDAPnameFields is split into sub fields. The original 39080Sstevel@tonic-gate# field is compared with each line of this attribute until one matches. 39090Sstevel@tonic-gate# When a match is found named sub-fields are generated. In latter 39100Sstevel@tonic-gate# operations sub-field names can be used in the same way as other 39110Sstevel@tonic-gate# field names. The format of nisLDAPsplitFields is : 39120Sstevel@tonic-gate# 39130Sstevel@tonic-gate# "nisLDAPsplitFields" fieldName ":" splitSpec[","...] 39140Sstevel@tonic-gate# splitSpec = "(" matchspec "," subFieldNames ")" 39150Sstevel@tonic-gate# fieldName = Name of a field from nisLDAPnameFields 39160Sstevel@tonic-gate# subFieldNames = subFieldname[","...] 39170Sstevel@tonic-gate# matchspec = \" formatString \" 39180Sstevel@tonic-gate' >> $MAP_FILE 39190Sstevel@tonic-gate 39200Sstevel@tonic-gateecho ' 39210Sstevel@tonic-gatenisLDAPsplitField memberTriples: \ 39220Sstevel@tonic-gate ("(%s,%s,%s)", host, user, domain), \ 39230Sstevel@tonic-gate ("%s", group) 39240Sstevel@tonic-gate' >> $MAP_FILE 39250Sstevel@tonic-gate 39260Sstevel@tonic-gate} 39270Sstevel@tonic-gate 39280Sstevel@tonic-gate# 39290Sstevel@tonic-gate# List split fields and repeated field separators. 39300Sstevel@tonic-gate# 39310Sstevel@tonic-gatecreate_split_field_and_repeatedfield_seperators() 39320Sstevel@tonic-gate{ 39330Sstevel@tonic-gate 39340Sstevel@tonic-gateecho "\ 39350Sstevel@tonic-gate# Specify how to break fields up into sub fields. 39360Sstevel@tonic-gate" >> $MAP_FILE 39370Sstevel@tonic-gate 39380Sstevel@tonic-gatecreate_nisLDAPrepeatedFieldSeparators 39390Sstevel@tonic-gate 39400Sstevel@tonic-gatecreate_nisLDAPsplitField 39410Sstevel@tonic-gate 39420Sstevel@tonic-gateecho " 39430Sstevel@tonic-gate# 39440Sstevel@tonic-gate#------------------------------------------------------------------------------ 39450Sstevel@tonic-gate# 39460Sstevel@tonic-gate" >> $MAP_FILE 39470Sstevel@tonic-gate} 39480Sstevel@tonic-gate 39490Sstevel@tonic-gatelist_default_nisLDAPobjectDN() 39500Sstevel@tonic-gate{ 39510Sstevel@tonic-gateecho ' 39520Sstevel@tonic-gate# Associate maps with RDNs and object classes. Base DN comes from the 39530Sstevel@tonic-gate# nisLDAPdomainContext. 39540Sstevel@tonic-gate# 39550Sstevel@tonic-gate# As supplied this file gives only the most derived objectClass for each map. 39560Sstevel@tonic-gate# For some servers it may be necessary to add "objectClass=" statements for 39570Sstevel@tonic-gate# all the superclasses. This should be done here. 39580Sstevel@tonic-gate 39590Sstevel@tonic-gatenisLDAPobjectDN auto.home: \ 39600Sstevel@tonic-gate automountmapname=auto_home,?one? \ 39610Sstevel@tonic-gate objectClass=automount: 39620Sstevel@tonic-gate 39630Sstevel@tonic-gatenisLDAPobjectDN auto.master: \ 39640Sstevel@tonic-gate automountmapname=auto_master,?one? \ 39650Sstevel@tonic-gate objectClass=automount: 39660Sstevel@tonic-gate 39670Sstevel@tonic-gatenisLDAPobjectDN auth_attr: \ 39680Sstevel@tonic-gate ou=SolarisAuthAttr,?one? \ 39690Sstevel@tonic-gate objectClass=SolarisAuthAttr: 39700Sstevel@tonic-gate 39710Sstevel@tonic-gatenisLDAPobjectDN bootparams: \ 39720Sstevel@tonic-gate ou=ethers,?one? \ 39730Sstevel@tonic-gate objectClass=bootableDevice, \ 39740Sstevel@tonic-gate bootParameter=*:\ 39750Sstevel@tonic-gate ou=ethers,?one? \ 39760Sstevel@tonic-gate objectClass=device, \ 39770Sstevel@tonic-gate objectClass=bootableDevice 39780Sstevel@tonic-gate 39790Sstevel@tonic-gate 39800Sstevel@tonic-gatenisLDAPobjectDN exec_attr:\ 39810Sstevel@tonic-gate ou=SolarisProfAttr,?one?objectClass=SolarisExecAttr,\ 39820Sstevel@tonic-gate SolarisKernelSecurityPolicy=*:\ 39830Sstevel@tonic-gate ou=SolarisProfAttr,?one?objectClass=SolarisExecAttr,\ 39840Sstevel@tonic-gate objectClass=SolarisProfAttr,\ 39850Sstevel@tonic-gate objectClass=top 39860Sstevel@tonic-gate 39870Sstevel@tonic-gatenisLDAPobjectDN ethers: \ 39880Sstevel@tonic-gate ou=ethers,?one? \ 39890Sstevel@tonic-gate objectClass=ieee802Device, \ 39900Sstevel@tonic-gate macAddress=*:\ 39910Sstevel@tonic-gate ou=ethers,?one? \ 39920Sstevel@tonic-gate objectClass=device, \ 39930Sstevel@tonic-gate objectClass=ieee802Device 39940Sstevel@tonic-gate 39950Sstevel@tonic-gatenisLDAPobjectDN group: \ 39960Sstevel@tonic-gate ou=group,?one? \ 39970Sstevel@tonic-gate objectClass=posixGroup: 39980Sstevel@tonic-gate' >> $MAP_FILE 39990Sstevel@tonic-gate 40000Sstevel@tonic-gate 40010Sstevel@tonic-gate# Need to handle group.adjunct.byname map for multiple domain. 40020Sstevel@tonic-gate 40030Sstevel@tonic-gate_MAP=group.adjunct.byname 40040Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 40050Sstevel@tonic-gatethen 40060Sstevel@tonic-gate # Just put the syntax in comment form 40070Sstevel@tonic-gate echo '#nisLDAPobjectDN group.adjunct.byname: \ 40080Sstevel@tonic-gate# ou=group,?one? \ 40090Sstevel@tonic-gate# objectClass=posixGroup: 40100Sstevel@tonic-gate' >> $MAP_FILE 40110Sstevel@tonic-gateelse 40120Sstevel@tonic-gate # Find the domains in which this map exists. 40130Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 40140Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 40150Sstevel@tonic-gate then 40160Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 40170Sstevel@tonic-gate echo 'nisLDAPobjectDN group.adjunct.byname: \ 40180Sstevel@tonic-gate ou=group,?one? \ 40190Sstevel@tonic-gate objectClass=posixGroup: 40200Sstevel@tonic-gate' >> $MAP_FILE 40210Sstevel@tonic-gate else 40220Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 40230Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 40240Sstevel@tonic-gate do 40250Sstevel@tonic-gate echo "nisLDAPobjectDN group.adjunct.byname,${_DMN}: \\ 40260Sstevel@tonic-gate ou=group,?one? \\ 40270Sstevel@tonic-gate objectClass=posixGroup: 40280Sstevel@tonic-gate" >> $MAP_FILE 40290Sstevel@tonic-gate done 40300Sstevel@tonic-gate fi 40310Sstevel@tonic-gatefi 40320Sstevel@tonic-gate 40330Sstevel@tonic-gate 40340Sstevel@tonic-gateecho 'nisLDAPobjectDN hosts: \ 40350Sstevel@tonic-gate ou=hosts,?one? \ 40360Sstevel@tonic-gate objectClass=ipHost:\ 40370Sstevel@tonic-gate ou=hosts,?one? \ 40380Sstevel@tonic-gate objectClass=device, \ 40390Sstevel@tonic-gate objectClass=ipHost 40400Sstevel@tonic-gate 40410Sstevel@tonic-gatenisLDAPobjectDN multihosts: \ 40420Sstevel@tonic-gate ou=hosts,?one? \ 40430Sstevel@tonic-gate objectClass=ipHost, \ 40440Sstevel@tonic-gate ipHostNumber=*.* 40450Sstevel@tonic-gate 40460Sstevel@tonic-gatenisLDAPobjectDN ipnodes: \ 40470Sstevel@tonic-gate ou=hosts,?one? \ 40480Sstevel@tonic-gate objectClass=ipHost:\ 40490Sstevel@tonic-gate ou=hosts,?one? \ 40500Sstevel@tonic-gate objectClass=device, \ 40510Sstevel@tonic-gate objectClass=ipHost 40520Sstevel@tonic-gate 40530Sstevel@tonic-gatenisLDAPobjectDN multiipnodes: \ 40540Sstevel@tonic-gate ou=hosts,?one? \ 40550Sstevel@tonic-gate objectClass=ipHost, \ 40560Sstevel@tonic-gate ipHostNumber=*\:* 40570Sstevel@tonic-gate 40580Sstevel@tonic-gatenisLDAPobjectDN mail.aliases: \ 40590Sstevel@tonic-gate ou=aliases,?one? \ 40600Sstevel@tonic-gate objectClass=mailGroup: 40610Sstevel@tonic-gate 40620Sstevel@tonic-gatenisLDAPobjectDN mail.mapping: \ 40630Sstevel@tonic-gate ou=aliases,?one? \ 40640Sstevel@tonic-gate objectClass=mailGroup 40650Sstevel@tonic-gate 40660Sstevel@tonic-gatenisLDAPobjectDN netgroup: \ 40670Sstevel@tonic-gate ou=netgroup,?one? \ 40680Sstevel@tonic-gate objectClass=nisNetgroup: 40690Sstevel@tonic-gate 40700Sstevel@tonic-gatenisLDAPobjectDN networks: \ 40710Sstevel@tonic-gate ou=networks,?one? \ 40720Sstevel@tonic-gate objectClass=ipNetwork, \ 40730Sstevel@tonic-gate cn=*: 40740Sstevel@tonic-gate 40750Sstevel@tonic-gate# Must come after networks (or equivalent) that creates ipNetworks 40760Sstevel@tonic-gatenisLDAPobjectDN netmasks.byaddr: \ 40770Sstevel@tonic-gate ou=networks,?one? \ 40780Sstevel@tonic-gate objectClass=ipNetwork, \ 40790Sstevel@tonic-gate ipNetMaskNumber=*: 40800Sstevel@tonic-gate 40810Sstevel@tonic-gatenisLDAPobjectDN passwd: \ 40820Sstevel@tonic-gate ou=people,?one? \ 40830Sstevel@tonic-gate objectClass=posixAccount:\ 40840Sstevel@tonic-gate ou=people,?one? \ 40850Sstevel@tonic-gate objectClass=account, \ 40860Sstevel@tonic-gate objectClass=shadowAccount, \ 40870Sstevel@tonic-gate objectClass=posixAccount 40880Sstevel@tonic-gate' >> $MAP_FILE 40890Sstevel@tonic-gate 40900Sstevel@tonic-gate 40910Sstevel@tonic-gate# Need to handle passwd.adjunct.byname map for multiple domain. 40920Sstevel@tonic-gate 40930Sstevel@tonic-gate_MAP=passwd.adjunct.byname 40940Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 40950Sstevel@tonic-gatethen 40960Sstevel@tonic-gate # Just put the syntax in comment form 40970Sstevel@tonic-gate echo '#nisLDAPobjectDN passwd.adjunct.byname: \ 40980Sstevel@tonic-gate# ou=people,?one? \ 40990Sstevel@tonic-gate# objectClass=posixAccount:\ 41000Sstevel@tonic-gate# ou=people,?one? \ 41010Sstevel@tonic-gate# objectClass=account, \ 41020Sstevel@tonic-gate# objectClass=shadowAccount, \ 41030Sstevel@tonic-gate# objectClass=posixAccount 41040Sstevel@tonic-gate' >> $MAP_FILE 41050Sstevel@tonic-gateelse 41060Sstevel@tonic-gate # Find the domains in which this map exists. 41070Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 41080Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 41090Sstevel@tonic-gate then 41100Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 41110Sstevel@tonic-gate echo 'nisLDAPobjectDN passwd.adjunct.byname: \ 41120Sstevel@tonic-gate ou=people,?one? \ 41130Sstevel@tonic-gate objectClass=posixAccount:\ 41140Sstevel@tonic-gate ou=people,?one? \ 41150Sstevel@tonic-gate objectClass=account, \ 41160Sstevel@tonic-gate objectClass=shadowAccount, \ 41170Sstevel@tonic-gate objectClass=posixAccount 41180Sstevel@tonic-gate' >> $MAP_FILE 41190Sstevel@tonic-gate else 41200Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 41210Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 41220Sstevel@tonic-gate do 41230Sstevel@tonic-gate echo "nisLDAPobjectDN passwd.adjunct.byname,${_DMN}: \\ 41240Sstevel@tonic-gate ou=people,?one? \\ 41250Sstevel@tonic-gate objectClass=posixAccount:\\ 41260Sstevel@tonic-gate ou=people,?one? \\ 41270Sstevel@tonic-gate objectClass=account, \\ 41280Sstevel@tonic-gate objectClass=shadowAccount, \\ 41290Sstevel@tonic-gate objectClass=posixAccount 41300Sstevel@tonic-gate" >> $MAP_FILE 41310Sstevel@tonic-gate done 41320Sstevel@tonic-gate fi 41330Sstevel@tonic-gatefi 41340Sstevel@tonic-gate 41350Sstevel@tonic-gate 41360Sstevel@tonic-gateecho '# Must follow passwd 41370Sstevel@tonic-gatenisLDAPobjectDN netid.pass: \ 41380Sstevel@tonic-gate ou=people,?one? \ 41390Sstevel@tonic-gate objectClass=posixAccount 41400Sstevel@tonic-gate 41410Sstevel@tonic-gate# Must follow hosts 41420Sstevel@tonic-gatenisLDAPobjectDN netid.host: \ 41430Sstevel@tonic-gate ou=hosts,?one? \ 41440Sstevel@tonic-gate objectClass=ipHost 41450Sstevel@tonic-gate 41460Sstevel@tonic-gatenisLDAPobjectDN printers.conf.byname: \ 41470Sstevel@tonic-gate ou=printers,?one? \ 41480Sstevel@tonic-gate objectClass=printerService:\ 41490Sstevel@tonic-gate ou=printers,?one? \ 41500Sstevel@tonic-gate objectClass=sunPrinter, \ 41510Sstevel@tonic-gate objectClass=printerService, \ 41520Sstevel@tonic-gate objectClass=printerLPR, \ 41530Sstevel@tonic-gate objectClass=printerAbstract 41540Sstevel@tonic-gate 41550Sstevel@tonic-gatenisLDAPobjectDN prof_attr:\ 41560Sstevel@tonic-gate ou=SolarisProfAttr,?one?objectClass=SolarisProfAttr,\ 41570Sstevel@tonic-gate SolarisAttrLongDesc=*:\ 41580Sstevel@tonic-gate ou=SolarisProfAttr,?one?objectClass=SolarisProfAttr,\ 41590Sstevel@tonic-gate objectClass=SolarisExecAttr,\ 41600Sstevel@tonic-gate objectClass=top 41610Sstevel@tonic-gatenisLDAPobjectDN project: \ 41620Sstevel@tonic-gate ou=project,?one? \ 41630Sstevel@tonic-gate objectClass=SolarisProject: 41640Sstevel@tonic-gate 41650Sstevel@tonic-gatenisLDAPobjectDN protocols: \ 41660Sstevel@tonic-gate ou=protocols,?one? \ 41670Sstevel@tonic-gate objectClass=ipProtocol: 41680Sstevel@tonic-gate 41690Sstevel@tonic-gatenisLDAPobjectDN rpc.bynumber: \ 41700Sstevel@tonic-gate ou=rpc,?one? \ 41710Sstevel@tonic-gate objectClass=oncRpc: 41720Sstevel@tonic-gate 41730Sstevel@tonic-gatenisLDAPobjectDN services.byname: \ 41740Sstevel@tonic-gate ou=services,?one? \ 41750Sstevel@tonic-gate objectClass=ipService: 41760Sstevel@tonic-gate 41770Sstevel@tonic-gate# Because services.byservicename contains keys of form both 'name' 41780Sstevel@tonic-gate# and 'name/protocol' we generate the DIT just from services.byname. 41790Sstevel@tonic-gate# Hence, write-disabled for services.byservicename 41800Sstevel@tonic-gatenisLDAPobjectDN services.byservicename: \ 41810Sstevel@tonic-gate ou=services,?one? \ 41820Sstevel@tonic-gate objectClass=ipService 41830Sstevel@tonic-gate 41840Sstevel@tonic-gate# This map is never created but yppasswd uses the mapping to extract password 41850Sstevel@tonic-gate# aging information from the DIT. 41860Sstevel@tonic-gatenisLDAPobjectDN ageing.byname: \ 41870Sstevel@tonic-gate ou=people,?one? \ 41880Sstevel@tonic-gate objectClass=shadowAccount: 41890Sstevel@tonic-gate 41900Sstevel@tonic-gate# Using nisplusTimeZoneData objectClass for compatibility with nis+2ldap 41910Sstevel@tonic-gatenisLDAPobjectDN timezone.byname: \ 41920Sstevel@tonic-gate ou=Timezone,?one? \ 41930Sstevel@tonic-gate objectClass=nisplusTimeZoneData: 41940Sstevel@tonic-gate 41950Sstevel@tonic-gatenisLDAPobjectDN user_attr: \ 41960Sstevel@tonic-gate ou=people,?one? \ 41970Sstevel@tonic-gate objectClass=SolarisUserAttr: 41980Sstevel@tonic-gate 41990Sstevel@tonic-gate# Must come after passwd (or equivalent) that creates posixAccounts 42000Sstevel@tonic-gatenisLDAPobjectDN audit_user: \ 42010Sstevel@tonic-gate ou=people,?one? \ 42020Sstevel@tonic-gate objectClass=SolarisAuditUser: 42030Sstevel@tonic-gate 42040Sstevel@tonic-gate# Must come after hosts + passwd. 42050Sstevel@tonic-gatenisLDAPobjectDN keys.host: \ 42060Sstevel@tonic-gate ou=hosts,?one? \ 42070Sstevel@tonic-gate objectClass=NisKeyObject: 42080Sstevel@tonic-gate 42090Sstevel@tonic-gatenisLDAPobjectDN keys.pass: \ 42100Sstevel@tonic-gate ou=people,?one? \ 42110Sstevel@tonic-gate objectClass=NisKeyObject: 42120Sstevel@tonic-gate 42130Sstevel@tonic-gatenisLDAPobjectDN keys.nobody: \ 42140Sstevel@tonic-gate ou=people,?one? \ 42150Sstevel@tonic-gate objectClass=NisKeyObject:\ 42160Sstevel@tonic-gate ou=people,?one? \ 42170Sstevel@tonic-gate objectClass=account, \ 42180Sstevel@tonic-gate objectClass=NisKeyObject 42190Sstevel@tonic-gate 42200Sstevel@tonic-gatenisLDAPobjectDN ypservers: \ 42210Sstevel@tonic-gate ou=ypservers,?one? \ 42220Sstevel@tonic-gate objectClass=device: 42230Sstevel@tonic-gate' >> $MAP_FILE 42240Sstevel@tonic-gate} 42250Sstevel@tonic-gate 42260Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 42270Sstevel@tonic-gatelist_auto_custom_nisLDAPobjectDN() 42280Sstevel@tonic-gate{ 42290Sstevel@tonic-gate 42300Sstevel@tonic-gate# auto.* entries are easy. 42310Sstevel@tonic-gateif [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then 42320Sstevel@tonic-gate echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE 42330Sstevel@tonic-gate 42340Sstevel@tonic-gate for _MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} 42350Sstevel@tonic-gate do 42360Sstevel@tonic-gate 42370Sstevel@tonic-gate # We need to find one container for each auto.* map. 42380Sstevel@tonic-gate # Assume that each auto.* maps's container is auto_*. 42390Sstevel@tonic-gate 42400Sstevel@tonic-gate _MAP_UNDERSCORE=`echo $_MAP | sed "s/auto\./auto_/"` 42410Sstevel@tonic-gate 42420Sstevel@tonic-gate echo "\ 42430Sstevel@tonic-gatenisLDAPobjectDN ${_MAP}: \\ 42440Sstevel@tonic-gate automountmapname=${_MAP_UNDERSCORE},?one? \\ 42450Sstevel@tonic-gate objectClass=automount: 42460Sstevel@tonic-gate" >> $MAP_FILE 42470Sstevel@tonic-gate done 42480Sstevel@tonic-gatefi 42490Sstevel@tonic-gate 42500Sstevel@tonic-gate# Since we do not have enough information to generate 42510Sstevel@tonic-gate# entries for other custom maps, best we can do is to 42520Sstevel@tonic-gate# log this map names and ask user to take care of them. 42530Sstevel@tonic-gate 42540Sstevel@tonic-gateask_user_to_update_the_custom_map_entries_too 42550Sstevel@tonic-gate 42560Sstevel@tonic-gate} 42570Sstevel@tonic-gate 42580Sstevel@tonic-gate 42590Sstevel@tonic-gate# 42600Sstevel@tonic-gate# List association of maps with RDNs and object classes. 42610Sstevel@tonic-gate# 42620Sstevel@tonic-gatecreate_nisLDAPobjectDN() 42630Sstevel@tonic-gate{ 42640Sstevel@tonic-gate 42650Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 42660Sstevel@tonic-gate# nisLDAPobjectDN : It specifies the connection between group of NIS 42670Sstevel@tonic-gate# maps and the LDAP directory. This attribute also defines the 'order' 42680Sstevel@tonic-gate# of the NIS maps. When NIS maps are bulk copied to or from the DIT 42690Sstevel@tonic-gate# they are processed in the same order as related nisLDAPobjectDN 42700Sstevel@tonic-gate# attributes appear in /var/yp/NISLDAPmapping. 42710Sstevel@tonic-gate# The format of "nisLDAPobjectDN" is : 42720Sstevel@tonic-gate# 42730Sstevel@tonic-gate# mapName[" "...] ":" objectDN *( ";" objectDN ) 42740Sstevel@tonic-gate# 42750Sstevel@tonic-gate# where: 42760Sstevel@tonic-gate# 42770Sstevel@tonic-gate# objectDN = readObjectSpec [":"[writeObjectSpec]] 42780Sstevel@tonic-gate# readObjectSpec = [baseAndScope [filterAttrValList]] 42790Sstevel@tonic-gate# writeObjectSpec = [baseAndScope [attrValList]] 42800Sstevel@tonic-gate# baseAndScope = [baseDN] ["?" [scope]] 42810Sstevel@tonic-gate# filterAttrValList = ["?" [filter | attrValList]]] 42820Sstevel@tonic-gate# scope = "base" | "one" | "sub" 42830Sstevel@tonic-gate# attrValList = attribute "=" value 42840Sstevel@tonic-gate# *("," attribute "=" value) 42850Sstevel@tonic-gate' >> $MAP_FILE 42860Sstevel@tonic-gate 42870Sstevel@tonic-gate# List all the default entries anyway. 42880Sstevel@tonic-gatelist_default_nisLDAPobjectDN 42890Sstevel@tonic-gate 42900Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 42910Sstevel@tonic-gatelist_auto_custom_nisLDAPobjectDN 42920Sstevel@tonic-gate 42930Sstevel@tonic-gate} 42940Sstevel@tonic-gate 42950Sstevel@tonic-gate# 42960Sstevel@tonic-gate# List all the default nisLDAPattributeFromField entries 42970Sstevel@tonic-gate# 42980Sstevel@tonic-gatelist_default_nisLDAPattributeFromField() 42990Sstevel@tonic-gate{ 43000Sstevel@tonic-gateecho ' 43010Sstevel@tonic-gate# Describe how named fields are mapped to DIT entries. 43020Sstevel@tonic-gate 43030Sstevel@tonic-gate# audit_user 43040Sstevel@tonic-gatenisLDAPattributeFromField audit_user: \ 43050Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 43060Sstevel@tonic-gate SolarisAuditAlways=alwaysAuditFlags, \ 43070Sstevel@tonic-gate SolarisAuditNever=neverAuditFlags 43080Sstevel@tonic-gate 43090Sstevel@tonic-gate# auto.home 43100Sstevel@tonic-gatenisLDAPattributeFromField auto.home: \ 43110Sstevel@tonic-gate dn=("automountKey=%s,", rf_key ), \ 43120Sstevel@tonic-gate automountKey=rf_key, \ 43130Sstevel@tonic-gate automountInformation=value 43140Sstevel@tonic-gate 43150Sstevel@tonic-gate# auto.master 43160Sstevel@tonic-gatenisLDAPattributeFromField auto.master: \ 43170Sstevel@tonic-gate dn=("automountKey=%s,", rf_key ), \ 43180Sstevel@tonic-gate automountKey=rf_key, \ 43190Sstevel@tonic-gate automountInformation=value 43200Sstevel@tonic-gate 43210Sstevel@tonic-gate# auth_attr 43220Sstevel@tonic-gatenisLDAPattributeFromField auth_attr: \ 43230Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 43240Sstevel@tonic-gate cn=name, \ 43250Sstevel@tonic-gate SolarisAttrReserved1=res1, \ 43260Sstevel@tonic-gate SolarisAttrReserved2=res2, \ 43270Sstevel@tonic-gate SolarisAttrShortDesc=short_desc, \ 43280Sstevel@tonic-gate SolarisAttrLongDesc=long_desc, \ 43290Sstevel@tonic-gate SolarisAttrKeyValue=attrs 43300Sstevel@tonic-gate 43310Sstevel@tonic-gate# exec_attr. Because of the messy NIS keys special handling is required here 43320Sstevel@tonic-gatenisLDAPattributeFromField exec_attr: \ 43330Sstevel@tonic-gate dn=("cn=%s+SolarisKernelSecurityPolicy=%s\ 43340Sstevel@tonic-gate +SolarisProfileType=%s+SolarisProfileID=%s,", \ 43350Sstevel@tonic-gate name, policy,type,id), \ 43360Sstevel@tonic-gate ("%s:*", cn)=rf_key, \ 43370Sstevel@tonic-gate ("*:%s:*", SolarisKernelSecurityPolicy)=rf_key, \ 43380Sstevel@tonic-gate ("*:*:%s", SolarisProfileId)=rf_key, \ 43390Sstevel@tonic-gate solarisProfileType=type, \ 43400Sstevel@tonic-gate solarisAttrReserved1=res1, \ 43410Sstevel@tonic-gate SolarisAttrReserved2=res2, \ 43420Sstevel@tonic-gate solarisAttrKeyValue=attrs 43430Sstevel@tonic-gate 43440Sstevel@tonic-gate# ethers 43450Sstevel@tonic-gatenisLDAPattributeFromField ethers.byname: \ 43460Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 43470Sstevel@tonic-gate macAddress=addr 43480Sstevel@tonic-gatenisLDAPattributeFromField ethers.byaddr: \ 43490Sstevel@tonic-gate dn=("cn=%s,", name ), \ 43500Sstevel@tonic-gate macAddress=rf_key 43510Sstevel@tonic-gatenisLDAPattributeFromField ethers: \ 43520Sstevel@tonic-gate cn=name, \ 43530Sstevel@tonic-gate description=rf_comment 43540Sstevel@tonic-gate 43550Sstevel@tonic-gate# bootparams. Must be done after ethers 43560Sstevel@tonic-gatenisLDAPattributeFromField bootparams: \ 43570Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 43580Sstevel@tonic-gate cn=rf_key, \ 43590Sstevel@tonic-gate (bootParameter)=(params, " ") 43600Sstevel@tonic-gate' >> $MAP_FILE 43610Sstevel@tonic-gate 43620Sstevel@tonic-gate# group syntax is different when group.adjunct map is present. 43630Sstevel@tonic-gate# So, need to handle the various possibilities 43640Sstevel@tonic-gate 43650Sstevel@tonic-gate_MAP=group.adjunct.byname 43660Sstevel@tonic-gate 43670Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 43680Sstevel@tonic-gatethen 43690Sstevel@tonic-gate 43700Sstevel@tonic-gate # Just put the group.adjunct syntax in comment form 43710Sstevel@tonic-gate 43720Sstevel@tonic-gate echo '# group 43730Sstevel@tonic-gatenisLDAPattributeFromField group.byname: \ 43740Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 43750Sstevel@tonic-gate gidNumber=gid 43760Sstevel@tonic-gatenisLDAPattributeFromField group.bygid: \ 43770Sstevel@tonic-gate dn=("cn=%s,", name ), \ 43780Sstevel@tonic-gate gidNumber=rf_key 43790Sstevel@tonic-gatenisLDAPattributeFromField group: \ 43800Sstevel@tonic-gate cn=name, \ 43810Sstevel@tonic-gate userPassword=("{crypt}%s",passwd), \ 43820Sstevel@tonic-gate (memberUid)=(users, ",") 43830Sstevel@tonic-gate 43840Sstevel@tonic-gate# 43850Sstevel@tonic-gate# If you are using group.adjunct, comment the group section above 43860Sstevel@tonic-gate# and uncomment the following group and group.adjunct sections 43870Sstevel@tonic-gate# 43880Sstevel@tonic-gate# group 43890Sstevel@tonic-gate#nisLDAPattributeFromField group.byname: \ 43900Sstevel@tonic-gate# dn=("cn=%s,", rf_key ), \ 43910Sstevel@tonic-gate# gidNumber=gid 43920Sstevel@tonic-gate#nisLDAPattributeFromField group.bygid: \ 43930Sstevel@tonic-gate# dn=("cn=%s,", name ), \ 43940Sstevel@tonic-gate# gidNumber=rf_key 43950Sstevel@tonic-gate#nisLDAPattributeFromField group: \ 43960Sstevel@tonic-gate# cn=name, \ 43970Sstevel@tonic-gate# (memberUid)=(users, ",") 43980Sstevel@tonic-gate 43990Sstevel@tonic-gate# group.adjunct 44000Sstevel@tonic-gate#nisLDAPattributeFromField group.adjunct.byname: \ 44010Sstevel@tonic-gate# dn=("cn=%s,", rf_key ), \ 44020Sstevel@tonic-gate# cn=name, \ 44030Sstevel@tonic-gate# userPassword=("{crypt}%s",passwd) 44040Sstevel@tonic-gate' >> $MAP_FILE 44050Sstevel@tonic-gate 44060Sstevel@tonic-gateelse 44070Sstevel@tonic-gate 44080Sstevel@tonic-gate # Find the domains in which group.adjunct map exists. 44090Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 44100Sstevel@tonic-gate 44110Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 44120Sstevel@tonic-gate then 44130Sstevel@tonic-gate 44140Sstevel@tonic-gate # All the domains have group.adjunct map. 44150Sstevel@tonic-gate 44160Sstevel@tonic-gate echo '# group 44170Sstevel@tonic-gate#nisLDAPattributeFromField group.byname: \ 44180Sstevel@tonic-gate# dn=("cn=%s,", rf_key ), \ 44190Sstevel@tonic-gate# gidNumber=gid 44200Sstevel@tonic-gate#nisLDAPattributeFromField group.bygid: \ 44210Sstevel@tonic-gate# dn=("cn=%s,", name ), \ 44220Sstevel@tonic-gate# gidNumber=rf_key 44230Sstevel@tonic-gate#nisLDAPattributeFromField group: \ 44240Sstevel@tonic-gate# cn=name, \ 44250Sstevel@tonic-gate# userPassword=("{crypt}%s",passwd), \ 44260Sstevel@tonic-gate# (memberUid)=(users, ",") 44270Sstevel@tonic-gate 44280Sstevel@tonic-gate# If you are not using group.adjunct, uncomment the group section above 44290Sstevel@tonic-gate# and comment the following group and group.adjunct sections 44300Sstevel@tonic-gate# 44310Sstevel@tonic-gate# group 44320Sstevel@tonic-gatenisLDAPattributeFromField group.byname: \ 44330Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 44340Sstevel@tonic-gate gidNumber=gid 44350Sstevel@tonic-gatenisLDAPattributeFromField group.bygid: \ 44360Sstevel@tonic-gate dn=("cn=%s,", name ), \ 44370Sstevel@tonic-gate gidNumber=rf_key 44380Sstevel@tonic-gatenisLDAPattributeFromField group: \ 44390Sstevel@tonic-gate cn=name, \ 44400Sstevel@tonic-gate (memberUid)=(users, ",") 44410Sstevel@tonic-gate 44420Sstevel@tonic-gate# group.adjunct 44430Sstevel@tonic-gatenisLDAPattributeFromField group.adjunct.byname: \ 44440Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 44450Sstevel@tonic-gate cn=name, \ 44460Sstevel@tonic-gate userPassword=("{crypt}%s",passwd) 44470Sstevel@tonic-gate' >> $MAP_FILE 44480Sstevel@tonic-gate 44490Sstevel@tonic-gate else 44500Sstevel@tonic-gate # Not every domain has group.adjunct map. 44510Sstevel@tonic-gate 44520Sstevel@tonic-gate # First put the password syntax with domain name for domains 44530Sstevel@tonic-gate # in which group.adjunct exists. 44540Sstevel@tonic-gate 44550Sstevel@tonic-gate echo "# group" >> $MAP_FILE 44560Sstevel@tonic-gate 44570Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 44580Sstevel@tonic-gate do 44590Sstevel@tonic-gate 44600Sstevel@tonic-gate echo "\ 44610Sstevel@tonic-gate# domain-specific group 44620Sstevel@tonic-gatenisLDAPattributeFromField group.byname,${_DMN}: \\ 44630Sstevel@tonic-gate dn=(\"cn=%s,\", rf_key ), \\ 44640Sstevel@tonic-gate gidNumber=gid 44650Sstevel@tonic-gatenisLDAPattributeFromField group.bygid,${_DMN}: \\ 44660Sstevel@tonic-gate dn=(\"cn=%s,\", name ), \\ 44670Sstevel@tonic-gate gidNumber=rf_key 44680Sstevel@tonic-gatenisLDAPattributeFromField group,${_DMN}: \\ 44690Sstevel@tonic-gate cn=name, \\ 44700Sstevel@tonic-gate (memberUid)=(users, \",\") 44710Sstevel@tonic-gate" >> $MAP_FILE 44720Sstevel@tonic-gate done 44730Sstevel@tonic-gate 44740Sstevel@tonic-gate # Now put the other group syntax. We do not need to 44750Sstevel@tonic-gate # append the domain name here. 44760Sstevel@tonic-gate 44770Sstevel@tonic-gate echo ' 44780Sstevel@tonic-gatenisLDAPattributeFromField group.byname: \ 44790Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 44800Sstevel@tonic-gate gidNumber=gid 44810Sstevel@tonic-gatenisLDAPattributeFromField group.bygid: \ 44820Sstevel@tonic-gate dn=("cn=%s,", name ), \ 44830Sstevel@tonic-gate gidNumber=rf_key 44840Sstevel@tonic-gatenisLDAPattributeFromField group: \ 44850Sstevel@tonic-gate cn=name, \ 44860Sstevel@tonic-gate userPassword=("{crypt}%s",passwd), \ 44870Sstevel@tonic-gate (memberUid)=(users, ",") 44880Sstevel@tonic-gate' >> $MAP_FILE 44890Sstevel@tonic-gate 44900Sstevel@tonic-gate # Now we need to put the group.adjunct syntax for domains 44910Sstevel@tonic-gate # in which this map exists. 44920Sstevel@tonic-gate 44930Sstevel@tonic-gate echo "# group.adjunct" >> $MAP_FILE 44940Sstevel@tonic-gate 44950Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 44960Sstevel@tonic-gate do 44970Sstevel@tonic-gate 44980Sstevel@tonic-gate echo "\ 44990Sstevel@tonic-gatenisLDAPattributeFromField group.adjunct.byname,${_DMN}: \\ 45000Sstevel@tonic-gate dn=(\"cn=%s,\", rf_key ), \\ 45010Sstevel@tonic-gate cn=name, \\ 45020Sstevel@tonic-gate userPassword=(\"{crypt}%s\",passwd) 45030Sstevel@tonic-gate" >> $MAP_FILE 45040Sstevel@tonic-gate done 45050Sstevel@tonic-gate 45060Sstevel@tonic-gate fi 45070Sstevel@tonic-gate 45080Sstevel@tonic-gatefi 45090Sstevel@tonic-gate 45100Sstevel@tonic-gate 45110Sstevel@tonic-gateecho ' 45120Sstevel@tonic-gate# hosts 45130Sstevel@tonic-gate# Cannot forward map hosts.byname key as the YP_MULTI entries will not work. 45140Sstevel@tonic-gatenisLDAPattributeFromField hosts.byname: \ 45150Sstevel@tonic-gate cn=rf_searchkey 45160Sstevel@tonic-gatenisLDAPattributeFromField hosts.byaddr: \ 45170Sstevel@tonic-gate ipHostNumber=rf_searchipkey 45180Sstevel@tonic-gatenisLDAPattributeFromField hosts: \ 45190Sstevel@tonic-gate ipHostNumber=addr, \ 45200Sstevel@tonic-gate dn=("cn=%s+ipHostNumber=%s,", canonicalName, addr), \ 45210Sstevel@tonic-gate cn=canonicalName, \ 45220Sstevel@tonic-gate (cn)=(aliases, " "), \ 45230Sstevel@tonic-gate description=rf_comment 45240Sstevel@tonic-gate 45250Sstevel@tonic-gatenisLDAPattributeFromField multihosts: \ 45260Sstevel@tonic-gate ("YP_MULTI_%s", cn)=rf_searchkey 45270Sstevel@tonic-gate 45280Sstevel@tonic-gate# ipnodes 45290Sstevel@tonic-gate# Cannot forward map ipnodes.byname key as the YP_MULTI entries will not work. 45300Sstevel@tonic-gatenisLDAPattributeFromField ipnodes.byname: \ 45310Sstevel@tonic-gate cn=rf_searchkey 45320Sstevel@tonic-gatenisLDAPattributeFromField ipnodes.byaddr: \ 45330Sstevel@tonic-gate ipHostNumber=rf_searchipkey 45340Sstevel@tonic-gatenisLDAPattributeFromField ipnodes: \ 45350Sstevel@tonic-gate ipHostNumber=addr, \ 45360Sstevel@tonic-gate dn=("cn=%s+ipHostNumber=%s,", canonicalName, addr), \ 45370Sstevel@tonic-gate cn=canonicalName, \ 45380Sstevel@tonic-gate (cn)=(aliases, " "), \ 45390Sstevel@tonic-gate description=rf_comment 45400Sstevel@tonic-gate 45410Sstevel@tonic-gatenisLDAPattributeFromField multiipnodes: \ 45420Sstevel@tonic-gate ("YP_MULTI_%s", cn)=rf_searchkey 45430Sstevel@tonic-gate 45440Sstevel@tonic-gate#mail.aliases 45450Sstevel@tonic-gatenisLDAPattributeFromField mail.aliases: \ 45460Sstevel@tonic-gate dn=("mail=%s,", rf_key), \ 45470Sstevel@tonic-gate mail=rf_key, \ 45480Sstevel@tonic-gate (mgrprfc822mailmember)=(addresses, ",") 45490Sstevel@tonic-gate 45500Sstevel@tonic-gate#mail.mapping 45510Sstevel@tonic-gate#Commented out because all NIS->LDAP mappings are done by mail.aliases 45520Sstevel@tonic-gate#nisLDAPattributeFromField mail.mapping: \ 45530Sstevel@tonic-gate# dn=("mail=%s,", address), \ 45540Sstevel@tonic-gate# mail=address, \ 45550Sstevel@tonic-gate# mgrprfc822mailmember=rf_key 45560Sstevel@tonic-gatenisLDAPattributeFromField mail.mapping: \ 45570Sstevel@tonic-gate mgrprfc822mailmember=rf_searchkey 45580Sstevel@tonic-gate 45590Sstevel@tonic-gate# netgroup. 45600Sstevel@tonic-gate# 45610Sstevel@tonic-gate# Only need to create DIT entries for netgroup. This contains a superset of 45620Sstevel@tonic-gate# the information in netgroup.byhost and netgroup.byuser 45630Sstevel@tonic-gatenisLDAPattributeFromField netgroup: \ 45640Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 45650Sstevel@tonic-gate (memberNisNetgroup)=group, \ 45660Sstevel@tonic-gate (nisNetgroupTriple)= \ 45670Sstevel@tonic-gate ("(%s,%s,%s)", host, user, domain), \ 45680Sstevel@tonic-gate cn=rf_key, \ 45690Sstevel@tonic-gate description=rf_comment 45700Sstevel@tonic-gate 45710Sstevel@tonic-gate# netid.pass 45720Sstevel@tonic-gate# 45730Sstevel@tonic-gate# Commented out because, unless remote domains (and thus /etc/netid) is 45740Sstevel@tonic-gate# supported, all NIS->LDAP mappings are set up from passwd. 45750Sstevel@tonic-gate#nisLDAPattributeFromField netid.pass: \ 45760Sstevel@tonic-gate# ("unix.%s@*", uidNumber)=rf_key, \ 45770Sstevel@tonic-gate# (gidNumber)=("%s", (data), " "), \ 45780Sstevel@tonic-gate# description=rf_comment 45790Sstevel@tonic-gatenisLDAPattributeFromField netid.pass: \ 45800Sstevel@tonic-gate ("unix.%s@*", uidNumber)=rf_searchkey 45810Sstevel@tonic-gate 45820Sstevel@tonic-gate# netid.host 45830Sstevel@tonic-gate# 45840Sstevel@tonic-gate# Commented out because, unless remote domains (and thus /etc/netid) is 45850Sstevel@tonic-gate# supported, all NIS->LDAP mappings are set up from hosts. 45860Sstevel@tonic-gate#nisLDAPattributeFromField netid.host: \ 45870Sstevel@tonic-gate# dn=("cn=%s+ipHostNumber=%s,", data, \ 45880Sstevel@tonic-gate# ldap:ipHostNumber:?one?("cn=%s", data)), \ 45890Sstevel@tonic-gate# ipHostNumber=ldap:ipHostNumber:?one?("cn=%s", data), \ 45900Sstevel@tonic-gate# ("unix.%s@*", cn)=rf_key, \ 45910Sstevel@tonic-gate# description=rf_comment 45920Sstevel@tonic-gatenisLDAPattributeFromField netid.host: \ 45930Sstevel@tonic-gate ("unix.%s@*", cn)=rf_searchkey 45940Sstevel@tonic-gate 45950Sstevel@tonic-gate# netmasks.byaddr 45960Sstevel@tonic-gatenisLDAPattributeFromField netmasks.byaddr: \ 45970Sstevel@tonic-gate dn=("ipNetworkNumber=%s,", rf_ipkey ), \ 45980Sstevel@tonic-gate ipNetworkNumber=rf_ipkey, \ 45990Sstevel@tonic-gate ipNetmaskNumber=mask, \ 46000Sstevel@tonic-gate description=rf_comment 46010Sstevel@tonic-gate 46020Sstevel@tonic-gate# networks. 46030Sstevel@tonic-gatenisLDAPattributeFromField networks.byname: \ 46040Sstevel@tonic-gate dn=("ipNetworkNumber=%s,", number ), \ 46050Sstevel@tonic-gate cn=name, \ 46060Sstevel@tonic-gate cn=rf_key 46070Sstevel@tonic-gatenisLDAPattributeFromField networks.byaddr: \ 46080Sstevel@tonic-gate dn=("ipNetworkNumber=%s,", rf_key ), \ 46090Sstevel@tonic-gate cn=name 46100Sstevel@tonic-gatenisLDAPattributeFromField networks: \ 46110Sstevel@tonic-gate (cn)=(aliases, " "), \ 46120Sstevel@tonic-gate ipNetworkNumber=number, \ 46130Sstevel@tonic-gate description=rf_comment 46140Sstevel@tonic-gate' >> $MAP_FILE 46150Sstevel@tonic-gate 46160Sstevel@tonic-gate 46170Sstevel@tonic-gate# passwd syntax is different when passwd.adjunct map is present. 46180Sstevel@tonic-gate# So, need to handle the various possibilities 46190Sstevel@tonic-gate 46200Sstevel@tonic-gate_MAP=passwd.adjunct.byname 46210Sstevel@tonic-gate 46220Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 46230Sstevel@tonic-gatethen 46240Sstevel@tonic-gate 46250Sstevel@tonic-gate # Just put the passwd.adjunct syntax in comment form 46260Sstevel@tonic-gate 46270Sstevel@tonic-gate echo '# passwd 46280Sstevel@tonic-gatenisLDAPattributeFromField passwd.byname: \ 46290Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 46300Sstevel@tonic-gate uid=rf_key, \ 46310Sstevel@tonic-gate uidNumber=uid 46320Sstevel@tonic-gatenisLDAPattributeFromField passwd.byuid: \ 46330Sstevel@tonic-gate dn=("uid=%s,", name ), \ 46340Sstevel@tonic-gate uidNumber=rf_key, \ 46350Sstevel@tonic-gate uid=name 46360Sstevel@tonic-gatenisLDAPattributeFromField passwd: \ 46370Sstevel@tonic-gate cn=name, \ 46380Sstevel@tonic-gate userPassword=("{crypt}%s",passwd), \ 46390Sstevel@tonic-gate gidNumber=gid, \ 46400Sstevel@tonic-gate gecos=gecos, \ 46410Sstevel@tonic-gate homeDirectory=home, \ 46420Sstevel@tonic-gate loginShell=shell 46430Sstevel@tonic-gate 46440Sstevel@tonic-gate# 46450Sstevel@tonic-gate# If you are using passwd.adjunct, comment the passwd section above 46460Sstevel@tonic-gate# and uncomment the following passwd and passwd.adjunct sections 46470Sstevel@tonic-gate# 46480Sstevel@tonic-gate# passwd 46490Sstevel@tonic-gate#nisLDAPattributeFromField passwd.byname: \ 46500Sstevel@tonic-gate# dn=("uid=%s,", rf_key ), \ 46510Sstevel@tonic-gate# uid=rf_key, \ 46520Sstevel@tonic-gate# uidNumber=uid 46530Sstevel@tonic-gate#nisLDAPattributeFromField passwd.byuid: \ 46540Sstevel@tonic-gate# dn=("uid=%s,", name ), \ 46550Sstevel@tonic-gate# uidNumber=rf_key, \ 46560Sstevel@tonic-gate# uid=name 46570Sstevel@tonic-gate#nisLDAPattributeFromField passwd: \ 46580Sstevel@tonic-gate# cn=name, \ 46590Sstevel@tonic-gate# gidNumber=gid, \ 46600Sstevel@tonic-gate# gecos=gecos, \ 46610Sstevel@tonic-gate# homeDirectory=home, \ 46620Sstevel@tonic-gate# loginShell=shell 46630Sstevel@tonic-gate 46640Sstevel@tonic-gate# passwd.adjunct 46650Sstevel@tonic-gate#nisLDAPattributeFromField passwd.adjunct.byname: \ 46660Sstevel@tonic-gate# dn=("uid=%s,", rf_key ), \ 46670Sstevel@tonic-gate# uid=name, \ 46680Sstevel@tonic-gate# userPassword=("{crypt}%s",passwd) 46690Sstevel@tonic-gate' >> $MAP_FILE 46700Sstevel@tonic-gate 46710Sstevel@tonic-gateelse 46720Sstevel@tonic-gate 46730Sstevel@tonic-gate # Find the domains in which passwd.adjunct map exists. 46740Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 46750Sstevel@tonic-gate 46760Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 46770Sstevel@tonic-gate then 46780Sstevel@tonic-gate 46790Sstevel@tonic-gate # All the domains have passwd.adjunct map. So, put the right 46800Sstevel@tonic-gate # passwd syntax and comment-in the passwd.adjunct syntax. 46810Sstevel@tonic-gate 46820Sstevel@tonic-gate 46830Sstevel@tonic-gate echo '# passwd 46840Sstevel@tonic-gate#nisLDAPattributeFromField passwd.byname: \ 46850Sstevel@tonic-gate# dn=("uid=%s,", rf_key ), \ 46860Sstevel@tonic-gate# uid=rf_key, \ 46870Sstevel@tonic-gate# uidNumber=uid 46880Sstevel@tonic-gate#nisLDAPattributeFromField passwd.byuid: \ 46890Sstevel@tonic-gate# dn=("uid=%s,", name ), \ 46900Sstevel@tonic-gate# uidNumber=rf_key, \ 46910Sstevel@tonic-gate# uid=name 46920Sstevel@tonic-gate#nisLDAPattributeFromField passwd: \ 46930Sstevel@tonic-gate# cn=name, \ 46940Sstevel@tonic-gate# userPassword=("{crypt}%s",passwd), \ 46950Sstevel@tonic-gate# gidNumber=gid, \ 46960Sstevel@tonic-gate# gecos=gecos, \ 46970Sstevel@tonic-gate# homeDirectory=home, \ 46980Sstevel@tonic-gate# loginShell=shell 46990Sstevel@tonic-gate 47000Sstevel@tonic-gate# If you are not using passwd.adjunct, uncomment the passwd section above 47010Sstevel@tonic-gate# and comment the following passwd and passwd.adjunct sections 47020Sstevel@tonic-gate# 47030Sstevel@tonic-gate# passwd 47040Sstevel@tonic-gatenisLDAPattributeFromField passwd.byname: \ 47050Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 47060Sstevel@tonic-gate uid=rf_key, \ 47070Sstevel@tonic-gate uidNumber=uid 47080Sstevel@tonic-gatenisLDAPattributeFromField passwd.byuid: \ 47090Sstevel@tonic-gate dn=("uid=%s,", name ), \ 47100Sstevel@tonic-gate uidNumber=rf_key, \ 47110Sstevel@tonic-gate uid=name 47120Sstevel@tonic-gatenisLDAPattributeFromField passwd: \ 47130Sstevel@tonic-gate cn=name, \ 47140Sstevel@tonic-gate gidNumber=gid, \ 47150Sstevel@tonic-gate gecos=gecos, \ 47160Sstevel@tonic-gate homeDirectory=home, \ 47170Sstevel@tonic-gate loginShell=shell 47180Sstevel@tonic-gate 47190Sstevel@tonic-gate# passwd.adjunct 47200Sstevel@tonic-gatenisLDAPattributeFromField passwd.adjunct.byname: \ 47210Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 47220Sstevel@tonic-gate uid=name, \ 47230Sstevel@tonic-gate userPassword=("{crypt}%s",passwd) 47240Sstevel@tonic-gate' >> $MAP_FILE 47250Sstevel@tonic-gate 47260Sstevel@tonic-gate else 47270Sstevel@tonic-gate # Not every domain has passwd.adjunct map. 47280Sstevel@tonic-gate 47290Sstevel@tonic-gate # First put the password syntax with domain name for domains 47300Sstevel@tonic-gate # in which passwd.adjunct exists. 47310Sstevel@tonic-gate 47320Sstevel@tonic-gate echo "# passwd" >> $MAP_FILE 47330Sstevel@tonic-gate 47340Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 47350Sstevel@tonic-gate do 47360Sstevel@tonic-gate 47370Sstevel@tonic-gate echo "\ 47380Sstevel@tonic-gatenisLDAPattributeFromField passwd.byname,${_DMN}: \\ 47390Sstevel@tonic-gate dn=(\"uid=%s,\", rf_key ), \\ 47400Sstevel@tonic-gate uid=rf_key, \\ 47410Sstevel@tonic-gate uidNumber=uid 47420Sstevel@tonic-gatenisLDAPattributeFromField passwd.byuid,${_DMN}: \\ 47430Sstevel@tonic-gate dn=(\"uid=%s,\", name ), \\ 47440Sstevel@tonic-gate uidNumber=rf_key, \\ 47450Sstevel@tonic-gate uid=name 47460Sstevel@tonic-gatenisLDAPattributeFromField passwd,${_DMN}: \\ 47470Sstevel@tonic-gate cn=name, \\ 47480Sstevel@tonic-gate gidNumber=gid, \\ 47490Sstevel@tonic-gate gecos=gecos, \\ 47500Sstevel@tonic-gate homeDirectory=home, \\ 47510Sstevel@tonic-gate loginShell=shell 47520Sstevel@tonic-gate" >> $MAP_FILE 47530Sstevel@tonic-gate done 47540Sstevel@tonic-gate 47550Sstevel@tonic-gate # Now put the other passwd syntax. We do not need to 47560Sstevel@tonic-gate # append the domain name here. 47570Sstevel@tonic-gate 47580Sstevel@tonic-gate echo ' 47590Sstevel@tonic-gatenisLDAPattributeFromField passwd.byname: \ 47600Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 47610Sstevel@tonic-gate uid=rf_key, \ 47620Sstevel@tonic-gate uidNumber=uid 47630Sstevel@tonic-gatenisLDAPattributeFromField passwd.byuid: \ 47640Sstevel@tonic-gate dn=("uid=%s,", name ), \ 47650Sstevel@tonic-gate uidNumber=rf_key, \ 47660Sstevel@tonic-gate uid=name 47670Sstevel@tonic-gatenisLDAPattributeFromField passwd: \ 47680Sstevel@tonic-gate cn=name, \ 47690Sstevel@tonic-gate userPassword=("{crypt}%s",passwd), \ 47700Sstevel@tonic-gate gidNumber=gid, \ 47710Sstevel@tonic-gate gecos=gecos, \ 47720Sstevel@tonic-gate homeDirectory=home, \ 47730Sstevel@tonic-gate loginShell=shell 47740Sstevel@tonic-gate' >> $MAP_FILE 47750Sstevel@tonic-gate 47760Sstevel@tonic-gate # Now we need to put the passwd.adjunct syntax for domains 47770Sstevel@tonic-gate # in which this map exists. 47780Sstevel@tonic-gate 47790Sstevel@tonic-gate echo "# passwd.adjunct" >> $MAP_FILE 47800Sstevel@tonic-gate 47810Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 47820Sstevel@tonic-gate do 47830Sstevel@tonic-gate 47840Sstevel@tonic-gate echo "\ 47850Sstevel@tonic-gatenisLDAPattributeFromField passwd.adjunct.byname,${_DMN}: \\ 47860Sstevel@tonic-gate dn=(\"uid=%s,\", rf_key ), \\ 47870Sstevel@tonic-gate uid=name, \\ 47880Sstevel@tonic-gate userPassword=(\"{crypt}%s\",passwd) 47890Sstevel@tonic-gate" >> $MAP_FILE 47900Sstevel@tonic-gate done 47910Sstevel@tonic-gate 47920Sstevel@tonic-gate fi 47930Sstevel@tonic-gate 47940Sstevel@tonic-gatefi 47950Sstevel@tonic-gate 47960Sstevel@tonic-gateecho ' 47970Sstevel@tonic-gate# This map is never created but yppasswd uses the mapping to extract password 47980Sstevel@tonic-gate# aging information from the DIT. 47990Sstevel@tonic-gatenisLDAPattributeFromField ageing.byname: \ 48000Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 48010Sstevel@tonic-gate uid=name, \ 48020Sstevel@tonic-gate shadowLastChange=lastchg, \ 48030Sstevel@tonic-gate shadowMin=min, \ 48040Sstevel@tonic-gate shadowMax=max, \ 48050Sstevel@tonic-gate shadowWarning=warn, \ 48060Sstevel@tonic-gate shadowInactive=inactive, \ 48070Sstevel@tonic-gate shadowExpire=expire, \ 48080Sstevel@tonic-gate shadowFlag=flag 48090Sstevel@tonic-gate 48100Sstevel@tonic-gate# printers.conf.byname 48110Sstevel@tonic-gatenisLDAPattributeFromField printers.conf.byname: \ 48120Sstevel@tonic-gate dn=("printer-uri=%s,", rf_key ), \ 48130Sstevel@tonic-gate printer-name=rf_key, \ 48140Sstevel@tonic-gate (printer-aliases)=(names, "|"), \ 48150Sstevel@tonic-gate sun-printer-bsdaddr=(values, "*bsdaddr=%s:*"), \ 48160Sstevel@tonic-gate (sun-printer-kvp)=(values,":"), \ 48170Sstevel@tonic-gate description=rf_comment 48180Sstevel@tonic-gate 48190Sstevel@tonic-gate# prof_attr 48200Sstevel@tonic-gatenisLDAPattributeFromField prof_attr: \ 48210Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 48220Sstevel@tonic-gate cn=name, \ 48230Sstevel@tonic-gate SolarisAttrReserved1=res1, \ 48240Sstevel@tonic-gate SolarisAttrReserved2=res2, \ 48250Sstevel@tonic-gate SolarisAttrLongDesc=desc, \ 48260Sstevel@tonic-gate SolarisAttrKeyValue=attrs 48270Sstevel@tonic-gate 48280Sstevel@tonic-gate# project 48290Sstevel@tonic-gatenisLDAPattributeFromField project.byname: \ 48300Sstevel@tonic-gate dn=("SolarisProjectName=%s,", rf_key ) 48310Sstevel@tonic-gatenisLDAPattributeFromField project.byprojid: \ 48320Sstevel@tonic-gate dn=("SolarisProjectName=%s,", name ), \ 48330Sstevel@tonic-gate SolarisProjectID=rf_searchkey 48340Sstevel@tonic-gatenisLDAPattributeFromField project: \ 48350Sstevel@tonic-gate SolarisProjectName=name, \ 48360Sstevel@tonic-gate SolarisProjectID=projID, \ 48370Sstevel@tonic-gate (memberUid)=(users, ","), \ 48380Sstevel@tonic-gate (memberGid)=(groups, ","), \ 48390Sstevel@tonic-gate (SolarisProjectAttr)=(attrs, ";"), \ 48400Sstevel@tonic-gate description=comment 48410Sstevel@tonic-gate 48420Sstevel@tonic-gate# protocols 48430Sstevel@tonic-gatenisLDAPattributeFromField protocols.byname: \ 48440Sstevel@tonic-gate ipProtocolNumber=number, \ 48450Sstevel@tonic-gate cn=rf_searchkey 48460Sstevel@tonic-gatenisLDAPattributeFromField protocols.bynumber: \ 48470Sstevel@tonic-gate ipProtocolNumber=rf_key, \ 48480Sstevel@tonic-gate description=rf_comment 48490Sstevel@tonic-gatenisLDAPattributeFromField protocols: \ 48500Sstevel@tonic-gate dn=("cn=%s,", name ), \ 48510Sstevel@tonic-gate (cn)=(aliases, " "), \ 48520Sstevel@tonic-gate cn=name 48530Sstevel@tonic-gate 48540Sstevel@tonic-gate# rpc.bynumber 48550Sstevel@tonic-gatenisLDAPattributeFromField rpc.bynumber: \ 48560Sstevel@tonic-gate dn=("cn=%s,", name ), \ 48570Sstevel@tonic-gate oncRpcNumber=rf_key, \ 48580Sstevel@tonic-gate (cn)=(aliases, " "), \ 48590Sstevel@tonic-gate cn=name, \ 48600Sstevel@tonic-gate description=rf_comment 48610Sstevel@tonic-gate 48620Sstevel@tonic-gate# services 48630Sstevel@tonic-gate# services.byservicename rule is only used to speed single search 48640Sstevel@tonic-gatenisLDAPattributeFromField services.byservicename: \ 48650Sstevel@tonic-gate ("%s/%s", cn, ipServiceProtocol) = rf_searchkey 48660Sstevel@tonic-gate 48670Sstevel@tonic-gatenisLDAPattributeFromField services.byname: \ 48680Sstevel@tonic-gate dn=("cn=%s+ipServiceProtocol=%s,", name, protocol ), \ 48690Sstevel@tonic-gate ("*/%s", ipServiceProtocol)=rf_key, \ 48700Sstevel@tonic-gate ("%s/*", ipServicePort)=rf_key, \ 48710Sstevel@tonic-gate (cn)=(aliases, " "), \ 48720Sstevel@tonic-gate cn=name, \ 48730Sstevel@tonic-gate description=rf_comment 48740Sstevel@tonic-gate 48750Sstevel@tonic-gate# timezone.byname 48760Sstevel@tonic-gatenisLDAPattributeFromField timezone.byname: \ 48770Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 48780Sstevel@tonic-gate cn=hostName, \ 48790Sstevel@tonic-gate nisplusTimeZone=zoneName, \ 48800Sstevel@tonic-gate description=comment 48810Sstevel@tonic-gate 48820Sstevel@tonic-gate# user_attr 48830Sstevel@tonic-gatenisLDAPattributeFromField user_attr: \ 48840Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 48850Sstevel@tonic-gate uid=rf_key, \ 48860Sstevel@tonic-gate SolarisUserAttr=qualifier, \ 48870Sstevel@tonic-gate SolarisUserReserved1=res1, \ 48880Sstevel@tonic-gate SolarisUserReserved2=res2, \ 48890Sstevel@tonic-gate SolarisAttrKeyValue=attrs 48900Sstevel@tonic-gate 48910Sstevel@tonic-gate# publickey.byname 48920Sstevel@tonic-gatenisLDAPattributeFromField keys.host: \ 48930Sstevel@tonic-gate dn=("%s", ldap:dn:?one?("cn=%s", (yp:rf_key, "unix.%s@*"))), \ 48940Sstevel@tonic-gate nisPublicKey=publicKey, \ 48950Sstevel@tonic-gate nisSecretKey=secretKey 48960Sstevel@tonic-gate 48970Sstevel@tonic-gatenisLDAPattributeFromField keys.pass: \ 48980Sstevel@tonic-gate dn=("%s", ldap:dn:?one?("uidNumber=%s", (yp:rf_key, "unix.%s@*"))), \ 48990Sstevel@tonic-gate nisPublicKey=publicKey, \ 49000Sstevel@tonic-gate nisSecretKey=secretKey 49010Sstevel@tonic-gate 49020Sstevel@tonic-gatenisLDAPattributeFromField keys.nobody: \ 49030Sstevel@tonic-gate dn=("uid=%s,",yp:rf_key), \ 49040Sstevel@tonic-gate cn=rf_key, \ 49050Sstevel@tonic-gate nisPublicKey=publicKey, \ 49060Sstevel@tonic-gate nisSecretKey=secretKey 49070Sstevel@tonic-gate 49080Sstevel@tonic-gate# ypservers. This derived from IPlanet implementation not RFC. 49090Sstevel@tonic-gatenisLDAPattributeFromField ypservers: \ 49100Sstevel@tonic-gate dn=("cn=%s,", rf_key), \ 49110Sstevel@tonic-gate cn=rf_key 49120Sstevel@tonic-gate' >> $MAP_FILE 49130Sstevel@tonic-gate} 49140Sstevel@tonic-gate 49150Sstevel@tonic-gate# 49160Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 49170Sstevel@tonic-gate# 49180Sstevel@tonic-gatelist_auto_and_custom_nisLDAPattributeFromField() 49190Sstevel@tonic-gate{ 49200Sstevel@tonic-gate 49210Sstevel@tonic-gate# auto.* entries are easy. 49220Sstevel@tonic-gateif [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then 49230Sstevel@tonic-gate echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE 49240Sstevel@tonic-gatefi 49250Sstevel@tonic-gate 49260Sstevel@tonic-gatefor _MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} 49270Sstevel@tonic-gatedo 49280Sstevel@tonic-gate echo "\ 49290Sstevel@tonic-gate# ${_MAP} 49300Sstevel@tonic-gatenisLDAPattributeFromField ${_MAP}: \\ 49310Sstevel@tonic-gate dn=(\"automountKey=%s,\", rf_key ), \\ 49320Sstevel@tonic-gate automountKey=rf_key, \\ 49330Sstevel@tonic-gate automountInformation=value 49340Sstevel@tonic-gate" >> $MAP_FILE 49350Sstevel@tonic-gatedone 49360Sstevel@tonic-gate 49370Sstevel@tonic-gate# Since we do not have enough information to generate 49380Sstevel@tonic-gate# entries for other custom maps, best we can do is to 49390Sstevel@tonic-gate# log this map names and ask user to take care of them. 49400Sstevel@tonic-gate 49410Sstevel@tonic-gateask_user_to_update_the_custom_map_entries_too 49420Sstevel@tonic-gate 49430Sstevel@tonic-gate} 49440Sstevel@tonic-gate 49450Sstevel@tonic-gate 49460Sstevel@tonic-gate# 49470Sstevel@tonic-gate# List mapping of named fields to DIT entries 49480Sstevel@tonic-gate# 49490Sstevel@tonic-gatecreate_nisLDAPattributeFromField() 49500Sstevel@tonic-gate{ 49510Sstevel@tonic-gate 49520Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 49530Sstevel@tonic-gate# nisLDAPattributeFromField : It specifies how an LDAP attribute 49540Sstevel@tonic-gate# value is derived from a NIS entries field values. 49550Sstevel@tonic-gate# 49560Sstevel@tonic-gate# The format of nisLDAPattributeFromField entry is : 49570Sstevel@tonic-gate# mapName ":" fieldattrspec *("," fieldattrspec ) 49580Sstevel@tonic-gate' >> $MAP_FILE 49590Sstevel@tonic-gate 49600Sstevel@tonic-gate# List all the default entries anyway. 49610Sstevel@tonic-gatelist_default_nisLDAPattributeFromField 49620Sstevel@tonic-gate 49630Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 49640Sstevel@tonic-gatelist_auto_and_custom_nisLDAPattributeFromField 49650Sstevel@tonic-gate 49660Sstevel@tonic-gateecho " 49670Sstevel@tonic-gate# 49680Sstevel@tonic-gate#------------------------------------------------------------------------------ 49690Sstevel@tonic-gate# 49700Sstevel@tonic-gate" >> $MAP_FILE 49710Sstevel@tonic-gate} 49720Sstevel@tonic-gate 49730Sstevel@tonic-gate 49740Sstevel@tonic-gate# 49750Sstevel@tonic-gate# List all the default nisLDAPattributeFromField entries 49760Sstevel@tonic-gate# 49770Sstevel@tonic-gatelist_default_nisLDAPfieldFromAttribute() 49780Sstevel@tonic-gate{ 49790Sstevel@tonic-gateecho ' 49800Sstevel@tonic-gate# Describe how named fields are mapped from DIT entries. 49810Sstevel@tonic-gate 49820Sstevel@tonic-gate# audit_user 49830Sstevel@tonic-gatenisLDAPfieldFromAttribute audit_user: \ 49840Sstevel@tonic-gate ("uid=%s,*", rf_key)=dn, \ 49850Sstevel@tonic-gate ("uid=%s,*", name)=dn, \ 49860Sstevel@tonic-gate alwaysAuditFlags=SolarisAuditAlways, \ 49870Sstevel@tonic-gate neverAuditFlags=SolarisAuditNever 49880Sstevel@tonic-gate 49890Sstevel@tonic-gate# auto.home 49900Sstevel@tonic-gatenisLDAPfieldFromAttribute auto.home: \ 49910Sstevel@tonic-gate rf_key=automountKey, \ 49920Sstevel@tonic-gate value=automountInformation 49930Sstevel@tonic-gate 49940Sstevel@tonic-gate# auto.master 49950Sstevel@tonic-gatenisLDAPfieldFromAttribute auto.master: \ 49960Sstevel@tonic-gate rf_key=automountKey, \ 49970Sstevel@tonic-gate value=automountInformation 49980Sstevel@tonic-gate 49990Sstevel@tonic-gate# auth_attr 50000Sstevel@tonic-gatenisLDAPfieldFromAttribute auth_attr: \ 50010Sstevel@tonic-gate rf_key=cn, \ 50020Sstevel@tonic-gate name=cn, \ 50030Sstevel@tonic-gate res1=SolarisAttrReserved1, \ 50040Sstevel@tonic-gate res2=SolarisAttrReserved2, \ 50050Sstevel@tonic-gate short_desc=SolarisAttrShortDesc, \ 50060Sstevel@tonic-gate long_desc=SolarisAttrLongDesc, \ 50070Sstevel@tonic-gate attrs=SolarisAttrKeyValue 50080Sstevel@tonic-gate 50090Sstevel@tonic-gate# Exec_attr. Because of messy NIS keys special handlind is required here 50100Sstevel@tonic-gatenisLDAPfieldFromAttribute exec_attr: \ 50110Sstevel@tonic-gate rf_key=("%s:%s:%s",cn,SolarisKernelSecurityPolicy, \ 50120Sstevel@tonic-gate solarisProfileId), \ 50130Sstevel@tonic-gate name=cn, \ 50140Sstevel@tonic-gate policy=SolarisKernelSecurityPolicy, \ 50150Sstevel@tonic-gate type=SolarisProfileType, \ 50160Sstevel@tonic-gate res1=SolarisAttrReserved1, \ 50170Sstevel@tonic-gate res2=SolarisAttrReserved2, \ 50180Sstevel@tonic-gate id=SolarisProfileId, \ 50190Sstevel@tonic-gate attrs=SolarisAttrKeyValue 50200Sstevel@tonic-gate 50210Sstevel@tonic-gate 50220Sstevel@tonic-gate# ethers 50230Sstevel@tonic-gatenisLDAPfieldFromAttribute ethers.byname: \ 50240Sstevel@tonic-gate rf_key=cn 50250Sstevel@tonic-gatenisLDAPfieldFromAttribute ethers.byaddr: \ 50260Sstevel@tonic-gate rf_key=macAddress 50270Sstevel@tonic-gatenisLDAPfieldFromAttribute ethers: \ 50280Sstevel@tonic-gate name=cn, \ 50290Sstevel@tonic-gate addr=macAddress, \ 50300Sstevel@tonic-gate rf_comment=description 50310Sstevel@tonic-gate 50320Sstevel@tonic-gate# bootparams. Must be done after ethers 50330Sstevel@tonic-gatenisLDAPfieldFromAttribute bootparams: \ 50340Sstevel@tonic-gate rf_key=cn, \ 50350Sstevel@tonic-gate params=("%s ", (bootParameter), " ") 50360Sstevel@tonic-gate' >> $MAP_FILE 50370Sstevel@tonic-gate 50380Sstevel@tonic-gate# group syntax is different when group.adjunct map is present. 50390Sstevel@tonic-gate# So, need to handle the various possibilities 50400Sstevel@tonic-gate 50410Sstevel@tonic-gate_MAP=group.adjunct.byname 50420Sstevel@tonic-gate 50430Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 50440Sstevel@tonic-gatethen 50450Sstevel@tonic-gate 50460Sstevel@tonic-gate # Just put the group.adjunct syntax in comment form 50470Sstevel@tonic-gate 50480Sstevel@tonic-gate echo '# group 50490Sstevel@tonic-gatenisLDAPfieldFromAttribute group.byname: \ 50500Sstevel@tonic-gate rf_key=cn 50510Sstevel@tonic-gatenisLDAPfieldFromAttribute group.bygid: \ 50520Sstevel@tonic-gate rf_key=gidNumber 50530Sstevel@tonic-gatenisLDAPfieldFromAttribute group: \ 50540Sstevel@tonic-gate gid=gidNumber, \ 50550Sstevel@tonic-gate name=cn, \ 50560Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword, \ 50570Sstevel@tonic-gate users=("%s,", (memberUid), ",") 50580Sstevel@tonic-gate 50590Sstevel@tonic-gate# 50600Sstevel@tonic-gate# If you are using group.adjunct, comment the group section above 50610Sstevel@tonic-gate# and uncomment the following group and group.adjunct section 50620Sstevel@tonic-gate# 50630Sstevel@tonic-gate# group 50640Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.byname: \ 50650Sstevel@tonic-gate# rf_key=cn 50660Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.bygid: \ 50670Sstevel@tonic-gate# rf_key=gidNumber 50680Sstevel@tonic-gate#nisLDAPfieldFromAttribute group: \ 50690Sstevel@tonic-gate# gid=gidNumber, \ 50700Sstevel@tonic-gate# name=cn, \ 50710Sstevel@tonic-gate# passwd=("#$%s", cn), \ 50720Sstevel@tonic-gate# users=("%s,", (memberUid), ",") 50730Sstevel@tonic-gate 50740Sstevel@tonic-gate# group.adjunct 50750Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.adjunct.byname: \ 50760Sstevel@tonic-gate# rf_key=cn, \ 50770Sstevel@tonic-gate# name=cn, \ 50780Sstevel@tonic-gate# ("{crypt}%s", passwd)=userPassword 50790Sstevel@tonic-gate' >> $MAP_FILE 50800Sstevel@tonic-gate 50810Sstevel@tonic-gateelse 50820Sstevel@tonic-gate 50830Sstevel@tonic-gate # Find the domains in which group.adjunct map exists. 50840Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 50850Sstevel@tonic-gate 50860Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 50870Sstevel@tonic-gate then 50880Sstevel@tonic-gate 50890Sstevel@tonic-gate # All the domains have group.adjunct map. 50900Sstevel@tonic-gate 50910Sstevel@tonic-gate 50920Sstevel@tonic-gate echo '# group 50930Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.byname: \ 50940Sstevel@tonic-gate# rf_key=cn 50950Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.bygid: \ 50960Sstevel@tonic-gate# rf_key=gidNumber 50970Sstevel@tonic-gate#nisLDAPfieldFromAttribute group: \ 50980Sstevel@tonic-gate# gid=gidNumber, \ 50990Sstevel@tonic-gate# name=cn, \ 51000Sstevel@tonic-gate# ("{crypt}%s", passwd)=userPassword, \ 51010Sstevel@tonic-gate# users=("%s,", (memberUid), ",") 51020Sstevel@tonic-gate 51030Sstevel@tonic-gate# 51040Sstevel@tonic-gate# If you are not using group.adjunct, comment the group section above 51050Sstevel@tonic-gate# and uncomment the following group and group.adjunct sections 51060Sstevel@tonic-gate# 51070Sstevel@tonic-gate# group 51080Sstevel@tonic-gatenisLDAPfieldFromAttribute group.byname: \ 51090Sstevel@tonic-gate rf_key=cn 51100Sstevel@tonic-gatenisLDAPfieldFromAttribute group.bygid: \ 51110Sstevel@tonic-gate rf_key=gidNumber 51120Sstevel@tonic-gatenisLDAPfieldFromAttribute group: \ 51130Sstevel@tonic-gate gid=gidNumber, \ 51140Sstevel@tonic-gate name=cn, \ 51150Sstevel@tonic-gate passwd=("#$%s", cn), \ 51160Sstevel@tonic-gate users=("%s,", (memberUid), ",") 51170Sstevel@tonic-gate 51180Sstevel@tonic-gate# 51190Sstevel@tonic-gate# group.adjunct 51200Sstevel@tonic-gatenisLDAPfieldFromAttribute group.adjunct.byname: \ 51210Sstevel@tonic-gate rf_key=cn, \ 51220Sstevel@tonic-gate name=cn, \ 51230Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword 51240Sstevel@tonic-gate' >> $MAP_FILE 51250Sstevel@tonic-gate 51260Sstevel@tonic-gate else 51270Sstevel@tonic-gate # Not every domain has group.adjunct map. 51280Sstevel@tonic-gate 51290Sstevel@tonic-gate echo "# group" >> $MAP_FILE 51300Sstevel@tonic-gate 51310Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 51320Sstevel@tonic-gate do 51330Sstevel@tonic-gate 51340Sstevel@tonic-gate echo "\ 51350Sstevel@tonic-gatenisLDAPfieldFromAttribute group.byname,${_DMN}: \\ 51360Sstevel@tonic-gate rf_key=cn 51370Sstevel@tonic-gatenisLDAPfieldFromAttribute group.bygid,${_DMN}: \\ 51380Sstevel@tonic-gate rf_key=gidNumber 51390Sstevel@tonic-gatenisLDAPfieldFromAttribute group,${_DMN}: \\ 51400Sstevel@tonic-gate gid=gidNumber, \\ 51410Sstevel@tonic-gate name=cn, \\ 51420Sstevel@tonic-gate passwd=(\"#$%s\", cn), \\ 51430Sstevel@tonic-gate users=(\"%s,\", (memberUid), \",\") 51440Sstevel@tonic-gate" >> $MAP_FILE 51450Sstevel@tonic-gate done 51460Sstevel@tonic-gate 51470Sstevel@tonic-gate # Now put the generic group syntax. We do not need to 51480Sstevel@tonic-gate # append the domain name here. 51490Sstevel@tonic-gate 51500Sstevel@tonic-gate echo ' 51510Sstevel@tonic-gatenisLDAPfieldFromAttribute group.byname: \ 51520Sstevel@tonic-gate rf_key=cn 51530Sstevel@tonic-gatenisLDAPfieldFromAttribute group.bygid: \ 51540Sstevel@tonic-gate rf_key=gidNumber 51550Sstevel@tonic-gatenisLDAPfieldFromAttribute group: \ 51560Sstevel@tonic-gate gid=gidNumber, \ 51570Sstevel@tonic-gate name=cn, \ 51580Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword, \ 51590Sstevel@tonic-gate users=("%s,", (memberUid), ",") 51600Sstevel@tonic-gate' >> $MAP_FILE 51610Sstevel@tonic-gate 51620Sstevel@tonic-gate # Now we need to put the group.adjunct syntax for domains 51630Sstevel@tonic-gate # in which this map exists. 51640Sstevel@tonic-gate 51650Sstevel@tonic-gate echo "# 51660Sstevel@tonic-gate# group.adjunct 51670Sstevel@tonic-gate# " >> $MAP_FILE 51680Sstevel@tonic-gate 51690Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 51700Sstevel@tonic-gate do 51710Sstevel@tonic-gate 51720Sstevel@tonic-gate echo "\ 51730Sstevel@tonic-gatenisLDAPfieldFromAttribute group.adjunct.byname,${_DMN}: \\ 51740Sstevel@tonic-gate rf_key=cn, \\ 51750Sstevel@tonic-gate name=cn, \\ 51760Sstevel@tonic-gate (\"{crypt}%s\", passwd)=userPassword 51770Sstevel@tonic-gate" >> $MAP_FILE 51780Sstevel@tonic-gate 51790Sstevel@tonic-gate done 51800Sstevel@tonic-gate 51810Sstevel@tonic-gate fi 51820Sstevel@tonic-gate 51830Sstevel@tonic-gatefi 51840Sstevel@tonic-gate 51850Sstevel@tonic-gateecho ' 51860Sstevel@tonic-gate# hosts 51870Sstevel@tonic-gatenisLDAPfieldFromAttribute hosts.byaddr: \ 51880Sstevel@tonic-gate rf_ipkey=ipHostNumber 51890Sstevel@tonic-gatenisLDAPfieldFromAttribute hosts.byname: \ 51900Sstevel@tonic-gate (rf_key)=(cn) 51910Sstevel@tonic-gatenisLDAPfieldFromAttribute hosts: \ 51920Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", canonicalName)=dn, \ 51930Sstevel@tonic-gate addr=ipHostNumber, \ 51940Sstevel@tonic-gate aliases=("%s ", (cn) - yp:canonicalName, " "), \ 51950Sstevel@tonic-gate rf_comment=description 51960Sstevel@tonic-gate 51970Sstevel@tonic-gatenisLDAPfieldFromAttribute multihosts: \ 51980Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", canonicalName)=dn, \ 51990Sstevel@tonic-gate (rf_key)=("YP_MULTI_%s", cn), \ 52000Sstevel@tonic-gate aliases=("%s ", (cn) - yp:canonicalName, " "), \ 52010Sstevel@tonic-gate rf_comment=description, \ 52020Sstevel@tonic-gate (tmp)=("%s", ipHostNumber:?one?("(&(cn=%s) \ 52030Sstevel@tonic-gate (ipHostNumber=*.*))", yp:canonicalName)), \ 52040Sstevel@tonic-gate addr=("%s,", (yp:tmp), ",") 52050Sstevel@tonic-gate 52060Sstevel@tonic-gate# ipnodes 52070Sstevel@tonic-gatenisLDAPfieldFromAttribute ipnodes.byaddr: \ 52080Sstevel@tonic-gate rf_ipkey=ipHostNumber 52090Sstevel@tonic-gatenisLDAPfieldFromAttribute ipnodes.byname: \ 5210*13083SBenjamin.Chang@Oracle.COM (rf_key)=(cn) 52110Sstevel@tonic-gatenisLDAPfieldFromAttribute ipnodes: \ 52120Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", canonicalName)=dn, \ 52130Sstevel@tonic-gate addr=ipHostNumber, \ 52140Sstevel@tonic-gate aliases=("%s ", (cn) - yp:canonicalName, " "), \ 52150Sstevel@tonic-gate rf_comment=description 52160Sstevel@tonic-gate 52170Sstevel@tonic-gatenisLDAPfieldFromAttribute multiipnodes: \ 52180Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", canonicalName)=dn, \ 52190Sstevel@tonic-gate (rf_key)=("YP_MULTI_%s", cn), \ 52200Sstevel@tonic-gate aliases=("%s ", (cn) - yp:canonicalName, " "), \ 52210Sstevel@tonic-gate rf_comment=description, \ 52220Sstevel@tonic-gate (tmp)=("%s", ipHostNumber:?one?("(&(cn=%s) \ 52230Sstevel@tonic-gate (ipHostNumber=*:*))", yp:canonicalName)), \ 52240Sstevel@tonic-gate addr=("%s,", (yp:tmp), ",") 52250Sstevel@tonic-gate 52260Sstevel@tonic-gate#mail.aliases 52270Sstevel@tonic-gatenisLDAPfieldFromAttribute mail.aliases: \ 52280Sstevel@tonic-gate rf_key=mail, \ 52290Sstevel@tonic-gate addresses= ("%s,", (mgrprfc822mailmember), ","), \ 52300Sstevel@tonic-gate rf_comment=description 52310Sstevel@tonic-gate 52320Sstevel@tonic-gate#mail.mapping 52330Sstevel@tonic-gatenisLDAPfieldFromAttribute mail.mapping: \ 52340Sstevel@tonic-gate rf_key=mgrprfc822mailmember, \ 52350Sstevel@tonic-gate address=mail, \ 52360Sstevel@tonic-gate rf_comment=description 52370Sstevel@tonic-gate 52380Sstevel@tonic-gate# netgroup. 52390Sstevel@tonic-gatenisLDAPfieldFromAttribute netgroup: \ 52400Sstevel@tonic-gate rf_key=cn, \ 52410Sstevel@tonic-gate (group)=(memberNisNetgroup), \ 52420Sstevel@tonic-gate ("(%s,%s,%s)", host, user, domain)= \ 52430Sstevel@tonic-gate (nisNetgroupTriple), \ 52440Sstevel@tonic-gate rf_comment=description 52450Sstevel@tonic-gate 52460Sstevel@tonic-gate# netid.pass 52470Sstevel@tonic-gatenisLDAPfieldFromAttribute netid.pass: \ 52480Sstevel@tonic-gate number=uidNumber, \ 52490Sstevel@tonic-gate (tmp)=("%s", gidNumber:ou=group,?one?\ 52500Sstevel@tonic-gate ("memberUid=%s", ldap:uid)), \ 52510Sstevel@tonic-gate sgid=("%s,", (yp:tmp) - gidNumber, ","), \ 52520Sstevel@tonic-gate data=("%s,%s", gidNumber, yp:sgid), \ 52530Sstevel@tonic-gate data=gidNumber, \ 52540Sstevel@tonic-gate (rf_key)=("unix.%s@%s", yp:number, yp:rf_domain) 52550Sstevel@tonic-gate 52560Sstevel@tonic-gate# netid.host 52570Sstevel@tonic-gatenisLDAPfieldFromAttribute netid.host: \ 52580Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", data)=dn, \ 52590Sstevel@tonic-gate number=("0"), \ 52600Sstevel@tonic-gate (rf_key)=("unix.%s@%s", yp:data, yp:rf_domain) 52610Sstevel@tonic-gate 52620Sstevel@tonic-gate# netmasks.byaddr 52630Sstevel@tonic-gatenisLDAPfieldFromAttribute netmasks.byaddr: \ 52640Sstevel@tonic-gate ("ipNetworkNumber=%s,*", rf_ipkey)=dn, \ 52650Sstevel@tonic-gate mask=ipNetmaskNumber, \ 52660Sstevel@tonic-gate rf_comment=description 52670Sstevel@tonic-gate 52680Sstevel@tonic-gate# networks. 52690Sstevel@tonic-gatenisLDAPfieldFromAttribute networks.byname: \ 52700Sstevel@tonic-gate (rf_key)=(cn) 52710Sstevel@tonic-gatenisLDAPfieldFromAttribute networks.byaddr: \ 52720Sstevel@tonic-gate ("ipNetworkNumber=%s,*", rf_key)=dn 52730Sstevel@tonic-gatenisLDAPfieldFromAttribute networks: \ 52740Sstevel@tonic-gate name=cn, \ 52750Sstevel@tonic-gate aliases=("%s ", (cn) - yp:name, " "), \ 52760Sstevel@tonic-gate number=ipNetworkNumber, \ 52770Sstevel@tonic-gate rf_comment=description 52780Sstevel@tonic-gate' >> $MAP_FILE 52790Sstevel@tonic-gate 52800Sstevel@tonic-gate# passwd syntax is different when passwd.adjunct map is present. 52810Sstevel@tonic-gate# So, need to handle the various possibilities 52820Sstevel@tonic-gate 52830Sstevel@tonic-gate_MAP=passwd.adjunct.byname 52840Sstevel@tonic-gate 52850Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 52860Sstevel@tonic-gatethen 52870Sstevel@tonic-gate 52880Sstevel@tonic-gate # Just put the passwd.adjunct syntax in comment form 52890Sstevel@tonic-gate 52900Sstevel@tonic-gate echo '# passwd 52910Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byname: \ 52920Sstevel@tonic-gate rf_key=uid 52930Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byuid: \ 52940Sstevel@tonic-gate rf_key=uidNumber 52950Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd: \ 52960Sstevel@tonic-gate name=uid, \ 52970Sstevel@tonic-gate uid=uidNumber, \ 52980Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword, \ 52990Sstevel@tonic-gate gid=gidNumber, \ 53000Sstevel@tonic-gate gecos=gecos, \ 53010Sstevel@tonic-gate home=homeDirectory, \ 53020Sstevel@tonic-gate shell=loginShell 53030Sstevel@tonic-gate 53040Sstevel@tonic-gate# 53050Sstevel@tonic-gate# If you are using passwd.adjunct, comment the passwd section above 53060Sstevel@tonic-gate# and uncomment the following passwd and passwd.adjunct sections 53070Sstevel@tonic-gate# 53080Sstevel@tonic-gate# passwd 53090Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.byname: \ 53100Sstevel@tonic-gate# rf_key=uid 53110Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.byuid: \ 53120Sstevel@tonic-gate# rf_key=uidNumber 53130Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd: \ 53140Sstevel@tonic-gate# name=uid, \ 53150Sstevel@tonic-gate# uid=uidNumber, \ 53160Sstevel@tonic-gate# passwd=("##%s", uid), \ 53170Sstevel@tonic-gate# gid=gidNumber, \ 53180Sstevel@tonic-gate# gecos=gecos, \ 53190Sstevel@tonic-gate# home=homeDirectory, \ 53200Sstevel@tonic-gate# shell=loginShell 53210Sstevel@tonic-gate 53220Sstevel@tonic-gate# passwd.adjunct 53230Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.adjunct.byname: \ 53240Sstevel@tonic-gate# rf_key=uid, \ 53250Sstevel@tonic-gate# name=uid, \ 53260Sstevel@tonic-gate# ("{crypt}%s", passwd)=userPassword 53270Sstevel@tonic-gate' >> $MAP_FILE 53280Sstevel@tonic-gate 53290Sstevel@tonic-gateelse 53300Sstevel@tonic-gate 53310Sstevel@tonic-gate # Find the domains in which passwd.adjunct map exists. 53320Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 53330Sstevel@tonic-gate 53340Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 53350Sstevel@tonic-gate then 53360Sstevel@tonic-gate 53370Sstevel@tonic-gate # All the domains have passwd.adjunct map. So, put the right 53380Sstevel@tonic-gate # passwd syntax and comment-in the passwd.adjunct syntax. 53390Sstevel@tonic-gate 53400Sstevel@tonic-gate 53410Sstevel@tonic-gate echo '# passwd 53420Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.byname: \ 53430Sstevel@tonic-gate# rf_key=uid 53440Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.byuid: \ 53450Sstevel@tonic-gate# rf_key=uidNumber 53460Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd: \ 53470Sstevel@tonic-gate# name=uid, \ 53480Sstevel@tonic-gate# uid=uidNumber, \ 53490Sstevel@tonic-gate# ("{crypt}%s", passwd)=userPassword, \ 53500Sstevel@tonic-gate# gid=gidNumber, \ 53510Sstevel@tonic-gate# gecos=gecos, \ 53520Sstevel@tonic-gate# home=homeDirectory, \ 53530Sstevel@tonic-gate# shell=loginShell 53540Sstevel@tonic-gate 53550Sstevel@tonic-gate# 53560Sstevel@tonic-gate# If you are not using passwd.adjunct, uncomment the passwd section 53570Sstevel@tonic-gate# above and comment the following passwd and passwd.adjunct sections 53580Sstevel@tonic-gate# 53590Sstevel@tonic-gate# passwd 53600Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byname: \ 53610Sstevel@tonic-gate rf_key=uid 53620Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byuid: \ 53630Sstevel@tonic-gate rf_key=uidNumber 53640Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd: \ 53650Sstevel@tonic-gate name=uid, \ 53660Sstevel@tonic-gate uid=uidNumber, \ 53670Sstevel@tonic-gate passwd=("##%s", uid), \ 53680Sstevel@tonic-gate gid=gidNumber, \ 53690Sstevel@tonic-gate gecos=gecos, \ 53700Sstevel@tonic-gate home=homeDirectory, \ 53710Sstevel@tonic-gate shell=loginShell 53720Sstevel@tonic-gate 53730Sstevel@tonic-gate# 53740Sstevel@tonic-gate# passwd.adjunct Must follow passwd 53750Sstevel@tonic-gate# 53760Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.adjunct.byname: \ 53770Sstevel@tonic-gate rf_key=uid, \ 53780Sstevel@tonic-gate name=uid, \ 53790Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword 53800Sstevel@tonic-gate' >> $MAP_FILE 53810Sstevel@tonic-gate 53820Sstevel@tonic-gate else 53830Sstevel@tonic-gate # Not every domain has passwd.adjunct map. 53840Sstevel@tonic-gate 53850Sstevel@tonic-gate # First put the password syntax with domain name for domains 53860Sstevel@tonic-gate # in which passwd.adjunct exists. 53870Sstevel@tonic-gate 53880Sstevel@tonic-gate echo "# passwd" >> $MAP_FILE 53890Sstevel@tonic-gate 53900Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 53910Sstevel@tonic-gate do 53920Sstevel@tonic-gate 53930Sstevel@tonic-gate echo "\ 53940Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byname,${_DMN}: \\ 53950Sstevel@tonic-gate rf_key=uid 53960Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byuid,${_DMN}: \\ 53970Sstevel@tonic-gate rf_key=uidNumber 53980Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd,${_DMN}: \\ 53990Sstevel@tonic-gate name=uid, \\ 54000Sstevel@tonic-gate uid=uidNumber, \\ 54010Sstevel@tonic-gate passwd=(\"##%s\", uid), \\ 54020Sstevel@tonic-gate gid=gidNumber, \\ 54030Sstevel@tonic-gate gecos=gecos, \\ 54040Sstevel@tonic-gate home=homeDirectory, \\ 54050Sstevel@tonic-gate shell=loginShell 54060Sstevel@tonic-gate" >> $MAP_FILE 54070Sstevel@tonic-gate done 54080Sstevel@tonic-gate 54090Sstevel@tonic-gate # Now put the other passwd syntax. We do not need to 54100Sstevel@tonic-gate # append the domain name here. 54110Sstevel@tonic-gate 54120Sstevel@tonic-gate echo ' 54130Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byname: \ 54140Sstevel@tonic-gate rf_key=uid 54150Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byuid: \ 54160Sstevel@tonic-gate rf_key=uidNumber 54170Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd: \ 54180Sstevel@tonic-gate name=uid, \ 54190Sstevel@tonic-gate uid=uidNumber, \ 54200Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword, \ 54210Sstevel@tonic-gate gid=gidNumber, \ 54220Sstevel@tonic-gate gecos=gecos, \ 54230Sstevel@tonic-gate home=homeDirectory, \ 54240Sstevel@tonic-gate shell=loginShell 54250Sstevel@tonic-gate' >> $MAP_FILE 54260Sstevel@tonic-gate 54270Sstevel@tonic-gate # Now we need to put the passwd.adjunct syntax for domains 54280Sstevel@tonic-gate # in which this map exists. 54290Sstevel@tonic-gate 54300Sstevel@tonic-gate echo "# 54310Sstevel@tonic-gate# passwd.adjunct Must follow passwd 54320Sstevel@tonic-gate# " >> $MAP_FILE 54330Sstevel@tonic-gate 54340Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 54350Sstevel@tonic-gate do 54360Sstevel@tonic-gate 54370Sstevel@tonic-gate echo "\ 54380Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.adjunct.byname,${_DMN}: \\ 54390Sstevel@tonic-gate rf_key=uid, \\ 54400Sstevel@tonic-gate name=uid, \\ 54410Sstevel@tonic-gate (\"{crypt}%s\", passwd)=userPassword 54420Sstevel@tonic-gate" >> $MAP_FILE 54430Sstevel@tonic-gate 54440Sstevel@tonic-gate done 54450Sstevel@tonic-gate 54460Sstevel@tonic-gate fi 54470Sstevel@tonic-gate 54480Sstevel@tonic-gatefi 54490Sstevel@tonic-gate 54500Sstevel@tonic-gateecho ' 54510Sstevel@tonic-gate# This map is never created but yppasswd uses the mapping to extract password 54520Sstevel@tonic-gate# ageing information from the DIT. 54530Sstevel@tonic-gatenisLDAPfieldFromAttribute ageing.byname: \ 54540Sstevel@tonic-gate rf_key=uid, \ 54550Sstevel@tonic-gate name=uid, \ 54560Sstevel@tonic-gate lastchg=shadowLastChange, \ 54570Sstevel@tonic-gate min=shadowMin, \ 54580Sstevel@tonic-gate max=shadowMax, \ 54590Sstevel@tonic-gate warn=shadowWarning, \ 54600Sstevel@tonic-gate inactive=shadowInactive, \ 54610Sstevel@tonic-gate expire=shadowExpire, \ 54620Sstevel@tonic-gate flag=shadowFlag 54630Sstevel@tonic-gate 54640Sstevel@tonic-gate# printers.conf.byname 54650Sstevel@tonic-gatenisLDAPfieldFromAttribute printers.conf.byname: \ 54660Sstevel@tonic-gate rf_key=printer-uri, \ 54670Sstevel@tonic-gate names=("%s|", (printer-aliases), "|"), \ 54680Sstevel@tonic-gate bsdaddr=("bsdaddr=%s", sun-printer-bsdaddr), \ 54690Sstevel@tonic-gate kvps=("%s:", (sun-printer-kvp) - yp:bsdaddr), \ 54700Sstevel@tonic-gate values=("%s:%s", yp:bsdaddr, yp:kvps), \ 54710Sstevel@tonic-gate values=("%s:", yp:bsdaddr), \ 54720Sstevel@tonic-gate values=yp:kvps, \ 54730Sstevel@tonic-gate rf_comment=description 54740Sstevel@tonic-gate 54750Sstevel@tonic-gate# prof_attr 54760Sstevel@tonic-gatenisLDAPfieldFromAttribute prof_attr: \ 54770Sstevel@tonic-gate rf_key=cn, \ 54780Sstevel@tonic-gate name=cn, \ 54790Sstevel@tonic-gate res1=SolarisAttrReserved1, \ 54800Sstevel@tonic-gate res2=SolarisAttrReserved2, \ 54810Sstevel@tonic-gate desc=SolarisAttrLongDesc, \ 54820Sstevel@tonic-gate attrs=SolarisAttrKeyValue 54830Sstevel@tonic-gate 54840Sstevel@tonic-gate# project 54850Sstevel@tonic-gatenisLDAPfieldFromAttribute project.byname: \ 54860Sstevel@tonic-gate rf_key=SolarisProjectName 54870Sstevel@tonic-gatenisLDAPfieldFromAttribute project.byprojid: \ 54880Sstevel@tonic-gate rf_key=SolarisProjectID 54890Sstevel@tonic-gatenisLDAPfieldFromAttribute project: \ 54900Sstevel@tonic-gate name=SolarisProjectName, \ 54910Sstevel@tonic-gate projID=SolarisProjectID, \ 54920Sstevel@tonic-gate comment=description, \ 54930Sstevel@tonic-gate users=("%s,", (memberUid), ","), \ 54940Sstevel@tonic-gate groups=("%s,", (memberGid), ","), \ 54950Sstevel@tonic-gate attrs=("%s;", (SolarisProjectAttr), ";") 54960Sstevel@tonic-gate 54970Sstevel@tonic-gate# protocols 54980Sstevel@tonic-gatenisLDAPfieldFromAttribute protocols.byname: \ 54990Sstevel@tonic-gate ("cn=%s,*", rf_key)=dn, \ 55000Sstevel@tonic-gate (rf_key)=(cn) 55010Sstevel@tonic-gatenisLDAPfieldFromAttribute protocols.bynumber: \ 55020Sstevel@tonic-gate rf_key=ipProtocolNumber, \ 55030Sstevel@tonic-gate rf_comment=description 55040Sstevel@tonic-gatenisLDAPfieldFromAttribute protocols: \ 55050Sstevel@tonic-gate ("cn=%s,*", name)=dn, \ 55060Sstevel@tonic-gate number=ipProtocolNumber, \ 55070Sstevel@tonic-gate aliases=("%s ", (cn) - yp:name, " ") 55080Sstevel@tonic-gate 55090Sstevel@tonic-gate# rpc.bynumber 55100Sstevel@tonic-gatenisLDAPfieldFromAttribute rpc.bynumber: \ 55110Sstevel@tonic-gate rf_key=oncRpcNumber, \ 55120Sstevel@tonic-gate number=oncRpcNumber, \ 55130Sstevel@tonic-gate ("cn=%s,*", name)=dn, \ 55140Sstevel@tonic-gate aliases=("%s ", (cn) - yp:name, " "), \ 55150Sstevel@tonic-gate rf_comment=description 55160Sstevel@tonic-gate 55170Sstevel@tonic-gate# services 55180Sstevel@tonic-gatenisLDAPfieldFromAttribute services.byname: \ 55190Sstevel@tonic-gate rf_key = ("%s/%s", ipServicePort, ipServiceProtocol) 55200Sstevel@tonic-gatenisLDAPfieldFromAttribute services.byservicename: \ 55210Sstevel@tonic-gate (rf_key)=("%s/%s", cn, ipServiceProtocol), \ 55220Sstevel@tonic-gate (rf_key)=(cn) 55230Sstevel@tonic-gatenisLDAPfieldFromAttribute services: \ 55240Sstevel@tonic-gate ("cn=%s+ipServiceProtocol=*", name)=dn, \ 55250Sstevel@tonic-gate protocol=ipServiceProtocol, \ 55260Sstevel@tonic-gate port=ipServicePort, \ 55270Sstevel@tonic-gate aliases=("%s ", (cn) - yp:name, " "), \ 55280Sstevel@tonic-gate rf_comment=description 55290Sstevel@tonic-gate 55300Sstevel@tonic-gate# timezone.byname 55310Sstevel@tonic-gatenisLDAPfieldFromAttribute timezone.byname: \ 55320Sstevel@tonic-gate rf_key=cn, \ 55330Sstevel@tonic-gate hostName=cn, \ 55340Sstevel@tonic-gate zoneName=nisplusTimeZone, \ 55350Sstevel@tonic-gate rf_comment=description 55360Sstevel@tonic-gate 55370Sstevel@tonic-gate# user_attr 55380Sstevel@tonic-gatenisLDAPfieldFromAttribute user_attr: \ 55390Sstevel@tonic-gate ("uid=%s,*", rf_key)=dn, \ 55400Sstevel@tonic-gate ("uid=%s,*", user)=dn, \ 55410Sstevel@tonic-gate qualifier=SolarisUserAttr, \ 55420Sstevel@tonic-gate res1=SolarisUserReserved1, \ 55430Sstevel@tonic-gate res2=SolarisUserReserved2, \ 55440Sstevel@tonic-gate attrs=SolarisAttrKeyValue 55450Sstevel@tonic-gate 55460Sstevel@tonic-gate# publickey.byname 55470Sstevel@tonic-gatenisLDAPfieldFromAttribute keys.host: \ 55480Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", cname)=dn, \ 55490Sstevel@tonic-gate rf_key=("unix.%s@%s", yp:cname, yp:rf_domain), \ 55500Sstevel@tonic-gate publicKey=nisPublicKey, \ 55510Sstevel@tonic-gate secretKey=nisSecretKey 55520Sstevel@tonic-gate 55530Sstevel@tonic-gatenisLDAPfieldFromAttribute keys.pass: \ 55540Sstevel@tonic-gate rf_key=("unix.%s@%s", uidNumber, yp:rf_domain), \ 55550Sstevel@tonic-gate publicKey=nisPublicKey, \ 55560Sstevel@tonic-gate secretKey=nisSecretKey 55570Sstevel@tonic-gate 55580Sstevel@tonic-gatenisLDAPfieldFromAttribute keys.nobody: \ 55590Sstevel@tonic-gate rf_key=uid, \ 55600Sstevel@tonic-gate publicKey=nisPublicKey, \ 55610Sstevel@tonic-gate secretKey=nisSecretKey 55620Sstevel@tonic-gate 55630Sstevel@tonic-gate# ypservers. This derived from IPlanet implementation not RFC. 55640Sstevel@tonic-gatenisLDAPfieldFromAttribute ypservers: \ 55650Sstevel@tonic-gate rf_key=cn 55660Sstevel@tonic-gate' >> $MAP_FILE 55670Sstevel@tonic-gate} 55680Sstevel@tonic-gate 55690Sstevel@tonic-gate 55700Sstevel@tonic-gate# 55710Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 55720Sstevel@tonic-gate# 55730Sstevel@tonic-gatelist_auto_and_custom_nisLDAPfieldFromAttribute() 55740Sstevel@tonic-gate{ 55750Sstevel@tonic-gate 55760Sstevel@tonic-gate# auto.* entries are easy. 55770Sstevel@tonic-gateif [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then 55780Sstevel@tonic-gate echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE 55790Sstevel@tonic-gatefi 55800Sstevel@tonic-gate 55810Sstevel@tonic-gatefor _MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} 55820Sstevel@tonic-gatedo 55830Sstevel@tonic-gate echo "\ 55840Sstevel@tonic-gate# ${_MAP} 55850Sstevel@tonic-gatenisLDAPfieldFromAttribute ${_MAP}: \\ 55860Sstevel@tonic-gate rf_key=automountKey, \\ 55870Sstevel@tonic-gate value=automountInformation 55880Sstevel@tonic-gate" >> $MAP_FILE 55890Sstevel@tonic-gatedone 55900Sstevel@tonic-gate 55910Sstevel@tonic-gate# Since we do not have enough information to generate 55920Sstevel@tonic-gate# entries for other custom maps, best we can do is to 55930Sstevel@tonic-gate# log this map names and ask user to take care of them. 55940Sstevel@tonic-gate 55950Sstevel@tonic-gateask_user_to_update_the_custom_map_entries_too 55960Sstevel@tonic-gate 55970Sstevel@tonic-gate} 55980Sstevel@tonic-gate 55990Sstevel@tonic-gate 56000Sstevel@tonic-gate# 56010Sstevel@tonic-gate# List mapping of named fields from DIT entries 56020Sstevel@tonic-gate# 56030Sstevel@tonic-gatecreate_nisLDAPfieldFromAttribute() 56040Sstevel@tonic-gate{ 56050Sstevel@tonic-gate 56060Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 56070Sstevel@tonic-gate# nisLDAPfieldFromAttribute : It specifies how a NIS entries 56080Sstevel@tonic-gate# field values are derived from LDAP attribute values. 56090Sstevel@tonic-gate# 56100Sstevel@tonic-gate# The format of nisLDAPfieldFromAttribute is : 56110Sstevel@tonic-gate# mapName ":" fieldattrspec *("," fieldattrspec) 56120Sstevel@tonic-gate' >> $MAP_FILE 56130Sstevel@tonic-gate 56140Sstevel@tonic-gate# List all the default entries anyway. 56150Sstevel@tonic-gatelist_default_nisLDAPfieldFromAttribute 56160Sstevel@tonic-gate 56170Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 56180Sstevel@tonic-gatelist_auto_and_custom_nisLDAPfieldFromAttribute 56190Sstevel@tonic-gate 56200Sstevel@tonic-gateecho " 56210Sstevel@tonic-gate# 56220Sstevel@tonic-gate#------------------------------------------------------------------------------ 56230Sstevel@tonic-gate# 56240Sstevel@tonic-gate" >> $MAP_FILE 56250Sstevel@tonic-gate} 56260Sstevel@tonic-gate 56270Sstevel@tonic-gate 56280Sstevel@tonic-gate 56290Sstevel@tonic-gate# Main function for creating the mapping file 56300Sstevel@tonic-gatecreate_mapping_file() 56310Sstevel@tonic-gate{ 56320Sstevel@tonic-gate# Ask user the list of domains to be served by N2L 56330Sstevel@tonic-gatecreate_n2l_domain_list 56340Sstevel@tonic-gate 56350Sstevel@tonic-gate# If there are no N2L domains or none selected, then exit 56360Sstevel@tonic-gateif [ $N2L_DMN_CNT -eq 0 ]; then 56370Sstevel@tonic-gate echo "There are no domains to serve. No mapping file generated." 56380Sstevel@tonic-gate return 1 56390Sstevel@tonic-gatefi 56400Sstevel@tonic-gate 56410Sstevel@tonic-gatewhile : 56420Sstevel@tonic-gatedo 56430Sstevel@tonic-gate get_ans "Enter the mapping file name (h=help):" "${MAP_FILE}" 56440Sstevel@tonic-gate 56450Sstevel@tonic-gate # If help continue, otherwise break. 56460Sstevel@tonic-gate case "$ANS" in 56470Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg new_mapping_file_name_help ;; 56480Sstevel@tonic-gate * ) break ;; 56490Sstevel@tonic-gate esac 56500Sstevel@tonic-gatedone 56510Sstevel@tonic-gate 56520Sstevel@tonic-gateMAP_FILE=${ANS} 56530Sstevel@tonic-gate[ $DEBUG -eq 1 ] && MAP_FILE = $MAP_FILE 56540Sstevel@tonic-gate 56550Sstevel@tonic-gate# Backup existing mapping file if selected 56560Sstevel@tonic-gatecheck_back_mapping_file 56570Sstevel@tonic-gate 56580Sstevel@tonic-gate# To prevent from leaving a partial mapping file in case some error 56590Sstevel@tonic-gate# or signal takes place which might result in machine starting in N2L 56600Sstevel@tonic-gate# mode at next reboot, store the output being generated in a temporary 56610Sstevel@tonic-gate# file first, and move it at the final destination only at the end if 56620Sstevel@tonic-gate# everything goes fine. 56630Sstevel@tonic-gate 56640Sstevel@tonic-gate_MAP_FILE=$MAP_FILE 56650Sstevel@tonic-gateMAP_FILE=${TMPDIR}/${TMPMAP}.$$ 56660Sstevel@tonic-gate 56670Sstevel@tonic-gateecho "Generating mapping file temporarily as \"${MAP_FILE}\"" 56680Sstevel@tonic-gate 56690Sstevel@tonic-gate# Place copyright information 56700Sstevel@tonic-gateput_mapping_file_copyright_info 56710Sstevel@tonic-gate 56720Sstevel@tonic-gate 56730Sstevel@tonic-gate# Prepare various map lists for each domain 56740Sstevel@tonic-gatecreate_map_lists 56750Sstevel@tonic-gate 56760Sstevel@tonic-gate# List domains and contexts 56770Sstevel@tonic-gateget_nisLDAPdomainContext 56780Sstevel@tonic-gate 56790Sstevel@tonic-gate# List domains for which passwords should be changed 56800Sstevel@tonic-gateget_nisLDAPyppasswddDomains 56810Sstevel@tonic-gate 56820Sstevel@tonic-gate# List databaseId mappings (aliases) 56830Sstevel@tonic-gatecreate_nisLDAPdatabaseIdMapping 56840Sstevel@tonic-gate 56850Sstevel@tonic-gate# List comment character for maps 56860Sstevel@tonic-gatecreate_nisLDAPcommentChar 56870Sstevel@tonic-gate 56880Sstevel@tonic-gate# List SECURE and INTERDOMAIN flags 56890Sstevel@tonic-gatecreate_nisLDAPmapFlags 56900Sstevel@tonic-gate 56910Sstevel@tonic-gate# List TTL values 56920Sstevel@tonic-gate create_nisLDAPentryTtl 56930Sstevel@tonic-gate 56940Sstevel@tonic-gate# List name fields 56950Sstevel@tonic-gatecreate_nisLDAPnameFields 56960Sstevel@tonic-gate 56970Sstevel@tonic-gate# List split fields and repeated fields seperators. 56980Sstevel@tonic-gatecreate_split_field_and_repeatedfield_seperators 56990Sstevel@tonic-gate 57000Sstevel@tonic-gate# List association of maps with RDNs and object classes. 57010Sstevel@tonic-gatecreate_nisLDAPobjectDN 57020Sstevel@tonic-gate 57030Sstevel@tonic-gate# List mapping of named fields to DIT entries 57040Sstevel@tonic-gatecreate_nisLDAPattributeFromField 57050Sstevel@tonic-gate 57060Sstevel@tonic-gate# List mapping of named fields from DIT entries 57070Sstevel@tonic-gatecreate_nisLDAPfieldFromAttribute 57080Sstevel@tonic-gate 57090Sstevel@tonic-gate 57100Sstevel@tonic-gate# We are done, so move back the mapping file from temp. location 57110Sstevel@tonic-gate# to actual location. 57120Sstevel@tonic-gate# In case the mapping file name has a directory component which does 57130Sstevel@tonic-gate# not exist, then create it now, otherwise 'mv' will return error. 57140Sstevel@tonic-gate 57150Sstevel@tonic-gateDIR_TO_CREATE=`dirname ${_MAP_FILE}` 57160Sstevel@tonic-gatemkdir -p ${DIR_TO_CREATE} 57170Sstevel@tonic-gate 57180Sstevel@tonic-gateecho "Moving output from temporary file ($MAP_FILE) to actual file ($_MAP_FILE)" 57190Sstevel@tonic-gatemv $MAP_FILE $_MAP_FILE 57200Sstevel@tonic-gate 57210Sstevel@tonic-gate# Revert back the mapping file name in case needed. 57220Sstevel@tonic-gateMAP_FILE=$_MAP_FILE 57230Sstevel@tonic-gateecho "Finished creation of mapping file ( $MAP_FILE )" 57240Sstevel@tonic-gate 57250Sstevel@tonic-gate} 57260Sstevel@tonic-gate 57270Sstevel@tonic-gate 57280Sstevel@tonic-gate# 57290Sstevel@tonic-gate# Main function for creating config file (ypserv) 57300Sstevel@tonic-gate# 57310Sstevel@tonic-gateprocess_config_file() 57320Sstevel@tonic-gate{ 57330Sstevel@tonic-gate# Ask for confirmation if the file name is not specified. 57340Sstevel@tonic-gate 57350Sstevel@tonic-gateif [ $CONFIG_FILE_SPECIFIED -eq 0 ]; then 57360Sstevel@tonic-gate display_msg no_config_file_name_specified 57370Sstevel@tonic-gate 57380Sstevel@tonic-gate get_confirm_nodef "Do you want to create the config file (y/n) ?" 57390Sstevel@tonic-gate 57400Sstevel@tonic-gate [ $? -eq 0 ] && return 0 57410Sstevel@tonic-gate 57420Sstevel@tonic-gate while : 57430Sstevel@tonic-gate do 57440Sstevel@tonic-gate get_ans "Enter the config file name (h=help):" "${CONFIG_FILE}" 57450Sstevel@tonic-gate 57460Sstevel@tonic-gate # If help continue, otherwise break. 57470Sstevel@tonic-gate case "$ANS" in 57480Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg new_config_file_name_help ;; 57490Sstevel@tonic-gate * ) break ;; 57500Sstevel@tonic-gate esac 57510Sstevel@tonic-gate done 57520Sstevel@tonic-gate 57530Sstevel@tonic-gate CONFIG_FILE=${ANS} 57540Sstevel@tonic-gate [ $DEBUG -eq 1 ] && CONFIG_FILE = $CONFIG_FILE 57550Sstevel@tonic-gate 57560Sstevel@tonic-gatefi 57570Sstevel@tonic-gate 57580Sstevel@tonic-gate# Backup existing config file if selected 57590Sstevel@tonic-gatecheck_back_config_file 57600Sstevel@tonic-gate 57610Sstevel@tonic-gate# Create config file 57620Sstevel@tonic-gatecreate_config_file 57630Sstevel@tonic-gate} 57640Sstevel@tonic-gate 57650Sstevel@tonic-gate 57660Sstevel@tonic-gate# 57670Sstevel@tonic-gate# Main function for creating mapping file (NISLDAPmapping) 57680Sstevel@tonic-gate# 57690Sstevel@tonic-gateprocess_mapping_file() 57700Sstevel@tonic-gate{ 57710Sstevel@tonic-gate# Ask for confirmation if the file name is not specified. 57720Sstevel@tonic-gate 57730Sstevel@tonic-gateif [ $MAPPING_FILE_SPECIFIED -eq 0 ]; then 57740Sstevel@tonic-gate display_msg no_mapping_file_name_specified 57750Sstevel@tonic-gate 57760Sstevel@tonic-gate get_confirm_nodef "Do you want to create the mapping file (y/n) ?" 57770Sstevel@tonic-gate 57780Sstevel@tonic-gate [ $? -eq 0 ] && return 0 57790Sstevel@tonic-gate 57800Sstevel@tonic-gate 57810Sstevel@tonic-gatefi 57820Sstevel@tonic-gate 57830Sstevel@tonic-gate# Create mapping file 57840Sstevel@tonic-gatecreate_mapping_file 57850Sstevel@tonic-gate} 57860Sstevel@tonic-gate 57870Sstevel@tonic-gate########################################### 57880Sstevel@tonic-gate########### MAIN ########### 57890Sstevel@tonic-gate########################################### 57900Sstevel@tonic-gate 57910Sstevel@tonic-gatePROG=`basename $0` # Program name 57920Sstevel@tonic-gateABS_PROG=$0 # absolute path needed 57930Sstevel@tonic-gate 57940Sstevel@tonic-gate# Only superuser should be able to run this script. 57950Sstevel@tonic-gateis_root_user 57960Sstevel@tonic-gateif [ $? -ne 0 ]; then 57970Sstevel@tonic-gate echo "ERROR : Only root can run $PROG" 57980Sstevel@tonic-gate exit 1 57990Sstevel@tonic-gatefi 58000Sstevel@tonic-gate 58010Sstevel@tonic-gate# Initialize things 58020Sstevel@tonic-gateinit 58030Sstevel@tonic-gate 58040Sstevel@tonic-gate# Parse command line arguments. 58050Sstevel@tonic-gateparse_arg $* 58060Sstevel@tonic-gate 58070Sstevel@tonic-gate# Create config file (ypserv) 58080Sstevel@tonic-gateprocess_config_file 58090Sstevel@tonic-gate 58100Sstevel@tonic-gate# Create mapping file (NISLDAPmapping). 58110Sstevel@tonic-gateprocess_mapping_file 58120Sstevel@tonic-gate 58130Sstevel@tonic-gate# Cleanup temp files and directories unless debug. 58140Sstevel@tonic-gate[ $DEBUG -eq 0 ] && cleanup 58150Sstevel@tonic-gate 58160Sstevel@tonic-gateexit 0 5817