Changes in / [ced1e17:d4810df]
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.h
rced1e17 rd4810df 33 33 34 34 #define PACKAGE "BitlBee" 35 #define BITLBEE_VERSION "1.2. 3"35 #define BITLBEE_VERSION "1.2.2" 36 36 #define VERSION BITLBEE_VERSION 37 37 -
doc/CHANGES
rced1e17 rd4810df 3 3 4 4 http://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 these9 variables was reviewed and should be correct now.10 11 Finished 7 Sep 200812 5 13 6 Version 1.2.2: -
doc/user-guide/Makefile
rced1e17 rd4810df 13 13 14 14 %.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 $< 16 16 17 17 %.pdf: %.db.xml -
doc/user-guide/help.xml
rced1e17 rd4810df 1 <?xml version="1.0" encoding=" utf-8"?>1 <?xml version="1.0" encoding="iso-8859-1"?> 2 2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> 3 3 -
doc/user-guide/user-guide.xml
rced1e17 rd4810df 1 <?xml version="1.0" encoding=" utf-8"?>1 <?xml version="1.0" encoding="iso-8859-1"?> 2 2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> 3 3 -
irc.c
rced1e17 rd4810df 38 38 irc_t *irc = set->data; 39 39 40 if( irc->status & USTATUS_IDENTIFIED && value)40 if( irc->status & USTATUS_IDENTIFIED ) 41 41 { 42 42 irc_setpass( irc, value ); … … 239 239 240 240 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 ) 242 242 irc_usermsg( irc, "Error while saving settings!" ); 243 243 -
root_commands.c
rced1e17 rd4810df 140 140 static void cmd_identify( irc_t *irc, char **cmd ) 141 141 { 142 storage_status_t status = storage_load( irc , cmd[1]);142 storage_status_t status = storage_load( irc->nick, cmd[1], irc ); 143 143 char *account_on[] = { "account", "on", NULL }; 144 144 … … 152 152 case STORAGE_OK: 153 153 irc_usermsg( irc, "Password accepted, settings and accounts loaded" ); 154 irc_setpass( irc, cmd[1] );155 irc->status |= USTATUS_IDENTIFIED;156 154 irc_umode_set( irc, "+R", 1 ); 157 155 if( set_getbool( &irc->set, "auto_connect" ) ) … … 173 171 } 174 172 175 switch( storage_save( irc, cmd[1], FALSE ) ) { 173 irc_setpass( irc, cmd[1] ); 174 switch( storage_save( irc, FALSE )) { 176 175 case STORAGE_ALREADY_EXISTS: 177 176 irc_usermsg( irc, "Nick is already registered" ); … … 180 179 case STORAGE_OK: 181 180 irc_usermsg( irc, "Account successfully created" ); 182 irc_setpass( irc, cmd[1] );183 181 irc->status |= USTATUS_IDENTIFIED; 184 182 irc_umode_set( irc, "+R", 1 ); … … 874 872 static void cmd_save( irc_t *irc, char **cmd ) 875 873 { 876 if( ( irc->status & USTATUS_IDENTIFIED ) == 0 ) 877 irc_usermsg( irc, "Please create an account first" ); 878 else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK ) 874 if( storage_save( irc, TRUE ) == STORAGE_OK ) 879 875 irc_usermsg( irc, "Configuration saved" ); 880 876 else -
storage.c
rced1e17 rd4810df 103 103 } 104 104 105 storage_status_t storage_load ( irc_t * irc, const char *password)105 storage_status_t storage_load (const char *nick, const char *password, irc_t * irc) 106 106 { 107 107 GList *gl; 108 109 if (irc && irc->status & USTATUS_IDENTIFIED)110 return STORAGE_OTHER_ERROR;111 108 112 109 /* Loop until we don't get NO_SUCH_USER */ … … 115 112 storage_status_t status; 116 113 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); 119 117 return status; 118 } 120 119 121 120 if (status != STORAGE_NO_SUCH_USER) … … 126 125 } 127 126 128 storage_status_t storage_save (irc_t *irc, char *password,int overwrite)127 storage_status_t storage_save (irc_t *irc, int overwrite) 129 128 { 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); 149 130 } 150 131 … … 162 143 163 144 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) 165 147 ret = status; 166 148 } … … 168 150 return ret; 169 151 } 170 171 #if 0172 Not using this yet. Test thoroughly before adding UI hooks to this function.173 152 174 153 storage_status_t storage_rename (const char *onick, const char *nnick, const char *password) … … 210 189 return STORAGE_OK; 211 190 } 212 #endif -
storage.h
rced1e17 rd4810df 45 45 storage_status_t (*check_pass) (const char *nick, const char *password); 46 46 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); 48 48 storage_status_t (*save) (irc_t *irc, int overwrite); 49 49 storage_status_t (*remove) (const char *nick, const char *password); … … 55 55 storage_status_t storage_check_pass (const char *nick, const char *password); 56 56 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);57 storage_status_t storage_load (const char *nick, const char *password, irc_t * irc); 58 storage_status_t storage_save (irc_t *irc, int overwrite); 59 59 storage_status_t storage_remove (const char *nick, const char *password); 60 60 61 /* storage_status_t storage_rename (const char *onick, const char *nnick, const char *password); */ 61 storage_status_t storage_rename (const char *onick, const char *nnick, const char *password); 62 62 63 63 void register_storage_backend(storage_t *); -
storage_text.c
rced1e17 rd4810df 44 44 } 45 45 46 static storage_status_t text_load ( irc_t *irc, const char* password)46 static storage_status_t text_load ( const char *my_nick, const char* password, irc_t *irc ) 47 47 { 48 48 char s[512]; … … 54 54 account_t *acc, *acc_lookup[9]; 55 55 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" ); 57 60 fp = fopen( s, "r" ); 58 61 if( !fp ) return STORAGE_NO_SUCH_USER; … … 65 68 return STORAGE_INVALID_PASSWORD; 66 69 } 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; 67 74 68 75 while( fscanf( fp, "%511[^\n]s", s ) > 0 ) … … 94 101 } 95 102 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" ); 97 104 fp = fopen( s, "r" ); 98 105 if( !fp ) return STORAGE_NO_SUCH_USER; -
storage_xml.c
rced1e17 rd4810df 288 288 } 289 289 290 static storage_status_t xml_load_real( irc_t *irc, const char *my_nick, const char *password, xml_pass_st action )290 static storage_status_t xml_load_real( const char *my_nick, const char *password, irc_t *irc, xml_pass_st action ) 291 291 { 292 292 GMarkupParseContext *ctx; … … 295 295 GError *gerr = NULL; 296 296 int fd, st; 297 298 if( irc && irc->status & USTATUS_IDENTIFIED ) 299 return( 1 ); 297 300 298 301 xd = g_new0( struct xml_parsedata, 1 ); … … 347 350 return STORAGE_OK; 348 351 352 irc->status |= USTATUS_IDENTIFIED; 353 349 354 return STORAGE_OK; 350 355 } 351 356 352 static storage_status_t xml_load( irc_t *irc, const char *password)353 { 354 return xml_load_real( irc, irc->nick, password, XML_PASS_UNKNOWN );357 static storage_status_t xml_load( const char *my_nick, const char *password, irc_t *irc ) 358 { 359 return xml_load_real( my_nick, password, irc, XML_PASS_UNKNOWN ); 355 360 } 356 361 … … 359 364 /* This is a little bit risky because we have to pass NULL for the 360 365 irc_t argument. This *should* be fine, if I didn't miss anything... */ 361 return xml_load_real( NULL, my_nick, password, XML_PASS_CHECK_ONLY );366 return xml_load_real( my_nick, password, NULL, XML_PASS_CHECK_ONLY ); 362 367 } 363 368 … … 394 399 md5_byte_t pass_md5[21]; 395 400 md5_state_t md5_state; 401 402 if( irc->password == NULL ) 403 { 404 irc_usermsg( irc, "Please register yourself if you want to save your settings." ); 405 return STORAGE_OTHER_ERROR; 406 } 396 407 397 408 path2 = g_strdup( irc->nick );
Note: See TracChangeset
for help on using the changeset viewer.