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

svn at pcbsd.org svn at pcbsd.org
Mon Jul 30 12:02:51 PDT 2012


Author: kris
Date: 2012-07-30 19:02:51 +0000 (Mon, 30 Jul 2012)
New Revision: 17996

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

Add backend integration with pc-adctl to start / stop AD services



Modified: pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp	2012-07-30 17:20:31 UTC (rev 17995)
+++ pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp	2012-07-30 19:02:51 UTC (rev 17996)
@@ -16,6 +16,8 @@
 #include <pcbsd-utils.h>
 #include "adsldap.h"
 
+#define ADCONF QString("/usr/local/etc/AD.conf")
+
 void pcADSLDAP::programInit()
 {
   connect(pushClose, SIGNAL(clicked()), this, SLOT(slotClose()));
@@ -43,6 +45,13 @@
    // Save ADS settings
    QSettings settings("PCBSD", "ADS");
    settings.setValue("Enabled", groupADS->isChecked());
+
+   // Enable / disable AD service
+   if ( groupADS->isChecked() )
+      Utils::setConfFileValue("/etc/rc.conf", "activedirectory_enable=", "activedirectory_enable=\"YES\"", -1);
+   else
+      Utils::setConfFileValue("/etc/rc.conf", "activedirectory_enable=", "activedirectory_enable=\"NO\"", -1);
+
    settings.setValue("DomainController", lineADSDomainController->text());
    settings.setValue("DomainName", lineADSDomainName->text());
    settings.setValue("NetBIOS", lineADSNetBIOS->text());
@@ -51,6 +60,8 @@
    settings.setValue("AdminName", lineADSAdminName->text());
    settings.setValue("AdminPW", lineADSAdminPW->text());
 
+
+
    QSettings settings2("PCBSD", "LDAP");
    settings2.setValue("Enabled", groupLDAP->isChecked());
    settings2.setValue("AnonBinding", checkLDAnonBinding->isChecked());
@@ -67,12 +78,19 @@
    settings2.setValue("UserSuffix", lineLDUserSuffix->text());
    settings2.setValue("Aux", textLDAux->toPlainText());
 
+
+   
 }
 
 void pcADSLDAP::loadSettings()
 {
   QSettings settings("PCBSD", "ADS");
-  groupADS->setChecked(settings.value("Enabled", false).toBool());
+  QString tmp = Utils::getConfFileValue("/etc/rc.conf", "activedirectory_enable=", 1) ;
+  if ( tmp == "YES" ) 
+    groupADS->setChecked(true);
+  else
+    groupADS->setChecked(false);
+
   lineADSDomainController->setText(settings.value("DomainController", QString()).toString());
   lineADSDomainName->setText(settings.value("DomainName", QString()).toString());
   lineADSNetBIOS->setText(settings.value("NetBIOS", QString()).toString());
@@ -112,20 +130,19 @@
       return;
   }
 
-  QString ADCONF="/usr/local/etc/AD.conf";
   QString tmp;
 
-  Utils::setConfFileValue( ADCONF, "ad_domainname", "ad_domainname=\"" + lineADSDomainName->text() + "\"", -1);
-  Utils::setConfFileValue( ADCONF, "ad_adminname", "ad_adminname=\"" + lineADSAdminName->text() + "\"", -1);
-  Utils::setConfFileValue( ADCONF, "ad_adminpw", "ad_adminpw=\"" + lineADSAdminPW->text() + "\"", -1);
-  Utils::setConfFileValue( ADCONF, "ad_workgroup", "ad_workgroup=\"" + lineADSWorkgroup->text() + "\"", -1);
-  Utils::setConfFileValue( ADCONF, "ad_netbiosname", "ad_netbiosname=\"" + lineADSNetBIOS->text() + "\"", -1);
-  Utils::setConfFileValue( ADCONF, "ad_domaincontroller", "ad_domaincontroller=\"" + lineADSDomainController->text() + "\"", -1);
-  if ( checkADSTrustedDomains->isChecked() )
-    tmp = "true";  
-  else
-    tmp = "false";  
-  Utils::setConfFileValue( ADCONF, "ad_trusteddomains", "ad_trusteddomains=\"" + tmp + "\"", -1);
+  // Now write /usr/local/etc/AD.conf values
+  Utils::setConfFileValue(ADCONF, "ad_domainname =", "ad_domainname = " + lineADSDomainName->text(), -1);
+  Utils::setConfFileValue(ADCONF, "ad_adminname =", "ad_adminname = " + lineADSAdminName->text(), -1);
+  Utils::setConfFileValue(ADCONF, "ad_adminpw =", "ad_adminpw = " + lineADSAdminPW->text(), -1);
+  Utils::setConfFileValue(ADCONF, "ad_workgroup =", "ad_workgroup = " + lineADSWorkgroup->text().toUpper(), -1);
+  Utils::setConfFileValue(ADCONF, "ad_netbiosname =", "ad_netbiosname = " + lineADSNetBIOS->text().toUpper(), -1);
+  
+  // Restart AD service if enabled   
+  if ( groupADS->isChecked() ) {
+  }
+
 }
 
 void pcADSLDAP::exportLDAP()



More information about the Commits mailing list