Changeset 51a4ffb


Ignore:
Timestamp:
2006-05-25T09:55:00Z (13 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
b1bd100
Parents:
80c1e4d
Message:

Some more work on SSL on Windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/ssl_sspi.c

    r80c1e4d r51a4ffb  
    6565        SCHANNEL_CRED ssl_cred;
    6666        TimeStamp timestamp;
     67        SecBuffer ibuf[2],obuf[1];
     68        SecBufferDesc ibufs,obufs;
     69        ULONG req = ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT |
     70        ISC_REQ_CONFIDENTIALITY | ISC_REQ_USE_SESSION_KEY |
     71        ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_STREAM | ISC_REQ_EXTENDED_ERROR |
     72                ISC_REQ_MANUAL_CRED_VALIDATION;
     73        ULONG a;
    6774       
    6875        conn->fd = proxy_connect( host, port, ssl_connected, conn );
     
    8491        }
    8592
    86         conn->context = NULL;
    87 
    8893        memset(&ssl_cred, 0, sizeof(SCHANNEL_CRED));
    8994        ssl_cred.dwVersion = SCHANNEL_CRED_VERSION;
     
    9196
    9297        SECURITY_STATUS st = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL, &ssl_cred, NULL, NULL, &conn->cred, &timestamp);
    93        
    94         InitializeSecurityContext(&conn->cred, &conn->context, host, FIXME, 1, FIXME); 
    95 
    96         QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes);
     98
     99        if (st != SEC_E_OK)
     100                return NULL;
     101       
     102        do {
     103                /* initialize buffers */
     104            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;
     107        ibuf[0].BufferType = obuf[0].BufferType = SECBUFFER_TOKEN;
     108            ibuf[1].BufferType = SECBUFFER_EMPTY;
     109
     110                /* initialize buffer descriptors */
     111            ibufs.ulVersion = obufs.ulVersion = SECBUFFER_VERSION;
     112            ibufs.cBuffers = 2; obufs.cBuffers = 1;
     113            ibufs.pBuffers = ibuf; obufs.pBuffers = obuf;
     114
     115                st = InitializeSecurityContext(&conn->cred, size?&conn->context:NULL, host, req, 0, SECURITY_NETWORK_DREP, size?&ibufs:NULL, 0, &conn->context, &obufs, &a, &timestamp); 
     116        if (obuf[0].pvBuffer && obuf[0].cbBuffer) {
     117                        send(conn->fd, obuf[0].pvBuffer, obuf[0].cbBuffer, 0);
     118                }
     119
     120                switch (st) {
     121                case SEC_I_INCOMPLETE_CREDENTIALS:
     122                        break;
     123                case SEC_I_CONTINUE_NEEDED:
     124
     125                }
     126       
     127
     128                QueryContextAttributes(&conn->context, SECPKG_ATTR_STREAM_SIZES, &conn->sizes);
    97129
    98130       
     
    201233        DeleteSecurityContext(&scd->context);
    202234
     235        FreeCredentialHandle(&scd->cred);
     236
    203237        closesocket( scd->fd );
    204238        g_free(scd);
Note: See TracChangeset for help on using the changeset viewer.