Changeset 22 for trunk/samba/source/libads/sasl.c
- Timestamp:
- Mar 25, 2007, 3:18:51 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/samba/source/libads/sasl.c
r1 r22 312 312 uint8 *p; 313 313 uint32 max_msg_size = 0; 314 char *sname ;314 char *sname = NULL; 315 315 ADS_STATUS status; 316 krb5_principal principal ;316 krb5_principal principal = NULL; 317 317 krb5_context ctx = NULL; 318 318 krb5_enctype enc_types[] = { … … 332 332 status = ADS_ERROR_KRB5(krb5_init_context(&ctx)); 333 333 if (!ADS_ERR_OK(status)) { 334 SAFE_FREE(sname); 334 335 return status; 335 336 } 336 337 status = ADS_ERROR_KRB5(krb5_set_default_tgs_ktypes(ctx, enc_types)); 337 338 if (!ADS_ERR_OK(status)) { 339 SAFE_FREE(sname); 340 krb5_free_context(ctx); 338 341 return status; 339 342 } 340 343 status = ADS_ERROR_KRB5(smb_krb5_parse_name(ctx, sname, &principal)); 341 344 if (!ADS_ERR_OK(status)) { 345 SAFE_FREE(sname); 346 krb5_free_context(ctx); 342 347 return status; 343 348 } 344 345 free(sname);346 krb5_free_context(ctx);347 349 348 350 input_name.value = &principal; … … 350 352 351 353 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 352 365 if (gss_rc) { 366 krb5_free_principal(ctx, principal); 367 krb5_free_context(ctx); 353 368 return ADS_ERROR_GSS(gss_rc, minor_status); 354 369 } … … 408 423 } 409 424 410 gss_release_name(&minor_status, &serv_name);411 412 425 gss_rc = gss_unwrap(&minor_status,context_handle,&input_token,&output_token, 413 426 (int *)&conf_state,NULL); … … 464 477 465 478 failed: 479 480 gss_release_name(&minor_status, &serv_name); 481 krb5_free_principal(ctx, principal); 482 krb5_free_context(ctx); 483 466 484 if(scred) 467 485 ber_bvfree(scred);
Note: See TracChangeset
for help on using the changeset viewer.