Changes in / [b99296f:0a4f6f4]


Ignore:
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.h

    rb99296f r0a4f6f4  
    3333
    3434#define PACKAGE "BitlBee"
    35 #define BITLBEE_VERSION "1.2.3"
     35#define BITLBEE_VERSION "1.2.2"
    3636#define VERSION BITLBEE_VERSION
    3737
  • doc/CHANGES

    rb99296f r0a4f6f4  
    33
    44http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on
    5 
    6 Version 1.2.3:
    7 - Fixed one more flaw similar to the previous hijacking bug, caused by incon-
    8   sistent handling of the USTATUS_IDENTIFIED state. All code touching these
    9   variables was reviewed and should be correct now.
    10 
    11 Finished 7 Sep 2008
    125
    136Version 1.2.2:
  • doc/user-guide/Makefile

    rb99296f r0a4f6f4  
    1313
    1414%.html: %.db.xml
    15         xsltproc --output $@ http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $<
     15        xsltproc --output $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $<
    1616
    1717%.pdf: %.db.xml
  • doc/user-guide/help.xml

    rb99296f r0a4f6f4  
    1 <?xml version="1.0" encoding="utf-8"?>
     1<?xml version="1.0" encoding="iso-8859-1"?>
    22<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
    33
  • doc/user-guide/user-guide.xml

    rb99296f r0a4f6f4  
    1 <?xml version="1.0" encoding="utf-8"?>
     1<?xml version="1.0" encoding="iso-8859-1"?>
    22<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
    33
  • irc.c

    rb99296f r0a4f6f4  
    3838        irc_t *irc = set->data;
    3939       
    40         if( irc->status & USTATUS_IDENTIFIED && value )
     40        if( irc->status & USTATUS_IDENTIFIED )
    4141        {
    4242                irc_setpass( irc, value );
     
    239239       
    240240        if( irc->status & USTATUS_IDENTIFIED && set_getbool( &irc->set, "save_on_quit" ) )
    241                 if( storage_save( irc, NULL, TRUE ) != STORAGE_OK )
     241                if( storage_save( irc, TRUE ) != STORAGE_OK )
    242242                        irc_usermsg( irc, "Error while saving settings!" );
    243243       
  • root_commands.c

    rb99296f r0a4f6f4  
    131131static void cmd_identify( irc_t *irc, char **cmd )
    132132{
    133         storage_status_t status = storage_load( irc, cmd[1] );
     133        storage_status_t status = storage_load( irc->nick, cmd[1], irc );
    134134        char *account_on[] = { "account", "on", NULL };
    135135       
     
    143143        case STORAGE_OK:
    144144                irc_usermsg( irc, "Password accepted, settings and accounts loaded" );
    145                 irc_setpass( irc, cmd[1] );
    146                 irc->status |= USTATUS_IDENTIFIED;
    147145                irc_umode_set( irc, "+R", 1 );
    148146                if( set_getbool( &irc->set, "auto_connect" ) )
     
    164162        }
    165163
    166         switch( storage_save( irc, cmd[1], FALSE ) ) {
     164        irc_setpass( irc, cmd[1] );
     165        switch( storage_save( irc, FALSE )) {
    167166                case STORAGE_ALREADY_EXISTS:
    168167                        irc_usermsg( irc, "Nick is already registered" );
     
    171170                case STORAGE_OK:
    172171                        irc_usermsg( irc, "Account successfully created" );
    173                         irc_setpass( irc, cmd[1] );
    174172                        irc->status |= USTATUS_IDENTIFIED;
    175173                        irc_umode_set( irc, "+R", 1 );
     
    889887static void cmd_save( irc_t *irc, char **cmd )
    890888{
    891         if( ( irc->status & USTATUS_IDENTIFIED ) == 0 )
    892                 irc_usermsg( irc, "Please create an account first" );
    893         else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK )
     889        if( storage_save( irc, TRUE ) == STORAGE_OK )
    894890                irc_usermsg( irc, "Configuration saved" );
    895891        else
  • storage.c

    rb99296f r0a4f6f4  
    103103}
    104104
    105 storage_status_t storage_load (irc_t * irc, const char *password)
     105storage_status_t storage_load (const char *nick, const char *password, irc_t * irc)
    106106{
    107107        GList *gl;
    108        
    109         if (irc && irc->status & USTATUS_IDENTIFIED)
    110                 return STORAGE_OTHER_ERROR;
    111108       
    112109        /* Loop until we don't get NO_SUCH_USER */
     
    115112                storage_status_t status;
    116113
    117                 status = st->load(irc, password);
    118                 if (status == STORAGE_OK)
     114                status = st->load(nick, password, irc);
     115                if (status == STORAGE_OK) {
     116                        irc_setpass(irc, password);
    119117                        return status;
     118                }
    120119               
    121120                if (status != STORAGE_NO_SUCH_USER)
     
    126125}
    127126
    128 storage_status_t storage_save (irc_t *irc, char *password, int overwrite)
     127storage_status_t storage_save (irc_t *irc, int overwrite)
    129128{
    130         storage_status_t st;
    131        
    132         if (password != NULL) {
    133                 /* Should only use this in the "register" command. */
    134                 if (irc->password || overwrite)
    135                         return STORAGE_OTHER_ERROR;
    136                
    137                 irc_setpass(irc, password);
    138         } else if ((irc->status & USTATUS_IDENTIFIED) == 0) {
    139                 return STORAGE_NO_SUCH_USER;
    140         }
    141        
    142         st = ((storage_t *)global.storage->data)->save(irc, overwrite);
    143        
    144         if (password != NULL) {
    145                 irc_setpass(irc, NULL);
    146         }
    147        
    148         return st;
     129        return ((storage_t *)global.storage->data)->save(irc, overwrite);
    149130}
    150131
     
    162143
    163144                status = st->remove(nick, password);
    164                 if (status != STORAGE_NO_SUCH_USER && status != STORAGE_OK)
     145                if (status != STORAGE_NO_SUCH_USER &&
     146                        status != STORAGE_OK)
    165147                        ret = status;
    166148        }
     
    168150        return ret;
    169151}
    170 
    171 #if 0
    172 Not using this yet. Test thoroughly before adding UI hooks to this function.
    173152
    174153storage_status_t storage_rename (const char *onick, const char *nnick, const char *password)
     
    210189        return STORAGE_OK;
    211190}
    212 #endif
  • storage.h

    rb99296f r0a4f6f4  
    4545        storage_status_t (*check_pass) (const char *nick, const char *password);
    4646
    47         storage_status_t (*load) (irc_t *irc, const char *password);
     47        storage_status_t (*load) (const char *nick, const char *password, irc_t * irc);
    4848        storage_status_t (*save) (irc_t *irc, int overwrite);
    4949        storage_status_t (*remove) (const char *nick, const char *password);
     
    5555storage_status_t storage_check_pass (const char *nick, const char *password);
    5656
    57 storage_status_t storage_load (irc_t * irc, const char *password);
    58 storage_status_t storage_save (irc_t *irc, char *password, int overwrite);
     57storage_status_t storage_load (const char *nick, const char *password, irc_t * irc);
     58storage_status_t storage_save (irc_t *irc, int overwrite);
    5959storage_status_t storage_remove (const char *nick, const char *password);
    6060
    61 /* storage_status_t storage_rename (const char *onick, const char *nnick, const char *password); */
     61storage_status_t storage_rename (const char *onick, const char *nnick, const char *password);
    6262
    6363void register_storage_backend(storage_t *);
  • storage_text.c

    rb99296f r0a4f6f4  
    4444}
    4545
    46 static storage_status_t text_load( irc_t *irc, const char* password )
     46static storage_status_t text_load ( const char *my_nick, const char* password, irc_t *irc )
    4747{
    4848        char s[512];
     
    5454        account_t *acc, *acc_lookup[9];
    5555       
    56         g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" );
     56        if( irc->status & USTATUS_IDENTIFIED )
     57                return( 1 );
     58       
     59        g_snprintf( s, 511, "%s%s%s", global.conf->configdir, my_nick, ".accounts" );
    5760        fp = fopen( s, "r" );
    5861        if( !fp ) return STORAGE_NO_SUCH_USER;
     
    6568                return STORAGE_INVALID_PASSWORD;
    6669        }
     70       
     71        /* Do this now. If the user runs with AuthMode = Registered, the
     72           account command will not work otherwise. */
     73        irc->status |= USTATUS_IDENTIFIED;
    6774       
    6875        while( fscanf( fp, "%511[^\n]s", s ) > 0 )
     
    94101        }
    95102       
    96         g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".nicks" );
     103        g_snprintf( s, 511, "%s%s%s", global.conf->configdir, my_nick, ".nicks" );
    97104        fp = fopen( s, "r" );
    98105        if( !fp ) return STORAGE_NO_SUCH_USER;
  • storage_xml.c

    rb99296f r0a4f6f4  
    2929#include "arc.h"
    3030#include "md5.h"
     31#include <glib/gstdio.h>
    3132
    3233#if GLIB_CHECK_VERSION(2,8,0)
     
    258259}
    259260
    260 static storage_status_t xml_load_real( irc_t *irc, const char *my_nick, const char *password, xml_pass_st action )
     261static storage_status_t xml_load_real( const char *my_nick, const char *password, irc_t *irc, xml_pass_st action )
    261262{
    262263        GMarkupParseContext *ctx;
     
    265266        GError *gerr = NULL;
    266267        int fd, st;
     268       
     269        if( irc && irc->status & USTATUS_IDENTIFIED )
     270                return( 1 );
    267271       
    268272        xd = g_new0( struct xml_parsedata, 1 );
     
    317321                return STORAGE_OK;
    318322       
     323        irc->status |= USTATUS_IDENTIFIED;
     324       
    319325        return STORAGE_OK;
    320326}
    321327
    322 static storage_status_t xml_load( irc_t *irc, const char *password )
    323 {
    324         return xml_load_real( irc, irc->nick, password, XML_PASS_UNKNOWN );
     328static storage_status_t xml_load( const char *my_nick, const char *password, irc_t *irc )
     329{
     330        return xml_load_real( my_nick, password, irc, XML_PASS_UNKNOWN );
    325331}
    326332
     
    329335        /* This is a little bit risky because we have to pass NULL for the
    330336           irc_t argument. This *should* be fine, if I didn't miss anything... */
    331         return xml_load_real( NULL, my_nick, password, XML_PASS_CHECK_ONLY );
     337        return xml_load_real( my_nick, password, NULL, XML_PASS_CHECK_ONLY );
    332338}
    333339
     
    364370        md5_byte_t pass_md5[21];
    365371        md5_state_t md5_state;
     372       
     373        if( irc->password == NULL )
     374        {
     375                irc_usermsg( irc, "Please register yourself if you want to save your settings." );
     376                return STORAGE_OTHER_ERROR;
     377        }
    366378       
    367379        path2 = g_strdup( irc->nick );
Note: See TracChangeset for help on using the changeset viewer.