Changeset 85

Show
Ignore:
Timestamp:
01/13/06 23:35:19 (3 years ago)
Author:
edmanm
Message:

Add the ability to load authentication token information from a file. We'll
have to think about the best way to store it securely.

Location:
trunk/src/config
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/config/vidaliasettings.cpp

    r71 r85  
    3232#define SETTING_CONTROL_ADDR   "Tor/ControlAddr" 
    3333#define SETTING_CONTROL_PORT   "Tor/ControlPort" 
     34#define SETTING_AUTH_TOKEN     "Tor/AuthToken" 
    3435 
    3536/* Default Settings */ 
     
    4546#define DEFAULT_CONTROL_ADDR   "127.0.0.1" 
    4647#define DEFAULT_CONTROL_PORT   9051 
     48#define DEFAULT_AUTH_TOKEN    "" 
    4749 
    4850/** Default Constructor 
     
    166168} 
    167169 
     170/** Get the authentication token sent by the controller to Tor. For now, this 
     171 * just sends the default (blank) authentication token. It is implemented as a 
     172 * stub here to make it easy to do real authentication in the future. */ 
     173QByteArray 
     174VidaliaSettings::getAuthToken() 
     175{ 
     176  return QByteArray::fromBase64(value(SETTING_AUTH_TOKEN, 
     177                                QByteArray(DEFAULT_AUTH_TOKEN)).toByteArray()); 
     178} 
     179 
     180/** Set the authentication token sent by the controller to Tor. */ 
     181void 
     182VidaliaSettings::setAuthToken(QByteArray token) 
     183{ 
     184  setValue(SETTING_AUTH_TOKEN, token.toBase64()); 
     185} 
     186 
  • trunk/src/config/vidaliasettings.h

    r71 r85  
    7474  quint16 getControlPort(); 
    7575  void    setControlPort(quint16 port); 
     76 
     77  /* Get and set Tor's authentication information */ 
     78  QByteArray getAuthToken(); 
     79  void setAuthToken(QByteArray token); 
    7680}; 
    7781