[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r2959: First commit including the changes according to proposal 121 (vidalia/branches/hidden-services/src/vidalia/config)



Author: borkdomenik
Date: 2008-08-14 06:01:50 -0400 (Thu, 14 Aug 2008)
New Revision: 2959

Modified:
   vidalia/branches/hidden-services/src/vidalia/config/service.cpp
   vidalia/branches/hidden-services/src/vidalia/config/service.h
   vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp
   vidalia/branches/hidden-services/src/vidalia/config/servicepage.h
   vidalia/branches/hidden-services/src/vidalia/config/servicepage.ui
   vidalia/branches/hidden-services/src/vidalia/config/servicesettings.cpp
Log:
First commit including the changes according to proposal 121 and the changes of the hidden service authorization protocol.
* changes of the .ui file to imclude basic|stealth check boxes
* include a attribute stealth to the Service entity in order to store the authorization mode
* several changes in the servicepage file according to proposal 121
* several changes in the servicesettings file because of the enlargement of the Service entity
* some smaller bugfixes

Modified: vidalia/branches/hidden-services/src/vidalia/config/service.cpp
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/config/service.cpp	2008-08-12 18:14:03 UTC (rev 2958)
+++ vidalia/branches/hidden-services/src/vidalia/config/service.cpp	2008-08-14 10:01:50 UTC (rev 2959)
@@ -16,7 +16,7 @@
 
 /** Constructor to create a new Service with initial settings */
 Service::Service(QString serviceAddress, QString virtualPort,
- QString physicalAddressPort, QString serviceDirectory, bool enabled)
+ QString physicalAddressPort, QString serviceDirectory, bool enabled, bool stealth)
 {
 
   _serviceAddress = serviceAddress;
@@ -24,6 +24,7 @@
   _physicalAddressPort = physicalAddressPort;
   _serviceDirectory = serviceDirectory;
   _enabled = enabled;
+  _stealth = stealth;
 }
 
 /** Destructor */
@@ -37,6 +38,12 @@
   _enabled = enabled;
 }
 
+/** Sets the authorization configuration mode */
+void Service::setStealth(bool stealth)
+{
+  _stealth = stealth;
+}
+
 /** Sets the adress of a service */
 void Service::setServiceAddress(QString serviceAddress)
 {
@@ -98,6 +105,7 @@
   out << myObj.physicalAddressPort();
   out << myObj.serviceDirectory();
   out << myObj.enabled();
+  out << myObj.stealth();
   out << myObj.additionalServiceOptions();
   out << myObj.users();
 
@@ -113,12 +121,14 @@
   QString physicalAddressPort;
   QString serviceDirectory;
   bool enabled;
+  bool stealth;
   QString additionalServiceOptions;
   QList<UserAuthorizationData> users;
 
   /* Read in from the data stream */
   in >> serviceAddress >> virtualPort  >> physicalAddressPort
-   >> serviceDirectory >> enabled >> additionalServiceOptions >> users;
+   >> serviceDirectory >> enabled >> stealth 
+   >> additionalServiceOptions >> users;
 
   /* Set the appropriate class member variables */
   myObj.setServiceAddress(serviceAddress);
@@ -126,6 +136,7 @@
   myObj.setPhysicalAddressPort(physicalAddressPort);
   myObj.setServiceDirectory(serviceDirectory);
   myObj.setEnabled(enabled);
+  myObj.setStealth(stealth);
   myObj.setAdditionalServiceOptions(additionalServiceOptions);
   myObj.setUsers(users);
 
@@ -138,10 +149,13 @@
 QString
 Service::toString()
 {
-  QString s;
+  QString s, stealth;
+  if(_stealth) {
+    stealth = "x1";
+  }
   s.append(_serviceAddress +"#"+ _virtualPort +"#"+  _physicalAddressPort +
-    "#"+ _serviceDirectory +"#"+  _enabled + "#"+ _additionalServiceOptions +
-    "#");
+    "#"+ _serviceDirectory +"#"+  _enabled + "#"+ stealth +"#"+ 
+    _additionalServiceOptions + "#");
   foreach(UserAuthorizationData user, _users)
   {
     s.append(user.toString());

Modified: vidalia/branches/hidden-services/src/vidalia/config/service.h
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/config/service.h	2008-08-12 18:14:03 UTC (rev 2958)
+++ vidalia/branches/hidden-services/src/vidalia/config/service.h	2008-08-14 10:01:50 UTC (rev 2959)
@@ -24,7 +24,7 @@
   Service();
   /** Constructor to create a new Service with initial settings */
   Service(QString serviceAddress, QString virtualPort,
-   QString physicalAddressPort, QString serviceDirectory, bool enabled);
+   QString physicalAddressPort, QString serviceDirectory, bool enabled, bool stealth);
   /** Destructor */
   virtual ~Service();
   /** Returns the service Adress of the service */
@@ -37,6 +37,8 @@
   QString serviceDirectory() const { return _serviceDirectory; }
   /** Returns the deployed status of a service */
   bool enabled() const { return _enabled; }
+  /** Returns the authorization configuration mode */
+  bool stealth() const { return _stealth; }
   /** Returns the additional options of a service e.g. excludeNodes */
   QString additionalServiceOptions() const
    { return _additionalServiceOptions; }
@@ -52,6 +54,8 @@
   void setServiceDirectory(QString serviceDirectory);
   /** Sets the deployed status a service */
   void setEnabled(bool enabled);
+  /** Sets the authorization configuration mode */
+  void setStealth(bool stealth);
   /** Sets the additional options of a service e.g. excludeNodes */
   void setAdditionalServiceOptions(QString options);
   /** Adds the given user to the list of users associated to the service */
@@ -80,6 +84,8 @@
   QString _serviceDirectory;
   /** The Enabled status of the service */
   bool _enabled;
+  /** This attribute represents the configuration mode of the authorization*/
+  bool _stealth;
   /** Some additional service options, not configured/displayed by Vidalia */
   QString _additionalServiceOptions;
   /** The list of users associated to the service */

Modified: vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp	2008-08-12 18:14:03 UTC (rev 2958)
+++ vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp	2008-08-14 10:01:50 UTC (rev 2959)
@@ -113,6 +113,8 @@
    SLOT(serviceAccessValueChanged()));
   connect(ui.serviceAccessWidget, SIGNAL(itemClicked(QTableWidgetItem*)), this,
    SLOT(serviceAccessSelectionChanged()));
+  connect(ui.checkBox_basic, SIGNAL(toggled(bool)), this, SLOT(checkBoxBasicToggled()));
+  connect(ui.checkBox_stealth, SIGNAL(toggled(bool)), this, SLOT(checkBoxStealthToggled()));
 }
 
 /** Destructor */
@@ -140,8 +142,9 @@
       QString directoryPath = ui.serviceWidget->item(index,3)->text();
       bool enabled = _services->value(index).enabled();
       QList<UserAuthorizationData> users = _services->value(index).users();
+      bool stealth = _services->value(index).stealth();
       Service temp(address, virtualPort, physicalAddress, directoryPath,
-       enabled);
+       enabled, stealth);
       temp.setAdditionalServiceOptions(_services->value(ui.serviceWidget->
        currentRow()).additionalServiceOptions());
       temp.setUsers(users);
@@ -286,9 +289,9 @@
   QString serviceConfString;
   QString errmsg = "Error while trying to publish services.";
   QListIterator<Service> it(services);
-  QList<UserAuthorizationData> publishedUsers;
   bool first = true;
   while(it.hasNext()) {
+    QList<UserAuthorizationData> publishedUsers;
     Service temp = it.next();
     serviceConfString.append("hiddenservicedir=" +
      string_escape(temp.serviceDirectory()) + " ");
@@ -304,12 +307,18 @@
       }
     }
     if(publishedUsers.size() > 0) {
+      QString stealthMode = "basic";
+      if(temp.stealth()) {
+        stealthMode = "stealth";
+      }
       serviceConfString.append(" hiddenserviceversion=\"2\" \
-       hiddenserviceauthorizeclient="+
-       string_escape(createUserAuthStringForTor(publishedUsers)));
+       hiddenserviceauthorizeclient="+string_escape(stealthMode+" " + 
+       createUserAuthStringForTor(publishedUsers)));
     }
     serviceConfString.append(" "+ temp.additionalServiceOptions());
   }
+  VMessageBox::warning(this, tr("torConfString"), serviceConfString,
+     VMessageBox::Ok);
   _serviceSettings->applyServices(serviceConfString, &errmsg);
 }
 
@@ -370,6 +379,8 @@
   QList<Service> completeList;
   QString torConfigurationString = _serviceSettings->
    getHiddenServiceDirectories();
+   VMessageBox::warning(this, tr("kompletter string:"), torConfigurationString,
+             VMessageBox::Ok);
   torServiceList = extractSingleServices(torConfigurationString);
   // the services stored with vidalia
   ServiceList serviceList = _serviceSettings->getServices();
@@ -409,6 +420,7 @@
 
 /** this method returns a Service by parseing the configuration string
  *  of Tor and storing its values into the object */
+ //XTODO hier den parser auch anpassen um basic/stealth abzufange!!
 Service
 ServicePage::generateService(QString s)
 {
@@ -439,6 +451,20 @@
        }
        additionalOptions.remove(indexstart, (indexend-indexstart));
      }
+    //remove first appearance of HiddenServiceVerison
+    indexstart = additionalOptions.indexOf("hiddenserviceversion", 0, Qt::CaseInsensitive);
+    endindex = additionalOptions.indexOf("250", indexstart);
+    if(endindex != -1) {
+      additionalOptions.remove(indexstart, (endindex-indexstart)+4);
+    } else {
+      endindex = additionalOptions.indexOf("\n", indexstart);
+      if(endindex != -1) {
+        additionalOptions.remove(indexstart, (endindex-indexstart));
+      } else {
+        endindex = additionalOptions.length()-1;
+        additionalOptions.remove(indexstart, (endindex-indexstart));
+      }
+    }
     //remove all appearances of "250"
     while(additionalOptions.contains("250")) {
       int i = additionalOptions.indexOf("250", 0);
@@ -463,6 +489,7 @@
   }
 
   QString address, virtualPort, physAddressPort, serviceDir;
+  bool stealth = false;
   // service directory
   QStringList strList = s.split("\n");
   QString tempServiceDir = strList.first().trimmed();
@@ -484,9 +511,6 @@
        QString tempVirtualPort = strList3.first();
        virtualPort = tempVirtualPort.remove(0, 1);
   }
-  //get all users that are in the client-keys file
-  QList<UserAuthorizationData> allUsers = parseClientKeys(serviceDir);
-  //get all actual users by parsing the hostname file
   QList<UserAuthorizationData> actualUsers;
   if(s.contains("HiddenServiceAuthorizeClient")) {
     userAuthConfigured = true;
@@ -494,18 +518,17 @@
     strList5.removeFirst();
     QStringList strList6 = strList5.first().split("\n");
     strList6.first().remove(0,1);
+    QStringList stealthList = strList6.first().split(" ");
+    if(stealthList.first().compare("stealth") == 0) {
+      stealth = true;
+      strList6.first().remove(0,8);
+    } else {
+      strList6.first().remove(0,6);
+    }
     QStringList userList = strList6.first().split(",");
     foreach(QString user, userList) {
       QString authdata, filereader;
       int index = 0;
-      //remove the users in the allUsers data structure,if they are actual users
-      while(index < allUsers.size()) {
-        UserAuthorizationData temp = allUsers.at(index);
-        if(temp.identification().compare(user) == 0) {
-          allUsers.removeAt(index);
-        }
-        index++;
-      }
       //parse the hostname file to get the authorization data
       QString dir = serviceDir;
       dir.append("/hostname");
@@ -519,37 +542,27 @@
           filereader.append("\n");
         }
         QStringList strList7 = filereader.split("\n");
-        //remove first 5 lines
-        for(int i = 0; i < 5; i++) {
-          strList7.removeFirst();
-        }
-        while(strList7.isEmpty() == false) {
-          QString temp = strList7.first();
-          if(temp.contains(""+user)){
-            break;
-          } else {
-             strList7.removeFirst();
-          }
-        }
-        QString temp = strList7.first();
-        QStringList strList8 = temp.split("#");
-        authdata = strList8.first();
-        authdata.remove(authdata.length()-1,1);
+        foreach(QString userString, strList7) {
+         if(userString.length() > 1 && userString.contains(user)) {
+           QString onion, cookie, id;
+           QStringList strList2 = userString.split(" ");
+           onion = strList2.first();
+           strList2.removeFirst();
+           cookie = strList2.first();
+           strList2.removeFirst();
+           strList2.removeFirst();
+           strList2.removeFirst();
+           id = strList2.first();
+           authdata = onion+" "+cookie;
+           UserAuthorizationData u(onion+" "+cookie, id);
+           u.setEnabled(true);
+           actualUsers.push_back(u);
+         }
+       }
       }
-      UserAuthorizationData u(authdata, user);
-      actualUsers.push_back(u);
     }
   }
-  //if there are some users not in the actual users data structure,
-  //but in client-keys
-  if(allUsers.size() > 0) {
-    QListIterator<UserAuthorizationData> it2(allUsers);
-    while(it2.hasNext()) {
-      UserAuthorizationData tempData = it2.next();
-      actualUsers.push_back(tempData);
-    }
-  }
-  //get .onion address
+  //get .onion address, cookie and identification
   if(userAuthConfigured == true) {
     address = "[Client Auth Configured]";
   } else {
@@ -568,7 +581,7 @@
           address = hostname;
         }
   }
-  Service service(address, virtualPort, physAddressPort, serviceDir, true);
+  Service service(address, virtualPort, physAddressPort, serviceDir, true, stealth);
   service.setAdditionalServiceOptions(additionalOptions);
   service.setUsers(actualUsers);
   _torServices->insert(serviceDir, service);
@@ -578,33 +591,43 @@
 /** this method is called to parse the client_keys file in order to
  *  get all users that had a authorization for the Service
  * @return a list of all users found in client_keys*/
-QList<UserAuthorizationData>
-ServicePage::parseClientKeys(QString dir)
-{
-  QList<UserAuthorizationData> result;
-  QString value;
-  QFile file(dir.append("/client_keys"));
-  if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
-    return result;
-  } else {
-      QTextStream in(&file);
-      QString content;
-      while (!in.atEnd()) {
-        content.append(in.readLine());
-        content.append("\n");
-      }
-      value = content;
-  }
-  QStringList strList = value.split("client-name");
-  strList.removeFirst();
-  foreach(QString user, strList) {
-    QStringList strList2 = user.split("\n");
-    UserAuthorizationData u("[Created by Tor]", strList2.first().trimmed());
-    u.setEnabled(false);
-    result.push_back(u);
-  }
-  return result;
-}
+//QList<UserAuthorizationData>
+//ServicePage::parseClientKeys(QString dir)
+//{
+  //QList<UserAuthorizationData> result;
+  //QString value;
+  //XTODO hier änderungen!!
+  //QFile file(dir.append("/hostname"));
+  //if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+    //return result;
+  //} else {
+      //QTextStream in(&file);
+      //QString content;
+      //while (!in.atEnd()) {
+        //content.append(in.readLine());
+        //content.append("\n");
+      //}
+      //value = content;
+  //}
+  //QStringList strList1 = value.split("\n");
+  //foreach(QString user, strList1) {
+   //if(user.length() > 1) {
+     //QString onion, cookie, id;
+     //QStringList strList2 = user.split(" ");
+     //onion = strList2.first();
+     //strList2.removeFirst();
+     //cookie = strList2.first();
+     //strList2.removeFirst();
+     //strList2.removeFirst();
+     //strList2.removeFirst();
+     //id = strList2.first();
+     //UserAuthorizationData u(onion+" "+cookie, id);
+     //u.setEnabled(false);
+     //result.push_back(u);
+   //}
+ //}
+  //return result;
+//}
 
 /** this method merges the list of services received from Vidalia and Tor
   * @return a list containing all services without double entries */
@@ -762,6 +785,7 @@
   ui.serviceWidget->setItem(rows, 4, cboxitem);
   Service s;
   s.setEnabled(true);
+  s.setStealth(false);
   _services->insert(rows, s);
 }
 
@@ -975,6 +999,13 @@
     ui.authClientsGroupBox->setVisible(false);
     ui.restrictAccessCheckBox->setCheckState(Qt::Unchecked);
   } else {
+      if(selService.stealth()) {
+        ui.checkBox_stealth->setCheckState(Qt::Checked);
+        ui.checkBox_basic->setCheckState(Qt::Unchecked);
+      } else {
+        ui.checkBox_basic->setCheckState(Qt::Checked);
+        ui.checkBox_stealth->setCheckState(Qt::Unchecked);
+      }
       int rowcount = 0;
       QListIterator<UserAuthorizationData> it(assoziatedUsers);
       while(it.hasNext()) {
@@ -1193,24 +1224,13 @@
 {
   QString serviceAuthdata, serviceIdentification;
   serviceAuthdata = ui.authLineAccess->text();
-  serviceIdentification = ui.commentLineAccess->text();
-  if(serviceAuthdata.length() == 0 || serviceIdentification.length() == 0) {
-    VMessageBox::warning(this, tr("Error"), tr("Please fill out both fields."),
+  serviceIdentification = ""+ui.commentLineAccess->text();
+  if(serviceAuthdata.length() == 0) {
+    VMessageBox::warning(this, tr("Error"), tr("Authorization data has to be set."),
      VMessageBox::Ok);
      return;
   } else {
-    for(int i = 0; i < ui.serviceAccessWidget->rowCount(); i++) {
-      QString tempidentification = ui.serviceAccessWidget->item(i, 1)->text();
-      if(serviceIdentification.compare(tempidentification) == 0) {
-        VMessageBox::warning(this, tr("Error"), tr("Identification has to be\
-        unique, try another one please."), VMessageBox::Ok);
-        ui.commentLineAccess->clear();
-        return;
-     }
-    }
     int pos = 0;
-    if(_identificationValidator->validate(serviceIdentification, pos) ==
-     QValidator::Acceptable) {
       if(validateServiceAuth(serviceAuthdata) == QValidator::Acceptable) {
         int rows = ui.serviceAccessWidget->rowCount();
         ui.serviceAccessWidget->insertRow(rows);
@@ -1225,14 +1245,11 @@
         ui.commentLineAccess->clear();
         ServiceAuthorizationData s(serviceAuthdata, serviceIdentification);
         _consumedServices->insert(serviceIdentification, s);
+      } else {
+         VMessageBox::warning(this, tr("Error"), tr("Invalid input for the\
+          authorization. Only [onion-Address] [descriptor-cookie] allowed."),
+          VMessageBox::Ok);
       }
-    } else {
-      VMessageBox::warning(this, tr("Error"), tr("Invalid characters for the\
-       identification, only {[a-z][A-Z][0-9]+-_} allowed. The length has to be\
-       between 1 and 19."), VMessageBox::Ok);
-        ui.commentLineAccess->clear();
-        return;
-    }
   }
 }
 
@@ -1242,6 +1259,9 @@
 QValidator::State
 ServicePage::validateServiceAuth(QString authString)
 {
+  if(authString.length() != 45 || authString.contains(" ") == false) {
+    return QValidator::Invalid;
+  }
   QStringList strList = authString.split(" ");
   int pos = 0;
   if(_onionAdressValidator->validate(strList.first(), pos) ==
@@ -1503,3 +1523,31 @@
   return true;
 }
 
+void
+ServicePage::checkBoxBasicToggled()
+{
+  bool state = ui.checkBox_basic->checkState() == Qt::Checked;
+  if(state) {
+    ui.checkBox_stealth->setCheckState(Qt::Unchecked);
+  } else {
+    ui.checkBox_stealth->setCheckState(Qt::Checked);
+  }
+  Service s = _services->take(ui.serviceWidget->currentRow());
+  s.setStealth(!state);
+  _services->insert(ui.serviceWidget->currentRow(), s);
+}
+
+void
+ServicePage::checkBoxStealthToggled()
+{
+  bool state = ui.checkBox_stealth->checkState() == Qt::Checked;
+  if(state) {
+    ui.checkBox_basic->setCheckState(Qt::Unchecked);
+  } else {
+    ui.checkBox_basic->setCheckState(Qt::Checked);
+  }
+  Service s = _services->take(ui.serviceWidget->currentRow());
+  s.setStealth(state);
+  _services->insert(ui.serviceWidget->currentRow(), s);
+}
+

Modified: vidalia/branches/hidden-services/src/vidalia/config/servicepage.h
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/config/servicepage.h	2008-08-12 18:14:03 UTC (rev 2958)
+++ vidalia/branches/hidden-services/src/vidalia/config/servicepage.h	2008-08-14 10:01:50 UTC (rev 2959)
@@ -53,7 +53,7 @@
   /** this method is called to parse the client_keys file in order to
   * get all users that had a authorization for the Service
   * @return a list of all users found in client_keys*/
-  QList<UserAuthorizationData> parseClientKeys(QString dir);
+  //QList<UserAuthorizationData> parseClientKeys(QString dir);
   /** this method creates the configuration string for tor including the
    * user authorization*/
   QString createUserAuthStringForTor(QList<UserAuthorizationData> users);
@@ -113,6 +113,8 @@
   /** Called whenever the user selects a different service authorization
    * entry(Provided Services)*/
   void serviceAuthSelectionChanged();
+  void checkBoxBasicToggled();
+  void checkBoxStealthToggled();
 
 private:
 

Modified: vidalia/branches/hidden-services/src/vidalia/config/servicepage.ui
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/config/servicepage.ui	2008-08-12 18:14:03 UTC (rev 2958)
+++ vidalia/branches/hidden-services/src/vidalia/config/servicepage.ui	2008-08-14 10:01:50 UTC (rev 2959)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>653</width>
-    <height>519</height>
+    <height>496</height>
    </rect>
   </property>
   <property name="sizePolicy" >
@@ -24,8 +24,8 @@
   <property name="windowIcon" >
    <iconset>../../../../../.designer/backup</iconset>
   </property>
-  <layout class="QVBoxLayout" >
-   <item>
+  <layout class="QGridLayout" >
+   <item row="0" column="0" >
     <widget class="QTabWidget" name="tabWidget" >
      <property name="sizePolicy" >
       <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
@@ -40,226 +40,276 @@
       <attribute name="title" >
        <string>Provide Hidden Services</string>
       </attribute>
-      <layout class="QVBoxLayout" >
-       <item>
-        <widget class="QGroupBox" name="groupBox" >
-         <property name="sizePolicy" >
-          <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="minimumSize" >
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="maximumSize" >
-          <size>
-           <width>16777215</width>
-           <height>16777215</height>
-          </size>
-         </property>
-         <property name="title" >
-          <string>Service List</string>
-         </property>
-         <layout class="QGridLayout" >
-          <item rowspan="5" row="0" column="0" >
-           <widget class="QTableWidget" name="serviceWidget" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
+      <widget class="QGroupBox" name="groupBox" >
+       <property name="geometry" >
+        <rect>
+         <x>9</x>
+         <y>7</y>
+         <width>613</width>
+         <height>230</height>
+        </rect>
+       </property>
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize" >
+        <size>
+         <width>561</width>
+         <height>230</height>
+        </size>
+       </property>
+       <property name="maximumSize" >
+        <size>
+         <width>16777215</width>
+         <height>16777215</height>
+        </size>
+       </property>
+       <property name="title" >
+        <string>Service List</string>
+       </property>
+       <widget class="QWidget" name="layoutWidget" >
+        <property name="geometry" >
+         <rect>
+          <x>11</x>
+          <y>29</y>
+          <width>591</width>
+          <height>190</height>
+         </rect>
+        </property>
+        <layout class="QGridLayout" >
+         <item rowspan="5" row="0" column="0" >
+          <widget class="QTableWidget" name="serviceWidget" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize" >
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="maximumSize" >
+            <size>
+             <width>16777215</width>
+             <height>16777215</height>
+            </size>
+           </property>
+           <property name="baseSize" >
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="selectionMode" >
+            <enum>QAbstractItemView::SingleSelection</enum>
+           </property>
+           <property name="selectionBehavior" >
+            <enum>QAbstractItemView::SelectRows</enum>
+           </property>
+           <property name="textElideMode" >
+            <enum>Qt::ElideLeft</enum>
+           </property>
+           <property name="showGrid" >
+            <bool>true</bool>
+           </property>
+           <column>
+            <property name="text" >
+             <string>Onion Address</string>
             </property>
-            <property name="minimumSize" >
-             <size>
-              <width>0</width>
-              <height>0</height>
-             </size>
+           </column>
+           <column>
+            <property name="text" >
+             <string>Virtual Port</string>
             </property>
-            <property name="maximumSize" >
-             <size>
-              <width>16777215</width>
-              <height>16777215</height>
-             </size>
+           </column>
+           <column>
+            <property name="text" >
+             <string>Target</string>
             </property>
-            <property name="baseSize" >
-             <size>
-              <width>0</width>
-              <height>0</height>
-             </size>
-            </property>
-            <property name="selectionMode" >
-             <enum>QAbstractItemView::SingleSelection</enum>
-            </property>
-            <property name="selectionBehavior" >
-             <enum>QAbstractItemView::SelectRows</enum>
-            </property>
-            <property name="textElideMode" >
-             <enum>Qt::ElideLeft</enum>
-            </property>
-            <property name="showGrid" >
-             <bool>true</bool>
-            </property>
-            <column>
-             <property name="text" >
-              <string>Onion Address</string>
-             </property>
-            </column>
-            <column>
-             <property name="text" >
-              <string>Virtual Port</string>
-             </property>
-            </column>
-            <column>
-             <property name="text" >
-              <string>Target</string>
-             </property>
-            </column>
-            <column>
-             <property name="text" >
-              <string>Directory Path</string>
-             </property>
-            </column>
-            <column>
-             <property name="text" >
-              <string>Enabled</string>
-             </property>
-            </column>
-           </widget>
-          </item>
-          <item row="0" column="1" >
-           <widget class="QToolButton" name="addServiceBtn" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="toolTip" >
-             <string>Add new service to list</string>
-            </property>
+           </column>
+           <column>
             <property name="text" >
-             <string/>
+             <string>Directory Path</string>
             </property>
-            <property name="icon" >
-             <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-add.png</iconset>
-            </property>
-           </widget>
-          </item>
-          <item row="1" column="1" >
-           <widget class="QToolButton" name="removeServiceBtn" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="toolTip" >
-             <string>Remove selected service from list</string>
-            </property>
+           </column>
+           <column>
             <property name="text" >
-             <string/>
+             <string>Enabled</string>
             </property>
-            <property name="icon" >
-             <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-remove.png</iconset>
-            </property>
-           </widget>
-          </item>
-          <item row="2" column="1" >
-           <widget class="QToolButton" name="copyServiceBtn" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="toolTip" >
-             <string>Copy onion address of selected service to clipboard</string>
-            </property>
+           </column>
+          </widget>
+         </item>
+         <item row="0" column="1" >
+          <widget class="QToolButton" name="addServiceBtn" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="toolTip" >
+            <string>Add new service to list</string>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="icon" >
+            <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-add.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1" >
+          <widget class="QToolButton" name="removeServiceBtn" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="toolTip" >
+            <string>Remove selected service from list</string>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="icon" >
+            <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-remove.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1" >
+          <widget class="QToolButton" name="copyServiceBtn" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="toolTip" >
+            <string>Copy onion address of selected service to clipboard</string>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="icon" >
+            <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/edit-copy.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="1" >
+          <widget class="QToolButton" name="browseServiceBtn" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="toolTip" >
+            <string>Browse in local file system and choose directory for selected service</string>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="icon" >
+            <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/folder.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="1" >
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>26</width>
+             <height>70</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
+      </widget>
+      <widget class="QCheckBox" name="restrictAccessCheckBox" >
+       <property name="geometry" >
+        <rect>
+         <x>9</x>
+         <y>243</y>
+         <width>613</width>
+         <height>23</height>
+        </rect>
+       </property>
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip" >
+        <string>Check to configure user authorization for a service</string>
+       </property>
+       <property name="text" >
+        <string>Restrict Access to Authorized Clients only</string>
+       </property>
+       <property name="checked" >
+        <bool>true</bool>
+       </property>
+      </widget>
+      <widget class="QGroupBox" name="authClientsGroupBox" >
+       <property name="geometry" >
+        <rect>
+         <x>9</x>
+         <y>270</y>
+         <width>613</width>
+         <height>171</height>
+        </rect>
+       </property>
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize" >
+        <size>
+         <width>0</width>
+         <height>0</height>
+        </size>
+       </property>
+       <property name="baseSize" >
+        <size>
+         <width>0</width>
+         <height>0</height>
+        </size>
+       </property>
+       <property name="title" >
+        <string>Authorized Clients</string>
+       </property>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <layout class="QGridLayout" >
+          <item row="0" column="0" >
+           <widget class="QCheckBox" name="checkBox_basic" >
             <property name="text" >
-             <string/>
+             <string>basic configuration</string>
             </property>
-            <property name="icon" >
-             <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/edit-copy.png</iconset>
-            </property>
            </widget>
           </item>
-          <item row="3" column="1" >
-           <widget class="QToolButton" name="browseServiceBtn" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="toolTip" >
-             <string>Browse in local file system and choose directory for selected service</string>
-            </property>
+          <item row="0" column="1" >
+           <widget class="QCheckBox" name="checkBox_stealth" >
             <property name="text" >
-             <string/>
+             <string>stealth configuration</string>
             </property>
-            <property name="icon" >
-             <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/folder.png</iconset>
-            </property>
            </widget>
           </item>
-          <item row="4" column="1" >
-           <spacer>
-            <property name="orientation" >
-             <enum>Qt::Vertical</enum>
-            </property>
-            <property name="sizeHint" >
-             <size>
-              <width>26</width>
-              <height>70</height>
-             </size>
-            </property>
-           </spacer>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item>
-        <widget class="QCheckBox" name="restrictAccessCheckBox" >
-         <property name="sizePolicy" >
-          <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="toolTip" >
-          <string>Check to configure user authorization for a service</string>
-         </property>
-         <property name="text" >
-          <string>Restrict Access to Authorized Clients only</string>
-         </property>
-         <property name="checked" >
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QGroupBox" name="authClientsGroupBox" >
-         <property name="sizePolicy" >
-          <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="baseSize" >
-          <size>
-           <width>0</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="title" >
-          <string>Authorized Clients</string>
-         </property>
-         <layout class="QVBoxLayout" >
-          <item>
+          <item row="1" column="0" colspan="2" >
            <layout class="QGridLayout" >
             <item rowspan="4" row="0" column="0" >
              <widget class="QTableWidget" name="serviceAuthWidget" >
@@ -347,8 +397,8 @@
               </property>
               <property name="sizeHint" >
                <size>
-                <width>20</width>
-                <height>20</height>
+                <width>26</width>
+                <height>66</height>
                </size>
               </property>
              </spacer>
@@ -356,22 +406,9 @@
            </layout>
           </item>
          </layout>
-        </widget>
-       </item>
-       <item>
-        <spacer>
-         <property name="orientation" >
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" >
-          <size>
-           <width>20</width>
-           <height>40</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-      </layout>
+        </item>
+       </layout>
+      </widget>
      </widget>
      <widget class="QWidget" name="tab_4" >
       <attribute name="title" >
@@ -406,7 +443,7 @@
          <item row="0" column="1" >
           <widget class="QLabel" name="label_4" >
            <property name="text" >
-            <string>Identification:</string>
+            <string>Optional Comment/Identification:</string>
            </property>
           </widget>
          </item>
@@ -506,7 +543,7 @@
           <number>1</number>
          </property>
          <property name="text" >
-          <string>Afterwards you can access the hidden service using the first part of the Client Athorization String, the onion adress.! (Don't forget to save before trying.)</string>
+          <string>Afterwards you can access the hidden service using the first part of the Client Authorization String, the onion address.! (Don't forget to save before trying.)</string>
          </property>
          <property name="scaledContents" >
           <bool>false</bool>
@@ -527,22 +564,6 @@
  </resources>
  <connections>
   <connection>
-   <sender>restrictAccessCheckBox</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>authClientsGroupBox</receiver>
-   <slot>setVisible(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>326</x>
-     <y>55</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>326</x>
-     <y>469</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
    <sender>commentLineAccess</sender>
    <signal>returnPressed()</signal>
    <receiver>authLineAccess</receiver>
@@ -590,5 +611,21 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>restrictAccessCheckBox</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>authClientsGroupBox</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>326</x>
+     <y>55</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>326</x>
+     <y>469</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>

Modified: vidalia/branches/hidden-services/src/vidalia/config/servicesettings.cpp
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/config/servicesettings.cpp	2008-08-12 18:14:03 UTC (rev 2958)
+++ vidalia/branches/hidden-services/src/vidalia/config/servicesettings.cpp	2008-08-14 10:01:50 UTC (rev 2959)
@@ -41,8 +41,10 @@
   QStringList serviceList;
   if(service.services().size() > 0) {
     QList<Service> services = service.services();
+    QString s;
     foreach (Service tempService, services) {
       serviceList << tempService.toString();
+      s.append(tempService.toString());
     }
   }
   setValue(SETTING_TOR_SERVICES, serviceList);
@@ -59,8 +61,9 @@
 ServiceList
 ServiceSettings::getServices()
 {
-  QString address,virtualPort,physAddrPort,serviceDir,enabledS,additionalData;
+  QString address,virtualPort,physAddrPort,serviceDir,enabledS,stealthS,additionalData;
   bool enabled = false;
+  bool stealth = false;
   QStringList stringList;
   ServiceList services;
   QString userString;
@@ -79,10 +82,15 @@
     skippedList.removeFirst();
     enabledS = skippedList.first();
     skippedList.removeFirst();
+    stealthS = skippedList.first();
+    skippedList.removeFirst();
     additionalData = skippedList.first();
     if(enabledS.compare("x1") == 0) {
       enabled = true;
     }
+    if(stealthS.compare("x1") == 0) {
+      stealth = true;
+    }
     skippedList.removeFirst();
     //for each user parse the authorization data
     foreach(QString user, skippedList)
@@ -97,7 +105,7 @@
         users.push_back(u);
       }
     }
-    Service s(address, virtualPort, physAddrPort, serviceDir, enabled);
+    Service s(address, virtualPort, physAddrPort, serviceDir, enabled, stealth);
     s.setAdditionalServiceOptions(additionalData);
     s.setUsers(users);
     services.addService(s);
@@ -115,13 +123,10 @@
   if(list.size() > 0) {
     foreach(ServiceAuthorizationData tempService, list) {
       serviceAuthdataList << tempService.toString();
-      //HidServAuth service-name client-key descriptor-cookie
-      torConfString.append(tempService.identification());
-      QStringList strList = tempService.authdata().split(" ");
-      torConfString.append(" "+strList.first().trimmed());
-      strList.removeFirst();
-      torConfString.append(" "+strList.first().trimmed());
-            torControl()->setConf("HidServAuth", torConfString);
+      //HidServAuth <onion address> <cookie> <optional_comment>
+      torConfString.append(tempService.authdata());
+      torConfString.append(" "+tempService.identification());
+      torControl()->setConf("HidServAuth", torConfString);
     }
   }
   setValue(SETTING_TOR_CONSUMED_SERVICES, serviceAuthdataList);