17c478bd9Sstevel@tonic-gate#! /usr/bin/ksh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6bcd524b5Sgww# Common Development and Distribution License (the "License"). 7bcd524b5Sgww# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 23*c3e9074dSBen Chang# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 24*c3e9074dSBen Chang# 25*c3e9074dSBen Chang 267c478bd9Sstevel@tonic-gate# 277c478bd9Sstevel@tonic-gate# inityp2l -- Utility to generate YP (NIS) to LDAP 287c478bd9Sstevel@tonic-gate# configuration file (/etc/default/ypserv) 297c478bd9Sstevel@tonic-gate# and mapping file (/var/yp/NISLDAPmapping) 307c478bd9Sstevel@tonic-gate# 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate# 357c478bd9Sstevel@tonic-gate# Displays message corresponding to the argument tag passed. 367c478bd9Sstevel@tonic-gate# 377c478bd9Sstevel@tonic-gatedisplay_msg() 387c478bd9Sstevel@tonic-gate{ 397c478bd9Sstevel@tonic-gate case "$1" in 407c478bd9Sstevel@tonic-gate usage) cat <<EOF 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate $PROG: [ -m mapping_file ] [ -c config_file ] 437c478bd9Sstevel@tonic-gate m <mapping_file> Name of the generated NISLDAP mapping file 447c478bd9Sstevel@tonic-gate Default is /var/yp/NISLDAPmapping 457c478bd9Sstevel@tonic-gate c <config_file> Name of the generated ypserv configuration file 467c478bd9Sstevel@tonic-gate Default is /etc/default/ypserv 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gateEOF 497c478bd9Sstevel@tonic-gate ;; 507c478bd9Sstevel@tonic-gate no_config_file_name_specified) cat <<EOF 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gateYou have not specified the config file name. You still have the 537c478bd9Sstevel@tonic-gateoption to skip creating this file, specify a config file name, or 547c478bd9Sstevel@tonic-gatecontinue creating it with the default file name (${CONFIG_FILE}). 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gateEOF 577c478bd9Sstevel@tonic-gate ;; 587c478bd9Sstevel@tonic-gate no_mapping_file_name_specified) cat <<EOF 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gateYou have not specified the mapping file name. You still have the 617c478bd9Sstevel@tonic-gateoption to skip creating this file, specify a mapping file name, or 627c478bd9Sstevel@tonic-gatecontinue creating it with the default file name (${MAP_FILE}). 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gateEOF 657c478bd9Sstevel@tonic-gate ;; 667c478bd9Sstevel@tonic-gate new_config_file_name_help) cat <<EOF 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gateYou can either specify a new file name, or accept the default 697c478bd9Sstevel@tonic-gateconfig file name (${CONFIG_FILE}). 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gateIt is recommended not to use the default file name since this 727c478bd9Sstevel@tonic-gatescript just helps with rapid creation of a config file. You 737c478bd9Sstevel@tonic-gateshould examine it's content before using it. 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gateEOF 767c478bd9Sstevel@tonic-gate ;; 777c478bd9Sstevel@tonic-gate new_mapping_file_name_help) cat <<EOF 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gateYou can either specify a new file name, or accept the default 807c478bd9Sstevel@tonic-gatemapping file name (${MAP_FILE}). 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gateIt is recommended not to use the default file name since this 837c478bd9Sstevel@tonic-gatescript just helps with rapid creation of a mapping file. You 847c478bd9Sstevel@tonic-gateshould examine it's content before using it. And if there are 857c478bd9Sstevel@tonic-gatecustom maps, then their entries in the mapping file need to be 867c478bd9Sstevel@tonic-gatecustomized too. 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gateAlso, creation of default mapping file would cause NIS components 897c478bd9Sstevel@tonic-gateto work in NIS to LDAP (N2L), rather than traditional NIS, mode 907c478bd9Sstevel@tonic-gatewhen next restarted. 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gateEOF 937c478bd9Sstevel@tonic-gate ;; 947c478bd9Sstevel@tonic-gate backup_config_file) cat <<EOF 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gateThe config file "${CONFIG_FILE}" already exists. It is strongly 977c478bd9Sstevel@tonic-gaterecommended that you BACKUP this file before running $PROG. 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gateHowever, even if you continue, you would be given the option to 1007c478bd9Sstevel@tonic-gateback up this file before it gets overwritten. 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gateEOF 1037c478bd9Sstevel@tonic-gate ;; 1047c478bd9Sstevel@tonic-gate backup_mapping_file) cat <<EOF 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gateThe mapping file "${MAP_FILE}" already exists. It is strongly 1077c478bd9Sstevel@tonic-gaterecommended that you BACKUP this file before running $PROG. 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gateHowever, even if you continue, you would be given the option to 1107c478bd9Sstevel@tonic-gateback up this file before it gets overwritten. 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gateEOF 1137c478bd9Sstevel@tonic-gate ;; 1147c478bd9Sstevel@tonic-gate warn_n2l_mode) cat <<EOF 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gateWarning : Creation of default mapping file (`basename $MAP_FILE`) 1177c478bd9Sstevel@tonic-gate at default location (`dirname $MAP_FILE`) would cause NIS 1187c478bd9Sstevel@tonic-gate components to work in NIS to LDAP (N2L) mode, rather than 1197c478bd9Sstevel@tonic-gate traditional NIS mode, when next restarted. 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate "$PROG" assists with rapid creation of a simple N2L mapping 1227c478bd9Sstevel@tonic-gate file. The user should examine it's content before using it. 1237c478bd9Sstevel@tonic-gate For custom maps, this file needs to be customized which can 1247c478bd9Sstevel@tonic-gate be done using standard text editors. 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gateEOF 1277c478bd9Sstevel@tonic-gate ;; 1287c478bd9Sstevel@tonic-gate config_auth_method_menu) cat <<EOF 1297c478bd9Sstevel@tonic-gate The following are the supported Authentication Methods - 1307c478bd9Sstevel@tonic-gate 1 none 1317c478bd9Sstevel@tonic-gate 2 simple 1327c478bd9Sstevel@tonic-gate 3 sasl/cram-md5 1337c478bd9Sstevel@tonic-gate 4 sasl/digest-md5 1347c478bd9Sstevel@tonic-gateEOF 1357c478bd9Sstevel@tonic-gate ;; 1367c478bd9Sstevel@tonic-gate auth_method_menu) cat <<EOF 1377c478bd9Sstevel@tonic-gate The following are the supported Authentication Methods - 1387c478bd9Sstevel@tonic-gate 1 simple 1397c478bd9Sstevel@tonic-gate 2 sasl/cram-md5 1407c478bd9Sstevel@tonic-gate 3 sasl/digest-md5 1417c478bd9Sstevel@tonic-gateEOF 1427c478bd9Sstevel@tonic-gate ;; 1437c478bd9Sstevel@tonic-gate tls_method_menu) cat <<EOF 1447c478bd9Sstevel@tonic-gate The following are the supported TLS Methods - 1457c478bd9Sstevel@tonic-gate 1 none 1467c478bd9Sstevel@tonic-gate 2 ssl 1477c478bd9Sstevel@tonic-gateEOF 1487c478bd9Sstevel@tonic-gate ;; 1497c478bd9Sstevel@tonic-gate retrieve_error_action_menu) cat <<EOF 1507c478bd9Sstevel@tonic-gate The following are the supported actions - 1517c478bd9Sstevel@tonic-gate 1 use_cached 1527c478bd9Sstevel@tonic-gate 2 fail 1537c478bd9Sstevel@tonic-gateEOF 1547c478bd9Sstevel@tonic-gate ;; 1557c478bd9Sstevel@tonic-gate store_error_action_menu) cat <<EOF 1567c478bd9Sstevel@tonic-gate The following are the supported actions - 1577c478bd9Sstevel@tonic-gate 1 retry 1587c478bd9Sstevel@tonic-gate 2 fail 1597c478bd9Sstevel@tonic-gateEOF 1607c478bd9Sstevel@tonic-gate ;; 1617c478bd9Sstevel@tonic-gate sorry) cat <<EOF 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gateHELP - No help is available for this topic. 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gateEOF 1667c478bd9Sstevel@tonic-gate ;; 1677c478bd9Sstevel@tonic-gate backup_config_file_cont_help) cat <<EOF 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gateHELP - Since $PROG will overwrite the existing config file, it is 1707c478bd9Sstevel@tonic-gate strongly recommended that you backup this file prior to 1717c478bd9Sstevel@tonic-gate running this utility. 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate However, even if you continue, you would be given the option 1747c478bd9Sstevel@tonic-gate to back up this file before it gets overwritten. 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gateEOF 1777c478bd9Sstevel@tonic-gate ;; 1787c478bd9Sstevel@tonic-gate backup_config_file_help) cat <<EOF 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gateHELP - If you choose to backup the existing config file, it would be 1817c478bd9Sstevel@tonic-gate saved with current date and time suffix in yymmdd.HH.MM.SS format. 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gateEOF 1847c478bd9Sstevel@tonic-gate ;; 1857c478bd9Sstevel@tonic-gate backup_mapping_file_cont_help) cat <<EOF 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gateHELP - Since $PROG will overwrite the existing mapping file, it is 1887c478bd9Sstevel@tonic-gate strongly recommended that you backup this file prior to running 1897c478bd9Sstevel@tonic-gate this utility. 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate However, even if you continue, you would be given the option to 1927c478bd9Sstevel@tonic-gate back up this file before it gets overwritten. 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gateEOF 1957c478bd9Sstevel@tonic-gate ;; 1967c478bd9Sstevel@tonic-gate backup_mapping_file_help) cat <<EOF 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gateHELP - If you choose to backup the existing mapping file, it would be 1997c478bd9Sstevel@tonic-gate saved with current date and time suffix in yymmdd.HH.MM.SS format. 2007c478bd9Sstevel@tonic-gate 2017c478bd9Sstevel@tonic-gateEOF 2027c478bd9Sstevel@tonic-gate ;; 2037c478bd9Sstevel@tonic-gate warn_n2l_mode_help) cat <<EOF 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gateHELP - It is strongly recommended that the mapping file is created at 2067c478bd9Sstevel@tonic-gate non-default location (other than `dirname $MAP_FILE`). After this, 2077c478bd9Sstevel@tonic-gate it's content should be verified, custom maps should be handled, 2087c478bd9Sstevel@tonic-gate and if NIS components are desired to run in NIS to LDAP (N2L), 2097c478bd9Sstevel@tonic-gate then only it should be copied at the default location. 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gateEOF 2127c478bd9Sstevel@tonic-gate ;; 2137c478bd9Sstevel@tonic-gate nisLDAPconfigDN_help) cat <<EOF 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gateHELP - The DN which stores the configuration information in LDAP. 2167c478bd9Sstevel@tonic-gate There is no default value for this field. Leave empty or 2177c478bd9Sstevel@tonic-gate undefined to get this information from config file (ypserv). 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gateEOF 2207c478bd9Sstevel@tonic-gate ;; 2217c478bd9Sstevel@tonic-gate nisLDAPconfigPreferredServerList_help) cat <<EOF 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gateHELP - List of directory servers to provide the configuration 2247c478bd9Sstevel@tonic-gate information. There is no default. The preferred servers 2257c478bd9Sstevel@tonic-gate must be entered IN THE ORDER you wish to have them contacted. 2267c478bd9Sstevel@tonic-gate The preferred server list is a space separated list of IP 2277c478bd9Sstevel@tonic-gate addresses. Providing port numbers is optional, and when not 2287c478bd9Sstevel@tonic-gate supplied, port 389 is assumed. For an LDAP server running 2297c478bd9Sstevel@tonic-gate on this machine, at port 389, use "127.0.0.1:389". 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gateEOF 2327c478bd9Sstevel@tonic-gate ;; 2337c478bd9Sstevel@tonic-gate auth_help) cat <<EOF 2347c478bd9Sstevel@tonic-gate 2357c478bd9Sstevel@tonic-gateHELP - The authentication method to be used to obtain information 2367c478bd9Sstevel@tonic-gate from LDAP server. The supported methods are provided in menu. 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gateEOF 2397c478bd9Sstevel@tonic-gate ;; 2407c478bd9Sstevel@tonic-gate tls_help) cat <<EOF 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gateHELP - The transport layer security used for connection to the LDAP 2437c478bd9Sstevel@tonic-gate server. In order to successfully use transport layer security, 2447c478bd9Sstevel@tonic-gate the server must also support the chosen values. The supported 2457c478bd9Sstevel@tonic-gate methods are provided in menu. Default is "$DEF_TLS". 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gateEOF 2487c478bd9Sstevel@tonic-gate ;; 2497c478bd9Sstevel@tonic-gate TLSCertificateDBPath_help) cat <<EOF 2507c478bd9Sstevel@tonic-gate 2511d7382f7SMilan JurikHELP - The absolute path name of the directory containing the certificate 2527c478bd9Sstevel@tonic-gate database. The default value is "$DEF_TLSCertificateDBPath" 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gateEOF 2557c478bd9Sstevel@tonic-gate ;; 2567c478bd9Sstevel@tonic-gate nisLDAPconfigProxyUser_help) cat <<EOF 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gateHELP - The bind DN of the proxy user used to obtain configuration 2597c478bd9Sstevel@tonic-gate information. There is no default value. If the value ends 2607c478bd9Sstevel@tonic-gate with a comma, the value of the nisLDAPconfigDN attribute 2617c478bd9Sstevel@tonic-gate is appended. 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gateEOF 2647c478bd9Sstevel@tonic-gate ;; 2657c478bd9Sstevel@tonic-gate ProxyPassword_warn) cat <<EOF 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gateWarning : In order to avoid having this password publicly visible 2687c478bd9Sstevel@tonic-gate on the machine, the password should appear only in the 2697c478bd9Sstevel@tonic-gate configuration file, and the file should have an appropriate 2707c478bd9Sstevel@tonic-gate owner, group, and file mode. 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate So, once this file is ready, please modify appropriately 2737c478bd9Sstevel@tonic-gate to make sure this file is well protected. 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gateEOF 2767c478bd9Sstevel@tonic-gate ;; 2777c478bd9Sstevel@tonic-gate preferredServerList_help) cat <<EOF 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gateHELP - List of directory servers for mapping data to/from LDAP. 2807c478bd9Sstevel@tonic-gate There is no default. The preferred servers must be entered 2817c478bd9Sstevel@tonic-gate IN THE ORDER you wish to have them contacted. The preferred 2827c478bd9Sstevel@tonic-gate server list is a space separated list of IP addresses. 2837c478bd9Sstevel@tonic-gate Providing port numbers is optional, and when not supplied, 2847c478bd9Sstevel@tonic-gate port 389 is assumed. For an LDAP server running on this 2857c478bd9Sstevel@tonic-gate machine, at port 389, use "127.0.0.1:389". 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gateEOF 2887c478bd9Sstevel@tonic-gate ;; 2897c478bd9Sstevel@tonic-gate nisLDAPproxyUser_help) cat <<EOF 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gateHELP - The bind DN of the proxy user the ypserv to read or write 2927c478bd9Sstevel@tonic-gate from or to LDAP. Assumed to have the appropriate permission 2937c478bd9Sstevel@tonic-gate to read and modify LDAP data. There is no default value. If 2947c478bd9Sstevel@tonic-gate the value ends with a comma, the value of the context for 2957c478bd9Sstevel@tonic-gate the current domain (as defined by a nisLDAPdomainContext 2967c478bd9Sstevel@tonic-gate attribute (NISLDAPmapping(4))) is appended. 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gateEOF 2997c478bd9Sstevel@tonic-gate ;; 3007c478bd9Sstevel@tonic-gate nisLDAPbindTimeout_help) cat <<EOF 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP bind operation 3037c478bd9Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPbindTimeout seconds. 3047c478bd9Sstevel@tonic-gate Decimal values are allowed. 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gateEOF 3077c478bd9Sstevel@tonic-gate ;; 3087c478bd9Sstevel@tonic-gate nisLDAPsearchTimeout_help) cat <<EOF 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP search operation 3117c478bd9Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPsearchTimeout seconds. 3127c478bd9Sstevel@tonic-gate Decimal values are allowed. 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gateEOF 3157c478bd9Sstevel@tonic-gate ;; 3167c478bd9Sstevel@tonic-gate nisLDAPmodifyTimeout_help) cat <<EOF 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP modify operation 3197c478bd9Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPmodifyTimeout seconds. 3207c478bd9Sstevel@tonic-gate Decimal values are allowed. 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gateEOF 3237c478bd9Sstevel@tonic-gate ;; 3247c478bd9Sstevel@tonic-gate nisLDAPaddTimeout_help) cat <<EOF 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP add operation 3277c478bd9Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPaddTimeout seconds. 3287c478bd9Sstevel@tonic-gate Decimal values are allowed. 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gateEOF 3317c478bd9Sstevel@tonic-gate ;; 3327c478bd9Sstevel@tonic-gate nisLDAPdeleteTimeout_help) cat <<EOF 3337c478bd9Sstevel@tonic-gate 3347c478bd9Sstevel@tonic-gateHELP - The amount of time in seconds after which an LDAP delete operation 3357c478bd9Sstevel@tonic-gate will timeout. Default is $DEF_nisLDAPdeleteTimeout seconds. 3367c478bd9Sstevel@tonic-gate Decimal values are allowed. 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gateEOF 3397c478bd9Sstevel@tonic-gate ;; 3407c478bd9Sstevel@tonic-gate nisLDAPsearchTimeLimit_help) cat <<EOF 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gateHELP - Establish a value for the LDAP_OPT_TIMELIMIT option, which 3437c478bd9Sstevel@tonic-gate suggests a time limit for the search operation on the LDAP 3447c478bd9Sstevel@tonic-gate server. The server may impose its own constraints on possible 3457c478bd9Sstevel@tonic-gate values. See your LDAP server documentation. The default is the 3467c478bd9Sstevel@tonic-gate nisLDAPsearchTimeout ($DEF_nisLDAPsearchTimeout seconds) value. 3477c478bd9Sstevel@tonic-gate Only integer values are allowed. 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate Since the nisLDAPsearchTimeout limits the amount of time the 3507c478bd9Sstevel@tonic-gate client ypserv will wait for completion of a search operation, 3517c478bd9Sstevel@tonic-gate setting the nisLDAPsearchTimeLimit larger than the 3527c478bd9Sstevel@tonic-gate nisLDAPsearchTimeout is not recommended. 3537c478bd9Sstevel@tonic-gate 3547c478bd9Sstevel@tonic-gateEOF 3557c478bd9Sstevel@tonic-gate ;; 3567c478bd9Sstevel@tonic-gate nisLDAPsearchSizeLimit_help) cat <<EOF 3577c478bd9Sstevel@tonic-gate 3587c478bd9Sstevel@tonic-gateHELP - Establish a value for the LDAP_OPT_SIZELIMIT option, which 3597c478bd9Sstevel@tonic-gate suggests a size limit, in bytes, for the search results on 3607c478bd9Sstevel@tonic-gate the LDAP server. The server may impose its own constraints 3617c478bd9Sstevel@tonic-gate on possible values. See your LDAP server documentation. The 3627c478bd9Sstevel@tonic-gate default is $DEF_nisLDAPsearchSizeLimit, which means unlimited. 3637c478bd9Sstevel@tonic-gate Only integer values are allowed. 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gateEOF 3667c478bd9Sstevel@tonic-gate ;; 3677c478bd9Sstevel@tonic-gate nisLDAPfollowReferral_help) cat <<EOF 3687c478bd9Sstevel@tonic-gate 3697c478bd9Sstevel@tonic-gateHELP - Determines if the ypserv should follow referrals or not. 3707c478bd9Sstevel@tonic-gate Recognized values are yes and no. Default is $DEF_nisLDAPfollowReferral. 3717c478bd9Sstevel@tonic-gate 3727c478bd9Sstevel@tonic-gateEOF 3737c478bd9Sstevel@tonic-gate ;; 3747c478bd9Sstevel@tonic-gate nisLDAPretrieveErrorAction_help) cat <<EOF 3757c478bd9Sstevel@tonic-gate 3767c478bd9Sstevel@tonic-gateHELP - If an error occurs while trying to retrieve an entry from 3777c478bd9Sstevel@tonic-gate LDAP, one of the following actions can be selected: 3787c478bd9Sstevel@tonic-gate 3797c478bd9Sstevel@tonic-gate use_cached : Retry the retrieval the number of time specified 3807c478bd9Sstevel@tonic-gate by nisLDAPretrieveErrorAttempts, with the 3817c478bd9Sstevel@tonic-gate nisLDAPretrieveErrorTimeout value controlling 3827c478bd9Sstevel@tonic-gate the wait between each attempt. 3837c478bd9Sstevel@tonic-gate 3847c478bd9Sstevel@tonic-gate If all attempts fail then log a warning and 3857c478bd9Sstevel@tonic-gate return the value currently in the cache to the 3867c478bd9Sstevel@tonic-gate client. This is the default value. 3877c478bd9Sstevel@tonic-gate 3887c478bd9Sstevel@tonic-gate fail : Proceed as for 'use_cached' but if all attempts 3897c478bd9Sstevel@tonic-gate fail return a YPERR_YPERR error to the client. 3907c478bd9Sstevel@tonic-gate 3917c478bd9Sstevel@tonic-gateEOF 3927c478bd9Sstevel@tonic-gate ;; 3937c478bd9Sstevel@tonic-gate nisLDAPretrieveErrorAttempts_help) cat <<EOF 3947c478bd9Sstevel@tonic-gate 3957c478bd9Sstevel@tonic-gateHELP - The number of times a failed retrieval should be retried. 3967c478bd9Sstevel@tonic-gate The default is unlimited. Note while retries are made, the 3977c478bd9Sstevel@tonic-gate NIS daemon will be prevented from servicing further requests. 3987c478bd9Sstevel@tonic-gate Hence, values other than 1 should be used with caution. 3997c478bd9Sstevel@tonic-gate 4007c478bd9Sstevel@tonic-gateEOF 4017c478bd9Sstevel@tonic-gate ;; 4027c478bd9Sstevel@tonic-gate nisLDAPretrieveErrorTimeout_help) cat <<EOF 4037c478bd9Sstevel@tonic-gate 4047c478bd9Sstevel@tonic-gateHELP - The timeout (in seconds) between each new attempt to retrieve 4057c478bd9Sstevel@tonic-gate LDAP data. Default is $DEF_nisLDAPretrieveErrorTimeout seconds. 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gateEOF 4087c478bd9Sstevel@tonic-gate ;; 4097c478bd9Sstevel@tonic-gate nisLDAPstoreErrorAction_help) cat <<EOF 4107c478bd9Sstevel@tonic-gate 4117c478bd9Sstevel@tonic-gateHELP - If an error occurs while trying to store data to the LDAP 4127c478bd9Sstevel@tonic-gate repository, one of the following actions can be selected : 4137c478bd9Sstevel@tonic-gate 4147c478bd9Sstevel@tonic-gate retry : Retry operation nisLDAPstoreErrorAttempts times with 4157c478bd9Sstevel@tonic-gate nisLDAPstoreErrorTimeout seconds between each attempt. 4167c478bd9Sstevel@tonic-gate Note while retries are made the NIS daemon will be 4177c478bd9Sstevel@tonic-gate prevented from servicing further requests. Use with 4187c478bd9Sstevel@tonic-gate caution. This is the default value. 4197c478bd9Sstevel@tonic-gate 4207c478bd9Sstevel@tonic-gate fail : Return YPERR_YPERR error to the client. 4217c478bd9Sstevel@tonic-gate 4227c478bd9Sstevel@tonic-gateEOF 4237c478bd9Sstevel@tonic-gate ;; 4247c478bd9Sstevel@tonic-gate nisLDAPstoreErrorAttempts_help) cat <<EOF 4257c478bd9Sstevel@tonic-gate 4267c478bd9Sstevel@tonic-gateHELP - The number of times a failed attempt to store data to the 4277c478bd9Sstevel@tonic-gate LDAP repository should be retried. The default is unlimited. 4287c478bd9Sstevel@tonic-gate 4297c478bd9Sstevel@tonic-gate The value for nisLDAPstoreErrorAttempts is ignored unless 4307c478bd9Sstevel@tonic-gate nisLDAPstoreErrorAction=retry. 4317c478bd9Sstevel@tonic-gate 4327c478bd9Sstevel@tonic-gateEOF 4337c478bd9Sstevel@tonic-gate ;; 4347c478bd9Sstevel@tonic-gate nisLDAPstoreErrorTimeout_help) cat <<EOF 4357c478bd9Sstevel@tonic-gate 4367c478bd9Sstevel@tonic-gateHELP - The timeout (in seconds) between each new attempt to store 4377c478bd9Sstevel@tonic-gate LDAP data. Default is $DEF_nisLDAPstoreErrorTimeout seconds. 4387c478bd9Sstevel@tonic-gate 4397c478bd9Sstevel@tonic-gate The value for nisLDAPstoreErrorTimeout is ignored unless 4407c478bd9Sstevel@tonic-gate nisLDAPstoreErrorAction=retry. 4417c478bd9Sstevel@tonic-gate 4427c478bd9Sstevel@tonic-gateEOF 4437c478bd9Sstevel@tonic-gate ;; 4447c478bd9Sstevel@tonic-gate selectDomain4N2L_help) cat <<EOF 4457c478bd9Sstevel@tonic-gate 4467c478bd9Sstevel@tonic-gateHELP - Whether this domain needs to be served by YP to LDAP transition 4477c478bd9Sstevel@tonic-gate solution. The default is no in which case the data in this 4487c478bd9Sstevel@tonic-gate domain would not be taken care for transitioning to LDAP. 4497c478bd9Sstevel@tonic-gate 4507c478bd9Sstevel@tonic-gateEOF 4517c478bd9Sstevel@tonic-gate ;; 4527c478bd9Sstevel@tonic-gate generate_comment_info_for_cust_map_help) cat <<EOF 4537c478bd9Sstevel@tonic-gate 4547c478bd9Sstevel@tonic-gateHELP - If selected, this script will try to add relevant comments 4557c478bd9Sstevel@tonic-gate in the mapping file which might help in customizing the 4567c478bd9Sstevel@tonic-gate mapping information for custom maps. 4577c478bd9Sstevel@tonic-gate 4587c478bd9Sstevel@tonic-gateEOF 4597c478bd9Sstevel@tonic-gate ;; 4607c478bd9Sstevel@tonic-gate generate_mapping_info_for_cust_map_help) cat <<EOF 4617c478bd9Sstevel@tonic-gate 4627c478bd9Sstevel@tonic-gateHELP - If selected, this script will try to generate mapping 4637c478bd9Sstevel@tonic-gate information for this map assuming it is a "simple" map. 4647c478bd9Sstevel@tonic-gate 4657c478bd9Sstevel@tonic-gate A map is assumed to be "simple" if each entry of this map 4667c478bd9Sstevel@tonic-gate has only one "key value" entry in YP, and if each map entry 4677c478bd9Sstevel@tonic-gate can be represented as a single DIT string in the LDAP server. 4687c478bd9Sstevel@tonic-gate 4697c478bd9Sstevel@tonic-gate If this map is not a simple map and you do want to store it 4707c478bd9Sstevel@tonic-gate in LDAP, you have two options : 4717c478bd9Sstevel@tonic-gate 4727c478bd9Sstevel@tonic-gate 1 - Answer yes, and this script would generate the mapping 4737c478bd9Sstevel@tonic-gate information for this map assuming it is a simple map. 4747c478bd9Sstevel@tonic-gate And once the execution of the script is over, you can 4757c478bd9Sstevel@tonic-gate customize the mapping information by hand editing the 4767c478bd9Sstevel@tonic-gate mapping file. 4777c478bd9Sstevel@tonic-gate 4787c478bd9Sstevel@tonic-gate 2 - Answer no, and this script would not generate mapping 4797c478bd9Sstevel@tonic-gate info for this map. And once the execution of the script 4807c478bd9Sstevel@tonic-gate is over, you can include the customized mapping 4817c478bd9Sstevel@tonic-gate information by hand editing the mapping file. 4827c478bd9Sstevel@tonic-gate 4837c478bd9Sstevel@tonic-gateEOF 4847c478bd9Sstevel@tonic-gate ;; 4857c478bd9Sstevel@tonic-gate nisLDAPdomainContext_help) cat <<EOF 4867c478bd9Sstevel@tonic-gate 4877c478bd9Sstevel@tonic-gateHELP - This parameter defines the context (default location) in 4887c478bd9Sstevel@tonic-gate the directory tree at which all the name service entries 4897c478bd9Sstevel@tonic-gate for this particular domain would be stored. 4907c478bd9Sstevel@tonic-gate 4917c478bd9Sstevel@tonic-gateEOF 4927c478bd9Sstevel@tonic-gate ;; 4937c478bd9Sstevel@tonic-gate nisLDAPyppasswddDomains_help) cat <<EOF 4947c478bd9Sstevel@tonic-gate 4957c478bd9Sstevel@tonic-gateHELP - Lists the domains for which password changes should be 4967c478bd9Sstevel@tonic-gate made. If this is not present then the value returned by 4977c478bd9Sstevel@tonic-gate 'domainname' will be used. 4987c478bd9Sstevel@tonic-gate 4997c478bd9Sstevel@tonic-gate NIS password change requests do not specify the domains in 5007c478bd9Sstevel@tonic-gate which any given password should be changed. (In traditional 5017c478bd9Sstevel@tonic-gate NIS this information is effectively hard coded in the NIS 5027c478bd9Sstevel@tonic-gate makefile.) 5037c478bd9Sstevel@tonic-gate 5047c478bd9Sstevel@tonic-gateEOF 5057c478bd9Sstevel@tonic-gate ;; 5067c478bd9Sstevel@tonic-gate custom_map_comment_char_help) cat <<EOF 5077c478bd9Sstevel@tonic-gate 5087c478bd9Sstevel@tonic-gateHELP - If selected, it will allow you to specify a character which 5097c478bd9Sstevel@tonic-gate would represent the start of the special 'comment' field in 5107c478bd9Sstevel@tonic-gate a given NIS map. If this attribute is not present then the 5117c478bd9Sstevel@tonic-gate default comment character '#' is used. 5127c478bd9Sstevel@tonic-gate 5137c478bd9Sstevel@tonic-gate If a map cannot contain comments then the blank comment 5147c478bd9Sstevel@tonic-gate character ('') should be specified (just hit the return key). 5157c478bd9Sstevel@tonic-gate 5167c478bd9Sstevel@tonic-gateEOF 5177c478bd9Sstevel@tonic-gate ;; 5187c478bd9Sstevel@tonic-gate same_comment_char_help) cat <<EOF 5197c478bd9Sstevel@tonic-gate 5207c478bd9Sstevel@tonic-gateHELP - If selected, for a given map, it will allow you to specify 5217c478bd9Sstevel@tonic-gate a common comment character for all the domains. 5227c478bd9Sstevel@tonic-gate 5237c478bd9Sstevel@tonic-gate Or else by selecting NO, for the same map, you would be 5247c478bd9Sstevel@tonic-gate given the option to specify different comment character 5257c478bd9Sstevel@tonic-gate for different domains. 5267c478bd9Sstevel@tonic-gate 5277c478bd9Sstevel@tonic-gateEOF 5287c478bd9Sstevel@tonic-gate ;; 5297c478bd9Sstevel@tonic-gate secure_flag_on_help) cat <<EOF 5307c478bd9Sstevel@tonic-gate 5317c478bd9Sstevel@tonic-gateHELP - Secure flag is set on maps which are generated with 5327c478bd9Sstevel@tonic-gate "makedbm -s". When converting data from LDAP to YP, 5337c478bd9Sstevel@tonic-gate it adds YP_SECURE entries. 5347c478bd9Sstevel@tonic-gate 5357c478bd9Sstevel@tonic-gateEOF 5367c478bd9Sstevel@tonic-gate ;; 5377c478bd9Sstevel@tonic-gate secure_flag_all_domains_help) cat <<EOF 5387c478bd9Sstevel@tonic-gate 5397c478bd9Sstevel@tonic-gateHELP - If selected, it will allow you to set the secure flag on 5407c478bd9Sstevel@tonic-gate for this map for all the domains. 5417c478bd9Sstevel@tonic-gate 5427c478bd9Sstevel@tonic-gate Or else by selecting NO, you would be given the option to 5437c478bd9Sstevel@tonic-gate set this flag, for the same map, on per domain basis. 5447c478bd9Sstevel@tonic-gate 5457c478bd9Sstevel@tonic-gateEOF 5467c478bd9Sstevel@tonic-gate ;; 5477c478bd9Sstevel@tonic-gate interdomain_flag_on_help) cat <<EOF 5487c478bd9Sstevel@tonic-gate 5497c478bd9Sstevel@tonic-gateHELP - Interdomain flag is set on a set of maps which are generated 5507c478bd9Sstevel@tonic-gate with "makedbm -b". It signals NIS servers to use the domain 5517c478bd9Sstevel@tonic-gate name resolver for host name and address lookups for hosts 5527c478bd9Sstevel@tonic-gate not found in the maps. 5537c478bd9Sstevel@tonic-gate 5547c478bd9Sstevel@tonic-gate If selected, it adds YP_INTERDOMAIN entries in these maps 5557c478bd9Sstevel@tonic-gate when converting data from LDAP to YP. 5567c478bd9Sstevel@tonic-gate 5577c478bd9Sstevel@tonic-gateEOF 5587c478bd9Sstevel@tonic-gate ;; 5597c478bd9Sstevel@tonic-gate interdomain_flag_all_domains_help) cat <<EOF 5607c478bd9Sstevel@tonic-gate 5617c478bd9Sstevel@tonic-gateHELP - If selected, it will allow you to set the interdomain flag 5627c478bd9Sstevel@tonic-gate on for all the domains. 5637c478bd9Sstevel@tonic-gate 5647c478bd9Sstevel@tonic-gate Or else by selecting NO, you would be given the option to 5657c478bd9Sstevel@tonic-gate set this flag on per domain basis. 5667c478bd9Sstevel@tonic-gate 5677c478bd9Sstevel@tonic-gateEOF 5687c478bd9Sstevel@tonic-gate ;; 5697c478bd9Sstevel@tonic-gate initialTTLlo_help) cat <<EOF 5707c478bd9Sstevel@tonic-gate 5717c478bd9Sstevel@tonic-gateHELP - The lower limit for the initial TTL (in seconds) for data 5727c478bd9Sstevel@tonic-gate read from disk when the ypserv starts. If initialTTLhi also 5737c478bd9Sstevel@tonic-gate is specified, the actual initialTTL will be randomly selected 5747c478bd9Sstevel@tonic-gate from the interval initialTTLlo to initialTTLhi (inclusive). 5757c478bd9Sstevel@tonic-gate 5767c478bd9Sstevel@tonic-gate Leaving the field empty yields the default value of $DEF_iTTLlo. 5777c478bd9Sstevel@tonic-gate 5787c478bd9Sstevel@tonic-gateEOF 5797c478bd9Sstevel@tonic-gate ;; 5807c478bd9Sstevel@tonic-gate initialTTLhi_help) cat <<EOF 5817c478bd9Sstevel@tonic-gate 5827c478bd9Sstevel@tonic-gateHELP - The upper limit for the initial TTL (in seconds). 5837c478bd9Sstevel@tonic-gate If left empty, defaults to "$DEF_iTTLhi". 5847c478bd9Sstevel@tonic-gate 5857c478bd9Sstevel@tonic-gateEOF 5867c478bd9Sstevel@tonic-gate ;; 5877c478bd9Sstevel@tonic-gate runningTTL_help) cat <<EOF 5887c478bd9Sstevel@tonic-gate 5897c478bd9Sstevel@tonic-gateHELP - The TTL (in seconds) for data retrieved from LDAP while the 5907c478bd9Sstevel@tonic-gate ypserv is running. If left empty, defaults to "$DEF_runTTL". 5917c478bd9Sstevel@tonic-gate 5927c478bd9Sstevel@tonic-gateEOF 5937c478bd9Sstevel@tonic-gate ;; 5947c478bd9Sstevel@tonic-gate default_ttl_help) cat <<EOF 5957c478bd9Sstevel@tonic-gate 5967c478bd9Sstevel@tonic-gateHELP - The default TTL value for each map is set to : 5977c478bd9Sstevel@tonic-gate ${DEF_iTTLlo}:${DEF_iTTLhi}:${DEF_runTTL} 5987c478bd9Sstevel@tonic-gate 5997c478bd9Sstevel@tonic-gate Select yes if you want to change the current TTL value. 6007c478bd9Sstevel@tonic-gate 6017c478bd9Sstevel@tonic-gateEOF 6027c478bd9Sstevel@tonic-gate ;; 6037c478bd9Sstevel@tonic-gate non_default_same_ttl_help) cat <<EOF 6047c478bd9Sstevel@tonic-gate 6057c478bd9Sstevel@tonic-gateHELP - Select yes if you want to set a new TTL value, but want 6067c478bd9Sstevel@tonic-gate to keep it same for all the maps. 6077c478bd9Sstevel@tonic-gate 6087c478bd9Sstevel@tonic-gateEOF 6097c478bd9Sstevel@tonic-gate ;; 6107c478bd9Sstevel@tonic-gate non_default_different_ttl_help) cat <<EOF 6117c478bd9Sstevel@tonic-gate 6127c478bd9Sstevel@tonic-gateHELP - Select yes if you want to set TTL value for each map, but 6137c478bd9Sstevel@tonic-gate want to keep it same for all the domains. 6147c478bd9Sstevel@tonic-gate 6157c478bd9Sstevel@tonic-gateEOF 6167c478bd9Sstevel@tonic-gate ;; 6177c478bd9Sstevel@tonic-gate default_different_ttl_help) cat <<EOF 6187c478bd9Sstevel@tonic-gate 6197c478bd9Sstevel@tonic-gateHELP - Select yes if you want to accept the default TTL 6207c478bd9Sstevel@tonic-gate value for this map. 6217c478bd9Sstevel@tonic-gate 6227c478bd9Sstevel@tonic-gateEOF 6237c478bd9Sstevel@tonic-gate ;; 6247c478bd9Sstevel@tonic-gate same_ttl_across_domains_help) cat <<EOF 6257c478bd9Sstevel@tonic-gate 6267c478bd9Sstevel@tonic-gateHELP - Select yes if you want to set TTL value for the map, 6277c478bd9Sstevel@tonic-gate but want to keep it same for all the domains. 6287c478bd9Sstevel@tonic-gate 6297c478bd9Sstevel@tonic-gateEOF 6307c478bd9Sstevel@tonic-gate ;; 6317c478bd9Sstevel@tonic-gate 6327c478bd9Sstevel@tonic-gate esac 6337c478bd9Sstevel@tonic-gate} 6347c478bd9Sstevel@tonic-gate 6357c478bd9Sstevel@tonic-gate# 6367c478bd9Sstevel@tonic-gate# Echo the message passed only if DEBUG is set. 6377c478bd9Sstevel@tonic-gate# Reduces the line width significantly. 6387c478bd9Sstevel@tonic-gate# 6397c478bd9Sstevel@tonic-gated_echo() 6407c478bd9Sstevel@tonic-gate{ 6417c478bd9Sstevel@tonic-gate[ DEBUG -eq 1 ] && echo $@ 6427c478bd9Sstevel@tonic-gate} 6437c478bd9Sstevel@tonic-gate 6447c478bd9Sstevel@tonic-gate 6457c478bd9Sstevel@tonic-gate# 6467c478bd9Sstevel@tonic-gate# get_ans(): gets an answer from the user. 6477c478bd9Sstevel@tonic-gate# $1 instruction/comment/description/question 6487c478bd9Sstevel@tonic-gate# $2 default value 6497c478bd9Sstevel@tonic-gate# 6507c478bd9Sstevel@tonic-gateget_ans() 6517c478bd9Sstevel@tonic-gate{ 6527c478bd9Sstevel@tonic-gate if [ -z "$2" ] 6537c478bd9Sstevel@tonic-gate then 6547c478bd9Sstevel@tonic-gate echo "$1 \c" 6557c478bd9Sstevel@tonic-gate else 6567c478bd9Sstevel@tonic-gate echo "$1 [$2] \c" 6577c478bd9Sstevel@tonic-gate fi 6587c478bd9Sstevel@tonic-gate 6597c478bd9Sstevel@tonic-gate read ANS 6607c478bd9Sstevel@tonic-gate if [ -z "$ANS" ] 6617c478bd9Sstevel@tonic-gate then 6627c478bd9Sstevel@tonic-gate ANS=$2 6637c478bd9Sstevel@tonic-gate fi 6647c478bd9Sstevel@tonic-gate} 6657c478bd9Sstevel@tonic-gate 6667c478bd9Sstevel@tonic-gate 6677c478bd9Sstevel@tonic-gate# 6687c478bd9Sstevel@tonic-gate# get_ans_req(): gets an answer (required) from the user, NULL value not allowed. 6697c478bd9Sstevel@tonic-gate# $@ instruction/comment/description/question 6707c478bd9Sstevel@tonic-gate# 6717c478bd9Sstevel@tonic-gateget_ans_req() 6727c478bd9Sstevel@tonic-gate{ 6737c478bd9Sstevel@tonic-gate ANS="" # Set ANS to NULL. 6747c478bd9Sstevel@tonic-gate while [ "$ANS" = "" ] 6757c478bd9Sstevel@tonic-gate do 6767c478bd9Sstevel@tonic-gate get_ans "$@" 6777c478bd9Sstevel@tonic-gate [ "$ANS" = "" ] && echo "NULL value not allowed!" 6787c478bd9Sstevel@tonic-gate done 6797c478bd9Sstevel@tonic-gate} 6807c478bd9Sstevel@tonic-gate 6817c478bd9Sstevel@tonic-gate 6827c478bd9Sstevel@tonic-gate# 6837c478bd9Sstevel@tonic-gate# get_integer(): Querys and verifies that number entered is integer. 6847c478bd9Sstevel@tonic-gate# Function will repeat prompt user for integer value. 6857c478bd9Sstevel@tonic-gate# $1 Message text. 6867c478bd9Sstevel@tonic-gate# $2 default value. 6877c478bd9Sstevel@tonic-gate# $3 Help argument. 6887c478bd9Sstevel@tonic-gate# 6897c478bd9Sstevel@tonic-gateget_integer() 6907c478bd9Sstevel@tonic-gate{ 6917c478bd9Sstevel@tonic-gate ANS="" # Set ANS to NULL. 6927c478bd9Sstevel@tonic-gate NUM="" 6937c478bd9Sstevel@tonic-gate 6947c478bd9Sstevel@tonic-gate get_ans "$1" "$2" 6957c478bd9Sstevel@tonic-gate 6967c478bd9Sstevel@tonic-gate # Verify that value is integer. 6977c478bd9Sstevel@tonic-gate while not_integer $ANS 6987c478bd9Sstevel@tonic-gate do 6997c478bd9Sstevel@tonic-gate case "$ANS" in 7007c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${3:-sorry} ;; 7017c478bd9Sstevel@tonic-gate * ) echo "Invalid value: \"${ANS}\". \c" 7027c478bd9Sstevel@tonic-gate ;; 7037c478bd9Sstevel@tonic-gate esac 7047c478bd9Sstevel@tonic-gate 7057c478bd9Sstevel@tonic-gate # Get a new value. 7067c478bd9Sstevel@tonic-gate get_ans "Enter an integer value:" "$2" 7077c478bd9Sstevel@tonic-gate done 7087c478bd9Sstevel@tonic-gate NUM=$ANS 7097c478bd9Sstevel@tonic-gate} 7107c478bd9Sstevel@tonic-gate 7117c478bd9Sstevel@tonic-gate 7127c478bd9Sstevel@tonic-gate# 7137c478bd9Sstevel@tonic-gate# get_number(): Querys and verifies that number entered is numeric. 7147c478bd9Sstevel@tonic-gate# Function will repeat prompt user for numeric value. 7157c478bd9Sstevel@tonic-gate# $1 Message text. 7167c478bd9Sstevel@tonic-gate# $2 default value. 7177c478bd9Sstevel@tonic-gate# $3 Help argument. 7187c478bd9Sstevel@tonic-gate# 7197c478bd9Sstevel@tonic-gateget_number() 7207c478bd9Sstevel@tonic-gate{ 7217c478bd9Sstevel@tonic-gate ANS="" # Set ANS to NULL. 7227c478bd9Sstevel@tonic-gate NUM="" 7237c478bd9Sstevel@tonic-gate 7247c478bd9Sstevel@tonic-gate get_ans "$1" "$2" 7257c478bd9Sstevel@tonic-gate 7267c478bd9Sstevel@tonic-gate # Verify that value is numeric. 7277c478bd9Sstevel@tonic-gate while not_numeric $ANS 7287c478bd9Sstevel@tonic-gate do 7297c478bd9Sstevel@tonic-gate case "$ANS" in 7307c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${3:-sorry} ;; 7317c478bd9Sstevel@tonic-gate * ) echo "Invalid value: \"${ANS}\". \c" 7327c478bd9Sstevel@tonic-gate ;; 7337c478bd9Sstevel@tonic-gate esac 7347c478bd9Sstevel@tonic-gate 7357c478bd9Sstevel@tonic-gate # Get a new value. 7367c478bd9Sstevel@tonic-gate get_ans "Enter a numeric value:" "$2" 7377c478bd9Sstevel@tonic-gate done 7387c478bd9Sstevel@tonic-gate NUM=$ANS 7397c478bd9Sstevel@tonic-gate} 7407c478bd9Sstevel@tonic-gate 7417c478bd9Sstevel@tonic-gate 7427c478bd9Sstevel@tonic-gate# 7437c478bd9Sstevel@tonic-gate# get_pos_int(): Only allows positive integer. 7447c478bd9Sstevel@tonic-gate# 7457c478bd9Sstevel@tonic-gate# $1 - Prompt message. 7467c478bd9Sstevel@tonic-gate# $2 - Default value (require). 7477c478bd9Sstevel@tonic-gate# $3 - Optional help argument. 7487c478bd9Sstevel@tonic-gateget_pos_int() 7497c478bd9Sstevel@tonic-gate{ 7507c478bd9Sstevel@tonic-gate while : 7517c478bd9Sstevel@tonic-gate do 7527c478bd9Sstevel@tonic-gate get_integer "$1" "$2" "$3" 7537c478bd9Sstevel@tonic-gate 7547c478bd9Sstevel@tonic-gate if [ $ANS -lt 0 ]; then 7557c478bd9Sstevel@tonic-gate echo "Invalid number: please enter a positive integer." 7567c478bd9Sstevel@tonic-gate else 7577c478bd9Sstevel@tonic-gate break # Positive integer 7587c478bd9Sstevel@tonic-gate fi 7597c478bd9Sstevel@tonic-gate done 7607c478bd9Sstevel@tonic-gate} 7617c478bd9Sstevel@tonic-gate 7627c478bd9Sstevel@tonic-gate 7637c478bd9Sstevel@tonic-gate# 7647c478bd9Sstevel@tonic-gate# get_pos_num(): Only allows positive number. 7657c478bd9Sstevel@tonic-gate# 7667c478bd9Sstevel@tonic-gate# $1 - Prompt message. 7677c478bd9Sstevel@tonic-gate# $2 - Default value (require). 7687c478bd9Sstevel@tonic-gate# $3 - Optional help argument. 7697c478bd9Sstevel@tonic-gateget_pos_num() 7707c478bd9Sstevel@tonic-gate{ 7717c478bd9Sstevel@tonic-gate while : 7727c478bd9Sstevel@tonic-gate do 7737c478bd9Sstevel@tonic-gate get_number "$1" "$2" "$3" 7747c478bd9Sstevel@tonic-gate 7757c478bd9Sstevel@tonic-gate if [ $ANS -lt 0 ]; then 7767c478bd9Sstevel@tonic-gate echo "Invalid number: please enter a positive number." 7777c478bd9Sstevel@tonic-gate else 7787c478bd9Sstevel@tonic-gate break # Positive number 7797c478bd9Sstevel@tonic-gate fi 7807c478bd9Sstevel@tonic-gate done 7817c478bd9Sstevel@tonic-gate} 7827c478bd9Sstevel@tonic-gate 7837c478bd9Sstevel@tonic-gate 7847c478bd9Sstevel@tonic-gate# 7857c478bd9Sstevel@tonic-gate# 7867c478bd9Sstevel@tonic-gate# get_passwd(): Reads a password from the user and verify with second. 7877c478bd9Sstevel@tonic-gate# $@ instruction/comment/description/question 7887c478bd9Sstevel@tonic-gate# 7897c478bd9Sstevel@tonic-gateget_passwd() 7907c478bd9Sstevel@tonic-gate{ 7917c478bd9Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo "In get_passwd()" 7927c478bd9Sstevel@tonic-gate 7937c478bd9Sstevel@tonic-gate # Temporary PASSWD variables 7947c478bd9Sstevel@tonic-gate _PASS1="" 7957c478bd9Sstevel@tonic-gate _PASS2="" 7967c478bd9Sstevel@tonic-gate 7977c478bd9Sstevel@tonic-gate # Handle signals, so that echo can be turned back on if Ctrl-C. 7987c478bd9Sstevel@tonic-gate trap "/usr/bin/stty echo; exit" 1 2 3 6 15 7997c478bd9Sstevel@tonic-gate 8007c478bd9Sstevel@tonic-gate /usr/bin/stty -echo # Turn echo OFF 8017c478bd9Sstevel@tonic-gate 8027c478bd9Sstevel@tonic-gate # Endless loop that continues until passwd and re-entered passwd 8037c478bd9Sstevel@tonic-gate # match. 8047c478bd9Sstevel@tonic-gate while : 8057c478bd9Sstevel@tonic-gate do 8067c478bd9Sstevel@tonic-gate ANS="" # Set ANS to NULL. 8077c478bd9Sstevel@tonic-gate 8087c478bd9Sstevel@tonic-gate # Don't allow NULL for first try. 8097c478bd9Sstevel@tonic-gate while [ "$ANS" = "" ] 8107c478bd9Sstevel@tonic-gate do 8117c478bd9Sstevel@tonic-gate get_ans "$@" 8127c478bd9Sstevel@tonic-gate [ "$ANS" = "" ] && echo "" && echo "NULL passwd not allowed!" 8137c478bd9Sstevel@tonic-gate done 8147c478bd9Sstevel@tonic-gate _PASS1=$ANS # Store first try. 8157c478bd9Sstevel@tonic-gate 8167c478bd9Sstevel@tonic-gate # Get second try. 8177c478bd9Sstevel@tonic-gate echo "" 8187c478bd9Sstevel@tonic-gate get_ans "Re-enter passwd:" 8197c478bd9Sstevel@tonic-gate _PASS2=$ANS 8207c478bd9Sstevel@tonic-gate 8217c478bd9Sstevel@tonic-gate # Test if passwords are identical. 8227c478bd9Sstevel@tonic-gate if [ "$_PASS1" = "$_PASS2" ]; then 8237c478bd9Sstevel@tonic-gate break 8247c478bd9Sstevel@tonic-gate fi 8257c478bd9Sstevel@tonic-gate 8267c478bd9Sstevel@tonic-gate # Move cursor down to next line and print ERROR message. 8277c478bd9Sstevel@tonic-gate echo "" 8287c478bd9Sstevel@tonic-gate echo "ERROR: passwords don't match; try again." 8297c478bd9Sstevel@tonic-gate done 8307c478bd9Sstevel@tonic-gate 8317c478bd9Sstevel@tonic-gate /usr/bin/stty echo # Turn echo ON 8327c478bd9Sstevel@tonic-gate 8337c478bd9Sstevel@tonic-gate # Removed signal handler 8347c478bd9Sstevel@tonic-gate trap 1 2 3 6 15 8357c478bd9Sstevel@tonic-gate 8367c478bd9Sstevel@tonic-gate echo "" 8377c478bd9Sstevel@tonic-gate} 8387c478bd9Sstevel@tonic-gate 8397c478bd9Sstevel@tonic-gate 8407c478bd9Sstevel@tonic-gate# 8417c478bd9Sstevel@tonic-gate# get_passwd_nochk(): Reads a password from the user w/o check. 8427c478bd9Sstevel@tonic-gate# $@ instruction/comment/description/question 8437c478bd9Sstevel@tonic-gate# 8447c478bd9Sstevel@tonic-gateget_passwd_nochk() 8457c478bd9Sstevel@tonic-gate{ 8467c478bd9Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo "In get_passwd_nochk()" 8477c478bd9Sstevel@tonic-gate 8487c478bd9Sstevel@tonic-gate # Handle signals, so that echo can be turned back on if Ctrl-C. 8497c478bd9Sstevel@tonic-gate trap "/usr/bin/stty echo; exit" 1 2 3 6 15 8507c478bd9Sstevel@tonic-gate 8517c478bd9Sstevel@tonic-gate /usr/bin/stty -echo # Turn echo OFF 8527c478bd9Sstevel@tonic-gate 8537c478bd9Sstevel@tonic-gate get_ans "$@" 8547c478bd9Sstevel@tonic-gate 8557c478bd9Sstevel@tonic-gate /usr/bin/stty echo # Turn echo ON 8567c478bd9Sstevel@tonic-gate 8577c478bd9Sstevel@tonic-gate # Removed signal handler 8587c478bd9Sstevel@tonic-gate trap 1 2 3 6 15 8597c478bd9Sstevel@tonic-gate 8607c478bd9Sstevel@tonic-gate echo "" 8617c478bd9Sstevel@tonic-gate} 8627c478bd9Sstevel@tonic-gate 8637c478bd9Sstevel@tonic-gate 8647c478bd9Sstevel@tonic-gate# 8657c478bd9Sstevel@tonic-gate# get_confirm(): Get confirmation from the user. (Y/Yes or N/No) 8667c478bd9Sstevel@tonic-gate# $1 - Message 8677c478bd9Sstevel@tonic-gate# $2 - default value. 8687c478bd9Sstevel@tonic-gate# 8697c478bd9Sstevel@tonic-gateget_confirm() 8707c478bd9Sstevel@tonic-gate{ 8717c478bd9Sstevel@tonic-gate _ANSWER= 8727c478bd9Sstevel@tonic-gate 8737c478bd9Sstevel@tonic-gate while : 8747c478bd9Sstevel@tonic-gate do 8757c478bd9Sstevel@tonic-gate # Display Internal ERROR if $2 not set. 8767c478bd9Sstevel@tonic-gate if [ -z "$2" ]; then 8777c478bd9Sstevel@tonic-gate echo "INTERNAL ERROR: get_confirm requires 2 args, 3rd is optional." 8787c478bd9Sstevel@tonic-gate exit 2 8797c478bd9Sstevel@tonic-gate fi 8807c478bd9Sstevel@tonic-gate 8817c478bd9Sstevel@tonic-gate # Display prompt. 8827c478bd9Sstevel@tonic-gate echo "$1 [$2] \c" 8837c478bd9Sstevel@tonic-gate 8847c478bd9Sstevel@tonic-gate # Get the ANSWER. 8857c478bd9Sstevel@tonic-gate read _ANSWER 8867c478bd9Sstevel@tonic-gate if [ "$_ANSWER" = "" ] && [ -n "$2" ] ; then 8877c478bd9Sstevel@tonic-gate _ANSWER=$2 8887c478bd9Sstevel@tonic-gate fi 8897c478bd9Sstevel@tonic-gate case "$_ANSWER" in 8907c478bd9Sstevel@tonic-gate [Yy] | yes | Yes | YES) return 1 ;; 8917c478bd9Sstevel@tonic-gate [Nn] | no | No | NO) return 0 ;; 8927c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${3:-sorry};; 8937c478bd9Sstevel@tonic-gate * ) echo "Please enter y or n." ;; 8947c478bd9Sstevel@tonic-gate esac 8957c478bd9Sstevel@tonic-gate done 8967c478bd9Sstevel@tonic-gate} 8977c478bd9Sstevel@tonic-gate 8987c478bd9Sstevel@tonic-gate 8997c478bd9Sstevel@tonic-gate# 9007c478bd9Sstevel@tonic-gate# get_confirm_nodef(): Get confirmation from the user. (Y/Yes or N/No) 9017c478bd9Sstevel@tonic-gate# No default value supported. Returns 1 for yes. 9027c478bd9Sstevel@tonic-gate# 9037c478bd9Sstevel@tonic-gateget_confirm_nodef() 9047c478bd9Sstevel@tonic-gate{ 9057c478bd9Sstevel@tonic-gate _ANSWER= 9067c478bd9Sstevel@tonic-gate 9077c478bd9Sstevel@tonic-gate while : 9087c478bd9Sstevel@tonic-gate do 9097c478bd9Sstevel@tonic-gate echo "$@ \c" 9107c478bd9Sstevel@tonic-gate read _ANSWER 9117c478bd9Sstevel@tonic-gate case "$_ANSWER" in 9127c478bd9Sstevel@tonic-gate [Yy] | yes | Yes | YES) return 1 ;; 9137c478bd9Sstevel@tonic-gate [Nn] | no | No | NO) return 0 ;; 9147c478bd9Sstevel@tonic-gate * ) echo "Please enter y or n." ;; 9157c478bd9Sstevel@tonic-gate esac 9167c478bd9Sstevel@tonic-gate done 9177c478bd9Sstevel@tonic-gate} 9187c478bd9Sstevel@tonic-gate 9197c478bd9Sstevel@tonic-gate 9207c478bd9Sstevel@tonic-gate# 9217c478bd9Sstevel@tonic-gate# is_integer(): Tells if a string is numeric integer. 9227c478bd9Sstevel@tonic-gate# 0 = Integer 9237c478bd9Sstevel@tonic-gate# 1 = NOT Integer 9247c478bd9Sstevel@tonic-gate# 9257c478bd9Sstevel@tonic-gateis_integer() 9267c478bd9Sstevel@tonic-gate{ 9277c478bd9Sstevel@tonic-gate # Check for parameter. 9287c478bd9Sstevel@tonic-gate if [ $# -ne 1 ]; then 9297c478bd9Sstevel@tonic-gate return 1 9307c478bd9Sstevel@tonic-gate fi 9317c478bd9Sstevel@tonic-gate 9327c478bd9Sstevel@tonic-gate # Determine if integer. 9337c478bd9Sstevel@tonic-gate expr "$1" + 1 > /dev/null 2>&1 9347c478bd9Sstevel@tonic-gate 9357c478bd9Sstevel@tonic-gate if [ $? -ge 2 ]; then 9367c478bd9Sstevel@tonic-gate return 1 9377c478bd9Sstevel@tonic-gate fi 9387c478bd9Sstevel@tonic-gate 9397c478bd9Sstevel@tonic-gate # Made it here, it's Numeric. 9407c478bd9Sstevel@tonic-gate return 0 9417c478bd9Sstevel@tonic-gate} 9427c478bd9Sstevel@tonic-gate 9437c478bd9Sstevel@tonic-gate 9447c478bd9Sstevel@tonic-gate# 9457c478bd9Sstevel@tonic-gate# not_integer(): Reverses the return values of is_integer. Useful 9467c478bd9Sstevel@tonic-gate# for if and while statements that want to test for 9477c478bd9Sstevel@tonic-gate# non-integer data. 9487c478bd9Sstevel@tonic-gate# 0 = NOT Integer 9497c478bd9Sstevel@tonic-gate# 1 = Integer 9507c478bd9Sstevel@tonic-gate# 9517c478bd9Sstevel@tonic-gatenot_integer() 9527c478bd9Sstevel@tonic-gate{ 9537c478bd9Sstevel@tonic-gate is_integer $1 9547c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 9557c478bd9Sstevel@tonic-gate return 1 9567c478bd9Sstevel@tonic-gate else 9577c478bd9Sstevel@tonic-gate return 0 9587c478bd9Sstevel@tonic-gate fi 9597c478bd9Sstevel@tonic-gate} 9607c478bd9Sstevel@tonic-gate 9617c478bd9Sstevel@tonic-gate 9627c478bd9Sstevel@tonic-gate# 9637c478bd9Sstevel@tonic-gate# is_numeric(): Tells if a string is numeric. 9647c478bd9Sstevel@tonic-gate# 0 = Numeric 9657c478bd9Sstevel@tonic-gate# 1 = NOT Numeric 9667c478bd9Sstevel@tonic-gate# 9677c478bd9Sstevel@tonic-gateis_numeric() 9687c478bd9Sstevel@tonic-gate{ 9697c478bd9Sstevel@tonic-gate # Check for parameter. 9707c478bd9Sstevel@tonic-gate if [ $# -ne 1 ]; then 9717c478bd9Sstevel@tonic-gate return 1 9727c478bd9Sstevel@tonic-gate fi 9737c478bd9Sstevel@tonic-gate 9747c478bd9Sstevel@tonic-gate # Determine if numeric. 9757c478bd9Sstevel@tonic-gate let _NUM="$1 + 1" > /dev/null 2>&1 9767c478bd9Sstevel@tonic-gate 9777c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 9787c478bd9Sstevel@tonic-gate return 0 9797c478bd9Sstevel@tonic-gate fi 9807c478bd9Sstevel@tonic-gate 9817c478bd9Sstevel@tonic-gate} 9827c478bd9Sstevel@tonic-gate 9837c478bd9Sstevel@tonic-gate 9847c478bd9Sstevel@tonic-gate# 9857c478bd9Sstevel@tonic-gate# not_numeric(): Reverses the return values of is_numeric. Useful 9867c478bd9Sstevel@tonic-gate# for if and while statements that want to test for 9877c478bd9Sstevel@tonic-gate# non-numeric data. 9887c478bd9Sstevel@tonic-gate# 0 = NOT Numeric 9897c478bd9Sstevel@tonic-gate# 1 = Numeric 9907c478bd9Sstevel@tonic-gate# 9917c478bd9Sstevel@tonic-gatenot_numeric() 9927c478bd9Sstevel@tonic-gate{ 9937c478bd9Sstevel@tonic-gate is_numeric $1 9947c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 9957c478bd9Sstevel@tonic-gate return 1 9967c478bd9Sstevel@tonic-gate else 9977c478bd9Sstevel@tonic-gate return 0 9987c478bd9Sstevel@tonic-gate fi 9997c478bd9Sstevel@tonic-gate} 10007c478bd9Sstevel@tonic-gate 10017c478bd9Sstevel@tonic-gate 10027c478bd9Sstevel@tonic-gate# 10037c478bd9Sstevel@tonic-gate# domain_2_dc(): Convert a domain name into dc string. 10047c478bd9Sstevel@tonic-gate# $1 .. Domain name. 10057c478bd9Sstevel@tonic-gate# 10067c478bd9Sstevel@tonic-gatedomain_2_dc() 10077c478bd9Sstevel@tonic-gate{ 10087c478bd9Sstevel@tonic-gate _DOM=$1 # Domain parameter. 10097c478bd9Sstevel@tonic-gate _DOM_2_DC="" # Return value from function. 10107c478bd9Sstevel@tonic-gate _FIRST=1 # Flag for first time. 10117c478bd9Sstevel@tonic-gate 10127c478bd9Sstevel@tonic-gate export _DOM_2_DC # Make visible for others. 10137c478bd9Sstevel@tonic-gate 10147c478bd9Sstevel@tonic-gate # Convert "."'s to spaces for "for" loop. 10157c478bd9Sstevel@tonic-gate domtmp="`echo ${_DOM} | tr '.' ' '`" 10167c478bd9Sstevel@tonic-gate for i in $domtmp; do 10177c478bd9Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 10187c478bd9Sstevel@tonic-gate _DOM_2_DC="dc=${i}" 10197c478bd9Sstevel@tonic-gate _FIRST=0 10207c478bd9Sstevel@tonic-gate else 10217c478bd9Sstevel@tonic-gate _DOM_2_DC="${_DOM_2_DC},dc=${i}" 10227c478bd9Sstevel@tonic-gate fi 10237c478bd9Sstevel@tonic-gate done 10247c478bd9Sstevel@tonic-gate} 10257c478bd9Sstevel@tonic-gate 10267c478bd9Sstevel@tonic-gate 10277c478bd9Sstevel@tonic-gate# 10287c478bd9Sstevel@tonic-gate# is_root_user(): Check to see if logged in as super user. 10297c478bd9Sstevel@tonic-gate# 10307c478bd9Sstevel@tonic-gateis_root_user() 10317c478bd9Sstevel@tonic-gate{ 10327c478bd9Sstevel@tonic-gate case `id` in 10337c478bd9Sstevel@tonic-gate uid=0\(root\)*) return 0 ;; 10347c478bd9Sstevel@tonic-gate * ) return 1 ;; 10357c478bd9Sstevel@tonic-gate esac 10367c478bd9Sstevel@tonic-gate} 10377c478bd9Sstevel@tonic-gate 10387c478bd9Sstevel@tonic-gate 10397c478bd9Sstevel@tonic-gate# 10407c478bd9Sstevel@tonic-gate# parse_arg(): Parses the command line arguments and sets the 10417c478bd9Sstevel@tonic-gate# appropriate variables. 10427c478bd9Sstevel@tonic-gate# 10437c478bd9Sstevel@tonic-gateparse_arg() 10447c478bd9Sstevel@tonic-gate{ 10457c478bd9Sstevel@tonic-gate while getopts ":dm:c:" ARG 10467c478bd9Sstevel@tonic-gate do 10477c478bd9Sstevel@tonic-gate case $ARG in 10487c478bd9Sstevel@tonic-gate d) DEBUG=1;; 10497c478bd9Sstevel@tonic-gate 10507c478bd9Sstevel@tonic-gate m) MAP_FILE=$OPTARG 10517c478bd9Sstevel@tonic-gate MAPPING_FILE_SPECIFIED=1;; 10527c478bd9Sstevel@tonic-gate 10537c478bd9Sstevel@tonic-gate c) CONFIG_FILE=$OPTARG 10547c478bd9Sstevel@tonic-gate CONFIG_FILE_SPECIFIED=1;; 10557c478bd9Sstevel@tonic-gate 10567c478bd9Sstevel@tonic-gate \?) echo "**ERROR: Invalid option '$OPTARG'" 10577c478bd9Sstevel@tonic-gate display_msg usage 10587c478bd9Sstevel@tonic-gate exit 1;; 10597c478bd9Sstevel@tonic-gate esac 10607c478bd9Sstevel@tonic-gate done 10617c478bd9Sstevel@tonic-gate 10627c478bd9Sstevel@tonic-gate shift `expr $OPTIND - 1` 10637c478bd9Sstevel@tonic-gate if [ $# -gt 0 ]; then 10647c478bd9Sstevel@tonic-gate echo "**ERROR: wrong usage " 10657c478bd9Sstevel@tonic-gate display_msg usage 10667c478bd9Sstevel@tonic-gate exit 1 10677c478bd9Sstevel@tonic-gate fi 10687c478bd9Sstevel@tonic-gate} 10697c478bd9Sstevel@tonic-gate 10707c478bd9Sstevel@tonic-gate 10717c478bd9Sstevel@tonic-gate# 10727c478bd9Sstevel@tonic-gate# present() : Checks if the first argument exists in the 10737c478bd9Sstevel@tonic-gate# argument list. Returns 0 if found, else 1. 10747c478bd9Sstevel@tonic-gate# 10757c478bd9Sstevel@tonic-gatepresent () 10767c478bd9Sstevel@tonic-gate{ 10777c478bd9Sstevel@tonic-gate_ELEMENT=$1 10787c478bd9Sstevel@tonic-gate 10797c478bd9Sstevel@tonic-gateshift 10807c478bd9Sstevel@tonic-gateARG_LIST=$@ 10817c478bd9Sstevel@tonic-gate 10827c478bd9Sstevel@tonic-gatefor item in $ARG_LIST 10837c478bd9Sstevel@tonic-gatedo 10847c478bd9Sstevel@tonic-gate [ "$_ELEMENT" = "$item" ] && return 0 10857c478bd9Sstevel@tonic-gatedone 10867c478bd9Sstevel@tonic-gate 10877c478bd9Sstevel@tonic-gate# If reached here, then the clement does not exist 10887c478bd9Sstevel@tonic-gatereturn 1 10897c478bd9Sstevel@tonic-gate} 10907c478bd9Sstevel@tonic-gate 10917c478bd9Sstevel@tonic-gate 10927c478bd9Sstevel@tonic-gate# 10937c478bd9Sstevel@tonic-gate# remove() : Returns a new string after removing the first 10947c478bd9Sstevel@tonic-gate# argument in the argument list. 10957c478bd9Sstevel@tonic-gate# 10967c478bd9Sstevel@tonic-gateremove () 10977c478bd9Sstevel@tonic-gate{ 10987c478bd9Sstevel@tonic-gate_ELEMENT=$1 10997c478bd9Sstevel@tonic-gate 11007c478bd9Sstevel@tonic-gateshift 11017c478bd9Sstevel@tonic-gateARG_LIST=$@ 11027c478bd9Sstevel@tonic-gate 11037c478bd9Sstevel@tonic-gateNEW_LIST="" 11047c478bd9Sstevel@tonic-gate 11057c478bd9Sstevel@tonic-gatefor item in $ARG_LIST 11067c478bd9Sstevel@tonic-gatedo 11077c478bd9Sstevel@tonic-gate [ "$_ELEMENT" != "$item" ] && NEW_LIST="$NEW_LIST $item" 11087c478bd9Sstevel@tonic-gatedone 11097c478bd9Sstevel@tonic-gate 11107c478bd9Sstevel@tonic-gateecho $NEW_LIST 11117c478bd9Sstevel@tonic-gatereturn 0 11127c478bd9Sstevel@tonic-gate} 11137c478bd9Sstevel@tonic-gate 11147c478bd9Sstevel@tonic-gate 11157c478bd9Sstevel@tonic-gate# 11167c478bd9Sstevel@tonic-gate# merge_lists() : Returns a list after merging elements 11177c478bd9Sstevel@tonic-gate# (uniquely) supplied in the argument list. 11187c478bd9Sstevel@tonic-gate# 11197c478bd9Sstevel@tonic-gatemerge_lists() 11207c478bd9Sstevel@tonic-gate{ 11217c478bd9Sstevel@tonic-gateMERGED_LIST="" 11227c478bd9Sstevel@tonic-gate 11237c478bd9Sstevel@tonic-gatefor _VAR in "$@" 11247c478bd9Sstevel@tonic-gatedo 11257c478bd9Sstevel@tonic-gate if ! present $_VAR $MERGED_LIST; then 11267c478bd9Sstevel@tonic-gate MERGED_LIST="$MERGED_LIST $_VAR" 11277c478bd9Sstevel@tonic-gate fi 11287c478bd9Sstevel@tonic-gatedone 11297c478bd9Sstevel@tonic-gate 11307c478bd9Sstevel@tonic-gateecho $MERGED_LIST 11317c478bd9Sstevel@tonic-gatereturn 0 11327c478bd9Sstevel@tonic-gate} 11337c478bd9Sstevel@tonic-gate 11347c478bd9Sstevel@tonic-gate 11357c478bd9Sstevel@tonic-gate# 11367c478bd9Sstevel@tonic-gate# init(): initializes variables and options 11377c478bd9Sstevel@tonic-gate# 11387c478bd9Sstevel@tonic-gateinit() 11397c478bd9Sstevel@tonic-gate{ 11407c478bd9Sstevel@tonic-gate# General variables. 11417c478bd9Sstevel@tonic-gateDEBUG=0 # Set Debug OFF 11427c478bd9Sstevel@tonic-gate 11437c478bd9Sstevel@tonic-gateMAPPING_FILE_SPECIFIED=0 # No file name passed 11447c478bd9Sstevel@tonic-gateCONFIG_FILE_SPECIFIED=0 # No file name passed 11457c478bd9Sstevel@tonic-gate 11467c478bd9Sstevel@tonic-gate# Prevent others from snooping 11477c478bd9Sstevel@tonic-gateumask 077 11487c478bd9Sstevel@tonic-gate 11497c478bd9Sstevel@tonic-gate# Set default config and mapping files. 11507c478bd9Sstevel@tonic-gateDEFAULT_MAP_FILE="/var/yp/NISLDAPmapping" 11517c478bd9Sstevel@tonic-gateDEFAULT_CONFIG_FILE="/etc/default/ypserv" 11527c478bd9Sstevel@tonic-gate 11537c478bd9Sstevel@tonic-gateMAP_FILE="$DEFAULT_MAP_FILE" 11547c478bd9Sstevel@tonic-gateCONFIG_FILE="$DEFAULT_CONFIG_FILE" 11557c478bd9Sstevel@tonic-gate 11567c478bd9Sstevel@tonic-gate# Set and create TMPDIR. Use a safe place to discourage hackers. 11577c478bd9Sstevel@tonic-gateTMPDIR="/var/yp/inityp2l" 11587c478bd9Sstevel@tonic-gate 11597c478bd9Sstevel@tonic-gate# Temporary file names to be used to prevent system starting in 11607c478bd9Sstevel@tonic-gate# N2L mode in case something goes wrong during file creation. 11617c478bd9Sstevel@tonic-gateTMPCONF="ypserv-tmp" 11627c478bd9Sstevel@tonic-gateTMPMAP="NISLDAPmapping-tmp" 11637c478bd9Sstevel@tonic-gate 11647c478bd9Sstevel@tonic-gate# Remove if the temp directory has been leftover 11657c478bd9Sstevel@tonic-gate[ -d "$TMPDIR" ] && rm -rf $TMPDIR 11667c478bd9Sstevel@tonic-gatemkdir $TMPDIR 11677c478bd9Sstevel@tonic-gateif [ $? -ne 0 ]; then 11687c478bd9Sstevel@tonic-gate echo ERROR : Failed to create temp directory $TMPDIR 11697c478bd9Sstevel@tonic-gate exit 1 11707c478bd9Sstevel@tonic-gatefi 11717c478bd9Sstevel@tonic-gate 11727c478bd9Sstevel@tonic-gate# Initialize the default NIS maps. 11737c478bd9Sstevel@tonic-gateDEFAULT_NIS_MAPS="passwd.byname 11747c478bd9Sstevel@tonic-gate passwd.byuid 11757c478bd9Sstevel@tonic-gate group.byname 11767c478bd9Sstevel@tonic-gate group.bygid 11777c478bd9Sstevel@tonic-gate hosts.byaddr 11787c478bd9Sstevel@tonic-gate hosts.byname 11797c478bd9Sstevel@tonic-gate ipnodes.byaddr 11807c478bd9Sstevel@tonic-gate ipnodes.byname 11817c478bd9Sstevel@tonic-gate ethers.byaddr 11827c478bd9Sstevel@tonic-gate ethers.byname 11837c478bd9Sstevel@tonic-gate networks.byaddr 11847c478bd9Sstevel@tonic-gate networks.byname 11857c478bd9Sstevel@tonic-gate rpc.bynumber 11867c478bd9Sstevel@tonic-gate services.byname 11877c478bd9Sstevel@tonic-gate services.byservicename 11887c478bd9Sstevel@tonic-gate printers.conf.byname 11897c478bd9Sstevel@tonic-gate project.byname 11907c478bd9Sstevel@tonic-gate project.byprojid 11917c478bd9Sstevel@tonic-gate protocols.byname 11927c478bd9Sstevel@tonic-gate protocols.bynumber 11937c478bd9Sstevel@tonic-gate netgroup 11947c478bd9Sstevel@tonic-gate netgroup.byuser 11957c478bd9Sstevel@tonic-gate netgroup.byhost 11967c478bd9Sstevel@tonic-gate bootparams 11977c478bd9Sstevel@tonic-gate mail.aliases 11987c478bd9Sstevel@tonic-gate mail.byaddr 11997c478bd9Sstevel@tonic-gate publickey.byname 12007c478bd9Sstevel@tonic-gate netid.byname 12017c478bd9Sstevel@tonic-gate netmasks.byaddr 12027c478bd9Sstevel@tonic-gate passwd.adjunct.byname 12037c478bd9Sstevel@tonic-gate group.adjunct.byname 12047c478bd9Sstevel@tonic-gate timezone.byname 12057c478bd9Sstevel@tonic-gate auth_attr 12067c478bd9Sstevel@tonic-gate exec_attr 12077c478bd9Sstevel@tonic-gate prof_attr 12087c478bd9Sstevel@tonic-gate user_attr 12097c478bd9Sstevel@tonic-gate audit_user 12107c478bd9Sstevel@tonic-gate auto.master 12117c478bd9Sstevel@tonic-gate auto.home 12127c478bd9Sstevel@tonic-gate ypservers" 12137c478bd9Sstevel@tonic-gate 12147c478bd9Sstevel@tonic-gateset -A DEF_NIS_MAP_ARRAY $DEFAULT_NIS_MAPS 12157c478bd9Sstevel@tonic-gate 12167c478bd9Sstevel@tonic-gate# The default TTL maps in database ID format. 12177c478bd9Sstevel@tonic-gateDEF_TTL_MAPLIST="audit_user 12187c478bd9Sstevel@tonic-gate auto.home 12197c478bd9Sstevel@tonic-gate auto.master 12207c478bd9Sstevel@tonic-gate auth_attr 12217c478bd9Sstevel@tonic-gate bootparams 12227c478bd9Sstevel@tonic-gate ethers 12237c478bd9Sstevel@tonic-gate exec_attr 12247c478bd9Sstevel@tonic-gate group 12257c478bd9Sstevel@tonic-gate group.adjunct.byname 12267c478bd9Sstevel@tonic-gate keys.host 12277c478bd9Sstevel@tonic-gate keys.pass 12287c478bd9Sstevel@tonic-gate keys.nobody 12297c478bd9Sstevel@tonic-gate hosts 12307c478bd9Sstevel@tonic-gate multihosts 12317c478bd9Sstevel@tonic-gate ipnodes 12327c478bd9Sstevel@tonic-gate multiipnodes 12337c478bd9Sstevel@tonic-gate netgroup 12347c478bd9Sstevel@tonic-gate networks 12357c478bd9Sstevel@tonic-gate passwd 12367c478bd9Sstevel@tonic-gate passwd.adjunct.byname 12377c478bd9Sstevel@tonic-gate printers.conf.byname 12387c478bd9Sstevel@tonic-gate prof_attr 12397c478bd9Sstevel@tonic-gate project 12407c478bd9Sstevel@tonic-gate protocols 12417c478bd9Sstevel@tonic-gate services 12427c478bd9Sstevel@tonic-gate mail.aliases 12437c478bd9Sstevel@tonic-gate mail.mapping 12447c478bd9Sstevel@tonic-gate netid.host 12457c478bd9Sstevel@tonic-gate netid.pass 12467c478bd9Sstevel@tonic-gate netmasks.byaddr 12477c478bd9Sstevel@tonic-gate rpc.bynumber 12487c478bd9Sstevel@tonic-gate ageing.byname 12497c478bd9Sstevel@tonic-gate timezone.byname 12507c478bd9Sstevel@tonic-gate user_attr 12517c478bd9Sstevel@tonic-gate ypservers" 12527c478bd9Sstevel@tonic-gate 12537c478bd9Sstevel@tonic-gate 12547c478bd9Sstevel@tonic-gate# Initialize default values for config parameters. 12557c478bd9Sstevel@tonic-gate 12567c478bd9Sstevel@tonic-gateconfigDN_flag=0 12577c478bd9Sstevel@tonic-gateDEF_nisLDAPconfigDN="" 12587c478bd9Sstevel@tonic-gateDEF_TLS=none 12591d7382f7SMilan JurikDEF_TLSCertificateDBPath=/var/yp/ 12607c478bd9Sstevel@tonic-gateDEF_nisLDAPbindTimeout=15 12617c478bd9Sstevel@tonic-gateDEF_nisLDAPsearchTimeout=180 12627c478bd9Sstevel@tonic-gateDEF_nisLDAPmodifyTimeout=15 12637c478bd9Sstevel@tonic-gateDEF_nisLDAPaddTimeout=15 12647c478bd9Sstevel@tonic-gateDEF_nisLDAPdeleteTimeout=15 12657c478bd9Sstevel@tonic-gateDEF_nisLDAPsearchTimeLimit=${DEF_nisLDAPsearchTimeout} 12667c478bd9Sstevel@tonic-gateDEF_nisLDAPsearchSizeLimit=0 12677c478bd9Sstevel@tonic-gateDEF_nisLDAPfollowReferral=no 12687c478bd9Sstevel@tonic-gateDEF_nisLDAPretrieveErrorAction=use_cached 12697c478bd9Sstevel@tonic-gate 12707c478bd9Sstevel@tonic-gate# The default is unlimited, but since it prevents the NIS daemon, 12717c478bd9Sstevel@tonic-gate# from servicing further requests, set 1 as the suggested value. 12727c478bd9Sstevel@tonic-gateSUG_nisLDAPretrieveErrorAttempts=1 12737c478bd9Sstevel@tonic-gateDEF_nisLDAPretrieveErrorTimeout=15 12747c478bd9Sstevel@tonic-gateDEF_nisLDAPstoreErrorAction=retry 12757c478bd9Sstevel@tonic-gate 12767c478bd9Sstevel@tonic-gate# The default is unlimited, but set 1 as the suggested value. 12777c478bd9Sstevel@tonic-gateSUG_nisLDAPstoreErrorAttempts=1 12787c478bd9Sstevel@tonic-gateDEF_nisLDAPstoreErrorTimeout=15 12797c478bd9Sstevel@tonic-gate 12807c478bd9Sstevel@tonic-gate# Default TTL values (in seconds) for NIS MAPS for mapping file. 12817c478bd9Sstevel@tonic-gateDEF_iTTLlo=1800 12827c478bd9Sstevel@tonic-gateDEF_iTTLhi=5400 12837c478bd9Sstevel@tonic-gateDEF_runTTL=3600 12847c478bd9Sstevel@tonic-gate 12857c478bd9Sstevel@tonic-gate} 12867c478bd9Sstevel@tonic-gate 12877c478bd9Sstevel@tonic-gate 12887c478bd9Sstevel@tonic-gate# 12897c478bd9Sstevel@tonic-gate# config_auth_menu_handler(): Enter the authentication method 12907c478bd9Sstevel@tonic-gate# for config server. 12917c478bd9Sstevel@tonic-gate# 12927c478bd9Sstevel@tonic-gateconfig_auth_menu_handler() 12937c478bd9Sstevel@tonic-gate{ 12947c478bd9Sstevel@tonic-gate # Display Auth menu 12957c478bd9Sstevel@tonic-gate display_msg config_auth_method_menu 12967c478bd9Sstevel@tonic-gate 12977c478bd9Sstevel@tonic-gate # Get a Valid choice. 12987c478bd9Sstevel@tonic-gate while : 12997c478bd9Sstevel@tonic-gate do 13007c478bd9Sstevel@tonic-gate # Display appropriate prompt and get answer. 13017c478bd9Sstevel@tonic-gate get_ans_req " Choose one Authentication Method (h=help):" 13027c478bd9Sstevel@tonic-gate 13037c478bd9Sstevel@tonic-gate # Determine choice. 13047c478bd9Sstevel@tonic-gate _MENU_CHOICE=$ANS 13057c478bd9Sstevel@tonic-gate case "$_MENU_CHOICE" in 13067c478bd9Sstevel@tonic-gate 1) _AUTHMETHOD="none" 13077c478bd9Sstevel@tonic-gate break ;; 13087c478bd9Sstevel@tonic-gate 2) _AUTHMETHOD="simple" 13097c478bd9Sstevel@tonic-gate break ;; 13107c478bd9Sstevel@tonic-gate 3) _AUTHMETHOD="sasl/cram-md5" 13117c478bd9Sstevel@tonic-gate break ;; 13127c478bd9Sstevel@tonic-gate 4) _AUTHMETHOD="sasl/digest-md5" 13137c478bd9Sstevel@tonic-gate break ;; 13147c478bd9Sstevel@tonic-gate h) display_msg auth_help ;; 13157c478bd9Sstevel@tonic-gate *) echo "Please enter 1-4, or h=help." ;; 13167c478bd9Sstevel@tonic-gate esac 13177c478bd9Sstevel@tonic-gate done 13187c478bd9Sstevel@tonic-gate} 13197c478bd9Sstevel@tonic-gate 13207c478bd9Sstevel@tonic-gate 13217c478bd9Sstevel@tonic-gate# 13227c478bd9Sstevel@tonic-gate# auth_menu_handler(): Enter the Authentication method for LDAP server. 13237c478bd9Sstevel@tonic-gate# 13247c478bd9Sstevel@tonic-gateauth_menu_handler() 13257c478bd9Sstevel@tonic-gate{ 13267c478bd9Sstevel@tonic-gate # Display Auth menu 13277c478bd9Sstevel@tonic-gate display_msg auth_method_menu 13287c478bd9Sstevel@tonic-gate 13297c478bd9Sstevel@tonic-gate # Get a Valid choice. 13307c478bd9Sstevel@tonic-gate while : 13317c478bd9Sstevel@tonic-gate do 13327c478bd9Sstevel@tonic-gate # Display appropriate prompt and get answer. 13337c478bd9Sstevel@tonic-gate get_ans_req " Choose one Authentication Method (h=help):" 13347c478bd9Sstevel@tonic-gate 13357c478bd9Sstevel@tonic-gate # Determine choice. 13367c478bd9Sstevel@tonic-gate _MENU_CHOICE=$ANS 13377c478bd9Sstevel@tonic-gate case "$_MENU_CHOICE" in 13387c478bd9Sstevel@tonic-gate 1) _AUTHMETHOD="simple" 13397c478bd9Sstevel@tonic-gate break ;; 13407c478bd9Sstevel@tonic-gate 2) _AUTHMETHOD="sasl/cram-md5" 13417c478bd9Sstevel@tonic-gate break ;; 13427c478bd9Sstevel@tonic-gate 3) _AUTHMETHOD="sasl/digest-md5" 13437c478bd9Sstevel@tonic-gate break ;; 13447c478bd9Sstevel@tonic-gate h) display_msg auth_help ;; 13457c478bd9Sstevel@tonic-gate *) echo "Please enter 1-3, or h=help." ;; 13467c478bd9Sstevel@tonic-gate esac 13477c478bd9Sstevel@tonic-gate done 13487c478bd9Sstevel@tonic-gate} 13497c478bd9Sstevel@tonic-gate 13507c478bd9Sstevel@tonic-gate 13517c478bd9Sstevel@tonic-gate# 13527c478bd9Sstevel@tonic-gate# tls_menu_handler(): Enter the transport layer security 13537c478bd9Sstevel@tonic-gate# 13547c478bd9Sstevel@tonic-gatetls_menu_handler() 13557c478bd9Sstevel@tonic-gate{ 13567c478bd9Sstevel@tonic-gate # Display TLS menu 13577c478bd9Sstevel@tonic-gate display_msg tls_method_menu 13587c478bd9Sstevel@tonic-gate 13597c478bd9Sstevel@tonic-gate # Get a Valid choice. 13607c478bd9Sstevel@tonic-gate while : 13617c478bd9Sstevel@tonic-gate do 13627c478bd9Sstevel@tonic-gate # Display appropriate prompt and get answer. 13637c478bd9Sstevel@tonic-gate # Default value is "none". 13647c478bd9Sstevel@tonic-gate 13657c478bd9Sstevel@tonic-gate get_ans " Choose one Transport Layer Security Method (h=help):" "1" 13667c478bd9Sstevel@tonic-gate 13677c478bd9Sstevel@tonic-gate # Determine choice. 13687c478bd9Sstevel@tonic-gate _MENU_CHOICE=$ANS 13697c478bd9Sstevel@tonic-gate case "$_MENU_CHOICE" in 13707c478bd9Sstevel@tonic-gate 1) _TLSMETHOD="none" 13717c478bd9Sstevel@tonic-gate break ;; 13727c478bd9Sstevel@tonic-gate 2) _TLSMETHOD="ssl" 13737c478bd9Sstevel@tonic-gate break ;; 13747c478bd9Sstevel@tonic-gate h) display_msg tls_help ;; 13757c478bd9Sstevel@tonic-gate *) echo "Please enter 1, 2, or h=help." ;; 13767c478bd9Sstevel@tonic-gate esac 13777c478bd9Sstevel@tonic-gate done 13787c478bd9Sstevel@tonic-gate} 13797c478bd9Sstevel@tonic-gate 13807c478bd9Sstevel@tonic-gate 13817c478bd9Sstevel@tonic-gate# 13827c478bd9Sstevel@tonic-gate# retrieve_error_action_menu_handler(): Enter the retrieve error action 13837c478bd9Sstevel@tonic-gate# 13847c478bd9Sstevel@tonic-gateretrieve_error_action_menu_handler() 13857c478bd9Sstevel@tonic-gate{ 13867c478bd9Sstevel@tonic-gate # Display retrieve error action menu 13877c478bd9Sstevel@tonic-gate display_msg retrieve_error_action_menu 13887c478bd9Sstevel@tonic-gate 13897c478bd9Sstevel@tonic-gate # Get a Valid choice. 13907c478bd9Sstevel@tonic-gate while : 13917c478bd9Sstevel@tonic-gate do 13927c478bd9Sstevel@tonic-gate # Display appropriate prompt and get answer. use_cached is default 13937c478bd9Sstevel@tonic-gate get_ans " Choose one retrieval error action (h=help):" "1" 13947c478bd9Sstevel@tonic-gate 13957c478bd9Sstevel@tonic-gate # Determine choice. 13967c478bd9Sstevel@tonic-gate _MENU_CHOICE=$ANS 13977c478bd9Sstevel@tonic-gate case "$_MENU_CHOICE" in 13987c478bd9Sstevel@tonic-gate 1) _RET_ERR_ACT="use_cached" 13997c478bd9Sstevel@tonic-gate break ;; 14007c478bd9Sstevel@tonic-gate 2) _RET_ERR_ACT="fail" 14017c478bd9Sstevel@tonic-gate break ;; 14027c478bd9Sstevel@tonic-gate h) display_msg nisLDAPretrieveErrorAction_help ;; 14037c478bd9Sstevel@tonic-gate *) echo "Please enter 1, 2, or h=help." ;; 14047c478bd9Sstevel@tonic-gate esac 14057c478bd9Sstevel@tonic-gate done 14067c478bd9Sstevel@tonic-gate} 14077c478bd9Sstevel@tonic-gate 14087c478bd9Sstevel@tonic-gate 14097c478bd9Sstevel@tonic-gate# 14107c478bd9Sstevel@tonic-gate# store_error_action_menu_handler(): Enter the store error action 14117c478bd9Sstevel@tonic-gate# 14127c478bd9Sstevel@tonic-gatestore_error_action_menu_handler() 14137c478bd9Sstevel@tonic-gate{ 14147c478bd9Sstevel@tonic-gate # Display store error action menu 14157c478bd9Sstevel@tonic-gate display_msg store_error_action_menu 14167c478bd9Sstevel@tonic-gate 14177c478bd9Sstevel@tonic-gate # Get a Valid choice. 14187c478bd9Sstevel@tonic-gate while : 14197c478bd9Sstevel@tonic-gate do 14207c478bd9Sstevel@tonic-gate # Display appropriate prompt and get answer. retry is default 14217c478bd9Sstevel@tonic-gate get_ans " Choose one store error action (h=help):" "1" 14227c478bd9Sstevel@tonic-gate 14237c478bd9Sstevel@tonic-gate # Determine choice. 14247c478bd9Sstevel@tonic-gate _MENU_CHOICE=$ANS 14257c478bd9Sstevel@tonic-gate case "$_MENU_CHOICE" in 14267c478bd9Sstevel@tonic-gate 1) _STOR_ERR_ACT="retry" 14277c478bd9Sstevel@tonic-gate break ;; 14287c478bd9Sstevel@tonic-gate 2) _STOR_ERR_ACT="fail" 14297c478bd9Sstevel@tonic-gate break ;; 14307c478bd9Sstevel@tonic-gate h) display_msg nisLDAPstoreErrorAction_help ;; 14317c478bd9Sstevel@tonic-gate *) echo "Please enter 1, 2, or h=help." ;; 14327c478bd9Sstevel@tonic-gate esac 14337c478bd9Sstevel@tonic-gate done 14347c478bd9Sstevel@tonic-gate} 14357c478bd9Sstevel@tonic-gate 14367c478bd9Sstevel@tonic-gate 14377c478bd9Sstevel@tonic-gate# 14387c478bd9Sstevel@tonic-gate# cleanup(): Remove the TMPDIR and all files in it. 14397c478bd9Sstevel@tonic-gate# 14407c478bd9Sstevel@tonic-gatecleanup() 14417c478bd9Sstevel@tonic-gate{ 14427c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo "In cleanup()" 14437c478bd9Sstevel@tonic-gate 14447c478bd9Sstevel@tonic-gate# Leave the temp directory if debug is set 14457c478bd9Sstevel@tonic-gate[ $DEBUG -eq 0 ] && rm -rf $TMPDIR 14467c478bd9Sstevel@tonic-gate} 14477c478bd9Sstevel@tonic-gate 14487c478bd9Sstevel@tonic-gate 14497c478bd9Sstevel@tonic-gate# Save existing config file if elected 14507c478bd9Sstevel@tonic-gatecheck_back_config_file() 14517c478bd9Sstevel@tonic-gate{ 14527c478bd9Sstevel@tonic-gateif [ -f $CONFIG_FILE ]; then 14537c478bd9Sstevel@tonic-gate display_msg backup_config_file 14547c478bd9Sstevel@tonic-gate 14557c478bd9Sstevel@tonic-gate get_confirm "Do you wish to continue (y/n/h)?" \ 14567c478bd9Sstevel@tonic-gate "n" "backup_config_file_cont_help" 14577c478bd9Sstevel@tonic-gate 14587c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then # if No, cleanup and exit. 14597c478bd9Sstevel@tonic-gate cleanup ; exit 1 14607c478bd9Sstevel@tonic-gate fi 14617c478bd9Sstevel@tonic-gate 14627c478bd9Sstevel@tonic-gate get_confirm "Do you wish to backup the config file "${CONFIG_FILE}" (y/n/h)?" \ 14637c478bd9Sstevel@tonic-gate "y" "backup_config_file_help" 14647c478bd9Sstevel@tonic-gate 14657c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then # Save the old config file with timestamp 14667c478bd9Sstevel@tonic-gate 14677c478bd9Sstevel@tonic-gate # SCCS converts '% H %' (without spaces) in current date during putback. 14687c478bd9Sstevel@tonic-gate # So use some other combination. 14697c478bd9Sstevel@tonic-gate SUFFIX=`date '+%d%h%Y.%H:%M:%S'` 14707c478bd9Sstevel@tonic-gate 14717c478bd9Sstevel@tonic-gate cp -p $CONFIG_FILE ${CONFIG_FILE}-${SUFFIX} 14727c478bd9Sstevel@tonic-gate echo " Saved existing $CONFIG_FILE as ${CONFIG_FILE}-${SUFFIX}" 14737c478bd9Sstevel@tonic-gate fi 14747c478bd9Sstevel@tonic-gatefi 14757c478bd9Sstevel@tonic-gate} 14767c478bd9Sstevel@tonic-gate 14777c478bd9Sstevel@tonic-gate 14787c478bd9Sstevel@tonic-gate# Save existing mapping file if elected 14797c478bd9Sstevel@tonic-gatecheck_back_mapping_file() 14807c478bd9Sstevel@tonic-gate{ 14817c478bd9Sstevel@tonic-gateif [ -f $MAP_FILE ]; then 14827c478bd9Sstevel@tonic-gate display_msg backup_mapping_file 14837c478bd9Sstevel@tonic-gate 14847c478bd9Sstevel@tonic-gate get_confirm "Do you wish to continue (y/n/h)?" \ 14857c478bd9Sstevel@tonic-gate "n" "backup_mapping_file_cont_help" 14867c478bd9Sstevel@tonic-gate 14877c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then # if No, cleanup and exit. 14887c478bd9Sstevel@tonic-gate cleanup ; exit 1 14897c478bd9Sstevel@tonic-gate fi 14907c478bd9Sstevel@tonic-gate 14917c478bd9Sstevel@tonic-gate get_confirm "Do you wish to backup the map file "${MAP_FILE}" (y/n/h)?" \ 14927c478bd9Sstevel@tonic-gate "y" "backup_mapping_file_help" 14937c478bd9Sstevel@tonic-gate 14947c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then # if Yes, save the old map file with timestamp 14957c478bd9Sstevel@tonic-gate 14967c478bd9Sstevel@tonic-gate # SCCS converts '% H %' (without spaces) in current date during putback. 14977c478bd9Sstevel@tonic-gate # So use some other combination. 14987c478bd9Sstevel@tonic-gate SUFFIX=`date '+%d%h%Y.%H:%M:%S'` 14997c478bd9Sstevel@tonic-gate 15007c478bd9Sstevel@tonic-gate cp -p $MAP_FILE ${MAP_FILE}-${SUFFIX} 15017c478bd9Sstevel@tonic-gate echo " Saved existing $MAP_FILE as ${MAP_FILE}-${SUFFIX}" 15027c478bd9Sstevel@tonic-gate fi 15037c478bd9Sstevel@tonic-gate 15047c478bd9Sstevel@tonic-gateelse 15057c478bd9Sstevel@tonic-gate if [ "$MAP_FILE" = "$DEFAULT_MAP_FILE" ]; then 15067c478bd9Sstevel@tonic-gate display_msg warn_n2l_mode 15077c478bd9Sstevel@tonic-gate 15087c478bd9Sstevel@tonic-gate get_confirm "Do you wish to continue (y/n/h)?" \ 15097c478bd9Sstevel@tonic-gate "n" "warn_n2l_mode_help" 15107c478bd9Sstevel@tonic-gate 15117c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 15127c478bd9Sstevel@tonic-gate cleanup ; exit 1 15137c478bd9Sstevel@tonic-gate fi 15147c478bd9Sstevel@tonic-gate fi 15157c478bd9Sstevel@tonic-gatefi 15167c478bd9Sstevel@tonic-gate} 15177c478bd9Sstevel@tonic-gate 15187c478bd9Sstevel@tonic-gate 15197c478bd9Sstevel@tonic-gateput_config_file_copyright_info() 15207c478bd9Sstevel@tonic-gate{ 15217c478bd9Sstevel@tonic-gate 1522*c3e9074dSBen Chang# Start with an empty file, so don't append, but overwrite here. 15237c478bd9Sstevel@tonic-gate# Just change the name, but keep the same date and version number 15247c478bd9Sstevel@tonic-gate# as in the ident string of this script. 15257c478bd9Sstevel@tonic-gate 15267c478bd9Sstevel@tonic-gategrep "ident \"@(#)$PROG" $ABS_PROG | \ 15277c478bd9Sstevel@tonic-gate sed "s/${PROG}/${NEW_NAME}/g" > $CONFIG_FILE 15287c478bd9Sstevel@tonic-gate 15297c478bd9Sstevel@tonic-gateecho "\ 15307c478bd9Sstevel@tonic-gate# 1531*c3e9074dSBen Chang# CDDL HEADER START 1532*c3e9074dSBen Chang# 1533*c3e9074dSBen Chang# The contents of this file are subject to the terms of the 1534*c3e9074dSBen Chang# Common Development and Distribution License (the "License"). 1535*c3e9074dSBen Chang# You may not use this file except in compliance with the License. 1536*c3e9074dSBen Chang# 1537*c3e9074dSBen Chang# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 1538*c3e9074dSBen Chang# or http://www.opensolaris.org/os/licensing. 1539*c3e9074dSBen Chang# See the License for the specific language governing permissions 1540*c3e9074dSBen Chang# and limitations under the License. 1541*c3e9074dSBen Chang# 1542*c3e9074dSBen Chang# When distributing Covered Code, include this CDDL HEADER in each 1543*c3e9074dSBen Chang# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1544*c3e9074dSBen Chang# If applicable, add the following below this CDDL HEADER, with the 1545*c3e9074dSBen Chang# fields enclosed by brackets "[]" replaced with your own identifying 1546*c3e9074dSBen Chang# information: Portions Copyright [yyyy] [name of copyright owner] 1547*c3e9074dSBen Chang# 1548*c3e9074dSBen Chang# CDDL HEADER END 1549*c3e9074dSBen Chang# 1550*c3e9074dSBen Chang# 1551*c3e9074dSBen Chang# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 15527c478bd9Sstevel@tonic-gate#\ 15537c478bd9Sstevel@tonic-gate" >> $MAP_FILE 15547c478bd9Sstevel@tonic-gate} 15557c478bd9Sstevel@tonic-gate 15567c478bd9Sstevel@tonic-gate 15577c478bd9Sstevel@tonic-gateget_nisLDAPconfigDN() 15587c478bd9Sstevel@tonic-gate{ 15597c478bd9Sstevel@tonic-gatewhile : 15607c478bd9Sstevel@tonic-gatedo 15617c478bd9Sstevel@tonic-gate 15627c478bd9Sstevel@tonic-gateget_ans "DN for configuration information (h=help):" 15637c478bd9Sstevel@tonic-gate 15647c478bd9Sstevel@tonic-gate# If help continue, otherwise break. 15657c478bd9Sstevel@tonic-gatecase "$ANS" in 15667c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPconfigDN_help ;; 15677c478bd9Sstevel@tonic-gate * ) break ;; 15687c478bd9Sstevel@tonic-gateesac 15697c478bd9Sstevel@tonic-gatedone 15707c478bd9Sstevel@tonic-gate 15717c478bd9Sstevel@tonic-gatenisLDAPconfigDN="${ANS}" 15727c478bd9Sstevel@tonic-gate 15737c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 15747c478bd9Sstevel@tonic-gateif [ "$ANS" != "${DEF_nisLDAPconfigDN}" ]; then 15757c478bd9Sstevel@tonic-gate echo "nisLDAPconfigDN=${ANS}" >> $CONFIG_FILE 15767c478bd9Sstevel@tonic-gatefi 15777c478bd9Sstevel@tonic-gate 15787c478bd9Sstevel@tonic-gate# Ask remaining config server related questions only if this 15797c478bd9Sstevel@tonic-gate# DN is set. So, if a value is specified, set a flag. 15807c478bd9Sstevel@tonic-gate 15817c478bd9Sstevel@tonic-gate[ "$ANS" != "" ] && configDN_flag=1 15827c478bd9Sstevel@tonic-gate} 15837c478bd9Sstevel@tonic-gate 15847c478bd9Sstevel@tonic-gate 15857c478bd9Sstevel@tonic-gateget_nisLDAPconfigPreferredServerList() 15867c478bd9Sstevel@tonic-gate{ 15877c478bd9Sstevel@tonic-gatewhile : 15887c478bd9Sstevel@tonic-gatedo 15897c478bd9Sstevel@tonic-gate 15907c478bd9Sstevel@tonic-gateget_ans_req "Preferred server list for configuration information (h=help):" 15917c478bd9Sstevel@tonic-gate 15927c478bd9Sstevel@tonic-gate# If help continue, otherwise break. 15937c478bd9Sstevel@tonic-gatecase "$ANS" in 15947c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPconfigPreferredServerList_help ;; 15957c478bd9Sstevel@tonic-gate * ) break ;; 15967c478bd9Sstevel@tonic-gateesac 15977c478bd9Sstevel@tonic-gatedone 15987c478bd9Sstevel@tonic-gate 15997c478bd9Sstevel@tonic-gatenisLDAPconfigPreferredServerList=${ANS} 16007c478bd9Sstevel@tonic-gateecho "nisLDAPconfigPreferredServerList=${ANS}" >> $CONFIG_FILE 16017c478bd9Sstevel@tonic-gate} 16027c478bd9Sstevel@tonic-gate 16037c478bd9Sstevel@tonic-gate 16047c478bd9Sstevel@tonic-gateget_nisLDAPconfigAuthenticationMethod() 16057c478bd9Sstevel@tonic-gate{ 16067c478bd9Sstevel@tonic-gate_AUTHMETHOD="" 16077c478bd9Sstevel@tonic-gate 16087c478bd9Sstevel@tonic-gateecho "Select the Authentication Method for configuration server :" 16097c478bd9Sstevel@tonic-gateconfig_auth_menu_handler 16107c478bd9Sstevel@tonic-gate 16117c478bd9Sstevel@tonic-gatenisLDAPconfigAuthenticationMethod=${_AUTHMETHOD} 16127c478bd9Sstevel@tonic-gateecho "nisLDAPconfigAuthenticationMethod=${_AUTHMETHOD}" >> $CONFIG_FILE 16137c478bd9Sstevel@tonic-gate} 16147c478bd9Sstevel@tonic-gate 16157c478bd9Sstevel@tonic-gate 16167c478bd9Sstevel@tonic-gateget_nisLDAPconfigTLS() 16177c478bd9Sstevel@tonic-gate{ 16187c478bd9Sstevel@tonic-gate_TLSMETHOD="" 16197c478bd9Sstevel@tonic-gate 16207c478bd9Sstevel@tonic-gateecho "Select the Transport Layer Security (TLS) for configuration server :" 16217c478bd9Sstevel@tonic-gatetls_menu_handler 16227c478bd9Sstevel@tonic-gate 16237c478bd9Sstevel@tonic-gatenisLDAPconfigTLS=${_TLSMETHOD} 16247c478bd9Sstevel@tonic-gate 16257c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 16267c478bd9Sstevel@tonic-gateif [ "${_TLSMETHOD}" != "${DEF_TLS}" ]; then 16277c478bd9Sstevel@tonic-gate echo "nisLDAPconfigTLS=${_TLSMETHOD}" >> $CONFIG_FILE 16287c478bd9Sstevel@tonic-gatefi 16297c478bd9Sstevel@tonic-gate} 16307c478bd9Sstevel@tonic-gate 16317c478bd9Sstevel@tonic-gate 16327c478bd9Sstevel@tonic-gateget_nisLDAPconfigTLSCertificateDBPath() 16337c478bd9Sstevel@tonic-gate{ 16347c478bd9Sstevel@tonic-gatewhile : 16357c478bd9Sstevel@tonic-gatedo 16367c478bd9Sstevel@tonic-gate 16371d7382f7SMilan Jurikget_ans "Path with TLS Certificate DB for configuration server (h=help):"\ 16387c478bd9Sstevel@tonic-gate "${DEF_TLSCertificateDBPath}" 16397c478bd9Sstevel@tonic-gate 16407c478bd9Sstevel@tonic-gate# If help continue, otherwise break. 16417c478bd9Sstevel@tonic-gatecase "$ANS" in 16427c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg TLSCertificateDBPath_help ;; 16437c478bd9Sstevel@tonic-gate * ) break ;; 16447c478bd9Sstevel@tonic-gateesac 16457c478bd9Sstevel@tonic-gatedone 16467c478bd9Sstevel@tonic-gate 16477c478bd9Sstevel@tonic-gatenisLDAPconfigTLSCertificateDBPath=${ANS} 16487c478bd9Sstevel@tonic-gate 16497c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 16507c478bd9Sstevel@tonic-gateif [ "$ANS" != "${DEF_TLSCertificateDBPath}" ]; then 16517c478bd9Sstevel@tonic-gate echo "nisLDAPconfigTLSCertificateDBPath=${ANS}" >> $CONFIG_FILE 16527c478bd9Sstevel@tonic-gatefi 16537c478bd9Sstevel@tonic-gate} 16547c478bd9Sstevel@tonic-gate 16557c478bd9Sstevel@tonic-gate 16567c478bd9Sstevel@tonic-gateget_nisLDAPconfigProxyUser() 16577c478bd9Sstevel@tonic-gate{ 16587c478bd9Sstevel@tonic-gatewhile : 16597c478bd9Sstevel@tonic-gatedo 16607c478bd9Sstevel@tonic-gate 16617c478bd9Sstevel@tonic-gateget_ans_req "Proxy user bind DN to obtain configuration information (h=help):" 16627c478bd9Sstevel@tonic-gate# If help continue, otherwise break. 16637c478bd9Sstevel@tonic-gatecase "$ANS" in 16647c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPconfigProxyUser_help ;; 16657c478bd9Sstevel@tonic-gate * ) break ;; 16667c478bd9Sstevel@tonic-gateesac 16677c478bd9Sstevel@tonic-gatedone 16687c478bd9Sstevel@tonic-gate 16697c478bd9Sstevel@tonic-gatenisLDAPconfigProxyUser=${ANS} 16707c478bd9Sstevel@tonic-gateecho "nisLDAPconfigProxyUser=${ANS}" >> $CONFIG_FILE 16717c478bd9Sstevel@tonic-gate} 16727c478bd9Sstevel@tonic-gate 16737c478bd9Sstevel@tonic-gate 16747c478bd9Sstevel@tonic-gateget_nisLDAPconfigProxyPassword() 16757c478bd9Sstevel@tonic-gate{ 16767c478bd9Sstevel@tonic-gateget_passwd "Proxy user password to obtain configuration information :" 16777c478bd9Sstevel@tonic-gatenisLDAPconfigProxyPassword=${ANS} 16787c478bd9Sstevel@tonic-gate 16797c478bd9Sstevel@tonic-gateecho "nisLDAPconfigProxyPassword=${ANS}" >> $CONFIG_FILE 16807c478bd9Sstevel@tonic-gate 16817c478bd9Sstevel@tonic-gatedisplay_msg ProxyPassword_warn 16827c478bd9Sstevel@tonic-gate} 16837c478bd9Sstevel@tonic-gate 16847c478bd9Sstevel@tonic-gate 16857c478bd9Sstevel@tonic-gateget_preferredServerList() 16867c478bd9Sstevel@tonic-gate{ 16877c478bd9Sstevel@tonic-gatewhile : 16887c478bd9Sstevel@tonic-gatedo 16897c478bd9Sstevel@tonic-gate 16907c478bd9Sstevel@tonic-gateget_ans_req "Preferred server list for mapping data to/from LDAP (h=help):" 16917c478bd9Sstevel@tonic-gate 16927c478bd9Sstevel@tonic-gate# If help continue, otherwise break. 16937c478bd9Sstevel@tonic-gatecase "$ANS" in 16947c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg preferredServerList_help ;; 16957c478bd9Sstevel@tonic-gate * ) break ;; 16967c478bd9Sstevel@tonic-gateesac 16977c478bd9Sstevel@tonic-gatedone 16987c478bd9Sstevel@tonic-gate 16997c478bd9Sstevel@tonic-gatepreferredServerList=${ANS} 17007c478bd9Sstevel@tonic-gateecho "preferredServerList=${ANS}" >> $CONFIG_FILE 17017c478bd9Sstevel@tonic-gate} 17027c478bd9Sstevel@tonic-gate 17037c478bd9Sstevel@tonic-gate 17047c478bd9Sstevel@tonic-gateget_authenticationMethod() 17057c478bd9Sstevel@tonic-gate{ 17067c478bd9Sstevel@tonic-gate_AUTHMETHOD="" 17077c478bd9Sstevel@tonic-gate 17087c478bd9Sstevel@tonic-gateecho "Select the Authentication Method for mapping data to/from LDAP :" 17097c478bd9Sstevel@tonic-gateauth_menu_handler 17107c478bd9Sstevel@tonic-gate 17117c478bd9Sstevel@tonic-gateauthenticationMethod=${_AUTHMETHOD} 17127c478bd9Sstevel@tonic-gateecho "authenticationMethod=${_AUTHMETHOD}" >> $CONFIG_FILE 17137c478bd9Sstevel@tonic-gate} 17147c478bd9Sstevel@tonic-gate 17157c478bd9Sstevel@tonic-gate 17167c478bd9Sstevel@tonic-gateget_nisLDAPTLS() 17177c478bd9Sstevel@tonic-gate{ 17187c478bd9Sstevel@tonic-gate_TLSMETHOD="" 17197c478bd9Sstevel@tonic-gate 17207c478bd9Sstevel@tonic-gateecho "Select the Transport Layer Security (TLS) for mapping data to/from LDAP :" 17217c478bd9Sstevel@tonic-gatetls_menu_handler 17227c478bd9Sstevel@tonic-gate 17237c478bd9Sstevel@tonic-gatenisLDAPTLS=${_TLSMETHOD} 17247c478bd9Sstevel@tonic-gate 17257c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 17267c478bd9Sstevel@tonic-gateif [ "${_TLSMETHOD}" != "${DEF_TLS}" ]; then 17277c478bd9Sstevel@tonic-gate echo "nisLDAPTLS=${_TLSMETHOD}" >> $CONFIG_FILE 17287c478bd9Sstevel@tonic-gatefi 17297c478bd9Sstevel@tonic-gate} 17307c478bd9Sstevel@tonic-gate 17317c478bd9Sstevel@tonic-gate 17327c478bd9Sstevel@tonic-gateget_nisLDAPTLSCertificateDBPath() 17337c478bd9Sstevel@tonic-gate{ 17347c478bd9Sstevel@tonic-gatewhile : 17357c478bd9Sstevel@tonic-gatedo 17367c478bd9Sstevel@tonic-gate 17371d7382f7SMilan Jurikget_ans "Path with TLS Certificate DB for LDAP data server (h=help):"\ 17387c478bd9Sstevel@tonic-gate "${DEF_nisLDAPTLSCertificateDBPath}" 17397c478bd9Sstevel@tonic-gate 17407c478bd9Sstevel@tonic-gate# If help continue, otherwise break. 17417c478bd9Sstevel@tonic-gatecase "$ANS" in 17427c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg TLSCertificateDBPath_help ;; 17437c478bd9Sstevel@tonic-gate * ) break ;; 17447c478bd9Sstevel@tonic-gateesac 17457c478bd9Sstevel@tonic-gatedone 17467c478bd9Sstevel@tonic-gate 17477c478bd9Sstevel@tonic-gatenisLDAPTLSCertificateDBPath=${ANS} 17487c478bd9Sstevel@tonic-gate 17497c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 17507c478bd9Sstevel@tonic-gateif [ "$ANS" != "${DEF_TLSCertificateDBPath}" ]; then 17517c478bd9Sstevel@tonic-gate echo "nisLDAPTLSCertificateDBPath=${ANS}" >> $CONFIG_FILE 17527c478bd9Sstevel@tonic-gatefi 17537c478bd9Sstevel@tonic-gate} 17547c478bd9Sstevel@tonic-gate 17557c478bd9Sstevel@tonic-gate 17567c478bd9Sstevel@tonic-gateget_nisLDAPproxyUser() 17577c478bd9Sstevel@tonic-gate{ 17587c478bd9Sstevel@tonic-gatewhile : 17597c478bd9Sstevel@tonic-gatedo 17607c478bd9Sstevel@tonic-gate 17617c478bd9Sstevel@tonic-gateget_ans_req "Proxy user bind DN to read/write data from/to LDAP (h=help):" 17627c478bd9Sstevel@tonic-gate 17637c478bd9Sstevel@tonic-gate# If help continue, otherwise break. 17647c478bd9Sstevel@tonic-gatecase "$ANS" in 17657c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPproxyUser_help ;; 17667c478bd9Sstevel@tonic-gate * ) break ;; 17677c478bd9Sstevel@tonic-gateesac 17687c478bd9Sstevel@tonic-gatedone 17697c478bd9Sstevel@tonic-gate 17707c478bd9Sstevel@tonic-gatenisLDAPproxyUser=${ANS} 17717c478bd9Sstevel@tonic-gateecho "nisLDAPproxyUser=${ANS}" >> $CONFIG_FILE 17727c478bd9Sstevel@tonic-gate} 17737c478bd9Sstevel@tonic-gate 17747c478bd9Sstevel@tonic-gate 17757c478bd9Sstevel@tonic-gateget_nisLDAPproxyPassword() 17767c478bd9Sstevel@tonic-gate{ 17777c478bd9Sstevel@tonic-gateget_passwd "Proxy user password to read/write data from/to LDAP :" 17787c478bd9Sstevel@tonic-gatenisLDAPproxyPassword=${ANS} 17797c478bd9Sstevel@tonic-gate 17807c478bd9Sstevel@tonic-gateecho "nisLDAPproxyPassword=${ANS}" >> $CONFIG_FILE 17817c478bd9Sstevel@tonic-gate 17827c478bd9Sstevel@tonic-gatedisplay_msg ProxyPassword_warn 17837c478bd9Sstevel@tonic-gate} 17847c478bd9Sstevel@tonic-gate 17857c478bd9Sstevel@tonic-gate 17867c478bd9Sstevel@tonic-gateget_nisLDAPbindTimeout() 17877c478bd9Sstevel@tonic-gate{ 17887c478bd9Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP bind operation (h=help):" \ 17897c478bd9Sstevel@tonic-gate "${DEF_nisLDAPbindTimeout}" "nisLDAPbindTimeout_help" 17907c478bd9Sstevel@tonic-gate 17917c478bd9Sstevel@tonic-gatenisLDAPbindTimeout=${NUM} 17927c478bd9Sstevel@tonic-gate 17937c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 17947c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPbindTimeout} ]; then 17957c478bd9Sstevel@tonic-gate echo "nisLDAPbindTimeout=${NUM}" >> $CONFIG_FILE 17967c478bd9Sstevel@tonic-gatefi 17977c478bd9Sstevel@tonic-gate} 17987c478bd9Sstevel@tonic-gate 17997c478bd9Sstevel@tonic-gate 18007c478bd9Sstevel@tonic-gateget_nisLDAPsearchTimeout() 18017c478bd9Sstevel@tonic-gate{ 18027c478bd9Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP search operation (h=help):" \ 18037c478bd9Sstevel@tonic-gate "${DEF_nisLDAPsearchTimeout}" "nisLDAPsearchTimeout_help" 18047c478bd9Sstevel@tonic-gate 18057c478bd9Sstevel@tonic-gatenisLDAPsearchTimeout=${NUM} 18067c478bd9Sstevel@tonic-gate 18077c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18087c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPsearchTimeout} ]; then 18097c478bd9Sstevel@tonic-gate echo "nisLDAPsearchTimeout=${NUM}" >> $CONFIG_FILE 18107c478bd9Sstevel@tonic-gatefi 18117c478bd9Sstevel@tonic-gate} 18127c478bd9Sstevel@tonic-gate 18137c478bd9Sstevel@tonic-gate 18147c478bd9Sstevel@tonic-gateget_nisLDAPmodifyTimeout() 18157c478bd9Sstevel@tonic-gate{ 18167c478bd9Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP modify operation (h=help):" \ 18177c478bd9Sstevel@tonic-gate "${DEF_nisLDAPmodifyTimeout}" "nisLDAPmodifyTimeout_help" 18187c478bd9Sstevel@tonic-gate 18197c478bd9Sstevel@tonic-gatenisLDAPmodifyTimeout=${NUM} 18207c478bd9Sstevel@tonic-gate 18217c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18227c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPmodifyTimeout} ]; then 18237c478bd9Sstevel@tonic-gate echo "nisLDAPmodifyTimeout=${NUM}" >> $CONFIG_FILE 18247c478bd9Sstevel@tonic-gatefi 18257c478bd9Sstevel@tonic-gate} 18267c478bd9Sstevel@tonic-gate 18277c478bd9Sstevel@tonic-gate 18287c478bd9Sstevel@tonic-gateget_nisLDAPaddTimeout() 18297c478bd9Sstevel@tonic-gate{ 18307c478bd9Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP add operation (h=help):" \ 18317c478bd9Sstevel@tonic-gate "${DEF_nisLDAPaddTimeout}" "nisLDAPaddTimeout_help" 18327c478bd9Sstevel@tonic-gate 18337c478bd9Sstevel@tonic-gatenisLDAPaddTimeout=${NUM} 18347c478bd9Sstevel@tonic-gate 18357c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18367c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPaddTimeout} ]; then 18377c478bd9Sstevel@tonic-gate echo "nisLDAPaddTimeout=${NUM}" >> $CONFIG_FILE 18387c478bd9Sstevel@tonic-gatefi 18397c478bd9Sstevel@tonic-gate} 18407c478bd9Sstevel@tonic-gate 18417c478bd9Sstevel@tonic-gate 18427c478bd9Sstevel@tonic-gateget_nisLDAPdeleteTimeout() 18437c478bd9Sstevel@tonic-gate{ 18447c478bd9Sstevel@tonic-gateget_pos_int "Timeout value (in seconds) for LDAP delete operation (h=help):" \ 18457c478bd9Sstevel@tonic-gate "${DEF_nisLDAPdeleteTimeout}" "nisLDAPdeleteTimeout_help" 18467c478bd9Sstevel@tonic-gate 18477c478bd9Sstevel@tonic-gatenisLDAPdeleteTimeout=${NUM} 18487c478bd9Sstevel@tonic-gate 18497c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18507c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPdeleteTimeout} ]; then 18517c478bd9Sstevel@tonic-gate echo "nisLDAPdeleteTimeout=${NUM}" >> $CONFIG_FILE 18527c478bd9Sstevel@tonic-gatefi 18537c478bd9Sstevel@tonic-gate} 18547c478bd9Sstevel@tonic-gate 18557c478bd9Sstevel@tonic-gate 18567c478bd9Sstevel@tonic-gateget_nisLDAPsearchTimeLimit() 18577c478bd9Sstevel@tonic-gate{ 18587c478bd9Sstevel@tonic-gateget_pos_int "Time limit (in seconds) for search operation on LDAP server (h=help):" \ 18597c478bd9Sstevel@tonic-gate "${DEF_nisLDAPsearchTimeLimit}" "nisLDAPsearchTimeLimit_help" 18607c478bd9Sstevel@tonic-gate 18617c478bd9Sstevel@tonic-gatenisLDAPsearchTimeLimit=${NUM} 18627c478bd9Sstevel@tonic-gate 18637c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18647c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPsearchTimeLimit} ]; then 18657c478bd9Sstevel@tonic-gate echo "nisLDAPsearchTimeLimit=${NUM}" >> $CONFIG_FILE 18667c478bd9Sstevel@tonic-gatefi 18677c478bd9Sstevel@tonic-gate} 18687c478bd9Sstevel@tonic-gate 18697c478bd9Sstevel@tonic-gate 18707c478bd9Sstevel@tonic-gateget_nisLDAPsearchSizeLimit() 18717c478bd9Sstevel@tonic-gate{ 18727c478bd9Sstevel@tonic-gateget_pos_int "Size limit (in bytes) for search operation on LDAP server (h=help):" \ 18737c478bd9Sstevel@tonic-gate "${DEF_nisLDAPsearchSizeLimit}" "nisLDAPsearchSizeLimit_help" 18747c478bd9Sstevel@tonic-gate 18757c478bd9Sstevel@tonic-gatenisLDAPsearchSizeLimit=${NUM} 18767c478bd9Sstevel@tonic-gate 18777c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18787c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPsearchSizeLimit} ]; then 18797c478bd9Sstevel@tonic-gate echo "nisLDAPsearchSizeLimit=${NUM}" >> $CONFIG_FILE 18807c478bd9Sstevel@tonic-gatefi 18817c478bd9Sstevel@tonic-gate} 18827c478bd9Sstevel@tonic-gate 18837c478bd9Sstevel@tonic-gate 18847c478bd9Sstevel@tonic-gateget_nisLDAPfollowReferral() 18857c478bd9Sstevel@tonic-gate{ 18867c478bd9Sstevel@tonic-gateget_confirm "Should the ypserv follow LDAP referrals (y/n/h):" \ 18877c478bd9Sstevel@tonic-gate "n" "nisLDAPfollowReferral_help" 18887c478bd9Sstevel@tonic-gate 18897c478bd9Sstevel@tonic-gateif [ $? -eq 1 ]; then 18907c478bd9Sstevel@tonic-gate _ANS="yes" 18917c478bd9Sstevel@tonic-gateelse 18927c478bd9Sstevel@tonic-gate _ANS="no" 18937c478bd9Sstevel@tonic-gatefi 18947c478bd9Sstevel@tonic-gate 18957c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 18967c478bd9Sstevel@tonic-gateif [ "${_ANS}" != "${DEF_nisLDAPfollowReferral}" ]; then 18977c478bd9Sstevel@tonic-gate echo "nisLDAPfollowReferral=${_ANS}" >> $CONFIG_FILE 18987c478bd9Sstevel@tonic-gatefi 18997c478bd9Sstevel@tonic-gate} 19007c478bd9Sstevel@tonic-gate 19017c478bd9Sstevel@tonic-gate 19027c478bd9Sstevel@tonic-gateget_nisLDAPretrieveErrorAction() 19037c478bd9Sstevel@tonic-gate{ 19047c478bd9Sstevel@tonic-gate_RET_ERR_ACT="" 19057c478bd9Sstevel@tonic-gate 19067c478bd9Sstevel@tonic-gateecho "Select the action to be taken in case of LDAP retrieval error :" 19077c478bd9Sstevel@tonic-gateretrieve_error_action_menu_handler 19087c478bd9Sstevel@tonic-gate 19097c478bd9Sstevel@tonic-gatenisLDAPretrieveErrorAction=${_RET_ERR_ACT} 19107c478bd9Sstevel@tonic-gate 19117c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 19127c478bd9Sstevel@tonic-gateif [ "${_RET_ERR_ACT}" != "${DEF_nisLDAPretrieveErrorAction}" ]; then 19137c478bd9Sstevel@tonic-gate echo "nisLDAPretrieveErrorAction=${_RET_ERR_ACT}" >> $CONFIG_FILE 19147c478bd9Sstevel@tonic-gatefi 19157c478bd9Sstevel@tonic-gate} 19167c478bd9Sstevel@tonic-gate 19177c478bd9Sstevel@tonic-gate 19187c478bd9Sstevel@tonic-gateget_nisLDAPretrieveErrorAttempts() 19197c478bd9Sstevel@tonic-gate{ 19207c478bd9Sstevel@tonic-gate 19217c478bd9Sstevel@tonic-gateget_pos_int "Number of attempts in case of LDAP retrieval error (h=help):" \ 19227c478bd9Sstevel@tonic-gate "$SUG_nisLDAPretrieveErrorAttempts" \ 19237c478bd9Sstevel@tonic-gate "nisLDAPretrieveErrorAttempts_help" 19247c478bd9Sstevel@tonic-gate 19257c478bd9Sstevel@tonic-gatenisLDAPretrieveErrorAttempts=${NUM} 19267c478bd9Sstevel@tonic-gate 19277c478bd9Sstevel@tonic-gateecho "nisLDAPretrieveErrorAttempts=${NUM}" >> $CONFIG_FILE 19287c478bd9Sstevel@tonic-gate} 19297c478bd9Sstevel@tonic-gate 19307c478bd9Sstevel@tonic-gate 19317c478bd9Sstevel@tonic-gateget_nisLDAPretrieveErrorTimeout() 19327c478bd9Sstevel@tonic-gate{ 19337c478bd9Sstevel@tonic-gate# if nisLDAPretrieveErrorAttempts=0, then no point in asking 19347c478bd9Sstevel@tonic-gate# for timeout vales as it is ignored anyway. 19357c478bd9Sstevel@tonic-gate 19367c478bd9Sstevel@tonic-gate[ $nisLDAPretrieveErrorAttempts -eq 0 ] && return 0 19377c478bd9Sstevel@tonic-gate 19387c478bd9Sstevel@tonic-gateget_pos_int "Timeout (in seconds) between each new attempt to retrieve LDAP data (h=help):"\ 19397c478bd9Sstevel@tonic-gate "${DEF_nisLDAPretrieveErrorTimeout}" \ 19407c478bd9Sstevel@tonic-gate "nisLDAPretrieveErrorTimeout_help" 19417c478bd9Sstevel@tonic-gate 19427c478bd9Sstevel@tonic-gatenisLDAPretrieveErrorTimeout=${NUM} 19437c478bd9Sstevel@tonic-gate 19447c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 19457c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPretrieveErrorTimeout} ]; then 19467c478bd9Sstevel@tonic-gate echo "nisLDAPretrieveErrorTimeout=${NUM}" >> $CONFIG_FILE 19477c478bd9Sstevel@tonic-gatefi 19487c478bd9Sstevel@tonic-gate} 19497c478bd9Sstevel@tonic-gate 19507c478bd9Sstevel@tonic-gate 19517c478bd9Sstevel@tonic-gateget_nisLDAPstoreErrorAction() 19527c478bd9Sstevel@tonic-gate{ 19537c478bd9Sstevel@tonic-gate_STOR_ERR_ACT="" 19547c478bd9Sstevel@tonic-gate 19557c478bd9Sstevel@tonic-gateecho "Select the action to be taken in case of LDAP store error :" 19567c478bd9Sstevel@tonic-gatestore_error_action_menu_handler 19577c478bd9Sstevel@tonic-gate 19587c478bd9Sstevel@tonic-gatenisLDAPstoreErrorAction=${_STOR_ERR_ACT} 19597c478bd9Sstevel@tonic-gate 19607c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 19617c478bd9Sstevel@tonic-gateif [ "${_STOR_ERR_ACT}" != "${DEF_nisLDAPstoreErrorAction}" ]; then 19627c478bd9Sstevel@tonic-gate echo "nisLDAPstoreErrorAction=${_STOR_ERR_ACT}" >> $CONFIG_FILE 19637c478bd9Sstevel@tonic-gatefi 19647c478bd9Sstevel@tonic-gate} 19657c478bd9Sstevel@tonic-gate 19667c478bd9Sstevel@tonic-gate 19677c478bd9Sstevel@tonic-gateget_nisLDAPstoreErrorAttempts() 19687c478bd9Sstevel@tonic-gate{ 19697c478bd9Sstevel@tonic-gate 19707c478bd9Sstevel@tonic-gate# if nisLDAPstoreErrorAction="fail", then no point in asking 19717c478bd9Sstevel@tonic-gate# for no. of attempts or timeout vales as they are ignored. 19727c478bd9Sstevel@tonic-gate 19737c478bd9Sstevel@tonic-gate[ "$nisLDAPstoreErrorAction" = "fail" ] && return 0 19747c478bd9Sstevel@tonic-gate 19757c478bd9Sstevel@tonic-gateget_pos_int "Number of attempts in case of LDAP store error (h=help):" \ 19767c478bd9Sstevel@tonic-gate "$SUG_nisLDAPstoreErrorAttempts" \ 19777c478bd9Sstevel@tonic-gate "nisLDAPstoreErrorAttempts_help" 19787c478bd9Sstevel@tonic-gate 19797c478bd9Sstevel@tonic-gatenisLDAPstoreErrorAttempts=${NUM} 19807c478bd9Sstevel@tonic-gate 19817c478bd9Sstevel@tonic-gateecho "nisLDAPstoreErrorAttempts=${NUM}" >> $CONFIG_FILE 19827c478bd9Sstevel@tonic-gate} 19837c478bd9Sstevel@tonic-gate 19847c478bd9Sstevel@tonic-gate 19857c478bd9Sstevel@tonic-gateget_nisLDAPstoreErrorTimeout() 19867c478bd9Sstevel@tonic-gate{ 19877c478bd9Sstevel@tonic-gate 19887c478bd9Sstevel@tonic-gate# if nisLDAPstoreErrorAction="fail", then no point in asking 19897c478bd9Sstevel@tonic-gate# for no. of attempts or timeout vales as they are ignored. 19907c478bd9Sstevel@tonic-gate 19917c478bd9Sstevel@tonic-gate[ "$nisLDAPstoreErrorAction" = "fail" ] && return 0 19927c478bd9Sstevel@tonic-gate 19937c478bd9Sstevel@tonic-gate# Similarly, if nisLDAPstoreErrorAttempts=0, ignore this question. 19947c478bd9Sstevel@tonic-gate 19957c478bd9Sstevel@tonic-gate[ $nisLDAPstoreErrorAttempts -eq 0 ] && return 0 19967c478bd9Sstevel@tonic-gate 19977c478bd9Sstevel@tonic-gateget_pos_int "Timeout (in seconds) between each new attempt to write LDAP data (h=help):"\ 19987c478bd9Sstevel@tonic-gate "${DEF_nisLDAPstoreErrorTimeout}" \ 19997c478bd9Sstevel@tonic-gate "nisLDAPstoreErrorTimeout_help" 20007c478bd9Sstevel@tonic-gate 20017c478bd9Sstevel@tonic-gatenisLDAPstoreErrorTimeout=${NUM} 20027c478bd9Sstevel@tonic-gate 20037c478bd9Sstevel@tonic-gate# Store in config file only if a non-default value is specified. 20047c478bd9Sstevel@tonic-gateif [ $NUM -ne ${DEF_nisLDAPstoreErrorTimeout} ]; then 20057c478bd9Sstevel@tonic-gate echo "nisLDAPstoreErrorTimeout=${NUM}" >> $CONFIG_FILE 20067c478bd9Sstevel@tonic-gatefi 20077c478bd9Sstevel@tonic-gate} 20087c478bd9Sstevel@tonic-gate 20097c478bd9Sstevel@tonic-gate 20107c478bd9Sstevel@tonic-gate 20117c478bd9Sstevel@tonic-gatecreate_config_file() 20127c478bd9Sstevel@tonic-gate{ 20137c478bd9Sstevel@tonic-gate 20147c478bd9Sstevel@tonic-gate# To prevent from leaving a partial config file in case some error or 20157c478bd9Sstevel@tonic-gate# signal takes place, store the output being generated in a temporary 20167c478bd9Sstevel@tonic-gate# file first, and move it at the final destination only at the end if 20177c478bd9Sstevel@tonic-gate# everything goes fine. 20187c478bd9Sstevel@tonic-gate 20197c478bd9Sstevel@tonic-gate_CONFIG_FILE=$CONFIG_FILE 20207c478bd9Sstevel@tonic-gateCONFIG_FILE=${TMPDIR}/${TMPCONF}.$$ 20217c478bd9Sstevel@tonic-gate 20227c478bd9Sstevel@tonic-gateecho "Generating config file temporarily as \"${CONFIG_FILE}\"" 20237c478bd9Sstevel@tonic-gate 20247c478bd9Sstevel@tonic-gate# Truncate the file before we append anything. 20257c478bd9Sstevel@tonic-gate# Place copyright information 20267c478bd9Sstevel@tonic-gateput_config_file_copyright_info 20277c478bd9Sstevel@tonic-gate 20287c478bd9Sstevel@tonic-gate# Filter out all the YP domains in /var/yp 20297c478bd9Sstevel@tonic-gate# The list of domains is stored in list "VARYP_DMN_LIST" 20307c478bd9Sstevel@tonic-gate 20317c478bd9Sstevel@tonic-gateecho "\ 20327c478bd9Sstevel@tonic-gate# 20337c478bd9Sstevel@tonic-gate# Configuration file for ypserv(1M); see ypserv(4) for more information, 20347c478bd9Sstevel@tonic-gate# and NISLDAPmapping(4) for configuration of NIS to LDAP mapping. 20357c478bd9Sstevel@tonic-gate 20367c478bd9Sstevel@tonic-gate# Unless otherwise noted, commented lines show default values. 20377c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 20387c478bd9Sstevel@tonic-gate 20397c478bd9Sstevel@tonic-gateecho "\ 20407c478bd9Sstevel@tonic-gate# Where to look for configuration information in LDAP. Leave empty or 20417c478bd9Sstevel@tonic-gate# undefined to use this file, in which case the values of the other 20427c478bd9Sstevel@tonic-gate# 'nisLdapConfig*' attributes are ignored. 20437c478bd9Sstevel@tonic-gate# 20447c478bd9Sstevel@tonic-gate#nisLDAPconfigDN=\ 20457c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 20467c478bd9Sstevel@tonic-gate 20477c478bd9Sstevel@tonic-gateget_nisLDAPconfigDN 20487c478bd9Sstevel@tonic-gate 20497c478bd9Sstevel@tonic-gateecho " 20507c478bd9Sstevel@tonic-gate 20517c478bd9Sstevel@tonic-gate# Server(s) for configuration information. There is no default; 20527c478bd9Sstevel@tonic-gate# use the value on the line below for an LDAP server running on 20537c478bd9Sstevel@tonic-gate# this machine, at port 389. 20547c478bd9Sstevel@tonic-gate#nisLDAPconfigPreferredServerList=127.0.0.1:389\ 20557c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 20567c478bd9Sstevel@tonic-gate 20577c478bd9Sstevel@tonic-gate[ $configDN_flag -eq 1 ] && get_nisLDAPconfigPreferredServerList 20587c478bd9Sstevel@tonic-gate 20597c478bd9Sstevel@tonic-gateecho " 20607c478bd9Sstevel@tonic-gate 20617c478bd9Sstevel@tonic-gate# Authentication method(s) to obtain configuration information. 20627c478bd9Sstevel@tonic-gate#\ 20637c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 20647c478bd9Sstevel@tonic-gate 20657c478bd9Sstevel@tonic-gate[ $configDN_flag -eq 1 ] && get_nisLDAPconfigAuthenticationMethod 20667c478bd9Sstevel@tonic-gate 20677c478bd9Sstevel@tonic-gateecho " 20687c478bd9Sstevel@tonic-gate 20697c478bd9Sstevel@tonic-gate# Transport layer security for configuration information 20707c478bd9Sstevel@tonic-gate# 20717c478bd9Sstevel@tonic-gate#nisLDAPconfigTLS=${DEF_TLS}\ 20727c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 20737c478bd9Sstevel@tonic-gate 20747c478bd9Sstevel@tonic-gate[ $configDN_flag -eq 1 ] && get_nisLDAPconfigTLS 20757c478bd9Sstevel@tonic-gate 20767c478bd9Sstevel@tonic-gateecho " 20777c478bd9Sstevel@tonic-gate 20787c478bd9Sstevel@tonic-gate# Certificate DB for transport layer security 20797c478bd9Sstevel@tonic-gate# 20807c478bd9Sstevel@tonic-gate#nisLDAPconfigTLSCertificateDBPath=${DEF_TLSCertificateDBPath}\ 20817c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 20827c478bd9Sstevel@tonic-gate 20837c478bd9Sstevel@tonic-gate# ask for Certificate DB only if SSL is set 20847c478bd9Sstevel@tonic-gateif [ "${nisLDAPconfigTLS}" = "ssl" ]; then 20857c478bd9Sstevel@tonic-gate [ $configDN_flag -eq 1 ] && get_nisLDAPconfigTLSCertificateDBPath 20867c478bd9Sstevel@tonic-gatefi 20877c478bd9Sstevel@tonic-gate 20887c478bd9Sstevel@tonic-gateecho " 20897c478bd9Sstevel@tonic-gate 20907c478bd9Sstevel@tonic-gate# Proxy user(s) to obtain configuration information. The line below 20917c478bd9Sstevel@tonic-gate# is an example of the format. 20927c478bd9Sstevel@tonic-gate# 20937c478bd9Sstevel@tonic-gate#nisLDAPconfigProxyUser=cn=nisAdmin,ou=People,\ 20947c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 20957c478bd9Sstevel@tonic-gate 20967c478bd9Sstevel@tonic-gate# Ask proxy user bind DN only if needed. 20977c478bd9Sstevel@tonic-gateif [ "${nisLDAPconfigAuthenticationMethod}" != "none" ]; then 20987c478bd9Sstevel@tonic-gate [ $configDN_flag -eq 1 ] && get_nisLDAPconfigProxyUser 20997c478bd9Sstevel@tonic-gatefi 21007c478bd9Sstevel@tonic-gate 21017c478bd9Sstevel@tonic-gateecho " 21027c478bd9Sstevel@tonic-gate 21037c478bd9Sstevel@tonic-gate# Password for proxy user. Must be supplied if the authentication method 21047c478bd9Sstevel@tonic-gate# requires a password. If a password appears in this file, it should be 21057c478bd9Sstevel@tonic-gate# protected appropriately against access by unauthorized users. 21067c478bd9Sstevel@tonic-gate# 21077c478bd9Sstevel@tonic-gate#nisLDAPconfigProxyPassword=\ 21087c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21097c478bd9Sstevel@tonic-gate 21107c478bd9Sstevel@tonic-gateif [ "${nisLDAPconfigAuthenticationMethod}" != "none" ]; then 21117c478bd9Sstevel@tonic-gate [ $configDN_flag -eq 1 ] && get_nisLDAPconfigProxyPassword 21127c478bd9Sstevel@tonic-gatefi 21137c478bd9Sstevel@tonic-gate 21147c478bd9Sstevel@tonic-gateecho " 21157c478bd9Sstevel@tonic-gate 21167c478bd9Sstevel@tonic-gate# Server list for mapping data to/from LDAP. There is no default; 21177c478bd9Sstevel@tonic-gate# use the value on the line below for an LDAP server running on 21187c478bd9Sstevel@tonic-gate# this machine, at port 389. 21197c478bd9Sstevel@tonic-gate#preferredServerList=127.0.0.1:389\ 21207c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21217c478bd9Sstevel@tonic-gate 21227c478bd9Sstevel@tonic-gateget_preferredServerList 21237c478bd9Sstevel@tonic-gate 21247c478bd9Sstevel@tonic-gateecho " 21257c478bd9Sstevel@tonic-gate 21267c478bd9Sstevel@tonic-gate# Authentication method for mapping data to/from LDAP 21277c478bd9Sstevel@tonic-gate#\ 21287c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21297c478bd9Sstevel@tonic-gate 21307c478bd9Sstevel@tonic-gateget_authenticationMethod 21317c478bd9Sstevel@tonic-gate 21327c478bd9Sstevel@tonic-gateecho " 21337c478bd9Sstevel@tonic-gate 21347c478bd9Sstevel@tonic-gate# Transport layer security for mapping data to/from LDAP. 21357c478bd9Sstevel@tonic-gate# 21367c478bd9Sstevel@tonic-gate#nisLDAPTLS=${DEF_TLS}\ 21377c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21387c478bd9Sstevel@tonic-gate 21397c478bd9Sstevel@tonic-gateget_nisLDAPTLS 21407c478bd9Sstevel@tonic-gate 21417c478bd9Sstevel@tonic-gateecho " 21427c478bd9Sstevel@tonic-gate 21437c478bd9Sstevel@tonic-gate# Certificate DB for transport layer security 21447c478bd9Sstevel@tonic-gate# 21457c478bd9Sstevel@tonic-gate#nisLDAPTLSCertificateDBPath=${DEF_TLSCertificateDBPath}\ 21467c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21477c478bd9Sstevel@tonic-gate 21487c478bd9Sstevel@tonic-gate# ask for Certificate DB only if SSL is set 21497c478bd9Sstevel@tonic-gateif [ "${nisLDAPTLS}" = "ssl" ]; then 21507c478bd9Sstevel@tonic-gate get_nisLDAPTLSCertificateDBPath 21517c478bd9Sstevel@tonic-gatefi 21527c478bd9Sstevel@tonic-gate 21537c478bd9Sstevel@tonic-gateecho " 21547c478bd9Sstevel@tonic-gate 21557c478bd9Sstevel@tonic-gate# Proxy user for ypserv. Assumed to have appropriate permission to read 21567c478bd9Sstevel@tonic-gate# and/or create or modify LDAP data. The line below is an example of the 21577c478bd9Sstevel@tonic-gate# format. 21587c478bd9Sstevel@tonic-gate# 21597c478bd9Sstevel@tonic-gate#nisLDAPproxyUser=cn=nisAdmin,ou=People,\ 21607c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21617c478bd9Sstevel@tonic-gate 21627c478bd9Sstevel@tonic-gate# Ask proxy user bind DN only if needed. 21637c478bd9Sstevel@tonic-gateif [ "${authenticationMethod}" != "none" ]; then 21647c478bd9Sstevel@tonic-gate get_nisLDAPproxyUser 21657c478bd9Sstevel@tonic-gatefi 21667c478bd9Sstevel@tonic-gate 21677c478bd9Sstevel@tonic-gateecho " 21687c478bd9Sstevel@tonic-gate 21697c478bd9Sstevel@tonic-gate# Password for proxy user. Must be supplied if the authentication method 21707c478bd9Sstevel@tonic-gate# requires a password. If a password appears in this file, it should be 21717c478bd9Sstevel@tonic-gate# protected appropriately against unauthorized access. 21727c478bd9Sstevel@tonic-gate# 21737c478bd9Sstevel@tonic-gate#nisLDAPproxyPassword=\ 21747c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21757c478bd9Sstevel@tonic-gate 21767c478bd9Sstevel@tonic-gateif [ "${authenticationMethod}" != "none" ]; then 21777c478bd9Sstevel@tonic-gate get_nisLDAPproxyPassword 21787c478bd9Sstevel@tonic-gatefi 21797c478bd9Sstevel@tonic-gate 21807c478bd9Sstevel@tonic-gateecho " 21817c478bd9Sstevel@tonic-gate 21827c478bd9Sstevel@tonic-gate# Timeouts and time/size limits for LDAP operations. 21837c478bd9Sstevel@tonic-gate# 21847c478bd9Sstevel@tonic-gate#nisLDAPbindTimeout=${DEF_nisLDAPbindTimeout}\ 21857c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21867c478bd9Sstevel@tonic-gate 21877c478bd9Sstevel@tonic-gateget_nisLDAPbindTimeout 21887c478bd9Sstevel@tonic-gate 21897c478bd9Sstevel@tonic-gateecho " 21907c478bd9Sstevel@tonic-gate#nisLDAPsearchTimeout=${DEF_nisLDAPsearchTimeout}\ 21917c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21927c478bd9Sstevel@tonic-gate 21937c478bd9Sstevel@tonic-gateget_nisLDAPsearchTimeout 21947c478bd9Sstevel@tonic-gate 21957c478bd9Sstevel@tonic-gateecho " 21967c478bd9Sstevel@tonic-gate#nisLDAPmodifyTimeout=${DEF_nisLDAPmodifyTimeout}\ 21977c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 21987c478bd9Sstevel@tonic-gate 21997c478bd9Sstevel@tonic-gateget_nisLDAPmodifyTimeout 22007c478bd9Sstevel@tonic-gate 22017c478bd9Sstevel@tonic-gateecho " 22027c478bd9Sstevel@tonic-gate#nisLDAPaddTimeout=${DEF_nisLDAPaddTimeout}\ 22037c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22047c478bd9Sstevel@tonic-gate 22057c478bd9Sstevel@tonic-gateget_nisLDAPaddTimeout 22067c478bd9Sstevel@tonic-gate 22077c478bd9Sstevel@tonic-gateecho " 22087c478bd9Sstevel@tonic-gate#nisLDAPdeleteTimeout=${DEF_nisLDAPdeleteTimeout}\ 22097c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22107c478bd9Sstevel@tonic-gate 22117c478bd9Sstevel@tonic-gateget_nisLDAPdeleteTimeout 22127c478bd9Sstevel@tonic-gate 22137c478bd9Sstevel@tonic-gateecho " 22147c478bd9Sstevel@tonic-gate#nisLDAPsearchTimeLimit=${DEF_nisLDAPsearchTimeLimit}\ 22157c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22167c478bd9Sstevel@tonic-gate 22177c478bd9Sstevel@tonic-gateget_nisLDAPsearchTimeLimit 22187c478bd9Sstevel@tonic-gate 22197c478bd9Sstevel@tonic-gateecho " 22207c478bd9Sstevel@tonic-gate#nisLDAPsearchSizeLimit=${DEF_nisLDAPsearchSizeLimit}\ 22217c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22227c478bd9Sstevel@tonic-gate 22237c478bd9Sstevel@tonic-gateget_nisLDAPsearchSizeLimit 22247c478bd9Sstevel@tonic-gate 22257c478bd9Sstevel@tonic-gateecho " 22267c478bd9Sstevel@tonic-gate 22277c478bd9Sstevel@tonic-gate# Should the ypserv follow LDAP referrals ? 22287c478bd9Sstevel@tonic-gate# 22297c478bd9Sstevel@tonic-gate#nisLDAPfollowReferral=${DEF_nisLDAPfollowReferral}\ 22307c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22317c478bd9Sstevel@tonic-gate 22327c478bd9Sstevel@tonic-gateget_nisLDAPfollowReferral 22337c478bd9Sstevel@tonic-gate 22347c478bd9Sstevel@tonic-gateecho " 22357c478bd9Sstevel@tonic-gate 22367c478bd9Sstevel@tonic-gate# Action, number of attempts, and timeout following an LDAP retrieval error 22377c478bd9Sstevel@tonic-gate# 22387c478bd9Sstevel@tonic-gate#nisLDAPretrieveErrorAction=${DEF_nisLDAPretrieveErrorAction}\ 22397c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22407c478bd9Sstevel@tonic-gate 22417c478bd9Sstevel@tonic-gateget_nisLDAPretrieveErrorAction 22427c478bd9Sstevel@tonic-gate 22437c478bd9Sstevel@tonic-gateecho " 22447c478bd9Sstevel@tonic-gate#nisLDAPretrieveErrorAttempts=\ 22457c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22467c478bd9Sstevel@tonic-gate 22477c478bd9Sstevel@tonic-gateget_nisLDAPretrieveErrorAttempts 22487c478bd9Sstevel@tonic-gate 22497c478bd9Sstevel@tonic-gateecho " 22507c478bd9Sstevel@tonic-gate#nisLDAPretrieveErrorTimeout=${DEF_nisLDAPretrieveErrorTimeout}\ 22517c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22527c478bd9Sstevel@tonic-gate 22537c478bd9Sstevel@tonic-gateget_nisLDAPretrieveErrorTimeout 22547c478bd9Sstevel@tonic-gate 22557c478bd9Sstevel@tonic-gateecho " 22567c478bd9Sstevel@tonic-gate 22577c478bd9Sstevel@tonic-gate# Action, number of attempts, and timeout following an LDAP store error 22587c478bd9Sstevel@tonic-gate# 22597c478bd9Sstevel@tonic-gate#nisLDAPstoreErrorAction=${DEF_nisLDAPstoreErrorAction}\ 22607c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22617c478bd9Sstevel@tonic-gate 22627c478bd9Sstevel@tonic-gateget_nisLDAPstoreErrorAction 22637c478bd9Sstevel@tonic-gate 22647c478bd9Sstevel@tonic-gateecho " 22657c478bd9Sstevel@tonic-gate#nisLDAPstoreErrorAttempts=\ 22667c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22677c478bd9Sstevel@tonic-gate 22687c478bd9Sstevel@tonic-gateget_nisLDAPstoreErrorAttempts 22697c478bd9Sstevel@tonic-gate 22707c478bd9Sstevel@tonic-gateecho " 22717c478bd9Sstevel@tonic-gate#nisLDAPstoreErrorTimeout=${DEF_nisLDAPstoreErrorTimeout}\ 22727c478bd9Sstevel@tonic-gate" >> $CONFIG_FILE 22737c478bd9Sstevel@tonic-gate 22747c478bd9Sstevel@tonic-gateget_nisLDAPstoreErrorTimeout 22757c478bd9Sstevel@tonic-gate 22767c478bd9Sstevel@tonic-gate 22777c478bd9Sstevel@tonic-gate# We are done, so move back the config file from temp. location 22787c478bd9Sstevel@tonic-gate# to actual location. 22797c478bd9Sstevel@tonic-gate# In case the config file name has a directory component which does 22807c478bd9Sstevel@tonic-gate# not exist, then create it now, otherwise 'mv' will return error. 22817c478bd9Sstevel@tonic-gate 22827c478bd9Sstevel@tonic-gateDIR_TO_CREATE=`dirname ${_CONFIG_FILE}` 22837c478bd9Sstevel@tonic-gatemkdir -p ${DIR_TO_CREATE} 22847c478bd9Sstevel@tonic-gate 22857c478bd9Sstevel@tonic-gateecho "Moving output from temporary file ($CONFIG_FILE) to actual file ($_CONFIG_FILE)" 22867c478bd9Sstevel@tonic-gatemv $CONFIG_FILE $_CONFIG_FILE 22877c478bd9Sstevel@tonic-gate 22887c478bd9Sstevel@tonic-gate# Revert back the config file name in case needed. 22897c478bd9Sstevel@tonic-gateCONFIG_FILE=$_CONFIG_FILE 22907c478bd9Sstevel@tonic-gateecho "Finished creation of config file ( $_CONFIG_FILE )" 22917c478bd9Sstevel@tonic-gate 22927c478bd9Sstevel@tonic-gate} 22937c478bd9Sstevel@tonic-gate 22947c478bd9Sstevel@tonic-gate 22957c478bd9Sstevel@tonic-gateput_mapping_file_copyright_info() 22967c478bd9Sstevel@tonic-gate{ 22977c478bd9Sstevel@tonic-gate 22987c478bd9Sstevel@tonic-gate# Start with an emptty file, so don't append, but overwrite here. 22997c478bd9Sstevel@tonic-gate# Just change the name and add the word pragma, but keep the same 23007c478bd9Sstevel@tonic-gate# date and version number as in the ident string of this script. 23017c478bd9Sstevel@tonic-gate 23027c478bd9Sstevel@tonic-gategrep "ident \"@(#)$PROG" $ABS_PROG | \ 23037c478bd9Sstevel@tonic-gate sed "s/ ident/pragma ident/g" | \ 23047c478bd9Sstevel@tonic-gate sed "s/${PROG}/${NEW_NAME}/g" > $MAP_FILE 23057c478bd9Sstevel@tonic-gate 23067c478bd9Sstevel@tonic-gateecho "\ 23077c478bd9Sstevel@tonic-gate# 2308*c3e9074dSBen Chang# CDDL HEADER START 2309*c3e9074dSBen Chang# 2310*c3e9074dSBen Chang# The contents of this file are subject to the terms of the 2311*c3e9074dSBen Chang# Common Development and Distribution License (the "License"). 2312*c3e9074dSBen Chang# You may not use this file except in compliance with the License. 2313*c3e9074dSBen Chang# 2314*c3e9074dSBen Chang# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 2315*c3e9074dSBen Chang# or http://www.opensolaris.org/os/licensing. 2316*c3e9074dSBen Chang# See the License for the specific language governing permissions 2317*c3e9074dSBen Chang# and limitations under the License. 2318*c3e9074dSBen Chang# 2319*c3e9074dSBen Chang# When distributing Covered Code, include this CDDL HEADER in each 2320*c3e9074dSBen Chang# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 2321*c3e9074dSBen Chang# If applicable, add the following below this CDDL HEADER, with the 2322*c3e9074dSBen Chang# fields enclosed by brackets "[]" replaced with your own identifying 2323*c3e9074dSBen Chang# information: Portions Copyright [yyyy] [name of copyright owner] 2324*c3e9074dSBen Chang# 2325*c3e9074dSBen Chang# CDDL HEADER END 2326*c3e9074dSBen Chang# 2327*c3e9074dSBen Chang# 2328*c3e9074dSBen Chang# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 23297c478bd9Sstevel@tonic-gate# 23307c478bd9Sstevel@tonic-gate#------------------------------------------------------------------- 23317c478bd9Sstevel@tonic-gate#\ 23327c478bd9Sstevel@tonic-gate" >> $MAP_FILE 23337c478bd9Sstevel@tonic-gate} 23347c478bd9Sstevel@tonic-gate 23357c478bd9Sstevel@tonic-gate 23367c478bd9Sstevel@tonic-gate# 23377c478bd9Sstevel@tonic-gate# Filter out all the YP domains in /var/yp 23387c478bd9Sstevel@tonic-gate# The list of domains is stored in list "VARYP_DMN_LIST" 23397c478bd9Sstevel@tonic-gate# 23407c478bd9Sstevel@tonic-gatecreate_all_var_yp_domain_list() 23417c478bd9Sstevel@tonic-gate{ 23427c478bd9Sstevel@tonic-gateVARYP_DMN_LIST="" 23437c478bd9Sstevel@tonic-gate 23447c478bd9Sstevel@tonic-gatefor entry in /var/yp/* 23457c478bd9Sstevel@tonic-gatedo 23467c478bd9Sstevel@tonic-gate DMN=`basename $entry` 23477c478bd9Sstevel@tonic-gate if [ -d "/var/yp/$DMN" ] && [ -f "/var/yp/binding/$DMN/ypservers" ] 23487c478bd9Sstevel@tonic-gate then 23497c478bd9Sstevel@tonic-gate VARYP_DMN_LIST="$VARYP_DMN_LIST $DMN" 23507c478bd9Sstevel@tonic-gate fi 23517c478bd9Sstevel@tonic-gatedone 23527c478bd9Sstevel@tonic-gate 23537c478bd9Sstevel@tonic-gate# d_echo VARYP_DMN_LIST = "$VARYP_DMN_LIST" 23547c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo VARYP_DMN_LIST = "$VARYP_DMN_LIST" 23557c478bd9Sstevel@tonic-gate} 23567c478bd9Sstevel@tonic-gate 23577c478bd9Sstevel@tonic-gate 23587c478bd9Sstevel@tonic-gate# 23597c478bd9Sstevel@tonic-gate# Ask user which domains would be served by N2L 23607c478bd9Sstevel@tonic-gate# The list of N2L domains is stored in global array 23617c478bd9Sstevel@tonic-gate# "N2L_DMN_LIST" and number of domains in N2L_DMN_CNT 23627c478bd9Sstevel@tonic-gate# 23637c478bd9Sstevel@tonic-gatecreate_n2l_domain_list() 23647c478bd9Sstevel@tonic-gate{ 23657c478bd9Sstevel@tonic-gate# First make a list of all the domains in /var/yp 23667c478bd9Sstevel@tonic-gatecreate_all_var_yp_domain_list 23677c478bd9Sstevel@tonic-gate 23687c478bd9Sstevel@tonic-gate# Now identify those to be served by N2L 23697c478bd9Sstevel@tonic-gatelet count=0 23707c478bd9Sstevel@tonic-gate 23717c478bd9Sstevel@tonic-gatefor DMN in $VARYP_DMN_LIST 23727c478bd9Sstevel@tonic-gatedo 23737c478bd9Sstevel@tonic-gate get_confirm "Do you want to store maps from ${DMN} domain to LDAP (y/n/h):" \ 23747c478bd9Sstevel@tonic-gate "n" "selectDomain4N2L_help" 23757c478bd9Sstevel@tonic-gate 23767c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 23777c478bd9Sstevel@tonic-gate N2L_DMN_LIST[count]=$DMN 23787c478bd9Sstevel@tonic-gate let count="count + 1" 23797c478bd9Sstevel@tonic-gate fi 23807c478bd9Sstevel@tonic-gate 23817c478bd9Sstevel@tonic-gatedone 23827c478bd9Sstevel@tonic-gateN2L_DMN_CNT=$count 23837c478bd9Sstevel@tonic-gate 23847c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo N2L_DMN_LIST=${N2L_DMN_LIST[*]} 23857c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo N2L_DMN_CNT=$N2L_DMN_CNT 23867c478bd9Sstevel@tonic-gate} 23877c478bd9Sstevel@tonic-gate 23887c478bd9Sstevel@tonic-gate 23897c478bd9Sstevel@tonic-gate# 23907c478bd9Sstevel@tonic-gate# Make various lists for different types of maps for each N2L domain 23917c478bd9Sstevel@tonic-gate# and ask user if mapping information and comments need to be generated 23927c478bd9Sstevel@tonic-gate# for custom maps. 23937c478bd9Sstevel@tonic-gate# 23947c478bd9Sstevel@tonic-gate# This function looks big, but since KSH does not support 2-D arrays, or 23957c478bd9Sstevel@tonic-gate# two level of dereferencing, it forced to have so many lists and arrays. 23967c478bd9Sstevel@tonic-gate# Lists are better for adding or removing elements, and arrays are better 23977c478bd9Sstevel@tonic-gate# for accessing with index and in knowing the no. of elements. 23987c478bd9Sstevel@tonic-gate# 23997c478bd9Sstevel@tonic-gatecreate_map_lists() 24007c478bd9Sstevel@tonic-gate{ 24017c478bd9Sstevel@tonic-gate# Initialize them with no maps. 24027c478bd9Sstevel@tonic-gateALL_DMN_ALL_MAPLIST="" 24037c478bd9Sstevel@tonic-gateALL_DMN_DEF_MAPLIST="" 24047c478bd9Sstevel@tonic-gateALL_DMN_CUST_MAPLIST="" 24057c478bd9Sstevel@tonic-gateALL_DMN_AUTO_CUST_MAPLIST="" 24067c478bd9Sstevel@tonic-gate 24077c478bd9Sstevel@tonic-gate# Default to don't generate custom mapping info or comment info. 24087c478bd9Sstevel@tonic-gateCUST_MAP_NEEDED=0 24097c478bd9Sstevel@tonic-gateCUST_CMT_NEEDED=0 24107c478bd9Sstevel@tonic-gate 24117c478bd9Sstevel@tonic-gatelet count=0 24127c478bd9Sstevel@tonic-gate 24137c478bd9Sstevel@tonic-gatewhile (( $count < $N2L_DMN_CNT )) 24147c478bd9Sstevel@tonic-gatedo 24157c478bd9Sstevel@tonic-gate DMN=${N2L_DMN_LIST[count]} 24167c478bd9Sstevel@tonic-gate MAPDIR=/var/yp/${DMN} 24177c478bd9Sstevel@tonic-gate 24187c478bd9Sstevel@tonic-gate # Initialize per domain lists to NULL. 24197c478bd9Sstevel@tonic-gate ALL_MAPLIST="" 24207c478bd9Sstevel@tonic-gate DEF_MAPLIST="" 24217c478bd9Sstevel@tonic-gate CUST_MAPLIST="" 24227c478bd9Sstevel@tonic-gate AUTO_CUST_MAPLIST="" 24237c478bd9Sstevel@tonic-gate 24247c478bd9Sstevel@tonic-gate for dbmfile in $MAPDIR/*.dir 24257c478bd9Sstevel@tonic-gate do 24267c478bd9Sstevel@tonic-gate MAP=`basename $dbmfile .dir` 24277c478bd9Sstevel@tonic-gate 24287c478bd9Sstevel@tonic-gate # Ignore N2L maps (those with "LDAP_" prefix and ageing.byname) 24297c478bd9Sstevel@tonic-gate if [[ $MAP != LDAP_* ]] && [[ $MAP != "" ]] && \ 24307c478bd9Sstevel@tonic-gate [ -f $MAPDIR/${MAP}.pag ] && [[ $MAP != ageing.byname ]] 24317c478bd9Sstevel@tonic-gate then 24327c478bd9Sstevel@tonic-gate ALL_MAPLIST="$ALL_MAPLIST $MAP" 24337c478bd9Sstevel@tonic-gate 24347c478bd9Sstevel@tonic-gate if present $MAP $DEFAULT_NIS_MAPS 24357c478bd9Sstevel@tonic-gate then 24367c478bd9Sstevel@tonic-gate DEF_MAPLIST="$DEF_MAPLIST $MAP" 24377c478bd9Sstevel@tonic-gate 24387c478bd9Sstevel@tonic-gate elif [[ $MAP = auto.* ]] 24397c478bd9Sstevel@tonic-gate then 24407c478bd9Sstevel@tonic-gate AUTO_CUST_MAPLIST="$AUTO_CUST_MAPLIST $MAP" 24417c478bd9Sstevel@tonic-gate 24427c478bd9Sstevel@tonic-gate else 24437c478bd9Sstevel@tonic-gate # If we reached here, means it is custom map. 24447c478bd9Sstevel@tonic-gate get_confirm "Do you want the mapping information to be generated for \"$MAP\" map of $DMN domain (y/n/h)?" \ 24457c478bd9Sstevel@tonic-gate "n" "generate_mapping_info_for_cust_map_help" 24467c478bd9Sstevel@tonic-gate 24477c478bd9Sstevel@tonic-gate if [ $? -eq 1 ] 24487c478bd9Sstevel@tonic-gate then 24497c478bd9Sstevel@tonic-gate CUST_MAPLIST="$CUST_MAPLIST $MAP" 24507c478bd9Sstevel@tonic-gate else 24517c478bd9Sstevel@tonic-gate # If a customer map is not desired, then delete it from 24527c478bd9Sstevel@tonic-gate # all maplist too. 24537c478bd9Sstevel@tonic-gate ALL_MAPLIST=$(remove $MAP $ALL_MAPLIST) 24547c478bd9Sstevel@tonic-gate fi 24557c478bd9Sstevel@tonic-gate 24567c478bd9Sstevel@tonic-gate fi 24577c478bd9Sstevel@tonic-gate 24587c478bd9Sstevel@tonic-gate fi 24597c478bd9Sstevel@tonic-gate 24607c478bd9Sstevel@tonic-gate done 24617c478bd9Sstevel@tonic-gate 24627c478bd9Sstevel@tonic-gate # Make ALL_DMN lists as they are very helpful in checking if a map exists. 24637c478bd9Sstevel@tonic-gate ALL_DMN_ALL_MAPLIST=$(merge_lists $ALL_DMN_ALL_MAPLIST $ALL_MAPLIST) 24647c478bd9Sstevel@tonic-gate ALL_DMN_DEF_MAPLIST=$(merge_lists $ALL_DMN_DEF_MAPLIST $DEF_MAPLIST) 24657c478bd9Sstevel@tonic-gate ALL_DMN_CUST_MAPLIST=$(merge_lists $ALL_DMN_CUST_MAPLIST $CUST_MAPLIST) 24667c478bd9Sstevel@tonic-gate ALL_DMN_AUTO_CUST_MAPLIST=$(merge_lists $ALL_DMN_AUTO_CUST_MAPLIST \ 24677c478bd9Sstevel@tonic-gate $AUTO_CUST_MAPLIST) 24687c478bd9Sstevel@tonic-gate 24697c478bd9Sstevel@tonic-gate # Store per domain lists in arrays. 24707c478bd9Sstevel@tonic-gate ALL_MAPS[$count]="$ALL_MAPLIST" 24717c478bd9Sstevel@tonic-gate DEF_MAPS[$count]="$DEF_MAPLIST" 24727c478bd9Sstevel@tonic-gate CUST_MAPS[$count]="$CUST_MAPLIST" 24737c478bd9Sstevel@tonic-gate AUTO_CUST_MAPS[$count]="$AUTO_CUST_MAPLIST" 24747c478bd9Sstevel@tonic-gate 24757c478bd9Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo ALL_MAPS[$DMN] = ${ALL_MAPS[$count]} 24767c478bd9Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo DEF_MAPS[$DMN] = ${DEF_MAPS[$count]} 24777c478bd9Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo CUST_MAPS[$DMN] = ${CUST_MAPS[$count]} 24787c478bd9Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo AUTO_CUST_MAPS[$DMN] = ${AUTO_CUST_MAPS[$count]} 24797c478bd9Sstevel@tonic-gate 24807c478bd9Sstevel@tonic-gate let count="count + 1" 24817c478bd9Sstevel@tonic-gatedone 24827c478bd9Sstevel@tonic-gate 24837c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo ALL_DMN_ALL_MAPLIST = $ALL_DMN_ALL_MAPLIST 24847c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo ALL_DMN_DEF_MAPLIST = $ALL_DMN_DEF_MAPLIST 24857c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo ALL_DMN_CUST_MAPLIST = $ALL_DMN_CUST_MAPLIST 24867c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo ALL_DMN_AUTO_CUST_MAPLIST = $ALL_DMN_AUTO_CUST_MAPLIST 24877c478bd9Sstevel@tonic-gate 24887c478bd9Sstevel@tonic-gate# Store all domain lists in array too. 24897c478bd9Sstevel@tonic-gateset -A ALL_DMN_ALL_MAPS $ALL_DMN_ALL_MAPLIST 24907c478bd9Sstevel@tonic-gateset -A ALL_DMN_DEF_MAPS $ALL_DMN_DEF_MAPLIST 24917c478bd9Sstevel@tonic-gateset -A ALL_DMN_CUST_MAPS $ALL_DMN_CUST_MAPLIST 24927c478bd9Sstevel@tonic-gateset -A ALL_DMN_AUTO_CUST_MAPS $ALL_DMN_AUTO_CUST_MAPLIST 24937c478bd9Sstevel@tonic-gate 24947c478bd9Sstevel@tonic-gate# A positive customer map count implies custom mapping information 24957c478bd9Sstevel@tonic-gate# is required. Set this flag. 24967c478bd9Sstevel@tonic-gate[ ${#ALL_DMN_CUST_MAPS[*]} -gt 0 ] && CUST_MAP_NEEDED=1 24977c478bd9Sstevel@tonic-gate 24987c478bd9Sstevel@tonic-gate# Give bit of info, and ask if comments need to be placed in mapping file 24997c478bd9Sstevel@tonic-gateecho " 25007c478bd9Sstevel@tonic-gate This script can place relevant information regarding custom 25017c478bd9Sstevel@tonic-gate maps at appropriate places in the mapping file which can be 25027c478bd9Sstevel@tonic-gate helpful in customizing this file. 25037c478bd9Sstevel@tonic-gate" 25047c478bd9Sstevel@tonic-gate 25057c478bd9Sstevel@tonic-gateget_confirm "Do you want such information to be generated (y/n/h)?" \ 25067c478bd9Sstevel@tonic-gate "n" "generate_comment_info_for_cust_map_help" 25077c478bd9Sstevel@tonic-gate 25087c478bd9Sstevel@tonic-gate[ $? -eq 1 ] && CUST_CMT_NEEDED=1 25097c478bd9Sstevel@tonic-gate 25107c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo CUST_MAP_NEEDED = $CUST_MAP_NEEDED 25117c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo CUST_CMT_NEEDED = $CUST_CMT_NEEDED 25127c478bd9Sstevel@tonic-gate 25137c478bd9Sstevel@tonic-gate} 25147c478bd9Sstevel@tonic-gate 25157c478bd9Sstevel@tonic-gate 25167c478bd9Sstevel@tonic-gate# 25177c478bd9Sstevel@tonic-gate# Ask user the context for each (N2l) domain 25187c478bd9Sstevel@tonic-gate# 25197c478bd9Sstevel@tonic-gateget_nisLDAPdomainContext() 25207c478bd9Sstevel@tonic-gate{ 25217c478bd9Sstevel@tonic-gateecho " 25227c478bd9Sstevel@tonic-gate# List domains and contexts 25237c478bd9Sstevel@tonic-gate" >> $MAP_FILE 25247c478bd9Sstevel@tonic-gate 25257c478bd9Sstevel@tonic-gatefor DMN in ${N2L_DMN_LIST[*]} 25267c478bd9Sstevel@tonic-gatedo 25277c478bd9Sstevel@tonic-gate while : 25287c478bd9Sstevel@tonic-gate do 25297c478bd9Sstevel@tonic-gate # Convert to domain in dc format for default choice 25307c478bd9Sstevel@tonic-gate domain_2_dc $DMN 25317c478bd9Sstevel@tonic-gate 25327c478bd9Sstevel@tonic-gate get_ans "Enter the naming context for $DMN domain (h=help):"\ 25337c478bd9Sstevel@tonic-gate "$_DOM_2_DC" 25347c478bd9Sstevel@tonic-gate 25357c478bd9Sstevel@tonic-gate # If help continue, otherwise break. 25367c478bd9Sstevel@tonic-gate case "$ANS" in 25377c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg nisLDAPdomainContext_help ;; 25387c478bd9Sstevel@tonic-gate * ) break ;; 25397c478bd9Sstevel@tonic-gate esac 25407c478bd9Sstevel@tonic-gate done 25417c478bd9Sstevel@tonic-gate 25427c478bd9Sstevel@tonic-gate # If a value is specified, set it, and save in mapping file too. 25437c478bd9Sstevel@tonic-gate if [ "$ANS" != "" ]; then 25447c478bd9Sstevel@tonic-gate echo "nisLDAPdomainContext $DMN : ${ANS}" >> $MAP_FILE 25457c478bd9Sstevel@tonic-gate fi 25467c478bd9Sstevel@tonic-gate 25477c478bd9Sstevel@tonic-gate [ $DEBUG -eq 1 ] && echo "nisLDAPdomainContext $DMN : ${ANS}" 25487c478bd9Sstevel@tonic-gatedone 25497c478bd9Sstevel@tonic-gate} 25507c478bd9Sstevel@tonic-gate 25517c478bd9Sstevel@tonic-gate 25527c478bd9Sstevel@tonic-gate# 25537c478bd9Sstevel@tonic-gate# Ask user the domains for which passwords should be changed 25547c478bd9Sstevel@tonic-gate# 25557c478bd9Sstevel@tonic-gateget_nisLDAPyppasswddDomains() 25567c478bd9Sstevel@tonic-gate{ 25577c478bd9Sstevel@tonic-gate 25587c478bd9Sstevel@tonic-gateecho " 25597c478bd9Sstevel@tonic-gate# List domains for which passwords should be changed. If this is not 25607c478bd9Sstevel@tonic-gate# present then the value returned by 'domainname' will be used. 25617c478bd9Sstevel@tonic-gate" >> $MAP_FILE 25627c478bd9Sstevel@tonic-gate 25637c478bd9Sstevel@tonic-gatefor DMN in ${N2L_DMN_LIST[*]} 25647c478bd9Sstevel@tonic-gatedo 25657c478bd9Sstevel@tonic-gate get_confirm "Enable password changes for ${DMN} domain (y/n/h)? " \ 25667c478bd9Sstevel@tonic-gate "n" "nisLDAPyppasswddDomains_help" 25677c478bd9Sstevel@tonic-gate 25687c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 25697c478bd9Sstevel@tonic-gate echo "nisLDAPyppasswddDomains $DMN" >> $MAP_FILE 25707c478bd9Sstevel@tonic-gate fi 25717c478bd9Sstevel@tonic-gatedone 25727c478bd9Sstevel@tonic-gate 25737c478bd9Sstevel@tonic-gateecho " 25747c478bd9Sstevel@tonic-gate# 25757c478bd9Sstevel@tonic-gate#------------------------------------------------------------------- 25767c478bd9Sstevel@tonic-gate#\ 25777c478bd9Sstevel@tonic-gate" >> $MAP_FILE 25787c478bd9Sstevel@tonic-gate} 25797c478bd9Sstevel@tonic-gate 25807c478bd9Sstevel@tonic-gate 25817c478bd9Sstevel@tonic-gate# 25827c478bd9Sstevel@tonic-gate# Create NIS databaseId mappings (aliases) 25837c478bd9Sstevel@tonic-gate# 25847c478bd9Sstevel@tonic-gatecreate_nisLDAPdatabaseIdMapping() 25857c478bd9Sstevel@tonic-gate{ 25867c478bd9Sstevel@tonic-gateecho ' 25877c478bd9Sstevel@tonic-gate# Associate map names with databaseIds (aliases) 25887c478bd9Sstevel@tonic-gate 25897c478bd9Sstevel@tonic-gate# Standard maps 25907c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping ethers: ethers.byaddr ethers.byname 25917c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping group: group.bygid group.byname 25927c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping hosts:[addr="[0-9]*.[0-9]*.[0-9]*.[0-9]*"] \ 25937c478bd9Sstevel@tonic-gate hosts.byaddr hosts.byname 25947c478bd9Sstevel@tonic-gate# Special mapping to handle the YP_MULTI cases 25957c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping multihosts: \ 25967c478bd9Sstevel@tonic-gate [addr="[0-9]*.[0-9]*.[0-9]*.[0-9]*,*"] \ 25977c478bd9Sstevel@tonic-gate hosts.byname 25987c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping networks: networks.byaddr networks.byname 25997c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping project: project.byname project.byprojid 26007c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping protocols: protocols.byname protocols.bynumber 26017c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping services: services.byname services.byservicename 26027c478bd9Sstevel@tonic-gate 26037c478bd9Sstevel@tonic-gate# netid.byname is built up from the hosts and passwd files using different 26047c478bd9Sstevel@tonic-gate# mappings. It thus has two associated nisLDAPdatabaseIdMappings. 26057c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping netid.host:[number="0"] netid.byname 26067c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping netid.pass:[number="[1-9]*"] netid.byname 26077c478bd9Sstevel@tonic-gate 26087c478bd9Sstevel@tonic-gate# The next two are special databaseIds. They associate maps with databaseIds 26097c478bd9Sstevel@tonic-gate# but additionally identify which maps contain password and password adjunct 26107c478bd9Sstevel@tonic-gate# information for yppasswdd. 26117c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping passwd: passwd.byname passwd.byuid 26127c478bd9Sstevel@tonic-gate 26137c478bd9Sstevel@tonic-gate# mail.byaddr needs to select entries of the form x@y or x!y 26147c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping mail.mapping:[rf_key="*@*", rf_key="*!*"] \ 26157c478bd9Sstevel@tonic-gate mail.byaddr 26167c478bd9Sstevel@tonic-gate 26177c478bd9Sstevel@tonic-gate# publickey.byname 26187c478bd9Sstevel@tonic-gate# Each entry in publickey map consists of a network user name which 26197c478bd9Sstevel@tonic-gate# may refer to a host or a user. It also contains a default entry for nobody. 26207c478bd9Sstevel@tonic-gate# Hence, we need three nisLDAPdatabaseIdmappings to support the three 26217c478bd9Sstevel@tonic-gate# different types of keys. 26227c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping keys.host:[rf_key="unix.[a-zA-Z]*@*"] \ 26237c478bd9Sstevel@tonic-gate publickey.byname 26247c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping keys.pass:[rf_key="unix.[0-9]*@*"] \ 26257c478bd9Sstevel@tonic-gate publickey.byname 26267c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping keys.nobody:[rf_key="nobody"] publickey.byname 26277c478bd9Sstevel@tonic-gate 26287c478bd9Sstevel@tonic-gate# Single standard maps. No point aliasing. 26297c478bd9Sstevel@tonic-gate# mail.aliases 26307c478bd9Sstevel@tonic-gate# netmasks.byaddr 26317c478bd9Sstevel@tonic-gate# rpc.bynumber 26327c478bd9Sstevel@tonic-gate# ypservers 26337c478bd9Sstevel@tonic-gate 26347c478bd9Sstevel@tonic-gate# Other maps 26357c478bd9Sstevel@tonic-gate# ipnodes looks identical to hosts but maps to a different context. 26367c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping ipnodes:[addr="*:*"] \ 26377c478bd9Sstevel@tonic-gate ipnodes.byaddr ipnodes.byname 26387c478bd9Sstevel@tonic-gate# Special mapping to handle the YP_MULTI cases 26397c478bd9Sstevel@tonic-gatenisLDAPdatabaseIdMapping multiipnodes: \ 26407c478bd9Sstevel@tonic-gate [addr="*:*,*"] \ 26417c478bd9Sstevel@tonic-gate ipnodes.byname 26427c478bd9Sstevel@tonic-gate 26437c478bd9Sstevel@tonic-gate# Other single maps. No point aliasing 26447c478bd9Sstevel@tonic-gate# audit_user 26457c478bd9Sstevel@tonic-gate# auth_attr 26467c478bd9Sstevel@tonic-gate# exec_attr 26477c478bd9Sstevel@tonic-gate# prof_attr 26487c478bd9Sstevel@tonic-gate# user_attr 26497c478bd9Sstevel@tonic-gate# auto.home 26507c478bd9Sstevel@tonic-gate# auto.master 26517c478bd9Sstevel@tonic-gate# bootparams 26527c478bd9Sstevel@tonic-gate# timezone.byname 26537c478bd9Sstevel@tonic-gate# printers.conf.byname 26547c478bd9Sstevel@tonic-gate# passwd.adjunct.byname 26557c478bd9Sstevel@tonic-gate# group.adjunct.byname 26567c478bd9Sstevel@tonic-gate' >> $MAP_FILE 26577c478bd9Sstevel@tonic-gate 26587c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && \ 26597c478bd9Sstevel@tonic-gateecho " 26607c478bd9Sstevel@tonic-gate# If any custom map needs to be aliased, then it should be listed 26617c478bd9Sstevel@tonic-gate# here in the following format : 26627c478bd9Sstevel@tonic-gate# nisLDAPdatabaseIdMapping databaseId ":" ["["indexlist"]"] mapname[" "...] 26637c478bd9Sstevel@tonic-gate" >> $MAP_FILE 26647c478bd9Sstevel@tonic-gate 26657c478bd9Sstevel@tonic-gate[ CUST_MAP_NEEDED -eq 1 ] && \ 26667c478bd9Sstevel@tonic-gateecho "\ 26677c478bd9Sstevel@tonic-gate# Not aliasing non-default/custom maps as they are assumed to be 26687c478bd9Sstevel@tonic-gate# simple, single maps.\ 26697c478bd9Sstevel@tonic-gate" >> $MAP_FILE 26707c478bd9Sstevel@tonic-gate 26717c478bd9Sstevel@tonic-gatefor MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} ${ALL_DMN_CUST_MAPS[*]} 26727c478bd9Sstevel@tonic-gatedo 26737c478bd9Sstevel@tonic-gate echo "# $MAP" >> $MAP_FILE 26747c478bd9Sstevel@tonic-gatedone 26757c478bd9Sstevel@tonic-gate 26767c478bd9Sstevel@tonic-gateecho "\ 26777c478bd9Sstevel@tonic-gate# 26787c478bd9Sstevel@tonic-gate#------------------------------------------------------------------------------ 26797c478bd9Sstevel@tonic-gate# 26807c478bd9Sstevel@tonic-gate" >> $MAP_FILE 26817c478bd9Sstevel@tonic-gate} 26827c478bd9Sstevel@tonic-gate 26837c478bd9Sstevel@tonic-gate 26847c478bd9Sstevel@tonic-gate# 26857c478bd9Sstevel@tonic-gate# Finds the domains in which the given map exists in the supplied list. 26867c478bd9Sstevel@tonic-gate# Sets result in PRESENT_COUNT and PRESENT_IN_DOMAINS. These fields are 26877c478bd9Sstevel@tonic-gate# set globally, so they can be accessed from any where. 26887c478bd9Sstevel@tonic-gate# Input : $1 - map, $2 - list name (just name, not the value) 26897c478bd9Sstevel@tonic-gate# 26907c478bd9Sstevel@tonic-gatefind_domains() 26917c478bd9Sstevel@tonic-gate{ 26927c478bd9Sstevel@tonic-gate_MAP=$1 26937c478bd9Sstevel@tonic-gate_ARRAY=$2 26947c478bd9Sstevel@tonic-gate 26957c478bd9Sstevel@tonic-gatelet PRESENT_COUNT=0 26967c478bd9Sstevel@tonic-gatePRESENT_IN_DOMAINS="" 26977c478bd9Sstevel@tonic-gate 26987c478bd9Sstevel@tonic-gatelet count=0 26997c478bd9Sstevel@tonic-gate 27007c478bd9Sstevel@tonic-gatewhile (( $count < $N2L_DMN_CNT )) 27017c478bd9Sstevel@tonic-gatedo 27027c478bd9Sstevel@tonic-gate 27037c478bd9Sstevel@tonic-gate # Quick and dirty way to get around unavailability of 2D array 27047c478bd9Sstevel@tonic-gate case "$_ARRAY" in 27057c478bd9Sstevel@tonic-gate ALL_MAPS ) _LIST=${ALL_MAPS[$count]} ;; 27067c478bd9Sstevel@tonic-gate DEF_MAPS ) _LIST=${DEF_MAPS[$count]} ;; 27077c478bd9Sstevel@tonic-gate CUST_MAPS ) _LIST=${CUST_MAPS[$count]} ;; 27087c478bd9Sstevel@tonic-gate AUTO_CUST_MAPS ) _LIST=${AUTO_CUST_MAPS[$count]} ;; 27097c478bd9Sstevel@tonic-gate * ) echo "Invalid value: \"${_ARRAY}\". \c" 27107c478bd9Sstevel@tonic-gate ;; 27117c478bd9Sstevel@tonic-gate esac 27127c478bd9Sstevel@tonic-gate 27137c478bd9Sstevel@tonic-gate if present $_MAP $_LIST 27147c478bd9Sstevel@tonic-gate then 27157c478bd9Sstevel@tonic-gate let PRESENT_COUNT="$PRESENT_COUNT + 1" 27167c478bd9Sstevel@tonic-gate PRESENT_IN_DOMAINS="$PRESENT_IN_DOMAINS ${N2L_DMN_LIST[count]}" 27177c478bd9Sstevel@tonic-gate fi 27187c478bd9Sstevel@tonic-gate let count="count + 1" 27197c478bd9Sstevel@tonic-gatedone 27207c478bd9Sstevel@tonic-gate 27217c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo "PRESENT_COUNT = $PRESENT_COUNT" 27227c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo "PRESENT_IN_DOMAINS = $PRESENT_IN_DOMAINS" 27237c478bd9Sstevel@tonic-gate 27247c478bd9Sstevel@tonic-gatereturn 0 27257c478bd9Sstevel@tonic-gate} 27267c478bd9Sstevel@tonic-gate 27277c478bd9Sstevel@tonic-gate 27287c478bd9Sstevel@tonic-gate# 27297c478bd9Sstevel@tonic-gate# For a given map, find out which list it belongs to (PRESENT_IN_LIST), 27307c478bd9Sstevel@tonic-gate# and in how many domains this map shows up (PRESENT_COUNT), and in 27317c478bd9Sstevel@tonic-gate# which ones (PRESENT_IN_DOMAINS). These fields are set globally, so 27327c478bd9Sstevel@tonic-gate# they can be accessed from any where. 27337c478bd9Sstevel@tonic-gate# 27347c478bd9Sstevel@tonic-gatefind_map_presence_details() 27357c478bd9Sstevel@tonic-gate{ 27367c478bd9Sstevel@tonic-gate_MAP=$1 27377c478bd9Sstevel@tonic-gate 27387c478bd9Sstevel@tonic-gatelet PRESENT_COUNT=0 27397c478bd9Sstevel@tonic-gatePRESENT_IN_LIST="" 27407c478bd9Sstevel@tonic-gatePRESENT_IN_DOMAINS="" 27417c478bd9Sstevel@tonic-gate 27427c478bd9Sstevel@tonic-gate# If the map does not exist, return right away, else 27437c478bd9Sstevel@tonic-gate# find which list it belongs to. 27447c478bd9Sstevel@tonic-gate# If a map exists in def or auto or cust lists, then 27457c478bd9Sstevel@tonic-gate# it also exists in "all" list. 27467c478bd9Sstevel@tonic-gate 27477c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_ALL_MAPLIST 27487c478bd9Sstevel@tonic-gatethen 27497c478bd9Sstevel@tonic-gate return 1 27507c478bd9Sstevel@tonic-gate 27517c478bd9Sstevel@tonic-gateelif present $_MAP $ALL_DMN_DEF_MAPLIST 27527c478bd9Sstevel@tonic-gatethen 27537c478bd9Sstevel@tonic-gate PRESENT_IN_LIST="DEF_MAPS" 27547c478bd9Sstevel@tonic-gate 27557c478bd9Sstevel@tonic-gateelif present $_MAP $ALL_DMN_CUST_MAPLIST 27567c478bd9Sstevel@tonic-gatethen 27577c478bd9Sstevel@tonic-gate PRESENT_IN_LIST="CUST_MAPS" 27587c478bd9Sstevel@tonic-gate 27597c478bd9Sstevel@tonic-gateelse 27607c478bd9Sstevel@tonic-gate # If map exists, and not in previous two lists, 27617c478bd9Sstevel@tonic-gate # then it has to be here only. 27627c478bd9Sstevel@tonic-gate PRESENT_IN_LIST="AUTO_CUST_MAPS" 27637c478bd9Sstevel@tonic-gatefi 27647c478bd9Sstevel@tonic-gate 27657c478bd9Sstevel@tonic-gate# Now we know which list the map belongs to. So, we need to 27667c478bd9Sstevel@tonic-gate# find which are the domains in which this map exists. 27677c478bd9Sstevel@tonic-gate 27687c478bd9Sstevel@tonic-gatefind_domains $_MAP $PRESENT_IN_LIST 27697c478bd9Sstevel@tonic-gate 27707c478bd9Sstevel@tonic-gate# Since the above function sets the values of PRESENT_COUNT and 27717c478bd9Sstevel@tonic-gate# PRESENT_IN_DOMAINS fields, we don't need to do anything else. 27727c478bd9Sstevel@tonic-gate 27737c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && echo "PRESENT_IN_LIST = $PRESENT_IN_LIST" 27747c478bd9Sstevel@tonic-gate 27757c478bd9Sstevel@tonic-gatereturn 0 27767c478bd9Sstevel@tonic-gate} 27777c478bd9Sstevel@tonic-gate 27787c478bd9Sstevel@tonic-gate 27797c478bd9Sstevel@tonic-gate# 27807c478bd9Sstevel@tonic-gate# Check if the comment char is a single character, return 0 on success. 27817c478bd9Sstevel@tonic-gate# Input is passed via global variable "COMMENT_CHAR" 27827c478bd9Sstevel@tonic-gate# 27837c478bd9Sstevel@tonic-gatevalid_comment_char() 27847c478bd9Sstevel@tonic-gate{ 27857c478bd9Sstevel@tonic-gateCOMMENT_CHAR_LENGTH=`echo "${COMMENT_CHAR}" | wc -c` 27867c478bd9Sstevel@tonic-gate 27877c478bd9Sstevel@tonic-gate# echo adds new line character, so adjust length appropriately 27887c478bd9Sstevel@tonic-gateif [ $COMMENT_CHAR_LENGTH -gt 2 ]; then 27897c478bd9Sstevel@tonic-gate echo " Comment character has to be a blank or single character; try again." 27907c478bd9Sstevel@tonic-gate return 1 27917c478bd9Sstevel@tonic-gateelse 27927c478bd9Sstevel@tonic-gate return 0 27937c478bd9Sstevel@tonic-gatefi 27947c478bd9Sstevel@tonic-gate} 27957c478bd9Sstevel@tonic-gate 27967c478bd9Sstevel@tonic-gate 27977c478bd9Sstevel@tonic-gate# 27987c478bd9Sstevel@tonic-gate# Read the comment character for a MAP. Append in mapping file if valid. 27997c478bd9Sstevel@tonic-gate# Input - $1 : MAP name 28007c478bd9Sstevel@tonic-gate# 28017c478bd9Sstevel@tonic-gateget_comment_char() 28027c478bd9Sstevel@tonic-gate{ 28037c478bd9Sstevel@tonic-gate_MAP=$1 28047c478bd9Sstevel@tonic-gate 28057c478bd9Sstevel@tonic-gatewhile : 28067c478bd9Sstevel@tonic-gatedo 28077c478bd9Sstevel@tonic-gate get_ans "Specify the comment character for $_MAP :" 28087c478bd9Sstevel@tonic-gate COMMENT_CHAR=$ANS 28097c478bd9Sstevel@tonic-gate 28107c478bd9Sstevel@tonic-gate if valid_comment_char; then 28117c478bd9Sstevel@tonic-gate break 28127c478bd9Sstevel@tonic-gate fi 28137c478bd9Sstevel@tonic-gatedone 28147c478bd9Sstevel@tonic-gate 28157c478bd9Sstevel@tonic-gateecho "nisLDAPcommentChar $_MAP : '${COMMENT_CHAR}'" >> $MAP_FILE 28167c478bd9Sstevel@tonic-gate} 28177c478bd9Sstevel@tonic-gate 28187c478bd9Sstevel@tonic-gate 28197c478bd9Sstevel@tonic-gate# 28207c478bd9Sstevel@tonic-gate# Read a seperate comment character for a MAP for each domain and 28217c478bd9Sstevel@tonic-gate# update this information in mapping file. 28227c478bd9Sstevel@tonic-gate# Input - $1 : MAP name, $@ : list of domains 28237c478bd9Sstevel@tonic-gate# 28247c478bd9Sstevel@tonic-gateget_comment_char_per_domain() 28257c478bd9Sstevel@tonic-gate{ 28267c478bd9Sstevel@tonic-gate_MAP=$1 28277c478bd9Sstevel@tonic-gateshift 28287c478bd9Sstevel@tonic-gate_DOMAIN_LIST="$@" 28297c478bd9Sstevel@tonic-gate 28307c478bd9Sstevel@tonic-gatefor _DMN in $_DOMAIN_LIST 28317c478bd9Sstevel@tonic-gatedo 28327c478bd9Sstevel@tonic-gate 28337c478bd9Sstevel@tonic-gate while : 28347c478bd9Sstevel@tonic-gate do 28357c478bd9Sstevel@tonic-gate 28367c478bd9Sstevel@tonic-gate get_ans "Specify the comment character for $_MAP,${_DMN} :" 28377c478bd9Sstevel@tonic-gate COMMENT_CHAR=$ANS 28387c478bd9Sstevel@tonic-gate 28397c478bd9Sstevel@tonic-gate if valid_comment_char; then 28407c478bd9Sstevel@tonic-gate break 28417c478bd9Sstevel@tonic-gate fi 28427c478bd9Sstevel@tonic-gate 28437c478bd9Sstevel@tonic-gate done 28447c478bd9Sstevel@tonic-gate echo "nisLDAPcommentChar $_MAP,${_DMN} : '${COMMENT_CHAR}'" >> $MAP_FILE 28457c478bd9Sstevel@tonic-gate 28467c478bd9Sstevel@tonic-gatedone 28477c478bd9Sstevel@tonic-gate} 28487c478bd9Sstevel@tonic-gate 28497c478bd9Sstevel@tonic-gate 28507c478bd9Sstevel@tonic-gate# 28517c478bd9Sstevel@tonic-gate# This function generates custom comment entries. The output is 28527c478bd9Sstevel@tonic-gate# appended in the mapping file. 28537c478bd9Sstevel@tonic-gate# 28547c478bd9Sstevel@tonic-gateget_custom_nisLDAPcommentChar() 28557c478bd9Sstevel@tonic-gate{ 28567c478bd9Sstevel@tonic-gate 28577c478bd9Sstevel@tonic-gate# All the auto mounter maps are assumed to have '#' as the default comment 28587c478bd9Sstevel@tonic-gate# char. But still list the non-default auto map entries here anyway. This 28597c478bd9Sstevel@tonic-gate# will make it very easy in case these entries need to be changed. 28607c478bd9Sstevel@tonic-gate 28617c478bd9Sstevel@tonic-gatefor MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} 28627c478bd9Sstevel@tonic-gatedo 28637c478bd9Sstevel@tonic-gate echo "nisLDAPcommentChar $MAP : '#'" >> $MAP_FILE 28647c478bd9Sstevel@tonic-gatedone 28657c478bd9Sstevel@tonic-gate 28667c478bd9Sstevel@tonic-gateif [ CUST_MAP_NEEDED -eq 1 ]; then 28677c478bd9Sstevel@tonic-gate get_confirm "Do you wish to specify the comment character for any custom map (y/n/h)?" \ 28687c478bd9Sstevel@tonic-gate "n" "custom_map_comment_char_help" 28697c478bd9Sstevel@tonic-gate 28707c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 28717c478bd9Sstevel@tonic-gate for MAP in ${ALL_DMN_CUST_MAPS[*]} 28727c478bd9Sstevel@tonic-gate do 28737c478bd9Sstevel@tonic-gate 28747c478bd9Sstevel@tonic-gate get_confirm "Do you wish to specify comment character for \"$MAP\" (y/n/h)?" \ 28757c478bd9Sstevel@tonic-gate "n" "custom_map_comment_char_help" 28767c478bd9Sstevel@tonic-gate 28777c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 28787c478bd9Sstevel@tonic-gate find_domains $MAP CUST_MAPS 28797c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -gt 1 ]; then 28807c478bd9Sstevel@tonic-gate echo "Map \"$MAP\" is present in these domains : $PRESENT_IN_DOMAINS" 28817c478bd9Sstevel@tonic-gate 28827c478bd9Sstevel@tonic-gate get_confirm "For \"$MAP\", should the same comment character be set for all the domains (y/n/h)?" \ 28837c478bd9Sstevel@tonic-gate "y" "same_comment_char_help" 28847c478bd9Sstevel@tonic-gate 28857c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 28867c478bd9Sstevel@tonic-gate get_comment_char $MAP 28877c478bd9Sstevel@tonic-gate else 28887c478bd9Sstevel@tonic-gate get_comment_char_per_domain $MAP "$PRESENT_IN_DOMAINS" 28897c478bd9Sstevel@tonic-gate fi 28907c478bd9Sstevel@tonic-gate 28917c478bd9Sstevel@tonic-gate else 28927c478bd9Sstevel@tonic-gate get_comment_char $MAP 28937c478bd9Sstevel@tonic-gate fi 28947c478bd9Sstevel@tonic-gate 28957c478bd9Sstevel@tonic-gate fi 28967c478bd9Sstevel@tonic-gate done 28977c478bd9Sstevel@tonic-gate fi 28987c478bd9Sstevel@tonic-gatefi 28997c478bd9Sstevel@tonic-gate 29007c478bd9Sstevel@tonic-gate} 29017c478bd9Sstevel@tonic-gate 29027c478bd9Sstevel@tonic-gate 29037c478bd9Sstevel@tonic-gate# List comment character (if any) for maps 29047c478bd9Sstevel@tonic-gatecreate_nisLDAPcommentChar() 29057c478bd9Sstevel@tonic-gate{ 29067c478bd9Sstevel@tonic-gate 29077c478bd9Sstevel@tonic-gateecho "\ 29087c478bd9Sstevel@tonic-gate# Specify the character representing the start of comments. 29097c478bd9Sstevel@tonic-gate" >> $MAP_FILE 29107c478bd9Sstevel@tonic-gate 29117c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo "\ 29127c478bd9Sstevel@tonic-gate# The comment character represents the start of the special 'comment' 29137c478bd9Sstevel@tonic-gate# field in a given NIS map. If this attribute is not present then the 29147c478bd9Sstevel@tonic-gate# default comment character '#' is used. If a map cannot contain comments 29157c478bd9Sstevel@tonic-gate# then the NULL ('') comment character should be specified. The format to 29167c478bd9Sstevel@tonic-gate# specify the comment character is : 29177c478bd9Sstevel@tonic-gate# nisLDAPcommentChar MAP[,DOMAIN] : 'single_comment_char' 29187c478bd9Sstevel@tonic-gate" >> $MAP_FILE 29197c478bd9Sstevel@tonic-gate 29207c478bd9Sstevel@tonic-gateecho "\ 29217c478bd9Sstevel@tonic-gatenisLDAPcommentChar group : '' 29227c478bd9Sstevel@tonic-gatenisLDAPcommentChar passwd : '' 29237c478bd9Sstevel@tonic-gatenisLDAPcommentChar ageing.byname : '' 29247c478bd9Sstevel@tonic-gatenisLDAPcommentChar audit_user : '' 29257c478bd9Sstevel@tonic-gatenisLDAPcommentChar auth_attr : '' 29267c478bd9Sstevel@tonic-gatenisLDAPcommentChar exec_attr : '' 29277c478bd9Sstevel@tonic-gatenisLDAPcommentChar user_attr : '' 29287c478bd9Sstevel@tonic-gatenisLDAPcommentChar bootparams : '' 29297c478bd9Sstevel@tonic-gate" >> $MAP_FILE 29307c478bd9Sstevel@tonic-gate 29317c478bd9Sstevel@tonic-gate# Need to handle passwd.adjunct.byname map for multiple domain. 29327c478bd9Sstevel@tonic-gate_MAP=passwd.adjunct.byname 29337c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 29347c478bd9Sstevel@tonic-gatethen 29357c478bd9Sstevel@tonic-gate # Just put the syntax in comment form 29367c478bd9Sstevel@tonic-gate echo "#nisLDAPcommentChar passwd.adjunct.byname: ''" >> $MAP_FILE 29377c478bd9Sstevel@tonic-gateelse 29387c478bd9Sstevel@tonic-gate # Find the domains in which this map exists. 29397c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 29407c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 29417c478bd9Sstevel@tonic-gate then 29427c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 29437c478bd9Sstevel@tonic-gate echo "nisLDAPcommentChar passwd.adjunct.byname: ''" >> $MAP_FILE 29447c478bd9Sstevel@tonic-gate else 29457c478bd9Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 29467c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 29477c478bd9Sstevel@tonic-gate do 29487c478bd9Sstevel@tonic-gate echo "nisLDAPcommentChar passwd.adjunct.byname,${_DMN}: ''" >> $MAP_FILE 29497c478bd9Sstevel@tonic-gate done 29507c478bd9Sstevel@tonic-gate fi 29517c478bd9Sstevel@tonic-gatefi 29527c478bd9Sstevel@tonic-gate# passwd.adjunct.byname done 29537c478bd9Sstevel@tonic-gate 29547c478bd9Sstevel@tonic-gate 29557c478bd9Sstevel@tonic-gate# Need to handle group.adjunct.byname map for multiple domain. 29567c478bd9Sstevel@tonic-gate_MAP=group.adjunct.byname 29577c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 29587c478bd9Sstevel@tonic-gatethen 29597c478bd9Sstevel@tonic-gate # Just put the syntax in comment form 29607c478bd9Sstevel@tonic-gate echo "#nisLDAPcommentChar group.adjunct.byname: ''" >> $MAP_FILE 29617c478bd9Sstevel@tonic-gateelse 29627c478bd9Sstevel@tonic-gate # Find the domains in which this map exists. 29637c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 29647c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 29657c478bd9Sstevel@tonic-gate then 29667c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 29677c478bd9Sstevel@tonic-gate echo "nisLDAPcommentChar group.adjunct.byname: ''" >> $MAP_FILE 29687c478bd9Sstevel@tonic-gate else 29697c478bd9Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 29707c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 29717c478bd9Sstevel@tonic-gate do 29727c478bd9Sstevel@tonic-gate echo "nisLDAPcommentChar group.adjunct.byname,${_DMN}: ''" >> $MAP_FILE 29737c478bd9Sstevel@tonic-gate done 29747c478bd9Sstevel@tonic-gate fi 29757c478bd9Sstevel@tonic-gatefi 29767c478bd9Sstevel@tonic-gate# group.adjunct.byname done 29777c478bd9Sstevel@tonic-gate 29787c478bd9Sstevel@tonic-gateecho "" >> $MAP_FILE 29797c478bd9Sstevel@tonic-gate 29807c478bd9Sstevel@tonic-gate# Ask user for comment char for custom maps 29817c478bd9Sstevel@tonic-gateget_custom_nisLDAPcommentChar 29827c478bd9Sstevel@tonic-gate 29837c478bd9Sstevel@tonic-gateecho " 29847c478bd9Sstevel@tonic-gate# 29857c478bd9Sstevel@tonic-gate#------------------------------------------------------------------------------ 29867c478bd9Sstevel@tonic-gate# 29877c478bd9Sstevel@tonic-gate" >> $MAP_FILE 29887c478bd9Sstevel@tonic-gate} 29897c478bd9Sstevel@tonic-gate 29907c478bd9Sstevel@tonic-gate 29917c478bd9Sstevel@tonic-gate# 29927c478bd9Sstevel@tonic-gate# Generate secure flag entries 29937c478bd9Sstevel@tonic-gate# 29947c478bd9Sstevel@tonic-gatecreate_secure_flag_entries() 29957c478bd9Sstevel@tonic-gate{ 29967c478bd9Sstevel@tonic-gateecho "\ 29977c478bd9Sstevel@tonic-gate# Specify YP_SECURE flags 29987c478bd9Sstevel@tonic-gate" >> $MAP_FILE 29997c478bd9Sstevel@tonic-gate 30007c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo "\ 30017c478bd9Sstevel@tonic-gate# If a map is secure, then it needs to be mentioned here 30027c478bd9Sstevel@tonic-gate# in the following format : 30037c478bd9Sstevel@tonic-gate# nisLDAPmapFlags mapname : s 30047c478bd9Sstevel@tonic-gate">> $MAP_FILE 30057c478bd9Sstevel@tonic-gate 30067c478bd9Sstevel@tonic-gate# Need to handle passwd.adjunct.byname map for multiple domain. 30077c478bd9Sstevel@tonic-gate_MAP=passwd.adjunct.byname 30087c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 30097c478bd9Sstevel@tonic-gatethen 30107c478bd9Sstevel@tonic-gate # Just put the syntax in comment form 30117c478bd9Sstevel@tonic-gate echo "#nisLDAPmapFlags passwd.adjunct.byname : s" >> $MAP_FILE 30127c478bd9Sstevel@tonic-gateelse 30137c478bd9Sstevel@tonic-gate # Find the domains in which this map exists. 30147c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 30157c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 30167c478bd9Sstevel@tonic-gate then 30177c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 30187c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags passwd.adjunct.byname : s" >> $MAP_FILE 30197c478bd9Sstevel@tonic-gate else 30207c478bd9Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 30217c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 30227c478bd9Sstevel@tonic-gate do 30237c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags passwd.adjunct.byname,${_DMN} : s" >> $MAP_FILE 30247c478bd9Sstevel@tonic-gate done 30257c478bd9Sstevel@tonic-gate fi 30267c478bd9Sstevel@tonic-gatefi 30277c478bd9Sstevel@tonic-gate 30287c478bd9Sstevel@tonic-gate# Need to handle group.adjunct.byname map for multiple domain. 30297c478bd9Sstevel@tonic-gate_MAP=group.adjunct.byname 30307c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 30317c478bd9Sstevel@tonic-gatethen 30327c478bd9Sstevel@tonic-gate # Just put the syntax in comment form 30337c478bd9Sstevel@tonic-gate echo "#nisLDAPmapFlags group.adjunct.byname : s" >> $MAP_FILE 30347c478bd9Sstevel@tonic-gateelse 30357c478bd9Sstevel@tonic-gate # Find the domains in which this map exists. 30367c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 30377c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 30387c478bd9Sstevel@tonic-gate then 30397c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 30407c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags group.adjunct.byname : s" >> $MAP_FILE 30417c478bd9Sstevel@tonic-gate else 30427c478bd9Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 30437c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 30447c478bd9Sstevel@tonic-gate do 30457c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags group.adjunct.byname,${_DMN} : s" >> $MAP_FILE 30467c478bd9Sstevel@tonic-gate done 30477c478bd9Sstevel@tonic-gate fi 30487c478bd9Sstevel@tonic-gatefi 30497c478bd9Sstevel@tonic-gate 30507c478bd9Sstevel@tonic-gateecho "" >> $MAP_FILE 30517c478bd9Sstevel@tonic-gate 30527c478bd9Sstevel@tonic-gateSTR="any" # Just to make the question look better. 30537c478bd9Sstevel@tonic-gatewhile : 30547c478bd9Sstevel@tonic-gatedo 30557c478bd9Sstevel@tonic-gate get_confirm "Do you wish to set the secure flag for $STR map (y/n/h)?" \ 30567c478bd9Sstevel@tonic-gate "n" "secure_flag_on_help" 30577c478bd9Sstevel@tonic-gate 30587c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 30597c478bd9Sstevel@tonic-gate return 0 30607c478bd9Sstevel@tonic-gate 30617c478bd9Sstevel@tonic-gate else 30627c478bd9Sstevel@tonic-gate get_ans "Enter the MAP name :" 30637c478bd9Sstevel@tonic-gate MAP=$ANS 30647c478bd9Sstevel@tonic-gate 30657c478bd9Sstevel@tonic-gate if [[ $MAP = "" ]]; then 30667c478bd9Sstevel@tonic-gate echo " Error : BLANK map name not allowed; try again" 30677c478bd9Sstevel@tonic-gate continue 30687c478bd9Sstevel@tonic-gate fi 30697c478bd9Sstevel@tonic-gate 30707c478bd9Sstevel@tonic-gate # Check if the supplied map name exists, and if yes, then 30717c478bd9Sstevel@tonic-gate # set the PRESENT attributes for further processing 30727c478bd9Sstevel@tonic-gate 30737c478bd9Sstevel@tonic-gate find_map_presence_details $MAP 30747c478bd9Sstevel@tonic-gate 30757c478bd9Sstevel@tonic-gate case $PRESENT_COUNT in 30767c478bd9Sstevel@tonic-gate 30777c478bd9Sstevel@tonic-gate 0 ) echo " Error : $MAP not found in any domain; try again" 30787c478bd9Sstevel@tonic-gate ;; 30797c478bd9Sstevel@tonic-gate 30807c478bd9Sstevel@tonic-gate 1 ) # The map exists in only one domain. 30817c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags $MAP : s" >> $MAP_FILE 30827c478bd9Sstevel@tonic-gate STR="another" # Just to make the question look better. 30837c478bd9Sstevel@tonic-gate ;; 30847c478bd9Sstevel@tonic-gate 30857c478bd9Sstevel@tonic-gate * ) # The map exists in multiple domain. Ask if this flag needs 30867c478bd9Sstevel@tonic-gate # to be set for all domains, or some specific ones. 30877c478bd9Sstevel@tonic-gate 30887c478bd9Sstevel@tonic-gate echo "Map \"$MAP\" is present in these domains : $PRESENT_IN_DOMAINS" 30897c478bd9Sstevel@tonic-gate get_confirm "For this map, do you wish to set this flag for all the domains (y/n/h)?" \ 30907c478bd9Sstevel@tonic-gate "y" "secure_flag_all_domains_help" 30917c478bd9Sstevel@tonic-gate 30927c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 30937c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags $MAP : s" >> $MAP_FILE 30947c478bd9Sstevel@tonic-gate else 30957c478bd9Sstevel@tonic-gate 30967c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 30977c478bd9Sstevel@tonic-gate do 30987c478bd9Sstevel@tonic-gate 30997c478bd9Sstevel@tonic-gate get_confirm_nodef "Set secure flag for $MAP,${_DMN} (y/n)?" 31007c478bd9Sstevel@tonic-gate 31017c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 31027c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags $MAP,${_DMN} : s" >> $MAP_FILE 31037c478bd9Sstevel@tonic-gate fi 31047c478bd9Sstevel@tonic-gate 31057c478bd9Sstevel@tonic-gate done 31067c478bd9Sstevel@tonic-gate fi 31077c478bd9Sstevel@tonic-gate STR="another" # Just to make the question look better. 31087c478bd9Sstevel@tonic-gate ;; 31097c478bd9Sstevel@tonic-gate 31107c478bd9Sstevel@tonic-gate esac 31117c478bd9Sstevel@tonic-gate 31127c478bd9Sstevel@tonic-gate fi 31137c478bd9Sstevel@tonic-gatedone 31147c478bd9Sstevel@tonic-gate} 31157c478bd9Sstevel@tonic-gate 31167c478bd9Sstevel@tonic-gate 31177c478bd9Sstevel@tonic-gate# 31187c478bd9Sstevel@tonic-gate# Generate interdomain flag entries 31197c478bd9Sstevel@tonic-gate# 31207c478bd9Sstevel@tonic-gatecreate_interdomain_flag_entries() 31217c478bd9Sstevel@tonic-gate{ 31227c478bd9Sstevel@tonic-gate 31237c478bd9Sstevel@tonic-gateINTERDOMAIN_MAP_LIST="ipnodes 31247c478bd9Sstevel@tonic-gate multiipnodes 31257c478bd9Sstevel@tonic-gate hosts 31267c478bd9Sstevel@tonic-gate multihosts 31277c478bd9Sstevel@tonic-gate services.byservicename" 31287c478bd9Sstevel@tonic-gate 31297c478bd9Sstevel@tonic-gate# 31307c478bd9Sstevel@tonic-gate# Simple function to avoid duplication of code 31317c478bd9Sstevel@tonic-gate# 31327c478bd9Sstevel@tonic-gateprint_interdomain_entries() 31337c478bd9Sstevel@tonic-gate{ 31347c478bd9Sstevel@tonic-gatefor _MAP in $INTERDOMAIN_MAP_LIST 31357c478bd9Sstevel@tonic-gatedo 31367c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags ${_MAP} : b" >> $MAP_FILE 31377c478bd9Sstevel@tonic-gatedone 31387c478bd9Sstevel@tonic-gate} 31397c478bd9Sstevel@tonic-gate 31407c478bd9Sstevel@tonic-gateecho " 31417c478bd9Sstevel@tonic-gate# Specify YP_INTERDOMAIN flags 31427c478bd9Sstevel@tonic-gate" >> $MAP_FILE 31437c478bd9Sstevel@tonic-gate 31447c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo "\ 31457c478bd9Sstevel@tonic-gate# It is used to indicate NIS servers to use the domain name resolver for 31467c478bd9Sstevel@tonic-gate# host name and address lookups for hosts not found in the maps. 31477c478bd9Sstevel@tonic-gate# If set, it adds YP_INTERDOMAIN entries in these maps when converting 31487c478bd9Sstevel@tonic-gate# data from LDAP to YP. It needs to be set in the following format : 31497c478bd9Sstevel@tonic-gate# nisLDAPmapFlags mapname : b 31507c478bd9Sstevel@tonic-gate" >> $MAP_FILE 31517c478bd9Sstevel@tonic-gate 31527c478bd9Sstevel@tonic-gate# List one set of entries in commented form anyway as it might help 31537c478bd9Sstevel@tonic-gate# user understand what it means. 31547c478bd9Sstevel@tonic-gate 31557c478bd9Sstevel@tonic-gateecho "\ 31567c478bd9Sstevel@tonic-gate# If \$B is set in /var/yp/Makefile, then this flag should be 31577c478bd9Sstevel@tonic-gate# set for following maps :\ 31587c478bd9Sstevel@tonic-gate" >> $MAP_FILE 31597c478bd9Sstevel@tonic-gate 31607c478bd9Sstevel@tonic-gatefor _MAP in $INTERDOMAIN_MAP_LIST 31617c478bd9Sstevel@tonic-gatedo 31627c478bd9Sstevel@tonic-gate echo "# nisLDAPmapFlags ${_MAP} : b" >> $MAP_FILE 31637c478bd9Sstevel@tonic-gatedone 31647c478bd9Sstevel@tonic-gate 31657c478bd9Sstevel@tonic-gate# Put a blank line for indentation purpose 31667c478bd9Sstevel@tonic-gateecho >> $MAP_FILE 31677c478bd9Sstevel@tonic-gate 31687c478bd9Sstevel@tonic-gateget_confirm "Do you wish to set the \"interdomain\" flag for any domain (y/n/h)?" \ 31697c478bd9Sstevel@tonic-gate "n" "interdomain_flag_on_help" 31707c478bd9Sstevel@tonic-gate 31717c478bd9Sstevel@tonic-gateif [ $? -eq 1 ]; then 31727c478bd9Sstevel@tonic-gate 31737c478bd9Sstevel@tonic-gate if [ $N2L_DMN_CNT -gt 1 ]; then 31747c478bd9Sstevel@tonic-gate 31757c478bd9Sstevel@tonic-gate get_confirm "Should \"interdomain\" flag be set for all domain (y/n/h)?" \ 31767c478bd9Sstevel@tonic-gate "y" "interdomain_flag_all_domains_help" 31777c478bd9Sstevel@tonic-gate 31787c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 31797c478bd9Sstevel@tonic-gate print_interdomain_entries 31807c478bd9Sstevel@tonic-gate else 31817c478bd9Sstevel@tonic-gate 31827c478bd9Sstevel@tonic-gate for _DMN in ${N2L_DMN_LIST[*]} 31837c478bd9Sstevel@tonic-gate do 31847c478bd9Sstevel@tonic-gate get_confirm_nodef "Set interdomain flag for ${_DMN} (y/n)?" 31857c478bd9Sstevel@tonic-gate 31867c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 31877c478bd9Sstevel@tonic-gate for _MAP in $INTERDOMAIN_MAP_LIST 31887c478bd9Sstevel@tonic-gate do 31897c478bd9Sstevel@tonic-gate echo "nisLDAPmapFlags ${_MAP},${_DMN} : b" >> $MAP_FILE 31907c478bd9Sstevel@tonic-gate done 31917c478bd9Sstevel@tonic-gate fi 31927c478bd9Sstevel@tonic-gate 31937c478bd9Sstevel@tonic-gate done 31947c478bd9Sstevel@tonic-gate fi 31957c478bd9Sstevel@tonic-gate 31967c478bd9Sstevel@tonic-gate else 31977c478bd9Sstevel@tonic-gate print_interdomain_entries 31987c478bd9Sstevel@tonic-gate fi 31997c478bd9Sstevel@tonic-gatefi 32007c478bd9Sstevel@tonic-gate 32017c478bd9Sstevel@tonic-gateecho " 32027c478bd9Sstevel@tonic-gate# 32037c478bd9Sstevel@tonic-gate#------------------------------------------------------------------------------ 32047c478bd9Sstevel@tonic-gate# 32057c478bd9Sstevel@tonic-gate" >> $MAP_FILE 32067c478bd9Sstevel@tonic-gate 32077c478bd9Sstevel@tonic-gatereturn 0 32087c478bd9Sstevel@tonic-gate} 32097c478bd9Sstevel@tonic-gate 32107c478bd9Sstevel@tonic-gate 32117c478bd9Sstevel@tonic-gate# 32127c478bd9Sstevel@tonic-gate# List SECURE and INTERDOMAIN flags 32137c478bd9Sstevel@tonic-gate# 32147c478bd9Sstevel@tonic-gatecreate_nisLDAPmapFlags() 32157c478bd9Sstevel@tonic-gate{ 32167c478bd9Sstevel@tonic-gatecreate_secure_flag_entries 32177c478bd9Sstevel@tonic-gatecreate_interdomain_flag_entries 32187c478bd9Sstevel@tonic-gate} 32197c478bd9Sstevel@tonic-gate 32207c478bd9Sstevel@tonic-gate 32217c478bd9Sstevel@tonic-gate# 32227c478bd9Sstevel@tonic-gate# Print one Map TTL entry in mapping file using supplied TTL. 32237c478bd9Sstevel@tonic-gate# 32247c478bd9Sstevel@tonic-gateprint_one_map_ttl_entry() 32257c478bd9Sstevel@tonic-gate{ 32267c478bd9Sstevel@tonic-gate_Map=$1 32277c478bd9Sstevel@tonic-gate_iTtlLo=$2 32287c478bd9Sstevel@tonic-gate_iTtlHi=$3 32297c478bd9Sstevel@tonic-gate_runTtl=$4 32307c478bd9Sstevel@tonic-gate 32317c478bd9Sstevel@tonic-gateecho "\ 32327c478bd9Sstevel@tonic-gatenisLDAPentryTtl ${_Map}:${_iTtlLo}:${_iTtlHi}:${_runTtl}\ 32337c478bd9Sstevel@tonic-gate" >> $MAP_FILE 32347c478bd9Sstevel@tonic-gate 32357c478bd9Sstevel@tonic-gatereturn 0 32367c478bd9Sstevel@tonic-gate} 32377c478bd9Sstevel@tonic-gate 32387c478bd9Sstevel@tonic-gate 32397c478bd9Sstevel@tonic-gate# 32407c478bd9Sstevel@tonic-gate# Print all the maps TTL entries of same TTL 32417c478bd9Sstevel@tonic-gate# values using the supplied TTL triplet. 32427c478bd9Sstevel@tonic-gate# 32437c478bd9Sstevel@tonic-gateprint_all_same_ttl_entries() 32447c478bd9Sstevel@tonic-gate{ 32457c478bd9Sstevel@tonic-gate_iTTLlo=$1 32467c478bd9Sstevel@tonic-gate_iTTLhi=$2 32477c478bd9Sstevel@tonic-gate_runTTL=$3 32487c478bd9Sstevel@tonic-gate 32497c478bd9Sstevel@tonic-gatefor _MAP in ${DEF_TTL_MAPLIST} ${ALL_DMN_CUST_MAPS[*]} \ 32507c478bd9Sstevel@tonic-gate ${ALL_DMN_AUTO_CUST_MAPS[*]} 32517c478bd9Sstevel@tonic-gatedo 32527c478bd9Sstevel@tonic-gate 32537c478bd9Sstevel@tonic-gate if [ "$_MAP" != "passwd.adjunct.byname" ] && \ 32547c478bd9Sstevel@tonic-gate [ "$_MAP" != "group.adjunct.byname" ] 32557c478bd9Sstevel@tonic-gate then 32567c478bd9Sstevel@tonic-gate print_one_map_ttl_entry $_MAP $_iTTLlo $_iTTLhi $_runTTL 32577c478bd9Sstevel@tonic-gate 32587c478bd9Sstevel@tonic-gate else 32597c478bd9Sstevel@tonic-gate 32607c478bd9Sstevel@tonic-gate # adjunct maps might not exist in all the domains. 32617c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 32627c478bd9Sstevel@tonic-gate 32637c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 32647c478bd9Sstevel@tonic-gate then 32657c478bd9Sstevel@tonic-gate 32667c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 32677c478bd9Sstevel@tonic-gate print_one_map_ttl_entry $_MAP $_iTTLlo $_iTTLhi $_runTTL 32687c478bd9Sstevel@tonic-gate 32697c478bd9Sstevel@tonic-gate else 32707c478bd9Sstevel@tonic-gate 32717c478bd9Sstevel@tonic-gate for _DMN_ in $PRESENT_IN_DOMAINS 32727c478bd9Sstevel@tonic-gate do 32737c478bd9Sstevel@tonic-gate _STR="${_MAP},${_DMN_}" 32747c478bd9Sstevel@tonic-gate print_one_map_ttl_entry $_STR $_iTTLlo $_iTTLhi $_runTTL 32757c478bd9Sstevel@tonic-gate done 32767c478bd9Sstevel@tonic-gate 32777c478bd9Sstevel@tonic-gate fi 32787c478bd9Sstevel@tonic-gate fi 32797c478bd9Sstevel@tonic-gatedone 32807c478bd9Sstevel@tonic-gate 32817c478bd9Sstevel@tonic-gatereturn 0 32827c478bd9Sstevel@tonic-gate} 32837c478bd9Sstevel@tonic-gate 32847c478bd9Sstevel@tonic-gate# 32857c478bd9Sstevel@tonic-gate# Read the initialTTLlo. Set the value in global variable. 32867c478bd9Sstevel@tonic-gate# 32877c478bd9Sstevel@tonic-gateget_ittl_lo() 32887c478bd9Sstevel@tonic-gate{ 32897c478bd9Sstevel@tonic-gateget_pos_int "Lower limit for initial TTL (in seconds) (h=help):" \ 32907c478bd9Sstevel@tonic-gate "$DEF_iTTLlo" "initialTTLlo_help" 32917c478bd9Sstevel@tonic-gate 32927c478bd9Sstevel@tonic-gateiTTLlo=${NUM} 32937c478bd9Sstevel@tonic-gate} 32947c478bd9Sstevel@tonic-gate 32957c478bd9Sstevel@tonic-gate 32967c478bd9Sstevel@tonic-gate# 32977c478bd9Sstevel@tonic-gate# Read the initialTTLhi. Set the value in global variable. 32987c478bd9Sstevel@tonic-gate# 32997c478bd9Sstevel@tonic-gateget_ittl_hi() 33007c478bd9Sstevel@tonic-gate{ 33017c478bd9Sstevel@tonic-gateget_pos_int "Higher limit for initial TTL (in seconds) (h=help):" \ 33027c478bd9Sstevel@tonic-gate "$DEF_iTTLhi" "initialTTLhi_help" 33037c478bd9Sstevel@tonic-gate 33047c478bd9Sstevel@tonic-gateiTTLhi=${NUM} 33057c478bd9Sstevel@tonic-gate} 33067c478bd9Sstevel@tonic-gate 33077c478bd9Sstevel@tonic-gate 33087c478bd9Sstevel@tonic-gate# 33097c478bd9Sstevel@tonic-gate# Read the initialTTLhi. Set the value in global variable. 33107c478bd9Sstevel@tonic-gate# 33117c478bd9Sstevel@tonic-gateget_run_ttl() 33127c478bd9Sstevel@tonic-gate{ 33137c478bd9Sstevel@tonic-gateget_pos_int "Runtime TTL (in seconds) (h=help):" \ 33147c478bd9Sstevel@tonic-gate "$DEF_runTTL" "runningTTL_help" 33157c478bd9Sstevel@tonic-gate 33167c478bd9Sstevel@tonic-gaterunTTL=${NUM} 33177c478bd9Sstevel@tonic-gate} 33187c478bd9Sstevel@tonic-gate 33197c478bd9Sstevel@tonic-gate 33207c478bd9Sstevel@tonic-gate# 33217c478bd9Sstevel@tonic-gate# Read one TTL triplet. Set the result in global variables. 33227c478bd9Sstevel@tonic-gate# 33237c478bd9Sstevel@tonic-gateread_one_ttl_triplet() 33247c478bd9Sstevel@tonic-gate{ 33257c478bd9Sstevel@tonic-gate# Just call the individual functions for each TTL. 33267c478bd9Sstevel@tonic-gate 33277c478bd9Sstevel@tonic-gate get_ittl_lo 33287c478bd9Sstevel@tonic-gate get_ittl_hi 33297c478bd9Sstevel@tonic-gate get_run_ttl 33307c478bd9Sstevel@tonic-gate 33317c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && \ 33327c478bd9Sstevel@tonic-gate echo "TTL = ${iTTLlo}:${iTTLhi}:${runTTL}" 33337c478bd9Sstevel@tonic-gate 33347c478bd9Sstevel@tonic-gatereturn 0 33357c478bd9Sstevel@tonic-gate} 33367c478bd9Sstevel@tonic-gate 33377c478bd9Sstevel@tonic-gate# 33387c478bd9Sstevel@tonic-gate# Takes MAP name (with or without domain name) as argument, asks 33397c478bd9Sstevel@tonic-gate# user for TTL values, and appends the entry in the mapping file. 33407c478bd9Sstevel@tonic-gate# 33417c478bd9Sstevel@tonic-gateprocess_one_map_ttl_value() 33427c478bd9Sstevel@tonic-gate{ 33437c478bd9Sstevel@tonic-gate 33447c478bd9Sstevel@tonic-gate_Map_="$1" 33457c478bd9Sstevel@tonic-gate 33467c478bd9Sstevel@tonic-gateget_confirm "Retain the default TTL values [$DEF_iTTLlo:$DEF_iTTLhi:$DEF_runTTL] for \"$_Map_\" (y/n/h) ?" \ 33477c478bd9Sstevel@tonic-gate "y" "default_different_ttl_help" 33487c478bd9Sstevel@tonic-gate 33497c478bd9Sstevel@tonic-gateif [ $? -eq 1 ]; then 33507c478bd9Sstevel@tonic-gate print_one_map_ttl_entry $_Map_ $DEF_iTTLlo $DEF_iTTLhi $DEF_runTTL 33517c478bd9Sstevel@tonic-gateelse 33527c478bd9Sstevel@tonic-gate 33537c478bd9Sstevel@tonic-gate echo "Reading TTL values for $_Map_ :" 33547c478bd9Sstevel@tonic-gate read_one_ttl_triplet 33557c478bd9Sstevel@tonic-gate print_one_map_ttl_entry $_Map_ $iTTLlo $iTTLhi $runTTL 33567c478bd9Sstevel@tonic-gate 33577c478bd9Sstevel@tonic-gatefi 33587c478bd9Sstevel@tonic-gatereturn 0 33597c478bd9Sstevel@tonic-gate} 33607c478bd9Sstevel@tonic-gate 33617c478bd9Sstevel@tonic-gate 33627c478bd9Sstevel@tonic-gate# 33637c478bd9Sstevel@tonic-gate# Read only one TTL triplet for each existing MAP without asking 33647c478bd9Sstevel@tonic-gate# different values for each domain and update the mapping file. 33657c478bd9Sstevel@tonic-gate# 33667c478bd9Sstevel@tonic-gateread_all_maps_ttl_values_no_multiple_domain_issue() 33677c478bd9Sstevel@tonic-gate{ 33687c478bd9Sstevel@tonic-gate 33697c478bd9Sstevel@tonic-gate# Need to read only one TTL triplet for each existing MAP. 33707c478bd9Sstevel@tonic-gate 33717c478bd9Sstevel@tonic-gatefor _MAP in ${DEF_TTL_MAPLIST} ${ALL_DMN_CUST_MAPS[*]} \ 33727c478bd9Sstevel@tonic-gate ${ALL_DMN_AUTO_CUST_MAPS[*]} 33737c478bd9Sstevel@tonic-gatedo 33747c478bd9Sstevel@tonic-gate 33757c478bd9Sstevel@tonic-gate if [ "$_MAP" != "passwd.adjunct.byname" ] && \ 33767c478bd9Sstevel@tonic-gate [ "$_MAP" != "group.adjunct.byname" ] 33777c478bd9Sstevel@tonic-gate then 33787c478bd9Sstevel@tonic-gate process_one_map_ttl_value $_MAP 33797c478bd9Sstevel@tonic-gate 33807c478bd9Sstevel@tonic-gate else 33817c478bd9Sstevel@tonic-gate 33827c478bd9Sstevel@tonic-gate # adjunct maps might not exist in all the domains. 33837c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 33847c478bd9Sstevel@tonic-gate 33857c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 33867c478bd9Sstevel@tonic-gate then 33877c478bd9Sstevel@tonic-gate 33887c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 33897c478bd9Sstevel@tonic-gate process_one_map_ttl_value $_MAP 33907c478bd9Sstevel@tonic-gate 33917c478bd9Sstevel@tonic-gate else 33927c478bd9Sstevel@tonic-gate 33937c478bd9Sstevel@tonic-gate for _DMN_ in $PRESENT_IN_DOMAINS 33947c478bd9Sstevel@tonic-gate do 33957c478bd9Sstevel@tonic-gate _STR="${_MAP},${_DMN_}" 33967c478bd9Sstevel@tonic-gate process_one_map_ttl_value $_STR 33977c478bd9Sstevel@tonic-gate done 33987c478bd9Sstevel@tonic-gate 33997c478bd9Sstevel@tonic-gate fi 34007c478bd9Sstevel@tonic-gate fi 34017c478bd9Sstevel@tonic-gatedone 34027c478bd9Sstevel@tonic-gate 34037c478bd9Sstevel@tonic-gatereturn 0 34047c478bd9Sstevel@tonic-gate} 34057c478bd9Sstevel@tonic-gate 34067c478bd9Sstevel@tonic-gate 34077c478bd9Sstevel@tonic-gate# 34087c478bd9Sstevel@tonic-gate# Read TTL triplet for each default MAP (in database ID form) while 34097c478bd9Sstevel@tonic-gate# taking care of multiple domains issue and update the mapping file. 34107c478bd9Sstevel@tonic-gate# 34117c478bd9Sstevel@tonic-gateread_default_maps_ttl_values_with_multi_domain_issue() 34127c478bd9Sstevel@tonic-gate{ 34137c478bd9Sstevel@tonic-gate 34147c478bd9Sstevel@tonic-gatefor _MAP_ in ${DEF_TTL_MAPLIST} 34157c478bd9Sstevel@tonic-gatedo 34167c478bd9Sstevel@tonic-gate if [ "$_MAP_" != "passwd.adjunct.byname" ] && \ 34177c478bd9Sstevel@tonic-gate [ "$_MAP_" != "group.adjunct.byname" ] 34187c478bd9Sstevel@tonic-gate then 34197c478bd9Sstevel@tonic-gate 34207c478bd9Sstevel@tonic-gate for _DMN_ in ${N2L_DMN_LIST[*]} 34217c478bd9Sstevel@tonic-gate do 34227c478bd9Sstevel@tonic-gate _STR_="${_MAP_},${_DMN_}" 34237c478bd9Sstevel@tonic-gate # Now process each combination one at a time. 34247c478bd9Sstevel@tonic-gate process_one_map_ttl_value "$_STR_" 34257c478bd9Sstevel@tonic-gate done 34267c478bd9Sstevel@tonic-gate 34277c478bd9Sstevel@tonic-gate else 34287c478bd9Sstevel@tonic-gate # List only those domains in which adjunct.byname exists. 34297c478bd9Sstevel@tonic-gate find_domains $_MAP_ DEF_MAPS 34307c478bd9Sstevel@tonic-gate for _DMN_ in $PRESENT_IN_DOMAINS 34317c478bd9Sstevel@tonic-gate do 34327c478bd9Sstevel@tonic-gate _STR_="${_MAP_},${_DMN_}" 34337c478bd9Sstevel@tonic-gate process_one_map_ttl_value "$_STR_" 34347c478bd9Sstevel@tonic-gate done 34357c478bd9Sstevel@tonic-gate fi 34367c478bd9Sstevel@tonic-gatedone 34377c478bd9Sstevel@tonic-gate 34387c478bd9Sstevel@tonic-gatereturn 0 34397c478bd9Sstevel@tonic-gate} 34407c478bd9Sstevel@tonic-gate 34417c478bd9Sstevel@tonic-gate 34427c478bd9Sstevel@tonic-gate# 34437c478bd9Sstevel@tonic-gate# Read TTL triplet for each existing custom MAP while taking 34447c478bd9Sstevel@tonic-gate# care of multiple domains issue and update the mapping file. 34457c478bd9Sstevel@tonic-gate# 34467c478bd9Sstevel@tonic-gateread_custom_maps_ttl_values_with_multi_domain_issue() 34477c478bd9Sstevel@tonic-gate{ 34487c478bd9Sstevel@tonic-gate 34497c478bd9Sstevel@tonic-gatefor _MAP_ in ${ALL_DMN_CUST_MAPS[*]} ${ALL_DMN_AUTO_CUST_MAPS[*]} 34507c478bd9Sstevel@tonic-gatedo 34517c478bd9Sstevel@tonic-gate 34527c478bd9Sstevel@tonic-gate find_map_presence_details $_MAP_ 34537c478bd9Sstevel@tonic-gate 34547c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq 1 ]; then 34557c478bd9Sstevel@tonic-gate 34567c478bd9Sstevel@tonic-gate # This map exists in only one domain. 34577c478bd9Sstevel@tonic-gate # So, no need to ask for multiple domains. 34587c478bd9Sstevel@tonic-gate 34597c478bd9Sstevel@tonic-gate process_one_map_ttl_value $_MAP_ 34607c478bd9Sstevel@tonic-gate 34617c478bd9Sstevel@tonic-gate else 34627c478bd9Sstevel@tonic-gate 34637c478bd9Sstevel@tonic-gate # Handle multiple domains. 34647c478bd9Sstevel@tonic-gate 34657c478bd9Sstevel@tonic-gate echo "Map \"${_MAP_}\" is present in these domains : $PRESENT_IN_DOMAINS" 34667c478bd9Sstevel@tonic-gate 34677c478bd9Sstevel@tonic-gate get_confirm "For this map, do you wish to use the same TTL values for all the domains (y/n/h) ?" \ 34687c478bd9Sstevel@tonic-gate "y" "same_ttl_across_domains_help" 34697c478bd9Sstevel@tonic-gate 34707c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 34717c478bd9Sstevel@tonic-gate 34727c478bd9Sstevel@tonic-gate # Need to read only one TTL triplet for this MAP. 34737c478bd9Sstevel@tonic-gate process_one_map_ttl_value $_MAP_ 34747c478bd9Sstevel@tonic-gate 34757c478bd9Sstevel@tonic-gate else 34767c478bd9Sstevel@tonic-gate 34777c478bd9Sstevel@tonic-gate # Need to ask for each domain 34787c478bd9Sstevel@tonic-gate 34797c478bd9Sstevel@tonic-gate for _DMN_ in $PRESENT_IN_DOMAINS 34807c478bd9Sstevel@tonic-gate do 34817c478bd9Sstevel@tonic-gate _STR="${_MAP_},${_DMN_}" 34827c478bd9Sstevel@tonic-gate 34837c478bd9Sstevel@tonic-gate # Now process each combination one at a time. 34847c478bd9Sstevel@tonic-gate process_one_map_ttl_value "$_STR" 34857c478bd9Sstevel@tonic-gate 34867c478bd9Sstevel@tonic-gate done 34877c478bd9Sstevel@tonic-gate fi 34887c478bd9Sstevel@tonic-gate fi 34897c478bd9Sstevel@tonic-gatedone 34907c478bd9Sstevel@tonic-gate 34917c478bd9Sstevel@tonic-gatereturn 0 34927c478bd9Sstevel@tonic-gate} 34937c478bd9Sstevel@tonic-gate 34947c478bd9Sstevel@tonic-gate 34957c478bd9Sstevel@tonic-gate# 34967c478bd9Sstevel@tonic-gate# List the TTL values for various MAPs 34977c478bd9Sstevel@tonic-gate# 34987c478bd9Sstevel@tonic-gatecreate_nisLDAPentryTtl() 34997c478bd9Sstevel@tonic-gate{ 35007c478bd9Sstevel@tonic-gate 35017c478bd9Sstevel@tonic-gateecho "\ 35027c478bd9Sstevel@tonic-gate# Associate TTLs with NIS entries derived from LDAP 35037c478bd9Sstevel@tonic-gate" >> $MAP_FILE 35047c478bd9Sstevel@tonic-gate 35057c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo "\ 35067c478bd9Sstevel@tonic-gate# Each map has three TTL values which are specified in seconds. 35077c478bd9Sstevel@tonic-gate# 1. initialTTLlo (default $DEF_iTTLlo sec) The lower limit for the initial 35087c478bd9Sstevel@tonic-gate# TTL (in seconds) for data read from disk when the ypserv starts. 35097c478bd9Sstevel@tonic-gate# 35107c478bd9Sstevel@tonic-gate# 2. initialTTLhi (default $DEF_iTTLhi sec) The upper limit for initial TTL. 35117c478bd9Sstevel@tonic-gate# 35127c478bd9Sstevel@tonic-gate# 3. runningTTL (default $DEF_runTTL sec) The TTL (in seconds) for data 35137c478bd9Sstevel@tonic-gate# retrieved from LDAP while the ypserv is running. 35147c478bd9Sstevel@tonic-gate# 35157c478bd9Sstevel@tonic-gate# If any value is not specified, then default value is used. 35167c478bd9Sstevel@tonic-gate# The format of TTL entry is : 35177c478bd9Sstevel@tonic-gate# nisLDAPentryTtl MAP[,DOMAIN]:initialTTLlo:initialTTLhi:runningTTL 35187c478bd9Sstevel@tonic-gate" >> $MAP_FILE 35197c478bd9Sstevel@tonic-gate 35207c478bd9Sstevel@tonic-gate# If no maps are present, just return. 35217c478bd9Sstevel@tonic-gate[ ${#ALL_DMN_ALL_MAPS[*]} -eq 0 ] && return 0 35227c478bd9Sstevel@tonic-gate 35237c478bd9Sstevel@tonic-gateecho "The default TTL for each map is set to ${DEF_iTTLlo}:${DEF_iTTLhi}:${DEF_runTTL}" 35247c478bd9Sstevel@tonic-gateget_confirm "Do you wish to change the TTL values for any map (y/n/h) ?" \ 35257c478bd9Sstevel@tonic-gate "n" "default_ttl_help" 35267c478bd9Sstevel@tonic-gate 35277c478bd9Sstevel@tonic-gateif [ $? -eq 0 ]; then 35287c478bd9Sstevel@tonic-gate # Default values accepted for all the maps. 35297c478bd9Sstevel@tonic-gate # So, just print all the maps with default TTL values. 35307c478bd9Sstevel@tonic-gate 35317c478bd9Sstevel@tonic-gate print_all_same_ttl_entries $DEF_iTTLlo $DEF_iTTLhi $DEF_runTTL 35327c478bd9Sstevel@tonic-gate 35337c478bd9Sstevel@tonic-gateelse 35347c478bd9Sstevel@tonic-gate echo "You would be allowed to enter the new TTL values." 35357c478bd9Sstevel@tonic-gate get_confirm "Do you wish to use the same TTL values for all the maps (y/n/h) ?" \ 35367c478bd9Sstevel@tonic-gate "y" "non_default_same_ttl_help" 35377c478bd9Sstevel@tonic-gate 35387c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 35397c478bd9Sstevel@tonic-gate # Need to read only one TTL triplet. 35407c478bd9Sstevel@tonic-gate # Print all the maps with new TTL triplet. 35417c478bd9Sstevel@tonic-gate 35427c478bd9Sstevel@tonic-gate # read one ttl triplet 35437c478bd9Sstevel@tonic-gate echo "Enter the new TTL values :" 35447c478bd9Sstevel@tonic-gate 35457c478bd9Sstevel@tonic-gate read_one_ttl_triplet 35467c478bd9Sstevel@tonic-gate 35477c478bd9Sstevel@tonic-gate print_all_same_ttl_entries $iTTLlo $iTTLhi $runTTL 35487c478bd9Sstevel@tonic-gate 35497c478bd9Sstevel@tonic-gate else 35507c478bd9Sstevel@tonic-gate if [ $N2L_DMN_CNT -eq 1 ]; then 35517c478bd9Sstevel@tonic-gate 35527c478bd9Sstevel@tonic-gate # TTL values are different now. But we haev only one domain. 35537c478bd9Sstevel@tonic-gate # So, no need to worry about multiple domains. Need to read 35547c478bd9Sstevel@tonic-gate # only one TTL triplet for each existing MAP. 35557c478bd9Sstevel@tonic-gate 35567c478bd9Sstevel@tonic-gate read_all_maps_ttl_values_no_multiple_domain_issue 35577c478bd9Sstevel@tonic-gate 35587c478bd9Sstevel@tonic-gate else 35597c478bd9Sstevel@tonic-gate 35607c478bd9Sstevel@tonic-gate # TTL values are different now. And we have multiple domains 35617c478bd9Sstevel@tonic-gate # too. Check if MAPS are going to have same TTL across domains. 35627c478bd9Sstevel@tonic-gate # This is just to avoid asking too many TTL triplet inputs 35637c478bd9Sstevel@tonic-gate 35647c478bd9Sstevel@tonic-gate echo "You would be allowed to enter different TTL values for each map." 35657c478bd9Sstevel@tonic-gate 35667c478bd9Sstevel@tonic-gate get_confirm "For a given map, do you wish to use the same TTL values for all the domains (y/n/h) ?" \ 35677c478bd9Sstevel@tonic-gate "y" "non_default_different_ttl_help" 35687c478bd9Sstevel@tonic-gate 35697c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 35707c478bd9Sstevel@tonic-gate 35717c478bd9Sstevel@tonic-gate # Need to read only one TTL triplet for each existing MAP. 35727c478bd9Sstevel@tonic-gate read_all_maps_ttl_values_no_multiple_domain_issue 35737c478bd9Sstevel@tonic-gate 35747c478bd9Sstevel@tonic-gate else 35757c478bd9Sstevel@tonic-gate 35767c478bd9Sstevel@tonic-gate # We have hit the worst case scenario. TTLs could be 35777c478bd9Sstevel@tonic-gate # different per map and per domain. 35787c478bd9Sstevel@tonic-gate 35797c478bd9Sstevel@tonic-gate read_default_maps_ttl_values_with_multi_domain_issue 35807c478bd9Sstevel@tonic-gate read_custom_maps_ttl_values_with_multi_domain_issue 35817c478bd9Sstevel@tonic-gate fi 35827c478bd9Sstevel@tonic-gate fi 35837c478bd9Sstevel@tonic-gate fi 35847c478bd9Sstevel@tonic-gatefi 35857c478bd9Sstevel@tonic-gate 35867c478bd9Sstevel@tonic-gateecho " 35877c478bd9Sstevel@tonic-gate# 35887c478bd9Sstevel@tonic-gate#------------------------------------------------------------------------------ 35897c478bd9Sstevel@tonic-gate# 35907c478bd9Sstevel@tonic-gate" >> $MAP_FILE 35917c478bd9Sstevel@tonic-gate 35927c478bd9Sstevel@tonic-gatereturn 0 35937c478bd9Sstevel@tonic-gate} 35947c478bd9Sstevel@tonic-gate 35957c478bd9Sstevel@tonic-gate 35967c478bd9Sstevel@tonic-gate# 35977c478bd9Sstevel@tonic-gate# The custom maps for which we do not have enough 35987c478bd9Sstevel@tonic-gate# information to be able to generate specific entries, 35997c478bd9Sstevel@tonic-gate# we just log the message that the user needs to take 36007c478bd9Sstevel@tonic-gate# care of those entries manually. 36017c478bd9Sstevel@tonic-gate# 36027c478bd9Sstevel@tonic-gateask_user_to_update_the_custom_map_entries_too() 36037c478bd9Sstevel@tonic-gate{ 36047c478bd9Sstevel@tonic-gate 36057c478bd9Sstevel@tonic-gateif [ ${#ALL_DMN_CUST_MAPS[*]} -gt 0 ]; then 36067c478bd9Sstevel@tonic-gate 36077c478bd9Sstevel@tonic-gate echo " 36087c478bd9Sstevel@tonic-gate# Similar entries need to be created 36097c478bd9Sstevel@tonic-gate# for following custom maps too :\ 36107c478bd9Sstevel@tonic-gate" >> $MAP_FILE 36117c478bd9Sstevel@tonic-gate 36127c478bd9Sstevel@tonic-gate for _MAP in ${ALL_DMN_CUST_MAPS[*]} 36137c478bd9Sstevel@tonic-gate do 36147c478bd9Sstevel@tonic-gate echo "# $_MAP" >> $MAP_FILE 36157c478bd9Sstevel@tonic-gate done 36167c478bd9Sstevel@tonic-gatefi 36177c478bd9Sstevel@tonic-gate} 36187c478bd9Sstevel@tonic-gate 36197c478bd9Sstevel@tonic-gate 36207c478bd9Sstevel@tonic-gateput_default_nisLDAPnameFields() 36217c478bd9Sstevel@tonic-gate{ 36227c478bd9Sstevel@tonic-gateecho ' 36237c478bd9Sstevel@tonic-gate# Associate names with fields in the maps. Must be same for all domains. 36247c478bd9Sstevel@tonic-gatenisLDAPnameFields audit_user: \ 36257c478bd9Sstevel@tonic-gate ("%s:%s:%s", name, alwaysAuditFlags, neverAuditFlags) 36267c478bd9Sstevel@tonic-gate 36277c478bd9Sstevel@tonic-gatenisLDAPnameFields auto.home: \ 36287c478bd9Sstevel@tonic-gate ("%s",value) 36297c478bd9Sstevel@tonic-gate 36307c478bd9Sstevel@tonic-gatenisLDAPnameFields auto.master: \ 36317c478bd9Sstevel@tonic-gate ("%s",value) 36327c478bd9Sstevel@tonic-gate 36337c478bd9Sstevel@tonic-gatenisLDAPnameFields auth_attr: \ 36347c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s", \ 36357c478bd9Sstevel@tonic-gate name, res1, res2, short_desc, long_desc, attrs ) 36367c478bd9Sstevel@tonic-gate 36377c478bd9Sstevel@tonic-gatenisLDAPnameFields bootparams: \ 36387c478bd9Sstevel@tonic-gate ("%s", params) 36397c478bd9Sstevel@tonic-gate 36407c478bd9Sstevel@tonic-gatenisLDAPnameFields ethers: \ 36417c478bd9Sstevel@tonic-gate ("%s %s", addr, name) 36427c478bd9Sstevel@tonic-gate 36437c478bd9Sstevel@tonic-gatenisLDAPnameFields exec_attr: \ 36447c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s:%s", \ 36457c478bd9Sstevel@tonic-gate name, policy, type, res1, res2, id, attrs) 36467c478bd9Sstevel@tonic-gate 36477c478bd9Sstevel@tonic-gatenisLDAPnameFields group: \ 36487c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s", name, passwd, gid, users) 36497c478bd9Sstevel@tonic-gate' >> $MAP_FILE 36507c478bd9Sstevel@tonic-gate 36517c478bd9Sstevel@tonic-gate# Need to handle group.adjunct.byname map for multiple domain. 36527c478bd9Sstevel@tonic-gate 36537c478bd9Sstevel@tonic-gate_MAP=group.adjunct.byname 36547c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 36557c478bd9Sstevel@tonic-gatethen 36567c478bd9Sstevel@tonic-gate # Just put the syntax in comment form 36577c478bd9Sstevel@tonic-gate echo '#nisLDAPnameFields group.adjunct.byname: \ 36587c478bd9Sstevel@tonic-gate# ("%s:%s", name, passwd) 36597c478bd9Sstevel@tonic-gate' >> $MAP_FILE 36607c478bd9Sstevel@tonic-gateelse 36617c478bd9Sstevel@tonic-gate # Find the domains in which this map exists. 36627c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 36637c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 36647c478bd9Sstevel@tonic-gate then 36657c478bd9Sstevel@tonic-gate 36667c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 36677c478bd9Sstevel@tonic-gate echo 'nisLDAPnameFields group.adjunct.byname: \ 36687c478bd9Sstevel@tonic-gate ("%s:%s", name, passwd) 36697c478bd9Sstevel@tonic-gate' >> $MAP_FILE 36707c478bd9Sstevel@tonic-gate else 36717c478bd9Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 36727c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 36737c478bd9Sstevel@tonic-gate do 36747c478bd9Sstevel@tonic-gate echo "nisLDAPnameFields group.adjunct.byname,${_DMN}: \\ 36757c478bd9Sstevel@tonic-gate (\"%s:%s\", name, passwd) 36767c478bd9Sstevel@tonic-gate" >> $MAP_FILE 36777c478bd9Sstevel@tonic-gate done 36787c478bd9Sstevel@tonic-gate fi 36797c478bd9Sstevel@tonic-gatefi 36807c478bd9Sstevel@tonic-gate 36817c478bd9Sstevel@tonic-gateecho 'nisLDAPnameFields keys.host: \ 36827c478bd9Sstevel@tonic-gate ("%s:%s", publicKey ,secretKey) 36837c478bd9Sstevel@tonic-gate 36847c478bd9Sstevel@tonic-gatenisLDAPnameFields keys.pass: \ 36857c478bd9Sstevel@tonic-gate ("%s:%s", publicKey ,secretKey) 36867c478bd9Sstevel@tonic-gate 36877c478bd9Sstevel@tonic-gatenisLDAPnameFields keys.nobody: \ 36887c478bd9Sstevel@tonic-gate ("%s:%s", publicKey ,secretKey) 36897c478bd9Sstevel@tonic-gate 36907c478bd9Sstevel@tonic-gatenisLDAPnameFields hosts: \ 36917c478bd9Sstevel@tonic-gate ("%a %s %s", addr, canonicalName, aliases) 36927c478bd9Sstevel@tonic-gate 36937c478bd9Sstevel@tonic-gatenisLDAPnameFields multihosts: \ 36947c478bd9Sstevel@tonic-gate ("%a %s %s", addr, canonicalName, aliases) 36957c478bd9Sstevel@tonic-gate 36967c478bd9Sstevel@tonic-gatenisLDAPnameFields ipnodes: \ 36977c478bd9Sstevel@tonic-gate ("%a %s %s", addr, canonicalName, aliases) 36987c478bd9Sstevel@tonic-gate 36997c478bd9Sstevel@tonic-gatenisLDAPnameFields multiipnodes: \ 37007c478bd9Sstevel@tonic-gate ("%a %s %s", addr, canonicalName, aliases) 37017c478bd9Sstevel@tonic-gate 37027c478bd9Sstevel@tonic-gatenisLDAPnameFields mail.aliases: \ 37037c478bd9Sstevel@tonic-gate ("%s", addresses) 37047c478bd9Sstevel@tonic-gate 37057c478bd9Sstevel@tonic-gatenisLDAPnameFields mail.mapping: \ 37067c478bd9Sstevel@tonic-gate ("%s", address) 37077c478bd9Sstevel@tonic-gate 37087c478bd9Sstevel@tonic-gate# memberTriples is split into sub-fields by a latter nisLDAPsplitField 37097c478bd9Sstevel@tonic-gate# attribute. 37107c478bd9Sstevel@tonic-gatenisLDAPnameFields netgroup: \ 37117c478bd9Sstevel@tonic-gate ("%s", memberTriples) 37127c478bd9Sstevel@tonic-gate 37137c478bd9Sstevel@tonic-gatenisLDAPnameFields netid.host: \ 37147c478bd9Sstevel@tonic-gate ("%s:%s", number, data) 37157c478bd9Sstevel@tonic-gate 37167c478bd9Sstevel@tonic-gatenisLDAPnameFields netid.pass: \ 37177c478bd9Sstevel@tonic-gate ("%s:%s", number, data) 37187c478bd9Sstevel@tonic-gate 37197c478bd9Sstevel@tonic-gatenisLDAPnameFields netmasks.byaddr: \ 37207c478bd9Sstevel@tonic-gate ("%a", mask) 37217c478bd9Sstevel@tonic-gate 37227c478bd9Sstevel@tonic-gatenisLDAPnameFields networks: \ 37237c478bd9Sstevel@tonic-gate ("%s %s %s", name, number, aliases) 37247c478bd9Sstevel@tonic-gate 37257c478bd9Sstevel@tonic-gatenisLDAPnameFields project: \ 37267c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s", \ 37277c478bd9Sstevel@tonic-gate name, projID, comment, users, groups, attrs) 37287c478bd9Sstevel@tonic-gate 37297c478bd9Sstevel@tonic-gatenisLDAPnameFields protocols: \ 37307c478bd9Sstevel@tonic-gate ("%s %s %s", name, number, aliases) 37317c478bd9Sstevel@tonic-gate 37327c478bd9Sstevel@tonic-gatenisLDAPnameFields rpc.bynumber: \ 37337c478bd9Sstevel@tonic-gate ("%s %s %s", name, number, aliases) 37347c478bd9Sstevel@tonic-gate 37357c478bd9Sstevel@tonic-gatenisLDAPnameFields passwd: \ 37367c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s:%s", \ 37377c478bd9Sstevel@tonic-gate name, passwd, uid, gid, gecos, home, shell) 37387c478bd9Sstevel@tonic-gate 37397c478bd9Sstevel@tonic-gate# It is not obvious what the fields in passwd.adjunct are for. They are not 37407c478bd9Sstevel@tonic-gate# the same as the shadow map. The following is based on information in:- 37417c478bd9Sstevel@tonic-gate# 37427c478bd9Sstevel@tonic-gate# lib/libbc/inc/include/pwdadj.h. 37437c478bd9Sstevel@tonic-gate# 37447c478bd9Sstevel@tonic-gate# This file implies that these are documented in getpwaent(3) but this man page 37457c478bd9Sstevel@tonic-gate# does not seem to exist. 37467c478bd9Sstevel@tonic-gate# 37477c478bd9Sstevel@tonic-gate# It is believed that 'min','max' and 'def' labels were reserved fields in 37487c478bd9Sstevel@tonic-gate# SunOS 4.x and are now unused. 'always' and 'never' audit information is 37497c478bd9Sstevel@tonic-gate# now contained in audit_user(4) so is now unused. 37507c478bd9Sstevel@tonic-gate# 37517c478bd9Sstevel@tonic-gate' >> $MAP_FILE 37527c478bd9Sstevel@tonic-gate 37537c478bd9Sstevel@tonic-gate# Need to handle passwd.adjunct.byname map for multiple domain. 37547c478bd9Sstevel@tonic-gate 37557c478bd9Sstevel@tonic-gate_MAP=passwd.adjunct.byname 37567c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 37577c478bd9Sstevel@tonic-gatethen 37587c478bd9Sstevel@tonic-gate # Just put the syntax in comment form 37597c478bd9Sstevel@tonic-gate echo '#nisLDAPnameFields passwd.adjunct.byname: \ 37607c478bd9Sstevel@tonic-gate# ("%s:%s:%s:%s:%s:%s:%s", \ 37617c478bd9Sstevel@tonic-gate# name, passwd, min, max, def, always, \ 37627c478bd9Sstevel@tonic-gate# never) 37637c478bd9Sstevel@tonic-gate' >> $MAP_FILE 37647c478bd9Sstevel@tonic-gateelse 37657c478bd9Sstevel@tonic-gate # Find the domains in which this map exists. 37667c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 37677c478bd9Sstevel@tonic-gate 37687c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 37697c478bd9Sstevel@tonic-gate then 37707c478bd9Sstevel@tonic-gate 37717c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 37727c478bd9Sstevel@tonic-gate echo 'nisLDAPnameFields passwd.adjunct.byname: \ 37737c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s:%s", \ 37747c478bd9Sstevel@tonic-gate name, passwd, min, max, def, always, \ 37757c478bd9Sstevel@tonic-gate never) 37767c478bd9Sstevel@tonic-gate' >> $MAP_FILE 37777c478bd9Sstevel@tonic-gate else 37787c478bd9Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 37797c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 37807c478bd9Sstevel@tonic-gate do 37817c478bd9Sstevel@tonic-gate echo "nisLDAPnameFields passwd.adjunct.byname,${_DMN}: \\ 37827c478bd9Sstevel@tonic-gate (\"%s:%s:%s:%s:%s:%s:%s\", \\ 37837c478bd9Sstevel@tonic-gate name, passwd, min, max, def, always, \\ 37847c478bd9Sstevel@tonic-gate never) 37857c478bd9Sstevel@tonic-gate" >> $MAP_FILE 37867c478bd9Sstevel@tonic-gate done 37877c478bd9Sstevel@tonic-gate fi 37887c478bd9Sstevel@tonic-gatefi 37897c478bd9Sstevel@tonic-gate 37907c478bd9Sstevel@tonic-gateecho ' 37917c478bd9Sstevel@tonic-gatenisLDAPnameFields printers.conf.byname: \ 37927c478bd9Sstevel@tonic-gate ("%s:%s", names, values) 37937c478bd9Sstevel@tonic-gate 37947c478bd9Sstevel@tonic-gatenisLDAPnameFields prof_attr: \ 37957c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s:%s", \ 37967c478bd9Sstevel@tonic-gate name, res1, res2, desc, attrs) 37977c478bd9Sstevel@tonic-gate 37987c478bd9Sstevel@tonic-gatenisLDAPnameFields services: \ 37997c478bd9Sstevel@tonic-gate ("%s %s/%s %s", name, port, protocol, aliases) 38007c478bd9Sstevel@tonic-gate 38017c478bd9Sstevel@tonic-gate# This map is never created but yppasswd uses the mapping to extract password 38027c478bd9Sstevel@tonic-gate# ageing information from the DIT. The password itself is not required by this 38037c478bd9Sstevel@tonic-gate# mechanism so is not included in the ageing mapping. 38047c478bd9Sstevel@tonic-gatenisLDAPnameFields ageing.byname: \ 38057c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s:%s:%s:%s:%s", \ 38067c478bd9Sstevel@tonic-gate name, lastchg, min, max, warn, inactive, \ 38077c478bd9Sstevel@tonic-gate expire, flag) 38087c478bd9Sstevel@tonic-gate 38097c478bd9Sstevel@tonic-gatenisLDAPnameFields timezone.byname: \ 38107c478bd9Sstevel@tonic-gate ("%s %s", zoneName, hostName) 38117c478bd9Sstevel@tonic-gate 38127c478bd9Sstevel@tonic-gatenisLDAPnameFields user_attr: \ 38137c478bd9Sstevel@tonic-gate ("%s:%s:%s:%s:%s", user, qualifier, res1, res2, attrs) 38147c478bd9Sstevel@tonic-gate' >> $MAP_FILE 38157c478bd9Sstevel@tonic-gate} 38167c478bd9Sstevel@tonic-gate 38177c478bd9Sstevel@tonic-gate# 38187c478bd9Sstevel@tonic-gate# List namefields for non-default auto maps and custom maps. 38197c478bd9Sstevel@tonic-gate# 38207c478bd9Sstevel@tonic-gateput_auto_and_custom_map_nisLDAPnameFields() 38217c478bd9Sstevel@tonic-gate{ 38227c478bd9Sstevel@tonic-gatefor _MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} ${ALL_DMN_CUST_MAPS[*]} 38237c478bd9Sstevel@tonic-gatedo 38247c478bd9Sstevel@tonic-gate 38257c478bd9Sstevel@tonic-gate echo "\ 38267c478bd9Sstevel@tonic-gatenisLDAPnameFields ${_MAP}: \\ 38277c478bd9Sstevel@tonic-gate (\"%s\",value) 38287c478bd9Sstevel@tonic-gate" >> $MAP_FILE 38297c478bd9Sstevel@tonic-gate 38307c478bd9Sstevel@tonic-gatedone 38317c478bd9Sstevel@tonic-gate} 38327c478bd9Sstevel@tonic-gate 38337c478bd9Sstevel@tonic-gate 38347c478bd9Sstevel@tonic-gatecreate_nisLDAPnameFields() 38357c478bd9Sstevel@tonic-gate{ 38367c478bd9Sstevel@tonic-gate# Put format information of "nisLDAPnameFields" 38377c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 38387c478bd9Sstevel@tonic-gate# "nisLDAPnameFields" specifies the content of entries in a NIS map 38397c478bd9Sstevel@tonic-gate# and how they should be broken into named fields. It is required as, 38407c478bd9Sstevel@tonic-gate# unlike NIS+, NIS maps do not store information in named fields. 38417c478bd9Sstevel@tonic-gate# 38427c478bd9Sstevel@tonic-gate# Following is the syntax for nisLDAPnameFields : 38437c478bd9Sstevel@tonic-gate# 38447c478bd9Sstevel@tonic-gate# "nisLDAPnameFields" mapName ":" "(" matchspec "," fieldNames ")" 38457c478bd9Sstevel@tonic-gate# fieldName = nameOrArrayName[","...] 38467c478bd9Sstevel@tonic-gate# nameOrArrayName = Name of field or 'array' of repeated fields. 38477c478bd9Sstevel@tonic-gate# matchspec = \" formatString \" 38487c478bd9Sstevel@tonic-gate' >> $MAP_FILE 38497c478bd9Sstevel@tonic-gate 38507c478bd9Sstevel@tonic-gate# List the default nameField values 38517c478bd9Sstevel@tonic-gateput_default_nisLDAPnameFields 38527c478bd9Sstevel@tonic-gate 38537c478bd9Sstevel@tonic-gate# List the underlying assumption 38547c478bd9Sstevel@tonic-gateecho "\ 38557c478bd9Sstevel@tonic-gate# With the assumption that all the custom maps are simple, single 38567c478bd9Sstevel@tonic-gate# map (single key-value pair type), below is the nisLDAPnameFields 38577c478bd9Sstevel@tonic-gate# information for all the custom and non-default auto.* maps. If 38587c478bd9Sstevel@tonic-gate# this assumption is not valid, then refer to the NISLDAPmapping 38597c478bd9Sstevel@tonic-gate# man page for information on how to customize this section. 38607c478bd9Sstevel@tonic-gate" >> $MAP_FILE 38617c478bd9Sstevel@tonic-gate 38627c478bd9Sstevel@tonic-gate# List namefields for non-default auto maps and custom maps. 38637c478bd9Sstevel@tonic-gateput_auto_and_custom_map_nisLDAPnameFields 38647c478bd9Sstevel@tonic-gate 38657c478bd9Sstevel@tonic-gate 38667c478bd9Sstevel@tonic-gateecho " 38677c478bd9Sstevel@tonic-gate# 38687c478bd9Sstevel@tonic-gate#------------------------------------------------------------------------------ 38697c478bd9Sstevel@tonic-gate# 38707c478bd9Sstevel@tonic-gate" >> $MAP_FILE 38717c478bd9Sstevel@tonic-gate 38727c478bd9Sstevel@tonic-gatereturn 0 38737c478bd9Sstevel@tonic-gate} 38747c478bd9Sstevel@tonic-gate 38757c478bd9Sstevel@tonic-gate 38767c478bd9Sstevel@tonic-gate# 38777c478bd9Sstevel@tonic-gate# List repeated field seperators 38787c478bd9Sstevel@tonic-gate# 38797c478bd9Sstevel@tonic-gatecreate_nisLDAPrepeatedFieldSeparators() 38807c478bd9Sstevel@tonic-gate{ 38817c478bd9Sstevel@tonic-gate 38827c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo " 38837c478bd9Sstevel@tonic-gate# nisLDAPrepeatedFieldSeparators : It is a character which separates 38847c478bd9Sstevel@tonic-gate# the repeatable instnaces of splitable fields. It's format is : 38857c478bd9Sstevel@tonic-gate# 38867c478bd9Sstevel@tonic-gate# nisLDAPrepeatedFieldSeparators fieldName \"sepChar[...]\" 38877c478bd9Sstevel@tonic-gate# sepChar = A separator character. 38887c478bd9Sstevel@tonic-gate# Default value is space or tab. 38897c478bd9Sstevel@tonic-gate" >> $MAP_FILE 38907c478bd9Sstevel@tonic-gate 38917c478bd9Sstevel@tonic-gateecho "\ 38927c478bd9Sstevel@tonic-gate#nisLDAPrepeatedFieldSeparators memberTriples: \" \t\" 38937c478bd9Sstevel@tonic-gate" >> $MAP_FILE 38947c478bd9Sstevel@tonic-gate 38957c478bd9Sstevel@tonic-gate} 38967c478bd9Sstevel@tonic-gate 38977c478bd9Sstevel@tonic-gate 38987c478bd9Sstevel@tonic-gate# 38997c478bd9Sstevel@tonic-gate# List split fields 39007c478bd9Sstevel@tonic-gate# 39017c478bd9Sstevel@tonic-gatecreate_nisLDAPsplitField() 39027c478bd9Sstevel@tonic-gate{ 39037c478bd9Sstevel@tonic-gate# List the default split fields 39047c478bd9Sstevel@tonic-gate 39057c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 39067c478bd9Sstevel@tonic-gate# nisLDAPsplitFields : It defines how a field, or list of fields, 39077c478bd9Sstevel@tonic-gate# named by nisLDAPnameFields is split into sub fields. The original 39087c478bd9Sstevel@tonic-gate# field is compared with each line of this attribute until one matches. 39097c478bd9Sstevel@tonic-gate# When a match is found named sub-fields are generated. In latter 39107c478bd9Sstevel@tonic-gate# operations sub-field names can be used in the same way as other 39117c478bd9Sstevel@tonic-gate# field names. The format of nisLDAPsplitFields is : 39127c478bd9Sstevel@tonic-gate# 39137c478bd9Sstevel@tonic-gate# "nisLDAPsplitFields" fieldName ":" splitSpec[","...] 39147c478bd9Sstevel@tonic-gate# splitSpec = "(" matchspec "," subFieldNames ")" 39157c478bd9Sstevel@tonic-gate# fieldName = Name of a field from nisLDAPnameFields 39167c478bd9Sstevel@tonic-gate# subFieldNames = subFieldname[","...] 39177c478bd9Sstevel@tonic-gate# matchspec = \" formatString \" 39187c478bd9Sstevel@tonic-gate' >> $MAP_FILE 39197c478bd9Sstevel@tonic-gate 39207c478bd9Sstevel@tonic-gateecho ' 39217c478bd9Sstevel@tonic-gatenisLDAPsplitField memberTriples: \ 39227c478bd9Sstevel@tonic-gate ("(%s,%s,%s)", host, user, domain), \ 39237c478bd9Sstevel@tonic-gate ("%s", group) 39247c478bd9Sstevel@tonic-gate' >> $MAP_FILE 39257c478bd9Sstevel@tonic-gate 39267c478bd9Sstevel@tonic-gate} 39277c478bd9Sstevel@tonic-gate 39287c478bd9Sstevel@tonic-gate# 39297c478bd9Sstevel@tonic-gate# List split fields and repeated field separators. 39307c478bd9Sstevel@tonic-gate# 39317c478bd9Sstevel@tonic-gatecreate_split_field_and_repeatedfield_seperators() 39327c478bd9Sstevel@tonic-gate{ 39337c478bd9Sstevel@tonic-gate 39347c478bd9Sstevel@tonic-gateecho "\ 39357c478bd9Sstevel@tonic-gate# Specify how to break fields up into sub fields. 39367c478bd9Sstevel@tonic-gate" >> $MAP_FILE 39377c478bd9Sstevel@tonic-gate 39387c478bd9Sstevel@tonic-gatecreate_nisLDAPrepeatedFieldSeparators 39397c478bd9Sstevel@tonic-gate 39407c478bd9Sstevel@tonic-gatecreate_nisLDAPsplitField 39417c478bd9Sstevel@tonic-gate 39427c478bd9Sstevel@tonic-gateecho " 39437c478bd9Sstevel@tonic-gate# 39447c478bd9Sstevel@tonic-gate#------------------------------------------------------------------------------ 39457c478bd9Sstevel@tonic-gate# 39467c478bd9Sstevel@tonic-gate" >> $MAP_FILE 39477c478bd9Sstevel@tonic-gate} 39487c478bd9Sstevel@tonic-gate 39497c478bd9Sstevel@tonic-gatelist_default_nisLDAPobjectDN() 39507c478bd9Sstevel@tonic-gate{ 39517c478bd9Sstevel@tonic-gateecho ' 39527c478bd9Sstevel@tonic-gate# Associate maps with RDNs and object classes. Base DN comes from the 39537c478bd9Sstevel@tonic-gate# nisLDAPdomainContext. 39547c478bd9Sstevel@tonic-gate# 39557c478bd9Sstevel@tonic-gate# As supplied this file gives only the most derived objectClass for each map. 39567c478bd9Sstevel@tonic-gate# For some servers it may be necessary to add "objectClass=" statements for 39577c478bd9Sstevel@tonic-gate# all the superclasses. This should be done here. 39587c478bd9Sstevel@tonic-gate 39597c478bd9Sstevel@tonic-gatenisLDAPobjectDN auto.home: \ 39607c478bd9Sstevel@tonic-gate automountmapname=auto_home,?one? \ 39617c478bd9Sstevel@tonic-gate objectClass=automount: 39627c478bd9Sstevel@tonic-gate 39637c478bd9Sstevel@tonic-gatenisLDAPobjectDN auto.master: \ 39647c478bd9Sstevel@tonic-gate automountmapname=auto_master,?one? \ 39657c478bd9Sstevel@tonic-gate objectClass=automount: 39667c478bd9Sstevel@tonic-gate 39677c478bd9Sstevel@tonic-gatenisLDAPobjectDN auth_attr: \ 39687c478bd9Sstevel@tonic-gate ou=SolarisAuthAttr,?one? \ 39697c478bd9Sstevel@tonic-gate objectClass=SolarisAuthAttr: 39707c478bd9Sstevel@tonic-gate 39717c478bd9Sstevel@tonic-gatenisLDAPobjectDN bootparams: \ 39727c478bd9Sstevel@tonic-gate ou=ethers,?one? \ 39737c478bd9Sstevel@tonic-gate objectClass=bootableDevice, \ 39747c478bd9Sstevel@tonic-gate bootParameter=*:\ 39757c478bd9Sstevel@tonic-gate ou=ethers,?one? \ 39767c478bd9Sstevel@tonic-gate objectClass=device, \ 39777c478bd9Sstevel@tonic-gate objectClass=bootableDevice 39787c478bd9Sstevel@tonic-gate 39797c478bd9Sstevel@tonic-gate 39807c478bd9Sstevel@tonic-gatenisLDAPobjectDN exec_attr:\ 39817c478bd9Sstevel@tonic-gate ou=SolarisProfAttr,?one?objectClass=SolarisExecAttr,\ 39827c478bd9Sstevel@tonic-gate SolarisKernelSecurityPolicy=*:\ 39837c478bd9Sstevel@tonic-gate ou=SolarisProfAttr,?one?objectClass=SolarisExecAttr,\ 39847c478bd9Sstevel@tonic-gate objectClass=SolarisProfAttr,\ 39857c478bd9Sstevel@tonic-gate objectClass=top 39867c478bd9Sstevel@tonic-gate 39877c478bd9Sstevel@tonic-gatenisLDAPobjectDN ethers: \ 39887c478bd9Sstevel@tonic-gate ou=ethers,?one? \ 39897c478bd9Sstevel@tonic-gate objectClass=ieee802Device, \ 39907c478bd9Sstevel@tonic-gate macAddress=*:\ 39917c478bd9Sstevel@tonic-gate ou=ethers,?one? \ 39927c478bd9Sstevel@tonic-gate objectClass=device, \ 39937c478bd9Sstevel@tonic-gate objectClass=ieee802Device 39947c478bd9Sstevel@tonic-gate 39957c478bd9Sstevel@tonic-gatenisLDAPobjectDN group: \ 39967c478bd9Sstevel@tonic-gate ou=group,?one? \ 39977c478bd9Sstevel@tonic-gate objectClass=posixGroup: 39987c478bd9Sstevel@tonic-gate' >> $MAP_FILE 39997c478bd9Sstevel@tonic-gate 40007c478bd9Sstevel@tonic-gate 40017c478bd9Sstevel@tonic-gate# Need to handle group.adjunct.byname map for multiple domain. 40027c478bd9Sstevel@tonic-gate 40037c478bd9Sstevel@tonic-gate_MAP=group.adjunct.byname 40047c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 40057c478bd9Sstevel@tonic-gatethen 40067c478bd9Sstevel@tonic-gate # Just put the syntax in comment form 40077c478bd9Sstevel@tonic-gate echo '#nisLDAPobjectDN group.adjunct.byname: \ 40087c478bd9Sstevel@tonic-gate# ou=group,?one? \ 40097c478bd9Sstevel@tonic-gate# objectClass=posixGroup: 40107c478bd9Sstevel@tonic-gate' >> $MAP_FILE 40117c478bd9Sstevel@tonic-gateelse 40127c478bd9Sstevel@tonic-gate # Find the domains in which this map exists. 40137c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 40147c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 40157c478bd9Sstevel@tonic-gate then 40167c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 40177c478bd9Sstevel@tonic-gate echo 'nisLDAPobjectDN group.adjunct.byname: \ 40187c478bd9Sstevel@tonic-gate ou=group,?one? \ 40197c478bd9Sstevel@tonic-gate objectClass=posixGroup: 40207c478bd9Sstevel@tonic-gate' >> $MAP_FILE 40217c478bd9Sstevel@tonic-gate else 40227c478bd9Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 40237c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 40247c478bd9Sstevel@tonic-gate do 40257c478bd9Sstevel@tonic-gate echo "nisLDAPobjectDN group.adjunct.byname,${_DMN}: \\ 40267c478bd9Sstevel@tonic-gate ou=group,?one? \\ 40277c478bd9Sstevel@tonic-gate objectClass=posixGroup: 40287c478bd9Sstevel@tonic-gate" >> $MAP_FILE 40297c478bd9Sstevel@tonic-gate done 40307c478bd9Sstevel@tonic-gate fi 40317c478bd9Sstevel@tonic-gatefi 40327c478bd9Sstevel@tonic-gate 40337c478bd9Sstevel@tonic-gate 40347c478bd9Sstevel@tonic-gateecho 'nisLDAPobjectDN hosts: \ 40357c478bd9Sstevel@tonic-gate ou=hosts,?one? \ 40367c478bd9Sstevel@tonic-gate objectClass=ipHost:\ 40377c478bd9Sstevel@tonic-gate ou=hosts,?one? \ 40387c478bd9Sstevel@tonic-gate objectClass=device, \ 40397c478bd9Sstevel@tonic-gate objectClass=ipHost 40407c478bd9Sstevel@tonic-gate 40417c478bd9Sstevel@tonic-gatenisLDAPobjectDN multihosts: \ 40427c478bd9Sstevel@tonic-gate ou=hosts,?one? \ 40437c478bd9Sstevel@tonic-gate objectClass=ipHost, \ 40447c478bd9Sstevel@tonic-gate ipHostNumber=*.* 40457c478bd9Sstevel@tonic-gate 40467c478bd9Sstevel@tonic-gatenisLDAPobjectDN ipnodes: \ 40477c478bd9Sstevel@tonic-gate ou=hosts,?one? \ 40487c478bd9Sstevel@tonic-gate objectClass=ipHost:\ 40497c478bd9Sstevel@tonic-gate ou=hosts,?one? \ 40507c478bd9Sstevel@tonic-gate objectClass=device, \ 40517c478bd9Sstevel@tonic-gate objectClass=ipHost 40527c478bd9Sstevel@tonic-gate 40537c478bd9Sstevel@tonic-gatenisLDAPobjectDN multiipnodes: \ 40547c478bd9Sstevel@tonic-gate ou=hosts,?one? \ 40557c478bd9Sstevel@tonic-gate objectClass=ipHost, \ 40567c478bd9Sstevel@tonic-gate ipHostNumber=*\:* 40577c478bd9Sstevel@tonic-gate 40587c478bd9Sstevel@tonic-gatenisLDAPobjectDN mail.aliases: \ 40597c478bd9Sstevel@tonic-gate ou=aliases,?one? \ 40607c478bd9Sstevel@tonic-gate objectClass=mailGroup: 40617c478bd9Sstevel@tonic-gate 40627c478bd9Sstevel@tonic-gatenisLDAPobjectDN mail.mapping: \ 40637c478bd9Sstevel@tonic-gate ou=aliases,?one? \ 40647c478bd9Sstevel@tonic-gate objectClass=mailGroup 40657c478bd9Sstevel@tonic-gate 40667c478bd9Sstevel@tonic-gatenisLDAPobjectDN netgroup: \ 40677c478bd9Sstevel@tonic-gate ou=netgroup,?one? \ 40687c478bd9Sstevel@tonic-gate objectClass=nisNetgroup: 40697c478bd9Sstevel@tonic-gate 40707c478bd9Sstevel@tonic-gatenisLDAPobjectDN networks: \ 40717c478bd9Sstevel@tonic-gate ou=networks,?one? \ 40727c478bd9Sstevel@tonic-gate objectClass=ipNetwork, \ 40737c478bd9Sstevel@tonic-gate cn=*: 40747c478bd9Sstevel@tonic-gate 40757c478bd9Sstevel@tonic-gate# Must come after networks (or equivalent) that creates ipNetworks 40767c478bd9Sstevel@tonic-gatenisLDAPobjectDN netmasks.byaddr: \ 40777c478bd9Sstevel@tonic-gate ou=networks,?one? \ 40787c478bd9Sstevel@tonic-gate objectClass=ipNetwork, \ 40797c478bd9Sstevel@tonic-gate ipNetMaskNumber=*: 40807c478bd9Sstevel@tonic-gate 40817c478bd9Sstevel@tonic-gatenisLDAPobjectDN passwd: \ 40827c478bd9Sstevel@tonic-gate ou=people,?one? \ 40837c478bd9Sstevel@tonic-gate objectClass=posixAccount:\ 40847c478bd9Sstevel@tonic-gate ou=people,?one? \ 40857c478bd9Sstevel@tonic-gate objectClass=account, \ 40867c478bd9Sstevel@tonic-gate objectClass=shadowAccount, \ 40877c478bd9Sstevel@tonic-gate objectClass=posixAccount 40887c478bd9Sstevel@tonic-gate' >> $MAP_FILE 40897c478bd9Sstevel@tonic-gate 40907c478bd9Sstevel@tonic-gate 40917c478bd9Sstevel@tonic-gate# Need to handle passwd.adjunct.byname map for multiple domain. 40927c478bd9Sstevel@tonic-gate 40937c478bd9Sstevel@tonic-gate_MAP=passwd.adjunct.byname 40947c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 40957c478bd9Sstevel@tonic-gatethen 40967c478bd9Sstevel@tonic-gate # Just put the syntax in comment form 40977c478bd9Sstevel@tonic-gate echo '#nisLDAPobjectDN passwd.adjunct.byname: \ 40987c478bd9Sstevel@tonic-gate# ou=people,?one? \ 40997c478bd9Sstevel@tonic-gate# objectClass=posixAccount:\ 41007c478bd9Sstevel@tonic-gate# ou=people,?one? \ 41017c478bd9Sstevel@tonic-gate# objectClass=account, \ 41027c478bd9Sstevel@tonic-gate# objectClass=shadowAccount, \ 41037c478bd9Sstevel@tonic-gate# objectClass=posixAccount 41047c478bd9Sstevel@tonic-gate' >> $MAP_FILE 41057c478bd9Sstevel@tonic-gateelse 41067c478bd9Sstevel@tonic-gate # Find the domains in which this map exists. 41077c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 41087c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 41097c478bd9Sstevel@tonic-gate then 41107c478bd9Sstevel@tonic-gate # Don't put domain info as the map is present in all of them. 41117c478bd9Sstevel@tonic-gate echo 'nisLDAPobjectDN passwd.adjunct.byname: \ 41127c478bd9Sstevel@tonic-gate ou=people,?one? \ 41137c478bd9Sstevel@tonic-gate objectClass=posixAccount:\ 41147c478bd9Sstevel@tonic-gate ou=people,?one? \ 41157c478bd9Sstevel@tonic-gate objectClass=account, \ 41167c478bd9Sstevel@tonic-gate objectClass=shadowAccount, \ 41177c478bd9Sstevel@tonic-gate objectClass=posixAccount 41187c478bd9Sstevel@tonic-gate' >> $MAP_FILE 41197c478bd9Sstevel@tonic-gate else 41207c478bd9Sstevel@tonic-gate # Not every domain has this map. So, list for the ones which do. 41217c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 41227c478bd9Sstevel@tonic-gate do 41237c478bd9Sstevel@tonic-gate echo "nisLDAPobjectDN passwd.adjunct.byname,${_DMN}: \\ 41247c478bd9Sstevel@tonic-gate ou=people,?one? \\ 41257c478bd9Sstevel@tonic-gate objectClass=posixAccount:\\ 41267c478bd9Sstevel@tonic-gate ou=people,?one? \\ 41277c478bd9Sstevel@tonic-gate objectClass=account, \\ 41287c478bd9Sstevel@tonic-gate objectClass=shadowAccount, \\ 41297c478bd9Sstevel@tonic-gate objectClass=posixAccount 41307c478bd9Sstevel@tonic-gate" >> $MAP_FILE 41317c478bd9Sstevel@tonic-gate done 41327c478bd9Sstevel@tonic-gate fi 41337c478bd9Sstevel@tonic-gatefi 41347c478bd9Sstevel@tonic-gate 41357c478bd9Sstevel@tonic-gate 41367c478bd9Sstevel@tonic-gateecho '# Must follow passwd 41377c478bd9Sstevel@tonic-gatenisLDAPobjectDN netid.pass: \ 41387c478bd9Sstevel@tonic-gate ou=people,?one? \ 41397c478bd9Sstevel@tonic-gate objectClass=posixAccount 41407c478bd9Sstevel@tonic-gate 41417c478bd9Sstevel@tonic-gate# Must follow hosts 41427c478bd9Sstevel@tonic-gatenisLDAPobjectDN netid.host: \ 41437c478bd9Sstevel@tonic-gate ou=hosts,?one? \ 41447c478bd9Sstevel@tonic-gate objectClass=ipHost 41457c478bd9Sstevel@tonic-gate 41467c478bd9Sstevel@tonic-gatenisLDAPobjectDN printers.conf.byname: \ 41477c478bd9Sstevel@tonic-gate ou=printers,?one? \ 41487c478bd9Sstevel@tonic-gate objectClass=printerService:\ 41497c478bd9Sstevel@tonic-gate ou=printers,?one? \ 41507c478bd9Sstevel@tonic-gate objectClass=sunPrinter, \ 41517c478bd9Sstevel@tonic-gate objectClass=printerService, \ 41527c478bd9Sstevel@tonic-gate objectClass=printerLPR, \ 41537c478bd9Sstevel@tonic-gate objectClass=printerAbstract 41547c478bd9Sstevel@tonic-gate 41557c478bd9Sstevel@tonic-gatenisLDAPobjectDN prof_attr:\ 41567c478bd9Sstevel@tonic-gate ou=SolarisProfAttr,?one?objectClass=SolarisProfAttr,\ 41577c478bd9Sstevel@tonic-gate SolarisAttrLongDesc=*:\ 41587c478bd9Sstevel@tonic-gate ou=SolarisProfAttr,?one?objectClass=SolarisProfAttr,\ 41597c478bd9Sstevel@tonic-gate objectClass=SolarisExecAttr,\ 41607c478bd9Sstevel@tonic-gate objectClass=top 41617c478bd9Sstevel@tonic-gatenisLDAPobjectDN project: \ 41627c478bd9Sstevel@tonic-gate ou=project,?one? \ 41637c478bd9Sstevel@tonic-gate objectClass=SolarisProject: 41647c478bd9Sstevel@tonic-gate 41657c478bd9Sstevel@tonic-gatenisLDAPobjectDN protocols: \ 41667c478bd9Sstevel@tonic-gate ou=protocols,?one? \ 41677c478bd9Sstevel@tonic-gate objectClass=ipProtocol: 41687c478bd9Sstevel@tonic-gate 41697c478bd9Sstevel@tonic-gatenisLDAPobjectDN rpc.bynumber: \ 41707c478bd9Sstevel@tonic-gate ou=rpc,?one? \ 41717c478bd9Sstevel@tonic-gate objectClass=oncRpc: 41727c478bd9Sstevel@tonic-gate 41737c478bd9Sstevel@tonic-gatenisLDAPobjectDN services.byname: \ 41747c478bd9Sstevel@tonic-gate ou=services,?one? \ 41757c478bd9Sstevel@tonic-gate objectClass=ipService: 41767c478bd9Sstevel@tonic-gate 41777c478bd9Sstevel@tonic-gate# Because services.byservicename contains keys of form both 'name' 41787c478bd9Sstevel@tonic-gate# and 'name/protocol' we generate the DIT just from services.byname. 41797c478bd9Sstevel@tonic-gate# Hence, write-disabled for services.byservicename 41807c478bd9Sstevel@tonic-gatenisLDAPobjectDN services.byservicename: \ 41817c478bd9Sstevel@tonic-gate ou=services,?one? \ 41827c478bd9Sstevel@tonic-gate objectClass=ipService 41837c478bd9Sstevel@tonic-gate 41847c478bd9Sstevel@tonic-gate# This map is never created but yppasswd uses the mapping to extract password 41857c478bd9Sstevel@tonic-gate# aging information from the DIT. 41867c478bd9Sstevel@tonic-gatenisLDAPobjectDN ageing.byname: \ 41877c478bd9Sstevel@tonic-gate ou=people,?one? \ 41887c478bd9Sstevel@tonic-gate objectClass=shadowAccount: 41897c478bd9Sstevel@tonic-gate 41907c478bd9Sstevel@tonic-gate# Using nisplusTimeZoneData objectClass for compatibility with nis+2ldap 41917c478bd9Sstevel@tonic-gatenisLDAPobjectDN timezone.byname: \ 41927c478bd9Sstevel@tonic-gate ou=Timezone,?one? \ 41937c478bd9Sstevel@tonic-gate objectClass=nisplusTimeZoneData: 41947c478bd9Sstevel@tonic-gate 41957c478bd9Sstevel@tonic-gatenisLDAPobjectDN user_attr: \ 41967c478bd9Sstevel@tonic-gate ou=people,?one? \ 41977c478bd9Sstevel@tonic-gate objectClass=SolarisUserAttr: 41987c478bd9Sstevel@tonic-gate 41997c478bd9Sstevel@tonic-gate# Must come after passwd (or equivalent) that creates posixAccounts 42007c478bd9Sstevel@tonic-gatenisLDAPobjectDN audit_user: \ 42017c478bd9Sstevel@tonic-gate ou=people,?one? \ 42027c478bd9Sstevel@tonic-gate objectClass=SolarisAuditUser: 42037c478bd9Sstevel@tonic-gate 42047c478bd9Sstevel@tonic-gate# Must come after hosts + passwd. 42057c478bd9Sstevel@tonic-gatenisLDAPobjectDN keys.host: \ 42067c478bd9Sstevel@tonic-gate ou=hosts,?one? \ 42077c478bd9Sstevel@tonic-gate objectClass=NisKeyObject: 42087c478bd9Sstevel@tonic-gate 42097c478bd9Sstevel@tonic-gatenisLDAPobjectDN keys.pass: \ 42107c478bd9Sstevel@tonic-gate ou=people,?one? \ 42117c478bd9Sstevel@tonic-gate objectClass=NisKeyObject: 42127c478bd9Sstevel@tonic-gate 42137c478bd9Sstevel@tonic-gatenisLDAPobjectDN keys.nobody: \ 42147c478bd9Sstevel@tonic-gate ou=people,?one? \ 42157c478bd9Sstevel@tonic-gate objectClass=NisKeyObject:\ 42167c478bd9Sstevel@tonic-gate ou=people,?one? \ 42177c478bd9Sstevel@tonic-gate objectClass=account, \ 42187c478bd9Sstevel@tonic-gate objectClass=NisKeyObject 42197c478bd9Sstevel@tonic-gate 42207c478bd9Sstevel@tonic-gatenisLDAPobjectDN ypservers: \ 42217c478bd9Sstevel@tonic-gate ou=ypservers,?one? \ 42227c478bd9Sstevel@tonic-gate objectClass=device: 42237c478bd9Sstevel@tonic-gate' >> $MAP_FILE 42247c478bd9Sstevel@tonic-gate} 42257c478bd9Sstevel@tonic-gate 42267c478bd9Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 42277c478bd9Sstevel@tonic-gatelist_auto_custom_nisLDAPobjectDN() 42287c478bd9Sstevel@tonic-gate{ 42297c478bd9Sstevel@tonic-gate 42307c478bd9Sstevel@tonic-gate# auto.* entries are easy. 42317c478bd9Sstevel@tonic-gateif [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then 42327c478bd9Sstevel@tonic-gate echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE 42337c478bd9Sstevel@tonic-gate 42347c478bd9Sstevel@tonic-gate for _MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} 42357c478bd9Sstevel@tonic-gate do 42367c478bd9Sstevel@tonic-gate 42377c478bd9Sstevel@tonic-gate # We need to find one container for each auto.* map. 42387c478bd9Sstevel@tonic-gate # Assume that each auto.* maps's container is auto_*. 42397c478bd9Sstevel@tonic-gate 42407c478bd9Sstevel@tonic-gate _MAP_UNDERSCORE=`echo $_MAP | sed "s/auto\./auto_/"` 42417c478bd9Sstevel@tonic-gate 42427c478bd9Sstevel@tonic-gate echo "\ 42437c478bd9Sstevel@tonic-gatenisLDAPobjectDN ${_MAP}: \\ 42447c478bd9Sstevel@tonic-gate automountmapname=${_MAP_UNDERSCORE},?one? \\ 42457c478bd9Sstevel@tonic-gate objectClass=automount: 42467c478bd9Sstevel@tonic-gate" >> $MAP_FILE 42477c478bd9Sstevel@tonic-gate done 42487c478bd9Sstevel@tonic-gatefi 42497c478bd9Sstevel@tonic-gate 42507c478bd9Sstevel@tonic-gate# Since we do not have enough information to generate 42517c478bd9Sstevel@tonic-gate# entries for other custom maps, best we can do is to 42527c478bd9Sstevel@tonic-gate# log this map names and ask user to take care of them. 42537c478bd9Sstevel@tonic-gate 42547c478bd9Sstevel@tonic-gateask_user_to_update_the_custom_map_entries_too 42557c478bd9Sstevel@tonic-gate 42567c478bd9Sstevel@tonic-gate} 42577c478bd9Sstevel@tonic-gate 42587c478bd9Sstevel@tonic-gate 42597c478bd9Sstevel@tonic-gate# 42607c478bd9Sstevel@tonic-gate# List association of maps with RDNs and object classes. 42617c478bd9Sstevel@tonic-gate# 42627c478bd9Sstevel@tonic-gatecreate_nisLDAPobjectDN() 42637c478bd9Sstevel@tonic-gate{ 42647c478bd9Sstevel@tonic-gate 42657c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 42667c478bd9Sstevel@tonic-gate# nisLDAPobjectDN : It specifies the connection between group of NIS 42677c478bd9Sstevel@tonic-gate# maps and the LDAP directory. This attribute also defines the 'order' 42687c478bd9Sstevel@tonic-gate# of the NIS maps. When NIS maps are bulk copied to or from the DIT 42697c478bd9Sstevel@tonic-gate# they are processed in the same order as related nisLDAPobjectDN 42707c478bd9Sstevel@tonic-gate# attributes appear in /var/yp/NISLDAPmapping. 42717c478bd9Sstevel@tonic-gate# The format of "nisLDAPobjectDN" is : 42727c478bd9Sstevel@tonic-gate# 42737c478bd9Sstevel@tonic-gate# mapName[" "...] ":" objectDN *( ";" objectDN ) 42747c478bd9Sstevel@tonic-gate# 42757c478bd9Sstevel@tonic-gate# where: 42767c478bd9Sstevel@tonic-gate# 42777c478bd9Sstevel@tonic-gate# objectDN = readObjectSpec [":"[writeObjectSpec]] 42787c478bd9Sstevel@tonic-gate# readObjectSpec = [baseAndScope [filterAttrValList]] 42797c478bd9Sstevel@tonic-gate# writeObjectSpec = [baseAndScope [attrValList]] 42807c478bd9Sstevel@tonic-gate# baseAndScope = [baseDN] ["?" [scope]] 42817c478bd9Sstevel@tonic-gate# filterAttrValList = ["?" [filter | attrValList]]] 42827c478bd9Sstevel@tonic-gate# scope = "base" | "one" | "sub" 42837c478bd9Sstevel@tonic-gate# attrValList = attribute "=" value 42847c478bd9Sstevel@tonic-gate# *("," attribute "=" value) 42857c478bd9Sstevel@tonic-gate' >> $MAP_FILE 42867c478bd9Sstevel@tonic-gate 42877c478bd9Sstevel@tonic-gate# List all the default entries anyway. 42887c478bd9Sstevel@tonic-gatelist_default_nisLDAPobjectDN 42897c478bd9Sstevel@tonic-gate 42907c478bd9Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 42917c478bd9Sstevel@tonic-gatelist_auto_custom_nisLDAPobjectDN 42927c478bd9Sstevel@tonic-gate 42937c478bd9Sstevel@tonic-gate} 42947c478bd9Sstevel@tonic-gate 42957c478bd9Sstevel@tonic-gate# 42967c478bd9Sstevel@tonic-gate# List all the default nisLDAPattributeFromField entries 42977c478bd9Sstevel@tonic-gate# 42987c478bd9Sstevel@tonic-gatelist_default_nisLDAPattributeFromField() 42997c478bd9Sstevel@tonic-gate{ 43007c478bd9Sstevel@tonic-gateecho ' 43017c478bd9Sstevel@tonic-gate# Describe how named fields are mapped to DIT entries. 43027c478bd9Sstevel@tonic-gate 43037c478bd9Sstevel@tonic-gate# audit_user 43047c478bd9Sstevel@tonic-gatenisLDAPattributeFromField audit_user: \ 43057c478bd9Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 43067c478bd9Sstevel@tonic-gate SolarisAuditAlways=alwaysAuditFlags, \ 43077c478bd9Sstevel@tonic-gate SolarisAuditNever=neverAuditFlags 43087c478bd9Sstevel@tonic-gate 43097c478bd9Sstevel@tonic-gate# auto.home 43107c478bd9Sstevel@tonic-gatenisLDAPattributeFromField auto.home: \ 43117c478bd9Sstevel@tonic-gate dn=("automountKey=%s,", rf_key ), \ 43127c478bd9Sstevel@tonic-gate automountKey=rf_key, \ 43137c478bd9Sstevel@tonic-gate automountInformation=value 43147c478bd9Sstevel@tonic-gate 43157c478bd9Sstevel@tonic-gate# auto.master 43167c478bd9Sstevel@tonic-gatenisLDAPattributeFromField auto.master: \ 43177c478bd9Sstevel@tonic-gate dn=("automountKey=%s,", rf_key ), \ 43187c478bd9Sstevel@tonic-gate automountKey=rf_key, \ 43197c478bd9Sstevel@tonic-gate automountInformation=value 43207c478bd9Sstevel@tonic-gate 43217c478bd9Sstevel@tonic-gate# auth_attr 43227c478bd9Sstevel@tonic-gatenisLDAPattributeFromField auth_attr: \ 43237c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 43247c478bd9Sstevel@tonic-gate cn=name, \ 43257c478bd9Sstevel@tonic-gate SolarisAttrReserved1=res1, \ 43267c478bd9Sstevel@tonic-gate SolarisAttrReserved2=res2, \ 43277c478bd9Sstevel@tonic-gate SolarisAttrShortDesc=short_desc, \ 43287c478bd9Sstevel@tonic-gate SolarisAttrLongDesc=long_desc, \ 43297c478bd9Sstevel@tonic-gate SolarisAttrKeyValue=attrs 43307c478bd9Sstevel@tonic-gate 43317c478bd9Sstevel@tonic-gate# exec_attr. Because of the messy NIS keys special handling is required here 43327c478bd9Sstevel@tonic-gatenisLDAPattributeFromField exec_attr: \ 43337c478bd9Sstevel@tonic-gate dn=("cn=%s+SolarisKernelSecurityPolicy=%s\ 43347c478bd9Sstevel@tonic-gate +SolarisProfileType=%s+SolarisProfileID=%s,", \ 43357c478bd9Sstevel@tonic-gate name, policy,type,id), \ 43367c478bd9Sstevel@tonic-gate ("%s:*", cn)=rf_key, \ 43377c478bd9Sstevel@tonic-gate ("*:%s:*", SolarisKernelSecurityPolicy)=rf_key, \ 43387c478bd9Sstevel@tonic-gate ("*:*:%s", SolarisProfileId)=rf_key, \ 43397c478bd9Sstevel@tonic-gate solarisProfileType=type, \ 43407c478bd9Sstevel@tonic-gate solarisAttrReserved1=res1, \ 43417c478bd9Sstevel@tonic-gate SolarisAttrReserved2=res2, \ 43427c478bd9Sstevel@tonic-gate solarisAttrKeyValue=attrs 43437c478bd9Sstevel@tonic-gate 43447c478bd9Sstevel@tonic-gate# ethers 43457c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ethers.byname: \ 43467c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 43477c478bd9Sstevel@tonic-gate macAddress=addr 43487c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ethers.byaddr: \ 43497c478bd9Sstevel@tonic-gate dn=("cn=%s,", name ), \ 43507c478bd9Sstevel@tonic-gate macAddress=rf_key 43517c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ethers: \ 43527c478bd9Sstevel@tonic-gate cn=name, \ 43537c478bd9Sstevel@tonic-gate description=rf_comment 43547c478bd9Sstevel@tonic-gate 43557c478bd9Sstevel@tonic-gate# bootparams. Must be done after ethers 43567c478bd9Sstevel@tonic-gatenisLDAPattributeFromField bootparams: \ 43577c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 43587c478bd9Sstevel@tonic-gate cn=rf_key, \ 43597c478bd9Sstevel@tonic-gate (bootParameter)=(params, " ") 43607c478bd9Sstevel@tonic-gate' >> $MAP_FILE 43617c478bd9Sstevel@tonic-gate 43627c478bd9Sstevel@tonic-gate# group syntax is different when group.adjunct map is present. 43637c478bd9Sstevel@tonic-gate# So, need to handle the various possibilities 43647c478bd9Sstevel@tonic-gate 43657c478bd9Sstevel@tonic-gate_MAP=group.adjunct.byname 43667c478bd9Sstevel@tonic-gate 43677c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 43687c478bd9Sstevel@tonic-gatethen 43697c478bd9Sstevel@tonic-gate 43707c478bd9Sstevel@tonic-gate # Just put the group.adjunct syntax in comment form 43717c478bd9Sstevel@tonic-gate 43727c478bd9Sstevel@tonic-gate echo '# group 43737c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.byname: \ 43747c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 43757c478bd9Sstevel@tonic-gate gidNumber=gid 43767c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.bygid: \ 43777c478bd9Sstevel@tonic-gate dn=("cn=%s,", name ), \ 43787c478bd9Sstevel@tonic-gate gidNumber=rf_key 43797c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group: \ 43807c478bd9Sstevel@tonic-gate cn=name, \ 43817c478bd9Sstevel@tonic-gate userPassword=("{crypt}%s",passwd), \ 43827c478bd9Sstevel@tonic-gate (memberUid)=(users, ",") 43837c478bd9Sstevel@tonic-gate 43847c478bd9Sstevel@tonic-gate# 43857c478bd9Sstevel@tonic-gate# If you are using group.adjunct, comment the group section above 43867c478bd9Sstevel@tonic-gate# and uncomment the following group and group.adjunct sections 43877c478bd9Sstevel@tonic-gate# 43887c478bd9Sstevel@tonic-gate# group 43897c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField group.byname: \ 43907c478bd9Sstevel@tonic-gate# dn=("cn=%s,", rf_key ), \ 43917c478bd9Sstevel@tonic-gate# gidNumber=gid 43927c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField group.bygid: \ 43937c478bd9Sstevel@tonic-gate# dn=("cn=%s,", name ), \ 43947c478bd9Sstevel@tonic-gate# gidNumber=rf_key 43957c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField group: \ 43967c478bd9Sstevel@tonic-gate# cn=name, \ 43977c478bd9Sstevel@tonic-gate# (memberUid)=(users, ",") 43987c478bd9Sstevel@tonic-gate 43997c478bd9Sstevel@tonic-gate# group.adjunct 44007c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField group.adjunct.byname: \ 44017c478bd9Sstevel@tonic-gate# dn=("cn=%s,", rf_key ), \ 44027c478bd9Sstevel@tonic-gate# cn=name, \ 44037c478bd9Sstevel@tonic-gate# userPassword=("{crypt}%s",passwd) 44047c478bd9Sstevel@tonic-gate' >> $MAP_FILE 44057c478bd9Sstevel@tonic-gate 44067c478bd9Sstevel@tonic-gateelse 44077c478bd9Sstevel@tonic-gate 44087c478bd9Sstevel@tonic-gate # Find the domains in which group.adjunct map exists. 44097c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 44107c478bd9Sstevel@tonic-gate 44117c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 44127c478bd9Sstevel@tonic-gate then 44137c478bd9Sstevel@tonic-gate 44147c478bd9Sstevel@tonic-gate # All the domains have group.adjunct map. 44157c478bd9Sstevel@tonic-gate 44167c478bd9Sstevel@tonic-gate echo '# group 44177c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField group.byname: \ 44187c478bd9Sstevel@tonic-gate# dn=("cn=%s,", rf_key ), \ 44197c478bd9Sstevel@tonic-gate# gidNumber=gid 44207c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField group.bygid: \ 44217c478bd9Sstevel@tonic-gate# dn=("cn=%s,", name ), \ 44227c478bd9Sstevel@tonic-gate# gidNumber=rf_key 44237c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField group: \ 44247c478bd9Sstevel@tonic-gate# cn=name, \ 44257c478bd9Sstevel@tonic-gate# userPassword=("{crypt}%s",passwd), \ 44267c478bd9Sstevel@tonic-gate# (memberUid)=(users, ",") 44277c478bd9Sstevel@tonic-gate 44287c478bd9Sstevel@tonic-gate# If you are not using group.adjunct, uncomment the group section above 44297c478bd9Sstevel@tonic-gate# and comment the following group and group.adjunct sections 44307c478bd9Sstevel@tonic-gate# 44317c478bd9Sstevel@tonic-gate# group 44327c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.byname: \ 44337c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 44347c478bd9Sstevel@tonic-gate gidNumber=gid 44357c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.bygid: \ 44367c478bd9Sstevel@tonic-gate dn=("cn=%s,", name ), \ 44377c478bd9Sstevel@tonic-gate gidNumber=rf_key 44387c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group: \ 44397c478bd9Sstevel@tonic-gate cn=name, \ 44407c478bd9Sstevel@tonic-gate (memberUid)=(users, ",") 44417c478bd9Sstevel@tonic-gate 44427c478bd9Sstevel@tonic-gate# group.adjunct 44437c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.adjunct.byname: \ 44447c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 44457c478bd9Sstevel@tonic-gate cn=name, \ 44467c478bd9Sstevel@tonic-gate userPassword=("{crypt}%s",passwd) 44477c478bd9Sstevel@tonic-gate' >> $MAP_FILE 44487c478bd9Sstevel@tonic-gate 44497c478bd9Sstevel@tonic-gate else 44507c478bd9Sstevel@tonic-gate # Not every domain has group.adjunct map. 44517c478bd9Sstevel@tonic-gate 44527c478bd9Sstevel@tonic-gate # First put the password syntax with domain name for domains 44537c478bd9Sstevel@tonic-gate # in which group.adjunct exists. 44547c478bd9Sstevel@tonic-gate 44557c478bd9Sstevel@tonic-gate echo "# group" >> $MAP_FILE 44567c478bd9Sstevel@tonic-gate 44577c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 44587c478bd9Sstevel@tonic-gate do 44597c478bd9Sstevel@tonic-gate 44607c478bd9Sstevel@tonic-gate echo "\ 44617c478bd9Sstevel@tonic-gate# domain-specific group 44627c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.byname,${_DMN}: \\ 44637c478bd9Sstevel@tonic-gate dn=(\"cn=%s,\", rf_key ), \\ 44647c478bd9Sstevel@tonic-gate gidNumber=gid 44657c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.bygid,${_DMN}: \\ 44667c478bd9Sstevel@tonic-gate dn=(\"cn=%s,\", name ), \\ 44677c478bd9Sstevel@tonic-gate gidNumber=rf_key 44687c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group,${_DMN}: \\ 44697c478bd9Sstevel@tonic-gate cn=name, \\ 44707c478bd9Sstevel@tonic-gate (memberUid)=(users, \",\") 44717c478bd9Sstevel@tonic-gate" >> $MAP_FILE 44727c478bd9Sstevel@tonic-gate done 44737c478bd9Sstevel@tonic-gate 44747c478bd9Sstevel@tonic-gate # Now put the other group syntax. We do not need to 44757c478bd9Sstevel@tonic-gate # append the domain name here. 44767c478bd9Sstevel@tonic-gate 44777c478bd9Sstevel@tonic-gate echo ' 44787c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.byname: \ 44797c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 44807c478bd9Sstevel@tonic-gate gidNumber=gid 44817c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.bygid: \ 44827c478bd9Sstevel@tonic-gate dn=("cn=%s,", name ), \ 44837c478bd9Sstevel@tonic-gate gidNumber=rf_key 44847c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group: \ 44857c478bd9Sstevel@tonic-gate cn=name, \ 44867c478bd9Sstevel@tonic-gate userPassword=("{crypt}%s",passwd), \ 44877c478bd9Sstevel@tonic-gate (memberUid)=(users, ",") 44887c478bd9Sstevel@tonic-gate' >> $MAP_FILE 44897c478bd9Sstevel@tonic-gate 44907c478bd9Sstevel@tonic-gate # Now we need to put the group.adjunct syntax for domains 44917c478bd9Sstevel@tonic-gate # in which this map exists. 44927c478bd9Sstevel@tonic-gate 44937c478bd9Sstevel@tonic-gate echo "# group.adjunct" >> $MAP_FILE 44947c478bd9Sstevel@tonic-gate 44957c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 44967c478bd9Sstevel@tonic-gate do 44977c478bd9Sstevel@tonic-gate 44987c478bd9Sstevel@tonic-gate echo "\ 44997c478bd9Sstevel@tonic-gatenisLDAPattributeFromField group.adjunct.byname,${_DMN}: \\ 45007c478bd9Sstevel@tonic-gate dn=(\"cn=%s,\", rf_key ), \\ 45017c478bd9Sstevel@tonic-gate cn=name, \\ 45027c478bd9Sstevel@tonic-gate userPassword=(\"{crypt}%s\",passwd) 45037c478bd9Sstevel@tonic-gate" >> $MAP_FILE 45047c478bd9Sstevel@tonic-gate done 45057c478bd9Sstevel@tonic-gate 45067c478bd9Sstevel@tonic-gate fi 45077c478bd9Sstevel@tonic-gate 45087c478bd9Sstevel@tonic-gatefi 45097c478bd9Sstevel@tonic-gate 45107c478bd9Sstevel@tonic-gate 45117c478bd9Sstevel@tonic-gateecho ' 45127c478bd9Sstevel@tonic-gate# hosts 45137c478bd9Sstevel@tonic-gate# Cannot forward map hosts.byname key as the YP_MULTI entries will not work. 45147c478bd9Sstevel@tonic-gatenisLDAPattributeFromField hosts.byname: \ 45157c478bd9Sstevel@tonic-gate cn=rf_searchkey 45167c478bd9Sstevel@tonic-gatenisLDAPattributeFromField hosts.byaddr: \ 45177c478bd9Sstevel@tonic-gate ipHostNumber=rf_searchipkey 45187c478bd9Sstevel@tonic-gatenisLDAPattributeFromField hosts: \ 45197c478bd9Sstevel@tonic-gate ipHostNumber=addr, \ 45207c478bd9Sstevel@tonic-gate dn=("cn=%s+ipHostNumber=%s,", canonicalName, addr), \ 45217c478bd9Sstevel@tonic-gate cn=canonicalName, \ 45227c478bd9Sstevel@tonic-gate (cn)=(aliases, " "), \ 45237c478bd9Sstevel@tonic-gate description=rf_comment 45247c478bd9Sstevel@tonic-gate 45257c478bd9Sstevel@tonic-gatenisLDAPattributeFromField multihosts: \ 45267c478bd9Sstevel@tonic-gate ("YP_MULTI_%s", cn)=rf_searchkey 45277c478bd9Sstevel@tonic-gate 45287c478bd9Sstevel@tonic-gate# ipnodes 45297c478bd9Sstevel@tonic-gate# Cannot forward map ipnodes.byname key as the YP_MULTI entries will not work. 45307c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ipnodes.byname: \ 45317c478bd9Sstevel@tonic-gate cn=rf_searchkey 45327c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ipnodes.byaddr: \ 45337c478bd9Sstevel@tonic-gate ipHostNumber=rf_searchipkey 45347c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ipnodes: \ 45357c478bd9Sstevel@tonic-gate ipHostNumber=addr, \ 45367c478bd9Sstevel@tonic-gate dn=("cn=%s+ipHostNumber=%s,", canonicalName, addr), \ 45377c478bd9Sstevel@tonic-gate cn=canonicalName, \ 45387c478bd9Sstevel@tonic-gate (cn)=(aliases, " "), \ 45397c478bd9Sstevel@tonic-gate description=rf_comment 45407c478bd9Sstevel@tonic-gate 45417c478bd9Sstevel@tonic-gatenisLDAPattributeFromField multiipnodes: \ 45427c478bd9Sstevel@tonic-gate ("YP_MULTI_%s", cn)=rf_searchkey 45437c478bd9Sstevel@tonic-gate 45447c478bd9Sstevel@tonic-gate#mail.aliases 45457c478bd9Sstevel@tonic-gatenisLDAPattributeFromField mail.aliases: \ 45467c478bd9Sstevel@tonic-gate dn=("mail=%s,", rf_key), \ 45477c478bd9Sstevel@tonic-gate mail=rf_key, \ 45487c478bd9Sstevel@tonic-gate (mgrprfc822mailmember)=(addresses, ",") 45497c478bd9Sstevel@tonic-gate 45507c478bd9Sstevel@tonic-gate#mail.mapping 45517c478bd9Sstevel@tonic-gate#Commented out because all NIS->LDAP mappings are done by mail.aliases 45527c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField mail.mapping: \ 45537c478bd9Sstevel@tonic-gate# dn=("mail=%s,", address), \ 45547c478bd9Sstevel@tonic-gate# mail=address, \ 45557c478bd9Sstevel@tonic-gate# mgrprfc822mailmember=rf_key 45567c478bd9Sstevel@tonic-gatenisLDAPattributeFromField mail.mapping: \ 45577c478bd9Sstevel@tonic-gate mgrprfc822mailmember=rf_searchkey 45587c478bd9Sstevel@tonic-gate 45597c478bd9Sstevel@tonic-gate# netgroup. 45607c478bd9Sstevel@tonic-gate# 45617c478bd9Sstevel@tonic-gate# Only need to create DIT entries for netgroup. This contains a superset of 45627c478bd9Sstevel@tonic-gate# the information in netgroup.byhost and netgroup.byuser 45637c478bd9Sstevel@tonic-gatenisLDAPattributeFromField netgroup: \ 45647c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 45657c478bd9Sstevel@tonic-gate (memberNisNetgroup)=group, \ 45667c478bd9Sstevel@tonic-gate (nisNetgroupTriple)= \ 45677c478bd9Sstevel@tonic-gate ("(%s,%s,%s)", host, user, domain), \ 45687c478bd9Sstevel@tonic-gate cn=rf_key, \ 45697c478bd9Sstevel@tonic-gate description=rf_comment 45707c478bd9Sstevel@tonic-gate 45717c478bd9Sstevel@tonic-gate# netid.pass 45727c478bd9Sstevel@tonic-gate# 45737c478bd9Sstevel@tonic-gate# Commented out because, unless remote domains (and thus /etc/netid) is 45747c478bd9Sstevel@tonic-gate# supported, all NIS->LDAP mappings are set up from passwd. 45757c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField netid.pass: \ 45767c478bd9Sstevel@tonic-gate# ("unix.%s@*", uidNumber)=rf_key, \ 45777c478bd9Sstevel@tonic-gate# (gidNumber)=("%s", (data), " "), \ 45787c478bd9Sstevel@tonic-gate# description=rf_comment 45797c478bd9Sstevel@tonic-gatenisLDAPattributeFromField netid.pass: \ 45807c478bd9Sstevel@tonic-gate ("unix.%s@*", uidNumber)=rf_searchkey 45817c478bd9Sstevel@tonic-gate 45827c478bd9Sstevel@tonic-gate# netid.host 45837c478bd9Sstevel@tonic-gate# 45847c478bd9Sstevel@tonic-gate# Commented out because, unless remote domains (and thus /etc/netid) is 45857c478bd9Sstevel@tonic-gate# supported, all NIS->LDAP mappings are set up from hosts. 45867c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField netid.host: \ 45877c478bd9Sstevel@tonic-gate# dn=("cn=%s+ipHostNumber=%s,", data, \ 45887c478bd9Sstevel@tonic-gate# ldap:ipHostNumber:?one?("cn=%s", data)), \ 45897c478bd9Sstevel@tonic-gate# ipHostNumber=ldap:ipHostNumber:?one?("cn=%s", data), \ 45907c478bd9Sstevel@tonic-gate# ("unix.%s@*", cn)=rf_key, \ 45917c478bd9Sstevel@tonic-gate# description=rf_comment 45927c478bd9Sstevel@tonic-gatenisLDAPattributeFromField netid.host: \ 45937c478bd9Sstevel@tonic-gate ("unix.%s@*", cn)=rf_searchkey 45947c478bd9Sstevel@tonic-gate 45957c478bd9Sstevel@tonic-gate# netmasks.byaddr 45967c478bd9Sstevel@tonic-gatenisLDAPattributeFromField netmasks.byaddr: \ 45977c478bd9Sstevel@tonic-gate dn=("ipNetworkNumber=%s,", rf_ipkey ), \ 45987c478bd9Sstevel@tonic-gate ipNetworkNumber=rf_ipkey, \ 45997c478bd9Sstevel@tonic-gate ipNetmaskNumber=mask, \ 46007c478bd9Sstevel@tonic-gate description=rf_comment 46017c478bd9Sstevel@tonic-gate 46027c478bd9Sstevel@tonic-gate# networks. 46037c478bd9Sstevel@tonic-gatenisLDAPattributeFromField networks.byname: \ 46047c478bd9Sstevel@tonic-gate dn=("ipNetworkNumber=%s,", number ), \ 46057c478bd9Sstevel@tonic-gate cn=name, \ 46067c478bd9Sstevel@tonic-gate cn=rf_key 46077c478bd9Sstevel@tonic-gatenisLDAPattributeFromField networks.byaddr: \ 46087c478bd9Sstevel@tonic-gate dn=("ipNetworkNumber=%s,", rf_key ), \ 46097c478bd9Sstevel@tonic-gate cn=name 46107c478bd9Sstevel@tonic-gatenisLDAPattributeFromField networks: \ 46117c478bd9Sstevel@tonic-gate (cn)=(aliases, " "), \ 46127c478bd9Sstevel@tonic-gate ipNetworkNumber=number, \ 46137c478bd9Sstevel@tonic-gate description=rf_comment 46147c478bd9Sstevel@tonic-gate' >> $MAP_FILE 46157c478bd9Sstevel@tonic-gate 46167c478bd9Sstevel@tonic-gate 46177c478bd9Sstevel@tonic-gate# passwd syntax is different when passwd.adjunct map is present. 46187c478bd9Sstevel@tonic-gate# So, need to handle the various possibilities 46197c478bd9Sstevel@tonic-gate 46207c478bd9Sstevel@tonic-gate_MAP=passwd.adjunct.byname 46217c478bd9Sstevel@tonic-gate 46227c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 46237c478bd9Sstevel@tonic-gatethen 46247c478bd9Sstevel@tonic-gate 46257c478bd9Sstevel@tonic-gate # Just put the passwd.adjunct syntax in comment form 46267c478bd9Sstevel@tonic-gate 46277c478bd9Sstevel@tonic-gate echo '# passwd 46287c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.byname: \ 46297c478bd9Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 46307c478bd9Sstevel@tonic-gate uid=rf_key, \ 46317c478bd9Sstevel@tonic-gate uidNumber=uid 46327c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.byuid: \ 46337c478bd9Sstevel@tonic-gate dn=("uid=%s,", name ), \ 46347c478bd9Sstevel@tonic-gate uidNumber=rf_key, \ 46357c478bd9Sstevel@tonic-gate uid=name 46367c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd: \ 46377c478bd9Sstevel@tonic-gate cn=name, \ 46387c478bd9Sstevel@tonic-gate userPassword=("{crypt}%s",passwd), \ 46397c478bd9Sstevel@tonic-gate gidNumber=gid, \ 46407c478bd9Sstevel@tonic-gate gecos=gecos, \ 46417c478bd9Sstevel@tonic-gate homeDirectory=home, \ 46427c478bd9Sstevel@tonic-gate loginShell=shell 46437c478bd9Sstevel@tonic-gate 46447c478bd9Sstevel@tonic-gate# 46457c478bd9Sstevel@tonic-gate# If you are using passwd.adjunct, comment the passwd section above 46467c478bd9Sstevel@tonic-gate# and uncomment the following passwd and passwd.adjunct sections 46477c478bd9Sstevel@tonic-gate# 46487c478bd9Sstevel@tonic-gate# passwd 46497c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField passwd.byname: \ 46507c478bd9Sstevel@tonic-gate# dn=("uid=%s,", rf_key ), \ 46517c478bd9Sstevel@tonic-gate# uid=rf_key, \ 46527c478bd9Sstevel@tonic-gate# uidNumber=uid 46537c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField passwd.byuid: \ 46547c478bd9Sstevel@tonic-gate# dn=("uid=%s,", name ), \ 46557c478bd9Sstevel@tonic-gate# uidNumber=rf_key, \ 46567c478bd9Sstevel@tonic-gate# uid=name 46577c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField passwd: \ 46587c478bd9Sstevel@tonic-gate# cn=name, \ 46597c478bd9Sstevel@tonic-gate# gidNumber=gid, \ 46607c478bd9Sstevel@tonic-gate# gecos=gecos, \ 46617c478bd9Sstevel@tonic-gate# homeDirectory=home, \ 46627c478bd9Sstevel@tonic-gate# loginShell=shell 46637c478bd9Sstevel@tonic-gate 46647c478bd9Sstevel@tonic-gate# passwd.adjunct 46657c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField passwd.adjunct.byname: \ 46667c478bd9Sstevel@tonic-gate# dn=("uid=%s,", rf_key ), \ 46677c478bd9Sstevel@tonic-gate# uid=name, \ 46687c478bd9Sstevel@tonic-gate# userPassword=("{crypt}%s",passwd) 46697c478bd9Sstevel@tonic-gate' >> $MAP_FILE 46707c478bd9Sstevel@tonic-gate 46717c478bd9Sstevel@tonic-gateelse 46727c478bd9Sstevel@tonic-gate 46737c478bd9Sstevel@tonic-gate # Find the domains in which passwd.adjunct map exists. 46747c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 46757c478bd9Sstevel@tonic-gate 46767c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 46777c478bd9Sstevel@tonic-gate then 46787c478bd9Sstevel@tonic-gate 46797c478bd9Sstevel@tonic-gate # All the domains have passwd.adjunct map. So, put the right 46807c478bd9Sstevel@tonic-gate # passwd syntax and comment-in the passwd.adjunct syntax. 46817c478bd9Sstevel@tonic-gate 46827c478bd9Sstevel@tonic-gate 46837c478bd9Sstevel@tonic-gate echo '# passwd 46847c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField passwd.byname: \ 46857c478bd9Sstevel@tonic-gate# dn=("uid=%s,", rf_key ), \ 46867c478bd9Sstevel@tonic-gate# uid=rf_key, \ 46877c478bd9Sstevel@tonic-gate# uidNumber=uid 46887c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField passwd.byuid: \ 46897c478bd9Sstevel@tonic-gate# dn=("uid=%s,", name ), \ 46907c478bd9Sstevel@tonic-gate# uidNumber=rf_key, \ 46917c478bd9Sstevel@tonic-gate# uid=name 46927c478bd9Sstevel@tonic-gate#nisLDAPattributeFromField passwd: \ 46937c478bd9Sstevel@tonic-gate# cn=name, \ 46947c478bd9Sstevel@tonic-gate# userPassword=("{crypt}%s",passwd), \ 46957c478bd9Sstevel@tonic-gate# gidNumber=gid, \ 46967c478bd9Sstevel@tonic-gate# gecos=gecos, \ 46977c478bd9Sstevel@tonic-gate# homeDirectory=home, \ 46987c478bd9Sstevel@tonic-gate# loginShell=shell 46997c478bd9Sstevel@tonic-gate 47007c478bd9Sstevel@tonic-gate# If you are not using passwd.adjunct, uncomment the passwd section above 47017c478bd9Sstevel@tonic-gate# and comment the following passwd and passwd.adjunct sections 47027c478bd9Sstevel@tonic-gate# 47037c478bd9Sstevel@tonic-gate# passwd 47047c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.byname: \ 47057c478bd9Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 47067c478bd9Sstevel@tonic-gate uid=rf_key, \ 47077c478bd9Sstevel@tonic-gate uidNumber=uid 47087c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.byuid: \ 47097c478bd9Sstevel@tonic-gate dn=("uid=%s,", name ), \ 47107c478bd9Sstevel@tonic-gate uidNumber=rf_key, \ 47117c478bd9Sstevel@tonic-gate uid=name 47127c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd: \ 47137c478bd9Sstevel@tonic-gate cn=name, \ 47147c478bd9Sstevel@tonic-gate gidNumber=gid, \ 47157c478bd9Sstevel@tonic-gate gecos=gecos, \ 47167c478bd9Sstevel@tonic-gate homeDirectory=home, \ 47177c478bd9Sstevel@tonic-gate loginShell=shell 47187c478bd9Sstevel@tonic-gate 47197c478bd9Sstevel@tonic-gate# passwd.adjunct 47207c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.adjunct.byname: \ 47217c478bd9Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 47227c478bd9Sstevel@tonic-gate uid=name, \ 47237c478bd9Sstevel@tonic-gate userPassword=("{crypt}%s",passwd) 47247c478bd9Sstevel@tonic-gate' >> $MAP_FILE 47257c478bd9Sstevel@tonic-gate 47267c478bd9Sstevel@tonic-gate else 47277c478bd9Sstevel@tonic-gate # Not every domain has passwd.adjunct map. 47287c478bd9Sstevel@tonic-gate 47297c478bd9Sstevel@tonic-gate # First put the password syntax with domain name for domains 47307c478bd9Sstevel@tonic-gate # in which passwd.adjunct exists. 47317c478bd9Sstevel@tonic-gate 47327c478bd9Sstevel@tonic-gate echo "# passwd" >> $MAP_FILE 47337c478bd9Sstevel@tonic-gate 47347c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 47357c478bd9Sstevel@tonic-gate do 47367c478bd9Sstevel@tonic-gate 47377c478bd9Sstevel@tonic-gate echo "\ 47387c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.byname,${_DMN}: \\ 47397c478bd9Sstevel@tonic-gate dn=(\"uid=%s,\", rf_key ), \\ 47407c478bd9Sstevel@tonic-gate uid=rf_key, \\ 47417c478bd9Sstevel@tonic-gate uidNumber=uid 47427c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.byuid,${_DMN}: \\ 47437c478bd9Sstevel@tonic-gate dn=(\"uid=%s,\", name ), \\ 47447c478bd9Sstevel@tonic-gate uidNumber=rf_key, \\ 47457c478bd9Sstevel@tonic-gate uid=name 47467c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd,${_DMN}: \\ 47477c478bd9Sstevel@tonic-gate cn=name, \\ 47487c478bd9Sstevel@tonic-gate gidNumber=gid, \\ 47497c478bd9Sstevel@tonic-gate gecos=gecos, \\ 47507c478bd9Sstevel@tonic-gate homeDirectory=home, \\ 47517c478bd9Sstevel@tonic-gate loginShell=shell 47527c478bd9Sstevel@tonic-gate" >> $MAP_FILE 47537c478bd9Sstevel@tonic-gate done 47547c478bd9Sstevel@tonic-gate 47557c478bd9Sstevel@tonic-gate # Now put the other passwd syntax. We do not need to 47567c478bd9Sstevel@tonic-gate # append the domain name here. 47577c478bd9Sstevel@tonic-gate 47587c478bd9Sstevel@tonic-gate echo ' 47597c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.byname: \ 47607c478bd9Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 47617c478bd9Sstevel@tonic-gate uid=rf_key, \ 47627c478bd9Sstevel@tonic-gate uidNumber=uid 47637c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.byuid: \ 47647c478bd9Sstevel@tonic-gate dn=("uid=%s,", name ), \ 47657c478bd9Sstevel@tonic-gate uidNumber=rf_key, \ 47667c478bd9Sstevel@tonic-gate uid=name 47677c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd: \ 47687c478bd9Sstevel@tonic-gate cn=name, \ 47697c478bd9Sstevel@tonic-gate userPassword=("{crypt}%s",passwd), \ 47707c478bd9Sstevel@tonic-gate gidNumber=gid, \ 47717c478bd9Sstevel@tonic-gate gecos=gecos, \ 47727c478bd9Sstevel@tonic-gate homeDirectory=home, \ 47737c478bd9Sstevel@tonic-gate loginShell=shell 47747c478bd9Sstevel@tonic-gate' >> $MAP_FILE 47757c478bd9Sstevel@tonic-gate 47767c478bd9Sstevel@tonic-gate # Now we need to put the passwd.adjunct syntax for domains 47777c478bd9Sstevel@tonic-gate # in which this map exists. 47787c478bd9Sstevel@tonic-gate 47797c478bd9Sstevel@tonic-gate echo "# passwd.adjunct" >> $MAP_FILE 47807c478bd9Sstevel@tonic-gate 47817c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 47827c478bd9Sstevel@tonic-gate do 47837c478bd9Sstevel@tonic-gate 47847c478bd9Sstevel@tonic-gate echo "\ 47857c478bd9Sstevel@tonic-gatenisLDAPattributeFromField passwd.adjunct.byname,${_DMN}: \\ 47867c478bd9Sstevel@tonic-gate dn=(\"uid=%s,\", rf_key ), \\ 47877c478bd9Sstevel@tonic-gate uid=name, \\ 47887c478bd9Sstevel@tonic-gate userPassword=(\"{crypt}%s\",passwd) 47897c478bd9Sstevel@tonic-gate" >> $MAP_FILE 47907c478bd9Sstevel@tonic-gate done 47917c478bd9Sstevel@tonic-gate 47927c478bd9Sstevel@tonic-gate fi 47937c478bd9Sstevel@tonic-gate 47947c478bd9Sstevel@tonic-gatefi 47957c478bd9Sstevel@tonic-gate 47967c478bd9Sstevel@tonic-gateecho ' 47977c478bd9Sstevel@tonic-gate# This map is never created but yppasswd uses the mapping to extract password 47987c478bd9Sstevel@tonic-gate# aging information from the DIT. 47997c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ageing.byname: \ 48007c478bd9Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 48017c478bd9Sstevel@tonic-gate uid=name, \ 48027c478bd9Sstevel@tonic-gate shadowLastChange=lastchg, \ 48037c478bd9Sstevel@tonic-gate shadowMin=min, \ 48047c478bd9Sstevel@tonic-gate shadowMax=max, \ 48057c478bd9Sstevel@tonic-gate shadowWarning=warn, \ 48067c478bd9Sstevel@tonic-gate shadowInactive=inactive, \ 48077c478bd9Sstevel@tonic-gate shadowExpire=expire, \ 48087c478bd9Sstevel@tonic-gate shadowFlag=flag 48097c478bd9Sstevel@tonic-gate 48107c478bd9Sstevel@tonic-gate# printers.conf.byname 48117c478bd9Sstevel@tonic-gatenisLDAPattributeFromField printers.conf.byname: \ 48127c478bd9Sstevel@tonic-gate dn=("printer-uri=%s,", rf_key ), \ 48137c478bd9Sstevel@tonic-gate printer-name=rf_key, \ 48147c478bd9Sstevel@tonic-gate (printer-aliases)=(names, "|"), \ 48157c478bd9Sstevel@tonic-gate sun-printer-bsdaddr=(values, "*bsdaddr=%s:*"), \ 48167c478bd9Sstevel@tonic-gate (sun-printer-kvp)=(values,":"), \ 48177c478bd9Sstevel@tonic-gate description=rf_comment 48187c478bd9Sstevel@tonic-gate 48197c478bd9Sstevel@tonic-gate# prof_attr 48207c478bd9Sstevel@tonic-gatenisLDAPattributeFromField prof_attr: \ 48217c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 48227c478bd9Sstevel@tonic-gate cn=name, \ 48237c478bd9Sstevel@tonic-gate SolarisAttrReserved1=res1, \ 48247c478bd9Sstevel@tonic-gate SolarisAttrReserved2=res2, \ 48257c478bd9Sstevel@tonic-gate SolarisAttrLongDesc=desc, \ 48267c478bd9Sstevel@tonic-gate SolarisAttrKeyValue=attrs 48277c478bd9Sstevel@tonic-gate 48287c478bd9Sstevel@tonic-gate# project 48297c478bd9Sstevel@tonic-gatenisLDAPattributeFromField project.byname: \ 48307c478bd9Sstevel@tonic-gate dn=("SolarisProjectName=%s,", rf_key ) 48317c478bd9Sstevel@tonic-gatenisLDAPattributeFromField project.byprojid: \ 48327c478bd9Sstevel@tonic-gate dn=("SolarisProjectName=%s,", name ), \ 48337c478bd9Sstevel@tonic-gate SolarisProjectID=rf_searchkey 48347c478bd9Sstevel@tonic-gatenisLDAPattributeFromField project: \ 48357c478bd9Sstevel@tonic-gate SolarisProjectName=name, \ 48367c478bd9Sstevel@tonic-gate SolarisProjectID=projID, \ 48377c478bd9Sstevel@tonic-gate (memberUid)=(users, ","), \ 48387c478bd9Sstevel@tonic-gate (memberGid)=(groups, ","), \ 48397c478bd9Sstevel@tonic-gate (SolarisProjectAttr)=(attrs, ";"), \ 48407c478bd9Sstevel@tonic-gate description=comment 48417c478bd9Sstevel@tonic-gate 48427c478bd9Sstevel@tonic-gate# protocols 48437c478bd9Sstevel@tonic-gatenisLDAPattributeFromField protocols.byname: \ 48447c478bd9Sstevel@tonic-gate ipProtocolNumber=number, \ 48457c478bd9Sstevel@tonic-gate cn=rf_searchkey 48467c478bd9Sstevel@tonic-gatenisLDAPattributeFromField protocols.bynumber: \ 48477c478bd9Sstevel@tonic-gate ipProtocolNumber=rf_key, \ 48487c478bd9Sstevel@tonic-gate description=rf_comment 48497c478bd9Sstevel@tonic-gatenisLDAPattributeFromField protocols: \ 48507c478bd9Sstevel@tonic-gate dn=("cn=%s,", name ), \ 48517c478bd9Sstevel@tonic-gate (cn)=(aliases, " "), \ 48527c478bd9Sstevel@tonic-gate cn=name 48537c478bd9Sstevel@tonic-gate 48547c478bd9Sstevel@tonic-gate# rpc.bynumber 48557c478bd9Sstevel@tonic-gatenisLDAPattributeFromField rpc.bynumber: \ 48567c478bd9Sstevel@tonic-gate dn=("cn=%s,", name ), \ 48577c478bd9Sstevel@tonic-gate oncRpcNumber=rf_key, \ 48587c478bd9Sstevel@tonic-gate (cn)=(aliases, " "), \ 48597c478bd9Sstevel@tonic-gate cn=name, \ 48607c478bd9Sstevel@tonic-gate description=rf_comment 48617c478bd9Sstevel@tonic-gate 48627c478bd9Sstevel@tonic-gate# services 48637c478bd9Sstevel@tonic-gate# services.byservicename rule is only used to speed single search 48647c478bd9Sstevel@tonic-gatenisLDAPattributeFromField services.byservicename: \ 48657c478bd9Sstevel@tonic-gate ("%s/%s", cn, ipServiceProtocol) = rf_searchkey 48667c478bd9Sstevel@tonic-gate 48677c478bd9Sstevel@tonic-gatenisLDAPattributeFromField services.byname: \ 48687c478bd9Sstevel@tonic-gate dn=("cn=%s+ipServiceProtocol=%s,", name, protocol ), \ 48697c478bd9Sstevel@tonic-gate ("*/%s", ipServiceProtocol)=rf_key, \ 48707c478bd9Sstevel@tonic-gate ("%s/*", ipServicePort)=rf_key, \ 48717c478bd9Sstevel@tonic-gate (cn)=(aliases, " "), \ 48727c478bd9Sstevel@tonic-gate cn=name, \ 48737c478bd9Sstevel@tonic-gate description=rf_comment 48747c478bd9Sstevel@tonic-gate 48757c478bd9Sstevel@tonic-gate# timezone.byname 48767c478bd9Sstevel@tonic-gatenisLDAPattributeFromField timezone.byname: \ 48777c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key ), \ 48787c478bd9Sstevel@tonic-gate cn=hostName, \ 48797c478bd9Sstevel@tonic-gate nisplusTimeZone=zoneName, \ 48807c478bd9Sstevel@tonic-gate description=comment 48817c478bd9Sstevel@tonic-gate 48827c478bd9Sstevel@tonic-gate# user_attr 48837c478bd9Sstevel@tonic-gatenisLDAPattributeFromField user_attr: \ 48847c478bd9Sstevel@tonic-gate dn=("uid=%s,", rf_key ), \ 48857c478bd9Sstevel@tonic-gate uid=rf_key, \ 48867c478bd9Sstevel@tonic-gate SolarisUserAttr=qualifier, \ 48877c478bd9Sstevel@tonic-gate SolarisUserReserved1=res1, \ 48887c478bd9Sstevel@tonic-gate SolarisUserReserved2=res2, \ 48897c478bd9Sstevel@tonic-gate SolarisAttrKeyValue=attrs 48907c478bd9Sstevel@tonic-gate 48917c478bd9Sstevel@tonic-gate# publickey.byname 48927c478bd9Sstevel@tonic-gatenisLDAPattributeFromField keys.host: \ 48937c478bd9Sstevel@tonic-gate dn=("%s", ldap:dn:?one?("cn=%s", (yp:rf_key, "unix.%s@*"))), \ 48947c478bd9Sstevel@tonic-gate nisPublicKey=publicKey, \ 48957c478bd9Sstevel@tonic-gate nisSecretKey=secretKey 48967c478bd9Sstevel@tonic-gate 48977c478bd9Sstevel@tonic-gatenisLDAPattributeFromField keys.pass: \ 48987c478bd9Sstevel@tonic-gate dn=("%s", ldap:dn:?one?("uidNumber=%s", (yp:rf_key, "unix.%s@*"))), \ 48997c478bd9Sstevel@tonic-gate nisPublicKey=publicKey, \ 49007c478bd9Sstevel@tonic-gate nisSecretKey=secretKey 49017c478bd9Sstevel@tonic-gate 49027c478bd9Sstevel@tonic-gatenisLDAPattributeFromField keys.nobody: \ 49037c478bd9Sstevel@tonic-gate dn=("uid=%s,",yp:rf_key), \ 49047c478bd9Sstevel@tonic-gate cn=rf_key, \ 49057c478bd9Sstevel@tonic-gate nisPublicKey=publicKey, \ 49067c478bd9Sstevel@tonic-gate nisSecretKey=secretKey 49077c478bd9Sstevel@tonic-gate 49087c478bd9Sstevel@tonic-gate# ypservers. This derived from IPlanet implementation not RFC. 49097c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ypservers: \ 49107c478bd9Sstevel@tonic-gate dn=("cn=%s,", rf_key), \ 49117c478bd9Sstevel@tonic-gate cn=rf_key 49127c478bd9Sstevel@tonic-gate' >> $MAP_FILE 49137c478bd9Sstevel@tonic-gate} 49147c478bd9Sstevel@tonic-gate 49157c478bd9Sstevel@tonic-gate# 49167c478bd9Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 49177c478bd9Sstevel@tonic-gate# 49187c478bd9Sstevel@tonic-gatelist_auto_and_custom_nisLDAPattributeFromField() 49197c478bd9Sstevel@tonic-gate{ 49207c478bd9Sstevel@tonic-gate 49217c478bd9Sstevel@tonic-gate# auto.* entries are easy. 49227c478bd9Sstevel@tonic-gateif [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then 49237c478bd9Sstevel@tonic-gate echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE 49247c478bd9Sstevel@tonic-gatefi 49257c478bd9Sstevel@tonic-gate 49267c478bd9Sstevel@tonic-gatefor _MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} 49277c478bd9Sstevel@tonic-gatedo 49287c478bd9Sstevel@tonic-gate echo "\ 49297c478bd9Sstevel@tonic-gate# ${_MAP} 49307c478bd9Sstevel@tonic-gatenisLDAPattributeFromField ${_MAP}: \\ 49317c478bd9Sstevel@tonic-gate dn=(\"automountKey=%s,\", rf_key ), \\ 49327c478bd9Sstevel@tonic-gate automountKey=rf_key, \\ 49337c478bd9Sstevel@tonic-gate automountInformation=value 49347c478bd9Sstevel@tonic-gate" >> $MAP_FILE 49357c478bd9Sstevel@tonic-gatedone 49367c478bd9Sstevel@tonic-gate 49377c478bd9Sstevel@tonic-gate# Since we do not have enough information to generate 49387c478bd9Sstevel@tonic-gate# entries for other custom maps, best we can do is to 49397c478bd9Sstevel@tonic-gate# log this map names and ask user to take care of them. 49407c478bd9Sstevel@tonic-gate 49417c478bd9Sstevel@tonic-gateask_user_to_update_the_custom_map_entries_too 49427c478bd9Sstevel@tonic-gate 49437c478bd9Sstevel@tonic-gate} 49447c478bd9Sstevel@tonic-gate 49457c478bd9Sstevel@tonic-gate 49467c478bd9Sstevel@tonic-gate# 49477c478bd9Sstevel@tonic-gate# List mapping of named fields to DIT entries 49487c478bd9Sstevel@tonic-gate# 49497c478bd9Sstevel@tonic-gatecreate_nisLDAPattributeFromField() 49507c478bd9Sstevel@tonic-gate{ 49517c478bd9Sstevel@tonic-gate 49527c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 49537c478bd9Sstevel@tonic-gate# nisLDAPattributeFromField : It specifies how an LDAP attribute 49547c478bd9Sstevel@tonic-gate# value is derived from a NIS entries field values. 49557c478bd9Sstevel@tonic-gate# 49567c478bd9Sstevel@tonic-gate# The format of nisLDAPattributeFromField entry is : 49577c478bd9Sstevel@tonic-gate# mapName ":" fieldattrspec *("," fieldattrspec ) 49587c478bd9Sstevel@tonic-gate' >> $MAP_FILE 49597c478bd9Sstevel@tonic-gate 49607c478bd9Sstevel@tonic-gate# List all the default entries anyway. 49617c478bd9Sstevel@tonic-gatelist_default_nisLDAPattributeFromField 49627c478bd9Sstevel@tonic-gate 49637c478bd9Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 49647c478bd9Sstevel@tonic-gatelist_auto_and_custom_nisLDAPattributeFromField 49657c478bd9Sstevel@tonic-gate 49667c478bd9Sstevel@tonic-gateecho " 49677c478bd9Sstevel@tonic-gate# 49687c478bd9Sstevel@tonic-gate#------------------------------------------------------------------------------ 49697c478bd9Sstevel@tonic-gate# 49707c478bd9Sstevel@tonic-gate" >> $MAP_FILE 49717c478bd9Sstevel@tonic-gate} 49727c478bd9Sstevel@tonic-gate 49737c478bd9Sstevel@tonic-gate 49747c478bd9Sstevel@tonic-gate# 49757c478bd9Sstevel@tonic-gate# List all the default nisLDAPattributeFromField entries 49767c478bd9Sstevel@tonic-gate# 49777c478bd9Sstevel@tonic-gatelist_default_nisLDAPfieldFromAttribute() 49787c478bd9Sstevel@tonic-gate{ 49797c478bd9Sstevel@tonic-gateecho ' 49807c478bd9Sstevel@tonic-gate# Describe how named fields are mapped from DIT entries. 49817c478bd9Sstevel@tonic-gate 49827c478bd9Sstevel@tonic-gate# audit_user 49837c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute audit_user: \ 49847c478bd9Sstevel@tonic-gate ("uid=%s,*", rf_key)=dn, \ 49857c478bd9Sstevel@tonic-gate ("uid=%s,*", name)=dn, \ 49867c478bd9Sstevel@tonic-gate alwaysAuditFlags=SolarisAuditAlways, \ 49877c478bd9Sstevel@tonic-gate neverAuditFlags=SolarisAuditNever 49887c478bd9Sstevel@tonic-gate 49897c478bd9Sstevel@tonic-gate# auto.home 49907c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute auto.home: \ 49917c478bd9Sstevel@tonic-gate rf_key=automountKey, \ 49927c478bd9Sstevel@tonic-gate value=automountInformation 49937c478bd9Sstevel@tonic-gate 49947c478bd9Sstevel@tonic-gate# auto.master 49957c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute auto.master: \ 49967c478bd9Sstevel@tonic-gate rf_key=automountKey, \ 49977c478bd9Sstevel@tonic-gate value=automountInformation 49987c478bd9Sstevel@tonic-gate 49997c478bd9Sstevel@tonic-gate# auth_attr 50007c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute auth_attr: \ 50017c478bd9Sstevel@tonic-gate rf_key=cn, \ 50027c478bd9Sstevel@tonic-gate name=cn, \ 50037c478bd9Sstevel@tonic-gate res1=SolarisAttrReserved1, \ 50047c478bd9Sstevel@tonic-gate res2=SolarisAttrReserved2, \ 50057c478bd9Sstevel@tonic-gate short_desc=SolarisAttrShortDesc, \ 50067c478bd9Sstevel@tonic-gate long_desc=SolarisAttrLongDesc, \ 50077c478bd9Sstevel@tonic-gate attrs=SolarisAttrKeyValue 50087c478bd9Sstevel@tonic-gate 50097c478bd9Sstevel@tonic-gate# Exec_attr. Because of messy NIS keys special handlind is required here 50107c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute exec_attr: \ 50117c478bd9Sstevel@tonic-gate rf_key=("%s:%s:%s",cn,SolarisKernelSecurityPolicy, \ 50127c478bd9Sstevel@tonic-gate solarisProfileId), \ 50137c478bd9Sstevel@tonic-gate name=cn, \ 50147c478bd9Sstevel@tonic-gate policy=SolarisKernelSecurityPolicy, \ 50157c478bd9Sstevel@tonic-gate type=SolarisProfileType, \ 50167c478bd9Sstevel@tonic-gate res1=SolarisAttrReserved1, \ 50177c478bd9Sstevel@tonic-gate res2=SolarisAttrReserved2, \ 50187c478bd9Sstevel@tonic-gate id=SolarisProfileId, \ 50197c478bd9Sstevel@tonic-gate attrs=SolarisAttrKeyValue 50207c478bd9Sstevel@tonic-gate 50217c478bd9Sstevel@tonic-gate 50227c478bd9Sstevel@tonic-gate# ethers 50237c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ethers.byname: \ 50247c478bd9Sstevel@tonic-gate rf_key=cn 50257c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ethers.byaddr: \ 50267c478bd9Sstevel@tonic-gate rf_key=macAddress 50277c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ethers: \ 50287c478bd9Sstevel@tonic-gate name=cn, \ 50297c478bd9Sstevel@tonic-gate addr=macAddress, \ 50307c478bd9Sstevel@tonic-gate rf_comment=description 50317c478bd9Sstevel@tonic-gate 50327c478bd9Sstevel@tonic-gate# bootparams. Must be done after ethers 50337c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute bootparams: \ 50347c478bd9Sstevel@tonic-gate rf_key=cn, \ 50357c478bd9Sstevel@tonic-gate params=("%s ", (bootParameter), " ") 50367c478bd9Sstevel@tonic-gate' >> $MAP_FILE 50377c478bd9Sstevel@tonic-gate 50387c478bd9Sstevel@tonic-gate# group syntax is different when group.adjunct map is present. 50397c478bd9Sstevel@tonic-gate# So, need to handle the various possibilities 50407c478bd9Sstevel@tonic-gate 50417c478bd9Sstevel@tonic-gate_MAP=group.adjunct.byname 50427c478bd9Sstevel@tonic-gate 50437c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 50447c478bd9Sstevel@tonic-gatethen 50457c478bd9Sstevel@tonic-gate 50467c478bd9Sstevel@tonic-gate # Just put the group.adjunct syntax in comment form 50477c478bd9Sstevel@tonic-gate 50487c478bd9Sstevel@tonic-gate echo '# group 50497c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.byname: \ 50507c478bd9Sstevel@tonic-gate rf_key=cn 50517c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.bygid: \ 50527c478bd9Sstevel@tonic-gate rf_key=gidNumber 50537c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group: \ 50547c478bd9Sstevel@tonic-gate gid=gidNumber, \ 50557c478bd9Sstevel@tonic-gate name=cn, \ 50567c478bd9Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword, \ 50577c478bd9Sstevel@tonic-gate users=("%s,", (memberUid), ",") 50587c478bd9Sstevel@tonic-gate 50597c478bd9Sstevel@tonic-gate# 50607c478bd9Sstevel@tonic-gate# If you are using group.adjunct, comment the group section above 50617c478bd9Sstevel@tonic-gate# and uncomment the following group and group.adjunct section 50627c478bd9Sstevel@tonic-gate# 50637c478bd9Sstevel@tonic-gate# group 50647c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.byname: \ 50657c478bd9Sstevel@tonic-gate# rf_key=cn 50667c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.bygid: \ 50677c478bd9Sstevel@tonic-gate# rf_key=gidNumber 50687c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute group: \ 50697c478bd9Sstevel@tonic-gate# gid=gidNumber, \ 50707c478bd9Sstevel@tonic-gate# name=cn, \ 50717c478bd9Sstevel@tonic-gate# passwd=("#$%s", cn), \ 50727c478bd9Sstevel@tonic-gate# users=("%s,", (memberUid), ",") 50737c478bd9Sstevel@tonic-gate 50747c478bd9Sstevel@tonic-gate# group.adjunct 50757c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.adjunct.byname: \ 50767c478bd9Sstevel@tonic-gate# rf_key=cn, \ 50777c478bd9Sstevel@tonic-gate# name=cn, \ 50787c478bd9Sstevel@tonic-gate# ("{crypt}%s", passwd)=userPassword 50797c478bd9Sstevel@tonic-gate' >> $MAP_FILE 50807c478bd9Sstevel@tonic-gate 50817c478bd9Sstevel@tonic-gateelse 50827c478bd9Sstevel@tonic-gate 50837c478bd9Sstevel@tonic-gate # Find the domains in which group.adjunct map exists. 50847c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 50857c478bd9Sstevel@tonic-gate 50867c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 50877c478bd9Sstevel@tonic-gate then 50887c478bd9Sstevel@tonic-gate 50897c478bd9Sstevel@tonic-gate # All the domains have group.adjunct map. 50907c478bd9Sstevel@tonic-gate 50917c478bd9Sstevel@tonic-gate 50927c478bd9Sstevel@tonic-gate echo '# group 50937c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.byname: \ 50947c478bd9Sstevel@tonic-gate# rf_key=cn 50957c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute group.bygid: \ 50967c478bd9Sstevel@tonic-gate# rf_key=gidNumber 50977c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute group: \ 50987c478bd9Sstevel@tonic-gate# gid=gidNumber, \ 50997c478bd9Sstevel@tonic-gate# name=cn, \ 51007c478bd9Sstevel@tonic-gate# ("{crypt}%s", passwd)=userPassword, \ 51017c478bd9Sstevel@tonic-gate# users=("%s,", (memberUid), ",") 51027c478bd9Sstevel@tonic-gate 51037c478bd9Sstevel@tonic-gate# 51047c478bd9Sstevel@tonic-gate# If you are not using group.adjunct, comment the group section above 51057c478bd9Sstevel@tonic-gate# and uncomment the following group and group.adjunct sections 51067c478bd9Sstevel@tonic-gate# 51077c478bd9Sstevel@tonic-gate# group 51087c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.byname: \ 51097c478bd9Sstevel@tonic-gate rf_key=cn 51107c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.bygid: \ 51117c478bd9Sstevel@tonic-gate rf_key=gidNumber 51127c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group: \ 51137c478bd9Sstevel@tonic-gate gid=gidNumber, \ 51147c478bd9Sstevel@tonic-gate name=cn, \ 51157c478bd9Sstevel@tonic-gate passwd=("#$%s", cn), \ 51167c478bd9Sstevel@tonic-gate users=("%s,", (memberUid), ",") 51177c478bd9Sstevel@tonic-gate 51187c478bd9Sstevel@tonic-gate# 51197c478bd9Sstevel@tonic-gate# group.adjunct 51207c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.adjunct.byname: \ 51217c478bd9Sstevel@tonic-gate rf_key=cn, \ 51227c478bd9Sstevel@tonic-gate name=cn, \ 51237c478bd9Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword 51247c478bd9Sstevel@tonic-gate' >> $MAP_FILE 51257c478bd9Sstevel@tonic-gate 51267c478bd9Sstevel@tonic-gate else 51277c478bd9Sstevel@tonic-gate # Not every domain has group.adjunct map. 51287c478bd9Sstevel@tonic-gate 51297c478bd9Sstevel@tonic-gate echo "# group" >> $MAP_FILE 51307c478bd9Sstevel@tonic-gate 51317c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 51327c478bd9Sstevel@tonic-gate do 51337c478bd9Sstevel@tonic-gate 51347c478bd9Sstevel@tonic-gate echo "\ 51357c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.byname,${_DMN}: \\ 51367c478bd9Sstevel@tonic-gate rf_key=cn 51377c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.bygid,${_DMN}: \\ 51387c478bd9Sstevel@tonic-gate rf_key=gidNumber 51397c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group,${_DMN}: \\ 51407c478bd9Sstevel@tonic-gate gid=gidNumber, \\ 51417c478bd9Sstevel@tonic-gate name=cn, \\ 51427c478bd9Sstevel@tonic-gate passwd=(\"#$%s\", cn), \\ 51437c478bd9Sstevel@tonic-gate users=(\"%s,\", (memberUid), \",\") 51447c478bd9Sstevel@tonic-gate" >> $MAP_FILE 51457c478bd9Sstevel@tonic-gate done 51467c478bd9Sstevel@tonic-gate 51477c478bd9Sstevel@tonic-gate # Now put the generic group syntax. We do not need to 51487c478bd9Sstevel@tonic-gate # append the domain name here. 51497c478bd9Sstevel@tonic-gate 51507c478bd9Sstevel@tonic-gate echo ' 51517c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.byname: \ 51527c478bd9Sstevel@tonic-gate rf_key=cn 51537c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.bygid: \ 51547c478bd9Sstevel@tonic-gate rf_key=gidNumber 51557c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group: \ 51567c478bd9Sstevel@tonic-gate gid=gidNumber, \ 51577c478bd9Sstevel@tonic-gate name=cn, \ 51587c478bd9Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword, \ 51597c478bd9Sstevel@tonic-gate users=("%s,", (memberUid), ",") 51607c478bd9Sstevel@tonic-gate' >> $MAP_FILE 51617c478bd9Sstevel@tonic-gate 51627c478bd9Sstevel@tonic-gate # Now we need to put the group.adjunct syntax for domains 51637c478bd9Sstevel@tonic-gate # in which this map exists. 51647c478bd9Sstevel@tonic-gate 51657c478bd9Sstevel@tonic-gate echo "# 51667c478bd9Sstevel@tonic-gate# group.adjunct 51677c478bd9Sstevel@tonic-gate# " >> $MAP_FILE 51687c478bd9Sstevel@tonic-gate 51697c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 51707c478bd9Sstevel@tonic-gate do 51717c478bd9Sstevel@tonic-gate 51727c478bd9Sstevel@tonic-gate echo "\ 51737c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute group.adjunct.byname,${_DMN}: \\ 51747c478bd9Sstevel@tonic-gate rf_key=cn, \\ 51757c478bd9Sstevel@tonic-gate name=cn, \\ 51767c478bd9Sstevel@tonic-gate (\"{crypt}%s\", passwd)=userPassword 51777c478bd9Sstevel@tonic-gate" >> $MAP_FILE 51787c478bd9Sstevel@tonic-gate 51797c478bd9Sstevel@tonic-gate done 51807c478bd9Sstevel@tonic-gate 51817c478bd9Sstevel@tonic-gate fi 51827c478bd9Sstevel@tonic-gate 51837c478bd9Sstevel@tonic-gatefi 51847c478bd9Sstevel@tonic-gate 51857c478bd9Sstevel@tonic-gateecho ' 51867c478bd9Sstevel@tonic-gate# hosts 51877c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute hosts.byaddr: \ 51887c478bd9Sstevel@tonic-gate rf_ipkey=ipHostNumber 51897c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute hosts.byname: \ 51907c478bd9Sstevel@tonic-gate (rf_key)=(cn) 51917c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute hosts: \ 51927c478bd9Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", canonicalName)=dn, \ 51937c478bd9Sstevel@tonic-gate addr=ipHostNumber, \ 51947c478bd9Sstevel@tonic-gate aliases=("%s ", (cn) - yp:canonicalName, " "), \ 51957c478bd9Sstevel@tonic-gate rf_comment=description 51967c478bd9Sstevel@tonic-gate 51977c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute multihosts: \ 51987c478bd9Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", canonicalName)=dn, \ 51997c478bd9Sstevel@tonic-gate (rf_key)=("YP_MULTI_%s", cn), \ 52007c478bd9Sstevel@tonic-gate aliases=("%s ", (cn) - yp:canonicalName, " "), \ 52017c478bd9Sstevel@tonic-gate rf_comment=description, \ 52027c478bd9Sstevel@tonic-gate (tmp)=("%s", ipHostNumber:?one?("(&(cn=%s) \ 52037c478bd9Sstevel@tonic-gate (ipHostNumber=*.*))", yp:canonicalName)), \ 52047c478bd9Sstevel@tonic-gate addr=("%s,", (yp:tmp), ",") 52057c478bd9Sstevel@tonic-gate 52067c478bd9Sstevel@tonic-gate# ipnodes 52077c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ipnodes.byaddr: \ 52087c478bd9Sstevel@tonic-gate rf_ipkey=ipHostNumber 52097c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ipnodes.byname: \ 5210*c3e9074dSBen Chang (rf_key)=(cn) 52117c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ipnodes: \ 52127c478bd9Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", canonicalName)=dn, \ 52137c478bd9Sstevel@tonic-gate addr=ipHostNumber, \ 52147c478bd9Sstevel@tonic-gate aliases=("%s ", (cn) - yp:canonicalName, " "), \ 52157c478bd9Sstevel@tonic-gate rf_comment=description 52167c478bd9Sstevel@tonic-gate 52177c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute multiipnodes: \ 52187c478bd9Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", canonicalName)=dn, \ 52197c478bd9Sstevel@tonic-gate (rf_key)=("YP_MULTI_%s", cn), \ 52207c478bd9Sstevel@tonic-gate aliases=("%s ", (cn) - yp:canonicalName, " "), \ 52217c478bd9Sstevel@tonic-gate rf_comment=description, \ 52227c478bd9Sstevel@tonic-gate (tmp)=("%s", ipHostNumber:?one?("(&(cn=%s) \ 52237c478bd9Sstevel@tonic-gate (ipHostNumber=*:*))", yp:canonicalName)), \ 52247c478bd9Sstevel@tonic-gate addr=("%s,", (yp:tmp), ",") 52257c478bd9Sstevel@tonic-gate 52267c478bd9Sstevel@tonic-gate#mail.aliases 52277c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute mail.aliases: \ 52287c478bd9Sstevel@tonic-gate rf_key=mail, \ 52297c478bd9Sstevel@tonic-gate addresses= ("%s,", (mgrprfc822mailmember), ","), \ 52307c478bd9Sstevel@tonic-gate rf_comment=description 52317c478bd9Sstevel@tonic-gate 52327c478bd9Sstevel@tonic-gate#mail.mapping 52337c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute mail.mapping: \ 52347c478bd9Sstevel@tonic-gate rf_key=mgrprfc822mailmember, \ 52357c478bd9Sstevel@tonic-gate address=mail, \ 52367c478bd9Sstevel@tonic-gate rf_comment=description 52377c478bd9Sstevel@tonic-gate 52387c478bd9Sstevel@tonic-gate# netgroup. 52397c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute netgroup: \ 52407c478bd9Sstevel@tonic-gate rf_key=cn, \ 52417c478bd9Sstevel@tonic-gate (group)=(memberNisNetgroup), \ 52427c478bd9Sstevel@tonic-gate ("(%s,%s,%s)", host, user, domain)= \ 52437c478bd9Sstevel@tonic-gate (nisNetgroupTriple), \ 52447c478bd9Sstevel@tonic-gate rf_comment=description 52457c478bd9Sstevel@tonic-gate 52467c478bd9Sstevel@tonic-gate# netid.pass 52477c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute netid.pass: \ 52487c478bd9Sstevel@tonic-gate number=uidNumber, \ 52497c478bd9Sstevel@tonic-gate (tmp)=("%s", gidNumber:ou=group,?one?\ 52507c478bd9Sstevel@tonic-gate ("memberUid=%s", ldap:uid)), \ 52517c478bd9Sstevel@tonic-gate sgid=("%s,", (yp:tmp) - gidNumber, ","), \ 52527c478bd9Sstevel@tonic-gate data=("%s,%s", gidNumber, yp:sgid), \ 52537c478bd9Sstevel@tonic-gate data=gidNumber, \ 52547c478bd9Sstevel@tonic-gate (rf_key)=("unix.%s@%s", yp:number, yp:rf_domain) 52557c478bd9Sstevel@tonic-gate 52567c478bd9Sstevel@tonic-gate# netid.host 52577c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute netid.host: \ 52587c478bd9Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", data)=dn, \ 52597c478bd9Sstevel@tonic-gate number=("0"), \ 52607c478bd9Sstevel@tonic-gate (rf_key)=("unix.%s@%s", yp:data, yp:rf_domain) 52617c478bd9Sstevel@tonic-gate 52627c478bd9Sstevel@tonic-gate# netmasks.byaddr 52637c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute netmasks.byaddr: \ 52647c478bd9Sstevel@tonic-gate ("ipNetworkNumber=%s,*", rf_ipkey)=dn, \ 52657c478bd9Sstevel@tonic-gate mask=ipNetmaskNumber, \ 52667c478bd9Sstevel@tonic-gate rf_comment=description 52677c478bd9Sstevel@tonic-gate 52687c478bd9Sstevel@tonic-gate# networks. 52697c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute networks.byname: \ 52707c478bd9Sstevel@tonic-gate (rf_key)=(cn) 52717c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute networks.byaddr: \ 52727c478bd9Sstevel@tonic-gate ("ipNetworkNumber=%s,*", rf_key)=dn 52737c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute networks: \ 52747c478bd9Sstevel@tonic-gate name=cn, \ 52757c478bd9Sstevel@tonic-gate aliases=("%s ", (cn) - yp:name, " "), \ 52767c478bd9Sstevel@tonic-gate number=ipNetworkNumber, \ 52777c478bd9Sstevel@tonic-gate rf_comment=description 52787c478bd9Sstevel@tonic-gate' >> $MAP_FILE 52797c478bd9Sstevel@tonic-gate 52807c478bd9Sstevel@tonic-gate# passwd syntax is different when passwd.adjunct map is present. 52817c478bd9Sstevel@tonic-gate# So, need to handle the various possibilities 52827c478bd9Sstevel@tonic-gate 52837c478bd9Sstevel@tonic-gate_MAP=passwd.adjunct.byname 52847c478bd9Sstevel@tonic-gate 52857c478bd9Sstevel@tonic-gateif ! present $_MAP $ALL_DMN_DEF_MAPLIST 52867c478bd9Sstevel@tonic-gatethen 52877c478bd9Sstevel@tonic-gate 52887c478bd9Sstevel@tonic-gate # Just put the passwd.adjunct syntax in comment form 52897c478bd9Sstevel@tonic-gate 52907c478bd9Sstevel@tonic-gate echo '# passwd 52917c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byname: \ 52927c478bd9Sstevel@tonic-gate rf_key=uid 52937c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byuid: \ 52947c478bd9Sstevel@tonic-gate rf_key=uidNumber 52957c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd: \ 52967c478bd9Sstevel@tonic-gate name=uid, \ 52977c478bd9Sstevel@tonic-gate uid=uidNumber, \ 52987c478bd9Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword, \ 52997c478bd9Sstevel@tonic-gate gid=gidNumber, \ 53007c478bd9Sstevel@tonic-gate gecos=gecos, \ 53017c478bd9Sstevel@tonic-gate home=homeDirectory, \ 53027c478bd9Sstevel@tonic-gate shell=loginShell 53037c478bd9Sstevel@tonic-gate 53047c478bd9Sstevel@tonic-gate# 53057c478bd9Sstevel@tonic-gate# If you are using passwd.adjunct, comment the passwd section above 53067c478bd9Sstevel@tonic-gate# and uncomment the following passwd and passwd.adjunct sections 53077c478bd9Sstevel@tonic-gate# 53087c478bd9Sstevel@tonic-gate# passwd 53097c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.byname: \ 53107c478bd9Sstevel@tonic-gate# rf_key=uid 53117c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.byuid: \ 53127c478bd9Sstevel@tonic-gate# rf_key=uidNumber 53137c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd: \ 53147c478bd9Sstevel@tonic-gate# name=uid, \ 53157c478bd9Sstevel@tonic-gate# uid=uidNumber, \ 53167c478bd9Sstevel@tonic-gate# passwd=("##%s", uid), \ 53177c478bd9Sstevel@tonic-gate# gid=gidNumber, \ 53187c478bd9Sstevel@tonic-gate# gecos=gecos, \ 53197c478bd9Sstevel@tonic-gate# home=homeDirectory, \ 53207c478bd9Sstevel@tonic-gate# shell=loginShell 53217c478bd9Sstevel@tonic-gate 53227c478bd9Sstevel@tonic-gate# passwd.adjunct 53237c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.adjunct.byname: \ 53247c478bd9Sstevel@tonic-gate# rf_key=uid, \ 53257c478bd9Sstevel@tonic-gate# name=uid, \ 53267c478bd9Sstevel@tonic-gate# ("{crypt}%s", passwd)=userPassword 53277c478bd9Sstevel@tonic-gate' >> $MAP_FILE 53287c478bd9Sstevel@tonic-gate 53297c478bd9Sstevel@tonic-gateelse 53307c478bd9Sstevel@tonic-gate 53317c478bd9Sstevel@tonic-gate # Find the domains in which passwd.adjunct map exists. 53327c478bd9Sstevel@tonic-gate find_domains $_MAP DEF_MAPS 53337c478bd9Sstevel@tonic-gate 53347c478bd9Sstevel@tonic-gate if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ] 53357c478bd9Sstevel@tonic-gate then 53367c478bd9Sstevel@tonic-gate 53377c478bd9Sstevel@tonic-gate # All the domains have passwd.adjunct map. So, put the right 53387c478bd9Sstevel@tonic-gate # passwd syntax and comment-in the passwd.adjunct syntax. 53397c478bd9Sstevel@tonic-gate 53407c478bd9Sstevel@tonic-gate 53417c478bd9Sstevel@tonic-gate echo '# passwd 53427c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.byname: \ 53437c478bd9Sstevel@tonic-gate# rf_key=uid 53447c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd.byuid: \ 53457c478bd9Sstevel@tonic-gate# rf_key=uidNumber 53467c478bd9Sstevel@tonic-gate#nisLDAPfieldFromAttribute passwd: \ 53477c478bd9Sstevel@tonic-gate# name=uid, \ 53487c478bd9Sstevel@tonic-gate# uid=uidNumber, \ 53497c478bd9Sstevel@tonic-gate# ("{crypt}%s", passwd)=userPassword, \ 53507c478bd9Sstevel@tonic-gate# gid=gidNumber, \ 53517c478bd9Sstevel@tonic-gate# gecos=gecos, \ 53527c478bd9Sstevel@tonic-gate# home=homeDirectory, \ 53537c478bd9Sstevel@tonic-gate# shell=loginShell 53547c478bd9Sstevel@tonic-gate 53557c478bd9Sstevel@tonic-gate# 53567c478bd9Sstevel@tonic-gate# If you are not using passwd.adjunct, uncomment the passwd section 53577c478bd9Sstevel@tonic-gate# above and comment the following passwd and passwd.adjunct sections 53587c478bd9Sstevel@tonic-gate# 53597c478bd9Sstevel@tonic-gate# passwd 53607c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byname: \ 53617c478bd9Sstevel@tonic-gate rf_key=uid 53627c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byuid: \ 53637c478bd9Sstevel@tonic-gate rf_key=uidNumber 53647c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd: \ 53657c478bd9Sstevel@tonic-gate name=uid, \ 53667c478bd9Sstevel@tonic-gate uid=uidNumber, \ 53677c478bd9Sstevel@tonic-gate passwd=("##%s", uid), \ 53687c478bd9Sstevel@tonic-gate gid=gidNumber, \ 53697c478bd9Sstevel@tonic-gate gecos=gecos, \ 53707c478bd9Sstevel@tonic-gate home=homeDirectory, \ 53717c478bd9Sstevel@tonic-gate shell=loginShell 53727c478bd9Sstevel@tonic-gate 53737c478bd9Sstevel@tonic-gate# 53747c478bd9Sstevel@tonic-gate# passwd.adjunct Must follow passwd 53757c478bd9Sstevel@tonic-gate# 53767c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.adjunct.byname: \ 53777c478bd9Sstevel@tonic-gate rf_key=uid, \ 53787c478bd9Sstevel@tonic-gate name=uid, \ 53797c478bd9Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword 53807c478bd9Sstevel@tonic-gate' >> $MAP_FILE 53817c478bd9Sstevel@tonic-gate 53827c478bd9Sstevel@tonic-gate else 53837c478bd9Sstevel@tonic-gate # Not every domain has passwd.adjunct map. 53847c478bd9Sstevel@tonic-gate 53857c478bd9Sstevel@tonic-gate # First put the password syntax with domain name for domains 53867c478bd9Sstevel@tonic-gate # in which passwd.adjunct exists. 53877c478bd9Sstevel@tonic-gate 53887c478bd9Sstevel@tonic-gate echo "# passwd" >> $MAP_FILE 53897c478bd9Sstevel@tonic-gate 53907c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 53917c478bd9Sstevel@tonic-gate do 53927c478bd9Sstevel@tonic-gate 53937c478bd9Sstevel@tonic-gate echo "\ 53947c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byname,${_DMN}: \\ 53957c478bd9Sstevel@tonic-gate rf_key=uid 53967c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byuid,${_DMN}: \\ 53977c478bd9Sstevel@tonic-gate rf_key=uidNumber 53987c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd,${_DMN}: \\ 53997c478bd9Sstevel@tonic-gate name=uid, \\ 54007c478bd9Sstevel@tonic-gate uid=uidNumber, \\ 54017c478bd9Sstevel@tonic-gate passwd=(\"##%s\", uid), \\ 54027c478bd9Sstevel@tonic-gate gid=gidNumber, \\ 54037c478bd9Sstevel@tonic-gate gecos=gecos, \\ 54047c478bd9Sstevel@tonic-gate home=homeDirectory, \\ 54057c478bd9Sstevel@tonic-gate shell=loginShell 54067c478bd9Sstevel@tonic-gate" >> $MAP_FILE 54077c478bd9Sstevel@tonic-gate done 54087c478bd9Sstevel@tonic-gate 54097c478bd9Sstevel@tonic-gate # Now put the other passwd syntax. We do not need to 54107c478bd9Sstevel@tonic-gate # append the domain name here. 54117c478bd9Sstevel@tonic-gate 54127c478bd9Sstevel@tonic-gate echo ' 54137c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byname: \ 54147c478bd9Sstevel@tonic-gate rf_key=uid 54157c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.byuid: \ 54167c478bd9Sstevel@tonic-gate rf_key=uidNumber 54177c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd: \ 54187c478bd9Sstevel@tonic-gate name=uid, \ 54197c478bd9Sstevel@tonic-gate uid=uidNumber, \ 54207c478bd9Sstevel@tonic-gate ("{crypt}%s", passwd)=userPassword, \ 54217c478bd9Sstevel@tonic-gate gid=gidNumber, \ 54227c478bd9Sstevel@tonic-gate gecos=gecos, \ 54237c478bd9Sstevel@tonic-gate home=homeDirectory, \ 54247c478bd9Sstevel@tonic-gate shell=loginShell 54257c478bd9Sstevel@tonic-gate' >> $MAP_FILE 54267c478bd9Sstevel@tonic-gate 54277c478bd9Sstevel@tonic-gate # Now we need to put the passwd.adjunct syntax for domains 54287c478bd9Sstevel@tonic-gate # in which this map exists. 54297c478bd9Sstevel@tonic-gate 54307c478bd9Sstevel@tonic-gate echo "# 54317c478bd9Sstevel@tonic-gate# passwd.adjunct Must follow passwd 54327c478bd9Sstevel@tonic-gate# " >> $MAP_FILE 54337c478bd9Sstevel@tonic-gate 54347c478bd9Sstevel@tonic-gate for _DMN in $PRESENT_IN_DOMAINS 54357c478bd9Sstevel@tonic-gate do 54367c478bd9Sstevel@tonic-gate 54377c478bd9Sstevel@tonic-gate echo "\ 54387c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute passwd.adjunct.byname,${_DMN}: \\ 54397c478bd9Sstevel@tonic-gate rf_key=uid, \\ 54407c478bd9Sstevel@tonic-gate name=uid, \\ 54417c478bd9Sstevel@tonic-gate (\"{crypt}%s\", passwd)=userPassword 54427c478bd9Sstevel@tonic-gate" >> $MAP_FILE 54437c478bd9Sstevel@tonic-gate 54447c478bd9Sstevel@tonic-gate done 54457c478bd9Sstevel@tonic-gate 54467c478bd9Sstevel@tonic-gate fi 54477c478bd9Sstevel@tonic-gate 54487c478bd9Sstevel@tonic-gatefi 54497c478bd9Sstevel@tonic-gate 54507c478bd9Sstevel@tonic-gateecho ' 54517c478bd9Sstevel@tonic-gate# This map is never created but yppasswd uses the mapping to extract password 54527c478bd9Sstevel@tonic-gate# ageing information from the DIT. 54537c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ageing.byname: \ 54547c478bd9Sstevel@tonic-gate rf_key=uid, \ 54557c478bd9Sstevel@tonic-gate name=uid, \ 54567c478bd9Sstevel@tonic-gate lastchg=shadowLastChange, \ 54577c478bd9Sstevel@tonic-gate min=shadowMin, \ 54587c478bd9Sstevel@tonic-gate max=shadowMax, \ 54597c478bd9Sstevel@tonic-gate warn=shadowWarning, \ 54607c478bd9Sstevel@tonic-gate inactive=shadowInactive, \ 54617c478bd9Sstevel@tonic-gate expire=shadowExpire, \ 54627c478bd9Sstevel@tonic-gate flag=shadowFlag 54637c478bd9Sstevel@tonic-gate 54647c478bd9Sstevel@tonic-gate# printers.conf.byname 54657c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute printers.conf.byname: \ 54667c478bd9Sstevel@tonic-gate rf_key=printer-uri, \ 54677c478bd9Sstevel@tonic-gate names=("%s|", (printer-aliases), "|"), \ 54687c478bd9Sstevel@tonic-gate bsdaddr=("bsdaddr=%s", sun-printer-bsdaddr), \ 54697c478bd9Sstevel@tonic-gate kvps=("%s:", (sun-printer-kvp) - yp:bsdaddr), \ 54707c478bd9Sstevel@tonic-gate values=("%s:%s", yp:bsdaddr, yp:kvps), \ 54717c478bd9Sstevel@tonic-gate values=("%s:", yp:bsdaddr), \ 54727c478bd9Sstevel@tonic-gate values=yp:kvps, \ 54737c478bd9Sstevel@tonic-gate rf_comment=description 54747c478bd9Sstevel@tonic-gate 54757c478bd9Sstevel@tonic-gate# prof_attr 54767c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute prof_attr: \ 54777c478bd9Sstevel@tonic-gate rf_key=cn, \ 54787c478bd9Sstevel@tonic-gate name=cn, \ 54797c478bd9Sstevel@tonic-gate res1=SolarisAttrReserved1, \ 54807c478bd9Sstevel@tonic-gate res2=SolarisAttrReserved2, \ 54817c478bd9Sstevel@tonic-gate desc=SolarisAttrLongDesc, \ 54827c478bd9Sstevel@tonic-gate attrs=SolarisAttrKeyValue 54837c478bd9Sstevel@tonic-gate 54847c478bd9Sstevel@tonic-gate# project 54857c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute project.byname: \ 54867c478bd9Sstevel@tonic-gate rf_key=SolarisProjectName 54877c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute project.byprojid: \ 54887c478bd9Sstevel@tonic-gate rf_key=SolarisProjectID 54897c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute project: \ 54907c478bd9Sstevel@tonic-gate name=SolarisProjectName, \ 54917c478bd9Sstevel@tonic-gate projID=SolarisProjectID, \ 54927c478bd9Sstevel@tonic-gate comment=description, \ 54937c478bd9Sstevel@tonic-gate users=("%s,", (memberUid), ","), \ 54947c478bd9Sstevel@tonic-gate groups=("%s,", (memberGid), ","), \ 54957c478bd9Sstevel@tonic-gate attrs=("%s;", (SolarisProjectAttr), ";") 54967c478bd9Sstevel@tonic-gate 54977c478bd9Sstevel@tonic-gate# protocols 54987c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute protocols.byname: \ 54997c478bd9Sstevel@tonic-gate ("cn=%s,*", rf_key)=dn, \ 55007c478bd9Sstevel@tonic-gate (rf_key)=(cn) 55017c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute protocols.bynumber: \ 55027c478bd9Sstevel@tonic-gate rf_key=ipProtocolNumber, \ 55037c478bd9Sstevel@tonic-gate rf_comment=description 55047c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute protocols: \ 55057c478bd9Sstevel@tonic-gate ("cn=%s,*", name)=dn, \ 55067c478bd9Sstevel@tonic-gate number=ipProtocolNumber, \ 55077c478bd9Sstevel@tonic-gate aliases=("%s ", (cn) - yp:name, " ") 55087c478bd9Sstevel@tonic-gate 55097c478bd9Sstevel@tonic-gate# rpc.bynumber 55107c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute rpc.bynumber: \ 55117c478bd9Sstevel@tonic-gate rf_key=oncRpcNumber, \ 55127c478bd9Sstevel@tonic-gate number=oncRpcNumber, \ 55137c478bd9Sstevel@tonic-gate ("cn=%s,*", name)=dn, \ 55147c478bd9Sstevel@tonic-gate aliases=("%s ", (cn) - yp:name, " "), \ 55157c478bd9Sstevel@tonic-gate rf_comment=description 55167c478bd9Sstevel@tonic-gate 55177c478bd9Sstevel@tonic-gate# services 55187c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute services.byname: \ 55197c478bd9Sstevel@tonic-gate rf_key = ("%s/%s", ipServicePort, ipServiceProtocol) 55207c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute services.byservicename: \ 55217c478bd9Sstevel@tonic-gate (rf_key)=("%s/%s", cn, ipServiceProtocol), \ 55227c478bd9Sstevel@tonic-gate (rf_key)=(cn) 55237c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute services: \ 55247c478bd9Sstevel@tonic-gate ("cn=%s+ipServiceProtocol=*", name)=dn, \ 55257c478bd9Sstevel@tonic-gate protocol=ipServiceProtocol, \ 55267c478bd9Sstevel@tonic-gate port=ipServicePort, \ 55277c478bd9Sstevel@tonic-gate aliases=("%s ", (cn) - yp:name, " "), \ 55287c478bd9Sstevel@tonic-gate rf_comment=description 55297c478bd9Sstevel@tonic-gate 55307c478bd9Sstevel@tonic-gate# timezone.byname 55317c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute timezone.byname: \ 55327c478bd9Sstevel@tonic-gate rf_key=cn, \ 55337c478bd9Sstevel@tonic-gate hostName=cn, \ 55347c478bd9Sstevel@tonic-gate zoneName=nisplusTimeZone, \ 55357c478bd9Sstevel@tonic-gate rf_comment=description 55367c478bd9Sstevel@tonic-gate 55377c478bd9Sstevel@tonic-gate# user_attr 55387c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute user_attr: \ 55397c478bd9Sstevel@tonic-gate ("uid=%s,*", rf_key)=dn, \ 55407c478bd9Sstevel@tonic-gate ("uid=%s,*", user)=dn, \ 55417c478bd9Sstevel@tonic-gate qualifier=SolarisUserAttr, \ 55427c478bd9Sstevel@tonic-gate res1=SolarisUserReserved1, \ 55437c478bd9Sstevel@tonic-gate res2=SolarisUserReserved2, \ 55447c478bd9Sstevel@tonic-gate attrs=SolarisAttrKeyValue 55457c478bd9Sstevel@tonic-gate 55467c478bd9Sstevel@tonic-gate# publickey.byname 55477c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute keys.host: \ 55487c478bd9Sstevel@tonic-gate ("cn=%s+ipHostNumber=*", cname)=dn, \ 55497c478bd9Sstevel@tonic-gate rf_key=("unix.%s@%s", yp:cname, yp:rf_domain), \ 55507c478bd9Sstevel@tonic-gate publicKey=nisPublicKey, \ 55517c478bd9Sstevel@tonic-gate secretKey=nisSecretKey 55527c478bd9Sstevel@tonic-gate 55537c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute keys.pass: \ 55547c478bd9Sstevel@tonic-gate rf_key=("unix.%s@%s", uidNumber, yp:rf_domain), \ 55557c478bd9Sstevel@tonic-gate publicKey=nisPublicKey, \ 55567c478bd9Sstevel@tonic-gate secretKey=nisSecretKey 55577c478bd9Sstevel@tonic-gate 55587c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute keys.nobody: \ 55597c478bd9Sstevel@tonic-gate rf_key=uid, \ 55607c478bd9Sstevel@tonic-gate publicKey=nisPublicKey, \ 55617c478bd9Sstevel@tonic-gate secretKey=nisSecretKey 55627c478bd9Sstevel@tonic-gate 55637c478bd9Sstevel@tonic-gate# ypservers. This derived from IPlanet implementation not RFC. 55647c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ypservers: \ 55657c478bd9Sstevel@tonic-gate rf_key=cn 55667c478bd9Sstevel@tonic-gate' >> $MAP_FILE 55677c478bd9Sstevel@tonic-gate} 55687c478bd9Sstevel@tonic-gate 55697c478bd9Sstevel@tonic-gate 55707c478bd9Sstevel@tonic-gate# 55717c478bd9Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 55727c478bd9Sstevel@tonic-gate# 55737c478bd9Sstevel@tonic-gatelist_auto_and_custom_nisLDAPfieldFromAttribute() 55747c478bd9Sstevel@tonic-gate{ 55757c478bd9Sstevel@tonic-gate 55767c478bd9Sstevel@tonic-gate# auto.* entries are easy. 55777c478bd9Sstevel@tonic-gateif [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then 55787c478bd9Sstevel@tonic-gate echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE 55797c478bd9Sstevel@tonic-gatefi 55807c478bd9Sstevel@tonic-gate 55817c478bd9Sstevel@tonic-gatefor _MAP in ${ALL_DMN_AUTO_CUST_MAPS[*]} 55827c478bd9Sstevel@tonic-gatedo 55837c478bd9Sstevel@tonic-gate echo "\ 55847c478bd9Sstevel@tonic-gate# ${_MAP} 55857c478bd9Sstevel@tonic-gatenisLDAPfieldFromAttribute ${_MAP}: \\ 55867c478bd9Sstevel@tonic-gate rf_key=automountKey, \\ 55877c478bd9Sstevel@tonic-gate value=automountInformation 55887c478bd9Sstevel@tonic-gate" >> $MAP_FILE 55897c478bd9Sstevel@tonic-gatedone 55907c478bd9Sstevel@tonic-gate 55917c478bd9Sstevel@tonic-gate# Since we do not have enough information to generate 55927c478bd9Sstevel@tonic-gate# entries for other custom maps, best we can do is to 55937c478bd9Sstevel@tonic-gate# log this map names and ask user to take care of them. 55947c478bd9Sstevel@tonic-gate 55957c478bd9Sstevel@tonic-gateask_user_to_update_the_custom_map_entries_too 55967c478bd9Sstevel@tonic-gate 55977c478bd9Sstevel@tonic-gate} 55987c478bd9Sstevel@tonic-gate 55997c478bd9Sstevel@tonic-gate 56007c478bd9Sstevel@tonic-gate# 56017c478bd9Sstevel@tonic-gate# List mapping of named fields from DIT entries 56027c478bd9Sstevel@tonic-gate# 56037c478bd9Sstevel@tonic-gatecreate_nisLDAPfieldFromAttribute() 56047c478bd9Sstevel@tonic-gate{ 56057c478bd9Sstevel@tonic-gate 56067c478bd9Sstevel@tonic-gate[ CUST_CMT_NEEDED -eq 1 ] && echo ' 56077c478bd9Sstevel@tonic-gate# nisLDAPfieldFromAttribute : It specifies how a NIS entries 56087c478bd9Sstevel@tonic-gate# field values are derived from LDAP attribute values. 56097c478bd9Sstevel@tonic-gate# 56107c478bd9Sstevel@tonic-gate# The format of nisLDAPfieldFromAttribute is : 56117c478bd9Sstevel@tonic-gate# mapName ":" fieldattrspec *("," fieldattrspec) 56127c478bd9Sstevel@tonic-gate' >> $MAP_FILE 56137c478bd9Sstevel@tonic-gate 56147c478bd9Sstevel@tonic-gate# List all the default entries anyway. 56157c478bd9Sstevel@tonic-gatelist_default_nisLDAPfieldFromAttribute 56167c478bd9Sstevel@tonic-gate 56177c478bd9Sstevel@tonic-gate# List all the non-default auto.* and custom maps. 56187c478bd9Sstevel@tonic-gatelist_auto_and_custom_nisLDAPfieldFromAttribute 56197c478bd9Sstevel@tonic-gate 56207c478bd9Sstevel@tonic-gateecho " 56217c478bd9Sstevel@tonic-gate# 56227c478bd9Sstevel@tonic-gate#------------------------------------------------------------------------------ 56237c478bd9Sstevel@tonic-gate# 56247c478bd9Sstevel@tonic-gate" >> $MAP_FILE 56257c478bd9Sstevel@tonic-gate} 56267c478bd9Sstevel@tonic-gate 56277c478bd9Sstevel@tonic-gate 56287c478bd9Sstevel@tonic-gate 56297c478bd9Sstevel@tonic-gate# Main function for creating the mapping file 56307c478bd9Sstevel@tonic-gatecreate_mapping_file() 56317c478bd9Sstevel@tonic-gate{ 56327c478bd9Sstevel@tonic-gate# Ask user the list of domains to be served by N2L 56337c478bd9Sstevel@tonic-gatecreate_n2l_domain_list 56347c478bd9Sstevel@tonic-gate 56357c478bd9Sstevel@tonic-gate# If there are no N2L domains or none selected, then exit 56367c478bd9Sstevel@tonic-gateif [ $N2L_DMN_CNT -eq 0 ]; then 56377c478bd9Sstevel@tonic-gate echo "There are no domains to serve. No mapping file generated." 56387c478bd9Sstevel@tonic-gate return 1 56397c478bd9Sstevel@tonic-gatefi 56407c478bd9Sstevel@tonic-gate 56417c478bd9Sstevel@tonic-gatewhile : 56427c478bd9Sstevel@tonic-gatedo 56437c478bd9Sstevel@tonic-gate get_ans "Enter the mapping file name (h=help):" "${MAP_FILE}" 56447c478bd9Sstevel@tonic-gate 56457c478bd9Sstevel@tonic-gate # If help continue, otherwise break. 56467c478bd9Sstevel@tonic-gate case "$ANS" in 56477c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg new_mapping_file_name_help ;; 56487c478bd9Sstevel@tonic-gate * ) break ;; 56497c478bd9Sstevel@tonic-gate esac 56507c478bd9Sstevel@tonic-gatedone 56517c478bd9Sstevel@tonic-gate 56527c478bd9Sstevel@tonic-gateMAP_FILE=${ANS} 56537c478bd9Sstevel@tonic-gate[ $DEBUG -eq 1 ] && MAP_FILE = $MAP_FILE 56547c478bd9Sstevel@tonic-gate 56557c478bd9Sstevel@tonic-gate# Backup existing mapping file if selected 56567c478bd9Sstevel@tonic-gatecheck_back_mapping_file 56577c478bd9Sstevel@tonic-gate 56587c478bd9Sstevel@tonic-gate# To prevent from leaving a partial mapping file in case some error 56597c478bd9Sstevel@tonic-gate# or signal takes place which might result in machine starting in N2L 56607c478bd9Sstevel@tonic-gate# mode at next reboot, store the output being generated in a temporary 56617c478bd9Sstevel@tonic-gate# file first, and move it at the final destination only at the end if 56627c478bd9Sstevel@tonic-gate# everything goes fine. 56637c478bd9Sstevel@tonic-gate 56647c478bd9Sstevel@tonic-gate_MAP_FILE=$MAP_FILE 56657c478bd9Sstevel@tonic-gateMAP_FILE=${TMPDIR}/${TMPMAP}.$$ 56667c478bd9Sstevel@tonic-gate 56677c478bd9Sstevel@tonic-gateecho "Generating mapping file temporarily as \"${MAP_FILE}\"" 56687c478bd9Sstevel@tonic-gate 56697c478bd9Sstevel@tonic-gate# Place copyright information 56707c478bd9Sstevel@tonic-gateput_mapping_file_copyright_info 56717c478bd9Sstevel@tonic-gate 56727c478bd9Sstevel@tonic-gate 56737c478bd9Sstevel@tonic-gate# Prepare various map lists for each domain 56747c478bd9Sstevel@tonic-gatecreate_map_lists 56757c478bd9Sstevel@tonic-gate 56767c478bd9Sstevel@tonic-gate# List domains and contexts 56777c478bd9Sstevel@tonic-gateget_nisLDAPdomainContext 56787c478bd9Sstevel@tonic-gate 56797c478bd9Sstevel@tonic-gate# List domains for which passwords should be changed 56807c478bd9Sstevel@tonic-gateget_nisLDAPyppasswddDomains 56817c478bd9Sstevel@tonic-gate 56827c478bd9Sstevel@tonic-gate# List databaseId mappings (aliases) 56837c478bd9Sstevel@tonic-gatecreate_nisLDAPdatabaseIdMapping 56847c478bd9Sstevel@tonic-gate 56857c478bd9Sstevel@tonic-gate# List comment character for maps 56867c478bd9Sstevel@tonic-gatecreate_nisLDAPcommentChar 56877c478bd9Sstevel@tonic-gate 56887c478bd9Sstevel@tonic-gate# List SECURE and INTERDOMAIN flags 56897c478bd9Sstevel@tonic-gatecreate_nisLDAPmapFlags 56907c478bd9Sstevel@tonic-gate 56917c478bd9Sstevel@tonic-gate# List TTL values 56927c478bd9Sstevel@tonic-gate create_nisLDAPentryTtl 56937c478bd9Sstevel@tonic-gate 56947c478bd9Sstevel@tonic-gate# List name fields 56957c478bd9Sstevel@tonic-gatecreate_nisLDAPnameFields 56967c478bd9Sstevel@tonic-gate 56977c478bd9Sstevel@tonic-gate# List split fields and repeated fields seperators. 56987c478bd9Sstevel@tonic-gatecreate_split_field_and_repeatedfield_seperators 56997c478bd9Sstevel@tonic-gate 57007c478bd9Sstevel@tonic-gate# List association of maps with RDNs and object classes. 57017c478bd9Sstevel@tonic-gatecreate_nisLDAPobjectDN 57027c478bd9Sstevel@tonic-gate 57037c478bd9Sstevel@tonic-gate# List mapping of named fields to DIT entries 57047c478bd9Sstevel@tonic-gatecreate_nisLDAPattributeFromField 57057c478bd9Sstevel@tonic-gate 57067c478bd9Sstevel@tonic-gate# List mapping of named fields from DIT entries 57077c478bd9Sstevel@tonic-gatecreate_nisLDAPfieldFromAttribute 57087c478bd9Sstevel@tonic-gate 57097c478bd9Sstevel@tonic-gate 57107c478bd9Sstevel@tonic-gate# We are done, so move back the mapping file from temp. location 57117c478bd9Sstevel@tonic-gate# to actual location. 57127c478bd9Sstevel@tonic-gate# In case the mapping file name has a directory component which does 57137c478bd9Sstevel@tonic-gate# not exist, then create it now, otherwise 'mv' will return error. 57147c478bd9Sstevel@tonic-gate 57157c478bd9Sstevel@tonic-gateDIR_TO_CREATE=`dirname ${_MAP_FILE}` 57167c478bd9Sstevel@tonic-gatemkdir -p ${DIR_TO_CREATE} 57177c478bd9Sstevel@tonic-gate 57187c478bd9Sstevel@tonic-gateecho "Moving output from temporary file ($MAP_FILE) to actual file ($_MAP_FILE)" 57197c478bd9Sstevel@tonic-gatemv $MAP_FILE $_MAP_FILE 57207c478bd9Sstevel@tonic-gate 57217c478bd9Sstevel@tonic-gate# Revert back the mapping file name in case needed. 57227c478bd9Sstevel@tonic-gateMAP_FILE=$_MAP_FILE 57237c478bd9Sstevel@tonic-gateecho "Finished creation of mapping file ( $MAP_FILE )" 57247c478bd9Sstevel@tonic-gate 57257c478bd9Sstevel@tonic-gate} 57267c478bd9Sstevel@tonic-gate 57277c478bd9Sstevel@tonic-gate 57287c478bd9Sstevel@tonic-gate# 57297c478bd9Sstevel@tonic-gate# Main function for creating config file (ypserv) 57307c478bd9Sstevel@tonic-gate# 57317c478bd9Sstevel@tonic-gateprocess_config_file() 57327c478bd9Sstevel@tonic-gate{ 57337c478bd9Sstevel@tonic-gate# Ask for confirmation if the file name is not specified. 57347c478bd9Sstevel@tonic-gate 57357c478bd9Sstevel@tonic-gateif [ $CONFIG_FILE_SPECIFIED -eq 0 ]; then 57367c478bd9Sstevel@tonic-gate display_msg no_config_file_name_specified 57377c478bd9Sstevel@tonic-gate 57387c478bd9Sstevel@tonic-gate get_confirm_nodef "Do you want to create the config file (y/n) ?" 57397c478bd9Sstevel@tonic-gate 57407c478bd9Sstevel@tonic-gate [ $? -eq 0 ] && return 0 57417c478bd9Sstevel@tonic-gate 57427c478bd9Sstevel@tonic-gate while : 57437c478bd9Sstevel@tonic-gate do 57447c478bd9Sstevel@tonic-gate get_ans "Enter the config file name (h=help):" "${CONFIG_FILE}" 57457c478bd9Sstevel@tonic-gate 57467c478bd9Sstevel@tonic-gate # If help continue, otherwise break. 57477c478bd9Sstevel@tonic-gate case "$ANS" in 57487c478bd9Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg new_config_file_name_help ;; 57497c478bd9Sstevel@tonic-gate * ) break ;; 57507c478bd9Sstevel@tonic-gate esac 57517c478bd9Sstevel@tonic-gate done 57527c478bd9Sstevel@tonic-gate 57537c478bd9Sstevel@tonic-gate CONFIG_FILE=${ANS} 57547c478bd9Sstevel@tonic-gate [ $DEBUG -eq 1 ] && CONFIG_FILE = $CONFIG_FILE 57557c478bd9Sstevel@tonic-gate 57567c478bd9Sstevel@tonic-gatefi 57577c478bd9Sstevel@tonic-gate 57587c478bd9Sstevel@tonic-gate# Backup existing config file if selected 57597c478bd9Sstevel@tonic-gatecheck_back_config_file 57607c478bd9Sstevel@tonic-gate 57617c478bd9Sstevel@tonic-gate# Create config file 57627c478bd9Sstevel@tonic-gatecreate_config_file 57637c478bd9Sstevel@tonic-gate} 57647c478bd9Sstevel@tonic-gate 57657c478bd9Sstevel@tonic-gate 57667c478bd9Sstevel@tonic-gate# 57677c478bd9Sstevel@tonic-gate# Main function for creating mapping file (NISLDAPmapping) 57687c478bd9Sstevel@tonic-gate# 57697c478bd9Sstevel@tonic-gateprocess_mapping_file() 57707c478bd9Sstevel@tonic-gate{ 57717c478bd9Sstevel@tonic-gate# Ask for confirmation if the file name is not specified. 57727c478bd9Sstevel@tonic-gate 57737c478bd9Sstevel@tonic-gateif [ $MAPPING_FILE_SPECIFIED -eq 0 ]; then 57747c478bd9Sstevel@tonic-gate display_msg no_mapping_file_name_specified 57757c478bd9Sstevel@tonic-gate 57767c478bd9Sstevel@tonic-gate get_confirm_nodef "Do you want to create the mapping file (y/n) ?" 57777c478bd9Sstevel@tonic-gate 57787c478bd9Sstevel@tonic-gate [ $? -eq 0 ] && return 0 57797c478bd9Sstevel@tonic-gate 57807c478bd9Sstevel@tonic-gate 57817c478bd9Sstevel@tonic-gatefi 57827c478bd9Sstevel@tonic-gate 57837c478bd9Sstevel@tonic-gate# Create mapping file 57847c478bd9Sstevel@tonic-gatecreate_mapping_file 57857c478bd9Sstevel@tonic-gate} 57867c478bd9Sstevel@tonic-gate 57877c478bd9Sstevel@tonic-gate########################################### 57887c478bd9Sstevel@tonic-gate########### MAIN ########### 57897c478bd9Sstevel@tonic-gate########################################### 57907c478bd9Sstevel@tonic-gate 57917c478bd9Sstevel@tonic-gatePROG=`basename $0` # Program name 57927c478bd9Sstevel@tonic-gateABS_PROG=$0 # absolute path needed 57937c478bd9Sstevel@tonic-gate 57947c478bd9Sstevel@tonic-gate# Only superuser should be able to run this script. 57957c478bd9Sstevel@tonic-gateis_root_user 57967c478bd9Sstevel@tonic-gateif [ $? -ne 0 ]; then 57977c478bd9Sstevel@tonic-gate echo "ERROR : Only root can run $PROG" 57987c478bd9Sstevel@tonic-gate exit 1 57997c478bd9Sstevel@tonic-gatefi 58007c478bd9Sstevel@tonic-gate 58017c478bd9Sstevel@tonic-gate# Initialize things 58027c478bd9Sstevel@tonic-gateinit 58037c478bd9Sstevel@tonic-gate 58047c478bd9Sstevel@tonic-gate# Parse command line arguments. 58057c478bd9Sstevel@tonic-gateparse_arg $* 58067c478bd9Sstevel@tonic-gate 58077c478bd9Sstevel@tonic-gate# Create config file (ypserv) 58087c478bd9Sstevel@tonic-gateprocess_config_file 58097c478bd9Sstevel@tonic-gate 58107c478bd9Sstevel@tonic-gate# Create mapping file (NISLDAPmapping). 58117c478bd9Sstevel@tonic-gateprocess_mapping_file 58127c478bd9Sstevel@tonic-gate 58137c478bd9Sstevel@tonic-gate# Cleanup temp files and directories unless debug. 58147c478bd9Sstevel@tonic-gate[ $DEBUG -eq 0 ] && cleanup 58157c478bd9Sstevel@tonic-gate 58167c478bd9Sstevel@tonic-gateexit 0 5817