# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
"""LDAP classes used by nscfg."""
"""LDAP Name Service class. Represents the configuration
of LDAP. See ldapclient(1m) for details."""
# Supported Property groups
# Type LEGACYNAME Multi-valued(T/F) MV type
# MV Types: ',' ' ' ';' NL (1 per line)
ALLPROPS = {
'version':
'bind_dn':
'bind_passwd':
'enable_shadow_update':
'admin_bind_dn':
'admin_bind_passwd':
'host_certpath':
'profile':
'preferred_server_list':
'server_list':
'search_base':
'search_scope':
'authentication_method':
'credential_level':
'service_search_descriptor':
'search_time_limit':
'bind_time_limit':
'follow_referrals':
'profile_ttl':
'attribute_map':
'objectclass_map':
'service_credential_level':
'service_authentication_method':
}
CREDCONFIG = {
'bind_dn': True,
'bind_passwd': True,
'enable_shadow_update': True,
'admin_bind_dn': True,
'admin_bind_passwd': True,
'host_certpath': True,
}
UNCPROP = (
( 'version', 'astring', '2.0' ),
( 'search_base', 'astring', '' ),
( 'server_list', 'net_address', '0.0.0.0' ),
)
'sasl/DIGEST-MD5:auth-int', 'sasl/DIGEST-MD5:auth-conf',
'tls:sasl/CRAM-MD5', 'tls:sasl/DIGEST-MD5',
'tls:sasl/DIGEST-MD5:auth-int', 'tls:sasl/DIGEST-MD5:auth-conf' )
# Map SMF properties to DB
db = {}
db[p] = None # Setup properties
if pval == None:
continue
else:
continue
else:
if pval == None:
continue
## Process ldap_client_file
try: # start with the version
except:
# Only support newer (V2) configurations
# Note: the client file has both multivalued params on a single line
# and multivalued params 1 per line, and single valued params
if p == 'version':
continue
if p in self.CREDCONFIG:
continue
try: # Get a valid property
except:
val = None
continue
if opmv:
continue # should not happen (see above)
for v in val:
if v == '0.0.0.0':
continue
else:
else:
# Save to temp file, with header
# Save away last_tmp for later comparison
## Process ldap_client_cred
try: # Get a valid property
except:
val = None
continue
# Save to temp file, with header
# Save away last_tmp for later comparison
## Move temp files
# Restore last_tmp
# Restore last_tmp
db = []
if lines == None: # defaults always exist
lines = []
for l in lines:
continue
if idx > 0:
l = l[:idx]
l = l[:-1]
if l == '': # Skip empty lines
continue
continue
try:
continue # Not a valid DB key
map = None
mtype = None
msep = None
map = m
break
if map == None:
continue
if mtype == 'boolean':
emsg = 'Illegal value (%s): %s' \
continue
if map == 'search_scope' and \
continue
else:
emsg = 'Illegal value (%s): %s' \
continue
if map == 'authentication_method' and \
continue
if map == 'credential_level' and \
continue
except:
continue
if err:
if err:
# Check for required client elements
# must have version, search_base and at least one server
if prop == 'version':
if val == '2.0':
else:
elif prop == 'search_base':
emsg = 'Missing configuration: version, search base or server list'
# Check for cred elements
# Only legal values are in CREDCONFIG
try:
pass
except:
# Exit before write processing
# Update config property group
# Commit the property group
# load config property group
# Create the multivalued prop list
mval = {}
mvaltype = {}
# Populate the multivalued prop list
# Load the single valued props
if ptype == 'boolean':
continue
# Now add the multivalued properties
# load cred property group
if ptype == 'boolean':
# Commit both property groups
# validate
"""Unconfigure SMF. Reset DEFPG."""
# Commit the property group
if pgs != None:
if props != None:
'config/search_base' in props and \
( 'config/preferred_server_list' in props or \
'config/server_list' in props ):
return False
return True
return False
"""Was the legacy file generated from SMF data?"""
return True # client and cred file are good
return False # cred file not good
return True # client file good, no cred
return False