Changeset 2974
- Timestamp:
- 08/16/08 12:57:32 (3 months ago)
- Location:
- vidalia/branches/hidden-services/src/vidalia/config
- Files:
-
- 3 modified
-
servicepage.cpp (modified) (10 diffs)
-
servicepage.h (modified) (1 diff)
-
servicepage.ui (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp
r2972 r2974 46 46 /** A QRegExpValidator to validate the identification of client auth(Id) 47 47 * and service auth(Id)*/ 48 QRegExp rx("[a-zA-Z0-9\\+\\-\\_]{0,1 8}([a-zA-Z0-9\\+\\-\\_])");48 QRegExp rx("[a-zA-Z0-9\\+\\-\\_]{0,15}([a-zA-Z0-9\\+\\-\\_])"); 49 49 _identificationValidator = new QRegExpValidator(rx, this); 50 50 /** A QRegExpValidator to validate a onion address (base32, … … 53 53 _onionAdressValidator = new QRegExpValidator(base32, this); 54 54 /** A QRegExpValidator to validate a cookie(base64, 22 chars)*/ 55 QRegExp base64("[a-zA-Z0-9\\+\\-\\/]{2 1}([a-zA-Z0-9\\+\\-\\/])");55 QRegExp base64("[a-zA-Z0-9\\+\\-\\/]{20}([a-zA-Z0-9\\+\\-\\/])"); 56 56 _cookieValidator = new QRegExpValidator(base64, this); 57 57 … … 111 111 connect(ui.serviceAccessWidget, SIGNAL(itemClicked(QTableWidgetItem*)), this, 112 112 SLOT(serviceAccessSelectionChanged())); 113 connect(ui.checkBox_basic, SIGNAL(toggled(bool)), this, 114 SLOT(checkBoxBasicToggled())); 115 connect(ui.checkBox_stealth, SIGNAL(toggled(bool)), this, 116 SLOT(checkBoxStealthToggled())); 113 connect(ui.basic_radioButton, SIGNAL(toggled(bool)), this, 114 SLOT(checkBoxBasicToggled(bool))); 117 115 } 118 116 … … 399 397 /** this method returns a Service by parseing the configuration string 400 398 * of Tor and storing its values into the object */ 401 //XTODO hier den parser auch anpassen um basic/stealth abzufange!!402 399 Service 403 400 ServicePage::generateService(QString s) … … 923 920 QList<UserAuthorizationData> assoziatedUsers = selService.users(); 924 921 if(selService.stealth()) { 925 ui. checkBox_stealth->setCheckState(Qt::Checked);926 ui. checkBox_basic->setCheckState(Qt::Unchecked);927 } else { 928 ui. checkBox_basic->setCheckState(Qt::Checked);929 ui. checkBox_stealth->setCheckState(Qt::Unchecked);922 ui.stealth_radioButton->setChecked(true); 923 ui.basic_radioButton->setChecked(false); 924 } else { 925 ui.stealth_radioButton->setChecked(false); 926 ui.basic_radioButton->setChecked(true); 930 927 } 931 928 if(assoziatedUsers.size() == 0) { 932 929 ui.authClientsGroupBox->setVisible(false); 933 930 ui.restrictAccessCheckBox->setCheckState(Qt::Unchecked); 931 ui.restrictAccessCheckBox->setEnabled(true); 934 932 } else { 935 933 ui.authClientsGroupBox->setVisible(true); 936 934 ui.restrictAccessCheckBox->setCheckState(Qt::Checked); 935 ui.restrictAccessCheckBox->setEnabled(false); 937 936 int rowcount = 0; 938 937 QListIterator<UserAuthorizationData> it(assoziatedUsers); … … 1175 1174 ServicePage::validateServiceAuth(QString authString) 1176 1175 { 1176 QStringList authMode; 1177 authMode << "A" <<"B" <<"Q" <<"R" <<"g" <<"h" <<"w" <<"x"; 1177 1178 if(authString.length() != 45 || authString.contains(" ") == false) { 1178 1179 return QValidator::Invalid; … … 1180 1181 QStringList strList = authString.split(" "); 1181 1182 int pos = 0; 1182 if(_onionAdressValidator->validate(strList.first(), pos) == 1183 QString onion = strList.first(); 1184 if(_onionAdressValidator->validate(onion, pos) == 1183 1185 QValidator::Acceptable) { 1184 1186 strList.removeFirst(); 1185 if(_cookieValidator->validate(strList.first(), pos) == 1186 QValidator::Acceptable) { 1187 QString cookieValid = strList.first().left(21); 1188 QString cookie = strList.first(); 1189 for(int i = 0; i < ui.serviceAccessWidget->rowCount(); i++) { 1190 QTableWidgetItem *item = ui.serviceAccessWidget->item(i,0); 1191 QStringList onionStrList = item->text().split(" "); 1192 QString on, cook; 1193 on = onionStrList.first(); 1194 onionStrList.removeFirst(); 1195 cook = onionStrList.first(); 1196 if(onion.compare(on) == 0 && cookie.compare(cook) == 0) { 1197 return QValidator::Invalid; 1198 } 1199 } 1200 if(_cookieValidator->validate(cookieValid, pos) == 1201 QValidator::Acceptable && authMode.contains(strList.first().right(1))) { 1187 1202 return QValidator::Acceptable; 1188 1203 } else { 1189 VMessageBox::warning(this, tr("Error"), tr("Your cookie is not valid,\1190 please correct it."), VMessageBox::Ok);1191 1204 return QValidator::Invalid; 1192 1205 } 1193 1206 } else { 1194 VMessageBox::warning(this, tr("Error"), tr("Your onion adress is\1195 not valid, please correct it."), VMessageBox::Ok);1196 1207 return QValidator::Invalid; 1197 1208 } … … 1215 1226 id++; 1216 1227 } 1228 serviceAccessSelectionChanged(); 1217 1229 } 1218 1230 … … 1391 1403 bool b = address.contains(".onion"); 1392 1404 ui.copyClientAuthBtn->setEnabled(b); 1405 ui.removeClientAuthBtn->setEnabled(true); 1406 } 1407 if(ui.serviceAuthWidget->rowCount() < 1) { 1408 ui.copyClientAuthBtn->setEnabled(false); 1409 ui.removeClientAuthBtn->setEnabled(false); 1410 ui.restrictAccessCheckBox->setEnabled(true); 1411 } else { 1412 ui.restrictAccessCheckBox->setEnabled(false); 1393 1413 } 1394 1414 } … … 1411 1431 /** Called whenever the user clicks on the basic authorization checkbox*/ 1412 1432 void 1413 ServicePage::checkBoxBasicToggled() 1414 { 1415 bool state = ui.checkBox_basic->checkState() == Qt::Checked; 1416 if(state) { 1417 ui.checkBox_stealth->setCheckState(Qt::Unchecked); 1418 } else { 1419 ui.checkBox_stealth->setCheckState(Qt::Checked); 1420 } 1433 ServicePage::checkBoxBasicToggled(bool checked) 1434 { 1421 1435 Service s = _services->take(ui.serviceWidget->currentRow()); 1422 s.setStealth(! state);1436 s.setStealth(!checked); 1423 1437 _services->insert(ui.serviceWidget->currentRow(), s); 1424 1438 } 1425 1439 1426 /** Called whenever the user clicks on the stealth authorization checkbox*/1427 void1428 ServicePage::checkBoxStealthToggled()1429 {1430 bool state = ui.checkBox_stealth->checkState() == Qt::Checked;1431 if(state) {1432 ui.checkBox_basic->setCheckState(Qt::Unchecked);1433 } else {1434 ui.checkBox_basic->setCheckState(Qt::Checked);1435 }1436 Service s = _services->take(ui.serviceWidget->currentRow());1437 s.setStealth(state);1438 _services->insert(ui.serviceWidget->currentRow(), s);1439 }1440 -
vidalia/branches/hidden-services/src/vidalia/config/servicepage.h
r2960 r2974 111 111 void serviceAuthSelectionChanged(); 112 112 /** Called whenever the user clicks on the basic authorization checkbox*/ 113 void checkBoxBasicToggled(); 114 /** Called whenever the user clicks on the stealth authorization checkbox*/ 115 void checkBoxStealthToggled(); 113 void checkBoxBasicToggled(bool checked); 116 114 117 115 private: -
vidalia/branches/hidden-services/src/vidalia/config/servicepage.ui
r2973 r2974 7 7 <y>0</y> 8 8 <width>653</width> 9 <height>49 6</height>9 <height>492</height> 10 10 </rect> 11 11 </property> … … 296 296 <string>Authorized Clients</string> 297 297 </property> 298 <layout class="QGridLayout" > 299 <item row="0" column="0" > 300 <layout class="QGridLayout" > 301 <item row="0" column="0" > 302 <widget class="QCheckBox" name="checkBox_basic" > 303 <property name="toolTip" > 304 <string>the basic authorization mode is more scalable but less secure</string> 305 </property> 306 <property name="text" > 307 <string>basic configuration</string> 308 </property> 309 </widget> 310 </item> 311 <item row="0" column="1" > 312 <widget class="QCheckBox" name="checkBox_stealth" > 313 <property name="toolTip" > 314 <string>the stealth authorization mode is more secure but less scalable</string> 315 </property> 316 <property name="text" > 317 <string>stealth configuration</string> 318 </property> 319 </widget> 320 </item> 321 <item row="1" column="0" colspan="2" > 322 <layout class="QGridLayout" > 323 <item rowspan="4" row="0" column="0" > 324 <widget class="QTableWidget" name="serviceAuthWidget" > 325 <property name="sizePolicy" > 326 <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > 327 <horstretch>0</horstretch> 328 <verstretch>0</verstretch> 329 </sizepolicy> 298 <widget class="QWidget" name="" > 299 <property name="geometry" > 300 <rect> 301 <x>12</x> 302 <y>20</y> 303 <width>591</width> 304 <height>141</height> 305 </rect> 306 </property> 307 <layout class="QGridLayout" > 308 <item row="0" column="0" > 309 <widget class="QRadioButton" name="basic_radioButton" > 310 <property name="text" > 311 <string>basic configuration</string> 312 </property> 313 </widget> 314 </item> 315 <item row="0" column="1" > 316 <widget class="QRadioButton" name="stealth_radioButton" > 317 <property name="text" > 318 <string>stealth configuration</string> 319 </property> 320 </widget> 321 </item> 322 <item row="1" column="0" colspan="2" > 323 <layout class="QGridLayout" > 324 <item rowspan="4" row="0" column="0" > 325 <widget class="QTableWidget" name="serviceAuthWidget" > 326 <property name="sizePolicy" > 327 <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > 328 <horstretch>0</horstretch> 329 <verstretch>0</verstretch> 330 </sizepolicy> 331 </property> 332 <property name="maximumSize" > 333 <size> 334 <width>16777215</width> 335 <height>16777215</height> 336 </size> 337 </property> 338 <property name="toolTip" > 339 <string>A listing of all ClientAuthorizationData configured with Vidalia</string> 340 </property> 341 <property name="selectionMode" > 342 <enum>QAbstractItemView::SingleSelection</enum> 343 </property> 344 <property name="selectionBehavior" > 345 <enum>QAbstractItemView::SelectRows</enum> 346 </property> 347 <property name="textElideMode" > 348 <enum>Qt::ElideLeft</enum> 349 </property> 350 <column> 351 <property name="text" > 352 <string>Authorization String</string> 330 353 </property> 331 <property name="maximumSize" > 332 <size> 333 <width>16777215</width> 334 <height>16777215</height> 335 </size> 354 </column> 355 <column> 356 <property name="text" > 357 <string>Identification</string> 336 358 </property> 337 <property name="toolTip" > 338 <string>A listing of all ClientAuthorizationData configured with Vidalia</string> 339 </property> 340 <property name="selectionMode" > 341 <enum>QAbstractItemView::SingleSelection</enum> 342 </property> 343 <property name="selectionBehavior" > 344 <enum>QAbstractItemView::SelectRows</enum> 345 </property> 346 <property name="textElideMode" > 347 <enum>Qt::ElideLeft</enum> 348 </property> 349 <column> 350 <property name="text" > 351 <string>Authorization String</string> 352 </property> 353 </column> 354 <column> 355 <property name="text" > 356 <string>Identification</string> 357 </property> 358 </column> 359 </widget> 360 </item> 361 <item row="0" column="1" > 362 <widget class="QToolButton" name="addClientAuthBtn" > 363 <property name="toolTip" > 364 <string>Add a new user with authorization to the selected service</string> 365 </property> 366 <property name="text" > 367 <string/> 368 </property> 369 <property name="icon" > 370 <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-add.png</iconset> 371 </property> 372 </widget> 373 </item> 374 <item row="1" column="1" > 375 <widget class="QToolButton" name="removeClientAuthBtn" > 376 <property name="toolTip" > 377 <string>Remove the selected user and his authorization data from the selected service</string> 378 </property> 379 <property name="text" > 380 <string/> 381 </property> 382 <property name="icon" > 383 <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-remove.png</iconset> 384 </property> 385 </widget> 386 </item> 387 <item row="2" column="1" > 388 <widget class="QToolButton" name="copyClientAuthBtn" > 389 <property name="toolTip" > 390 <string>Copy authorization data to clipboard</string> 391 </property> 392 <property name="text" > 393 <string/> 394 </property> 395 <property name="icon" > 396 <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/edit-copy.png</iconset> 397 </property> 398 </widget> 399 </item> 400 <item row="3" column="1" > 401 <spacer> 402 <property name="orientation" > 403 <enum>Qt::Vertical</enum> 404 </property> 405 <property name="sizeHint" > 406 <size> 407 <width>26</width> 408 <height>66</height> 409 </size> 410 </property> 411 </spacer> 412 </item> 413 </layout> 414 </item> 415 </layout> 416 </item> 417 </layout> 359 </column> 360 </widget> 361 </item> 362 <item row="0" column="1" > 363 <widget class="QToolButton" name="addClientAuthBtn" > 364 <property name="toolTip" > 365 <string>Add a new user with authorization to the selected service</string> 366 </property> 367 <property name="text" > 368 <string/> 369 </property> 370 <property name="icon" > 371 <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-add.png</iconset> 372 </property> 373 </widget> 374 </item> 375 <item row="1" column="1" > 376 <widget class="QToolButton" name="removeClientAuthBtn" > 377 <property name="toolTip" > 378 <string>Remove the selected user and his authorization data from the selected service</string> 379 </property> 380 <property name="text" > 381 <string/> 382 </property> 383 <property name="icon" > 384 <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-remove.png</iconset> 385 </property> 386 </widget> 387 </item> 388 <item row="2" column="1" > 389 <widget class="QToolButton" name="copyClientAuthBtn" > 390 <property name="toolTip" > 391 <string>Copy authorization data to clipboard</string> 392 </property> 393 <property name="text" > 394 <string/> 395 </property> 396 <property name="icon" > 397 <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/edit-copy.png</iconset> 398 </property> 399 </widget> 400 </item> 401 <item row="3" column="1" > 402 <spacer> 403 <property name="orientation" > 404 <enum>Qt::Vertical</enum> 405 </property> 406 <property name="sizeHint" > 407 <size> 408 <width>26</width> 409 <height>66</height> 410 </size> 411 </property> 412 </spacer> 413 </item> 414 </layout> 415 </item> 416 </layout> 417 </widget> 418 418 </widget> 419 419 </widget> … … 562 562 </property> 563 563 <property name="text" > 564 <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>564 <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> 565 565 </property> 566 566 <property name="scaledContents" >
