Ignore:
Timestamp:
Mar 25, 2007, 3:18:51 PM (14 years ago)
Author:
Yuri Dario
Message:

Source code upgrade to 3.0.25pre2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/libads/sasl.c

    r1 r22  
    312312        uint8 *p;
    313313        uint32 max_msg_size = 0;
    314         char *sname;
     314        char *sname = NULL;
    315315        ADS_STATUS status;
    316         krb5_principal principal;
     316        krb5_principal principal = NULL;
    317317        krb5_context ctx = NULL;
    318318        krb5_enctype enc_types[] = {
     
    332332        status = ADS_ERROR_KRB5(krb5_init_context(&ctx));
    333333        if (!ADS_ERR_OK(status)) {
     334                SAFE_FREE(sname);
    334335                return status;
    335336        }
    336337        status = ADS_ERROR_KRB5(krb5_set_default_tgs_ktypes(ctx, enc_types));
    337338        if (!ADS_ERR_OK(status)) {
     339                SAFE_FREE(sname);
     340                krb5_free_context(ctx);
    338341                return status;
    339342        }
    340343        status = ADS_ERROR_KRB5(smb_krb5_parse_name(ctx, sname, &principal));
    341344        if (!ADS_ERR_OK(status)) {
     345                SAFE_FREE(sname);
     346                krb5_free_context(ctx);
    342347                return status;
    343348        }
    344 
    345         free(sname);
    346         krb5_free_context(ctx);
    347349
    348350        input_name.value = &principal;
     
    350352
    351353        gss_rc = gss_import_name(&minor_status, &input_name, &nt_principal, &serv_name);
     354
     355        /*
     356         * The MIT libraries have a *HORRIBLE* bug - input_value.value needs
     357         * to point to the *address* of the krb5_principal, and the gss libraries
     358         * to a shallow copy of the krb5_principal pointer - so we need to keep
     359         * the krb5_principal around until we do the gss_release_name. MIT *SUCKS* !
     360         * Just one more way in which MIT engineers screwed me over.... JRA.
     361         */
     362
     363        SAFE_FREE(sname);
     364
    352365        if (gss_rc) {
     366                krb5_free_principal(ctx, principal);
     367                krb5_free_context(ctx);
    353368                return ADS_ERROR_GSS(gss_rc, minor_status);
    354369        }
     
    408423        }
    409424
    410         gss_release_name(&minor_status, &serv_name);
    411 
    412425        gss_rc = gss_unwrap(&minor_status,context_handle,&input_token,&output_token,
    413426                            (int *)&conf_state,NULL);
     
    464477
    465478failed:
     479
     480        gss_release_name(&minor_status, &serv_name);
     481        krb5_free_principal(ctx, principal);
     482        krb5_free_context(ctx);
     483
    466484        if(scred)
    467485                ber_bvfree(scred);
Note: See TracChangeset for help on using the changeset viewer.