Changeset 3b6eadc


Ignore:
Timestamp:
2007-07-07T17:19:28Z (17 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
b9e4ab5
Parents:
f7b44f2
Message:

Fix some warnings in storage.c.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • lib/base64.c

    rf7b44f2 r3b6eadc  
    3131char *tobase64(const char *text)
    3232{
    33         return base64_encode(text, strlen(text));
     33        return base64_encode((const unsigned char *)text, strlen(text));
    3434}
    3535
    36 char *base64_encode(const char *in, int len)
     36char *base64_encode(const unsigned char *in, int len)
    3737{
    3838        char *out;
  • lib/base64.h

    rf7b44f2 r3b6eadc  
    2727
    2828G_MODULE_EXPORT char *tobase64( const char *text );
    29 G_MODULE_EXPORT char *base64_encode( const char *in, int len );
     29G_MODULE_EXPORT char *base64_encode( const unsigned char *in, int len );
    3030G_MODULE_EXPORT int base64_encode_real( const unsigned char *in, int inlen, unsigned char *out, const char *b64digits );
    3131G_MODULE_EXPORT char *frombase64( const char *in );
  • lib/rc4.c

    rf7b44f2 r3b6eadc  
    122122*/
    123123
    124 int rc4_encode( unsigned char *clear, int clear_len, unsigned char **crypt, char *password )
     124int rc4_encode( char *clear, int clear_len, unsigned char **crypt, char *password )
    125125{
    126126        struct rc4_state *st;
     
    130130        key_len = strlen( password ) + RC4_IV_LEN;
    131131        if( clear_len <= 0 )
    132                 clear_len = strlen( (char*) clear );
     132                clear_len = strlen( clear );
    133133       
    134134        /* Prepare buffers and the key + IV */
     
    154154}
    155155
    156 int rc4_decode( unsigned char *crypt, int crypt_len, unsigned char **clear, char *password )
     156int rc4_decode( unsigned char *crypt, int crypt_len, char **clear, char *password )
    157157{
    158158        struct rc4_state *st;
     
    165165        if( clear_len < 0 )
    166166        {
    167                 *clear = (unsigned char*) g_strdup( "" );
     167                *clear = g_strdup( "" );
    168168                return 0;
    169169        }
  • lib/rc4.h

    rf7b44f2 r3b6eadc  
    3333struct rc4_state *rc4_keymaker( unsigned char *key, int kl, int cycles );
    3434unsigned char rc4_getbyte( struct rc4_state *st );
    35 int rc4_encode( unsigned char *clear, int clear_len, unsigned char **crypt, char *password );
    36 int rc4_decode( unsigned char *crypt, int crypt_len, unsigned char **clear, char *password );
     35int rc4_encode( char *clear, int clear_len, unsigned char **crypt, char *password );
     36int rc4_decode( unsigned char *crypt, int crypt_len, char **clear, char *password );
  • protocols/jabber/sasl.c

    rf7b44f2 r3b6eadc  
    8989                strcpy( s + 1, jd->username );
    9090                strcpy( s + 2 + strlen( jd->username ), ic->acc->pass );
    91                 reply->text = base64_encode( s, len );
     91                reply->text = base64_encode( (unsigned char *)s, len );
    9292                reply->text_len = strlen( reply->text );
    9393                g_free( s );
     
    185185        struct jabber_data *jd = ic->proto_data;
    186186        struct xt_node *reply = NULL;
    187         char *nonce = NULL, *realm = NULL, *cnonce = NULL, cnonce_bin[30];
     187        char *nonce = NULL, *realm = NULL, *cnonce = NULL;
     188        unsigned char cnonce_bin[30];
    188189        char *digest_uri = NULL;
    189190        char *dec = NULL;
     
    216217                        realm = g_strdup( jd->server );
    217218               
    218                 random_bytes( (unsigned char *) cnonce_bin, sizeof( cnonce_bin ) );
     219                random_bytes( cnonce_bin, sizeof( cnonce_bin ) );
    219220                cnonce = base64_encode( cnonce_bin, sizeof( cnonce_bin ) );
    220221                digest_uri = g_strdup_printf( "%s/%s", "xmpp", jd->server );
  • storage_xml.c

    rf7b44f2 r3b6eadc  
    132132        {
    133133                char *protocol, *handle, *server, *password = NULL, *autoconnect;
    134                 char *pass_b64 = NULL, *pass_rc4 = NULL;
     134                char *pass_b64 = NULL;
     135                unsigned char *pass_rc4 = NULL;
    135136                int pass_len;
    136137                struct prpl *prpl = NULL;
     
    152153                                     "Unknown protocol: %s", protocol );
    153154                else if( ( pass_len = base64_decode( pass_b64, (unsigned char**) &pass_rc4 ) ) &&
    154                                 rc4_decode( (unsigned char*) pass_rc4, pass_len,
    155                                             (unsigned char**) &password, xd->given_pass ) )
     155                                rc4_decode( pass_rc4, pass_len,
     156                                            &password,
     157                                                                        xd->given_pass ) )
    156158                {
    157159                        xd->current_account = account_add( irc, prpl, handle, password );
     
    410412        md5_finish( &md5_state, pass_md5 );
    411413        /* Save the hash in base64-encoded form. */
    412         pass_buf = base64_encode( (char*) pass_md5, 21 );
     414        pass_buf = base64_encode( pass_md5, 21 );
    413415       
    414416        if( !xml_printf( fd, 0, "<user nick=\"%s\" password=\"%s\" version=\"%d\">\n", irc->nick, pass_buf, XML_FORMAT_VERSION ) )
     
    424426        for( acc = irc->accounts; acc; acc = acc->next )
    425427        {
    426                 char *pass_rc4, *pass_b64;
     428                unsigned char *pass_rc4;
     429                char *pass_b64;
    427430                int pass_len;
    428431               
    429                 pass_len = rc4_encode( (unsigned char*) acc->pass, strlen( acc->pass ), (unsigned char**) &pass_rc4, irc->password );
     432                pass_len = rc4_encode( acc->pass, strlen( acc->pass ), (unsigned char**) &pass_rc4, irc->password );
    430433                pass_b64 = base64_encode( pass_rc4, pass_len );
    431434                g_free( pass_rc4 );
Note: See TracChangeset for help on using the changeset viewer.