7065379 Text installer LDAP proxy bind password not encrypted into profile
authorWilliam Schumann <william.schumann@sun.com>
Tue, 12 Jul 2011 05:17:28 -0700
changeset 1269 52a132cd3aa8
parent 1268 25dda32568b2
child 1270 02782558f09a
7065379 Text installer LDAP proxy bind password not encrypted into profile
usr/src/cmd/system-config/nameservice.py
usr/src/cmd/system-config/profile/nameservice_info.py
--- a/usr/src/cmd/system-config/nameservice.py	Mon Jul 11 16:52:18 2011 -0600
+++ b/usr/src/cmd/system-config/nameservice.py	Tue Jul 12 05:17:28 2011 -0700
@@ -27,6 +27,7 @@
 '''
 
 import logging
+import nss
 import re
 import string
 
@@ -477,7 +478,11 @@
                   "LDAP proxy bind password.  The network administrator "
                   "can provide this information.")
         self.title = _("Proxy bind distinguished name:")
-        self.title2 = _("Proxy bind password:")
+        # temporary code until ns1_convert method is integrated
+        if hasattr(nss.nssscf, 'ns1_convert'):
+            self.title2 = _("Proxy bind password:")
+        else:
+            self.title2 = _("Encrypted proxy bind password:")
 
     def _show(self):
         super(NSLDAPProxyBindInfo, self)._show()
@@ -506,7 +511,7 @@
         self.ldap_pb_psw = EditField(area, window=self.center_win,
                                      text=self.nameservice.ldap_pb_psw,
                                      error_win=self.main_win.error_line,
-                                     masked=True)
+                                     masked=hasattr(nss.nssscf, 'ns1_convert'))
         self.main_win.do_update()
         self.center_win.activate_object(self.ldap_pb_dn)
 
--- a/usr/src/cmd/system-config/profile/nameservice_info.py	Mon Jul 11 16:52:18 2011 -0600
+++ b/usr/src/cmd/system-config/profile/nameservice_info.py	Tue Jul 12 05:17:28 2011 -0700
@@ -27,6 +27,7 @@
 '''
 
 import logging
+import nss
 
 from solaris_install.data_object import DataObject
 from solaris_install.logger import INSTALL_LOGGER_NAME
@@ -162,8 +163,15 @@
                 ldap.insert_children([ldap_cred_props])
                 ldap_cred_props.setprop("propval", "bind_dn", "astring",
                                         self.ldap_pb_dn)
+                # encrypt password if encryption method was integrated
+                # otherwise, user must enter encrypted password
+                # the check for the method can be removed after integration
+                if hasattr(nss.nssscf, 'ns1_convert'):
+                    psw = nss.nssscf.ns1_convert(self.ldap_pb_psw)
+                else:
+                    psw = self.ldap_pb_psw
                 ldap_cred_props.setprop("propval", "bind_passwd", "astring",
-                                        self.ldap_pb_psw)
+                                        psw)
             # configure default service instance
             ldap.insert_children(ENABLED_DEFAULT_SERVICE_LIST)
         # For NIS, user is given automatic (broadcast) or manual