~jackweirdy/vidalia/680192

« back to all changes in this revision

Viewing changes to .pc/use-control-socket.patch/src/vidalia/config/TorSettings.cpp

  • Committer: Package Import Robot
  • Author(s): Ulises Vitulli, intrigeri, Ulises Vitulli
  • Date: 2012-06-22 07:18:44 UTC
  • mfrom: (1.4.8) (8.2.13 sid)
  • Revision ID: package-import@ubuntu.com-20120622071844-s278v0p646pqt949
Tags: 0.2.19-1
[ intrigeri ]
* Imported Upstream version 0.2.19
* Install AppArmor profile.
* Enable hardening flags.

[ Ulises Vitulli ]
* Added runtime dependency on apparmor.
* Updated d/NEWS and d/README.Debian to reflect new features.
* Move dirs from d/rules to d/vidalia.dir.
* Updated Standard-version to 3.9.3 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
**  LICENSE file, found in the top level directory of this distribution. If you
4
4
**  did not receive the LICENSE file with this file, you may obtain it from the
5
5
**  Vidalia source package distributed by the Vidalia Project at
6
 
**  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
7
 
**  including this file, may be copied, modified, propagated, or distributed 
 
6
**  http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
 
7
**  including this file, may be copied, modified, propagated, or distributed
8
8
**  except according to the terms described in the LICENSE file.
9
9
*/
10
10
 
90
90
  setDefault(SETTING_DATA_DIRECTORY, "");
91
91
  setDefault(SETTING_CONTROL_PASSWORD, "");
92
92
  setDefault(SETTING_USE_RANDOM_PASSWORD, true);
93
 
  setDefault(SETTING_WARN_PLAINTEXT_PORTS, QList<QVariant>() << 23 << 109 
 
93
  setDefault(SETTING_WARN_PLAINTEXT_PORTS, QList<QVariant>() << 23 << 109
94
94
                                                             << 110 << 143);
95
95
  setDefault(SETTING_REJECT_PLAINTEXT_PORTS, QList<QVariant>());
96
96
  setDefault(SETTING_BOOTSTRAP, false);
112
112
    conf.insert(TOR_ARG_SOCKSPORT, "auto");
113
113
  else
114
114
    conf.insert(TOR_ARG_SOCKSPORT, "9050");
115
 
  
116
 
  AuthenticationMethod authMethod = 
 
115
 
 
116
  AuthenticationMethod authMethod =
117
117
    toAuthenticationMethod(localValue(SETTING_AUTH_METHOD).toString());
118
118
  switch (authMethod) {
119
119
    case CookieAuth:
121
121
      conf.insert(TOR_ARG_HASHED_PASSWORD, "");
122
122
      break;
123
123
    case PasswordAuth:
124
 
      hashedPassword = useRandomPassword() 
 
124
      hashedPassword = useRandomPassword()
125
125
                          ? hashPassword(randomPassword())
126
126
                          : hashPassword(getControlPassword());
127
127
      if (hashedPassword.isEmpty()) {
189
189
}
190
190
 
191
191
/** Sets the torrc that will be used when starting Tor.
192
 
 * \param torrc The torrc to use. 
 
192
 * \param torrc The torrc to use.
193
193
 */
194
194
void
195
195
TorSettings::setTorrc(const QString &torrc)
227
227
}
228
228
 
229
229
/** Get the path for ControlSocket */
230
 
QString 
 
230
QString
231
231
TorSettings::getSocketPath() const
232
232
{
233
233
  return value(SETTING_SOCKET_PATH).toString();
234
234
}
235
235
 
236
236
/** Set the path for ControlSocket */
237
 
void 
 
237
void
238
238
TorSettings::setSocketPath(const QString &path)
239
239
{
240
240
  setValue(SETTING_SOCKET_PATH, path);
248
248
}
249
249
 
250
250
/** Set the control method */
251
 
void 
 
251
void
252
252
TorSettings::setControlMethod(ControlMethod::Method method)
253
253
{
254
254
  setValue(SETTING_CONTROL_METHOD, ControlMethod::toString(method));
389
389
 * description of the authentication method given in <b>authMethod</b>. */
390
390
TorSettings::AuthenticationMethod
391
391
TorSettings::toAuthenticationMethod(const QString &authMethod) const
392
 
 
392
{
393
393
  QString str = authMethod.toLower();
394
394
  if (str == toString(NullAuth))
395
395
    return NullAuth;
413
413
TorSettings::hashPassword(const QString &password)
414
414
{
415
415
  QByteArray salt;
416
 
  
 
416
 
417
417
  /* Generate an 8 octet salt value. Bail if we fail to generate enough
418
418
   * random bytes (unlikely). */
419
419
  while (salt.size() < 8) {
460
460
  return QDir::convertSeparators(value(SETTING_BOOTSTRAP_FROM).toString());
461
461
}
462
462
 
463
 
bool 
 
463
bool
464
464
TorSettings::autoControlPort() const
465
465
{
466
466
  return value(SETTING_AUTOCONTROL).toBool();
467
467
}
468
468
 
469
 
void 
 
469
void
470
470
TorSettings::setAutoControlPort(const bool autoControl)
471
471
{
472
472
  setValue(SETTING_AUTOCONTROL, autoControl);