Ignore:
Timestamp:
2006-05-25T16:09:15Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
1705ec3
Parents:
51a4ffb (diff), 0a69d7b (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.
Message:

[merge] integration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/ssl_sspi.c

    r51a4ffb rb1bd100  
    4848};
    4949
    50 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );
     50static void ssl_connected(gpointer, gint, GaimInputCondition);
    5151
    5252void sspi_global_init( void )
     
    6363{
    6464        struct scd *conn = g_new0( struct scd, 1 );
     65               
     66        conn->fd = proxy_connect( host, port, ssl_connected, conn );
     67        conn->func = func;
     68        conn->data = data;
     69        conn->inpa = -1;
     70       
     71        if( conn->fd < 0 )
     72        {
     73                g_free( conn );
     74                return( NULL );
     75        }
     76       
     77        if( !initialized )
     78        {
     79                sspi_global_init();
     80                initialized = TRUE;
     81                atexit( sspi_global_deinit );
     82        }
     83
     84        return conn;
     85}
     86
     87static void ssl_connected(gpointer data, gint fd, GaimInputCondition cond)
     88{
     89        struct scd *conn = data;
    6590        SCHANNEL_CRED ssl_cred;
    6691        TimeStamp timestamp;
     
    7297                ISC_REQ_MANUAL_CRED_VALIDATION;
    7398        ULONG a;
    74        
    75         conn->fd = proxy_connect( host, port, ssl_connected, conn );
    76         conn->func = func;
    77         conn->data = data;
    78         conn->inpa = -1;
    79        
    80         if( conn->fd < 0 )
    81         {
    82                 g_free( conn );
    83                 return( NULL );
    84         }
    85        
    86         if( !initialized )
    87         {
    88                 sspi_global_init();
    89                 initialized = TRUE;
    90                 atexit( sspi_global_deinit );
    91         }
    9299
    93100        memset(&ssl_cred, 0, sizeof(SCHANNEL_CRED));
     
    97104        SECURITY_STATUS st = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL, &ssl_cred, NULL, NULL, &conn->cred, &timestamp);
    98105
    99         if (st != SEC_E_OK)
    100                 return NULL;
     106        if (st != SEC_E_OK) {
     107                conn->func( conn->data, NULL, cond );
     108                return;
     109       
    101110       
    102111        do {
    103112                /* initialize buffers */
    104113            ibuf[0].cbBuffer = size; ibuf[0].pvBuffer = buf;
    105             ibuf[1].cbBuffer = 0; ibuf[1].pvBuffer = NIL;
    106             obuf[0].cbBuffer = 0; obuf[0].pvBuffer = NIL;
     114            ibuf[1].cbBuffer = 0; ibuf[1].pvBuffer = NULL;
     115            obuf[0].cbBuffer = 0; obuf[0].pvBuffer = NULL;
    107116        ibuf[0].BufferType = obuf[0].BufferType = SECBUFFER_TOKEN;
    108117            ibuf[1].BufferType = SECBUFFER_EMPTY;
     
    127136
    128137                QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes);
    129 
    130        
    131         return( conn );
     138        } while (1);
     139
     140        conn->func( conn->data, conn, cond );
    132141}
    133142
     
    233242        DeleteSecurityContext(&scd->context);
    234243
    235         FreeCredentialHandle(&scd->cred);
     244        FreeCredentialsHandle(&scd->cred);
    236245
    237246        closesocket( scd->fd );
Note: See TracChangeset for help on using the changeset viewer.