[PC-BSD Commits] r18285 - pcbsd/current/src-qt4/pc-adsldap

svn at pcbsd.org svn at pcbsd.org
Tue Aug 7 07:13:04 PDT 2012


Author: kris
Date: 2012-08-07 14:13:04 +0000 (Tue, 07 Aug 2012)
New Revision: 18285

Modified:
   pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp
   pcbsd/current/src-qt4/pc-adsldap/adsldap.ui
Log:

Add LDAP backend integration with service



Modified: pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp	2012-08-07 14:09:58 UTC (rev 18284)
+++ pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp	2012-08-07 14:13:04 UTC (rev 18285)
@@ -25,8 +25,6 @@
   connect(pushSave, SIGNAL(clicked()), this, SLOT(slotSave()));
 
   loadSettings();
-  tabWidget->setTabEnabled(1, false);
-  tabWidget->removeTab(1);
 }
 
 void pcADSLDAP::slotClose()
@@ -135,15 +133,27 @@
   else
     Utils::setConfFileValue(ADCONF, "ad_allow_trusted_doms =", "ad_allow_trusted_doms = no", -1);
 
-  // Restart AD service if enabled   
-  qDebug() << "Enabling AD";
-  Utils::setConfFileValue("/etc/rc.conf", "activedirectory_enable=", "activedirectory_enable=\"YES\"", -1);
-  Utils::runShellCommand("/usr/local/etc/rc.d/pc-adctl start");
 }
 
 void pcADSLDAP::exportLDAP()
 {
-
+  Utils::setConfFileValue(LDCONF, "ldap_hostname =", "ldap_hostname = " + lineLDHostname->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_basedn =", "ldap_basedn = " + lineLDBaseDN->text(), -1);
+  if ( checkLDAnonBinding->isChecked() )
+     Utils::setConfFileValue(LDCONF, "ldap_anonbind =", "ldap_anonbind = yes", -1);
+  else
+     Utils::setConfFileValue(LDCONF, "ldap_anonbind =", "ldap_anonbind = no", -1);
+  Utils::setConfFileValue(LDCONF, "ldap_rootbasedn =", "ldap_rootbasedn = " + lineLDRootBindDN->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_rootbindpw =", "ldap_rootbindpw = " + lineLDRootBindPW->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_rootbindpw =", "ldap_rootbindpw = " + lineLDRootBindPW->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_pwencryption =", "ldap_pwencryption = " + comboLDPWEnc->currentText(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_usersuffix =", "ldap_usersuffix = " + lineLDUserSuffix->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_groupsuffix =", "ldap_groupsuffix = " + lineLDGroupSuffix->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_passwordstuff =", "ldap_passwordstuff = " + lineLDPWSuffix->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_machinesuffix =", "ldap_machinesuffix = " + lineLDMachineSuffix->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_encryption_mode =", "ldap_encryption_mode = " + comboLDEncMode->currentText().toLower(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_tls_cacertfile =", "ldap_tls_cacertfile = " + lineLDSelfSignedCert->text(), -1);
+  Utils::setConfFileValue(LDCONF, "ldap_options =", "ldap_options = " + textLDAux->toPlainText().simplified(), -1);
 }
 
 void pcADSLDAP::exportSettings()
@@ -151,12 +161,24 @@
   // Start adding AD.conf values
   if ( groupADS->isChecked() ) {
     exportAD();
+    // Restart AD service if enabled   
+    qDebug() << "Enabling AD";
+    Utils::setConfFileValue("/etc/rc.conf", "activedirectory_enable=", "activedirectory_enable=\"YES\"", -1);
+    Utils::runShellCommand("/usr/local/etc/rc.d/pc-adctl start");
   } else {
      qDebug() << "Disabling AD";
      Utils::runShellCommand("/usr/local/etc/rc.d/pc-adctl stop");
      Utils::setConfFileValue("/etc/rc.conf", "activedirectory_enable=", "activedirectory_enable=\"NO\"", -1);
   }
-
-  if ( groupLDAP->isChecked() )
+  
+  // Enable the LDAP service
+  if ( groupLDAP->isChecked() ) {
     exportLDAP();
+     Utils::setConfFileValue("/etc/rc.conf", "ldapclient_enable=", "ldapclient_enable=\"YES\"", -1);
+     Utils::runShellCommand("/usr/local/etc/rc.d/pc-ldap start");
+  } else {
+     qDebug() << "Disabling LDAP";
+     Utils::runShellCommand("/usr/local/etc/rc.d/pc-ldap stop");
+     Utils::setConfFileValue("/etc/rc.conf", "ldapclient_enable=", "ldapclient_enable=\"NO\"", -1);
+  }
 }

Modified: pcbsd/current/src-qt4/pc-adsldap/adsldap.ui
===================================================================
(Binary files differ)



More information about the Commits mailing list