Changeset b99296f
- Timestamp:
- 2008-09-07T17:13:49Z (16 years ago)
- Branches:
- master
- Children:
- 92e90b7
- Parents:
- 0a4f6f4 (diff), ba3a8a5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.h
r0a4f6f4 rb99296f 33 33 34 34 #define PACKAGE "BitlBee" 35 #define BITLBEE_VERSION "1.2. 2"35 #define BITLBEE_VERSION "1.2.3" 36 36 #define VERSION BITLBEE_VERSION 37 37 -
doc/CHANGES
r0a4f6f4 rb99296f 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 these 9 variables was reviewed and should be correct now. 10 11 Finished 7 Sep 2008 5 12 6 13 Version 1.2.2: -
doc/user-guide/Makefile
r0a4f6f4 rb99296f 13 13 14 14 %.html: %.db.xml 15 xsltproc --output $@ http://docbook.sourceforge.net/release/xsl/current/ html/docbook.xsl $<15 xsltproc --output $@ http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $< 16 16 17 17 %.pdf: %.db.xml -
doc/user-guide/help.xml
r0a4f6f4 rb99296f 1 <?xml version="1.0" encoding=" iso-8859-1"?>1 <?xml version="1.0" encoding="utf-8"?> 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
r0a4f6f4 rb99296f 1 <?xml version="1.0" encoding=" iso-8859-1"?>1 <?xml version="1.0" encoding="utf-8"?> 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
r0a4f6f4 rb99296f 38 38 irc_t *irc = set->data; 39 39 40 if( irc->status & USTATUS_IDENTIFIED )40 if( irc->status & USTATUS_IDENTIFIED && value ) 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, TRUE ) != STORAGE_OK )241 if( storage_save( irc, NULL, TRUE ) != STORAGE_OK ) 242 242 irc_usermsg( irc, "Error while saving settings!" ); 243 243 -
root_commands.c
r0a4f6f4 rb99296f 131 131 static void cmd_identify( irc_t *irc, char **cmd ) 132 132 { 133 storage_status_t status = storage_load( irc ->nick, cmd[1], irc);133 storage_status_t status = storage_load( irc, cmd[1] ); 134 134 char *account_on[] = { "account", "on", NULL }; 135 135 … … 143 143 case STORAGE_OK: 144 144 irc_usermsg( irc, "Password accepted, settings and accounts loaded" ); 145 irc_setpass( irc, cmd[1] ); 146 irc->status |= USTATUS_IDENTIFIED; 145 147 irc_umode_set( irc, "+R", 1 ); 146 148 if( set_getbool( &irc->set, "auto_connect" ) ) … … 162 164 } 163 165 164 irc_setpass( irc, cmd[1] ); 165 switch( storage_save( irc, FALSE )) { 166 switch( storage_save( irc, cmd[1], FALSE ) ) { 166 167 case STORAGE_ALREADY_EXISTS: 167 168 irc_usermsg( irc, "Nick is already registered" ); … … 170 171 case STORAGE_OK: 171 172 irc_usermsg( irc, "Account successfully created" ); 173 irc_setpass( irc, cmd[1] ); 172 174 irc->status |= USTATUS_IDENTIFIED; 173 175 irc_umode_set( irc, "+R", 1 ); … … 887 889 static void cmd_save( irc_t *irc, char **cmd ) 888 890 { 889 if( storage_save( irc, TRUE ) == STORAGE_OK ) 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 ) 890 894 irc_usermsg( irc, "Configuration saved" ); 891 895 else -
storage.c
r0a4f6f4 rb99296f 103 103 } 104 104 105 storage_status_t storage_load (const char *nick, const char *password, irc_t * irc) 106 { 107 GList *gl; 105 storage_status_t storage_load (irc_t * irc, const char *password) 106 { 107 GList *gl; 108 109 if (irc && irc->status & USTATUS_IDENTIFIED) 110 return STORAGE_OTHER_ERROR; 108 111 109 112 /* Loop until we don't get NO_SUCH_USER */ … … 112 115 storage_status_t status; 113 116 114 status = st->load(nick, password, irc); 115 if (status == STORAGE_OK) { 116 irc_setpass(irc, password); 117 status = st->load(irc, password); 118 if (status == STORAGE_OK) 117 119 return status; 118 }119 120 120 121 if (status != STORAGE_NO_SUCH_USER) … … 125 126 } 126 127 127 storage_status_t storage_save (irc_t *irc, int overwrite) 128 { 129 return ((storage_t *)global.storage->data)->save(irc, overwrite); 128 storage_status_t storage_save (irc_t *irc, char *password, int overwrite) 129 { 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; 130 149 } 131 150 … … 143 162 144 163 status = st->remove(nick, password); 145 if (status != STORAGE_NO_SUCH_USER && 146 status != STORAGE_OK) 164 if (status != STORAGE_NO_SUCH_USER && status != STORAGE_OK) 147 165 ret = status; 148 166 } … … 150 168 return ret; 151 169 } 170 171 #if 0 172 Not using this yet. Test thoroughly before adding UI hooks to this function. 152 173 153 174 storage_status_t storage_rename (const char *onick, const char *nnick, const char *password) … … 189 210 return STORAGE_OK; 190 211 } 212 #endif -
storage.h
r0a4f6f4 rb99296f 45 45 storage_status_t (*check_pass) (const char *nick, const char *password); 46 46 47 storage_status_t (*load) ( const char *nick, const char *password, irc_t * irc);47 storage_status_t (*load) (irc_t *irc, const char *password); 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 ( const char *nick, const char *password, irc_t * irc);58 storage_status_t storage_save (irc_t *irc, int overwrite);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); 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
r0a4f6f4 rb99296f 44 44 } 45 45 46 static storage_status_t text_load ( const char *my_nick, const char* password, irc_t *irc)46 static storage_status_t text_load( irc_t *irc, const char* password ) 47 47 { 48 48 char s[512]; … … 54 54 account_t *acc, *acc_lookup[9]; 55 55 56 if( irc->status & USTATUS_IDENTIFIED ) 57 return( 1 ); 58 59 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, my_nick, ".accounts" ); 56 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" ); 60 57 fp = fopen( s, "r" ); 61 58 if( !fp ) return STORAGE_NO_SUCH_USER; … … 68 65 return STORAGE_INVALID_PASSWORD; 69 66 } 70 71 /* Do this now. If the user runs with AuthMode = Registered, the72 account command will not work otherwise. */73 irc->status |= USTATUS_IDENTIFIED;74 67 75 68 while( fscanf( fp, "%511[^\n]s", s ) > 0 ) … … 101 94 } 102 95 103 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, my_nick, ".nicks" );96 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".nicks" ); 104 97 fp = fopen( s, "r" ); 105 98 if( !fp ) return STORAGE_NO_SUCH_USER; -
storage_xml.c
r0a4f6f4 rb99296f 29 29 #include "arc.h" 30 30 #include "md5.h" 31 #include <glib/gstdio.h>32 31 33 32 #if GLIB_CHECK_VERSION(2,8,0) … … 259 258 } 260 259 261 static storage_status_t xml_load_real( const char *my_nick, const char *password, irc_t *irc, xml_pass_st action )260 static storage_status_t xml_load_real( irc_t *irc, const char *my_nick, const char *password, xml_pass_st action ) 262 261 { 263 262 GMarkupParseContext *ctx; … … 266 265 GError *gerr = NULL; 267 266 int fd, st; 268 269 if( irc && irc->status & USTATUS_IDENTIFIED )270 return( 1 );271 267 272 268 xd = g_new0( struct xml_parsedata, 1 ); … … 321 317 return STORAGE_OK; 322 318 323 irc->status |= USTATUS_IDENTIFIED;324 325 319 return STORAGE_OK; 326 320 } 327 321 328 static 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 );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 ); 331 325 } 332 326 … … 335 329 /* This is a little bit risky because we have to pass NULL for the 336 330 irc_t argument. This *should* be fine, if I didn't miss anything... */ 337 return xml_load_real( my_nick, password, NULL, XML_PASS_CHECK_ONLY );331 return xml_load_real( NULL, my_nick, password, XML_PASS_CHECK_ONLY ); 338 332 } 339 333 … … 370 364 md5_byte_t pass_md5[21]; 371 365 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 }378 366 379 367 path2 = g_strdup( irc->nick );
Note: See TracChangeset
for help on using the changeset viewer.