5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
27 # inityp2l -- Utility to generate YP (NIS) to LDAP
28 # configuration file (/etc/default/ypserv)
29 # and mapping file (/var/yp/NISLDAPmapping)
35 # Displays message corresponding to the argument tag passed.
42 $PROG: [ -m mapping_file ] [ -c config_file ]
43 m <mapping_file> Name of the generated NISLDAP mapping file
44 Default is /var/yp/NISLDAPmapping
45 c <config_file> Name of the generated ypserv configuration file
46 Default is /etc/default/ypserv
50 no_config_file_name_specified
) cat <<EOF
52 You have not specified the config file name. You still have the
53 option to skip creating this file, specify a config file name, or
54 continue creating it with the default file name (${CONFIG_FILE}).
58 no_mapping_file_name_specified
) cat <<EOF
60 You have not specified the mapping file name. You still have the
61 option to skip creating this file, specify a mapping file name, or
62 continue creating it with the default file name (${MAP_FILE}).
66 new_config_file_name_help
) cat <<EOF
68 You can either specify a new file name, or accept the default
69 config file name (${CONFIG_FILE}).
71 It is recommended not to use the default file name since this
72 script just helps with rapid creation of a config file. You
73 should examine it's content before using it.
77 new_mapping_file_name_help
) cat <<EOF
79 You can either specify a new file name, or accept the default
80 mapping file name (${MAP_FILE}).
82 It is recommended not to use the default file name since this
83 script just helps with rapid creation of a mapping file. You
84 should examine it's content before using it. And if there are
85 custom maps, then their entries in the mapping file need to be
88 Also, creation of default mapping file would cause NIS components
89 to work in NIS to LDAP (N2L), rather than traditional NIS, mode
94 backup_config_file
) cat <<EOF
96 The config file "${CONFIG_FILE}" already exists. It is strongly
97 recommended that you BACKUP this file before running $PROG.
99 However, even if you continue, you would be given the option to
100 back up this file before it gets overwritten.
104 backup_mapping_file
) cat <<EOF
106 The mapping file "${MAP_FILE}" already exists. It is strongly
107 recommended that you BACKUP this file before running $PROG.
109 However, even if you continue, you would be given the option to
110 back up this file before it gets overwritten.
114 warn_n2l_mode
) cat <<EOF
116 Warning : Creation of default mapping file (`basename $MAP_FILE`)
117 at default location (`dirname $MAP_FILE`) would cause NIS
118 components to work in NIS to LDAP (N2L) mode, rather than
119 traditional NIS mode, when next restarted.
121 "$PROG" assists with rapid creation of a simple N2L mapping
122 file. The user should examine it's content before using it.
123 For custom maps, this file needs to be customized which can
124 be done using standard text editors.
128 config_auth_method_menu
) cat <<EOF
129 The following are the supported Authentication Methods -
136 auth_method_menu
) cat <<EOF
137 The following are the supported Authentication Methods -
143 tls_method_menu
) cat <<EOF
144 The following are the supported TLS Methods -
149 retrieve_error_action_menu
) cat <<EOF
150 The following are the supported actions -
155 store_error_action_menu
) cat <<EOF
156 The following are the supported actions -
163 HELP - No help is available for this topic.
167 backup_config_file_cont_help
) cat <<EOF
169 HELP - Since $PROG will overwrite the existing config file, it is
170 strongly recommended that you backup this file prior to
171 running this utility.
173 However, even if you continue, you would be given the option
174 to back up this file before it gets overwritten.
178 backup_config_file_help
) cat <<EOF
180 HELP - If you choose to backup the existing config file, it would be
181 saved with current date and time suffix in yymmdd.HH.MM.SS format.
185 backup_mapping_file_cont_help
) cat <<EOF
187 HELP - Since $PROG will overwrite the existing mapping file, it is
188 strongly recommended that you backup this file prior to running
191 However, even if you continue, you would be given the option to
192 back up this file before it gets overwritten.
196 backup_mapping_file_help
) cat <<EOF
198 HELP - If you choose to backup the existing mapping file, it would be
199 saved with current date and time suffix in yymmdd.HH.MM.SS format.
203 warn_n2l_mode_help
) cat <<EOF
205 HELP - It is strongly recommended that the mapping file is created at
206 non-default location (other than `dirname $MAP_FILE`). After this,
207 it's content should be verified, custom maps should be handled,
208 and if NIS components are desired to run in NIS to LDAP (N2L),
209 then only it should be copied at the default location.
213 nisLDAPconfigDN_help
) cat <<EOF
215 HELP - The DN which stores the configuration information in LDAP.
216 There is no default value for this field. Leave empty or
217 undefined to get this information from config file (ypserv).
221 nisLDAPconfigPreferredServerList_help
) cat <<EOF
223 HELP - List of directory servers to provide the configuration
224 information. There is no default. The preferred servers
225 must be entered IN THE ORDER you wish to have them contacted.
226 The preferred server list is a space separated list of IP
227 addresses. Providing port numbers is optional, and when not
228 supplied, port 389 is assumed. For an LDAP server running
229 on this machine, at port 389, use "127.0.0.1:389".
235 HELP - The authentication method to be used to obtain information
236 from LDAP server. The supported methods are provided in menu.
242 HELP - The transport layer security used for connection to the LDAP
243 server. In order to successfully use transport layer security,
244 the server must also support the chosen values. The supported
245 methods are provided in menu. Default is "$DEF_TLS".
249 TLSCertificateDBPath_help
) cat <<EOF
251 HELP - The absolute path name of the directory containing the certificate
252 database. The default value is "$DEF_TLSCertificateDBPath"
256 nisLDAPconfigProxyUser_help
) cat <<EOF
258 HELP - The bind DN of the proxy user used to obtain configuration
259 information. There is no default value. If the value ends
260 with a comma, the value of the nisLDAPconfigDN attribute
265 ProxyPassword_warn
) cat <<EOF
267 Warning : In order to avoid having this password publicly visible
268 on the machine, the password should appear only in the
269 configuration file, and the file should have an appropriate
270 owner, group, and file mode.
272 So, once this file is ready, please modify appropriately
273 to make sure this file is well protected.
277 preferredServerList_help
) cat <<EOF
279 HELP - List of directory servers for mapping data to/from LDAP.
280 There is no default. The preferred servers must be entered
281 IN THE ORDER you wish to have them contacted. The preferred
282 server list is a space separated list of IP addresses.
283 Providing port numbers is optional, and when not supplied,
284 port 389 is assumed. For an LDAP server running on this
285 machine, at port 389, use "127.0.0.1:389".
289 nisLDAPproxyUser_help
) cat <<EOF
291 HELP - The bind DN of the proxy user the ypserv to read or write
292 from or to LDAP. Assumed to have the appropriate permission
293 to read and modify LDAP data. There is no default value. If
294 the value ends with a comma, the value of the context for
295 the current domain (as defined by a nisLDAPdomainContext
296 attribute (NISLDAPmapping(4))) is appended.
300 nisLDAPbindTimeout_help
) cat <<EOF
302 HELP - The amount of time in seconds after which an LDAP bind operation
303 will timeout. Default is $DEF_nisLDAPbindTimeout seconds.
304 Decimal values are allowed.
308 nisLDAPsearchTimeout_help
) cat <<EOF
310 HELP - The amount of time in seconds after which an LDAP search operation
311 will timeout. Default is $DEF_nisLDAPsearchTimeout seconds.
312 Decimal values are allowed.
316 nisLDAPmodifyTimeout_help
) cat <<EOF
318 HELP - The amount of time in seconds after which an LDAP modify operation
319 will timeout. Default is $DEF_nisLDAPmodifyTimeout seconds.
320 Decimal values are allowed.
324 nisLDAPaddTimeout_help
) cat <<EOF
326 HELP - The amount of time in seconds after which an LDAP add operation
327 will timeout. Default is $DEF_nisLDAPaddTimeout seconds.
328 Decimal values are allowed.
332 nisLDAPdeleteTimeout_help
) cat <<EOF
334 HELP - The amount of time in seconds after which an LDAP delete operation
335 will timeout. Default is $DEF_nisLDAPdeleteTimeout seconds.
336 Decimal values are allowed.
340 nisLDAPsearchTimeLimit_help
) cat <<EOF
342 HELP - Establish a value for the LDAP_OPT_TIMELIMIT option, which
343 suggests a time limit for the search operation on the LDAP
344 server. The server may impose its own constraints on possible
345 values. See your LDAP server documentation. The default is the
346 nisLDAPsearchTimeout ($DEF_nisLDAPsearchTimeout seconds) value.
347 Only integer values are allowed.
349 Since the nisLDAPsearchTimeout limits the amount of time the
350 client ypserv will wait for completion of a search operation,
351 setting the nisLDAPsearchTimeLimit larger than the
352 nisLDAPsearchTimeout is not recommended.
356 nisLDAPsearchSizeLimit_help
) cat <<EOF
358 HELP - Establish a value for the LDAP_OPT_SIZELIMIT option, which
359 suggests a size limit, in bytes, for the search results on
360 the LDAP server. The server may impose its own constraints
361 on possible values. See your LDAP server documentation. The
362 default is $DEF_nisLDAPsearchSizeLimit, which means unlimited.
363 Only integer values are allowed.
367 nisLDAPfollowReferral_help
) cat <<EOF
369 HELP - Determines if the ypserv should follow referrals or not.
370 Recognized values are yes and no. Default is $DEF_nisLDAPfollowReferral.
374 nisLDAPretrieveErrorAction_help
) cat <<EOF
376 HELP - If an error occurs while trying to retrieve an entry from
377 LDAP, one of the following actions can be selected:
379 use_cached : Retry the retrieval the number of time specified
380 by nisLDAPretrieveErrorAttempts, with the
381 nisLDAPretrieveErrorTimeout value controlling
382 the wait between each attempt.
384 If all attempts fail then log a warning and
385 return the value currently in the cache to the
386 client. This is the default value.
388 fail : Proceed as for 'use_cached' but if all attempts
389 fail return a YPERR_YPERR error to the client.
393 nisLDAPretrieveErrorAttempts_help
) cat <<EOF
395 HELP - The number of times a failed retrieval should be retried.
396 The default is unlimited. Note while retries are made, the
397 NIS daemon will be prevented from servicing further requests.
398 Hence, values other than 1 should be used with caution.
402 nisLDAPretrieveErrorTimeout_help
) cat <<EOF
404 HELP - The timeout (in seconds) between each new attempt to retrieve
405 LDAP data. Default is $DEF_nisLDAPretrieveErrorTimeout seconds.
409 nisLDAPstoreErrorAction_help
) cat <<EOF
411 HELP - If an error occurs while trying to store data to the LDAP
412 repository, one of the following actions can be selected :
414 retry : Retry operation nisLDAPstoreErrorAttempts times with
415 nisLDAPstoreErrorTimeout seconds between each attempt.
416 Note while retries are made the NIS daemon will be
417 prevented from servicing further requests. Use with
418 caution. This is the default value.
420 fail : Return YPERR_YPERR error to the client.
424 nisLDAPstoreErrorAttempts_help
) cat <<EOF
426 HELP - The number of times a failed attempt to store data to the
427 LDAP repository should be retried. The default is unlimited.
429 The value for nisLDAPstoreErrorAttempts is ignored unless
430 nisLDAPstoreErrorAction=retry.
434 nisLDAPstoreErrorTimeout_help
) cat <<EOF
436 HELP - The timeout (in seconds) between each new attempt to store
437 LDAP data. Default is $DEF_nisLDAPstoreErrorTimeout seconds.
439 The value for nisLDAPstoreErrorTimeout is ignored unless
440 nisLDAPstoreErrorAction=retry.
444 selectDomain4N2L_help
) cat <<EOF
446 HELP - Whether this domain needs to be served by YP to LDAP transition
447 solution. The default is no in which case the data in this
448 domain would not be taken care for transitioning to LDAP.
452 generate_comment_info_for_cust_map_help
) cat <<EOF
454 HELP - If selected, this script will try to add relevant comments
455 in the mapping file which might help in customizing the
456 mapping information for custom maps.
460 generate_mapping_info_for_cust_map_help
) cat <<EOF
462 HELP - If selected, this script will try to generate mapping
463 information for this map assuming it is a "simple" map.
465 A map is assumed to be "simple" if each entry of this map
466 has only one "key value" entry in YP, and if each map entry
467 can be represented as a single DIT string in the LDAP server.
469 If this map is not a simple map and you do want to store it
470 in LDAP, you have two options :
472 1 - Answer yes, and this script would generate the mapping
473 information for this map assuming it is a simple map.
474 And once the execution of the script is over, you can
475 customize the mapping information by hand editing the
478 2 - Answer no, and this script would not generate mapping
479 info for this map. And once the execution of the script
480 is over, you can include the customized mapping
481 information by hand editing the mapping file.
485 nisLDAPdomainContext_help
) cat <<EOF
487 HELP - This parameter defines the context (default location) in
488 the directory tree at which all the name service entries
489 for this particular domain would be stored.
493 nisLDAPyppasswddDomains_help
) cat <<EOF
495 HELP - Lists the domains for which password changes should be
496 made. If this is not present then the value returned by
497 'domainname' will be used.
499 NIS password change requests do not specify the domains in
500 which any given password should be changed. (In traditional
501 NIS this information is effectively hard coded in the NIS
506 custom_map_comment_char_help
) cat <<EOF
508 HELP - If selected, it will allow you to specify a character which
509 would represent the start of the special 'comment' field in
510 a given NIS map. If this attribute is not present then the
511 default comment character '#' is used.
513 If a map cannot contain comments then the blank comment
514 character ('') should be specified (just hit the return key).
518 same_comment_char_help
) cat <<EOF
520 HELP - If selected, for a given map, it will allow you to specify
521 a common comment character for all the domains.
523 Or else by selecting NO, for the same map, you would be
524 given the option to specify different comment character
525 for different domains.
529 secure_flag_on_help
) cat <<EOF
531 HELP - Secure flag is set on maps which are generated with
532 "makedbm -s". When converting data from LDAP to YP,
533 it adds YP_SECURE entries.
537 secure_flag_all_domains_help
) cat <<EOF
539 HELP - If selected, it will allow you to set the secure flag on
540 for this map for all the domains.
542 Or else by selecting NO, you would be given the option to
543 set this flag, for the same map, on per domain basis.
547 interdomain_flag_on_help
) cat <<EOF
549 HELP - Interdomain flag is set on a set of maps which are generated
550 with "makedbm -b". It signals NIS servers to use the domain
551 name resolver for host name and address lookups for hosts
552 not found in the maps.
554 If selected, it adds YP_INTERDOMAIN entries in these maps
555 when converting data from LDAP to YP.
559 interdomain_flag_all_domains_help
) cat <<EOF
561 HELP - If selected, it will allow you to set the interdomain flag
562 on for all the domains.
564 Or else by selecting NO, you would be given the option to
565 set this flag on per domain basis.
569 initialTTLlo_help
) cat <<EOF
571 HELP - The lower limit for the initial TTL (in seconds) for data
572 read from disk when the ypserv starts. If initialTTLhi also
573 is specified, the actual initialTTL will be randomly selected
574 from the interval initialTTLlo to initialTTLhi (inclusive).
576 Leaving the field empty yields the default value of $DEF_iTTLlo.
580 initialTTLhi_help
) cat <<EOF
582 HELP - The upper limit for the initial TTL (in seconds).
583 If left empty, defaults to "$DEF_iTTLhi".
587 runningTTL_help
) cat <<EOF
589 HELP - The TTL (in seconds) for data retrieved from LDAP while the
590 ypserv is running. If left empty, defaults to "$DEF_runTTL".
594 default_ttl_help
) cat <<EOF
596 HELP - The default TTL value for each map is set to :
597 ${DEF_iTTLlo}:${DEF_iTTLhi}:${DEF_runTTL}
599 Select yes if you want to change the current TTL value.
603 non_default_same_ttl_help
) cat <<EOF
605 HELP - Select yes if you want to set a new TTL value, but want
606 to keep it same for all the maps.
610 non_default_different_ttl_help
) cat <<EOF
612 HELP - Select yes if you want to set TTL value for each map, but
613 want to keep it same for all the domains.
617 default_different_ttl_help
) cat <<EOF
619 HELP - Select yes if you want to accept the default TTL
624 same_ttl_across_domains_help
) cat <<EOF
626 HELP - Select yes if you want to set TTL value for the map,
627 but want to keep it same for all the domains.
636 # Echo the message passed only if DEBUG is set.
637 # Reduces the line width significantly.
641 [ DEBUG
-eq 1 ] && echo $@
646 # get_ans(): gets an answer from the user.
647 # $1 instruction/comment/description/question
668 # get_ans_req(): gets an answer (required) from the user, NULL value not allowed.
669 # $@ instruction/comment/description/question
673 ANS
="" # Set ANS to NULL.
674 while [ "$ANS" = "" ]
677 [ "$ANS" = "" ] && echo "NULL value not allowed!"
683 # get_integer(): Querys and verifies that number entered is integer.
684 # Function will repeat prompt user for integer value.
691 ANS
="" # Set ANS to NULL.
696 # Verify that value is integer.
697 while not_integer
$ANS
700 [Hh
] |
help | Help |
\?) display_msg
${3:-sorry} ;;
701 * ) echo "Invalid value: \"${ANS}\". \c"
706 get_ans
"Enter an integer value:" "$2"
713 # get_number(): Querys and verifies that number entered is numeric.
714 # Function will repeat prompt user for numeric value.
721 ANS
="" # Set ANS to NULL.
726 # Verify that value is numeric.
727 while not_numeric
$ANS
730 [Hh
] |
help | Help |
\?) display_msg
${3:-sorry} ;;
731 * ) echo "Invalid value: \"${ANS}\". \c"
736 get_ans
"Enter a numeric value:" "$2"
743 # get_pos_int(): Only allows positive integer.
745 # $1 - Prompt message.
746 # $2 - Default value (require).
747 # $3 - Optional help argument.
752 get_integer
"$1" "$2" "$3"
754 if [ $ANS -lt 0 ]; then
755 echo "Invalid number: please enter a positive integer."
757 break # Positive integer
764 # get_pos_num(): Only allows positive number.
766 # $1 - Prompt message.
767 # $2 - Default value (require).
768 # $3 - Optional help argument.
773 get_number
"$1" "$2" "$3"
775 if [ $ANS -lt 0 ]; then
776 echo "Invalid number: please enter a positive number."
778 break # Positive number
786 # get_passwd(): Reads a password from the user and verify with second.
787 # $@ instruction/comment/description/question
791 [ $DEBUG -eq 1 ] && echo "In get_passwd()"
793 # Temporary PASSWD variables
797 # Handle signals, so that echo can be turned back on if Ctrl-C.
798 trap "/usr/bin/stty echo; exit" 1 2 3 6 15
800 /usr
/bin
/stty
-echo # Turn echo OFF
802 # Endless loop that continues until passwd and re-entered passwd
806 ANS
="" # Set ANS to NULL.
808 # Don't allow NULL for first try.
809 while [ "$ANS" = "" ]
812 [ "$ANS" = "" ] && echo "" && echo "NULL passwd not allowed!"
814 _PASS1
=$ANS # Store first try.
818 get_ans
"Re-enter passwd:"
821 # Test if passwords are identical.
822 if [ "$_PASS1" = "$_PASS2" ]; then
826 # Move cursor down to next line and print ERROR message.
828 echo "ERROR: passwords don't match; try again."
831 /usr
/bin
/stty
echo # Turn echo ON
833 # Removed signal handler
841 # get_passwd_nochk(): Reads a password from the user w/o check.
842 # $@ instruction/comment/description/question
846 [ $DEBUG -eq 1 ] && echo "In get_passwd_nochk()"
848 # Handle signals, so that echo can be turned back on if Ctrl-C.
849 trap "/usr/bin/stty echo; exit" 1 2 3 6 15
851 /usr
/bin
/stty
-echo # Turn echo OFF
855 /usr
/bin
/stty
echo # Turn echo ON
857 # Removed signal handler
865 # get_confirm(): Get confirmation from the user. (Y/Yes or N/No)
867 # $2 - default value.
875 # Display Internal ERROR if $2 not set.
877 echo "INTERNAL ERROR: get_confirm requires 2 args, 3rd is optional."
886 if [ "$_ANSWER" = "" ] && [ -n "$2" ] ; then
890 [Yy
] |
yes | Yes | YES
) return 1 ;;
891 [Nn
] | no | No | NO
) return 0 ;;
892 [Hh
] |
help | Help |
\?) display_msg
${3:-sorry};;
893 * ) echo "Please enter y or n." ;;
900 # get_confirm_nodef(): Get confirmation from the user. (Y/Yes or N/No)
901 # No default value supported. Returns 1 for yes.
912 [Yy
] |
yes | Yes | YES
) return 1 ;;
913 [Nn
] | no | No | NO
) return 0 ;;
914 * ) echo "Please enter y or n." ;;
921 # is_integer(): Tells if a string is numeric integer.
927 # Check for parameter.
928 if [ $# -ne 1 ]; then
932 # Determine if integer.
933 expr "$1" + 1 > /dev
/null
2>&1
935 if [ $?
-ge 2 ]; then
939 # Made it here, it's Numeric.
945 # not_integer(): Reverses the return values of is_integer. Useful
946 # for if and while statements that want to test for
954 if [ $?
-eq 0 ]; then
963 # is_numeric(): Tells if a string is numeric.
969 # Check for parameter.
970 if [ $# -ne 1 ]; then
974 # Determine if numeric.
975 let _NUM
="$1 + 1" > /dev
/null
2>&1
977 if [ $?
-eq 0 ]; then
985 # not_numeric(): Reverses the return values of is_numeric. Useful
986 # for if and while statements that want to test for
994 if [ $?
-eq 0 ]; then
1003 # domain_2_dc(): Convert a domain name into dc string.
1004 # $1 .. Domain name.
1008 _DOM
=$1 # Domain parameter.
1009 _DOM_2_DC
="" # Return value from function.
1010 _FIRST
=1 # Flag for first time.
1012 export _DOM_2_DC
# Make visible for others.
1014 # Convert "."'s to spaces for "for" loop.
1015 domtmp
="`echo ${_DOM} | tr '.' ' '`"
1016 for i
in $domtmp; do
1017 if [ $_FIRST -eq 1 ]; then
1021 _DOM_2_DC
="${_DOM_2_DC},dc=${i}"
1028 # is_root_user(): Check to see if logged in as super user.
1033 uid
=0\
(root\
)*) return 0 ;;
1040 # parse_arg(): Parses the command line arguments and sets the
1041 # appropriate variables.
1045 while getopts ":dm:c:" ARG
1051 MAPPING_FILE_SPECIFIED
=1;;
1053 c
) CONFIG_FILE
=$OPTARG
1054 CONFIG_FILE_SPECIFIED
=1;;
1056 \?) echo "**ERROR: Invalid option '$OPTARG'"
1062 shift `expr $OPTIND - 1`
1063 if [ $# -gt 0 ]; then
1064 echo "**ERROR: wrong usage "
1072 # present() : Checks if the first argument exists in the
1073 # argument list. Returns 0 if found, else 1.
1082 for item
in $ARG_LIST
1084 [ "$_ELEMENT" = "$item" ] && return 0
1087 # If reached here, then the clement does not exist
1093 # remove() : Returns a new string after removing the first
1094 # argument in the argument list.
1105 for item
in $ARG_LIST
1107 [ "$_ELEMENT" != "$item" ] && NEW_LIST
="$NEW_LIST $item"
1116 # merge_lists() : Returns a list after merging elements
1117 # (uniquely) supplied in the argument list.
1125 if ! present
$_VAR $MERGED_LIST; then
1126 MERGED_LIST
="$MERGED_LIST $_VAR"
1136 # init(): initializes variables and options
1140 # General variables.
1141 DEBUG
=0 # Set Debug OFF
1143 MAPPING_FILE_SPECIFIED
=0 # No file name passed
1144 CONFIG_FILE_SPECIFIED
=0 # No file name passed
1146 # Prevent others from snooping
1149 # Set default config and mapping files.
1150 DEFAULT_MAP_FILE
="/var/yp/NISLDAPmapping"
1151 DEFAULT_CONFIG_FILE
="/etc/default/ypserv"
1153 MAP_FILE
="$DEFAULT_MAP_FILE"
1154 CONFIG_FILE
="$DEFAULT_CONFIG_FILE"
1156 # Set and create TMPDIR. Use a safe place to discourage hackers.
1157 TMPDIR
="/var/yp/inityp2l"
1159 # Temporary file names to be used to prevent system starting in
1160 # N2L mode in case something goes wrong during file creation.
1161 TMPCONF
="ypserv-tmp"
1162 TMPMAP
="NISLDAPmapping-tmp"
1164 # Remove if the temp directory has been leftover
1165 [ -d "$TMPDIR" ] && rm -rf $TMPDIR
1167 if [ $?
-ne 0 ]; then
1168 echo ERROR
: Failed to create temp directory
$TMPDIR
1172 # Initialize the default NIS maps.
1173 DEFAULT_NIS_MAPS
="passwd.byname
1187 services.byservicename
1188 printers.conf.byname
1202 passwd.adjunct.byname
1203 group.adjunct.byname
1214 set -A DEF_NIS_MAP_ARRAY
$DEFAULT_NIS_MAPS
1216 # The default TTL maps in database ID format.
1217 DEF_TTL_MAPLIST
="audit_user
1225 group.adjunct.byname
1236 passwd.adjunct.byname
1237 printers.conf.byname
1254 # Initialize default values for config parameters.
1257 DEF_nisLDAPconfigDN
=""
1259 DEF_TLSCertificateDBPath
=/var
/yp
/
1260 DEF_nisLDAPbindTimeout
=15
1261 DEF_nisLDAPsearchTimeout
=180
1262 DEF_nisLDAPmodifyTimeout
=15
1263 DEF_nisLDAPaddTimeout
=15
1264 DEF_nisLDAPdeleteTimeout
=15
1265 DEF_nisLDAPsearchTimeLimit
=${DEF_nisLDAPsearchTimeout}
1266 DEF_nisLDAPsearchSizeLimit
=0
1267 DEF_nisLDAPfollowReferral
=no
1268 DEF_nisLDAPretrieveErrorAction
=use_cached
1270 # The default is unlimited, but since it prevents the NIS daemon,
1271 # from servicing further requests, set 1 as the suggested value.
1272 SUG_nisLDAPretrieveErrorAttempts
=1
1273 DEF_nisLDAPretrieveErrorTimeout
=15
1274 DEF_nisLDAPstoreErrorAction
=retry
1276 # The default is unlimited, but set 1 as the suggested value.
1277 SUG_nisLDAPstoreErrorAttempts
=1
1278 DEF_nisLDAPstoreErrorTimeout
=15
1280 # Default TTL values (in seconds) for NIS MAPS for mapping file.
1289 # config_auth_menu_handler(): Enter the authentication method
1290 # for config server.
1292 config_auth_menu_handler
()
1295 display_msg config_auth_method_menu
1297 # Get a Valid choice.
1300 # Display appropriate prompt and get answer.
1301 get_ans_req
" Choose one Authentication Method (h=help):"
1305 case "$_MENU_CHOICE" in
1306 1) _AUTHMETHOD
="none"
1308 2) _AUTHMETHOD
="simple"
1310 3) _AUTHMETHOD
="sasl/cram-md5"
1312 4) _AUTHMETHOD
="sasl/digest-md5"
1314 h
) display_msg auth_help
;;
1315 *) echo "Please enter 1-4, or h=help." ;;
1322 # auth_menu_handler(): Enter the Authentication method for LDAP server.
1327 display_msg auth_method_menu
1329 # Get a Valid choice.
1332 # Display appropriate prompt and get answer.
1333 get_ans_req
" Choose one Authentication Method (h=help):"
1337 case "$_MENU_CHOICE" in
1338 1) _AUTHMETHOD
="simple"
1340 2) _AUTHMETHOD
="sasl/cram-md5"
1342 3) _AUTHMETHOD
="sasl/digest-md5"
1344 h
) display_msg auth_help
;;
1345 *) echo "Please enter 1-3, or h=help." ;;
1352 # tls_menu_handler(): Enter the transport layer security
1357 display_msg tls_method_menu
1359 # Get a Valid choice.
1362 # Display appropriate prompt and get answer.
1363 # Default value is "none".
1365 get_ans
" Choose one Transport Layer Security Method (h=help):" "1"
1369 case "$_MENU_CHOICE" in
1370 1) _TLSMETHOD
="none"
1374 h
) display_msg tls_help
;;
1375 *) echo "Please enter 1, 2, or h=help." ;;
1382 # retrieve_error_action_menu_handler(): Enter the retrieve error action
1384 retrieve_error_action_menu_handler
()
1386 # Display retrieve error action menu
1387 display_msg retrieve_error_action_menu
1389 # Get a Valid choice.
1392 # Display appropriate prompt and get answer. use_cached is default
1393 get_ans
" Choose one retrieval error action (h=help):" "1"
1397 case "$_MENU_CHOICE" in
1398 1) _RET_ERR_ACT
="use_cached"
1400 2) _RET_ERR_ACT
="fail"
1402 h
) display_msg nisLDAPretrieveErrorAction_help
;;
1403 *) echo "Please enter 1, 2, or h=help." ;;
1410 # store_error_action_menu_handler(): Enter the store error action
1412 store_error_action_menu_handler
()
1414 # Display store error action menu
1415 display_msg store_error_action_menu
1417 # Get a Valid choice.
1420 # Display appropriate prompt and get answer. retry is default
1421 get_ans
" Choose one store error action (h=help):" "1"
1425 case "$_MENU_CHOICE" in
1426 1) _STOR_ERR_ACT
="retry"
1428 2) _STOR_ERR_ACT
="fail"
1430 h
) display_msg nisLDAPstoreErrorAction_help
;;
1431 *) echo "Please enter 1, 2, or h=help." ;;
1438 # cleanup(): Remove the TMPDIR and all files in it.
1442 [ $DEBUG -eq 1 ] && echo "In cleanup()"
1444 # Leave the temp directory if debug is set
1445 [ $DEBUG -eq 0 ] && rm -rf $TMPDIR
1449 # Save existing config file if elected
1450 check_back_config_file
()
1452 if [ -f $CONFIG_FILE ]; then
1453 display_msg backup_config_file
1455 get_confirm
"Do you wish to continue (y/n/h)?" \
1456 "n" "backup_config_file_cont_help"
1458 if [ $?
-eq 0 ]; then # if No, cleanup and exit.
1462 get_confirm
"Do you wish to backup the config file "${CONFIG_FILE}" (y/n/h)?" \
1463 "y" "backup_config_file_help"
1465 if [ $?
-eq 1 ]; then # Save the old config file with timestamp
1467 # SCCS converts '% H %' (without spaces) in current date during putback.
1468 # So use some other combination.
1469 SUFFIX
=`date '+%d%h%Y.%H:%M:%S'`
1471 cp -p $CONFIG_FILE ${CONFIG_FILE}-${SUFFIX}
1472 echo " Saved existing $CONFIG_FILE as ${CONFIG_FILE}-${SUFFIX}"
1478 # Save existing mapping file if elected
1479 check_back_mapping_file
()
1481 if [ -f $MAP_FILE ]; then
1482 display_msg backup_mapping_file
1484 get_confirm
"Do you wish to continue (y/n/h)?" \
1485 "n" "backup_mapping_file_cont_help"
1487 if [ $?
-eq 0 ]; then # if No, cleanup and exit.
1491 get_confirm
"Do you wish to backup the map file "${MAP_FILE}" (y/n/h)?" \
1492 "y" "backup_mapping_file_help"
1494 if [ $?
-eq 1 ]; then # if Yes, save the old map file with timestamp
1496 # SCCS converts '% H %' (without spaces) in current date during putback.
1497 # So use some other combination.
1498 SUFFIX
=`date '+%d%h%Y.%H:%M:%S'`
1500 cp -p $MAP_FILE ${MAP_FILE}-${SUFFIX}
1501 echo " Saved existing $MAP_FILE as ${MAP_FILE}-${SUFFIX}"
1505 if [ "$MAP_FILE" = "$DEFAULT_MAP_FILE" ]; then
1506 display_msg warn_n2l_mode
1508 get_confirm
"Do you wish to continue (y/n/h)?" \
1509 "n" "warn_n2l_mode_help"
1511 if [ $?
-eq 0 ]; then
1519 put_config_file_copyright_info
()
1522 # Start with an empty file, so don't append, but overwrite here.
1523 # Just change the name, but keep the same date and version number
1524 # as in the ident string of this script.
1526 grep "ident \"@(#)$PROG" $ABS_PROG | \
1527 sed "s/${PROG}/${NEW_NAME}/g" > $CONFIG_FILE
1533 # The contents of this file are subject to the terms of the
1534 # Common Development and Distribution License (the "License
").
1535 # You may not use this file except in compliance with the License.
1537 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1538 # or http://www.opensolaris.org/os/licensing.
1539 # See the License for the specific language governing permissions
1540 # and limitations under the License.
1542 # When distributing Covered Code, include this CDDL HEADER in each
1543 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1544 # If applicable, add the following below this CDDL HEADER, with the
1545 # fields enclosed by brackets "[]" replaced with your own identifying
1546 # information: Portions Copyright [yyyy] [name of copyright owner]
1551 # Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
1557 get_nisLDAPconfigDN
()
1562 get_ans
"DN for configuration information (h=help):"
1564 # If help continue, otherwise break.
1566 [Hh
] |
help | Help |
\?) display_msg nisLDAPconfigDN_help
;;
1571 nisLDAPconfigDN
="${ANS}"
1573 # Store in config file only if a non-default value is specified.
1574 if [ "$ANS" != "${DEF_nisLDAPconfigDN}" ]; then
1575 echo "nisLDAPconfigDN=${ANS}" >> $CONFIG_FILE
1578 # Ask remaining config server related questions only if this
1579 # DN is set. So, if a value is specified, set a flag.
1581 [ "$ANS" != "" ] && configDN_flag
=1
1585 get_nisLDAPconfigPreferredServerList
()
1590 get_ans_req
"Preferred server list for configuration information (h=help):"
1592 # If help continue, otherwise break.
1594 [Hh
] |
help | Help |
\?) display_msg nisLDAPconfigPreferredServerList_help
;;
1599 nisLDAPconfigPreferredServerList
=${ANS}
1600 echo "nisLDAPconfigPreferredServerList=${ANS}" >> $CONFIG_FILE
1604 get_nisLDAPconfigAuthenticationMethod
()
1608 echo "Select the Authentication Method for configuration server :"
1609 config_auth_menu_handler
1611 nisLDAPconfigAuthenticationMethod
=${_AUTHMETHOD}
1612 echo "nisLDAPconfigAuthenticationMethod=${_AUTHMETHOD}" >> $CONFIG_FILE
1616 get_nisLDAPconfigTLS
()
1620 echo "Select the Transport Layer Security (TLS) for configuration server :"
1623 nisLDAPconfigTLS
=${_TLSMETHOD}
1625 # Store in config file only if a non-default value is specified.
1626 if [ "${_TLSMETHOD}" != "${DEF_TLS}" ]; then
1627 echo "nisLDAPconfigTLS=${_TLSMETHOD}" >> $CONFIG_FILE
1632 get_nisLDAPconfigTLSCertificateDBPath
()
1637 get_ans
"Path with TLS Certificate DB for configuration server (h=help):"\
1638 "${DEF_TLSCertificateDBPath}"
1640 # If help continue, otherwise break.
1642 [Hh
] |
help | Help |
\?) display_msg TLSCertificateDBPath_help
;;
1647 nisLDAPconfigTLSCertificateDBPath
=${ANS}
1649 # Store in config file only if a non-default value is specified.
1650 if [ "$ANS" != "${DEF_TLSCertificateDBPath}" ]; then
1651 echo "nisLDAPconfigTLSCertificateDBPath=${ANS}" >> $CONFIG_FILE
1656 get_nisLDAPconfigProxyUser
()
1661 get_ans_req
"Proxy user bind DN to obtain configuration information (h=help):"
1662 # If help continue, otherwise break.
1664 [Hh
] |
help | Help |
\?) display_msg nisLDAPconfigProxyUser_help
;;
1669 nisLDAPconfigProxyUser
=${ANS}
1670 echo "nisLDAPconfigProxyUser=${ANS}" >> $CONFIG_FILE
1674 get_nisLDAPconfigProxyPassword
()
1676 get_passwd
"Proxy user password to obtain configuration information :"
1677 nisLDAPconfigProxyPassword
=${ANS}
1679 echo "nisLDAPconfigProxyPassword=${ANS}" >> $CONFIG_FILE
1681 display_msg ProxyPassword_warn
1685 get_preferredServerList
()
1690 get_ans_req
"Preferred server list for mapping data to/from LDAP (h=help):"
1692 # If help continue, otherwise break.
1694 [Hh
] |
help | Help |
\?) display_msg preferredServerList_help
;;
1699 preferredServerList
=${ANS}
1700 echo "preferredServerList=${ANS}" >> $CONFIG_FILE
1704 get_authenticationMethod
()
1708 echo "Select the Authentication Method for mapping data to/from LDAP :"
1711 authenticationMethod
=${_AUTHMETHOD}
1712 echo "authenticationMethod=${_AUTHMETHOD}" >> $CONFIG_FILE
1720 echo "Select the Transport Layer Security (TLS) for mapping data to/from LDAP :"
1723 nisLDAPTLS
=${_TLSMETHOD}
1725 # Store in config file only if a non-default value is specified.
1726 if [ "${_TLSMETHOD}" != "${DEF_TLS}" ]; then
1727 echo "nisLDAPTLS=${_TLSMETHOD}" >> $CONFIG_FILE
1732 get_nisLDAPTLSCertificateDBPath
()
1737 get_ans
"Path with TLS Certificate DB for LDAP data server (h=help):"\
1738 "${DEF_nisLDAPTLSCertificateDBPath}"
1740 # If help continue, otherwise break.
1742 [Hh
] |
help | Help |
\?) display_msg TLSCertificateDBPath_help
;;
1747 nisLDAPTLSCertificateDBPath
=${ANS}
1749 # Store in config file only if a non-default value is specified.
1750 if [ "$ANS" != "${DEF_TLSCertificateDBPath}" ]; then
1751 echo "nisLDAPTLSCertificateDBPath=${ANS}" >> $CONFIG_FILE
1756 get_nisLDAPproxyUser
()
1761 get_ans_req
"Proxy user bind DN to read/write data from/to LDAP (h=help):"
1763 # If help continue, otherwise break.
1765 [Hh
] |
help | Help |
\?) display_msg nisLDAPproxyUser_help
;;
1770 nisLDAPproxyUser
=${ANS}
1771 echo "nisLDAPproxyUser=${ANS}" >> $CONFIG_FILE
1775 get_nisLDAPproxyPassword
()
1777 get_passwd
"Proxy user password to read/write data from/to LDAP :"
1778 nisLDAPproxyPassword
=${ANS}
1780 echo "nisLDAPproxyPassword=${ANS}" >> $CONFIG_FILE
1782 display_msg ProxyPassword_warn
1786 get_nisLDAPbindTimeout
()
1788 get_pos_int
"Timeout value (in seconds) for LDAP bind operation (h=help):" \
1789 "${DEF_nisLDAPbindTimeout}" "nisLDAPbindTimeout_help"
1791 nisLDAPbindTimeout
=${NUM}
1793 # Store in config file only if a non-default value is specified.
1794 if [ $NUM -ne ${DEF_nisLDAPbindTimeout} ]; then
1795 echo "nisLDAPbindTimeout=${NUM}" >> $CONFIG_FILE
1800 get_nisLDAPsearchTimeout
()
1802 get_pos_int
"Timeout value (in seconds) for LDAP search operation (h=help):" \
1803 "${DEF_nisLDAPsearchTimeout}" "nisLDAPsearchTimeout_help"
1805 nisLDAPsearchTimeout
=${NUM}
1807 # Store in config file only if a non-default value is specified.
1808 if [ $NUM -ne ${DEF_nisLDAPsearchTimeout} ]; then
1809 echo "nisLDAPsearchTimeout=${NUM}" >> $CONFIG_FILE
1814 get_nisLDAPmodifyTimeout
()
1816 get_pos_int
"Timeout value (in seconds) for LDAP modify operation (h=help):" \
1817 "${DEF_nisLDAPmodifyTimeout}" "nisLDAPmodifyTimeout_help"
1819 nisLDAPmodifyTimeout
=${NUM}
1821 # Store in config file only if a non-default value is specified.
1822 if [ $NUM -ne ${DEF_nisLDAPmodifyTimeout} ]; then
1823 echo "nisLDAPmodifyTimeout=${NUM}" >> $CONFIG_FILE
1828 get_nisLDAPaddTimeout
()
1830 get_pos_int
"Timeout value (in seconds) for LDAP add operation (h=help):" \
1831 "${DEF_nisLDAPaddTimeout}" "nisLDAPaddTimeout_help"
1833 nisLDAPaddTimeout
=${NUM}
1835 # Store in config file only if a non-default value is specified.
1836 if [ $NUM -ne ${DEF_nisLDAPaddTimeout} ]; then
1837 echo "nisLDAPaddTimeout=${NUM}" >> $CONFIG_FILE
1842 get_nisLDAPdeleteTimeout
()
1844 get_pos_int
"Timeout value (in seconds) for LDAP delete operation (h=help):" \
1845 "${DEF_nisLDAPdeleteTimeout}" "nisLDAPdeleteTimeout_help"
1847 nisLDAPdeleteTimeout
=${NUM}
1849 # Store in config file only if a non-default value is specified.
1850 if [ $NUM -ne ${DEF_nisLDAPdeleteTimeout} ]; then
1851 echo "nisLDAPdeleteTimeout=${NUM}" >> $CONFIG_FILE
1856 get_nisLDAPsearchTimeLimit
()
1858 get_pos_int
"Time limit (in seconds) for search operation on LDAP server (h=help):" \
1859 "${DEF_nisLDAPsearchTimeLimit}" "nisLDAPsearchTimeLimit_help"
1861 nisLDAPsearchTimeLimit
=${NUM}
1863 # Store in config file only if a non-default value is specified.
1864 if [ $NUM -ne ${DEF_nisLDAPsearchTimeLimit} ]; then
1865 echo "nisLDAPsearchTimeLimit=${NUM}" >> $CONFIG_FILE
1870 get_nisLDAPsearchSizeLimit
()
1872 get_pos_int
"Size limit (in bytes) for search operation on LDAP server (h=help):" \
1873 "${DEF_nisLDAPsearchSizeLimit}" "nisLDAPsearchSizeLimit_help"
1875 nisLDAPsearchSizeLimit
=${NUM}
1877 # Store in config file only if a non-default value is specified.
1878 if [ $NUM -ne ${DEF_nisLDAPsearchSizeLimit} ]; then
1879 echo "nisLDAPsearchSizeLimit=${NUM}" >> $CONFIG_FILE
1884 get_nisLDAPfollowReferral
()
1886 get_confirm
"Should the ypserv follow LDAP referrals (y/n/h):" \
1887 "n" "nisLDAPfollowReferral_help"
1889 if [ $?
-eq 1 ]; then
1895 # Store in config file only if a non-default value is specified.
1896 if [ "${_ANS}" != "${DEF_nisLDAPfollowReferral}" ]; then
1897 echo "nisLDAPfollowReferral=${_ANS}" >> $CONFIG_FILE
1902 get_nisLDAPretrieveErrorAction
()
1906 echo "Select the action to be taken in case of LDAP retrieval error :"
1907 retrieve_error_action_menu_handler
1909 nisLDAPretrieveErrorAction
=${_RET_ERR_ACT}
1911 # Store in config file only if a non-default value is specified.
1912 if [ "${_RET_ERR_ACT}" != "${DEF_nisLDAPretrieveErrorAction}" ]; then
1913 echo "nisLDAPretrieveErrorAction=${_RET_ERR_ACT}" >> $CONFIG_FILE
1918 get_nisLDAPretrieveErrorAttempts
()
1921 get_pos_int
"Number of attempts in case of LDAP retrieval error (h=help):" \
1922 "$SUG_nisLDAPretrieveErrorAttempts" \
1923 "nisLDAPretrieveErrorAttempts_help"
1925 nisLDAPretrieveErrorAttempts
=${NUM}
1927 echo "nisLDAPretrieveErrorAttempts=${NUM}" >> $CONFIG_FILE
1931 get_nisLDAPretrieveErrorTimeout
()
1933 # if nisLDAPretrieveErrorAttempts=0, then no point in asking
1934 # for timeout vales as it is ignored anyway.
1936 [ $nisLDAPretrieveErrorAttempts -eq 0 ] && return 0
1938 get_pos_int
"Timeout (in seconds) between each new attempt to retrieve LDAP data (h=help):"\
1939 "${DEF_nisLDAPretrieveErrorTimeout}" \
1940 "nisLDAPretrieveErrorTimeout_help"
1942 nisLDAPretrieveErrorTimeout
=${NUM}
1944 # Store in config file only if a non-default value is specified.
1945 if [ $NUM -ne ${DEF_nisLDAPretrieveErrorTimeout} ]; then
1946 echo "nisLDAPretrieveErrorTimeout=${NUM}" >> $CONFIG_FILE
1951 get_nisLDAPstoreErrorAction
()
1955 echo "Select the action to be taken in case of LDAP store error :"
1956 store_error_action_menu_handler
1958 nisLDAPstoreErrorAction
=${_STOR_ERR_ACT}
1960 # Store in config file only if a non-default value is specified.
1961 if [ "${_STOR_ERR_ACT}" != "${DEF_nisLDAPstoreErrorAction}" ]; then
1962 echo "nisLDAPstoreErrorAction=${_STOR_ERR_ACT}" >> $CONFIG_FILE
1967 get_nisLDAPstoreErrorAttempts
()
1970 # if nisLDAPstoreErrorAction="fail", then no point in asking
1971 # for no. of attempts or timeout vales as they are ignored.
1973 [ "$nisLDAPstoreErrorAction" = "fail" ] && return 0
1975 get_pos_int
"Number of attempts in case of LDAP store error (h=help):" \
1976 "$SUG_nisLDAPstoreErrorAttempts" \
1977 "nisLDAPstoreErrorAttempts_help"
1979 nisLDAPstoreErrorAttempts
=${NUM}
1981 echo "nisLDAPstoreErrorAttempts=${NUM}" >> $CONFIG_FILE
1985 get_nisLDAPstoreErrorTimeout
()
1988 # if nisLDAPstoreErrorAction="fail", then no point in asking
1989 # for no. of attempts or timeout vales as they are ignored.
1991 [ "$nisLDAPstoreErrorAction" = "fail" ] && return 0
1993 # Similarly, if nisLDAPstoreErrorAttempts=0, ignore this question.
1995 [ $nisLDAPstoreErrorAttempts -eq 0 ] && return 0
1997 get_pos_int
"Timeout (in seconds) between each new attempt to write LDAP data (h=help):"\
1998 "${DEF_nisLDAPstoreErrorTimeout}" \
1999 "nisLDAPstoreErrorTimeout_help"
2001 nisLDAPstoreErrorTimeout
=${NUM}
2003 # Store in config file only if a non-default value is specified.
2004 if [ $NUM -ne ${DEF_nisLDAPstoreErrorTimeout} ]; then
2005 echo "nisLDAPstoreErrorTimeout=${NUM}" >> $CONFIG_FILE
2011 create_config_file
()
2014 # To prevent from leaving a partial config file in case some error or
2015 # signal takes place, store the output being generated in a temporary
2016 # file first, and move it at the final destination only at the end if
2017 # everything goes fine.
2019 _CONFIG_FILE
=$CONFIG_FILE
2020 CONFIG_FILE
=${TMPDIR}/${TMPCONF}.$$
2022 echo "Generating config file temporarily as \"${CONFIG_FILE}\""
2024 # Truncate the file before we append anything.
2025 # Place copyright information
2026 put_config_file_copyright_info
2028 # Filter out all the YP domains in /var/yp
2029 # The list of domains is stored in list "VARYP_DMN_LIST"
2033 # Configuration file for ypserv(1M); see ypserv(4) for more information,
2034 # and NISLDAPmapping(4) for configuration of NIS to LDAP mapping.
2036 # Unless otherwise noted, commented lines show default values.
2040 # Where to look for configuration information in LDAP. Leave empty or
2041 # undefined to use this file, in which case the values of the other
2042 # 'nisLdapConfig*' attributes are ignored.
2051 # Server(s) for configuration information. There is no default;
2052 # use the value on the line below for an LDAP server running on
2053 # this machine, at port 389.
2054 #nisLDAPconfigPreferredServerList=127.0.0.1:389\
2057 [ $configDN_flag -eq 1 ] && get_nisLDAPconfigPreferredServerList
2061 # Authentication method(s) to obtain configuration information.
2065 [ $configDN_flag -eq 1 ] && get_nisLDAPconfigAuthenticationMethod
2069 # Transport layer security for configuration information
2071 #nisLDAPconfigTLS=${DEF_TLS}\
2074 [ $configDN_flag -eq 1 ] && get_nisLDAPconfigTLS
2078 # Certificate DB for transport layer security
2080 #nisLDAPconfigTLSCertificateDBPath=${DEF_TLSCertificateDBPath}\
2083 # ask for Certificate DB only if SSL is set
2084 if [ "${nisLDAPconfigTLS}" = "ssl" ]; then
2085 [ $configDN_flag -eq 1 ] && get_nisLDAPconfigTLSCertificateDBPath
2090 # Proxy user(s) to obtain configuration information. The line below
2091 # is an example of the format.
2093 #nisLDAPconfigProxyUser=cn=nisAdmin,ou=People,\
2096 # Ask proxy user bind DN only if needed.
2097 if [ "${nisLDAPconfigAuthenticationMethod}" != "none" ]; then
2098 [ $configDN_flag -eq 1 ] && get_nisLDAPconfigProxyUser
2103 # Password for proxy user. Must be supplied if the authentication method
2104 # requires a password. If a password appears in this file, it should be
2105 # protected appropriately against access by unauthorized users.
2107 #nisLDAPconfigProxyPassword=\
2110 if [ "${nisLDAPconfigAuthenticationMethod}" != "none" ]; then
2111 [ $configDN_flag -eq 1 ] && get_nisLDAPconfigProxyPassword
2116 # Server list for mapping data to/from LDAP. There is no default;
2117 # use the value on the line below for an LDAP server running on
2118 # this machine, at port 389.
2119 #preferredServerList=127.0.0.1:389\
2122 get_preferredServerList
2126 # Authentication method for mapping data to/from LDAP
2130 get_authenticationMethod
2134 # Transport layer security for mapping data to/from LDAP.
2136 #nisLDAPTLS=${DEF_TLS}\
2143 # Certificate DB for transport layer security
2145 #nisLDAPTLSCertificateDBPath=${DEF_TLSCertificateDBPath}\
2148 # ask for Certificate DB only if SSL is set
2149 if [ "${nisLDAPTLS}" = "ssl" ]; then
2150 get_nisLDAPTLSCertificateDBPath
2155 # Proxy user for ypserv. Assumed to have appropriate permission to read
2156 # and/or create or modify LDAP data. The line below is an example of the
2159 #nisLDAPproxyUser=cn=nisAdmin,ou=People,\
2162 # Ask proxy user bind DN only if needed.
2163 if [ "${authenticationMethod}" != "none" ]; then
2164 get_nisLDAPproxyUser
2169 # Password for proxy user. Must be supplied if the authentication method
2170 # requires a password. If a password appears in this file, it should be
2171 # protected appropriately against unauthorized access.
2173 #nisLDAPproxyPassword=\
2176 if [ "${authenticationMethod}" != "none" ]; then
2177 get_nisLDAPproxyPassword
2182 # Timeouts and time/size limits for LDAP operations.
2184 #nisLDAPbindTimeout=${DEF_nisLDAPbindTimeout}\
2187 get_nisLDAPbindTimeout
2190 #nisLDAPsearchTimeout=${DEF_nisLDAPsearchTimeout}\
2193 get_nisLDAPsearchTimeout
2196 #nisLDAPmodifyTimeout=${DEF_nisLDAPmodifyTimeout}\
2199 get_nisLDAPmodifyTimeout
2202 #nisLDAPaddTimeout=${DEF_nisLDAPaddTimeout}\
2205 get_nisLDAPaddTimeout
2208 #nisLDAPdeleteTimeout=${DEF_nisLDAPdeleteTimeout}\
2211 get_nisLDAPdeleteTimeout
2214 #nisLDAPsearchTimeLimit=${DEF_nisLDAPsearchTimeLimit}\
2217 get_nisLDAPsearchTimeLimit
2220 #nisLDAPsearchSizeLimit=${DEF_nisLDAPsearchSizeLimit}\
2223 get_nisLDAPsearchSizeLimit
2227 # Should the ypserv follow LDAP referrals ?
2229 #nisLDAPfollowReferral=${DEF_nisLDAPfollowReferral}\
2232 get_nisLDAPfollowReferral
2236 # Action, number of attempts, and timeout following an LDAP retrieval error
2238 #nisLDAPretrieveErrorAction=${DEF_nisLDAPretrieveErrorAction}\
2241 get_nisLDAPretrieveErrorAction
2244 #nisLDAPretrieveErrorAttempts=\
2247 get_nisLDAPretrieveErrorAttempts
2250 #nisLDAPretrieveErrorTimeout=${DEF_nisLDAPretrieveErrorTimeout}\
2253 get_nisLDAPretrieveErrorTimeout
2257 # Action, number of attempts, and timeout following an LDAP store error
2259 #nisLDAPstoreErrorAction=${DEF_nisLDAPstoreErrorAction}\
2262 get_nisLDAPstoreErrorAction
2265 #nisLDAPstoreErrorAttempts=\
2268 get_nisLDAPstoreErrorAttempts
2271 #nisLDAPstoreErrorTimeout=${DEF_nisLDAPstoreErrorTimeout}\
2274 get_nisLDAPstoreErrorTimeout
2277 # We are done, so move back the config file from temp. location
2278 # to actual location.
2279 # In case the config file name has a directory component which does
2280 # not exist, then create it now, otherwise 'mv' will return error.
2282 DIR_TO_CREATE
=`dirname ${_CONFIG_FILE}`
2283 mkdir
-p ${DIR_TO_CREATE}
2285 echo "Moving output from temporary file ($CONFIG_FILE) to actual file ($_CONFIG_FILE)"
2286 mv $CONFIG_FILE $_CONFIG_FILE
2288 # Revert back the config file name in case needed.
2289 CONFIG_FILE
=$_CONFIG_FILE
2290 echo "Finished creation of config file ( $_CONFIG_FILE )"
2295 put_mapping_file_copyright_info
()
2298 # Start with an emptty file, so don't append, but overwrite here.
2299 # Just change the name and add the word pragma, but keep the same
2300 # date and version number as in the ident string of this script.
2302 grep "ident \"@(#)$PROG" $ABS_PROG | \
2303 sed "s/ ident/pragma ident/g" | \
2304 sed "s/${PROG}/${NEW_NAME}/g" > $MAP_FILE
2310 # The contents of this file are subject to the terms of the
2311 # Common Development and Distribution License (the "License
").
2312 # You may not use this file except in compliance with the License.
2314 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2315 # or http://www.opensolaris.org/os/licensing.
2316 # See the License for the specific language governing permissions
2317 # and limitations under the License.
2319 # When distributing Covered Code, include this CDDL HEADER in each
2320 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2321 # If applicable, add the following below this CDDL HEADER, with the
2322 # fields enclosed by brackets "[]" replaced with your own identifying
2323 # information: Portions Copyright [yyyy] [name of copyright owner]
2328 # Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
2330 #-------------------------------------------------------------------
2337 # Filter out all the YP domains in /var/yp
2338 # The list of domains is stored in list "VARYP_DMN_LIST"
2340 create_all_var_yp_domain_list
()
2344 for entry
in /var
/yp
/*
2346 DMN
=`basename $entry`
2347 if [ -d "/var/yp/$DMN" ] && [ -f "/var/yp/binding/$DMN/ypservers" ]
2349 VARYP_DMN_LIST
="$VARYP_DMN_LIST $DMN"
2353 # d_echo VARYP_DMN_LIST = "$VARYP_DMN_LIST"
2354 [ $DEBUG -eq 1 ] && echo VARYP_DMN_LIST
= "$VARYP_DMN_LIST"
2359 # Ask user which domains would be served by N2L
2360 # The list of N2L domains is stored in global array
2361 # "N2L_DMN_LIST" and number of domains in N2L_DMN_CNT
2363 create_n2l_domain_list
()
2365 # First make a list of all the domains in /var/yp
2366 create_all_var_yp_domain_list
2368 # Now identify those to be served by N2L
2371 for DMN
in $VARYP_DMN_LIST
2373 get_confirm
"Do you want to store maps from ${DMN} domain to LDAP (y/n/h):" \
2374 "n" "selectDomain4N2L_help"
2376 if [ $?
-eq 1 ]; then
2377 N2L_DMN_LIST
[count
]=$DMN
2378 let count
="count + 1"
2384 [ $DEBUG -eq 1 ] && echo N2L_DMN_LIST
=${N2L_DMN_LIST[*]}
2385 [ $DEBUG -eq 1 ] && echo N2L_DMN_CNT
=$N2L_DMN_CNT
2390 # Make various lists for different types of maps for each N2L domain
2391 # and ask user if mapping information and comments need to be generated
2394 # This function looks big, but since KSH does not support 2-D arrays, or
2395 # two level of dereferencing, it forced to have so many lists and arrays.
2396 # Lists are better for adding or removing elements, and arrays are better
2397 # for accessing with index and in knowing the no. of elements.
2401 # Initialize them with no maps.
2402 ALL_DMN_ALL_MAPLIST
=""
2403 ALL_DMN_DEF_MAPLIST
=""
2404 ALL_DMN_CUST_MAPLIST
=""
2405 ALL_DMN_AUTO_CUST_MAPLIST
=""
2407 # Default to don't generate custom mapping info or comment info.
2413 while (( $count < $N2L_DMN_CNT ))
2415 DMN
=${N2L_DMN_LIST[count]}
2416 MAPDIR
=/var
/yp
/${DMN}
2418 # Initialize per domain lists to NULL.
2422 AUTO_CUST_MAPLIST
=""
2424 for dbmfile
in $MAPDIR/*.dir
2426 MAP
=`basename $dbmfile .dir`
2428 # Ignore N2L maps (those with "LDAP_" prefix and ageing.byname)
2429 if [[ $MAP != LDAP_
* ]] && [[ $MAP != "" ]] && \
2430 [ -f $MAPDIR/${MAP}.pag
] && [[ $MAP != ageing.byname
]]
2432 ALL_MAPLIST
="$ALL_MAPLIST $MAP"
2434 if present
$MAP $DEFAULT_NIS_MAPS
2436 DEF_MAPLIST
="$DEF_MAPLIST $MAP"
2438 elif [[ $MAP = auto.
* ]]
2440 AUTO_CUST_MAPLIST
="$AUTO_CUST_MAPLIST $MAP"
2443 # If we reached here, means it is custom map.
2444 get_confirm
"Do you want the mapping information to be generated for \"$MAP\" map of $DMN domain (y/n/h)?" \
2445 "n" "generate_mapping_info_for_cust_map_help"
2449 CUST_MAPLIST
="$CUST_MAPLIST $MAP"
2451 # If a customer map is not desired, then delete it from
2453 ALL_MAPLIST
=$
(remove
$MAP $ALL_MAPLIST)
2462 # Make ALL_DMN lists as they are very helpful in checking if a map exists.
2463 ALL_DMN_ALL_MAPLIST
=$
(merge_lists
$ALL_DMN_ALL_MAPLIST $ALL_MAPLIST)
2464 ALL_DMN_DEF_MAPLIST
=$
(merge_lists
$ALL_DMN_DEF_MAPLIST $DEF_MAPLIST)
2465 ALL_DMN_CUST_MAPLIST
=$
(merge_lists
$ALL_DMN_CUST_MAPLIST $CUST_MAPLIST)
2466 ALL_DMN_AUTO_CUST_MAPLIST
=$
(merge_lists
$ALL_DMN_AUTO_CUST_MAPLIST \
2469 # Store per domain lists in arrays.
2470 ALL_MAPS
[$count]="$ALL_MAPLIST"
2471 DEF_MAPS
[$count]="$DEF_MAPLIST"
2472 CUST_MAPS
[$count]="$CUST_MAPLIST"
2473 AUTO_CUST_MAPS
[$count]="$AUTO_CUST_MAPLIST"
2475 [ $DEBUG -eq 1 ] && echo ALL_MAPS
[$DMN] = ${ALL_MAPS[$count]}
2476 [ $DEBUG -eq 1 ] && echo DEF_MAPS
[$DMN] = ${DEF_MAPS[$count]}
2477 [ $DEBUG -eq 1 ] && echo CUST_MAPS
[$DMN] = ${CUST_MAPS[$count]}
2478 [ $DEBUG -eq 1 ] && echo AUTO_CUST_MAPS
[$DMN] = ${AUTO_CUST_MAPS[$count]}
2480 let count
="count + 1"
2483 [ $DEBUG -eq 1 ] && echo ALL_DMN_ALL_MAPLIST
= $ALL_DMN_ALL_MAPLIST
2484 [ $DEBUG -eq 1 ] && echo ALL_DMN_DEF_MAPLIST
= $ALL_DMN_DEF_MAPLIST
2485 [ $DEBUG -eq 1 ] && echo ALL_DMN_CUST_MAPLIST
= $ALL_DMN_CUST_MAPLIST
2486 [ $DEBUG -eq 1 ] && echo ALL_DMN_AUTO_CUST_MAPLIST
= $ALL_DMN_AUTO_CUST_MAPLIST
2488 # Store all domain lists in array too.
2489 set -A ALL_DMN_ALL_MAPS
$ALL_DMN_ALL_MAPLIST
2490 set -A ALL_DMN_DEF_MAPS
$ALL_DMN_DEF_MAPLIST
2491 set -A ALL_DMN_CUST_MAPS
$ALL_DMN_CUST_MAPLIST
2492 set -A ALL_DMN_AUTO_CUST_MAPS
$ALL_DMN_AUTO_CUST_MAPLIST
2494 # A positive customer map count implies custom mapping information
2495 # is required. Set this flag.
2496 [ ${#ALL_DMN_CUST_MAPS[*]} -gt 0 ] && CUST_MAP_NEEDED
=1
2498 # Give bit of info, and ask if comments need to be placed in mapping file
2500 This script can place relevant information regarding custom
2501 maps at appropriate places in the mapping file which can be
2502 helpful in customizing this file.
2505 get_confirm
"Do you want such information to be generated (y/n/h)?" \
2506 "n" "generate_comment_info_for_cust_map_help"
2508 [ $?
-eq 1 ] && CUST_CMT_NEEDED
=1
2510 [ $DEBUG -eq 1 ] && echo CUST_MAP_NEEDED
= $CUST_MAP_NEEDED
2511 [ $DEBUG -eq 1 ] && echo CUST_CMT_NEEDED
= $CUST_CMT_NEEDED
2517 # Ask user the context for each (N2l) domain
2519 get_nisLDAPdomainContext
()
2522 # List domains and contexts
2525 for DMN
in ${N2L_DMN_LIST[*]}
2529 # Convert to domain in dc format for default choice
2532 get_ans
"Enter the naming context for $DMN domain (h=help):"\
2535 # If help continue, otherwise break.
2537 [Hh
] |
help | Help |
\?) display_msg nisLDAPdomainContext_help
;;
2542 # If a value is specified, set it, and save in mapping file too.
2543 if [ "$ANS" != "" ]; then
2544 echo "nisLDAPdomainContext $DMN : ${ANS}" >> $MAP_FILE
2547 [ $DEBUG -eq 1 ] && echo "nisLDAPdomainContext $DMN : ${ANS}"
2553 # Ask user the domains for which passwords should be changed
2555 get_nisLDAPyppasswddDomains
()
2559 # List domains for which passwords should be changed. If this is not
2560 # present then the value returned by 'domainname' will be used.
2563 for DMN
in ${N2L_DMN_LIST[*]}
2565 get_confirm
"Enable password changes for ${DMN} domain (y/n/h)? " \
2566 "n" "nisLDAPyppasswddDomains_help"
2568 if [ $?
-eq 1 ]; then
2569 echo "nisLDAPyppasswddDomains $DMN" >> $MAP_FILE
2575 #-------------------------------------------------------------------
2582 # Create NIS databaseId mappings (aliases)
2584 create_nisLDAPdatabaseIdMapping
()
2587 # Associate map names with databaseIds (aliases)
2590 nisLDAPdatabaseIdMapping ethers: ethers.byaddr ethers.byname
2591 nisLDAPdatabaseIdMapping group: group.bygid group.byname
2592 nisLDAPdatabaseIdMapping hosts:[addr="[0-9]*.[0-9]*.[0-9]*.[0-9]*"] \
2593 hosts.byaddr hosts.byname
2594 # Special mapping to handle the YP_MULTI cases
2595 nisLDAPdatabaseIdMapping multihosts: \
2596 [addr="[0-9]*.[0-9]*.[0-9]*.[0-9]*,*"] \
2598 nisLDAPdatabaseIdMapping networks: networks.byaddr networks.byname
2599 nisLDAPdatabaseIdMapping project: project.byname project.byprojid
2600 nisLDAPdatabaseIdMapping protocols: protocols.byname protocols.bynumber
2601 nisLDAPdatabaseIdMapping services: services.byname services.byservicename
2603 # netid.byname is built up from the hosts and passwd files using different
2604 # mappings. It thus has two associated nisLDAPdatabaseIdMappings.
2605 nisLDAPdatabaseIdMapping netid.host:[number="0"] netid.byname
2606 nisLDAPdatabaseIdMapping netid.pass:[number="[1-9]*"] netid.byname
2608 # The next two are special databaseIds. They associate maps with databaseIds
2609 # but additionally identify which maps contain password and password adjunct
2610 # information for yppasswdd.
2611 nisLDAPdatabaseIdMapping passwd: passwd.byname passwd.byuid
2613 # mail.byaddr needs to select entries of the form x@y or x!y
2614 nisLDAPdatabaseIdMapping mail.mapping:[rf_key="*@*", rf_key="*!*"] \
2618 # Each entry in publickey map consists of a network user name which
2619 # may refer to a host or a user. It also contains a default entry for nobody.
2620 # Hence, we need three nisLDAPdatabaseIdmappings to support the three
2621 # different types of keys.
2622 nisLDAPdatabaseIdMapping keys.host:[rf_key="unix.[a-zA-Z]*@*"] \
2624 nisLDAPdatabaseIdMapping keys.pass:[rf_key="unix.[0-9]*@*"] \
2626 nisLDAPdatabaseIdMapping keys.nobody:[rf_key="nobody"] publickey.byname
2628 # Single standard maps. No point aliasing.
2635 # ipnodes looks identical to hosts but maps to a different context.
2636 nisLDAPdatabaseIdMapping ipnodes:[addr="*:*"] \
2637 ipnodes.byaddr ipnodes.byname
2638 # Special mapping to handle the YP_MULTI cases
2639 nisLDAPdatabaseIdMapping multiipnodes: \
2643 # Other single maps. No point aliasing
2653 # printers.conf.byname
2654 # passwd.adjunct.byname
2655 # group.adjunct.byname
2658 [ CUST_CMT_NEEDED
-eq 1 ] && \
2660 # If any custom map needs to be aliased, then it should be listed
2661 # here in the following format :
2662 # nisLDAPdatabaseIdMapping databaseId ":" ["["indexlist"]"] mapname[" "...]
2665 [ CUST_MAP_NEEDED
-eq 1 ] && \
2667 # Not aliasing non-default/custom maps as they are assumed to be
2668 # simple, single maps.\
2671 for MAP
in ${ALL_DMN_AUTO_CUST_MAPS[*]} ${ALL_DMN_CUST_MAPS[*]}
2673 echo "# $MAP" >> $MAP_FILE
2678 #------------------------------------------------------------------------------
2685 # Finds the domains in which the given map exists in the supplied list.
2686 # Sets result in PRESENT_COUNT and PRESENT_IN_DOMAINS. These fields are
2687 # set globally, so they can be accessed from any where.
2688 # Input : $1 - map, $2 - list name (just name, not the value)
2696 PRESENT_IN_DOMAINS
=""
2700 while (( $count < $N2L_DMN_CNT ))
2703 # Quick and dirty way to get around unavailability of 2D array
2705 ALL_MAPS
) _LIST
=${ALL_MAPS[$count]} ;;
2706 DEF_MAPS
) _LIST
=${DEF_MAPS[$count]} ;;
2707 CUST_MAPS
) _LIST
=${CUST_MAPS[$count]} ;;
2708 AUTO_CUST_MAPS
) _LIST
=${AUTO_CUST_MAPS[$count]} ;;
2709 * ) echo "Invalid value: \"${_ARRAY}\". \c"
2713 if present
$_MAP $_LIST
2715 let PRESENT_COUNT
="$PRESENT_COUNT + 1"
2716 PRESENT_IN_DOMAINS
="$PRESENT_IN_DOMAINS ${N2L_DMN_LIST[count]}"
2718 let count
="count + 1"
2721 [ $DEBUG -eq 1 ] && echo "PRESENT_COUNT = $PRESENT_COUNT"
2722 [ $DEBUG -eq 1 ] && echo "PRESENT_IN_DOMAINS = $PRESENT_IN_DOMAINS"
2729 # For a given map, find out which list it belongs to (PRESENT_IN_LIST),
2730 # and in how many domains this map shows up (PRESENT_COUNT), and in
2731 # which ones (PRESENT_IN_DOMAINS). These fields are set globally, so
2732 # they can be accessed from any where.
2734 find_map_presence_details
()
2740 PRESENT_IN_DOMAINS
=""
2742 # If the map does not exist, return right away, else
2743 # find which list it belongs to.
2744 # If a map exists in def or auto or cust lists, then
2745 # it also exists in "all" list.
2747 if ! present
$_MAP $ALL_DMN_ALL_MAPLIST
2751 elif present
$_MAP $ALL_DMN_DEF_MAPLIST
2753 PRESENT_IN_LIST
="DEF_MAPS"
2755 elif present
$_MAP $ALL_DMN_CUST_MAPLIST
2757 PRESENT_IN_LIST
="CUST_MAPS"
2760 # If map exists, and not in previous two lists,
2761 # then it has to be here only.
2762 PRESENT_IN_LIST
="AUTO_CUST_MAPS"
2765 # Now we know which list the map belongs to. So, we need to
2766 # find which are the domains in which this map exists.
2768 find_domains
$_MAP $PRESENT_IN_LIST
2770 # Since the above function sets the values of PRESENT_COUNT and
2771 # PRESENT_IN_DOMAINS fields, we don't need to do anything else.
2773 [ $DEBUG -eq 1 ] && echo "PRESENT_IN_LIST = $PRESENT_IN_LIST"
2780 # Check if the comment char is a single character, return 0 on success.
2781 # Input is passed via global variable "COMMENT_CHAR"
2783 valid_comment_char
()
2785 COMMENT_CHAR_LENGTH
=`echo "${COMMENT_CHAR}" | wc -c`
2787 # echo adds new line character, so adjust length appropriately
2788 if [ $COMMENT_CHAR_LENGTH -gt 2 ]; then
2789 echo " Comment character has to be a blank or single character; try again."
2798 # Read the comment character for a MAP. Append in mapping file if valid.
2799 # Input - $1 : MAP name
2807 get_ans
"Specify the comment character for $_MAP :"
2810 if valid_comment_char
; then
2815 echo "nisLDAPcommentChar $_MAP : '${COMMENT_CHAR}'" >> $MAP_FILE
2820 # Read a seperate comment character for a MAP for each domain and
2821 # update this information in mapping file.
2822 # Input - $1 : MAP name, $@ : list of domains
2824 get_comment_char_per_domain
()
2830 for _DMN
in $_DOMAIN_LIST
2836 get_ans
"Specify the comment character for $_MAP,${_DMN} :"
2839 if valid_comment_char
; then
2844 echo "nisLDAPcommentChar $_MAP,${_DMN} : '${COMMENT_CHAR}'" >> $MAP_FILE
2851 # This function generates custom comment entries. The output is
2852 # appended in the mapping file.
2854 get_custom_nisLDAPcommentChar
()
2857 # All the auto mounter maps are assumed to have '#' as the default comment
2858 # char. But still list the non-default auto map entries here anyway. This
2859 # will make it very easy in case these entries need to be changed.
2861 for MAP
in ${ALL_DMN_AUTO_CUST_MAPS[*]}
2863 echo "nisLDAPcommentChar $MAP : '#'" >> $MAP_FILE
2866 if [ CUST_MAP_NEEDED
-eq 1 ]; then
2867 get_confirm
"Do you wish to specify the comment character for any custom map (y/n/h)?" \
2868 "n" "custom_map_comment_char_help"
2870 if [ $?
-eq 1 ]; then
2871 for MAP
in ${ALL_DMN_CUST_MAPS[*]}
2874 get_confirm
"Do you wish to specify comment character for \"$MAP\" (y/n/h)?" \
2875 "n" "custom_map_comment_char_help"
2877 if [ $?
-eq 1 ]; then
2878 find_domains
$MAP CUST_MAPS
2879 if [ $PRESENT_COUNT -gt 1 ]; then
2880 echo "Map \"$MAP\" is present in these domains : $PRESENT_IN_DOMAINS"
2882 get_confirm
"For \"$MAP\", should the same comment character be set for all the domains (y/n/h)?" \
2883 "y" "same_comment_char_help"
2885 if [ $?
-eq 1 ]; then
2886 get_comment_char
$MAP
2888 get_comment_char_per_domain
$MAP "$PRESENT_IN_DOMAINS"
2892 get_comment_char
$MAP
2903 # List comment character (if any) for maps
2904 create_nisLDAPcommentChar
()
2908 # Specify the character representing the start of comments.
2911 [ CUST_CMT_NEEDED
-eq 1 ] && echo "\
2912 # The comment character represents the start of the special 'comment'
2913 # field in a given NIS map. If this attribute is not present then the
2914 # default comment character '#' is used. If a map cannot contain comments
2915 # then the NULL ('') comment character should be specified. The format to
2916 # specify the comment character is :
2917 # nisLDAPcommentChar MAP[,DOMAIN] : 'single_comment_char'
2921 nisLDAPcommentChar group : ''
2922 nisLDAPcommentChar passwd : ''
2923 nisLDAPcommentChar ageing.byname : ''
2924 nisLDAPcommentChar audit_user : ''
2925 nisLDAPcommentChar auth_attr : ''
2926 nisLDAPcommentChar exec_attr : ''
2927 nisLDAPcommentChar user_attr : ''
2928 nisLDAPcommentChar bootparams : ''
2931 # Need to handle passwd.adjunct.byname map for multiple domain.
2932 _MAP
=passwd.adjunct.byname
2933 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
2935 # Just put the syntax in comment form
2936 echo "#nisLDAPcommentChar passwd.adjunct.byname: ''" >> $MAP_FILE
2938 # Find the domains in which this map exists.
2939 find_domains
$_MAP DEF_MAPS
2940 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
2942 # Don't put domain info as the map is present in all of them.
2943 echo "nisLDAPcommentChar passwd.adjunct.byname: ''" >> $MAP_FILE
2945 # Not every domain has this map. So, list for the ones which do.
2946 for _DMN
in $PRESENT_IN_DOMAINS
2948 echo "nisLDAPcommentChar passwd.adjunct.byname,${_DMN}: ''" >> $MAP_FILE
2952 # passwd.adjunct.byname done
2955 # Need to handle group.adjunct.byname map for multiple domain.
2956 _MAP
=group.adjunct.byname
2957 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
2959 # Just put the syntax in comment form
2960 echo "#nisLDAPcommentChar group.adjunct.byname: ''" >> $MAP_FILE
2962 # Find the domains in which this map exists.
2963 find_domains
$_MAP DEF_MAPS
2964 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
2966 # Don't put domain info as the map is present in all of them.
2967 echo "nisLDAPcommentChar group.adjunct.byname: ''" >> $MAP_FILE
2969 # Not every domain has this map. So, list for the ones which do.
2970 for _DMN
in $PRESENT_IN_DOMAINS
2972 echo "nisLDAPcommentChar group.adjunct.byname,${_DMN}: ''" >> $MAP_FILE
2976 # group.adjunct.byname done
2978 echo "" >> $MAP_FILE
2980 # Ask user for comment char for custom maps
2981 get_custom_nisLDAPcommentChar
2985 #------------------------------------------------------------------------------
2992 # Generate secure flag entries
2994 create_secure_flag_entries
()
2997 # Specify YP_SECURE flags
3000 [ CUST_CMT_NEEDED
-eq 1 ] && echo "\
3001 # If a map is secure, then it needs to be mentioned here
3002 # in the following format :
3003 # nisLDAPmapFlags mapname : s
3006 # Need to handle passwd.adjunct.byname map for multiple domain.
3007 _MAP
=passwd.adjunct.byname
3008 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
3010 # Just put the syntax in comment form
3011 echo "#nisLDAPmapFlags passwd.adjunct.byname : s" >> $MAP_FILE
3013 # Find the domains in which this map exists.
3014 find_domains
$_MAP DEF_MAPS
3015 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
3017 # Don't put domain info as the map is present in all of them.
3018 echo "nisLDAPmapFlags passwd.adjunct.byname : s" >> $MAP_FILE
3020 # Not every domain has this map. So, list for the ones which do.
3021 for _DMN
in $PRESENT_IN_DOMAINS
3023 echo "nisLDAPmapFlags passwd.adjunct.byname,${_DMN} : s" >> $MAP_FILE
3028 # Need to handle group.adjunct.byname map for multiple domain.
3029 _MAP
=group.adjunct.byname
3030 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
3032 # Just put the syntax in comment form
3033 echo "#nisLDAPmapFlags group.adjunct.byname : s" >> $MAP_FILE
3035 # Find the domains in which this map exists.
3036 find_domains
$_MAP DEF_MAPS
3037 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
3039 # Don't put domain info as the map is present in all of them.
3040 echo "nisLDAPmapFlags group.adjunct.byname : s" >> $MAP_FILE
3042 # Not every domain has this map. So, list for the ones which do.
3043 for _DMN
in $PRESENT_IN_DOMAINS
3045 echo "nisLDAPmapFlags group.adjunct.byname,${_DMN} : s" >> $MAP_FILE
3050 echo "" >> $MAP_FILE
3052 STR
="any" # Just to make the question look better.
3055 get_confirm
"Do you wish to set the secure flag for $STR map (y/n/h)?" \
3056 "n" "secure_flag_on_help"
3058 if [ $?
-eq 0 ]; then
3062 get_ans
"Enter the MAP name :"
3065 if [[ $MAP = "" ]]; then
3066 echo " Error : BLANK map name not allowed; try again"
3070 # Check if the supplied map name exists, and if yes, then
3071 # set the PRESENT attributes for further processing
3073 find_map_presence_details
$MAP
3075 case $PRESENT_COUNT in
3077 0 ) echo " Error : $MAP not found in any domain; try again"
3080 1 ) # The map exists in only one domain.
3081 echo "nisLDAPmapFlags $MAP : s" >> $MAP_FILE
3082 STR
="another" # Just to make the question look better.
3085 * ) # The map exists in multiple domain. Ask if this flag needs
3086 # to be set for all domains, or some specific ones.
3088 echo "Map \"$MAP\" is present in these domains : $PRESENT_IN_DOMAINS"
3089 get_confirm
"For this map, do you wish to set this flag for all the domains (y/n/h)?" \
3090 "y" "secure_flag_all_domains_help"
3092 if [ $?
-eq 1 ]; then
3093 echo "nisLDAPmapFlags $MAP : s" >> $MAP_FILE
3096 for _DMN
in $PRESENT_IN_DOMAINS
3099 get_confirm_nodef
"Set secure flag for $MAP,${_DMN} (y/n)?"
3101 if [ $?
-eq 1 ]; then
3102 echo "nisLDAPmapFlags $MAP,${_DMN} : s" >> $MAP_FILE
3107 STR
="another" # Just to make the question look better.
3118 # Generate interdomain flag entries
3120 create_interdomain_flag_entries
()
3123 INTERDOMAIN_MAP_LIST
="ipnodes
3127 services.byservicename"
3130 # Simple function to avoid duplication of code
3132 print_interdomain_entries
()
3134 for _MAP
in $INTERDOMAIN_MAP_LIST
3136 echo "nisLDAPmapFlags ${_MAP} : b" >> $MAP_FILE
3141 # Specify YP_INTERDOMAIN flags
3144 [ CUST_CMT_NEEDED
-eq 1 ] && echo "\
3145 # It is used to indicate NIS servers to use the domain name resolver for
3146 # host name and address lookups for hosts not found in the maps.
3147 # If set, it adds YP_INTERDOMAIN entries in these maps when converting
3148 # data from LDAP to YP. It needs to be set in the following format :
3149 # nisLDAPmapFlags mapname : b
3152 # List one set of entries in commented form anyway as it might help
3153 # user understand what it means.
3156 # If \$B is set in /var/yp/Makefile, then this flag should be
3157 # set for following maps :\
3160 for _MAP
in $INTERDOMAIN_MAP_LIST
3162 echo "# nisLDAPmapFlags ${_MAP} : b" >> $MAP_FILE
3165 # Put a blank line for indentation purpose
3168 get_confirm
"Do you wish to set the \"interdomain\" flag for any domain (y/n/h)?" \
3169 "n" "interdomain_flag_on_help"
3171 if [ $?
-eq 1 ]; then
3173 if [ $N2L_DMN_CNT -gt 1 ]; then
3175 get_confirm
"Should \"interdomain\" flag be set for all domain (y/n/h)?" \
3176 "y" "interdomain_flag_all_domains_help"
3178 if [ $?
-eq 1 ]; then
3179 print_interdomain_entries
3182 for _DMN
in ${N2L_DMN_LIST[*]}
3184 get_confirm_nodef
"Set interdomain flag for ${_DMN} (y/n)?"
3186 if [ $?
-eq 1 ]; then
3187 for _MAP
in $INTERDOMAIN_MAP_LIST
3189 echo "nisLDAPmapFlags ${_MAP},${_DMN} : b" >> $MAP_FILE
3197 print_interdomain_entries
3203 #------------------------------------------------------------------------------
3212 # List SECURE and INTERDOMAIN flags
3214 create_nisLDAPmapFlags
()
3216 create_secure_flag_entries
3217 create_interdomain_flag_entries
3222 # Print one Map TTL entry in mapping file using supplied TTL.
3224 print_one_map_ttl_entry
()
3232 nisLDAPentryTtl ${_Map}:${_iTtlLo}:${_iTtlHi}:${_runTtl}\
3240 # Print all the maps TTL entries of same TTL
3241 # values using the supplied TTL triplet.
3243 print_all_same_ttl_entries
()
3249 for _MAP
in ${DEF_TTL_MAPLIST} ${ALL_DMN_CUST_MAPS[*]} \
3250 ${ALL_DMN_AUTO_CUST_MAPS[*]}
3253 if [ "$_MAP" != "passwd.adjunct.byname" ] && \
3254 [ "$_MAP" != "group.adjunct.byname" ]
3256 print_one_map_ttl_entry
$_MAP $_iTTLlo $_iTTLhi $_runTTL
3260 # adjunct maps might not exist in all the domains.
3261 find_domains
$_MAP DEF_MAPS
3263 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
3266 # Don't put domain info as the map is present in all of them.
3267 print_one_map_ttl_entry
$_MAP $_iTTLlo $_iTTLhi $_runTTL
3271 for _DMN_
in $PRESENT_IN_DOMAINS
3273 _STR
="${_MAP},${_DMN_}"
3274 print_one_map_ttl_entry
$_STR $_iTTLlo $_iTTLhi $_runTTL
3285 # Read the initialTTLlo. Set the value in global variable.
3289 get_pos_int
"Lower limit for initial TTL (in seconds) (h=help):" \
3290 "$DEF_iTTLlo" "initialTTLlo_help"
3297 # Read the initialTTLhi. Set the value in global variable.
3301 get_pos_int
"Higher limit for initial TTL (in seconds) (h=help):" \
3302 "$DEF_iTTLhi" "initialTTLhi_help"
3309 # Read the initialTTLhi. Set the value in global variable.
3313 get_pos_int
"Runtime TTL (in seconds) (h=help):" \
3314 "$DEF_runTTL" "runningTTL_help"
3321 # Read one TTL triplet. Set the result in global variables.
3323 read_one_ttl_triplet
()
3325 # Just call the individual functions for each TTL.
3331 [ $DEBUG -eq 1 ] && \
3332 echo "TTL = ${iTTLlo}:${iTTLhi}:${runTTL}"
3338 # Takes MAP name (with or without domain name) as argument, asks
3339 # user for TTL values, and appends the entry in the mapping file.
3341 process_one_map_ttl_value
()
3346 get_confirm
"Retain the default TTL values [$DEF_iTTLlo:$DEF_iTTLhi:$DEF_runTTL] for \"$_Map_\" (y/n/h) ?" \
3347 "y" "default_different_ttl_help"
3349 if [ $?
-eq 1 ]; then
3350 print_one_map_ttl_entry
$_Map_ $DEF_iTTLlo $DEF_iTTLhi $DEF_runTTL
3353 echo "Reading TTL values for $_Map_ :"
3354 read_one_ttl_triplet
3355 print_one_map_ttl_entry
$_Map_ $iTTLlo $iTTLhi $runTTL
3363 # Read only one TTL triplet for each existing MAP without asking
3364 # different values for each domain and update the mapping file.
3366 read_all_maps_ttl_values_no_multiple_domain_issue
()
3369 # Need to read only one TTL triplet for each existing MAP.
3371 for _MAP
in ${DEF_TTL_MAPLIST} ${ALL_DMN_CUST_MAPS[*]} \
3372 ${ALL_DMN_AUTO_CUST_MAPS[*]}
3375 if [ "$_MAP" != "passwd.adjunct.byname" ] && \
3376 [ "$_MAP" != "group.adjunct.byname" ]
3378 process_one_map_ttl_value
$_MAP
3382 # adjunct maps might not exist in all the domains.
3383 find_domains
$_MAP DEF_MAPS
3385 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
3388 # Don't put domain info as the map is present in all of them.
3389 process_one_map_ttl_value
$_MAP
3393 for _DMN_
in $PRESENT_IN_DOMAINS
3395 _STR
="${_MAP},${_DMN_}"
3396 process_one_map_ttl_value
$_STR
3408 # Read TTL triplet for each default MAP (in database ID form) while
3409 # taking care of multiple domains issue and update the mapping file.
3411 read_default_maps_ttl_values_with_multi_domain_issue
()
3414 for _MAP_
in ${DEF_TTL_MAPLIST}
3416 if [ "$_MAP_" != "passwd.adjunct.byname" ] && \
3417 [ "$_MAP_" != "group.adjunct.byname" ]
3420 for _DMN_
in ${N2L_DMN_LIST[*]}
3422 _STR_
="${_MAP_},${_DMN_}"
3423 # Now process each combination one at a time.
3424 process_one_map_ttl_value
"$_STR_"
3428 # List only those domains in which adjunct.byname exists.
3429 find_domains
$_MAP_ DEF_MAPS
3430 for _DMN_
in $PRESENT_IN_DOMAINS
3432 _STR_
="${_MAP_},${_DMN_}"
3433 process_one_map_ttl_value
"$_STR_"
3443 # Read TTL triplet for each existing custom MAP while taking
3444 # care of multiple domains issue and update the mapping file.
3446 read_custom_maps_ttl_values_with_multi_domain_issue
()
3449 for _MAP_
in ${ALL_DMN_CUST_MAPS[*]} ${ALL_DMN_AUTO_CUST_MAPS[*]}
3452 find_map_presence_details
$_MAP_
3454 if [ $PRESENT_COUNT -eq 1 ]; then
3456 # This map exists in only one domain.
3457 # So, no need to ask for multiple domains.
3459 process_one_map_ttl_value
$_MAP_
3463 # Handle multiple domains.
3465 echo "Map \"${_MAP_}\" is present in these domains : $PRESENT_IN_DOMAINS"
3467 get_confirm
"For this map, do you wish to use the same TTL values for all the domains (y/n/h) ?" \
3468 "y" "same_ttl_across_domains_help"
3470 if [ $?
-eq 1 ]; then
3472 # Need to read only one TTL triplet for this MAP.
3473 process_one_map_ttl_value
$_MAP_
3477 # Need to ask for each domain
3479 for _DMN_
in $PRESENT_IN_DOMAINS
3481 _STR
="${_MAP_},${_DMN_}"
3483 # Now process each combination one at a time.
3484 process_one_map_ttl_value
"$_STR"
3496 # List the TTL values for various MAPs
3498 create_nisLDAPentryTtl
()
3502 # Associate TTLs with NIS entries derived from LDAP
3505 [ CUST_CMT_NEEDED
-eq 1 ] && echo "\
3506 # Each map has three TTL values which are specified in seconds.
3507 # 1. initialTTLlo (default $DEF_iTTLlo sec) The lower limit for the initial
3508 # TTL (in seconds) for data read from disk when the ypserv starts.
3510 # 2. initialTTLhi (default $DEF_iTTLhi sec) The upper limit for initial TTL.
3512 # 3. runningTTL (default $DEF_runTTL sec) The TTL (in seconds) for data
3513 # retrieved from LDAP while the ypserv is running.
3515 # If any value is not specified, then default value is used.
3516 # The format of TTL entry is :
3517 # nisLDAPentryTtl MAP[,DOMAIN]:initialTTLlo:initialTTLhi:runningTTL
3520 # If no maps are present, just return.
3521 [ ${#ALL_DMN_ALL_MAPS[*]} -eq 0 ] && return 0
3523 echo "The default TTL for each map is set to ${DEF_iTTLlo}:${DEF_iTTLhi}:${DEF_runTTL}"
3524 get_confirm
"Do you wish to change the TTL values for any map (y/n/h) ?" \
3525 "n" "default_ttl_help"
3527 if [ $?
-eq 0 ]; then
3528 # Default values accepted for all the maps.
3529 # So, just print all the maps with default TTL values.
3531 print_all_same_ttl_entries
$DEF_iTTLlo $DEF_iTTLhi $DEF_runTTL
3534 echo "You would be allowed to enter the new TTL values."
3535 get_confirm
"Do you wish to use the same TTL values for all the maps (y/n/h) ?" \
3536 "y" "non_default_same_ttl_help"
3538 if [ $?
-eq 1 ]; then
3539 # Need to read only one TTL triplet.
3540 # Print all the maps with new TTL triplet.
3542 # read one ttl triplet
3543 echo "Enter the new TTL values :"
3545 read_one_ttl_triplet
3547 print_all_same_ttl_entries
$iTTLlo $iTTLhi $runTTL
3550 if [ $N2L_DMN_CNT -eq 1 ]; then
3552 # TTL values are different now. But we haev only one domain.
3553 # So, no need to worry about multiple domains. Need to read
3554 # only one TTL triplet for each existing MAP.
3556 read_all_maps_ttl_values_no_multiple_domain_issue
3560 # TTL values are different now. And we have multiple domains
3561 # too. Check if MAPS are going to have same TTL across domains.
3562 # This is just to avoid asking too many TTL triplet inputs
3564 echo "You would be allowed to enter different TTL values for each map."
3566 get_confirm
"For a given map, do you wish to use the same TTL values for all the domains (y/n/h) ?" \
3567 "y" "non_default_different_ttl_help"
3569 if [ $?
-eq 1 ]; then
3571 # Need to read only one TTL triplet for each existing MAP.
3572 read_all_maps_ttl_values_no_multiple_domain_issue
3576 # We have hit the worst case scenario. TTLs could be
3577 # different per map and per domain.
3579 read_default_maps_ttl_values_with_multi_domain_issue
3580 read_custom_maps_ttl_values_with_multi_domain_issue
3588 #------------------------------------------------------------------------------
3597 # The custom maps for which we do not have enough
3598 # information to be able to generate specific entries,
3599 # we just log the message that the user needs to take
3600 # care of those entries manually.
3602 ask_user_to_update_the_custom_map_entries_too
()
3605 if [ ${#ALL_DMN_CUST_MAPS[*]} -gt 0 ]; then
3608 # Similar entries need to be created
3609 # for following custom maps too :\
3612 for _MAP
in ${ALL_DMN_CUST_MAPS[*]}
3614 echo "# $_MAP" >> $MAP_FILE
3620 put_default_nisLDAPnameFields
()
3623 # Associate names with fields in the maps. Must be same for all domains.
3624 nisLDAPnameFields audit_user: \
3625 ("%s:%s:%s", name, alwaysAuditFlags, neverAuditFlags)
3627 nisLDAPnameFields auto.home: \
3630 nisLDAPnameFields auto.master: \
3633 nisLDAPnameFields auth_attr: \
3634 ("%s:%s:%s:%s:%s:%s", \
3635 name, res1, res2, short_desc, long_desc, attrs )
3637 nisLDAPnameFields bootparams: \
3640 nisLDAPnameFields ethers: \
3641 ("%s %s", addr, name)
3643 nisLDAPnameFields exec_attr: \
3644 ("%s:%s:%s:%s:%s:%s:%s", \
3645 name, policy, type, res1, res2, id, attrs)
3647 nisLDAPnameFields group: \
3648 ("%s:%s:%s:%s", name, passwd, gid, users)
3651 # Need to handle group.adjunct.byname map for multiple domain.
3653 _MAP
=group.adjunct.byname
3654 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
3656 # Just put the syntax in comment form
3657 echo '#nisLDAPnameFields group.adjunct.byname: \
3658 # ("%s:%s", name, passwd)
3661 # Find the domains in which this map exists.
3662 find_domains
$_MAP DEF_MAPS
3663 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
3666 # Don't put domain info as the map is present in all of them.
3667 echo 'nisLDAPnameFields group.adjunct.byname: \
3668 ("%s:%s", name, passwd)
3671 # Not every domain has this map. So, list for the ones which do.
3672 for _DMN
in $PRESENT_IN_DOMAINS
3674 echo "nisLDAPnameFields group.adjunct.byname,${_DMN}: \\
3675 (\"%s:%s\", name, passwd)
3681 echo 'nisLDAPnameFields keys.host: \
3682 ("%s:%s", publicKey ,secretKey)
3684 nisLDAPnameFields keys.pass: \
3685 ("%s:%s", publicKey ,secretKey)
3687 nisLDAPnameFields keys.nobody: \
3688 ("%s:%s", publicKey ,secretKey)
3690 nisLDAPnameFields hosts: \
3691 ("%a %s %s", addr, canonicalName, aliases)
3693 nisLDAPnameFields multihosts: \
3694 ("%a %s %s", addr, canonicalName, aliases)
3696 nisLDAPnameFields ipnodes: \
3697 ("%a %s %s", addr, canonicalName, aliases)
3699 nisLDAPnameFields multiipnodes: \
3700 ("%a %s %s", addr, canonicalName, aliases)
3702 nisLDAPnameFields mail.aliases: \
3705 nisLDAPnameFields mail.mapping: \
3708 # memberTriples is split into sub-fields by a latter nisLDAPsplitField
3710 nisLDAPnameFields netgroup: \
3711 ("%s", memberTriples)
3713 nisLDAPnameFields netid.host: \
3714 ("%s:%s", number, data)
3716 nisLDAPnameFields netid.pass: \
3717 ("%s:%s", number, data)
3719 nisLDAPnameFields netmasks.byaddr: \
3722 nisLDAPnameFields networks: \
3723 ("%s %s %s", name, number, aliases)
3725 nisLDAPnameFields project: \
3726 ("%s:%s:%s:%s:%s:%s", \
3727 name, projID, comment, users, groups, attrs)
3729 nisLDAPnameFields protocols: \
3730 ("%s %s %s", name, number, aliases)
3732 nisLDAPnameFields rpc.bynumber: \
3733 ("%s %s %s", name, number, aliases)
3735 nisLDAPnameFields passwd: \
3736 ("%s:%s:%s:%s:%s:%s:%s", \
3737 name, passwd, uid, gid, gecos, home, shell)
3739 # It is not obvious what the fields in passwd.adjunct are for. They are not
3740 # the same as the shadow map. The following is based on information in:-
3742 # lib/libbc/inc/include/pwdadj.h.
3744 # This file implies that these are documented in getpwaent(3) but this man page
3745 # does not seem to exist.
3747 # It is believed that 'min
','max
' and 'def
' labels were reserved fields in
3748 # SunOS 4.x and are now unused. 'always
' and 'never
' audit information is
3749 # now contained in audit_user(4) so is now unused.
3753 # Need to handle passwd.adjunct.byname map for multiple domain.
3755 _MAP
=passwd.adjunct.byname
3756 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
3758 # Just put the syntax in comment form
3759 echo '#nisLDAPnameFields passwd.adjunct.byname: \
3760 # ("%s:%s:%s:%s:%s:%s:%s", \
3761 # name, passwd, min, max, def, always, \
3765 # Find the domains in which this map exists.
3766 find_domains
$_MAP DEF_MAPS
3768 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
3771 # Don't put domain info as the map is present in all of them.
3772 echo 'nisLDAPnameFields passwd.adjunct.byname: \
3773 ("%s:%s:%s:%s:%s:%s:%s", \
3774 name, passwd, min, max, def, always, \
3778 # Not every domain has this map. So, list for the ones which do.
3779 for _DMN
in $PRESENT_IN_DOMAINS
3781 echo "nisLDAPnameFields passwd.adjunct.byname,${_DMN}: \\
3782 (\"%s:%s:%s:%s:%s:%s:%s\", \\
3783 name, passwd, min, max, def, always, \\
3791 nisLDAPnameFields printers.conf.byname: \
3792 ("%s:%s", names, values)
3794 nisLDAPnameFields prof_attr: \
3795 ("%s:%s:%s:%s:%s", \
3796 name, res1, res2, desc, attrs)
3798 nisLDAPnameFields services: \
3799 ("%s %s/%s %s", name, port, protocol, aliases)
3801 # This map is never created but yppasswd uses the mapping to extract password
3802 # ageing information from the DIT. The password itself is not required by this
3803 # mechanism so is not included in the ageing mapping.
3804 nisLDAPnameFields ageing.byname: \
3805 ("%s:%s:%s:%s:%s:%s:%s:%s", \
3806 name, lastchg, min, max, warn, inactive, \
3809 nisLDAPnameFields timezone.byname: \
3810 ("%s %s", zoneName, hostName)
3812 nisLDAPnameFields user_attr: \
3813 ("%s:%s:%s:%s:%s", user, qualifier, res1, res2, attrs)
3818 # List namefields for non-default auto maps and custom maps.
3820 put_auto_and_custom_map_nisLDAPnameFields
()
3822 for _MAP
in ${ALL_DMN_AUTO_CUST_MAPS[*]} ${ALL_DMN_CUST_MAPS[*]}
3826 nisLDAPnameFields ${_MAP}: \\
3834 create_nisLDAPnameFields
()
3836 # Put format information of "nisLDAPnameFields"
3837 [ CUST_CMT_NEEDED
-eq 1 ] && echo '
3838 # "nisLDAPnameFields" specifies the content of entries in a NIS map
3839 # and how they should be broken into named fields. It is required as,
3840 # unlike NIS+, NIS maps do not store information in named fields.
3842 # Following is the syntax for nisLDAPnameFields :
3844 # "nisLDAPnameFields" mapName ":" "(" matchspec "," fieldNames ")"
3845 # fieldName = nameOrArrayName[","...]
3846 # nameOrArrayName = Name of field or 'array
' of repeated fields.
3847 # matchspec = \" formatString \"
3850 # List the default nameField values
3851 put_default_nisLDAPnameFields
3853 # List the underlying assumption
3855 # With the assumption that all the custom maps are simple, single
3856 # map (single key-value pair type), below is the nisLDAPnameFields
3857 # information for all the custom and non-default auto.* maps. If
3858 # this assumption is not valid, then refer to the NISLDAPmapping
3859 # man page for information on how to customize this section.
3862 # List namefields for non-default auto maps and custom maps.
3863 put_auto_and_custom_map_nisLDAPnameFields
3868 #------------------------------------------------------------------------------
3877 # List repeated field seperators
3879 create_nisLDAPrepeatedFieldSeparators
()
3882 [ CUST_CMT_NEEDED
-eq 1 ] && echo "
3883 # nisLDAPrepeatedFieldSeparators : It is a character which separates
3884 # the repeatable instnaces of splitable fields. It's format is :
3886 # nisLDAPrepeatedFieldSeparators fieldName \"sepChar[...]\"
3887 # sepChar = A separator character.
3888 # Default value is space or tab.
3892 #nisLDAPrepeatedFieldSeparators memberTriples: \" \t\"
3901 create_nisLDAPsplitField
()
3903 # List the default split fields
3905 [ CUST_CMT_NEEDED
-eq 1 ] && echo '
3906 # nisLDAPsplitFields : It defines how a field, or list of fields,
3907 # named by nisLDAPnameFields is split into sub fields. The original
3908 # field is compared with each line of this attribute until one matches.
3909 # When a match is found named sub-fields are generated. In latter
3910 # operations sub-field names can be used in the same way as other
3911 # field names. The format of nisLDAPsplitFields is :
3913 # "nisLDAPsplitFields" fieldName ":" splitSpec[","...]
3914 # splitSpec = "(" matchspec "," subFieldNames ")"
3915 # fieldName = Name of a field from nisLDAPnameFields
3916 # subFieldNames = subFieldname[","...]
3917 # matchspec = \" formatString \"
3921 nisLDAPsplitField memberTriples: \
3922 ("(%s,%s,%s)", host, user, domain), \
3929 # List split fields and repeated field separators.
3931 create_split_field_and_repeatedfield_seperators
()
3935 # Specify how to break fields up into sub fields.
3938 create_nisLDAPrepeatedFieldSeparators
3940 create_nisLDAPsplitField
3944 #------------------------------------------------------------------------------
3949 list_default_nisLDAPobjectDN
()
3952 # Associate maps with RDNs and object classes. Base DN comes from the
3953 # nisLDAPdomainContext.
3955 # As supplied this file gives only the most derived objectClass for each map.
3956 # For some servers it may be necessary to add "objectClass=" statements for
3957 # all the superclasses. This should be done here.
3959 nisLDAPobjectDN auto.home: \
3960 automountmapname=auto_home,?one? \
3961 objectClass=automount:
3963 nisLDAPobjectDN auto.master: \
3964 automountmapname=auto_master,?one? \
3965 objectClass=automount:
3967 nisLDAPobjectDN auth_attr: \
3968 ou=SolarisAuthAttr,?one? \
3969 objectClass=SolarisAuthAttr:
3971 nisLDAPobjectDN bootparams: \
3973 objectClass=bootableDevice, \
3976 objectClass=device, \
3977 objectClass=bootableDevice
3980 nisLDAPobjectDN exec_attr:\
3981 ou=SolarisProfAttr,?one?objectClass=SolarisExecAttr,\
3982 SolarisKernelSecurityPolicy=*:\
3983 ou=SolarisProfAttr,?one?objectClass=SolarisExecAttr,\
3984 objectClass=SolarisProfAttr,\
3987 nisLDAPobjectDN ethers: \
3989 objectClass=ieee802Device, \
3992 objectClass=device, \
3993 objectClass=ieee802Device
3995 nisLDAPobjectDN group: \
3997 objectClass=posixGroup:
4001 # Need to handle group.adjunct.byname map for multiple domain.
4003 _MAP
=group.adjunct.byname
4004 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
4006 # Just put the syntax in comment form
4007 echo '#nisLDAPobjectDN group.adjunct.byname: \
4009 # objectClass=posixGroup:
4012 # Find the domains in which this map exists.
4013 find_domains
$_MAP DEF_MAPS
4014 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
4016 # Don't put domain info as the map is present in all of them.
4017 echo 'nisLDAPobjectDN group.adjunct.byname: \
4019 objectClass=posixGroup:
4022 # Not every domain has this map. So, list for the ones which do.
4023 for _DMN
in $PRESENT_IN_DOMAINS
4025 echo "nisLDAPobjectDN group.adjunct.byname,${_DMN}: \\
4027 objectClass=posixGroup:
4034 echo 'nisLDAPobjectDN hosts: \
4036 objectClass=ipHost:\
4038 objectClass=device, \
4041 nisLDAPobjectDN multihosts: \
4043 objectClass=ipHost, \
4046 nisLDAPobjectDN ipnodes: \
4048 objectClass=ipHost:\
4050 objectClass=device, \
4053 nisLDAPobjectDN multiipnodes: \
4055 objectClass=ipHost, \
4058 nisLDAPobjectDN mail.aliases: \
4060 objectClass=mailGroup:
4062 nisLDAPobjectDN mail.mapping: \
4064 objectClass=mailGroup
4066 nisLDAPobjectDN netgroup: \
4068 objectClass=nisNetgroup:
4070 nisLDAPobjectDN networks: \
4072 objectClass=ipNetwork, \
4075 # Must come after networks (or equivalent) that creates ipNetworks
4076 nisLDAPobjectDN netmasks.byaddr: \
4078 objectClass=ipNetwork, \
4081 nisLDAPobjectDN passwd: \
4083 objectClass=posixAccount:\
4085 objectClass=account, \
4086 objectClass=shadowAccount, \
4087 objectClass=posixAccount
4091 # Need to handle passwd.adjunct.byname map for multiple domain.
4093 _MAP
=passwd.adjunct.byname
4094 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
4096 # Just put the syntax in comment form
4097 echo '#nisLDAPobjectDN passwd.adjunct.byname: \
4099 # objectClass=posixAccount:\
4101 # objectClass=account, \
4102 # objectClass=shadowAccount, \
4103 # objectClass=posixAccount
4106 # Find the domains in which this map exists.
4107 find_domains
$_MAP DEF_MAPS
4108 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
4110 # Don't put domain info as the map is present in all of them.
4111 echo 'nisLDAPobjectDN passwd.adjunct.byname: \
4113 objectClass=posixAccount:\
4115 objectClass=account, \
4116 objectClass=shadowAccount, \
4117 objectClass=posixAccount
4120 # Not every domain has this map. So, list for the ones which do.
4121 for _DMN
in $PRESENT_IN_DOMAINS
4123 echo "nisLDAPobjectDN passwd.adjunct.byname,${_DMN}: \\
4125 objectClass=posixAccount:\\
4127 objectClass=account, \\
4128 objectClass=shadowAccount, \\
4129 objectClass=posixAccount
4136 echo '# Must follow passwd
4137 nisLDAPobjectDN netid.pass: \
4139 objectClass=posixAccount
4142 nisLDAPobjectDN netid.host: \
4146 nisLDAPobjectDN printers.conf.byname: \
4148 objectClass=printerService:\
4150 objectClass=sunPrinter, \
4151 objectClass=printerService, \
4152 objectClass=printerLPR, \
4153 objectClass=printerAbstract
4155 nisLDAPobjectDN prof_attr:\
4156 ou=SolarisProfAttr,?one?objectClass=SolarisProfAttr,\
4157 SolarisAttrLongDesc=*:\
4158 ou=SolarisProfAttr,?one?objectClass=SolarisProfAttr,\
4159 objectClass=SolarisExecAttr,\
4161 nisLDAPobjectDN project: \
4163 objectClass=SolarisProject:
4165 nisLDAPobjectDN protocols: \
4166 ou=protocols,?one? \
4167 objectClass=ipProtocol:
4169 nisLDAPobjectDN rpc.bynumber: \
4173 nisLDAPobjectDN services.byname: \
4175 objectClass=ipService:
4177 # Because services.byservicename contains keys of form both 'name
'
4178 # and 'name
/protocol
' we generate the DIT just from services.byname.
4179 # Hence, write-disabled for services.byservicename
4180 nisLDAPobjectDN services.byservicename: \
4182 objectClass=ipService
4184 # This map is never created but yppasswd uses the mapping to extract password
4185 # aging information from the DIT.
4186 nisLDAPobjectDN ageing.byname: \
4188 objectClass=shadowAccount:
4190 # Using nisplusTimeZoneData objectClass for compatibility with nis+2ldap
4191 nisLDAPobjectDN timezone.byname: \
4193 objectClass=nisplusTimeZoneData:
4195 nisLDAPobjectDN user_attr: \
4197 objectClass=SolarisUserAttr:
4199 # Must come after passwd (or equivalent) that creates posixAccounts
4200 nisLDAPobjectDN audit_user: \
4202 objectClass=SolarisAuditUser:
4204 # Must come after hosts + passwd.
4205 nisLDAPobjectDN keys.host: \
4207 objectClass=NisKeyObject:
4209 nisLDAPobjectDN keys.pass: \
4211 objectClass=NisKeyObject:
4213 nisLDAPobjectDN keys.nobody: \
4215 objectClass=NisKeyObject:\
4217 objectClass=account, \
4218 objectClass=NisKeyObject
4220 nisLDAPobjectDN ypservers: \
4221 ou=ypservers,?one? \
4226 # List all the non-default auto.* and custom maps.
4227 list_auto_custom_nisLDAPobjectDN
()
4230 # auto.* entries are easy.
4231 if [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then
4232 echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE
4234 for _MAP
in ${ALL_DMN_AUTO_CUST_MAPS[*]}
4237 # We need to find one container for each auto.* map.
4238 # Assume that each auto.* maps's container is auto_*.
4240 _MAP_UNDERSCORE
=`echo $_MAP | sed "s/auto\./auto_/"`
4243 nisLDAPobjectDN ${_MAP}: \\
4244 automountmapname=${_MAP_UNDERSCORE},?one? \\
4245 objectClass=automount:
4250 # Since we do not have enough information to generate
4251 # entries for other custom maps, best we can do is to
4252 # log this map names and ask user to take care of them.
4254 ask_user_to_update_the_custom_map_entries_too
4260 # List association of maps with RDNs and object classes.
4262 create_nisLDAPobjectDN
()
4265 [ CUST_CMT_NEEDED
-eq 1 ] && echo '
4266 # nisLDAPobjectDN : It specifies the connection between group of NIS
4267 # maps and the LDAP directory. This attribute also defines the 'order
'
4268 # of the NIS maps. When NIS maps are bulk copied to or from the DIT
4269 # they are processed in the same order as related nisLDAPobjectDN
4270 # attributes appear in /var/yp/NISLDAPmapping.
4271 # The format of "nisLDAPobjectDN" is :
4273 # mapName[" "...] ":" objectDN *( ";" objectDN )
4277 # objectDN = readObjectSpec [":"[writeObjectSpec]]
4278 # readObjectSpec = [baseAndScope [filterAttrValList]]
4279 # writeObjectSpec = [baseAndScope [attrValList]]
4280 # baseAndScope = [baseDN] ["?" [scope]]
4281 # filterAttrValList = ["?" [filter | attrValList]]]
4282 # scope = "base" | "one" | "sub"
4283 # attrValList = attribute "=" value
4284 # *("," attribute "=" value)
4287 # List all the default entries anyway.
4288 list_default_nisLDAPobjectDN
4290 # List all the non-default auto.* and custom maps.
4291 list_auto_custom_nisLDAPobjectDN
4296 # List all the default nisLDAPattributeFromField entries
4298 list_default_nisLDAPattributeFromField
()
4301 # Describe how named fields are mapped to DIT entries.
4304 nisLDAPattributeFromField audit_user: \
4305 dn=("uid=%s,", rf_key ), \
4306 SolarisAuditAlways=alwaysAuditFlags, \
4307 SolarisAuditNever=neverAuditFlags
4310 nisLDAPattributeFromField auto.home: \
4311 dn=("automountKey=%s,", rf_key ), \
4312 automountKey=rf_key, \
4313 automountInformation=value
4316 nisLDAPattributeFromField auto.master: \
4317 dn=("automountKey=%s,", rf_key ), \
4318 automountKey=rf_key, \
4319 automountInformation=value
4322 nisLDAPattributeFromField auth_attr: \
4323 dn=("cn=%s,", rf_key ), \
4325 SolarisAttrReserved1=res1, \
4326 SolarisAttrReserved2=res2, \
4327 SolarisAttrShortDesc=short_desc, \
4328 SolarisAttrLongDesc=long_desc, \
4329 SolarisAttrKeyValue=attrs
4331 # exec_attr. Because of the messy NIS keys special handling is required here
4332 nisLDAPattributeFromField exec_attr: \
4333 dn=("cn=%s+SolarisKernelSecurityPolicy=%s\
4334 +SolarisProfileType=%s+SolarisProfileID=%s,", \
4335 name, policy,type,id), \
4336 ("%s:*", cn)=rf_key, \
4337 ("*:%s:*", SolarisKernelSecurityPolicy)=rf_key, \
4338 ("*:*:%s", SolarisProfileId)=rf_key, \
4339 solarisProfileType=type, \
4340 solarisAttrReserved1=res1, \
4341 SolarisAttrReserved2=res2, \
4342 solarisAttrKeyValue=attrs
4345 nisLDAPattributeFromField ethers.byname: \
4346 dn=("cn=%s,", rf_key ), \
4348 nisLDAPattributeFromField ethers.byaddr: \
4349 dn=("cn=%s,", name ), \
4351 nisLDAPattributeFromField ethers: \
4353 description=rf_comment
4355 # bootparams. Must be done after ethers
4356 nisLDAPattributeFromField bootparams: \
4357 dn=("cn=%s,", rf_key ), \
4359 (bootParameter)=(params, " ")
4362 # group syntax is different when group.adjunct map is present.
4363 # So, need to handle the various possibilities
4365 _MAP
=group.adjunct.byname
4367 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
4370 # Just put the group.adjunct syntax in comment form
4373 nisLDAPattributeFromField group.byname: \
4374 dn=("cn=%s,", rf_key ), \
4376 nisLDAPattributeFromField group.bygid: \
4377 dn=("cn=%s,", name ), \
4379 nisLDAPattributeFromField group: \
4381 userPassword=("{crypt}%s",passwd), \
4382 (memberUid)=(users, ",")
4385 # If you are using group.adjunct, comment the group section above
4386 # and uncomment the following group and group.adjunct sections
4389 #nisLDAPattributeFromField group.byname: \
4390 # dn=("cn=%s,", rf_key ), \
4392 #nisLDAPattributeFromField group.bygid: \
4393 # dn=("cn=%s,", name ), \
4395 #nisLDAPattributeFromField group: \
4397 # (memberUid)=(users, ",")
4400 #nisLDAPattributeFromField group.adjunct.byname: \
4401 # dn=("cn=%s,", rf_key ), \
4403 # userPassword=("{crypt}%s",passwd)
4408 # Find the domains in which group.adjunct map exists.
4409 find_domains
$_MAP DEF_MAPS
4411 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
4414 # All the domains have group.adjunct map.
4417 #nisLDAPattributeFromField group.byname: \
4418 # dn=("cn=%s,", rf_key ), \
4420 #nisLDAPattributeFromField group.bygid: \
4421 # dn=("cn=%s,", name ), \
4423 #nisLDAPattributeFromField group: \
4425 # userPassword=("{crypt}%s",passwd), \
4426 # (memberUid)=(users, ",")
4428 # If you are not using group.adjunct, uncomment the group section above
4429 # and comment the following group and group.adjunct sections
4432 nisLDAPattributeFromField group.byname: \
4433 dn=("cn=%s,", rf_key ), \
4435 nisLDAPattributeFromField group.bygid: \
4436 dn=("cn=%s,", name ), \
4438 nisLDAPattributeFromField group: \
4440 (memberUid)=(users, ",")
4443 nisLDAPattributeFromField group.adjunct.byname: \
4444 dn=("cn=%s,", rf_key ), \
4446 userPassword=("{crypt}%s",passwd)
4450 # Not every domain has group.adjunct map.
4452 # First put the password syntax with domain name for domains
4453 # in which group.adjunct exists.
4455 echo "# group" >> $MAP_FILE
4457 for _DMN
in $PRESENT_IN_DOMAINS
4461 # domain-specific group
4462 nisLDAPattributeFromField group.byname,${_DMN}: \\
4463 dn=(\"cn=%s,\", rf_key ), \\
4465 nisLDAPattributeFromField group.bygid,${_DMN}: \\
4466 dn=(\"cn=%s,\", name ), \\
4468 nisLDAPattributeFromField group,${_DMN}: \\
4470 (memberUid)=(users, \",\")
4474 # Now put the other group syntax. We do not need to
4475 # append the domain name here.
4478 nisLDAPattributeFromField group.byname: \
4479 dn=("cn=%s,", rf_key ), \
4481 nisLDAPattributeFromField group.bygid: \
4482 dn=("cn=%s,", name ), \
4484 nisLDAPattributeFromField group: \
4486 userPassword=("{crypt}%s",passwd), \
4487 (memberUid)=(users, ",")
4490 # Now we need to put the group.adjunct syntax for domains
4491 # in which this map exists.
4493 echo "# group.adjunct" >> $MAP_FILE
4495 for _DMN
in $PRESENT_IN_DOMAINS
4499 nisLDAPattributeFromField group.adjunct.byname,${_DMN}: \\
4500 dn=(\"cn=%s,\", rf_key ), \\
4502 userPassword=(\"{crypt}%s\",passwd)
4513 # Cannot forward map hosts.byname key as the YP_MULTI entries will not work.
4514 nisLDAPattributeFromField hosts.byname: \
4516 nisLDAPattributeFromField hosts.byaddr: \
4517 ipHostNumber=rf_searchipkey
4518 nisLDAPattributeFromField hosts: \
4519 ipHostNumber=addr, \
4520 dn=("cn=%s+ipHostNumber=%s,", canonicalName, addr), \
4522 (cn)=(aliases, " "), \
4523 description=rf_comment
4525 nisLDAPattributeFromField multihosts: \
4526 ("YP_MULTI_%s", cn)=rf_searchkey
4529 # Cannot forward map ipnodes.byname key as the YP_MULTI entries will not work.
4530 nisLDAPattributeFromField ipnodes.byname: \
4532 nisLDAPattributeFromField ipnodes.byaddr: \
4533 ipHostNumber=rf_searchipkey
4534 nisLDAPattributeFromField ipnodes: \
4535 ipHostNumber=addr, \
4536 dn=("cn=%s+ipHostNumber=%s,", canonicalName, addr), \
4538 (cn)=(aliases, " "), \
4539 description=rf_comment
4541 nisLDAPattributeFromField multiipnodes: \
4542 ("YP_MULTI_%s", cn)=rf_searchkey
4545 nisLDAPattributeFromField mail.aliases: \
4546 dn=("mail=%s,", rf_key), \
4548 (mgrprfc822mailmember)=(addresses, ",")
4551 #Commented out because all NIS->LDAP mappings are done by mail.aliases
4552 #nisLDAPattributeFromField mail.mapping: \
4553 # dn=("mail=%s,", address), \
4555 # mgrprfc822mailmember=rf_key
4556 nisLDAPattributeFromField mail.mapping: \
4557 mgrprfc822mailmember=rf_searchkey
4561 # Only need to create DIT entries for netgroup. This contains a superset of
4562 # the information in netgroup.byhost and netgroup.byuser
4563 nisLDAPattributeFromField netgroup: \
4564 dn=("cn=%s,", rf_key ), \
4565 (memberNisNetgroup)=group, \
4566 (nisNetgroupTriple)= \
4567 ("(%s,%s,%s)", host, user, domain), \
4569 description=rf_comment
4573 # Commented out because, unless remote domains (and thus /etc/netid) is
4574 # supported, all NIS->LDAP mappings are set up from passwd.
4575 #nisLDAPattributeFromField netid.pass: \
4576 # ("unix.%s@*", uidNumber)=rf_key, \
4577 # (gidNumber)=("%s", (data), " "), \
4578 # description=rf_comment
4579 nisLDAPattributeFromField netid.pass: \
4580 ("unix.%s@*", uidNumber)=rf_searchkey
4584 # Commented out because, unless remote domains (and thus /etc/netid) is
4585 # supported, all NIS->LDAP mappings are set up from hosts.
4586 #nisLDAPattributeFromField netid.host: \
4587 # dn=("cn=%s+ipHostNumber=%s,", data, \
4588 # ldap:ipHostNumber:?one?("cn=%s", data)), \
4589 # ipHostNumber=ldap:ipHostNumber:?one?("cn=%s", data), \
4590 # ("unix.%s@*", cn)=rf_key, \
4591 # description=rf_comment
4592 nisLDAPattributeFromField netid.host: \
4593 ("unix.%s@*", cn)=rf_searchkey
4596 nisLDAPattributeFromField netmasks.byaddr: \
4597 dn=("ipNetworkNumber=%s,", rf_ipkey ), \
4598 ipNetworkNumber=rf_ipkey, \
4599 ipNetmaskNumber=mask, \
4600 description=rf_comment
4603 nisLDAPattributeFromField networks.byname: \
4604 dn=("ipNetworkNumber=%s,", number ), \
4607 nisLDAPattributeFromField networks.byaddr: \
4608 dn=("ipNetworkNumber=%s,", rf_key ), \
4610 nisLDAPattributeFromField networks: \
4611 (cn)=(aliases, " "), \
4612 ipNetworkNumber=number, \
4613 description=rf_comment
4617 # passwd syntax is different when passwd.adjunct map is present.
4618 # So, need to handle the various possibilities
4620 _MAP
=passwd.adjunct.byname
4622 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
4625 # Just put the passwd.adjunct syntax in comment form
4628 nisLDAPattributeFromField passwd.byname: \
4629 dn=("uid=%s,", rf_key ), \
4632 nisLDAPattributeFromField passwd.byuid: \
4633 dn=("uid=%s,", name ), \
4636 nisLDAPattributeFromField passwd: \
4638 userPassword=("{crypt}%s",passwd), \
4641 homeDirectory=home, \
4645 # If you are using passwd.adjunct, comment the passwd section above
4646 # and uncomment the following passwd and passwd.adjunct sections
4649 #nisLDAPattributeFromField passwd.byname: \
4650 # dn=("uid=%s,", rf_key ), \
4653 #nisLDAPattributeFromField passwd.byuid: \
4654 # dn=("uid=%s,", name ), \
4655 # uidNumber=rf_key, \
4657 #nisLDAPattributeFromField passwd: \
4661 # homeDirectory=home, \
4665 #nisLDAPattributeFromField passwd.adjunct.byname: \
4666 # dn=("uid=%s,", rf_key ), \
4668 # userPassword=("{crypt}%s",passwd)
4673 # Find the domains in which passwd.adjunct map exists.
4674 find_domains
$_MAP DEF_MAPS
4676 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
4679 # All the domains have passwd.adjunct map. So, put the right
4680 # passwd syntax and comment-in the passwd.adjunct syntax.
4684 #nisLDAPattributeFromField passwd.byname: \
4685 # dn=("uid=%s,", rf_key ), \
4688 #nisLDAPattributeFromField passwd.byuid: \
4689 # dn=("uid=%s,", name ), \
4690 # uidNumber=rf_key, \
4692 #nisLDAPattributeFromField passwd: \
4694 # userPassword=("{crypt}%s",passwd), \
4697 # homeDirectory=home, \
4700 # If you are not using passwd.adjunct, uncomment the passwd section above
4701 # and comment the following passwd and passwd.adjunct sections
4704 nisLDAPattributeFromField passwd.byname: \
4705 dn=("uid=%s,", rf_key ), \
4708 nisLDAPattributeFromField passwd.byuid: \
4709 dn=("uid=%s,", name ), \
4712 nisLDAPattributeFromField passwd: \
4716 homeDirectory=home, \
4720 nisLDAPattributeFromField passwd.adjunct.byname: \
4721 dn=("uid=%s,", rf_key ), \
4723 userPassword=("{crypt}%s",passwd)
4727 # Not every domain has passwd.adjunct map.
4729 # First put the password syntax with domain name for domains
4730 # in which passwd.adjunct exists.
4732 echo "# passwd" >> $MAP_FILE
4734 for _DMN
in $PRESENT_IN_DOMAINS
4738 nisLDAPattributeFromField passwd.byname,${_DMN}: \\
4739 dn=(\"uid=%s,\", rf_key ), \\
4742 nisLDAPattributeFromField passwd.byuid,${_DMN}: \\
4743 dn=(\"uid=%s,\", name ), \\
4744 uidNumber=rf_key, \\
4746 nisLDAPattributeFromField passwd,${_DMN}: \\
4750 homeDirectory=home, \\
4755 # Now put the other passwd syntax. We do not need to
4756 # append the domain name here.
4759 nisLDAPattributeFromField passwd.byname: \
4760 dn=("uid=%s,", rf_key ), \
4763 nisLDAPattributeFromField passwd.byuid: \
4764 dn=("uid=%s,", name ), \
4767 nisLDAPattributeFromField passwd: \
4769 userPassword=("{crypt}%s",passwd), \
4772 homeDirectory=home, \
4776 # Now we need to put the passwd.adjunct syntax for domains
4777 # in which this map exists.
4779 echo "# passwd.adjunct" >> $MAP_FILE
4781 for _DMN
in $PRESENT_IN_DOMAINS
4785 nisLDAPattributeFromField passwd.adjunct.byname,${_DMN}: \\
4786 dn=(\"uid=%s,\", rf_key ), \\
4788 userPassword=(\"{crypt}%s\",passwd)
4797 # This map is never created but yppasswd uses the mapping to extract password
4798 # aging information from the DIT.
4799 nisLDAPattributeFromField ageing.byname: \
4800 dn=("uid=%s,", rf_key ), \
4802 shadowLastChange=lastchg, \
4805 shadowWarning=warn, \
4806 shadowInactive=inactive, \
4807 shadowExpire=expire, \
4810 # printers.conf.byname
4811 nisLDAPattributeFromField printers.conf.byname: \
4812 dn=("printer-uri=%s,", rf_key ), \
4813 printer-name=rf_key, \
4814 (printer-aliases)=(names, "|"), \
4815 sun-printer-bsdaddr=(values, "*bsdaddr=%s:*"), \
4816 (sun-printer-kvp)=(values,":"), \
4817 description=rf_comment
4820 nisLDAPattributeFromField prof_attr: \
4821 dn=("cn=%s,", rf_key ), \
4823 SolarisAttrReserved1=res1, \
4824 SolarisAttrReserved2=res2, \
4825 SolarisAttrLongDesc=desc, \
4826 SolarisAttrKeyValue=attrs
4829 nisLDAPattributeFromField project.byname: \
4830 dn=("SolarisProjectName=%s,", rf_key )
4831 nisLDAPattributeFromField project.byprojid: \
4832 dn=("SolarisProjectName=%s,", name ), \
4833 SolarisProjectID=rf_searchkey
4834 nisLDAPattributeFromField project: \
4835 SolarisProjectName=name, \
4836 SolarisProjectID=projID, \
4837 (memberUid)=(users, ","), \
4838 (memberGid)=(groups, ","), \
4839 (SolarisProjectAttr)=(attrs, ";"), \
4843 nisLDAPattributeFromField protocols.byname: \
4844 ipProtocolNumber=number, \
4846 nisLDAPattributeFromField protocols.bynumber: \
4847 ipProtocolNumber=rf_key, \
4848 description=rf_comment
4849 nisLDAPattributeFromField protocols: \
4850 dn=("cn=%s,", name ), \
4851 (cn)=(aliases, " "), \
4855 nisLDAPattributeFromField rpc.bynumber: \
4856 dn=("cn=%s,", name ), \
4857 oncRpcNumber=rf_key, \
4858 (cn)=(aliases, " "), \
4860 description=rf_comment
4863 # services.byservicename rule is only used to speed single search
4864 nisLDAPattributeFromField services.byservicename: \
4865 ("%s/%s", cn, ipServiceProtocol) = rf_searchkey
4867 nisLDAPattributeFromField services.byname: \
4868 dn=("cn=%s+ipServiceProtocol=%s,", name, protocol ), \
4869 ("*/%s", ipServiceProtocol)=rf_key, \
4870 ("%s/*", ipServicePort)=rf_key, \
4871 (cn)=(aliases, " "), \
4873 description=rf_comment
4876 nisLDAPattributeFromField timezone.byname: \
4877 dn=("cn=%s,", rf_key ), \
4879 nisplusTimeZone=zoneName, \
4883 nisLDAPattributeFromField user_attr: \
4884 dn=("uid=%s,", rf_key ), \
4886 SolarisUserAttr=qualifier, \
4887 SolarisUserReserved1=res1, \
4888 SolarisUserReserved2=res2, \
4889 SolarisAttrKeyValue=attrs
4892 nisLDAPattributeFromField keys.host: \
4893 dn=("%s", ldap:dn:?one?("cn=%s", (yp:rf_key, "unix.%s@*"))), \
4894 nisPublicKey=publicKey, \
4895 nisSecretKey=secretKey
4897 nisLDAPattributeFromField keys.pass: \
4898 dn=("%s", ldap:dn:?one?("uidNumber=%s", (yp:rf_key, "unix.%s@*"))), \
4899 nisPublicKey=publicKey, \
4900 nisSecretKey=secretKey
4902 nisLDAPattributeFromField keys.nobody: \
4903 dn=("uid=%s,",yp:rf_key), \
4905 nisPublicKey=publicKey, \
4906 nisSecretKey=secretKey
4908 # ypservers. This derived from IPlanet implementation not RFC.
4909 nisLDAPattributeFromField ypservers: \
4910 dn=("cn=%s,", rf_key), \
4916 # List all the non-default auto.* and custom maps.
4918 list_auto_and_custom_nisLDAPattributeFromField
()
4921 # auto.* entries are easy.
4922 if [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then
4923 echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE
4926 for _MAP
in ${ALL_DMN_AUTO_CUST_MAPS[*]}
4930 nisLDAPattributeFromField ${_MAP}: \\
4931 dn=(\"automountKey=%s,\", rf_key ), \\
4932 automountKey=rf_key, \\
4933 automountInformation=value
4937 # Since we do not have enough information to generate
4938 # entries for other custom maps, best we can do is to
4939 # log this map names and ask user to take care of them.
4941 ask_user_to_update_the_custom_map_entries_too
4947 # List mapping of named fields to DIT entries
4949 create_nisLDAPattributeFromField
()
4952 [ CUST_CMT_NEEDED
-eq 1 ] && echo '
4953 # nisLDAPattributeFromField : It specifies how an LDAP attribute
4954 # value is derived from a NIS entries field values.
4956 # The format of nisLDAPattributeFromField entry is :
4957 # mapName ":" fieldattrspec *("," fieldattrspec )
4960 # List all the default entries anyway.
4961 list_default_nisLDAPattributeFromField
4963 # List all the non-default auto.* and custom maps.
4964 list_auto_and_custom_nisLDAPattributeFromField
4968 #------------------------------------------------------------------------------
4975 # List all the default nisLDAPattributeFromField entries
4977 list_default_nisLDAPfieldFromAttribute
()
4980 # Describe how named fields are mapped from DIT entries.
4983 nisLDAPfieldFromAttribute audit_user: \
4984 ("uid=%s,*", rf_key)=dn, \
4985 ("uid=%s,*", name)=dn, \
4986 alwaysAuditFlags=SolarisAuditAlways, \
4987 neverAuditFlags=SolarisAuditNever
4990 nisLDAPfieldFromAttribute auto.home: \
4991 rf_key=automountKey, \
4992 value=automountInformation
4995 nisLDAPfieldFromAttribute auto.master: \
4996 rf_key=automountKey, \
4997 value=automountInformation
5000 nisLDAPfieldFromAttribute auth_attr: \
5003 res1=SolarisAttrReserved1, \
5004 res2=SolarisAttrReserved2, \
5005 short_desc=SolarisAttrShortDesc, \
5006 long_desc=SolarisAttrLongDesc, \
5007 attrs=SolarisAttrKeyValue
5009 # Exec_attr. Because of messy NIS keys special handlind is required here
5010 nisLDAPfieldFromAttribute exec_attr: \
5011 rf_key=("%s:%s:%s",cn,SolarisKernelSecurityPolicy, \
5012 solarisProfileId), \
5014 policy=SolarisKernelSecurityPolicy, \
5015 type=SolarisProfileType, \
5016 res1=SolarisAttrReserved1, \
5017 res2=SolarisAttrReserved2, \
5018 id=SolarisProfileId, \
5019 attrs=SolarisAttrKeyValue
5023 nisLDAPfieldFromAttribute ethers.byname: \
5025 nisLDAPfieldFromAttribute ethers.byaddr: \
5027 nisLDAPfieldFromAttribute ethers: \
5030 rf_comment=description
5032 # bootparams. Must be done after ethers
5033 nisLDAPfieldFromAttribute bootparams: \
5035 params=("%s ", (bootParameter), " ")
5038 # group syntax is different when group.adjunct map is present.
5039 # So, need to handle the various possibilities
5041 _MAP
=group.adjunct.byname
5043 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
5046 # Just put the group.adjunct syntax in comment form
5049 nisLDAPfieldFromAttribute group.byname: \
5051 nisLDAPfieldFromAttribute group.bygid: \
5053 nisLDAPfieldFromAttribute group: \
5056 ("{crypt}%s", passwd)=userPassword, \
5057 users=("%s,", (memberUid), ",")
5060 # If you are using group.adjunct, comment the group section above
5061 # and uncomment the following group and group.adjunct section
5064 #nisLDAPfieldFromAttribute group.byname: \
5066 #nisLDAPfieldFromAttribute group.bygid: \
5068 #nisLDAPfieldFromAttribute group: \
5071 # passwd=("#$%s", cn), \
5072 # users=("%s,", (memberUid), ",")
5075 #nisLDAPfieldFromAttribute group.adjunct.byname: \
5078 # ("{crypt}%s", passwd)=userPassword
5083 # Find the domains in which group.adjunct map exists.
5084 find_domains
$_MAP DEF_MAPS
5086 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
5089 # All the domains have group.adjunct map.
5093 #nisLDAPfieldFromAttribute group.byname: \
5095 #nisLDAPfieldFromAttribute group.bygid: \
5097 #nisLDAPfieldFromAttribute group: \
5100 # ("{crypt}%s", passwd)=userPassword, \
5101 # users=("%s,", (memberUid), ",")
5104 # If you are not using group.adjunct, comment the group section above
5105 # and uncomment the following group and group.adjunct sections
5108 nisLDAPfieldFromAttribute group.byname: \
5110 nisLDAPfieldFromAttribute group.bygid: \
5112 nisLDAPfieldFromAttribute group: \
5115 passwd=("#$%s", cn), \
5116 users=("%s,", (memberUid), ",")
5120 nisLDAPfieldFromAttribute group.adjunct.byname: \
5123 ("{crypt}%s", passwd)=userPassword
5127 # Not every domain has group.adjunct map.
5129 echo "# group" >> $MAP_FILE
5131 for _DMN
in $PRESENT_IN_DOMAINS
5135 nisLDAPfieldFromAttribute group.byname,${_DMN}: \\
5137 nisLDAPfieldFromAttribute group.bygid,${_DMN}: \\
5139 nisLDAPfieldFromAttribute group,${_DMN}: \\
5142 passwd=(\"#$%s\", cn), \\
5143 users=(\"%s,\", (memberUid), \",\")
5147 # Now put the generic group syntax. We do not need to
5148 # append the domain name here.
5151 nisLDAPfieldFromAttribute group.byname: \
5153 nisLDAPfieldFromAttribute group.bygid: \
5155 nisLDAPfieldFromAttribute group: \
5158 ("{crypt}%s", passwd)=userPassword, \
5159 users=("%s,", (memberUid), ",")
5162 # Now we need to put the group.adjunct syntax for domains
5163 # in which this map exists.
5169 for _DMN
in $PRESENT_IN_DOMAINS
5173 nisLDAPfieldFromAttribute group.adjunct.byname,${_DMN}: \\
5176 (\"{crypt}%s\", passwd)=userPassword
5187 nisLDAPfieldFromAttribute hosts.byaddr: \
5188 rf_ipkey=ipHostNumber
5189 nisLDAPfieldFromAttribute hosts.byname: \
5191 nisLDAPfieldFromAttribute hosts: \
5192 ("cn=%s+ipHostNumber=*", canonicalName)=dn, \
5193 addr=ipHostNumber, \
5194 aliases=("%s ", (cn) - yp:canonicalName, " "), \
5195 rf_comment=description
5197 nisLDAPfieldFromAttribute multihosts: \
5198 ("cn=%s+ipHostNumber=*", canonicalName)=dn, \
5199 (rf_key)=("YP_MULTI_%s", cn), \
5200 aliases=("%s ", (cn) - yp:canonicalName, " "), \
5201 rf_comment=description, \
5202 (tmp)=("%s", ipHostNumber:?one?("(&(cn=%s) \
5203 (ipHostNumber=*.*))", yp:canonicalName)), \
5204 addr=("%s,", (yp:tmp), ",")
5207 nisLDAPfieldFromAttribute ipnodes.byaddr: \
5208 rf_ipkey=ipHostNumber
5209 nisLDAPfieldFromAttribute ipnodes.byname: \
5211 nisLDAPfieldFromAttribute ipnodes: \
5212 ("cn=%s+ipHostNumber=*", canonicalName)=dn, \
5213 addr=ipHostNumber, \
5214 aliases=("%s ", (cn) - yp:canonicalName, " "), \
5215 rf_comment=description
5217 nisLDAPfieldFromAttribute multiipnodes: \
5218 ("cn=%s+ipHostNumber=*", canonicalName)=dn, \
5219 (rf_key)=("YP_MULTI_%s", cn), \
5220 aliases=("%s ", (cn) - yp:canonicalName, " "), \
5221 rf_comment=description, \
5222 (tmp)=("%s", ipHostNumber:?one?("(&(cn=%s) \
5223 (ipHostNumber=*:*))", yp:canonicalName)), \
5224 addr=("%s,", (yp:tmp), ",")
5227 nisLDAPfieldFromAttribute mail.aliases: \
5229 addresses= ("%s,", (mgrprfc822mailmember), ","), \
5230 rf_comment=description
5233 nisLDAPfieldFromAttribute mail.mapping: \
5234 rf_key=mgrprfc822mailmember, \
5236 rf_comment=description
5239 nisLDAPfieldFromAttribute netgroup: \
5241 (group)=(memberNisNetgroup), \
5242 ("(%s,%s,%s)", host, user, domain)= \
5243 (nisNetgroupTriple), \
5244 rf_comment=description
5247 nisLDAPfieldFromAttribute netid.pass: \
5249 (tmp)=("%s", gidNumber:ou=group,?one?\
5250 ("memberUid=%s", ldap:uid)), \
5251 sgid=("%s,", (yp:tmp) - gidNumber, ","), \
5252 data=("%s,%s", gidNumber, yp:sgid), \
5254 (rf_key)=("unix.%s@%s", yp:number, yp:rf_domain)
5257 nisLDAPfieldFromAttribute netid.host: \
5258 ("cn=%s+ipHostNumber=*", data)=dn, \
5260 (rf_key)=("unix.%s@%s", yp:data, yp:rf_domain)
5263 nisLDAPfieldFromAttribute netmasks.byaddr: \
5264 ("ipNetworkNumber=%s,*", rf_ipkey)=dn, \
5265 mask=ipNetmaskNumber, \
5266 rf_comment=description
5269 nisLDAPfieldFromAttribute networks.byname: \
5271 nisLDAPfieldFromAttribute networks.byaddr: \
5272 ("ipNetworkNumber=%s,*", rf_key)=dn
5273 nisLDAPfieldFromAttribute networks: \
5275 aliases=("%s ", (cn) - yp:name, " "), \
5276 number=ipNetworkNumber, \
5277 rf_comment=description
5280 # passwd syntax is different when passwd.adjunct map is present.
5281 # So, need to handle the various possibilities
5283 _MAP
=passwd.adjunct.byname
5285 if ! present
$_MAP $ALL_DMN_DEF_MAPLIST
5288 # Just put the passwd.adjunct syntax in comment form
5291 nisLDAPfieldFromAttribute passwd.byname: \
5293 nisLDAPfieldFromAttribute passwd.byuid: \
5295 nisLDAPfieldFromAttribute passwd: \
5298 ("{crypt}%s", passwd)=userPassword, \
5301 home=homeDirectory, \
5305 # If you are using passwd.adjunct, comment the passwd section above
5306 # and uncomment the following passwd and passwd.adjunct sections
5309 #nisLDAPfieldFromAttribute passwd.byname: \
5311 #nisLDAPfieldFromAttribute passwd.byuid: \
5313 #nisLDAPfieldFromAttribute passwd: \
5316 # passwd=("##%s", uid), \
5319 # home=homeDirectory, \
5323 #nisLDAPfieldFromAttribute passwd.adjunct.byname: \
5326 # ("{crypt}%s", passwd)=userPassword
5331 # Find the domains in which passwd.adjunct map exists.
5332 find_domains
$_MAP DEF_MAPS
5334 if [ $PRESENT_COUNT -eq $N2L_DMN_CNT ]
5337 # All the domains have passwd.adjunct map. So, put the right
5338 # passwd syntax and comment-in the passwd.adjunct syntax.
5342 #nisLDAPfieldFromAttribute passwd.byname: \
5344 #nisLDAPfieldFromAttribute passwd.byuid: \
5346 #nisLDAPfieldFromAttribute passwd: \
5349 # ("{crypt}%s", passwd)=userPassword, \
5352 # home=homeDirectory, \
5356 # If you are not using passwd.adjunct, uncomment the passwd section
5357 # above and comment the following passwd and passwd.adjunct sections
5360 nisLDAPfieldFromAttribute passwd.byname: \
5362 nisLDAPfieldFromAttribute passwd.byuid: \
5364 nisLDAPfieldFromAttribute passwd: \
5367 passwd=("##%s", uid), \
5370 home=homeDirectory, \
5374 # passwd.adjunct Must follow passwd
5376 nisLDAPfieldFromAttribute passwd.adjunct.byname: \
5379 ("{crypt}%s", passwd)=userPassword
5383 # Not every domain has passwd.adjunct map.
5385 # First put the password syntax with domain name for domains
5386 # in which passwd.adjunct exists.
5388 echo "# passwd" >> $MAP_FILE
5390 for _DMN
in $PRESENT_IN_DOMAINS
5394 nisLDAPfieldFromAttribute passwd.byname,${_DMN}: \\
5396 nisLDAPfieldFromAttribute passwd.byuid,${_DMN}: \\
5398 nisLDAPfieldFromAttribute passwd,${_DMN}: \\
5401 passwd=(\"##%s\", uid), \\
5404 home=homeDirectory, \\
5409 # Now put the other passwd syntax. We do not need to
5410 # append the domain name here.
5413 nisLDAPfieldFromAttribute passwd.byname: \
5415 nisLDAPfieldFromAttribute passwd.byuid: \
5417 nisLDAPfieldFromAttribute passwd: \
5420 ("{crypt}%s", passwd)=userPassword, \
5423 home=homeDirectory, \
5427 # Now we need to put the passwd.adjunct syntax for domains
5428 # in which this map exists.
5431 # passwd.adjunct Must follow passwd
5434 for _DMN
in $PRESENT_IN_DOMAINS
5438 nisLDAPfieldFromAttribute passwd.adjunct.byname,${_DMN}: \\
5441 (\"{crypt}%s\", passwd)=userPassword
5451 # This map is never created but yppasswd uses the mapping to extract password
5452 # ageing information from the DIT.
5453 nisLDAPfieldFromAttribute ageing.byname: \
5456 lastchg=shadowLastChange, \
5459 warn=shadowWarning, \
5460 inactive=shadowInactive, \
5461 expire=shadowExpire, \
5464 # printers.conf.byname
5465 nisLDAPfieldFromAttribute printers.conf.byname: \
5466 rf_key=printer-uri, \
5467 names=("%s|", (printer-aliases), "|"), \
5468 bsdaddr=("bsdaddr=%s", sun-printer-bsdaddr), \
5469 kvps=("%s:", (sun-printer-kvp) - yp:bsdaddr), \
5470 values=("%s:%s", yp:bsdaddr, yp:kvps), \
5471 values=("%s:", yp:bsdaddr), \
5473 rf_comment=description
5476 nisLDAPfieldFromAttribute prof_attr: \
5479 res1=SolarisAttrReserved1, \
5480 res2=SolarisAttrReserved2, \
5481 desc=SolarisAttrLongDesc, \
5482 attrs=SolarisAttrKeyValue
5485 nisLDAPfieldFromAttribute project.byname: \
5486 rf_key=SolarisProjectName
5487 nisLDAPfieldFromAttribute project.byprojid: \
5488 rf_key=SolarisProjectID
5489 nisLDAPfieldFromAttribute project: \
5490 name=SolarisProjectName, \
5491 projID=SolarisProjectID, \
5492 comment=description, \
5493 users=("%s,", (memberUid), ","), \
5494 groups=("%s,", (memberGid), ","), \
5495 attrs=("%s;", (SolarisProjectAttr), ";")
5498 nisLDAPfieldFromAttribute protocols.byname: \
5499 ("cn=%s,*", rf_key)=dn, \
5501 nisLDAPfieldFromAttribute protocols.bynumber: \
5502 rf_key=ipProtocolNumber, \
5503 rf_comment=description
5504 nisLDAPfieldFromAttribute protocols: \
5505 ("cn=%s,*", name)=dn, \
5506 number=ipProtocolNumber, \
5507 aliases=("%s ", (cn) - yp:name, " ")
5510 nisLDAPfieldFromAttribute rpc.bynumber: \
5511 rf_key=oncRpcNumber, \
5512 number=oncRpcNumber, \
5513 ("cn=%s,*", name)=dn, \
5514 aliases=("%s ", (cn) - yp:name, " "), \
5515 rf_comment=description
5518 nisLDAPfieldFromAttribute services.byname: \
5519 rf_key = ("%s/%s", ipServicePort, ipServiceProtocol)
5520 nisLDAPfieldFromAttribute services.byservicename: \
5521 (rf_key)=("%s/%s", cn, ipServiceProtocol), \
5523 nisLDAPfieldFromAttribute services: \
5524 ("cn=%s+ipServiceProtocol=*", name)=dn, \
5525 protocol=ipServiceProtocol, \
5526 port=ipServicePort, \
5527 aliases=("%s ", (cn) - yp:name, " "), \
5528 rf_comment=description
5531 nisLDAPfieldFromAttribute timezone.byname: \
5534 zoneName=nisplusTimeZone, \
5535 rf_comment=description
5538 nisLDAPfieldFromAttribute user_attr: \
5539 ("uid=%s,*", rf_key)=dn, \
5540 ("uid=%s,*", user)=dn, \
5541 qualifier=SolarisUserAttr, \
5542 res1=SolarisUserReserved1, \
5543 res2=SolarisUserReserved2, \
5544 attrs=SolarisAttrKeyValue
5547 nisLDAPfieldFromAttribute keys.host: \
5548 ("cn=%s+ipHostNumber=*", cname)=dn, \
5549 rf_key=("unix.%s@%s", yp:cname, yp:rf_domain), \
5550 publicKey=nisPublicKey, \
5551 secretKey=nisSecretKey
5553 nisLDAPfieldFromAttribute keys.pass: \
5554 rf_key=("unix.%s@%s", uidNumber, yp:rf_domain), \
5555 publicKey=nisPublicKey, \
5556 secretKey=nisSecretKey
5558 nisLDAPfieldFromAttribute keys.nobody: \
5560 publicKey=nisPublicKey, \
5561 secretKey=nisSecretKey
5563 # ypservers. This derived from IPlanet implementation not RFC.
5564 nisLDAPfieldFromAttribute ypservers: \
5571 # List all the non-default auto.* and custom maps.
5573 list_auto_and_custom_nisLDAPfieldFromAttribute
()
5576 # auto.* entries are easy.
5577 if [ ${#ALL_DMN_AUTO_CUST_MAPS[*]} -gt 0 ]; then
5578 echo "# Non-default custom auto maps (auto.*)\n" >> $MAP_FILE
5581 for _MAP
in ${ALL_DMN_AUTO_CUST_MAPS[*]}
5585 nisLDAPfieldFromAttribute ${_MAP}: \\
5586 rf_key=automountKey, \\
5587 value=automountInformation
5591 # Since we do not have enough information to generate
5592 # entries for other custom maps, best we can do is to
5593 # log this map names and ask user to take care of them.
5595 ask_user_to_update_the_custom_map_entries_too
5601 # List mapping of named fields from DIT entries
5603 create_nisLDAPfieldFromAttribute
()
5606 [ CUST_CMT_NEEDED
-eq 1 ] && echo '
5607 # nisLDAPfieldFromAttribute : It specifies how a NIS entries
5608 # field values are derived from LDAP attribute values.
5610 # The format of nisLDAPfieldFromAttribute is :
5611 # mapName ":" fieldattrspec *("," fieldattrspec)
5614 # List all the default entries anyway.
5615 list_default_nisLDAPfieldFromAttribute
5617 # List all the non-default auto.* and custom maps.
5618 list_auto_and_custom_nisLDAPfieldFromAttribute
5622 #------------------------------------------------------------------------------
5629 # Main function for creating the mapping file
5630 create_mapping_file
()
5632 # Ask user the list of domains to be served by N2L
5633 create_n2l_domain_list
5635 # If there are no N2L domains or none selected, then exit
5636 if [ $N2L_DMN_CNT -eq 0 ]; then
5637 echo "There are no domains to serve. No mapping file generated."
5643 get_ans
"Enter the mapping file name (h=help):" "${MAP_FILE}"
5645 # If help continue, otherwise break.
5647 [Hh
] |
help | Help |
\?) display_msg new_mapping_file_name_help
;;
5653 [ $DEBUG -eq 1 ] && MAP_FILE
= $MAP_FILE
5655 # Backup existing mapping file if selected
5656 check_back_mapping_file
5658 # To prevent from leaving a partial mapping file in case some error
5659 # or signal takes place which might result in machine starting in N2L
5660 # mode at next reboot, store the output being generated in a temporary
5661 # file first, and move it at the final destination only at the end if
5662 # everything goes fine.
5665 MAP_FILE
=${TMPDIR}/${TMPMAP}.$$
5667 echo "Generating mapping file temporarily as \"${MAP_FILE}\""
5669 # Place copyright information
5670 put_mapping_file_copyright_info
5673 # Prepare various map lists for each domain
5676 # List domains and contexts
5677 get_nisLDAPdomainContext
5679 # List domains for which passwords should be changed
5680 get_nisLDAPyppasswddDomains
5682 # List databaseId mappings (aliases)
5683 create_nisLDAPdatabaseIdMapping
5685 # List comment character for maps
5686 create_nisLDAPcommentChar
5688 # List SECURE and INTERDOMAIN flags
5689 create_nisLDAPmapFlags
5692 create_nisLDAPentryTtl
5695 create_nisLDAPnameFields
5697 # List split fields and repeated fields seperators.
5698 create_split_field_and_repeatedfield_seperators
5700 # List association of maps with RDNs and object classes.
5701 create_nisLDAPobjectDN
5703 # List mapping of named fields to DIT entries
5704 create_nisLDAPattributeFromField
5706 # List mapping of named fields from DIT entries
5707 create_nisLDAPfieldFromAttribute
5710 # We are done, so move back the mapping file from temp. location
5711 # to actual location.
5712 # In case the mapping file name has a directory component which does
5713 # not exist, then create it now, otherwise 'mv' will return error.
5715 DIR_TO_CREATE
=`dirname ${_MAP_FILE}`
5716 mkdir
-p ${DIR_TO_CREATE}
5718 echo "Moving output from temporary file ($MAP_FILE) to actual file ($_MAP_FILE)"
5719 mv $MAP_FILE $_MAP_FILE
5721 # Revert back the mapping file name in case needed.
5723 echo "Finished creation of mapping file ( $MAP_FILE )"
5729 # Main function for creating config file (ypserv)
5731 process_config_file
()
5733 # Ask for confirmation if the file name is not specified.
5735 if [ $CONFIG_FILE_SPECIFIED -eq 0 ]; then
5736 display_msg no_config_file_name_specified
5738 get_confirm_nodef
"Do you want to create the config file (y/n) ?"
5740 [ $?
-eq 0 ] && return 0
5744 get_ans
"Enter the config file name (h=help):" "${CONFIG_FILE}"
5746 # If help continue, otherwise break.
5748 [Hh
] |
help | Help |
\?) display_msg new_config_file_name_help
;;
5754 [ $DEBUG -eq 1 ] && CONFIG_FILE
= $CONFIG_FILE
5758 # Backup existing config file if selected
5759 check_back_config_file
5761 # Create config file
5767 # Main function for creating mapping file (NISLDAPmapping)
5769 process_mapping_file
()
5771 # Ask for confirmation if the file name is not specified.
5773 if [ $MAPPING_FILE_SPECIFIED -eq 0 ]; then
5774 display_msg no_mapping_file_name_specified
5776 get_confirm_nodef
"Do you want to create the mapping file (y/n) ?"
5778 [ $?
-eq 0 ] && return 0
5783 # Create mapping file
5787 ###########################################
5788 ########### MAIN ###########
5789 ###########################################
5791 PROG
=`basename $0` # Program name
5792 ABS_PROG
=$0 # absolute path needed
5794 # Only superuser should be able to run this script.
5796 if [ $?
-ne 0 ]; then
5797 echo "ERROR : Only root can run $PROG"
5804 # Parse command line arguments.
5807 # Create config file (ypserv)
5810 # Create mapping file (NISLDAPmapping).
5811 process_mapping_file
5813 # Cleanup temp files and directories unless debug.
5814 [ $DEBUG -eq 0 ] && cleanup