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

svn at pcbsd.org svn at pcbsd.org
Wed Aug 8 08:28:14 PDT 2012


Author: kris
Date: 2012-08-08 15:28:13 +0000 (Wed, 08 Aug 2012)
New Revision: 18353

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

Change how we set opt_ values for ldap config



Modified: pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp	2012-08-08 13:49:46 UTC (rev 18352)
+++ pcbsd/current/src-qt4/pc-adsldap/adsldap.cpp	2012-08-08 15:28:13 UTC (rev 18353)
@@ -10,6 +10,7 @@
 ** destructor.
 *****************************************************************************/
 #include <QTextStream>
+#include <QTextBlock>
 #include <QString>
 #include <QDebug>
 #include <QSettings>
@@ -153,7 +154,25 @@
   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);
+
+  // Remove old opts
+  QString optName, optVal;
+  Utils::setConfFileValue(LDCONF, "opt_", "", -1);
+  for ( int i = 0; i < textLDAux->document()->lineCount(); ++i)
+  { 
+     // Make sure we have a value and key
+     if ( textLDAux->document()->findBlockByLineNumber(i).text().section('=', 0, 0).isEmpty() )
+       continue;
+     if ( textLDAux->document()->findBlockByLineNumber(i).text().section('=', 1).isEmpty() ) 
+       continue;
+
+     optName = "opt_" + textLDAux->document()->findBlockByLineNumber(i).text().section('=', 0, 0).isEmpty();
+
+     optVal = textLDAux->document()->findBlockByLineNumber(i).text().section('=', 1);
+
+     // Save the config
+     Utils::setConfFileValue(LDCONF, optName + " =", optName + " = " + optVal, -1);
+  }
 }
 
 void pcADSLDAP::exportSettings()



More information about the Commits mailing list