Changeset 745 for trunk/server/source4/heimdal/lib/gssapi
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 116 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/heimdal/lib/gssapi/gssapi/gssapi.h
r414 r745 46 46 #ifndef BUILD_GSSAPI_LIB 47 47 #if defined(_WIN32) 48 #define GSSAPI_LIB_FUNCTION _stdcall __declspec(dllimport) 48 #define GSSAPI_LIB_FUNCTION __declspec(dllimport) 49 #define GSSAPI_LIB_CALL __stdcall 49 50 #define GSSAPI_LIB_VARIABLE __declspec(dllimport) 50 51 #else 51 52 #define GSSAPI_LIB_FUNCTION 53 #define GSSAPI_LIB_CALL 52 54 #define GSSAPI_LIB_VARIABLE 53 55 #endif … … 72 74 #endif 73 75 76 #ifdef _WIN32 77 #define GSSAPI_CALLCONV __stdcall 78 #else 79 #define GSSAPI_CALLCONV 80 #endif 81 74 82 /* 75 83 * Now define the three implementation-dependent types. … … 83 91 struct gss_name_t_desc_struct; 84 92 typedef struct gss_name_t_desc_struct *gss_name_t; 93 typedef const struct gss_name_t_desc_struct *gss_const_name_t; 85 94 86 95 struct gss_ctx_id_t_desc_struct; 87 96 typedef struct gss_ctx_id_t_desc_struct *gss_ctx_id_t; 97 typedef const struct gss_ctx_id_t_desc_struct gss_const_ctx_id_t; 88 98 89 99 typedef struct gss_OID_desc_struct { … … 91 101 void *elements; 92 102 } gss_OID_desc, *gss_OID; 103 typedef const gss_OID_desc * gss_const_OID; 93 104 94 105 typedef struct gss_OID_set_desc_struct { … … 96 107 gss_OID elements; 97 108 } gss_OID_set_desc, *gss_OID_set; 109 typedef const gss_OID_set_desc * gss_const_OID_set; 98 110 99 111 typedef int gss_cred_usage_t; … … 101 113 struct gss_cred_id_t_desc_struct; 102 114 typedef struct gss_cred_id_t_desc_struct *gss_cred_id_t; 115 typedef const struct gss_cred_id_t_desc_struct *gss_const_cred_id_t; 103 116 104 117 typedef struct gss_buffer_desc_struct { … … 106 119 void *value; 107 120 } gss_buffer_desc, *gss_buffer_t; 121 typedef const gss_buffer_desc * gss_const_buffer_t; 108 122 109 123 typedef struct gss_channel_bindings_struct { … … 114 128 gss_buffer_desc application_data; 115 129 } *gss_channel_bindings_t; 130 typedef const struct gss_channel_bindings_struct *gss_const_channel_bindings_t; 116 131 117 132 /* GGF extension data types */ … … 130 145 */ 131 146 typedef OM_uint32 gss_qop_t; 147 148 132 149 133 150 /* … … 245 262 #define GSS_IOV_BUFFER_TYPE_SIGN_ONLY 11 246 263 247 #define GSS_IOV_BUFFER_TYPE_FLAG_MASK 0xffff0000 248 #define GSS_IOV_BUFFER_TYPE_FLAG_ALLOCATE 0x00010000 249 #define GSS_IOV_BUFFER_TYPE_FLAG_ALLOCATED 0x00020000 264 #define GSS_IOV_BUFFER_TYPE_FLAG_MASK 0xffff0000 265 #define GSS_IOV_BUFFER_FLAG_ALLOCATE 0x00010000 266 #define GSS_IOV_BUFFER_FLAG_ALLOCATED 0x00020000 267 268 #define GSS_IOV_BUFFER_TYPE_FLAG_ALLOCATE 0x00010000 /* old name */ 269 #define GSS_IOV_BUFFER_TYPE_FLAG_ALLOCATED 0x00020000 /* old name */ 250 270 251 271 #define GSS_IOV_BUFFER_TYPE(_t) ((_t) & ~GSS_IOV_BUFFER_TYPE_FLAG_MASK) … … 253 273 254 274 GSSAPI_CPP_START 275 276 #include <gssapi/gssapi_oid.h> 255 277 256 278 /* … … 265 287 * to that gss_OID_desc. 266 288 */ 267 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_USER_NAME; 289 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_user_name_oid_desc; 290 #define GSS_C_NT_USER_NAME (&__gss_c_nt_user_name_oid_desc) 268 291 269 292 /* … … 278 301 * initialized to point to that gss_OID_desc. 279 302 */ 280 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_MACHINE_UID_NAME; 303 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_machine_uid_name_oid_desc; 304 #define GSS_C_NT_MACHINE_UID_NAME (&__gss_c_nt_machine_uid_name_oid_desc) 281 305 282 306 /* … … 291 315 * initialized to point to that gss_OID_desc. 292 316 */ 293 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_STRING_UID_NAME; 317 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_string_uid_name_oid_desc; 318 #define GSS_C_NT_STRING_UID_NAME (&__gss_c_nt_string_uid_name_oid_desc) 294 319 295 320 /* … … 310 335 * implementations 311 336 */ 312 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_HOSTBASED_SERVICE_X; 337 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_hostbased_service_x_oid_desc; 338 #define GSS_C_NT_HOSTBASED_SERVICE_X (&__gss_c_nt_hostbased_service_x_oid_desc) 313 339 314 340 /* … … 323 349 * to point to that gss_OID_desc. 324 350 */ 325 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_HOSTBASED_SERVICE; 351 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_hostbased_service_oid_desc; 352 #define GSS_C_NT_HOSTBASED_SERVICE (&__gss_c_nt_hostbased_service_oid_desc) 326 353 327 354 /* … … 335 362 * to that gss_OID_desc. 336 363 */ 337 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_ANONYMOUS; 364 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_anonymous_oid_desc; 365 #define GSS_C_NT_ANONYMOUS (&__gss_c_nt_anonymous_oid_desc) 338 366 339 367 /* … … 347 375 * to that gss_OID_desc. 348 376 */ 349 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_EXPORT_NAME; 350 351 /* 352 * Digest mechanism 353 */ 354 355 extern GSSAPI_LIB_VARIABLE gss_OID GSS_SASL_DIGEST_MD5_MECHANISM; 377 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_c_nt_export_name_oid_desc; 378 #define GSS_C_NT_EXPORT_NAME (&__gss_c_nt_export_name_oid_desc) 356 379 357 380 /* Major status codes */ … … 422 445 #define GSS_S_DUPLICATE_ELEMENT (17ul << GSS_C_ROUTINE_ERROR_OFFSET) 423 446 #define GSS_S_NAME_NOT_MN (18ul << GSS_C_ROUTINE_ERROR_OFFSET) 447 #define GSS_S_BAD_MECH_ATTR (19ul << GSS_C_ROUTINE_ERROR_OFFSET) 424 448 425 449 /* … … 436 460 */ 437 461 438 OM_uint32 GSSAPI_LIB_FUNCTIONgss_acquire_cred462 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_acquire_cred 439 463 (OM_uint32 * /*minor_status*/, 440 464 const gss_name_t /*desired_name*/, … … 447 471 ); 448 472 449 OM_uint32 GSSAPI_LIB_FUNCTIONgss_release_cred473 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_release_cred 450 474 (OM_uint32 * /*minor_status*/, 451 475 gss_cred_id_t * /*cred_handle*/ 452 476 ); 453 477 454 OM_uint32 GSSAPI_LIB_FUNCTIONgss_init_sec_context478 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_init_sec_context 455 479 (OM_uint32 * /*minor_status*/, 456 480 const gss_cred_id_t /*initiator_cred_handle*/, … … 468 492 ); 469 493 470 OM_uint32 GSSAPI_LIB_FUNCTIONgss_accept_sec_context494 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_accept_sec_context 471 495 (OM_uint32 * /*minor_status*/, 472 496 gss_ctx_id_t * /*context_handle*/, … … 482 506 ); 483 507 484 OM_uint32 GSSAPI_LIB_FUNCTIONgss_process_context_token508 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_process_context_token 485 509 (OM_uint32 * /*minor_status*/, 486 510 const gss_ctx_id_t /*context_handle*/, … … 488 512 ); 489 513 490 OM_uint32 GSSAPI_LIB_FUNCTIONgss_delete_sec_context514 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_delete_sec_context 491 515 (OM_uint32 * /*minor_status*/, 492 516 gss_ctx_id_t * /*context_handle*/, … … 494 518 ); 495 519 496 OM_uint32 GSSAPI_LIB_FUNCTIONgss_context_time520 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_context_time 497 521 (OM_uint32 * /*minor_status*/, 498 522 const gss_ctx_id_t /*context_handle*/, … … 500 524 ); 501 525 502 OM_uint32 GSSAPI_LIB_FUNCTIONgss_get_mic526 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_get_mic 503 527 (OM_uint32 * /*minor_status*/, 504 528 const gss_ctx_id_t /*context_handle*/, … … 508 532 ); 509 533 510 OM_uint32 GSSAPI_LIB_FUNCTIONgss_verify_mic534 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_verify_mic 511 535 (OM_uint32 * /*minor_status*/, 512 536 const gss_ctx_id_t /*context_handle*/, … … 516 540 ); 517 541 518 OM_uint32 GSSAPI_LIB_FUNCTIONgss_wrap542 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_wrap 519 543 (OM_uint32 * /*minor_status*/, 520 544 const gss_ctx_id_t /*context_handle*/, … … 526 550 ); 527 551 528 OM_uint32 GSSAPI_LIB_FUNCTIONgss_unwrap552 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_unwrap 529 553 (OM_uint32 * /*minor_status*/, 530 554 const gss_ctx_id_t /*context_handle*/, … … 535 559 ); 536 560 537 OM_uint32 GSSAPI_LIB_FUNCTIONgss_display_status561 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_display_status 538 562 (OM_uint32 * /*minor_status*/, 539 563 OM_uint32 /*status_value*/, … … 544 568 ); 545 569 546 OM_uint32 GSSAPI_LIB_FUNCTIONgss_indicate_mechs570 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_indicate_mechs 547 571 (OM_uint32 * /*minor_status*/, 548 572 gss_OID_set * /*mech_set*/ 549 573 ); 550 574 551 OM_uint32 GSSAPI_LIB_FUNCTIONgss_compare_name575 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_compare_name 552 576 (OM_uint32 * /*minor_status*/, 553 577 const gss_name_t /*name1*/, … … 556 580 ); 557 581 558 OM_uint32 GSSAPI_LIB_FUNCTIONgss_display_name582 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_display_name 559 583 (OM_uint32 * /*minor_status*/, 560 584 const gss_name_t /*input_name*/, … … 563 587 ); 564 588 565 OM_uint32 GSSAPI_LIB_FUNCTIONgss_import_name589 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_import_name 566 590 (OM_uint32 * /*minor_status*/, 567 591 const gss_buffer_t /*input_name_buffer*/, … … 570 594 ); 571 595 572 OM_uint32 GSSAPI_LIB_FUNCTIONgss_export_name596 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_export_name 573 597 (OM_uint32 * /*minor_status*/, 574 598 const gss_name_t /*input_name*/, … … 576 600 ); 577 601 578 OM_uint32 GSSAPI_LIB_FUNCTIONgss_release_name602 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_release_name 579 603 (OM_uint32 * /*minor_status*/, 580 604 gss_name_t * /*input_name*/ 581 605 ); 582 606 583 OM_uint32 GSSAPI_LIB_FUNCTIONgss_release_buffer607 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_release_buffer 584 608 (OM_uint32 * /*minor_status*/, 585 609 gss_buffer_t /*buffer*/ 586 610 ); 587 611 588 OM_uint32 GSSAPI_LIB_FUNCTIONgss_release_oid_set612 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_release_oid_set 589 613 (OM_uint32 * /*minor_status*/, 590 614 gss_OID_set * /*set*/ 591 615 ); 592 616 593 OM_uint32 GSSAPI_LIB_FUNCTIONgss_inquire_cred617 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_inquire_cred 594 618 (OM_uint32 * /*minor_status*/, 595 619 const gss_cred_id_t /*cred_handle*/, … … 600 624 ); 601 625 602 OM_uint32 GSSAPI_LIB_FUNCTIONgss_inquire_context (626 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_inquire_context ( 603 627 OM_uint32 * /*minor_status*/, 604 628 const gss_ctx_id_t /*context_handle*/, … … 612 636 ); 613 637 614 OM_uint32 GSSAPI_LIB_FUNCTIONgss_wrap_size_limit (638 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_wrap_size_limit ( 615 639 OM_uint32 * /*minor_status*/, 616 640 const gss_ctx_id_t /*context_handle*/, … … 621 645 ); 622 646 623 OM_uint32 GSSAPI_LIB_FUNCTIONgss_add_cred (647 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_add_cred ( 624 648 OM_uint32 * /*minor_status*/, 625 649 const gss_cred_id_t /*input_cred_handle*/, … … 635 659 ); 636 660 637 OM_uint32 GSSAPI_LIB_FUNCTIONgss_inquire_cred_by_mech (661 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_inquire_cred_by_mech ( 638 662 OM_uint32 * /*minor_status*/, 639 663 const gss_cred_id_t /*cred_handle*/, … … 645 669 ); 646 670 647 OM_uint32 GSSAPI_LIB_FUNCTIONgss_export_sec_context (671 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_export_sec_context ( 648 672 OM_uint32 * /*minor_status*/, 649 673 gss_ctx_id_t * /*context_handle*/, … … 651 675 ); 652 676 653 OM_uint32 GSSAPI_LIB_FUNCTIONgss_import_sec_context (677 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_import_sec_context ( 654 678 OM_uint32 * /*minor_status*/, 655 679 const gss_buffer_t /*interprocess_token*/, … … 657 681 ); 658 682 659 OM_uint32 GSSAPI_LIB_FUNCTIONgss_create_empty_oid_set (683 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_create_empty_oid_set ( 660 684 OM_uint32 * /*minor_status*/, 661 685 gss_OID_set * /*oid_set*/ 662 686 ); 663 687 664 OM_uint32 GSSAPI_LIB_FUNCTIONgss_add_oid_set_member (688 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_add_oid_set_member ( 665 689 OM_uint32 * /*minor_status*/, 666 690 const gss_OID /*member_oid*/, … … 668 692 ); 669 693 670 OM_uint32 GSSAPI_LIB_FUNCTIONgss_test_oid_set_member (694 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_test_oid_set_member ( 671 695 OM_uint32 * /*minor_status*/, 672 696 const gss_OID /*member*/, … … 675 699 ); 676 700 677 OM_uint32 GSSAPI_LIB_FUNCTIONgss_inquire_names_for_mech (701 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_inquire_names_for_mech ( 678 702 OM_uint32 * /*minor_status*/, 679 703 const gss_OID /*mechanism*/, … … 681 705 ); 682 706 683 OM_uint32 GSSAPI_LIB_FUNCTIONgss_inquire_mechs_for_name (707 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_inquire_mechs_for_name ( 684 708 OM_uint32 * /*minor_status*/, 685 709 const gss_name_t /*input_name*/, … … 687 711 ); 688 712 689 OM_uint32 GSSAPI_LIB_FUNCTIONgss_canonicalize_name (713 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_canonicalize_name ( 690 714 OM_uint32 * /*minor_status*/, 691 715 const gss_name_t /*input_name*/, … … 694 718 ); 695 719 696 OM_uint32 GSSAPI_LIB_FUNCTIONgss_duplicate_name (720 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_duplicate_name ( 697 721 OM_uint32 * /*minor_status*/, 698 722 const gss_name_t /*src_name*/, … … 700 724 ); 701 725 702 OM_uint32 GSSAPI_LIB_FUNCTIONgss_duplicate_oid (726 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_duplicate_oid ( 703 727 OM_uint32 * /* minor_status */, 704 728 gss_OID /* src_oid */, … … 706 730 ); 707 731 708 OM_uint32 GSSAPI_LIB_FUNCTION 732 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 709 733 gss_release_oid 710 734 (OM_uint32 * /*minor_status*/, … … 712 736 ); 713 737 714 OM_uint32 GSSAPI_LIB_FUNCTION 738 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 715 739 gss_oid_to_str( 716 740 OM_uint32 * /*minor_status*/, … … 719 743 ); 720 744 721 OM_uint32 GSSAPI_LIB_FUNCTION 745 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 722 746 gss_inquire_sec_context_by_oid( 723 747 OM_uint32 * minor_status, … … 727 751 ); 728 752 729 OM_uint32 GSSAPI_LIB_FUNCTION 753 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 730 754 gss_set_sec_context_option (OM_uint32 *minor_status, 731 755 gss_ctx_id_t *context_handle, … … 733 757 const gss_buffer_t value); 734 758 735 OM_uint32 GSSAPI_LIB_FUNCTION 759 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 736 760 gss_set_cred_option (OM_uint32 *minor_status, 737 761 gss_cred_id_t *cred_handle, … … 739 763 const gss_buffer_t value); 740 764 741 int GSSAPI_LIB_FUNCTION 742 gss_oid_equal( const gss_OID a, const gss_OID b);743 744 OM_uint32 GSSAPI_LIB_FUNCTION 765 GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL 766 gss_oid_equal(gss_const_OID a, gss_const_OID b); 767 768 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 745 769 gss_create_empty_buffer_set 746 770 (OM_uint32 * minor_status, 747 771 gss_buffer_set_t *buffer_set); 748 772 749 OM_uint32 GSSAPI_LIB_FUNCTION 773 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 750 774 gss_add_buffer_set_member 751 775 (OM_uint32 * minor_status, … … 753 777 gss_buffer_set_t *buffer_set); 754 778 755 OM_uint32 GSSAPI_LIB_FUNCTION 779 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 756 780 gss_release_buffer_set 757 781 (OM_uint32 * minor_status, 758 782 gss_buffer_set_t *buffer_set); 759 783 760 OM_uint32 GSSAPI_LIB_FUNCTION 784 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 761 785 gss_inquire_cred_by_oid(OM_uint32 *minor_status, 762 786 const gss_cred_id_t cred_handle, … … 771 795 #define GSS_C_PRF_KEY_PARTIAL 1 772 796 773 OM_uint32 GSSAPI_LIB_FUNCTION 797 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 774 798 gss_pseudo_random 775 799 (OM_uint32 *minor_status, … … 781 805 ); 782 806 783 OM_uint32 807 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 784 808 gss_store_cred(OM_uint32 * /* minor_status */, 785 809 gss_cred_id_t /* input_cred_handle */, … … 806 830 } gss_context_stream_sizes; 807 831 808 extern gss_OID GSSAPI_LIB_VARIABLE GSS_C_ATTR_STREAM_SIZES; 809 810 811 OM_uint32 GSSAPI_LIB_FUNCTION 832 extern gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_attr_stream_sizes_oid_desc; 833 #define GSS_C_ATTR_STREAM_SIZES (&__gss_c_attr_stream_sizes_oid_desc) 834 835 836 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 812 837 gss_context_query_attributes(OM_uint32 * /* minor_status */, 813 gss_OID /* attribute */, 838 const gss_ctx_id_t /* context_handle */, 839 const gss_OID /* attribute */, 814 840 void * /*data*/, 815 841 size_t /* len */); … … 825 851 */ 826 852 827 OM_uint32 GSSAPI_LIB_FUNCTION GSSAPI_DEPRECATEDgss_sign853 GSSAPI_DEPRECATED GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_sign 828 854 (OM_uint32 * /*minor_status*/, 829 855 gss_ctx_id_t /*context_handle*/, … … 833 859 ); 834 860 835 OM_uint32 GSSAPI_LIB_FUNCTION GSSAPI_DEPRECATEDgss_verify861 GSSAPI_DEPRECATED GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_verify 836 862 (OM_uint32 * /*minor_status*/, 837 863 gss_ctx_id_t /*context_handle*/, … … 841 867 ); 842 868 843 OM_uint32 GSSAPI_LIB_FUNCTION GSSAPI_DEPRECATEDgss_seal869 GSSAPI_DEPRECATED GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_seal 844 870 (OM_uint32 * /*minor_status*/, 845 871 gss_ctx_id_t /*context_handle*/, … … 851 877 ); 852 878 853 OM_uint32 GSSAPI_LIB_FUNCTION GSSAPI_DEPRECATEDgss_unseal879 GSSAPI_DEPRECATED GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_unseal 854 880 (OM_uint32 * /*minor_status*/, 855 881 gss_ctx_id_t /*context_handle*/, … … 860 886 ); 861 887 862 /* 888 /** 863 889 * 864 890 */ 865 891 866 OM_uint32 GSSAPI_LIB_FUNCTION 867 gss_encapsulate_token( gss_buffer_t /* input_token */,868 gss_OID /* oid */,892 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 893 gss_encapsulate_token(const gss_buffer_t /* input_token */, 894 const gss_OID /* oid */, 869 895 gss_buffer_t /* output_token */); 870 896 871 OM_uint32 GSSAPI_LIB_FUNCTION 872 gss_decapsulate_token( gss_buffer_t /* input_token */,873 gss_OID /* oid */,897 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 898 gss_decapsulate_token(const gss_buffer_t /* input_token */, 899 const gss_OID /* oid */, 874 900 gss_buffer_t /* output_token */); 875 901 … … 884 910 */ 885 911 886 OM_uint32 GSSAPI_LIB_FUNCTION 912 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 887 913 gss_wrap_iov(OM_uint32 *, gss_ctx_id_t, int, gss_qop_t, int *, 888 914 gss_iov_buffer_desc *, int); 889 915 890 916 891 OM_uint32 GSSAPI_LIB_FUNCTION 917 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 892 918 gss_unwrap_iov(OM_uint32 *, gss_ctx_id_t, int *, gss_qop_t *, 893 919 gss_iov_buffer_desc *, int); 894 920 895 OM_uint32 GSSAPI_LIB_FUNCTION 921 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 896 922 gss_wrap_iov_length(OM_uint32 *, gss_ctx_id_t, int, gss_qop_t, int *, 897 923 gss_iov_buffer_desc *, int); 898 924 899 OM_uint32 GSSAPI_LIB_FUNCTION 925 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 900 926 gss_release_iov_buffer(OM_uint32 *, gss_iov_buffer_desc *, int); 901 927 902 928 903 OM_uint32 GSSAPI_LIB_FUNCTION 929 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 904 930 gss_export_cred(OM_uint32 * /* minor_status */, 905 931 gss_cred_id_t /* cred_handle */, 906 932 gss_buffer_t /* cred_token */); 907 933 908 OM_uint32 GSSAPI_LIB_FUNCTION 934 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 909 935 gss_import_cred(OM_uint32 * /* minor_status */, 910 936 gss_buffer_t /* cred_token */, 911 937 gss_cred_id_t * /* cred_handle */); 912 938 939 /* 940 * mech option 941 */ 942 943 GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL 944 gss_mo_set(gss_const_OID mech, gss_const_OID option, 945 int enable, gss_buffer_t value); 946 947 GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL 948 gss_mo_get(gss_const_OID mech, gss_const_OID option, gss_buffer_t value); 949 950 GSSAPI_LIB_FUNCTION void GSSAPI_LIB_CALL 951 gss_mo_list(gss_const_OID mech, gss_OID_set *options); 952 953 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 954 gss_mo_name(gss_const_OID mech, gss_const_OID options, gss_buffer_t name); 955 956 /* 957 * SASL glue functions and mech inquire 958 */ 959 960 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 961 gss_inquire_saslname_for_mech(OM_uint32 *minor_status, 962 const gss_OID desired_mech, 963 gss_buffer_t sasl_mech_name, 964 gss_buffer_t mech_name, 965 gss_buffer_t mech_description); 966 967 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 968 gss_inquire_mech_for_saslname(OM_uint32 *minor_status, 969 const gss_buffer_t sasl_mech_name, 970 gss_OID *mech_type); 971 972 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 973 gss_indicate_mechs_by_attrs(OM_uint32 * minor_status, 974 gss_const_OID_set desired_mech_attrs, 975 gss_const_OID_set except_mech_attrs, 976 gss_const_OID_set critical_mech_attrs, 977 gss_OID_set *mechs); 978 979 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 980 gss_inquire_attrs_for_mech(OM_uint32 * minor_status, 981 gss_const_OID mech, 982 gss_OID_set *mech_attr, 983 gss_OID_set *known_mech_attrs); 984 985 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 986 gss_display_mech_attr(OM_uint32 * minor_status, 987 gss_const_OID mech_attr, 988 gss_buffer_t name, 989 gss_buffer_t short_desc, 990 gss_buffer_t long_desc); 991 992 /* 993 * Naming extensions 994 */ 995 996 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_display_name_ext ( 997 OM_uint32 *, /* minor_status */ 998 gss_name_t, /* name */ 999 gss_OID, /* display_as_name_type */ 1000 gss_buffer_t /* display_name */ 1001 ); 1002 1003 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_inquire_name ( 1004 OM_uint32 *, /* minor_status */ 1005 gss_name_t, /* name */ 1006 int *, /* name_is_MN */ 1007 gss_OID *, /* MN_mech */ 1008 gss_buffer_set_t * /* attrs */ 1009 ); 1010 1011 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_get_name_attribute ( 1012 OM_uint32 *, /* minor_status */ 1013 gss_name_t, /* name */ 1014 gss_buffer_t, /* attr */ 1015 int *, /* authenticated */ 1016 int *, /* complete */ 1017 gss_buffer_t, /* value */ 1018 gss_buffer_t, /* display_value */ 1019 int * /* more */ 1020 ); 1021 1022 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_set_name_attribute ( 1023 OM_uint32 *, /* minor_status */ 1024 gss_name_t, /* name */ 1025 int, /* complete */ 1026 gss_buffer_t, /* attr */ 1027 gss_buffer_t /* value */ 1028 ); 1029 1030 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_delete_name_attribute ( 1031 OM_uint32 *, /* minor_status */ 1032 gss_name_t, /* name */ 1033 gss_buffer_t /* attr */ 1034 ); 1035 1036 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_export_name_composite ( 1037 OM_uint32 *, /* minor_status */ 1038 gss_name_t, /* name */ 1039 gss_buffer_t /* exp_composite_name */ 1040 ); 1041 1042 /* 1043 * 1044 */ 1045 1046 GSSAPI_LIB_FUNCTION const char * GSSAPI_LIB_CALL 1047 gss_oid_to_name(gss_const_OID oid); 1048 1049 GSSAPI_LIB_FUNCTION gss_OID GSSAPI_LIB_CALL 1050 gss_name_to_oid(const char *name); 913 1051 914 1052 GSSAPI_CPP_END -
trunk/server/source4/heimdal/lib/gssapi/gssapi/gssapi_krb5.h
r414 r745 54 54 */ 55 55 56 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_NT_PRINCIPAL_NAME; 57 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_NT_USER_NAME; 58 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_NT_MACHINE_UID_NAME; 59 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_NT_STRING_UID_NAME; 60 61 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_MECHANISM; 56 extern gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_nt_principal_name_oid_desc; 57 #define GSS_KRB5_NT_PRINCIPAL_NAME (&__gss_krb5_nt_principal_name_oid_desc) 58 59 #define GSS_KRB5_NT_USER_NAME (&__gss_c_nt_user_name_oid_desc) 60 #define GSS_KRB5_NT_MACHINE_UID_NAME (&__gss_c_nt_machine_uid_name_oid_desc) 61 #define GSS_KRB5_NT_STRING_UID_NAME (&__gss_c_nt_string_uid_name_oid_desc) 62 63 extern gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_mechanism_oid_desc; 64 #define GSS_KRB5_MECHANISM (&__gss_krb5_mechanism_oid_desc) 62 65 63 66 /* for compatibility with MIT api */ … … 65 68 #define gss_mech_krb5 GSS_KRB5_MECHANISM 66 69 #define gss_krb5_nt_general_name GSS_KRB5_NT_PRINCIPAL_NAME 67 68 /* Extensions set contexts options */69 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_COPY_CCACHE_X;70 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_COMPAT_DES3_MIC_X;71 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_REGISTER_ACCEPTOR_IDENTITY_X;72 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_SET_DNS_CANONICALIZE_X;73 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_SEND_TO_KDC_X;74 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_SET_DEFAULT_REALM_X;75 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_CCACHE_NAME_X;76 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_SET_TIME_OFFSET_X;77 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_GET_TIME_OFFSET_X;78 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_PLUGIN_REGISTER_X;79 /* Extensions inquire context */80 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_GET_TKT_FLAGS_X;81 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT_X;82 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_PEER_HAS_UPDATED_SPNEGO;83 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_EXPORT_LUCID_CONTEXT_X;84 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_EXPORT_LUCID_CONTEXT_V1_X;85 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_GET_SUBKEY_X;86 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_GET_INITIATOR_SUBKEY_X;87 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_GET_ACCEPTOR_SUBKEY_X;88 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_GET_AUTHTIME_X;89 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_GET_SERVICE_KEYBLOCK_X;90 /* Extensions creds */91 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_IMPORT_CRED_X;92 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_SET_ALLOWABLE_ENCTYPES_X;93 extern GSSAPI_LIB_VARIABLE gss_OID GSS_KRB5_CRED_NO_CI_FLAGS_X;94 70 95 71 /* … … 101 77 struct Principal; 102 78 103 OM_uint32 GSSAPI_LIB_FUNCTION 79 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 104 80 gss_krb5_ccache_name(OM_uint32 * /*minor_status*/, 105 81 const char * /*name */, 106 82 const char ** /*out_name */); 107 83 108 OM_uint32 GSSAPI_LIB_FUNCTIONgsskrb5_register_acceptor_identity109 (const char * /*identity*/);110 111 OM_uint32 GSSAPI_LIB_FUNCTIONkrb5_gss_register_acceptor_identity112 (const char * /*identity*/);113 114 OM_uint32 GSSAPI_LIB_FUNCTIONgss_krb5_copy_ccache115 (OM_uint32 * /*minor*/,84 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gsskrb5_register_acceptor_identity 85 (const char * /*identity*/); 86 87 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL krb5_gss_register_acceptor_identity 88 (const char * /*identity*/); 89 90 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_krb5_copy_ccache 91 (OM_uint32 * /*minor*/, 116 92 gss_cred_id_t /*cred*/, 117 struct krb5_ccache_data * /*out*/);118 119 OM_uint32 GSSAPI_LIB_FUNCTION 120 gss_krb5_import_cred(OM_uint32 * /*minor*/,93 struct krb5_ccache_data * /*out*/); 94 95 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 96 gss_krb5_import_cred(OM_uint32 * /*minor*/, 121 97 struct krb5_ccache_data * /*in*/, 122 98 struct Principal * /*keytab_principal*/, 123 99 struct krb5_keytab_data * /*keytab*/, 124 gss_cred_id_t * /*out*/);125 126 OM_uint32 GSSAPI_LIB_FUNCTIONgss_krb5_get_tkt_flags127 (OM_uint32 * /*minor*/,100 gss_cred_id_t * /*out*/); 101 102 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_krb5_get_tkt_flags 103 (OM_uint32 * /*minor*/, 128 104 gss_ctx_id_t /*context_handle*/, 129 OM_uint32 * /*tkt_flags*/);130 131 OM_uint32 GSSAPI_LIB_FUNCTION 105 OM_uint32 * /*tkt_flags*/); 106 107 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 132 108 gsskrb5_extract_authz_data_from_sec_context 133 109 (OM_uint32 * /*minor_status*/, … … 136 112 gss_buffer_t /*ad_data*/); 137 113 138 OM_uint32 GSSAPI_LIB_FUNCTION 114 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 139 115 gsskrb5_set_dns_canonicalize(int); 140 116 … … 144 120 }; 145 121 146 OM_uint32 GSSAPI_LIB_FUNCTION 122 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 147 123 gsskrb5_set_send_to_kdc(struct gsskrb5_send_to_kdc *) 148 124 GSSKRB5_FUNCTION_DEPRECATED; 149 125 150 OM_uint32 GSSAPI_LIB_FUNCTION 126 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 151 127 gsskrb5_set_default_realm(const char *); 152 128 153 OM_uint32 GSSAPI_LIB_FUNCTION 129 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 154 130 gsskrb5_extract_authtime_from_sec_context(OM_uint32 *, gss_ctx_id_t, time_t *); 155 131 156 132 struct EncryptionKey; 157 133 158 OM_uint32 GSSAPI_LIB_FUNCTION 134 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 159 135 gsskrb5_extract_service_keyblock(OM_uint32 *minor_status, 160 136 gss_ctx_id_t context_handle, 161 137 struct EncryptionKey **out); 162 OM_uint32 GSSAPI_LIB_FUNCTION 138 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 163 139 gsskrb5_get_initiator_subkey(OM_uint32 *minor_status, 164 140 gss_ctx_id_t context_handle, 165 141 struct EncryptionKey **out); 166 OM_uint32 GSSAPI_LIB_FUNCTION 142 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 167 143 gsskrb5_get_subkey(OM_uint32 *minor_status, 168 144 gss_ctx_id_t context_handle, 169 145 struct EncryptionKey **out); 170 146 171 OM_uint32 GSSAPI_LIB_FUNCTION 147 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 172 148 gsskrb5_set_time_offset(int); 173 149 174 OM_uint32 GSSAPI_LIB_FUNCTION 150 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 175 151 gsskrb5_get_time_offset(int *); 176 152 … … 181 157 }; 182 158 183 OM_uint32 GSSAPI_LIB_FUNCTION 159 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 184 160 gsskrb5_plugin_register(struct gsskrb5_krb5_plugin *); 185 161 … … 227 203 */ 228 204 229 OM_uint32 GSSAPI_LIB_FUNCTION 205 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 230 206 gss_krb5_export_lucid_sec_context(OM_uint32 *minor_status, 231 207 gss_ctx_id_t *context_handle, … … 234 210 235 211 236 OM_uint32 GSSAPI_LIB_FUNCTION 212 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 237 213 gss_krb5_free_lucid_sec_context(OM_uint32 *minor_status, 238 214 void *kctx); 239 215 240 216 241 OM_uint32 GSSAPI_LIB_FUNCTION 217 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 242 218 gss_krb5_set_allowable_enctypes(OM_uint32 *minor_status, 243 219 gss_cred_id_t cred, -
trunk/server/source4/heimdal/lib/gssapi/gssapi/gssapi_spnego.h
r414 r745 47 47 * iso.org.dod.internet.security.mechanism.snego (1.3.6.1.5.5.2). 48 48 */ 49 extern GSSAPI_LIB_VARIABLE gss_OID GSS_SPNEGO_MECHANISM; 49 extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_spnego_mechanism_oid_desc; 50 #define GSS_SPNEGO_MECHANISM (&__gss_spnego_mechanism_oid_desc) 50 51 #define gss_mech_spnego GSS_SPNEGO_MECHANISM 51 52 -
trunk/server/source4/heimdal/lib/gssapi/gssapi_mech.h
r414 r745 32 32 #include <gssapi.h> 33 33 34 typedef OM_uint32 _gss_acquire_cred_t34 typedef OM_uint32 GSSAPI_CALLCONV _gss_acquire_cred_t 35 35 (OM_uint32 *, /* minor_status */ 36 36 const gss_name_t, /* desired_name */ … … 43 43 ); 44 44 45 typedef OM_uint32 _gss_release_cred_t45 typedef OM_uint32 GSSAPI_CALLCONV _gss_release_cred_t 46 46 (OM_uint32 *, /* minor_status */ 47 47 gss_cred_id_t * /* cred_handle */ 48 48 ); 49 49 50 typedef OM_uint32 _gss_init_sec_context_t50 typedef OM_uint32 GSSAPI_CALLCONV _gss_init_sec_context_t 51 51 (OM_uint32 *, /* minor_status */ 52 52 const gss_cred_id_t, /* initiator_cred_handle */ … … 65 65 ); 66 66 67 typedef OM_uint32 _gss_accept_sec_context_t67 typedef OM_uint32 GSSAPI_CALLCONV _gss_accept_sec_context_t 68 68 (OM_uint32 *, /* minor_status */ 69 69 gss_ctx_id_t *, /* context_handle */ … … 80 80 ); 81 81 82 typedef OM_uint32 _gss_process_context_token_t82 typedef OM_uint32 GSSAPI_CALLCONV _gss_process_context_token_t 83 83 (OM_uint32 *, /* minor_status */ 84 84 const gss_ctx_id_t, /* context_handle */ … … 86 86 ); 87 87 88 typedef OM_uint32 _gss_delete_sec_context_t88 typedef OM_uint32 GSSAPI_CALLCONV _gss_delete_sec_context_t 89 89 (OM_uint32 *, /* minor_status */ 90 90 gss_ctx_id_t *, /* context_handle */ … … 92 92 ); 93 93 94 typedef OM_uint32 _gss_context_time_t94 typedef OM_uint32 GSSAPI_CALLCONV _gss_context_time_t 95 95 (OM_uint32 *, /* minor_status */ 96 96 const gss_ctx_id_t, /* context_handle */ … … 98 98 ); 99 99 100 typedef OM_uint32 _gss_get_mic_t100 typedef OM_uint32 GSSAPI_CALLCONV _gss_get_mic_t 101 101 (OM_uint32 *, /* minor_status */ 102 102 const gss_ctx_id_t, /* context_handle */ … … 106 106 ); 107 107 108 typedef OM_uint32 _gss_verify_mic_t108 typedef OM_uint32 GSSAPI_CALLCONV _gss_verify_mic_t 109 109 (OM_uint32 *, /* minor_status */ 110 110 const gss_ctx_id_t, /* context_handle */ … … 114 114 ); 115 115 116 typedef OM_uint32 _gss_wrap_t116 typedef OM_uint32 GSSAPI_CALLCONV _gss_wrap_t 117 117 (OM_uint32 *, /* minor_status */ 118 118 const gss_ctx_id_t, /* context_handle */ … … 124 124 ); 125 125 126 typedef OM_uint32 _gss_unwrap_t126 typedef OM_uint32 GSSAPI_CALLCONV _gss_unwrap_t 127 127 (OM_uint32 *, /* minor_status */ 128 128 const gss_ctx_id_t, /* context_handle */ … … 133 133 ); 134 134 135 typedef OM_uint32 _gss_display_status_t135 typedef OM_uint32 GSSAPI_CALLCONV _gss_display_status_t 136 136 (OM_uint32 *, /* minor_status */ 137 137 OM_uint32, /* status_value */ … … 142 142 ); 143 143 144 typedef OM_uint32 _gss_indicate_mechs_t144 typedef OM_uint32 GSSAPI_CALLCONV _gss_indicate_mechs_t 145 145 (OM_uint32 *, /* minor_status */ 146 146 gss_OID_set * /* mech_set */ 147 147 ); 148 148 149 typedef OM_uint32 _gss_compare_name_t149 typedef OM_uint32 GSSAPI_CALLCONV _gss_compare_name_t 150 150 (OM_uint32 *, /* minor_status */ 151 151 const gss_name_t, /* name1 */ … … 154 154 ); 155 155 156 typedef OM_uint32 _gss_display_name_t156 typedef OM_uint32 GSSAPI_CALLCONV _gss_display_name_t 157 157 (OM_uint32 *, /* minor_status */ 158 158 const gss_name_t, /* input_name */ … … 161 161 ); 162 162 163 typedef OM_uint32 _gss_import_name_t163 typedef OM_uint32 GSSAPI_CALLCONV _gss_import_name_t 164 164 (OM_uint32 *, /* minor_status */ 165 165 const gss_buffer_t, /* input_name_buffer */ … … 168 168 ); 169 169 170 typedef OM_uint32 _gss_export_name_t170 typedef OM_uint32 GSSAPI_CALLCONV _gss_export_name_t 171 171 (OM_uint32 *, /* minor_status */ 172 172 const gss_name_t, /* input_name */ … … 174 174 ); 175 175 176 typedef OM_uint32 _gss_release_name_t176 typedef OM_uint32 GSSAPI_CALLCONV _gss_release_name_t 177 177 (OM_uint32 *, /* minor_status */ 178 178 gss_name_t * /* input_name */ 179 179 ); 180 180 181 typedef OM_uint32 _gss_inquire_cred_t181 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_t 182 182 (OM_uint32 *, /* minor_status */ 183 183 const gss_cred_id_t, /* cred_handle */ … … 188 188 ); 189 189 190 typedef OM_uint32 _gss_inquire_context_t190 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_context_t 191 191 (OM_uint32 *, /* minor_status */ 192 192 const gss_ctx_id_t, /* context_handle */ … … 200 200 ); 201 201 202 typedef OM_uint32 _gss_wrap_size_limit_t202 typedef OM_uint32 GSSAPI_CALLCONV _gss_wrap_size_limit_t 203 203 (OM_uint32 *, /* minor_status */ 204 204 const gss_ctx_id_t, /* context_handle */ … … 209 209 ); 210 210 211 typedef OM_uint32 _gss_add_cred_t (211 typedef OM_uint32 GSSAPI_CALLCONV _gss_add_cred_t ( 212 212 OM_uint32 *, /* minor_status */ 213 213 const gss_cred_id_t, /* input_cred_handle */ … … 223 223 ); 224 224 225 typedef OM_uint32 _gss_inquire_cred_by_mech_t (225 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_by_mech_t ( 226 226 OM_uint32 *, /* minor_status */ 227 227 const gss_cred_id_t, /* cred_handle */ … … 233 233 ); 234 234 235 typedef OM_uint32 _gss_export_sec_context_t (235 typedef OM_uint32 GSSAPI_CALLCONV _gss_export_sec_context_t ( 236 236 OM_uint32 *, /* minor_status */ 237 237 gss_ctx_id_t *, /* context_handle */ … … 239 239 ); 240 240 241 typedef OM_uint32 _gss_import_sec_context_t (241 typedef OM_uint32 GSSAPI_CALLCONV _gss_import_sec_context_t ( 242 242 OM_uint32 *, /* minor_status */ 243 243 const gss_buffer_t, /* interprocess_token */ … … 245 245 ); 246 246 247 typedef OM_uint32 _gss_inquire_names_for_mech_t (247 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_names_for_mech_t ( 248 248 OM_uint32 *, /* minor_status */ 249 249 const gss_OID, /* mechanism */ … … 251 251 ); 252 252 253 typedef OM_uint32 _gss_inquire_mechs_for_name_t (253 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_mechs_for_name_t ( 254 254 OM_uint32 *, /* minor_status */ 255 255 const gss_name_t, /* input_name */ … … 257 257 ); 258 258 259 typedef OM_uint32 _gss_canonicalize_name_t (259 typedef OM_uint32 GSSAPI_CALLCONV _gss_canonicalize_name_t ( 260 260 OM_uint32 *, /* minor_status */ 261 261 const gss_name_t, /* input_name */ … … 264 264 ); 265 265 266 typedef OM_uint32 _gss_duplicate_name_t (266 typedef OM_uint32 GSSAPI_CALLCONV _gss_duplicate_name_t ( 267 267 OM_uint32 *, /* minor_status */ 268 268 const gss_name_t, /* src_name */ … … 270 270 ); 271 271 272 typedef OM_uint32 _gss_inquire_sec_context_by_oid (272 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_sec_context_by_oid ( 273 273 OM_uint32 *minor_status, 274 274 const gss_ctx_id_t context_handle, … … 277 277 ); 278 278 279 typedef OM_uint32 _gss_inquire_cred_by_oid (279 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_by_oid ( 280 280 OM_uint32 *minor_status, 281 281 const gss_cred_id_t cred, … … 284 284 ); 285 285 286 typedef OM_uint32 _gss_set_sec_context_option (286 typedef OM_uint32 GSSAPI_CALLCONV _gss_set_sec_context_option ( 287 287 OM_uint32 *minor_status, 288 288 gss_ctx_id_t *cred_handle, … … 291 291 ); 292 292 293 typedef OM_uint32 _gss_set_cred_option (293 typedef OM_uint32 GSSAPI_CALLCONV _gss_set_cred_option ( 294 294 OM_uint32 *minor_status, 295 295 gss_cred_id_t *cred_handle, … … 299 299 300 300 301 typedef OM_uint32 _gss_pseudo_random(301 typedef OM_uint32 GSSAPI_CALLCONV _gss_pseudo_random( 302 302 OM_uint32 *minor_status, 303 303 gss_ctx_id_t context, … … 308 308 ); 309 309 310 typedef OM_uint32 310 typedef OM_uint32 GSSAPI_CALLCONV 311 311 _gss_wrap_iov_t(OM_uint32 *minor_status, 312 312 gss_ctx_id_t context_handle, … … 317 317 int iov_count); 318 318 319 typedef OM_uint32 319 typedef OM_uint32 GSSAPI_CALLCONV 320 320 _gss_unwrap_iov_t(OM_uint32 *minor_status, 321 321 gss_ctx_id_t context_handle, … … 325 325 int iov_count); 326 326 327 typedef OM_uint32 327 typedef OM_uint32 GSSAPI_CALLCONV 328 328 _gss_wrap_iov_length_t(OM_uint32 * minor_status, 329 329 gss_ctx_id_t context_handle, … … 334 334 int iov_count); 335 335 336 typedef OM_uint32 336 typedef OM_uint32 GSSAPI_CALLCONV 337 337 _gss_store_cred_t(OM_uint32 *minor_status, 338 338 gss_cred_id_t input_cred_handle, … … 344 344 gss_cred_usage_t *cred_usage_stored); 345 345 346 typedef OM_uint32 346 typedef OM_uint32 GSSAPI_CALLCONV 347 347 _gss_export_cred_t(OM_uint32 *minor_status, 348 348 gss_cred_id_t cred_handle, 349 349 gss_buffer_t cred_token); 350 350 351 typedef OM_uint32 351 typedef OM_uint32 GSSAPI_CALLCONV 352 352 _gss_import_cred_t(OM_uint32 * minor_status, 353 353 gss_buffer_t cred_token, … … 355 355 356 356 357 #define GMI_VERSION 2 357 typedef OM_uint32 GSSAPI_CALLCONV 358 _gss_acquire_cred_ex_t(void * /* status */, 359 const gss_name_t /* desired_name */, 360 OM_uint32 /* flags */, 361 OM_uint32 /* time_req */, 362 gss_cred_usage_t /* cred_usage */, 363 void * /* identity */, 364 void * /* ctx */, 365 void (* /*complete */)(void *, OM_uint32, void *, gss_cred_id_t, OM_uint32)); 366 367 typedef void GSSAPI_CALLCONV 368 _gss_iter_creds_t(OM_uint32 /* flags */, 369 void * /* userctx */, 370 void (* /*cred_iter */ )(void *, gss_OID, gss_cred_id_t)); 371 372 typedef OM_uint32 GSSAPI_CALLCONV 373 _gss_destroy_cred_t(OM_uint32 * /* minor_status */, 374 gss_cred_id_t * /* cred */); 375 376 typedef OM_uint32 GSSAPI_CALLCONV 377 _gss_cred_hold_t(OM_uint32 * /* minor_status */, 378 gss_cred_id_t /* cred */); 379 380 typedef OM_uint32 GSSAPI_CALLCONV 381 _gss_cred_unhold_t(OM_uint32 * /* minor_status */, 382 gss_cred_id_t /* cred */); 383 384 typedef OM_uint32 GSSAPI_CALLCONV 385 _gss_cred_label_set_t(OM_uint32 * /* minor_status */, 386 gss_cred_id_t /* cred */, 387 const char * /* label */, 388 gss_buffer_t /* value */); 389 390 typedef OM_uint32 GSSAPI_CALLCONV 391 _gss_cred_label_get_t(OM_uint32 * /* minor_status */, 392 gss_cred_id_t /* cred */, 393 const char * /* label */, 394 gss_buffer_t /* value */); 395 396 typedef OM_uint32 GSSAPI_CALLCONV _gss_display_name_ext_t ( 397 OM_uint32 *, /* minor_status */ 398 gss_name_t, /* name */ 399 gss_OID, /* display_as_name_type */ 400 gss_buffer_t /* display_name */ 401 ); 402 403 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_name_t ( 404 OM_uint32 *, /* minor_status */ 405 gss_name_t, /* name */ 406 int *, /* name_is_MN */ 407 gss_OID *, /* MN_mech */ 408 gss_buffer_set_t * /* attrs */ 409 ); 410 411 typedef OM_uint32 GSSAPI_CALLCONV _gss_get_name_attribute_t ( 412 OM_uint32 *, /* minor_status */ 413 gss_name_t, /* name */ 414 gss_buffer_t, /* attr */ 415 int *, /* authenticated */ 416 int *, /* complete */ 417 gss_buffer_t, /* value */ 418 gss_buffer_t, /* display_value */ 419 int * /* more */ 420 ); 421 422 typedef OM_uint32 GSSAPI_CALLCONV _gss_set_name_attribute_t ( 423 OM_uint32 *, /* minor_status */ 424 gss_name_t, /* name */ 425 int, /* complete */ 426 gss_buffer_t, /* attr */ 427 gss_buffer_t /* value */ 428 ); 429 430 typedef OM_uint32 GSSAPI_CALLCONV _gss_delete_name_attribute_t ( 431 OM_uint32 *, /* minor_status */ 432 gss_name_t, /* name */ 433 gss_buffer_t /* attr */ 434 ); 435 436 typedef OM_uint32 GSSAPI_CALLCONV _gss_export_name_composite_t ( 437 OM_uint32 *, /* minor_status */ 438 gss_name_t, /* name */ 439 gss_buffer_t /* exp_composite_name */ 440 ); 441 442 /* 443 * 444 */ 445 446 typedef struct gss_mo_desc_struct gss_mo_desc; 447 448 typedef OM_uint32 GSSAPI_CALLCONV 449 _gss_mo_init (OM_uint32 *, gss_OID, gss_mo_desc **, size_t *); 450 451 452 struct gss_mo_desc_struct { 453 gss_OID option; 454 OM_uint32 flags; 455 #define GSS_MO_MA 1 456 #define GSS_MO_MA_CRITICAL 2 457 const char *name; 458 void *ctx; 459 int (*get)(gss_const_OID, gss_mo_desc *, gss_buffer_t); 460 int (*set)(gss_const_OID, gss_mo_desc *, int, gss_buffer_t); 461 }; 462 463 464 #define GMI_VERSION 5 465 466 /* gm_flags */ 467 #define GM_USE_MG_CRED 1 /* uses mech glue credentials */ 468 358 469 359 470 typedef struct gssapi_mech_interface_desc { … … 361 472 const char *gm_name; 362 473 gss_OID_desc gm_mech_oid; 474 unsigned gm_flags; 363 475 _gss_acquire_cred_t *gm_acquire_cred; 364 476 _gss_release_cred_t *gm_release_cred; … … 401 513 _gss_export_cred_t *gm_export_cred; 402 514 _gss_import_cred_t *gm_import_cred; 515 _gss_acquire_cred_ex_t *gm_acquire_cred_ex; 516 _gss_iter_creds_t *gm_iter_creds; 517 _gss_destroy_cred_t *gm_destroy_cred; 518 _gss_cred_hold_t *gm_cred_hold; 519 _gss_cred_unhold_t *gm_cred_unhold; 520 _gss_cred_label_get_t *gm_cred_label_get; 521 _gss_cred_label_set_t *gm_cred_label_set; 522 gss_mo_desc *gm_mo; 523 size_t gm_mo_num; 524 _gss_display_name_ext_t *gm_display_name_ext; 525 _gss_inquire_name_t *gm_inquire_name; 526 _gss_get_name_attribute_t *gm_get_name_attribute; 527 _gss_set_name_attribute_t *gm_set_name_attribute; 528 _gss_delete_name_attribute_t *gm_delete_name_attribute; 529 _gss_export_name_composite_t *gm_export_name_composite; 403 530 } gssapi_mech_interface_desc, *gssapi_mech_interface; 404 531 405 532 gssapi_mech_interface 406 __gss_get_mechanism(gss_ OID /* oid */);533 __gss_get_mechanism(gss_const_OID /* oid */); 407 534 408 535 gssapi_mech_interface __gss_spnego_initialize(void); … … 412 539 void gss_mg_collect_error(gss_OID, OM_uint32, OM_uint32); 413 540 541 int _gss_mo_get_option_1(gss_const_OID, gss_mo_desc *, gss_buffer_t); 542 int _gss_mo_get_option_0(gss_const_OID, gss_mo_desc *, gss_buffer_t); 543 int _gss_mo_get_ctx_as_string(gss_const_OID, gss_mo_desc *, gss_buffer_t); 544 545 struct _gss_oid_name_table { 546 gss_OID oid; 547 const char *name; 548 const char *short_desc; 549 const char *long_desc; 550 }; 551 552 extern struct _gss_oid_name_table _gss_ont_mech[]; 553 extern struct _gss_oid_name_table _gss_ont_ma[]; 554 414 555 #endif /* GSSAPI_MECH_H */ -
trunk/server/source4/heimdal/lib/gssapi/krb5/8003.c
r414 r745 75 75 { 76 76 u_char num[4]; 77 MD5_CTX md5; 78 79 MD5_Init(&md5); 77 EVP_MD_CTX *ctx; 78 79 ctx = EVP_MD_CTX_create(); 80 EVP_DigestInit_ex(ctx, EVP_md5(), NULL); 81 80 82 _gsskrb5_encode_om_uint32 (b->initiator_addrtype, num); 81 MD5_Update (&md5, num, sizeof(num));83 EVP_DigestUpdate(ctx, num, sizeof(num)); 82 84 _gsskrb5_encode_om_uint32 (b->initiator_address.length, num); 83 MD5_Update (&md5, num, sizeof(num));85 EVP_DigestUpdate(ctx, num, sizeof(num)); 84 86 if (b->initiator_address.length) 85 MD5_Update (&md5,86 b->initiator_address.value,87 b->initiator_address.length);87 EVP_DigestUpdate(ctx, 88 b->initiator_address.value, 89 b->initiator_address.length); 88 90 _gsskrb5_encode_om_uint32 (b->acceptor_addrtype, num); 89 MD5_Update (&md5, num, sizeof(num));91 EVP_DigestUpdate(ctx, num, sizeof(num)); 90 92 _gsskrb5_encode_om_uint32 (b->acceptor_address.length, num); 91 MD5_Update (&md5, num, sizeof(num));93 EVP_DigestUpdate(ctx, num, sizeof(num)); 92 94 if (b->acceptor_address.length) 93 MD5_Update (&md5,94 b->acceptor_address.value,95 b->acceptor_address.length);95 EVP_DigestUpdate(ctx, 96 b->acceptor_address.value, 97 b->acceptor_address.length); 96 98 _gsskrb5_encode_om_uint32 (b->application_data.length, num); 97 MD5_Update (&md5, num, sizeof(num));99 EVP_DigestUpdate(ctx, num, sizeof(num)); 98 100 if (b->application_data.length) 99 MD5_Update (&md5, 100 b->application_data.value, 101 b->application_data.length); 102 MD5_Final (p, &md5); 101 EVP_DigestUpdate(ctx, 102 b->application_data.value, 103 b->application_data.length); 104 EVP_DigestFinal_ex(ctx, p, NULL); 105 EVP_MD_CTX_destroy(ctx); 106 103 107 return 0; 104 108 } … … 179 183 static unsigned char zeros[16]; 180 184 181 if (cksum == NULL) {182 *minor_status = 0;183 return GSS_S_BAD_BINDINGS;184 }185 186 185 /* XXX should handle checksums > 24 bytes */ 187 186 if(cksum->cksumtype != CKSUMTYPE_GSSAPI || cksum->checksum.length < 24) { … … 205 204 return GSS_S_BAD_BINDINGS; 206 205 } 207 if( memcmp(hash, p, sizeof(hash)) != 0) {206 if(ct_memcmp(hash, p, sizeof(hash)) != 0) { 208 207 *minor_status = 0; 209 208 return GSS_S_BAD_BINDINGS; -
trunk/server/source4/heimdal/lib/gssapi/krb5/accept_sec_context.c
r414 r745 56 56 ret = krb5_kt_default(context, &_gsskrb5_keytab); 57 57 } else { 58 char *p ;59 60 asprintf(&p, "FILE:%s", identity);61 if( p == NULL) {58 char *p = NULL; 59 60 ret = asprintf(&p, "FILE:%s", identity); 61 if(ret < 0 || p == NULL) { 62 62 HEIMDAL_MUTEX_unlock(&gssapi_keytab_mutex); 63 63 return GSS_S_FAILURE; … … 100 100 case ETYPE_DES_CBC_MD5: 101 101 case ETYPE_DES3_CBC_MD5: 102 case ETYPE_OLD_DES3_CBC_SHA1: 102 103 case ETYPE_DES3_CBC_SHA1: 103 104 case ETYPE_ARCFOUR_HMAC_MD5: … … 208 209 int is_cfx = 0; 209 210 210 krb5_auth_ getremoteseqnumber (context,211 ctx->auth_context,212 &seq_number);211 krb5_auth_con_getremoteseqnumber (context, 212 ctx->auth_context, 213 &seq_number); 213 214 214 215 _gsskrb5i_is_cfx(context, ctx, 1); … … 264 265 krb5_error_code ret; 265 266 krb5_data outbuf; 267 /* this e_data value encodes KERB_AP_ERR_TYPE_SKEW_RECOVERY which 268 tells windows to try again with the corrected timestamp. See 269 [MS-KILE] 2.2.1 KERB-ERROR-DATA */ 270 krb5_data e_data = { 7, rk_UNCONST("\x30\x05\xa1\x03\x02\x01\x02") }; 266 271 267 272 /* build server from request if the acceptor had not selected one */ … … 286 291 } 287 292 288 ret = krb5_mk_error(context, kret, NULL, NULL, NULL,293 ret = krb5_mk_error(context, kret, NULL, &e_data, NULL, 289 294 server, NULL, NULL, &outbuf); 290 295 if (ap_req_server) … … 463 468 * We need to get the flags out of the 8003 checksum. 464 469 */ 470 465 471 { 466 472 krb5_authenticator authenticator; … … 473 479 *minor_status = kret; 474 480 return ret; 481 } 482 483 if (authenticator->cksum == NULL) { 484 krb5_free_authenticator(context, &authenticator); 485 *minor_status = 0; 486 return GSS_S_BAD_BINDINGS; 475 487 } 476 488 … … 670 682 } 671 683 672 kret = krb5_auth_ getremoteseqnumber(context,673 674 684 kret = krb5_auth_con_getremoteseqnumber(context, 685 ctx->auth_context, 686 &r_seq_number); 675 687 if (kret) { 676 688 *minor_status = kret; … … 750 762 int32_t tmp_r_seq_number, tmp_l_seq_number; 751 763 752 kret = krb5_auth_ getremoteseqnumber(context,753 754 764 kret = krb5_auth_con_getremoteseqnumber(context, 765 ctx->auth_context, 766 &tmp_r_seq_number); 755 767 if (kret) { 756 768 *minor_status = kret; … … 794 806 795 807 796 OM_uint32 808 OM_uint32 GSSAPI_CALLCONV 797 809 _gsskrb5_accept_sec_context(OM_uint32 * minor_status, 798 810 gss_ctx_id_t * context_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/acquire_cred.c
r414 r745 41 41 OM_uint32 *lifetime) 42 42 { 43 krb5_creds in_cred, *out_cred;43 krb5_creds in_cred, out_cred; 44 44 krb5_const_realm realm; 45 45 krb5_error_code kret; … … 62 62 } 63 63 64 kret = krb5_get_credentials(context, 0, 65 id, &in_cred, &out_cred); 64 kret = krb5_cc_retrieve_cred(context, id, 0, &in_cred, &out_cred); 66 65 krb5_free_principal(context, in_cred.server); 67 66 if (kret) { 68 *minor_status = kret; 69 return GSS_S_FAILURE; 70 } 71 72 *lifetime = out_cred->times.endtime; 73 krb5_free_creds(context, out_cred); 67 *minor_status = 0; 68 *lifetime = 0; 69 return GSS_S_COMPLETE; 70 } 71 72 *lifetime = out_cred.times.endtime; 73 krb5_free_cred_contents(context, &out_cred); 74 74 75 75 return GSS_S_COMPLETE; … … 289 289 } 290 290 291 OM_uint32 _gsskrb5_acquire_cred291 OM_uint32 GSSAPI_CALLCONV _gsskrb5_acquire_cred 292 292 (OM_uint32 * minor_status, 293 293 const gss_name_t desired_name, … … 340 340 if (desired_name != GSS_C_NO_NAME) { 341 341 342 ret = _gsskrb5_canon_name(minor_status, context, 0, NULL,342 ret = _gsskrb5_canon_name(minor_status, context, 1, NULL, 343 343 desired_name, &handle->principal); 344 344 if (ret) { -
trunk/server/source4/heimdal/lib/gssapi/krb5/add_cred.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_add_cred (36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_add_cred ( 37 37 OM_uint32 *minor_status, 38 38 const gss_cred_id_t input_cred_handle, … … 156 156 if (cred->ccache) { 157 157 const char *type, *name; 158 char *type_name ;158 char *type_name = NULL; 159 159 160 160 ret = GSS_S_FAILURE; … … 188 188 } 189 189 190 asprintf(&type_name, "%s:%s", type, name);191 if ( type_name == NULL) {190 kret = asprintf(&type_name, "%s:%s", type, name); 191 if (kret < 0 || type_name == NULL) { 192 192 *minor_status = ENOMEM; 193 193 goto failure; -
trunk/server/source4/heimdal/lib/gssapi/krb5/aeap.c
r414 r745 36 36 #include <roken.h> 37 37 38 OM_uint32 GSSAPI_ LIB_FUNCTION38 OM_uint32 GSSAPI_CALLCONV 39 39 _gk_wrap_iov(OM_uint32 * minor_status, 40 40 gss_ctx_id_t context_handle, … … 58 58 } 59 59 60 OM_uint32 GSSAPI_ LIB_FUNCTION60 OM_uint32 GSSAPI_CALLCONV 61 61 _gk_unwrap_iov(OM_uint32 *minor_status, 62 62 gss_ctx_id_t context_handle, … … 78 78 } 79 79 80 OM_uint32 GSSAPI_LIB_FUNCTION80 OM_uint32 GSSAPI_CALLCONV 81 81 _gk_wrap_iov_length(OM_uint32 * minor_status, 82 82 gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/arcfour.c
r414 r745 174 174 size_t len, total_len; 175 175 u_char k6_data[16], *p0, *p; 176 RC4_KEYrc4_key;176 EVP_CIPHER_CTX rc4_key; 177 177 178 178 _gsskrb5_encap_length (22, &len, &total_len, GSS_KRB5_MECHANISM); … … 236 236 memset (p + 4, (context_handle->more_flags & LOCAL) ? 0 : 0xff, 4); 237 237 238 RC4_set_key (&rc4_key, sizeof(k6_data), k6_data); 239 RC4 (&rc4_key, 8, p, p); 240 241 memset(&rc4_key, 0, sizeof(rc4_key)); 238 EVP_CIPHER_CTX_init(&rc4_key); 239 EVP_CipherInit_ex(&rc4_key, EVP_rc4(), NULL, k6_data, NULL, 1); 240 EVP_Cipher(&rc4_key, p, p, 8); 241 EVP_CIPHER_CTX_cleanup(&rc4_key); 242 242 243 memset(k6_data, 0, sizeof(k6_data)); 243 244 … … 301 302 } 302 303 303 cmp = memcmp(cksum_data, p + 8, 8);304 cmp = ct_memcmp(cksum_data, p + 8, 8); 304 305 if (cmp) { 305 306 *minor_status = 0; … … 308 309 309 310 { 310 RC4_KEYrc4_key;311 EVP_CIPHER_CTX rc4_key; 311 312 312 RC4_set_key (&rc4_key, sizeof(k6_data), (void*)k6_data); 313 RC4 (&rc4_key, 8, p, SND_SEQ); 314 315 memset(&rc4_key, 0, sizeof(rc4_key)); 313 EVP_CIPHER_CTX_init(&rc4_key); 314 EVP_CipherInit_ex(&rc4_key, EVP_rc4(), NULL, (void *)k6_data, NULL, 0); 315 EVP_Cipher(&rc4_key, SND_SEQ, p, 8); 316 EVP_CIPHER_CTX_cleanup(&rc4_key); 317 316 318 memset(k6_data, 0, sizeof(k6_data)); 317 319 } … … 460 462 461 463 if(conf_req_flag) { 462 RC4_KEYrc4_key;463 464 RC4_set_key (&rc4_key, sizeof(k6_data), (void *)k6_data);465 /* XXX ? */466 RC4 (&rc4_key, 8 + datalen, p0 + 24, p0 + 24); /* Confounder + data */467 memset(&rc4_key, 0, sizeof(rc4_key));464 EVP_CIPHER_CTX rc4_key; 465 466 EVP_CIPHER_CTX_init(&rc4_key); 467 EVP_CipherInit_ex(&rc4_key, EVP_rc4(), NULL, k6_data, NULL, 1); 468 EVP_Cipher(&rc4_key, p0 + 24, p0 + 24, 8 + datalen); 469 EVP_CIPHER_CTX_cleanup(&rc4_key); 468 470 } 469 471 memset(k6_data, 0, sizeof(k6_data)); … … 479 481 480 482 { 481 RC4_KEYrc4_key;483 EVP_CIPHER_CTX rc4_key; 482 484 483 RC4_set_key (&rc4_key, sizeof(k6_data), k6_data); 484 RC4 (&rc4_key, 8, p0 + 8, p0 + 8); /* SND_SEQ */ 485 memset(&rc4_key, 0, sizeof(rc4_key)); 485 EVP_CIPHER_CTX_init(&rc4_key); 486 EVP_CipherInit_ex(&rc4_key, EVP_rc4(), NULL, k6_data, NULL, 1); 487 EVP_Cipher(&rc4_key, p0 + 8, p0 + 8 /* SND_SEQ */, 8); 488 EVP_CIPHER_CTX_cleanup(&rc4_key); 486 489 memset(k6_data, 0, sizeof(k6_data)); 487 490 } … … 578 581 579 582 { 580 RC4_KEYrc4_key;583 EVP_CIPHER_CTX rc4_key; 581 584 582 RC4_set_key (&rc4_key, sizeof(k6_data), k6_data); 583 RC4 (&rc4_key, 8, p0 + 8, SND_SEQ); /* SND_SEQ */ 584 memset(&rc4_key, 0, sizeof(rc4_key)); 585 EVP_CIPHER_CTX_init(&rc4_key); 586 EVP_CipherInit_ex(&rc4_key, EVP_rc4(), NULL, k6_data, NULL, 1); 587 EVP_Cipher(&rc4_key, SND_SEQ, p0 + 8, 8); 588 EVP_CIPHER_CTX_cleanup(&rc4_key); 585 589 memset(k6_data, 0, sizeof(k6_data)); 586 590 } … … 625 629 626 630 if(conf_flag) { 627 RC4_KEYrc4_key;628 629 RC4_set_key (&rc4_key, sizeof(k6_data), k6_data);630 RC4 (&rc4_key, 8, p0 + 24, Confounder); /* Confounder */631 RC4 (&rc4_key, datalen, p0 + GSS_ARCFOUR_WRAP_TOKEN_SIZE,632 output_message_buffer->value);633 memset(&rc4_key, 0, sizeof(rc4_key));631 EVP_CIPHER_CTX rc4_key; 632 633 EVP_CIPHER_CTX_init(&rc4_key); 634 EVP_CipherInit_ex(&rc4_key, EVP_rc4(), NULL, k6_data, NULL, 1); 635 EVP_Cipher(&rc4_key, Confounder, p0 + 24, 8); 636 EVP_Cipher(&rc4_key, output_message_buffer->value, p0 + GSS_ARCFOUR_WRAP_TOKEN_SIZE, datalen); 637 EVP_CIPHER_CTX_cleanup(&rc4_key); 634 638 } else { 635 639 memcpy(Confounder, p0 + 24, 8); /* Confounder */ … … 663 667 } 664 668 665 cmp = memcmp(cksum_data, p0 + 16, 8); /* SGN_CKSUM */669 cmp = ct_memcmp(cksum_data, p0 + 16, 8); /* SGN_CKSUM */ 666 670 if (cmp) { 667 671 _gsskrb5_release_buffer(minor_status, output_message_buffer); -
trunk/server/source4/heimdal/lib/gssapi/krb5/canonicalize_name.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_canonicalize_name (36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_canonicalize_name ( 37 37 OM_uint32 * minor_status, 38 38 const gss_name_t input_name, -
trunk/server/source4/heimdal/lib/gssapi/krb5/cfx.c
r414 r745 214 214 } 215 215 216 staticOM_uint32217 allocate_buffer(OM_uint32 *minor_status, gss_iov_buffer_desc *buffer, size_t size)216 OM_uint32 217 _gk_allocate_buffer(OM_uint32 *minor_status, gss_iov_buffer_desc *buffer, size_t size) 218 218 { 219 if (buffer->type & GSS_IOV_BUFFER_ TYPE_FLAG_ALLOCATED) {219 if (buffer->type & GSS_IOV_BUFFER_FLAG_ALLOCATED) { 220 220 if (buffer->buffer.length == size) 221 221 return GSS_S_COMPLETE; … … 229 229 return GSS_S_FAILURE; 230 230 } 231 buffer->type |= GSS_IOV_BUFFER_ TYPE_FLAG_ALLOCATED;231 buffer->type |= GSS_IOV_BUFFER_FLAG_ALLOCATED; 232 232 233 233 return GSS_S_COMPLETE; … … 235 235 236 236 237 OM_uint32 238 _gk_verify_buffers(OM_uint32 *minor_status, 239 const gsskrb5_ctx ctx, 240 const gss_iov_buffer_desc *header, 241 const gss_iov_buffer_desc *padding, 242 const gss_iov_buffer_desc *trailer) 243 { 244 if (header == NULL) { 245 *minor_status = EINVAL; 246 return GSS_S_FAILURE; 247 } 248 249 if (IS_DCE_STYLE(ctx)) { 250 /* 251 * In DCE style mode we reject having a padding or trailer buffer 252 */ 253 if (padding) { 254 *minor_status = EINVAL; 255 return GSS_S_FAILURE; 256 } 257 if (trailer) { 258 *minor_status = EINVAL; 259 return GSS_S_FAILURE; 260 } 261 } else { 262 /* 263 * In non-DCE style mode we require having a padding buffer 264 */ 265 if (padding == NULL) { 266 *minor_status = EINVAL; 267 return GSS_S_FAILURE; 268 } 269 } 270 271 *minor_status = 0; 272 return GSS_S_COMPLETE; 273 } 237 274 238 275 OM_uint32 … … 249 286 size_t gsshsize, k5hsize; 250 287 size_t gsstsize, k5tsize; 251 size_t i, padlength,rrc = 0, ec = 0;288 size_t i, rrc = 0, ec = 0; 252 289 gss_cfx_wrap_token token; 253 290 krb5_error_code ret; … … 255 292 unsigned usage; 256 293 krb5_crypto_iov *data = NULL; 257 int paddingoffset = 0; 258 294 259 295 header = _gk_find_buffer(iov, iov_count, GSS_IOV_BUFFER_TYPE_HEADER); 260 296 if (header == NULL) { … … 263 299 } 264 300 265 krb5_crypto_length(context, ctx->crypto, KRB5_CRYPTO_TYPE_PADDING, &padlength);266 267 301 padding = _gk_find_buffer(iov, iov_count, GSS_IOV_BUFFER_TYPE_PADDING); 268 if (padlength != 0 && padding == NULL) { 269 *minor_status = EINVAL; 270 return GSS_S_FAILURE; 302 if (padding != NULL) { 303 padding->buffer.length = 0; 271 304 } 272 305 273 306 trailer = _gk_find_buffer(iov, iov_count, GSS_IOV_BUFFER_TYPE_TRAILER); 274 307 308 major_status = _gk_verify_buffers(minor_status, ctx, header, padding, trailer); 309 if (major_status != GSS_S_COMPLETE) { 310 return major_status; 311 } 312 275 313 if (conf_req_flag) { 276 ec = padlength; 277 278 krb5_crypto_length(context, ctx->crypto, KRB5_CRYPTO_TYPE_TRAILER, &k5tsize); 279 krb5_crypto_length(context, ctx->crypto, KRB5_CRYPTO_TYPE_HEADER, &k5hsize); 280 281 gsshsize = k5hsize + sizeof(*token); 282 gsstsize = k5tsize + sizeof(*token); /* encrypted token stored in trailer */ 283 284 } else { 285 286 krb5_crypto_length(context, ctx->crypto, KRB5_CRYPTO_TYPE_CHECKSUM, &k5tsize); 287 288 gsshsize = sizeof(*token); 314 size_t k5psize = 0; 315 size_t k5pbase = 0; 316 size_t k5bsize = 0; 317 size_t size = 0; 318 319 for (i = 0; i < iov_count; i++) { 320 switch (GSS_IOV_BUFFER_TYPE(iov[i].type)) { 321 case GSS_IOV_BUFFER_TYPE_DATA: 322 size += iov[i].buffer.length; 323 break; 324 default: 325 break; 326 } 327 } 328 329 size += sizeof(gss_cfx_wrap_token_desc); 330 331 *minor_status = krb5_crypto_length(context, ctx->crypto, 332 KRB5_CRYPTO_TYPE_HEADER, 333 &k5hsize); 334 if (*minor_status) 335 return GSS_S_FAILURE; 336 337 *minor_status = krb5_crypto_length(context, ctx->crypto, 338 KRB5_CRYPTO_TYPE_TRAILER, 339 &k5tsize); 340 if (*minor_status) 341 return GSS_S_FAILURE; 342 343 *minor_status = krb5_crypto_length(context, ctx->crypto, 344 KRB5_CRYPTO_TYPE_PADDING, 345 &k5pbase); 346 if (*minor_status) 347 return GSS_S_FAILURE; 348 349 if (k5pbase > 1) { 350 k5psize = k5pbase - (size % k5pbase); 351 } else { 352 k5psize = 0; 353 } 354 355 if (k5psize == 0 && IS_DCE_STYLE(ctx)) { 356 *minor_status = krb5_crypto_getblocksize(context, ctx->crypto, 357 &k5bsize); 358 if (*minor_status) 359 return GSS_S_FAILURE; 360 ec = k5bsize; 361 } else { 362 ec = k5psize; 363 } 364 365 gsshsize = sizeof(gss_cfx_wrap_token_desc) + k5hsize; 366 gsstsize = sizeof(gss_cfx_wrap_token_desc) + ec + k5tsize; 367 } else { 368 if (IS_DCE_STYLE(ctx)) { 369 *minor_status = EINVAL; 370 return GSS_S_FAILURE; 371 } 372 373 k5hsize = 0; 374 *minor_status = krb5_crypto_length(context, ctx->crypto, 375 KRB5_CRYPTO_TYPE_CHECKSUM, 376 &k5tsize); 377 if (*minor_status) 378 return GSS_S_FAILURE; 379 380 gsshsize = sizeof(gss_cfx_wrap_token_desc); 289 381 gsstsize = k5tsize; 290 382 } … … 295 387 296 388 if (trailer == NULL) { 297 /* conf_req_flag=0 doesn't support DCE_STYLE */298 if (conf_req_flag == 0) {299 *minor_status = EINVAL;300 major_status = GSS_S_FAILURE;301 goto failure;302 }303 389 rrc = gsstsize; 304 390 if (IS_DCE_STYLE(ctx)) … … 306 392 gsshsize += gsstsize; 307 393 gsstsize = 0; 308 } else if (GSS_IOV_BUFFER_FLAGS(trailer->type) & GSS_IOV_BUFFER_ TYPE_FLAG_ALLOCATE) {309 major_status = allocate_buffer(minor_status, trailer, gsstsize);394 } else if (GSS_IOV_BUFFER_FLAGS(trailer->type) & GSS_IOV_BUFFER_FLAG_ALLOCATE) { 395 major_status = _gk_allocate_buffer(minor_status, trailer, gsstsize); 310 396 if (major_status) 311 397 goto failure; … … 321 407 */ 322 408 323 if (GSS_IOV_BUFFER_FLAGS(header->type) & GSS_IOV_BUFFER_ TYPE_FLAG_ALLOCATE) {324 major_status = allocate_buffer(minor_status, header, gsshsize);409 if (GSS_IOV_BUFFER_FLAGS(header->type) & GSS_IOV_BUFFER_FLAG_ALLOCATE) { 410 major_status = _gk_allocate_buffer(minor_status, header, gsshsize); 325 411 if (major_status != GSS_S_COMPLETE) 326 412 goto failure; … … 353 439 */ 354 440 token->Flags |= CFXSealed; 355 token->EC[0] = ( padlength>> 8) & 0xFF;356 token->EC[1] = ( padlength>> 0) & 0xFF;441 token->EC[0] = (ec >> 8) & 0xFF; 442 token->EC[1] = (ec >> 0) & 0xFF; 357 443 358 444 } else { … … 405 491 plain packet: 406 492 407 {"header" | encrypt(plaintext-data | padding | E"header")}493 {"header" | encrypt(plaintext-data | ec-padding | E"header")} 408 494 409 495 Expanded, this is with with RRC = 0: 410 496 411 {"header" | krb5-header | plaintext-data | padding | E"header" | krb5-trailer }412 413 In DCE-RPC mode == no trailer: RRC = gss "trailer" == length( padding | E"header" | krb5-trailer)414 415 {"header" | padding | E"header" | krb5-trailer | krb5-header | plaintext-data }497 {"header" | krb5-header | plaintext-data | ec-padding | E"header" | krb5-trailer } 498 499 In DCE-RPC mode == no trailer: RRC = gss "trailer" == length(ec-padding | E"header" | krb5-trailer) 500 501 {"header" | ec-padding | E"header" | krb5-trailer | krb5-header | plaintext-data } 416 502 */ 417 503 … … 425 511 case GSS_IOV_BUFFER_TYPE_DATA: 426 512 data[i].flags = KRB5_CRYPTO_TYPE_DATA; 427 break;428 case GSS_IOV_BUFFER_TYPE_PADDING:429 data[i].flags = KRB5_CRYPTO_TYPE_PADDING;430 paddingoffset = i;431 513 break; 432 514 case GSS_IOV_BUFFER_TYPE_SIGN_ONLY: … … 447 529 */ 448 530 449 /* XXX KRB5_CRYPTO_TYPE_PADDING */450 451 531 /* encrypted CFX header in trailer (or after the header if in 452 532 DCE mode). Copy in header into E"header" … … 456 536 data[i].data.data = trailer->buffer.value; 457 537 else 458 data[i].data.data = ((uint8_t *)header->buffer.value) + header->buffer.length - k5hsize - k5tsize - sizeof(*token); 459 460 data[i].data.length = sizeof(*token); 461 memcpy(data[i].data.data, token, sizeof(*token)); 538 data[i].data.data = ((uint8_t *)header->buffer.value) + sizeof(*token); 539 540 data[i].data.length = ec + sizeof(*token); 541 memset(data[i].data.data, 0xFF, ec); 542 memcpy(((uint8_t *)data[i].data.data) + ec, token, sizeof(*token)); 462 543 i++; 463 544 464 545 /* Kerberos trailer comes after the gss trailer */ 465 546 data[i].flags = KRB5_CRYPTO_TYPE_TRAILER; 466 data[i].data.data = ((uint8_t *)data[i-1].data.data) + sizeof(*token);547 data[i].data.data = ((uint8_t *)data[i-1].data.data) + ec + sizeof(*token); 467 548 data[i].data.length = k5tsize; 468 549 i++; … … 480 561 } 481 562 482 if (paddingoffset)483 padding->buffer.length = data[paddingoffset].data.length;484 485 563 } else { 486 564 /* … … 496 574 switch (GSS_IOV_BUFFER_TYPE(iov[i].type)) { 497 575 case GSS_IOV_BUFFER_TYPE_DATA: 498 case GSS_IOV_BUFFER_TYPE_PADDING:499 576 data[i].flags = KRB5_CRYPTO_TYPE_DATA; 500 577 break; … … 512 589 data[i].flags = KRB5_CRYPTO_TYPE_DATA; 513 590 data[i].data.data = header->buffer.value; 514 data[i].data.length = header->buffer.length;591 data[i].data.length = sizeof(gss_cfx_wrap_token_desc); 515 592 i++; 516 593 517 594 data[i].flags = KRB5_CRYPTO_TYPE_CHECKSUM; 518 data[i].data.data = trailer->buffer.value; 519 data[i].data.length = trailer->buffer.length; 595 if (trailer) { 596 data[i].data.data = trailer->buffer.value; 597 } else { 598 data[i].data.data = (uint8_t *)header->buffer.value + 599 sizeof(gss_cfx_wrap_token_desc); 600 } 601 data[i].data.length = k5tsize; 520 602 i++; 521 603 … … 527 609 } 528 610 529 token->EC[0] = (trailer->buffer.length >> 8) & 0xFF; 530 token->EC[1] = (trailer->buffer.length >> 0) & 0xFF; 611 if (rrc) { 612 token->RRC[0] = (rrc >> 8) & 0xFF; 613 token->RRC[1] = (rrc >> 0) & 0xFF; 614 } 615 616 token->EC[0] = (k5tsize >> 8) & 0xFF; 617 token->EC[1] = (k5tsize >> 0) & 0xFF; 531 618 } 532 619 … … 607 694 GSS_IOV_BUFFER_TYPE(iov[i].type) == GSS_IOV_BUFFER_TYPE_TRAILER) 608 695 { 609 memcpy(q, iov[i].buffer.value, MIN(iov[i].buffer.length, skip));696 memcpy(q, iov[i].buffer.value, min(iov[i].buffer.length, skip)); 610 697 if (iov[i].buffer.length > skip) 611 698 break; … … 628 715 { 629 716 OM_uint32 seq_number_lo, seq_number_hi, major_status, junk; 630 gss_iov_buffer_desc *header, *trailer ;717 gss_iov_buffer_desc *header, *trailer, *padding; 631 718 gss_cfx_wrap_token token, ttoken; 632 719 u_char token_flags; … … 648 735 return GSS_S_DEFECTIVE_TOKEN; 649 736 737 padding = _gk_find_buffer(iov, iov_count, GSS_IOV_BUFFER_TYPE_PADDING); 738 if (padding != NULL && padding->buffer.length != 0) { 739 *minor_status = EINVAL; 740 return GSS_S_FAILURE; 741 } 742 650 743 trailer = _gk_find_buffer(iov, iov_count, GSS_IOV_BUFFER_TYPE_TRAILER); 744 745 major_status = _gk_verify_buffers(minor_status, ctx, header, padding, trailer); 746 if (major_status != GSS_S_COMPLETE) { 747 return major_status; 748 } 651 749 652 750 token = (gss_cfx_wrap_token)header->buffer.value; … … 731 829 size_t gsshsize = k5hsize + sizeof(*token); 732 830 733 if (IS_DCE_STYLE(ctx))734 gsstsize += ec;735 gsshsize += gsstsize;736 737 831 if (rrc != gsstsize) { 738 832 major_status = GSS_S_DEFECTIVE_TOKEN; 739 833 goto failure; 740 834 } 835 836 if (IS_DCE_STYLE(ctx)) 837 gsstsize += ec; 838 839 gsshsize += gsstsize; 840 741 841 if (header->buffer.length != gsshsize) { 742 842 major_status = GSS_S_DEFECTIVE_TOKEN; … … 765 865 switch (GSS_IOV_BUFFER_TYPE(iov[j].type)) { 766 866 case GSS_IOV_BUFFER_TYPE_DATA: 767 case GSS_IOV_BUFFER_TYPE_PADDING:768 867 data[i].flags = KRB5_CRYPTO_TYPE_DATA; 769 868 break; … … 783 882 */ 784 883 data[i].flags = KRB5_CRYPTO_TYPE_DATA; 785 if (trailer) 884 if (trailer) { 786 885 data[i].data.data = trailer->buffer.value; 787 else 788 data[i].data.data = ((uint8_t *)header->buffer.value) + header->buffer.length - k5hsize - k5tsize - sizeof(*token); 789 data[i].data.length = sizeof(*token); 790 ttoken = (gss_cfx_wrap_token)data[i].data.data; 886 } else { 887 data[i].data.data = ((uint8_t *)header->buffer.value) + 888 header->buffer.length - k5hsize - k5tsize - ec- sizeof(*token); 889 } 890 891 data[i].data.length = ec + sizeof(*token); 892 ttoken = (gss_cfx_wrap_token)(((uint8_t *)data[i].data.data) + ec); 791 893 i++; 792 894 793 895 /* Kerberos trailer comes after the gss trailer */ 794 896 data[i].flags = KRB5_CRYPTO_TYPE_TRAILER; 795 data[i].data.data = ((uint8_t *)data[i-1].data.data) + sizeof(*token);897 data[i].data.data = ((uint8_t *)data[i-1].data.data) + ec + sizeof(*token); 796 898 data[i].data.length = k5tsize; 797 899 i++; … … 808 910 809 911 /* Check the integrity of the header */ 810 if ( memcmp(ttoken, token, sizeof(*token)) != 0) {912 if (ct_memcmp(ttoken, token, sizeof(*token)) != 0) { 811 913 major_status = GSS_S_BAD_MIC; 812 914 goto failure; 813 915 } 814 916 } else { 815 /* Check RRC */ 816 if (rrc != 0) { 917 size_t gsstsize = ec; 918 size_t gsshsize = sizeof(*token); 919 920 if (trailer == NULL) { 921 /* Check RRC */ 922 if (rrc != gsstsize) { 923 *minor_status = EINVAL; 924 major_status = GSS_S_FAILURE; 925 goto failure; 926 } 927 928 gsshsize += gsstsize; 929 gsstsize = 0; 930 } else if (trailer->buffer.length != gsstsize) { 931 major_status = GSS_S_DEFECTIVE_TOKEN; 932 goto failure; 933 } else if (rrc != 0) { 934 /* Check RRC */ 817 935 *minor_status = EINVAL; 818 936 major_status = GSS_S_FAILURE; … … 820 938 } 821 939 822 if (trailer == NULL) { 823 *minor_status = EINVAL; 824 major_status = GSS_S_FAILURE; 825 goto failure; 826 } 827 828 if (trailer->buffer.length != ec) { 829 *minor_status = EINVAL; 830 major_status = GSS_S_FAILURE; 940 if (header->buffer.length != gsshsize) { 941 major_status = GSS_S_DEFECTIVE_TOKEN; 831 942 goto failure; 832 943 } … … 835 946 switch (GSS_IOV_BUFFER_TYPE(iov[i].type)) { 836 947 case GSS_IOV_BUFFER_TYPE_DATA: 837 case GSS_IOV_BUFFER_TYPE_PADDING:838 948 data[i].flags = KRB5_CRYPTO_TYPE_DATA; 839 949 break; … … 851 961 data[i].flags = KRB5_CRYPTO_TYPE_DATA; 852 962 data[i].data.data = header->buffer.value; 853 data[i].data.length = header->buffer.length;963 data[i].data.length = sizeof(*token); 854 964 i++; 855 965 856 966 data[i].flags = KRB5_CRYPTO_TYPE_CHECKSUM; 857 data[i].data.data = trailer->buffer.value; 858 data[i].data.length = trailer->buffer.length; 967 if (trailer) { 968 data[i].data.data = trailer->buffer.value; 969 } else { 970 data[i].data.data = (uint8_t *)header->buffer.value + 971 sizeof(*token); 972 } 973 data[i].data.length = ec; 859 974 i++; 860 975 … … 901 1016 int iov_count) 902 1017 { 1018 OM_uint32 major_status; 903 1019 size_t size; 904 1020 int i; 905 size_t *padding = NULL; 1021 gss_iov_buffer_desc *header = NULL; 1022 gss_iov_buffer_desc *padding = NULL; 1023 gss_iov_buffer_desc *trailer = NULL; 1024 size_t gsshsize = 0; 1025 size_t gsstsize = 0; 1026 size_t k5hsize = 0; 1027 size_t k5tsize = 0; 906 1028 907 1029 GSSAPI_KRB5_INIT (&context); … … 916 1038 break; 917 1039 case GSS_IOV_BUFFER_TYPE_HEADER: 918 *minor_status = krb5_crypto_length(context, ctx->crypto, KRB5_CRYPTO_TYPE_HEADER, &iov[i].buffer.length);919 if (*minor_status)1040 if (header != NULL) { 1041 *minor_status = 0; 920 1042 return GSS_S_FAILURE; 1043 } 1044 header = &iov[i]; 921 1045 break; 922 1046 case GSS_IOV_BUFFER_TYPE_TRAILER: 923 *minor_status = krb5_crypto_length(context, ctx->crypto, KRB5_CRYPTO_TYPE_TRAILER, &iov[i].buffer.length);924 if (*minor_status)1047 if (trailer != NULL) { 1048 *minor_status = 0; 925 1049 return GSS_S_FAILURE; 1050 } 1051 trailer = &iov[i]; 926 1052 break; 927 1053 case GSS_IOV_BUFFER_TYPE_PADDING: … … 930 1056 return GSS_S_FAILURE; 931 1057 } 932 padding = &iov[i] .buffer.length;1058 padding = &iov[i]; 933 1059 break; 934 1060 case GSS_IOV_BUFFER_TYPE_SIGN_ONLY: … … 939 1065 } 940 1066 } 1067 1068 major_status = _gk_verify_buffers(minor_status, ctx, header, padding, trailer); 1069 if (major_status != GSS_S_COMPLETE) { 1070 return major_status; 1071 } 1072 1073 if (conf_req_flag) { 1074 size_t k5psize = 0; 1075 size_t k5pbase = 0; 1076 size_t k5bsize = 0; 1077 size_t ec = 0; 1078 1079 size += sizeof(gss_cfx_wrap_token_desc); 1080 1081 *minor_status = krb5_crypto_length(context, ctx->crypto, 1082 KRB5_CRYPTO_TYPE_HEADER, 1083 &k5hsize); 1084 if (*minor_status) 1085 return GSS_S_FAILURE; 1086 1087 *minor_status = krb5_crypto_length(context, ctx->crypto, 1088 KRB5_CRYPTO_TYPE_TRAILER, 1089 &k5tsize); 1090 if (*minor_status) 1091 return GSS_S_FAILURE; 1092 1093 *minor_status = krb5_crypto_length(context, ctx->crypto, 1094 KRB5_CRYPTO_TYPE_PADDING, 1095 &k5pbase); 1096 if (*minor_status) 1097 return GSS_S_FAILURE; 1098 1099 if (k5pbase > 1) { 1100 k5psize = k5pbase - (size % k5pbase); 1101 } else { 1102 k5psize = 0; 1103 } 1104 1105 if (k5psize == 0 && IS_DCE_STYLE(ctx)) { 1106 *minor_status = krb5_crypto_getblocksize(context, ctx->crypto, 1107 &k5bsize); 1108 if (*minor_status) 1109 return GSS_S_FAILURE; 1110 1111 ec = k5bsize; 1112 } else { 1113 ec = k5psize; 1114 } 1115 1116 gsshsize = sizeof(gss_cfx_wrap_token_desc) + k5hsize; 1117 gsstsize = sizeof(gss_cfx_wrap_token_desc) + ec + k5tsize; 1118 } else { 1119 *minor_status = krb5_crypto_length(context, ctx->crypto, 1120 KRB5_CRYPTO_TYPE_CHECKSUM, 1121 &k5tsize); 1122 if (*minor_status) 1123 return GSS_S_FAILURE; 1124 1125 gsshsize = sizeof(gss_cfx_wrap_token_desc); 1126 gsstsize = k5tsize; 1127 } 1128 1129 if (trailer != NULL) { 1130 trailer->buffer.length = gsstsize; 1131 } else { 1132 gsshsize += gsstsize; 1133 } 1134 1135 header->buffer.length = gsshsize; 1136 941 1137 if (padding) { 942 size_t pad; 943 krb5_crypto_length(context, ctx->crypto, KRB5_CRYPTO_TYPE_PADDING, &pad); 944 if (pad > 1) { 945 *padding = pad - (size % pad); 946 if (*padding == pad) 947 *padding = 0; 948 } else 949 *padding = 0; 1138 /* padding is done via EC and is contained in the header or trailer */ 1139 padding->buffer.length = 0; 1140 } 1141 1142 if (conf_state) { 1143 *conf_state = conf_req_flag; 950 1144 } 951 1145 … … 1295 1489 1296 1490 /* Check the integrity of the header */ 1297 if ( memcmp(p, token, sizeof(*token)) != 0) {1491 if (ct_memcmp(p, token, sizeof(*token)) != 0) { 1298 1492 krb5_data_free(&data); 1299 1493 return GSS_S_BAD_MIC; … … 1497 1691 } 1498 1692 1499 if ( memcmp(token->Filler, "\xff\xff\xff\xff\xff", 5) != 0) {1693 if (ct_memcmp(token->Filler, "\xff\xff\xff\xff\xff", 5) != 0) { 1500 1694 return GSS_S_DEFECTIVE_TOKEN; 1501 1695 } -
trunk/server/source4/heimdal/lib/gssapi/krb5/compare_name.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_compare_name36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_compare_name 37 37 (OM_uint32 * minor_status, 38 38 const gss_name_t name1, -
trunk/server/source4/heimdal/lib/gssapi/krb5/context_time.c
r414 r745 63 63 64 64 65 OM_uint32 _gsskrb5_context_time65 OM_uint32 GSSAPI_CALLCONV _gsskrb5_context_time 66 66 (OM_uint32 * minor_status, 67 67 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/creds.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 36 OM_uint32 GSSAPI_CALLCONV 37 37 _gsskrb5_export_cred(OM_uint32 *minor_status, 38 38 gss_cred_id_t cred_handle, … … 155 155 } 156 156 157 OM_uint32 157 OM_uint32 GSSAPI_CALLCONV 158 158 _gsskrb5_import_cred(OM_uint32 * minor_status, 159 159 gss_buffer_t cred_token, … … 251 251 252 252 *cred_handle = (gss_cred_id_t)handle; 253 253 254 return GSS_S_COMPLETE; 254 255 } -
trunk/server/source4/heimdal/lib/gssapi/krb5/decapsulate.c
r414 r745 81 81 if (mech_len != mech->length) 82 82 return GSS_S_BAD_MECH; 83 if ( memcmp(p,84 85 83 if (ct_memcmp(p, 84 mech->elements, 85 mech->length) != 0) 86 86 return GSS_S_BAD_MECH; 87 87 p += mech_len; … … 109 109 return GSS_S_DEFECTIVE_TOKEN; 110 110 111 if ( memcmp (*str, type, 2) != 0)111 if (ct_memcmp (*str, type, 2) != 0) 112 112 return GSS_S_DEFECTIVE_TOKEN; 113 113 *str += 2; -
trunk/server/source4/heimdal/lib/gssapi/krb5/delete_sec_context.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 36 OM_uint32 GSSAPI_CALLCONV 37 37 _gsskrb5_delete_sec_context(OM_uint32 * minor_status, 38 38 gss_ctx_id_t * context_handle, … … 60 60 61 61 krb5_auth_con_free (context, ctx->auth_context); 62 krb5_auth_con_free (context, ctx->deleg_auth_context); 62 63 if (ctx->kcred) 63 64 krb5_free_creds(context, ctx->kcred); -
trunk/server/source4/heimdal/lib/gssapi/krb5/display_name.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_display_name36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_display_name 37 37 (OM_uint32 * minor_status, 38 38 const gss_name_t input_name, -
trunk/server/source4/heimdal/lib/gssapi/krb5/display_status.c
r414 r745 126 126 va_list args; 127 127 char *str; 128 int e; 128 129 129 130 if (_gsskrb5_init (&context) != 0) … … 131 132 132 133 va_start(args, fmt); 133 vasprintf(&str, fmt, args);134 e = vasprintf(&str, fmt, args); 134 135 va_end(args); 135 if ( str) {136 if (e >= 0 && str) { 136 137 krb5_set_error_message(context, ret, "%s", str); 137 138 free(str); … … 139 140 } 140 141 141 OM_uint32 _gsskrb5_display_status142 OM_uint32 GSSAPI_CALLCONV _gsskrb5_display_status 142 143 (OM_uint32 *minor_status, 143 144 OM_uint32 status_value, … … 148 149 { 149 150 krb5_context context; 150 char *buf; 151 char *buf = NULL; 152 int e = 0; 151 153 152 154 GSSAPI_KRB5_INIT (&context); … … 163 165 if (status_type == GSS_C_GSS_CODE) { 164 166 if (GSS_SUPPLEMENTARY_INFO(status_value)) 165 asprintf(&buf, "%s",166 167 e = asprintf(&buf, "%s", 168 supplementary_error(GSS_SUPPLEMENTARY_INFO(status_value))); 167 169 else 168 asprintf (&buf, "%s %s",169 170 170 e = asprintf (&buf, "%s %s", 171 calling_error(GSS_CALLING_ERROR(status_value)), 172 routine_error(GSS_ROUTINE_ERROR(status_value))); 171 173 } else if (status_type == GSS_C_MECH_CODE) { 172 174 const char *buf2 = krb5_get_error_message(context, status_value); … … 175 177 krb5_free_error_message(context, buf2); 176 178 } else { 177 asprintf(&buf, "unknown mech error-code %u",178 179 e = asprintf(&buf, "unknown mech error-code %u", 180 (unsigned)status_value); 179 181 } 180 182 } else { … … 183 185 } 184 186 185 if ( buf == NULL) {187 if (e < 0 || buf == NULL) { 186 188 *minor_status = ENOMEM; 187 189 return GSS_S_FAILURE; -
trunk/server/source4/heimdal/lib/gssapi/krb5/duplicate_name.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_duplicate_name (36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_duplicate_name ( 37 37 OM_uint32 * minor_status, 38 38 const gss_name_t src_name, -
trunk/server/source4/heimdal/lib/gssapi/krb5/export_name.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_export_name36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_export_name 37 37 (OM_uint32 * minor_status, 38 38 const gss_name_t input_name, -
trunk/server/source4/heimdal/lib/gssapi/krb5/export_sec_context.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 36 OM_uint32 GSSAPI_CALLCONV 37 37 _gsskrb5_export_sec_context ( 38 38 OM_uint32 * minor_status, -
trunk/server/source4/heimdal/lib/gssapi/krb5/external.c
r414 r745 47 47 */ 48 48 49 static gss_OID_descgss_c_nt_user_name_oid_desc =49 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_user_name_oid_desc = 50 50 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x01")}; 51 52 gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_USER_NAME =53 &gss_c_nt_user_name_oid_desc;54 51 55 52 /* … … 65 62 */ 66 63 67 static gss_OID_descgss_c_nt_machine_uid_name_oid_desc =64 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_machine_uid_name_oid_desc = 68 65 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x02")}; 69 70 gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_MACHINE_UID_NAME =71 &gss_c_nt_machine_uid_name_oid_desc;72 66 73 67 /* … … 83 77 */ 84 78 85 static gss_OID_descgss_c_nt_string_uid_name_oid_desc =79 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_string_uid_name_oid_desc = 86 80 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x03")}; 87 88 gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_STRING_UID_NAME =89 &gss_c_nt_string_uid_name_oid_desc;90 81 91 82 /* … … 107 98 */ 108 99 109 static gss_OID_descgss_c_nt_hostbased_service_x_oid_desc =100 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_x_oid_desc = 110 101 {6, rk_UNCONST("\x2b\x06\x01\x05\x06\x02")}; 111 112 gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_HOSTBASED_SERVICE_X =113 &gss_c_nt_hostbased_service_x_oid_desc;114 102 115 103 /* … … 124 112 * to point to that gss_OID_desc. 125 113 */ 126 static gss_OID_descgss_c_nt_hostbased_service_oid_desc =114 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_oid_desc = 127 115 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04")}; 128 129 gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_HOSTBASED_SERVICE =130 &gss_c_nt_hostbased_service_oid_desc;131 116 132 117 /* … … 141 126 */ 142 127 143 static gss_OID_descgss_c_nt_anonymous_oid_desc =128 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_anonymous_oid_desc = 144 129 {6, rk_UNCONST("\x2b\x06\01\x05\x06\x03")}; 145 146 gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_ANONYMOUS =147 &gss_c_nt_anonymous_oid_desc;148 130 149 131 /* … … 158 140 */ 159 141 160 static gss_OID_descgss_c_nt_export_name_oid_desc =142 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_export_name_oid_desc = 161 143 {6, rk_UNCONST("\x2b\x06\x01\x05\x06\x04") }; 162 163 gss_OID GSSAPI_LIB_VARIABLE GSS_C_NT_EXPORT_NAME =164 &gss_c_nt_export_name_oid_desc;165 144 166 145 /* … … 171 150 */ 172 151 173 static gss_OID_descgss_krb5_nt_principal_name_oid_desc =152 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_nt_principal_name_oid_desc = 174 153 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01") }; 175 176 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_NT_PRINCIPAL_NAME =177 &gss_krb5_nt_principal_name_oid_desc;178 179 /*180 * This name form shall be represented by the Object Identifier {iso(1)181 * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)182 * generic(1) user_name(1)}. The recommended symbolic name for this183 * type is "GSS_KRB5_NT_USER_NAME".184 */185 186 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_NT_USER_NAME =187 &gss_c_nt_user_name_oid_desc;188 189 /*190 * This name form shall be represented by the Object Identifier {iso(1)191 * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)192 * generic(1) machine_uid_name(2)}. The recommended symbolic name for193 * this type is "GSS_KRB5_NT_MACHINE_UID_NAME".194 */195 196 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_NT_MACHINE_UID_NAME =197 &gss_c_nt_machine_uid_name_oid_desc;198 199 /*200 * This name form shall be represented by the Object Identifier {iso(1)201 * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)202 * generic(1) string_uid_name(3)}. The recommended symbolic name for203 * this type is "GSS_KRB5_NT_STRING_UID_NAME".204 */205 206 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_NT_STRING_UID_NAME =207 &gss_c_nt_string_uid_name_oid_desc;208 209 /*210 * To support ongoing experimentation, testing, and evolution of the211 * specification, the Kerberos V5 GSS-API mechanism as defined in this212 * and any successor memos will be identified with the following Object213 * Identifier, as defined in RFC-1510, until the specification is214 * advanced to the level of Proposed Standard RFC:215 *216 * {iso(1), org(3), dod(5), internet(1), security(5), kerberosv5(2)}217 *218 * Upon advancement to the level of Proposed Standard RFC, the Kerberos219 * V5 GSS-API mechanism will be identified by an Object Identifier220 * having the value:221 *222 * {iso(1) member-body(2) United States(840) mit(113554) infosys(1)223 * gssapi(2) krb5(2)}224 */225 226 #if 0 /* This is the old OID */227 228 static gss_OID_desc gss_krb5_mechanism_oid_desc =229 {5, rk_UNCONST("\x2b\x05\x01\x05\x02")};230 231 #endif232 233 static gss_OID_desc gss_krb5_mechanism_oid_desc =234 {9, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02") };235 236 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_MECHANISM =237 &gss_krb5_mechanism_oid_desc;238 154 239 155 /* … … 250 166 */ 251 167 252 static gss_OID_descgss_iakerb_proxy_mechanism_oid_desc =168 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_proxy_mechanism_oid_desc = 253 169 {7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x01")}; 254 170 255 gss_OID GSSAPI_LIB_VARIABLE GSS_IAKERB_PROXY_MECHANISM = 256 &gss_iakerb_proxy_mechanism_oid_desc; 257 258 static gss_OID_desc gss_iakerb_min_msg_mechanism_oid_desc = 171 gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_min_msg_mechanism_oid_desc = 259 172 {7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x02") }; 260 173 261 gss_OID GSSAPI_LIB_VARIABLE GSS_IAKERB_MIN_MSG_MECHANISM =262 &gss_iakerb_min_msg_mechanism_oid_desc;263 264 /*265 *266 */267 268 static gss_OID_desc gss_c_peer_has_updated_spnego_oid_desc =269 {9, (void *)"\x2b\x06\x01\x04\x01\xa9\x4a\x13\x05"};270 271 gss_OID GSSAPI_LIB_VARIABLE GSS_C_PEER_HAS_UPDATED_SPNEGO =272 &gss_c_peer_has_updated_spnego_oid_desc;273 274 /*275 * 1.2.752.43.13 Heimdal GSS-API Extentions276 */277 278 /* 1.2.752.43.13.1 */279 static gss_OID_desc gss_krb5_copy_ccache_x_oid_desc =280 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x01")};281 282 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_COPY_CCACHE_X =283 &gss_krb5_copy_ccache_x_oid_desc;284 285 /* 1.2.752.43.13.2 */286 static gss_OID_desc gss_krb5_get_tkt_flags_x_oid_desc =287 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x02")};288 289 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_GET_TKT_FLAGS_X =290 &gss_krb5_get_tkt_flags_x_oid_desc;291 292 /* 1.2.752.43.13.3 */293 static gss_OID_desc gss_krb5_extract_authz_data_from_sec_context_x_oid_desc =294 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x03")};295 296 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT_X =297 &gss_krb5_extract_authz_data_from_sec_context_x_oid_desc;298 299 /* 1.2.752.43.13.4 */300 static gss_OID_desc gss_krb5_compat_des3_mic_x_oid_desc =301 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x04")};302 303 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_COMPAT_DES3_MIC_X =304 &gss_krb5_compat_des3_mic_x_oid_desc;305 306 /* 1.2.752.43.13.5 */307 static gss_OID_desc gss_krb5_register_acceptor_identity_x_desc =308 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x05")};309 310 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_REGISTER_ACCEPTOR_IDENTITY_X =311 &gss_krb5_register_acceptor_identity_x_desc;312 313 /* 1.2.752.43.13.6 */314 static gss_OID_desc gss_krb5_export_lucid_context_x_desc =315 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x06")};316 317 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_EXPORT_LUCID_CONTEXT_X =318 &gss_krb5_export_lucid_context_x_desc;319 320 /* 1.2.752.43.13.6.1 */321 static gss_OID_desc gss_krb5_export_lucid_context_v1_x_desc =322 {7, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x06\x01")};323 324 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_EXPORT_LUCID_CONTEXT_V1_X =325 &gss_krb5_export_lucid_context_v1_x_desc;326 327 /* 1.2.752.43.13.7 */328 static gss_OID_desc gss_krb5_set_dns_canonicalize_x_desc =329 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x07")};330 331 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_SET_DNS_CANONICALIZE_X =332 &gss_krb5_set_dns_canonicalize_x_desc;333 334 /* 1.2.752.43.13.8 */335 static gss_OID_desc gss_krb5_get_subkey_x_desc =336 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x08")};337 338 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_GET_SUBKEY_X =339 &gss_krb5_get_subkey_x_desc;340 341 /* 1.2.752.43.13.9 */342 static gss_OID_desc gss_krb5_get_initiator_subkey_x_desc =343 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x09")};344 345 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_GET_INITIATOR_SUBKEY_X =346 &gss_krb5_get_initiator_subkey_x_desc;347 348 /* 1.2.752.43.13.10 */349 static gss_OID_desc gss_krb5_get_acceptor_subkey_x_desc =350 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0a")};351 352 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_GET_ACCEPTOR_SUBKEY_X =353 &gss_krb5_get_acceptor_subkey_x_desc;354 355 /* 1.2.752.43.13.11 */356 static gss_OID_desc gss_krb5_send_to_kdc_x_desc =357 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0b")};358 359 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_SEND_TO_KDC_X =360 &gss_krb5_send_to_kdc_x_desc;361 362 /* 1.2.752.43.13.12 */363 static gss_OID_desc gss_krb5_get_authtime_x_desc =364 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0c")};365 366 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_GET_AUTHTIME_X =367 &gss_krb5_get_authtime_x_desc;368 369 /* 1.2.752.43.13.13 */370 static gss_OID_desc gss_krb5_get_service_keyblock_x_desc =371 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0d")};372 373 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_GET_SERVICE_KEYBLOCK_X =374 &gss_krb5_get_service_keyblock_x_desc;375 376 /* 1.2.752.43.13.14 */377 static gss_OID_desc gss_krb5_set_allowable_enctypes_x_desc =378 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0e")};379 380 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_SET_ALLOWABLE_ENCTYPES_X =381 &gss_krb5_set_allowable_enctypes_x_desc;382 383 /* 1.2.752.43.13.15 */384 static gss_OID_desc gss_krb5_set_default_realm_x_desc =385 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x0f")};386 387 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_SET_DEFAULT_REALM_X =388 &gss_krb5_set_default_realm_x_desc;389 390 /* 1.2.752.43.13.16 */391 static gss_OID_desc gss_krb5_ccache_name_x_desc =392 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x10")};393 394 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_CCACHE_NAME_X =395 &gss_krb5_ccache_name_x_desc;396 397 /* 1.2.752.43.13.17 */398 static gss_OID_desc gss_krb5_set_time_offset_x_desc =399 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x11")};400 401 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_SET_TIME_OFFSET_X =402 &gss_krb5_set_time_offset_x_desc;403 404 /* 1.2.752.43.13.18 */405 static gss_OID_desc gss_krb5_get_time_offset_x_desc =406 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x12")};407 408 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_GET_TIME_OFFSET_X =409 &gss_krb5_get_time_offset_x_desc;410 411 /* 1.2.752.43.13.19 */412 static gss_OID_desc gss_krb5_plugin_register_x_desc =413 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x13")};414 415 gss_OID GSSAPI_LIB_VARIABLE GSS_KRB5_PLUGIN_REGISTER_X =416 &gss_krb5_plugin_register_x_desc;417 418 /* 1.2.752.43.14.1 */419 static gss_OID_desc gss_sasl_digest_md5_mechanism_desc =420 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0e\x01") };421 422 gss_OID GSSAPI_LIB_VARIABLE GSS_SASL_DIGEST_MD5_MECHANISM =423 &gss_sasl_digest_md5_mechanism_desc;424 425 174 /* 426 175 * Context for krb5 calls. 427 176 */ 177 178 static gss_mo_desc krb5_mo[] = { 179 { 180 GSS_C_MA_SASL_MECH_NAME, 181 GSS_MO_MA, 182 "SASL mech name", 183 "GS2-KRB5", 184 _gss_mo_get_ctx_as_string, 185 NULL 186 }, 187 { 188 GSS_C_MA_MECH_NAME, 189 GSS_MO_MA, 190 "Mechanism name", 191 "KRB5", 192 _gss_mo_get_ctx_as_string, 193 NULL 194 }, 195 { 196 GSS_C_MA_MECH_DESCRIPTION, 197 GSS_MO_MA, 198 "Mechanism description", 199 "Heimdal Kerberos 5 mech", 200 _gss_mo_get_ctx_as_string, 201 NULL 202 }, 203 { 204 GSS_C_MA_MECH_CONCRETE, 205 GSS_MO_MA 206 }, 207 { 208 GSS_C_MA_ITOK_FRAMED, 209 GSS_MO_MA 210 }, 211 { 212 GSS_C_MA_AUTH_INIT, 213 GSS_MO_MA 214 }, 215 { 216 GSS_C_MA_AUTH_TARG, 217 GSS_MO_MA 218 }, 219 { 220 GSS_C_MA_AUTH_INIT_ANON, 221 GSS_MO_MA 222 }, 223 { 224 GSS_C_MA_DELEG_CRED, 225 GSS_MO_MA 226 }, 227 { 228 GSS_C_MA_INTEG_PROT, 229 GSS_MO_MA 230 }, 231 { 232 GSS_C_MA_CONF_PROT, 233 GSS_MO_MA 234 }, 235 { 236 GSS_C_MA_MIC, 237 GSS_MO_MA 238 }, 239 { 240 GSS_C_MA_WRAP, 241 GSS_MO_MA 242 }, 243 { 244 GSS_C_MA_PROT_READY, 245 GSS_MO_MA 246 }, 247 { 248 GSS_C_MA_REPLAY_DET, 249 GSS_MO_MA 250 }, 251 { 252 GSS_C_MA_OOS_DET, 253 GSS_MO_MA 254 }, 255 { 256 GSS_C_MA_CBINDINGS, 257 GSS_MO_MA 258 }, 259 { 260 GSS_C_MA_PFS, 261 GSS_MO_MA 262 }, 263 { 264 GSS_C_MA_CTX_TRANS, 265 GSS_MO_MA 266 } 267 }; 428 268 429 269 /* … … 435 275 "kerberos 5", 436 276 {9, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" }, 277 0, 437 278 _gsskrb5_acquire_cred, 438 279 _gsskrb5_release_cred, … … 474 315 _gsskrb5_store_cred, 475 316 _gsskrb5_export_cred, 476 _gsskrb5_import_cred 317 _gsskrb5_import_cred, 318 NULL, 319 NULL, 320 NULL, 321 NULL, 322 NULL, 323 NULL, 324 NULL, 325 krb5_mo, 326 sizeof(krb5_mo) / sizeof(krb5_mo[0]) 477 327 }; 478 328 -
trunk/server/source4/heimdal/lib/gssapi/krb5/get_mic.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 #ifdef HEIM_WEAK_CRYPTO 37 36 38 static OM_uint32 37 39 mic_des … … 46 48 { 47 49 u_char *p; 48 MD5_CTXmd5;50 EVP_MD_CTX *md5; 49 51 u_char hash[16]; 50 52 DES_key_schedule schedule; 53 EVP_CIPHER_CTX des_ctx; 51 54 DES_cblock deskey; 52 55 DES_cblock zero; … … 80 83 81 84 /* checksum */ 82 MD5_Init (&md5); 83 MD5_Update (&md5, p - 24, 8); 84 MD5_Update (&md5, message_buffer->value, message_buffer->length); 85 MD5_Final (hash, &md5); 85 md5 = EVP_MD_CTX_create(); 86 EVP_DigestInit_ex(md5, EVP_md5(), NULL); 87 EVP_DigestUpdate(md5, p - 24, 8); 88 EVP_DigestUpdate(md5, message_buffer->value, message_buffer->length); 89 EVP_DigestFinal_ex(md5, hash, NULL); 90 EVP_MD_CTX_destroy(md5); 86 91 87 92 memset (&zero, 0, sizeof(zero)); … … 107 112 4); 108 113 109 DES_set_key_unchecked (&deskey, &schedule); 110 DES_cbc_encrypt ((void *)p, (void *)p, 8, 111 &schedule, (DES_cblock *)(p + 8), DES_ENCRYPT); 114 EVP_CIPHER_CTX_init(&des_ctx); 115 EVP_CipherInit_ex(&des_ctx, EVP_des_cbc(), NULL, key->keyvalue.data, p + 8, 1); 116 EVP_Cipher(&des_ctx, p, p, 8); 117 EVP_CIPHER_CTX_cleanup(&des_ctx); 112 118 113 119 krb5_auth_con_setlocalseqnumber (context, … … 122 128 return GSS_S_COMPLETE; 123 129 } 130 #endif 124 131 125 132 static OM_uint32 … … 267 274 } 268 275 269 OM_uint32 _gsskrb5_get_mic276 OM_uint32 GSSAPI_CALLCONV _gsskrb5_get_mic 270 277 (OM_uint32 * minor_status, 271 278 const gss_ctx_id_t context_handle, … … 298 305 switch (keytype) { 299 306 case KEYTYPE_DES : 307 #ifdef HEIM_WEAK_CRYPTO 300 308 ret = mic_des (minor_status, ctx, context, qop_req, 301 309 message_buffer, message_token, key); 310 #else 311 ret = GSS_S_FAILURE; 312 #endif 302 313 break; 303 314 case KEYTYPE_DES3 : -
trunk/server/source4/heimdal/lib/gssapi/krb5/gsskrb5_locl.h
r414 r745 56 56 typedef struct gsskrb5_ctx { 57 57 struct krb5_auth_context_data *auth_context; 58 struct krb5_auth_context_data *deleg_auth_context; 58 59 krb5_principal source, target; 59 60 #define IS_DCE_STYLE(ctx) (((ctx)->flags & GSS_C_DCE_STYLE) != 0) … … 112 113 extern HEIMDAL_MUTEX gssapi_keytab_mutex; 113 114 114 struct gssapi_thr_context {115 HEIMDAL_MUTEX mutex;116 char *error_string;117 };118 119 115 /* 120 116 * Prototypes -
trunk/server/source4/heimdal/lib/gssapi/krb5/import_name.c
r414 r745 216 216 } 217 217 218 OM_uint32 _gsskrb5_import_name218 OM_uint32 GSSAPI_CALLCONV _gsskrb5_import_name 219 219 (OM_uint32 * minor_status, 220 220 const gss_buffer_t input_name_buffer, … … 236 236 input_name_buffer, 237 237 output_name); 238 else if ( gss_oid_equal(input_name_type, GSS_C_NO_OID)238 else if (input_name_type == GSS_C_NO_OID 239 239 || gss_oid_equal(input_name_type, GSS_C_NT_USER_NAME) 240 240 || gss_oid_equal(input_name_type, GSS_KRB5_NT_PRINCIPAL_NAME)) -
trunk/server/source4/heimdal/lib/gssapi/krb5/import_sec_context.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 36 OM_uint32 GSSAPI_CALLCONV 37 37 _gsskrb5_import_sec_context ( 38 38 OM_uint32 * minor_status, … … 203 203 krb5_storage_free (sp); 204 204 205 _gsskrb5i_is_cfx(context, ctx, (ctx->more_flags & LOCAL) == 0); 206 205 207 *context_handle = (gss_ctx_id_t)ctx; 206 208 -
trunk/server/source4/heimdal/lib/gssapi/krb5/indicate_mechs.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_indicate_mechs36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_indicate_mechs 37 37 (OM_uint32 * minor_status, 38 38 gss_OID_set * mech_set -
trunk/server/source4/heimdal/lib/gssapi/krb5/init_sec_context.c
r414 r745 118 118 } 119 119 ctx->auth_context = NULL; 120 ctx->deleg_auth_context = NULL; 120 121 ctx->source = NULL; 121 122 ctx->target = NULL; … … 140 141 } 141 142 143 kret = krb5_auth_con_init (context, &ctx->deleg_auth_context); 144 if (kret) { 145 *minor_status = kret; 146 krb5_auth_con_free(context, ctx->auth_context); 147 HEIMDAL_MUTEX_destroy(&ctx->ctx_id_mutex); 148 return GSS_S_FAILURE; 149 } 150 142 151 kret = set_addresses(context, ctx->auth_context, input_chan_bindings); 143 152 if (kret) { 144 153 *minor_status = kret; 145 154 155 krb5_auth_con_free(context, ctx->auth_context); 156 krb5_auth_con_free(context, ctx->deleg_auth_context); 157 146 158 HEIMDAL_MUTEX_destroy(&ctx->ctx_id_mutex); 147 159 160 return GSS_S_BAD_BINDINGS; 161 } 162 163 kret = set_addresses(context, ctx->deleg_auth_context, input_chan_bindings); 164 if (kret) { 165 *minor_status = kret; 166 148 167 krb5_auth_con_free(context, ctx->auth_context); 168 krb5_auth_con_free(context, ctx->deleg_auth_context); 169 170 HEIMDAL_MUTEX_destroy(&ctx->ctx_id_mutex); 149 171 150 172 return GSS_S_BAD_BINDINGS; … … 157 179 krb5_auth_con_addflags(context, 158 180 ctx->auth_context, 181 KRB5_AUTH_CONTEXT_DO_SEQUENCE | 182 KRB5_AUTH_CONTEXT_CLEAR_FORWARDED_CRED, 183 NULL); 184 185 /* 186 * We need a sequence number 187 */ 188 189 krb5_auth_con_addflags(context, 190 ctx->deleg_auth_context, 159 191 KRB5_AUTH_CONTEXT_DO_SEQUENCE | 160 192 KRB5_AUTH_CONTEXT_CLEAR_FORWARDED_CRED, … … 176 208 int use_dns, 177 209 OM_uint32 time_req, 178 OM_uint32 * time_rec, 179 krb5_creds ** cred) 210 OM_uint32 * time_rec) 180 211 { 181 212 OM_uint32 ret; … … 184 215 OM_uint32 lifetime_rec; 185 216 186 *cred = NULL;187 188 217 if (ctx->target) { 189 218 krb5_free_principal(context, ctx->target); 190 219 ctx->target = NULL; 220 } 221 if (ctx->kcred) { 222 krb5_free_creds(context, ctx->kcred); 223 ctx->kcred = NULL; 191 224 } 192 225 … … 215 248 ccache, 216 249 &this_cred, 217 cred);250 &ctx->kcred); 218 251 if (kret) { 219 252 *minor_status = kret; … … 221 254 } 222 255 223 ctx->lifetime = (*cred)->times.endtime;256 ctx->lifetime = ctx->kcred->times.endtime; 224 257 225 258 ret = _gsskrb5_lifetime_left(minor_status, context, … … 255 288 ctx->ccache = NULL; 256 289 257 krb5_auth_ getremoteseqnumber (context, ctx->auth_context, &seq_number);290 krb5_auth_con_getremoteseqnumber (context, ctx->auth_context, &seq_number); 258 291 259 292 _gsskrb5i_is_cfx(context, ctx, 0); … … 297 330 goto out; 298 331 299 kret = krb5_build_principal(context, 300 &creds.server, 301 strlen(creds.client->realm), 302 creds.client->realm, 303 KRB5_TGS_NAME, 304 creds.client->realm, 305 NULL); 332 kret = krb5_make_principal(context, 333 &creds.server, 334 creds.client->realm, 335 KRB5_TGS_NAME, 336 creds.client->realm, 337 NULL); 306 338 if (kret) 307 339 goto out; … … 428 460 ret = gsskrb5_get_creds(minor_status, context, ctx->ccache, 429 461 ctx, name, 0, time_req, 430 time_rec , &ctx->kcred);462 time_rec); 431 463 if (ret && allow_dns) 432 464 ret = gsskrb5_get_creds(minor_status, context, ctx->ccache, 433 465 ctx, name, 1, time_req, 434 time_rec , &ctx->kcred);466 time_rec); 435 467 if (ret) 436 468 goto failure; … … 539 571 if (flagmask & GSS_C_DELEG_FLAG) { 540 572 do_delegation (context, 541 ctx-> auth_context,573 ctx->deleg_auth_context, 542 574 ctx->ccache, ctx->kcred, ctx->target, 543 575 &fwd_data, flagmask, &flags); … … 610 642 } 611 643 612 kret = krb5_build_authenticator(context,644 kret = _krb5_build_authenticator(context, 613 645 ctx->auth_context, 614 646 enctype, 615 647 ctx->kcred, 616 648 &cksum, 617 NULL,618 649 &authenticator, 619 650 KRB5_KU_AP_REQ_AUTH); … … 666 697 667 698 return ret; 699 } 700 701 static krb5_error_code 702 handle_error_packet(krb5_context context, 703 gsskrb5_ctx ctx, 704 krb5_data indata) 705 { 706 krb5_error_code kret; 707 KRB_ERROR error; 708 709 kret = krb5_rd_error(context, &indata, &error); 710 if (kret == 0) { 711 kret = krb5_error_from_rd_error(context, &error, NULL); 712 713 /* save the time skrew for this host */ 714 if (kret == KRB5KRB_AP_ERR_SKEW) { 715 krb5_data timedata; 716 unsigned char p[4]; 717 int32_t t = error.stime - time(NULL); 718 719 p[0] = (t >> 24) & 0xFF; 720 p[1] = (t >> 16) & 0xFF; 721 p[2] = (t >> 8) & 0xFF; 722 p[3] = (t >> 0) & 0xFF; 723 724 timedata.data = p; 725 timedata.length = sizeof(p); 726 727 krb5_cc_set_config(context, ctx->ccache, ctx->target, 728 "time-offset", &timedata); 729 730 if ((ctx->more_flags & RETRIED) == 0) 731 ctx->state = INITIATOR_RESTART; 732 ctx->more_flags |= RETRIED; 733 } 734 free_KRB_ERROR (&error); 735 } 736 return kret; 668 737 } 669 738 … … 700 769 indata.length = input_token->length; 701 770 indata.data = input_token->value; 771 kret = krb5_rd_rep(context, 772 ctx->auth_context, 773 &indata, 774 &repl); 775 if (kret) { 776 ret = _gsskrb5_decapsulate(minor_status, 777 input_token, 778 &indata, 779 "\x03\x00", 780 GSS_KRB5_MECHANISM); 781 if (ret == GSS_S_COMPLETE) { 782 *minor_status = handle_error_packet(context, ctx, indata); 783 } else { 784 *minor_status = kret; 785 } 786 return GSS_S_FAILURE; 787 } 702 788 } else { 703 789 ret = _gsskrb5_decapsulate (minor_status, … … 714 800 GSS_KRB5_MECHANISM); 715 801 if (ret == GSS_S_COMPLETE) { 716 KRB_ERROR error; 717 718 kret = krb5_rd_error(context, &indata, &error); 719 if (kret == 0) { 720 kret = krb5_error_from_rd_error(context, &error, NULL); 721 722 /* save the time skrew for this host */ 723 if (kret == KRB5KRB_AP_ERR_SKEW) { 724 krb5_data timedata; 725 unsigned char p[4]; 726 int32_t t = error.stime - time(NULL); 727 728 p[0] = (t >> 24) & 0xFF; 729 p[1] = (t >> 16) & 0xFF; 730 p[2] = (t >> 8) & 0xFF; 731 p[3] = (t >> 0) & 0xFF; 732 733 timedata.data = p; 734 timedata.length = sizeof(p); 735 736 krb5_cc_set_config(context, ctx->ccache, ctx->target, 737 "time-offset", &timedata); 738 739 if ((ctx->more_flags & RETRIED) == 0) 740 ctx->state = INITIATOR_RESTART; 741 ctx->more_flags |= RETRIED; 742 } 743 free_KRB_ERROR (&error); 744 } 745 *minor_status = kret; 802 *minor_status = handle_error_packet(context, ctx, indata); 746 803 return GSS_S_FAILURE; 747 804 } 748 return ret;749 805 } 750 } 751 752 kret = krb5_rd_rep (context,753 ctx->auth_context,754 &indata,755 &repl);756 if (kret) { 757 *minor_status = kret;758 return GSS_S_FAILURE; 759 } 806 kret = krb5_rd_rep (context, 807 ctx->auth_context, 808 &indata, 809 &repl); 810 if (kret) { 811 *minor_status = kret; 812 return GSS_S_FAILURE; 813 } 814 } 815 760 816 krb5_free_ap_rep_enc_part (context, 761 817 repl); … … 784 840 */ 785 841 786 krb5_auth_ getremoteseqnumber(context, ctx->auth_context, &remote_seq);842 krb5_auth_con_getremoteseqnumber(context, ctx->auth_context, &remote_seq); 787 843 krb5_auth_con_getlocalseqnumber(context, ctx->auth_context, &local_seq); 788 844 krb5_auth_con_setlocalseqnumber(context, ctx->auth_context, remote_seq); … … 808 864 */ 809 865 810 OM_uint32 _gsskrb5_init_sec_context866 OM_uint32 GSSAPI_CALLCONV _gsskrb5_init_sec_context 811 867 (OM_uint32 * minor_status, 812 868 const gss_cred_id_t cred_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/inquire_context.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_inquire_context (36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_inquire_context ( 37 37 OM_uint32 * minor_status, 38 38 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/inquire_cred.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_inquire_cred36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_inquire_cred 37 37 (OM_uint32 * minor_status, 38 38 const gss_cred_id_t cred_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/inquire_cred_by_mech.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_inquire_cred_by_mech (36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_inquire_cred_by_mech ( 37 37 OM_uint32 * minor_status, 38 38 const gss_cred_id_t cred_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/inquire_cred_by_oid.c
r414 r745 33 33 #include "gsskrb5_locl.h" 34 34 35 OM_uint32 _gsskrb5_inquire_cred_by_oid35 OM_uint32 GSSAPI_CALLCONV _gsskrb5_inquire_cred_by_oid 36 36 (OM_uint32 * minor_status, 37 37 const gss_cred_id_t cred_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/inquire_mechs_for_name.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_inquire_mechs_for_name (36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_inquire_mechs_for_name ( 37 37 OM_uint32 * minor_status, 38 38 const gss_name_t input_name, -
trunk/server/source4/heimdal/lib/gssapi/krb5/inquire_names_for_mech.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 static gss_OID *name_list[] = {37 &GSS_C_NT_HOSTBASED_SERVICE,38 &GSS_C_NT_USER_NAME,39 &GSS_KRB5_NT_PRINCIPAL_NAME,40 &GSS_C_NT_EXPORT_NAME,36 static gss_OID name_list[] = { 37 GSS_C_NT_HOSTBASED_SERVICE, 38 GSS_C_NT_USER_NAME, 39 GSS_KRB5_NT_PRINCIPAL_NAME, 40 GSS_C_NT_EXPORT_NAME, 41 41 NULL 42 42 }; 43 43 44 OM_uint32 _gsskrb5_inquire_names_for_mech (44 OM_uint32 GSSAPI_CALLCONV _gsskrb5_inquire_names_for_mech ( 45 45 OM_uint32 * minor_status, 46 46 const gss_OID mechanism, … … 65 65 for (i = 0; name_list[i] != NULL; i++) { 66 66 ret = gss_add_oid_set_member(minor_status, 67 *(name_list[i]),67 name_list[i], 68 68 name_types); 69 69 if (ret != GSS_S_COMPLETE) -
trunk/server/source4/heimdal/lib/gssapi/krb5/inquire_sec_context_by_oid.c
r414 r745 303 303 ret = krb5_store_uint32(sp, (uint32_t)number); 304 304 if (ret) goto out; 305 krb5_auth_ getremoteseqnumber (context,306 context_handle->auth_context,307 &number);305 krb5_auth_con_getremoteseqnumber (context, 306 context_handle->auth_context, 307 &number); 308 308 ret = krb5_store_uint32(sp, (uint32_t)0); /* store top half as zero */ 309 309 if (ret) goto out; … … 488 488 */ 489 489 490 OM_uint32 _gsskrb5_inquire_sec_context_by_oid490 OM_uint32 GSSAPI_CALLCONV _gsskrb5_inquire_sec_context_by_oid 491 491 (OM_uint32 *minor_status, 492 492 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/prf.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 36 OM_uint32 GSSAPI_CALLCONV 37 37 _gsskrb5_pseudo_random(OM_uint32 *minor_status, 38 38 gss_ctx_id_t context_handle, … … 133 133 num++; 134 134 } 135 free(input.data); 135 136 136 137 krb5_crypto_destroy(context, crypto); -
trunk/server/source4/heimdal/lib/gssapi/krb5/process_context_token.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_process_context_token (36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_process_context_token ( 37 37 OM_uint32 *minor_status, 38 38 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/release_cred.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_release_cred36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_release_cred 37 37 (OM_uint32 * minor_status, 38 38 gss_cred_id_t * cred_handle -
trunk/server/source4/heimdal/lib/gssapi/krb5/release_name.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 _gsskrb5_release_name36 OM_uint32 GSSAPI_CALLCONV _gsskrb5_release_name 37 37 (OM_uint32 * minor_status, 38 38 gss_name_t * input_name -
trunk/server/source4/heimdal/lib/gssapi/krb5/set_cred_option.c
r414 r745 32 32 33 33 #include "gsskrb5_locl.h" 34 35 /* 1.2.752.43.13.17 */36 static gss_OID_desc gss_krb5_cred_no_ci_flags_x_oid_desc =37 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x11")};38 39 gss_OID GSS_KRB5_CRED_NO_CI_FLAGS_X = &gss_krb5_cred_no_ci_flags_x_oid_desc;40 41 /* 1.2.752.43.13.18 */42 static gss_OID_desc gss_krb5_import_cred_x_oid_desc =43 {6, rk_UNCONST("\x2a\x85\x70\x2b\x0d\x12")};44 45 gss_OID GSS_KRB5_IMPORT_CRED_X = &gss_krb5_import_cred_x_oid_desc;46 47 48 34 49 35 static OM_uint32 … … 231 217 232 218 233 OM_uint32 219 OM_uint32 GSSAPI_CALLCONV 234 220 _gsskrb5_set_cred_option 235 221 (OM_uint32 *minor_status, -
trunk/server/source4/heimdal/lib/gssapi/krb5/set_sec_context_option.c
r414 r745 99 99 } 100 100 101 OM_uint32 101 OM_uint32 GSSAPI_CALLCONV 102 102 _gsskrb5_set_sec_context_option 103 103 (OM_uint32 *minor_status, -
trunk/server/source4/heimdal/lib/gssapi/krb5/store_cred.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 OM_uint32 36 OM_uint32 GSSAPI_CALLCONV 37 37 _gsskrb5_store_cred(OM_uint32 *minor_status, 38 38 gss_cred_id_t input_cred_handle, -
trunk/server/source4/heimdal/lib/gssapi/krb5/unwrap.c
r414 r745 34 34 #include "gsskrb5_locl.h" 35 35 36 #ifdef HEIM_WEAK_CRYPTO 37 36 38 static OM_uint32 37 39 unwrap_des … … 47 49 u_char *p, *seq; 48 50 size_t len; 49 MD5_CTXmd5;51 EVP_MD_CTX *md5; 50 52 u_char hash[16]; 53 EVP_CIPHER_CTX des_ctx; 51 54 DES_key_schedule schedule; 52 55 DES_cblock deskey; … … 99 102 for (i = 0; i < sizeof(deskey); ++i) 100 103 deskey[i] ^= 0xf0; 101 DES_set_key_unchecked (&deskey, &schedule); 102 memset (&zero, 0, sizeof(zero)); 103 DES_cbc_encrypt ((void *)p, 104 (void *)p, 105 input_message_buffer->length - len, 106 &schedule, 107 &zero, 108 DES_DECRYPT); 109 110 memset (deskey, 0, sizeof(deskey)); 104 105 106 EVP_CIPHER_CTX_init(&des_ctx); 107 EVP_CipherInit_ex(&des_ctx, EVP_des_cbc(), NULL, deskey, zero, 0); 108 EVP_Cipher(&des_ctx, p, p, input_message_buffer->length - len); 109 EVP_CIPHER_CTX_cleanup(&des_ctx); 110 111 111 memset (&schedule, 0, sizeof(schedule)); 112 112 } … … 123 123 } 124 124 125 MD5_Init (&md5); 126 MD5_Update (&md5, p - 24, 8); 127 MD5_Update (&md5, p, input_message_buffer->length - len); 128 MD5_Final (hash, &md5); 125 md5 = EVP_MD_CTX_create(); 126 EVP_DigestInit_ex(md5, EVP_md5(), NULL); 127 EVP_DigestUpdate(md5, p - 24, 8); 128 EVP_DigestUpdate(md5, p, input_message_buffer->length - len); 129 EVP_DigestFinal_ex(md5, hash, NULL); 130 EVP_MD_CTX_destroy(md5); 129 131 130 132 memset (&zero, 0, sizeof(zero)); … … 133 135 DES_cbc_cksum ((void *)hash, (void *)hash, sizeof(hash), 134 136 &schedule, &zero); 135 if ( memcmp (p - 8, hash, 8) != 0)137 if (ct_memcmp (p - 8, hash, 8) != 0) 136 138 return GSS_S_BAD_MIC; 137 139 … … 141 143 142 144 p -= 16; 143 DES_set_key_unchecked (&deskey, &schedule); 144 DES_cbc_encrypt ((void *)p, (void *)p, 8, 145 &schedule, (DES_cblock *)hash, DES_DECRYPT); 145 146 EVP_CIPHER_CTX_init(&des_ctx); 147 EVP_CipherInit_ex(&des_ctx, EVP_des_cbc(), NULL, key->keyvalue.data, hash, 0); 148 EVP_Cipher(&des_ctx, p, p, 8); 149 EVP_CIPHER_CTX_cleanup(&des_ctx); 146 150 147 151 memset (deskey, 0, sizeof(deskey)); … … 152 156 153 157 if (context_handle->more_flags & LOCAL) 154 cmp = memcmp(&seq[4], "\xff\xff\xff\xff", 4);158 cmp = ct_memcmp(&seq[4], "\xff\xff\xff\xff", 4); 155 159 else 156 cmp = memcmp(&seq[4], "\x00\x00\x00\x00", 4);160 cmp = ct_memcmp(&seq[4], "\x00\x00\x00\x00", 4); 157 161 158 162 if (cmp != 0) { … … 181 185 return GSS_S_COMPLETE; 182 186 } 187 #endif 183 188 184 189 static OM_uint32 … … 225 230 return GSS_S_BAD_SIG; 226 231 p += 2; 227 if ( memcmp (p, "\x02\x00", 2) == 0) {232 if (ct_memcmp (p, "\x02\x00", 2) == 0) { 228 233 cstate = 1; 229 } else if ( memcmp (p, "\xff\xff", 2) == 0) {234 } else if (ct_memcmp (p, "\xff\xff", 2) == 0) { 230 235 cstate = 0; 231 236 } else … … 234 239 if(conf_state != NULL) 235 240 *conf_state = cstate; 236 if ( memcmp (p, "\xff\xff", 2) != 0)241 if (ct_memcmp (p, "\xff\xff", 2) != 0) 237 242 return GSS_S_DEFECTIVE_TOKEN; 238 243 p += 2; … … 315 320 316 321 if (context_handle->more_flags & LOCAL) 317 cmp = memcmp(&seq[4], "\xff\xff\xff\xff", 4);322 cmp = ct_memcmp(&seq[4], "\xff\xff\xff\xff", 4); 318 323 else 319 cmp = memcmp(&seq[4], "\x00\x00\x00\x00", 4);324 cmp = ct_memcmp(&seq[4], "\x00\x00\x00\x00", 4); 320 325 321 326 krb5_data_free (&seq_data); … … 375 380 } 376 381 377 OM_uint32 _gsskrb5_unwrap382 OM_uint32 GSSAPI_CALLCONV _gsskrb5_unwrap 378 383 (OM_uint32 * minor_status, 379 384 const gss_ctx_id_t context_handle, … … 415 420 switch (keytype) { 416 421 case KEYTYPE_DES : 422 #ifdef HEIM_WEAK_CRYPTO 417 423 ret = unwrap_des (minor_status, ctx, 418 424 input_message_buffer, output_message_buffer, 419 425 conf_state, qop_state, key); 426 #else 427 ret = GSS_S_FAILURE; 428 #endif 420 429 break; 421 430 case KEYTYPE_DES3 : -
trunk/server/source4/heimdal/lib/gssapi/krb5/verify_mic.c
r414 r745 33 33 34 34 #include "gsskrb5_locl.h" 35 36 #ifdef HEIM_WEAK_CRYPTO 35 37 36 38 static OM_uint32 … … 47 49 { 48 50 u_char *p; 49 MD5_CTXmd5;51 EVP_MD_CTX *md5; 50 52 u_char hash[16], *seq; 51 53 DES_key_schedule schedule; 54 EVP_CIPHER_CTX des_ctx; 52 55 DES_cblock zero; 53 56 DES_cblock deskey; … … 73 76 74 77 /* verify checksum */ 75 MD5_Init (&md5); 76 MD5_Update (&md5, p - 24, 8); 77 MD5_Update (&md5, message_buffer->value, 78 message_buffer->length); 79 MD5_Final (hash, &md5); 78 md5 = EVP_MD_CTX_create(); 79 EVP_DigestInit_ex(md5, EVP_md5(), NULL); 80 EVP_DigestUpdate(md5, p - 24, 8); 81 EVP_DigestUpdate(md5, message_buffer->value, message_buffer->length); 82 EVP_DigestFinal_ex(md5, hash, NULL); 83 EVP_MD_CTX_destroy(md5); 80 84 81 85 memset (&zero, 0, sizeof(zero)); … … 85 89 DES_cbc_cksum ((void *)hash, (void *)hash, sizeof(hash), 86 90 &schedule, &zero); 87 if ( memcmp (p - 8, hash, 8) != 0) {91 if (ct_memcmp (p - 8, hash, 8) != 0) { 88 92 memset (deskey, 0, sizeof(deskey)); 89 93 memset (&schedule, 0, sizeof(schedule)); … … 96 100 97 101 p -= 16; 98 DES_set_key_unchecked (&deskey, &schedule); 99 DES_cbc_encrypt ((void *)p, (void *)p, 8, 100 &schedule, (DES_cblock *)hash, DES_DECRYPT); 102 103 EVP_CIPHER_CTX_init(&des_ctx); 104 EVP_CipherInit_ex(&des_ctx, EVP_des_cbc(), NULL, key->keyvalue.data, hash, 0); 105 EVP_Cipher(&des_ctx, p, p, 8); 106 EVP_CIPHER_CTX_cleanup(&des_ctx); 101 107 102 108 memset (deskey, 0, sizeof(deskey)); … … 107 113 108 114 if (context_handle->more_flags & LOCAL) 109 cmp = memcmp(&seq[4], "\xff\xff\xff\xff", 4);115 cmp = ct_memcmp(&seq[4], "\xff\xff\xff\xff", 4); 110 116 else 111 cmp = memcmp(&seq[4], "\x00\x00\x00\x00", 4);117 cmp = ct_memcmp(&seq[4], "\x00\x00\x00\x00", 4); 112 118 113 119 if (cmp != 0) { … … 126 132 return GSS_S_COMPLETE; 127 133 } 134 #endif 128 135 129 136 static OM_uint32 … … 208 215 209 216 if (context_handle->more_flags & LOCAL) 210 cmp = memcmp(&seq[4], "\xff\xff\xff\xff", 4);217 cmp = ct_memcmp(&seq[4], "\xff\xff\xff\xff", 4); 211 218 else 212 cmp = memcmp(&seq[4], "\x00\x00\x00\x00", 4);219 cmp = ct_memcmp(&seq[4], "\x00\x00\x00\x00", 4); 213 220 214 221 krb5_data_free (&seq_data); … … 293 300 switch (keytype) { 294 301 case KEYTYPE_DES : 302 #ifdef HEIM_WEAK_CRYPTO 295 303 ret = verify_mic_des (minor_status, ctx, context, 296 304 message_buffer, token_buffer, qop_state, key, 297 305 type); 306 #else 307 ret = GSS_S_FAILURE; 308 #endif 298 309 break; 299 310 case KEYTYPE_DES3 : … … 317 328 } 318 329 319 OM_uint32 330 OM_uint32 GSSAPI_CALLCONV 320 331 _gsskrb5_verify_mic 321 332 (OM_uint32 * minor_status, -
trunk/server/source4/heimdal/lib/gssapi/krb5/wrap.c
r414 r745 135 135 } 136 136 137 OM_uint32 137 OM_uint32 GSSAPI_CALLCONV 138 138 _gsskrb5_wrap_size_limit ( 139 139 OM_uint32 * minor_status, … … 169 169 switch (keytype) { 170 170 case KEYTYPE_DES : 171 #ifdef HEIM_WEAK_CRYPTO 171 172 ret = sub_wrap_size(req_output_size, max_input_size, 8, 22); 173 #else 174 ret = GSS_S_FAILURE; 175 #endif 172 176 break; 173 177 case KEYTYPE_ARCFOUR: … … 188 192 return ret; 189 193 } 194 195 #ifdef HEIM_WEAK_CRYPTO 190 196 191 197 static OM_uint32 … … 203 209 { 204 210 u_char *p; 205 MD5_CTXmd5;211 EVP_MD_CTX *md5; 206 212 u_char hash[16]; 207 213 DES_key_schedule schedule; 214 EVP_CIPHER_CTX des_ctx; 208 215 DES_cblock deskey; 209 216 DES_cblock zero; … … 263 270 264 271 /* checksum */ 265 MD5_Init (&md5); 266 MD5_Update (&md5, p - 24, 8); 267 MD5_Update (&md5, p, datalen); 268 MD5_Final (hash, &md5); 272 md5 = EVP_MD_CTX_create(); 273 EVP_DigestInit_ex(md5, EVP_md5(), NULL); 274 EVP_DigestUpdate(md5, p - 24, 8); 275 EVP_DigestUpdate(md5, p, datalen); 276 EVP_DigestFinal_ex(md5, hash, NULL); 277 EVP_MD_CTX_destroy(md5); 269 278 270 279 memset (&zero, 0, sizeof(zero)); … … 290 299 4); 291 300 292 DES_set_key_unchecked (&deskey, &schedule); 293 DES_cbc_encrypt ((void *)p, (void *)p, 8, 294 &schedule, (DES_cblock *)(p + 8), DES_ENCRYPT); 301 EVP_CIPHER_CTX_init(&des_ctx); 302 EVP_CipherInit_ex(&des_ctx, EVP_des_cbc(), NULL, key->keyvalue.data, p + 8, 1); 303 EVP_Cipher(&des_ctx, p, p, 8); 304 EVP_CIPHER_CTX_cleanup(&des_ctx); 295 305 296 306 krb5_auth_con_setlocalseqnumber (context, … … 307 317 for (i = 0; i < sizeof(deskey); ++i) 308 318 deskey[i] ^= 0xf0; 309 DES_set_key_unchecked (&deskey, &schedule); 310 memset (&zero, 0, sizeof(zero)); 311 DES_cbc_encrypt ((void *)p, 312 (void *)p, 313 datalen, 314 &schedule, 315 &zero, 316 DES_ENCRYPT); 319 320 EVP_CIPHER_CTX_init(&des_ctx); 321 EVP_CipherInit_ex(&des_ctx, EVP_des_cbc(), NULL, deskey, zero, 1); 322 EVP_Cipher(&des_ctx, p, p, datalen); 323 EVP_CIPHER_CTX_cleanup(&des_ctx); 317 324 } 318 325 memset (deskey, 0, sizeof(deskey)); … … 324 331 return GSS_S_COMPLETE; 325 332 } 333 334 #endif 326 335 327 336 static OM_uint32 … … 516 525 } 517 526 518 OM_uint32 _gsskrb5_wrap 527 OM_uint32 GSSAPI_CALLCONV 528 _gsskrb5_wrap 519 529 (OM_uint32 * minor_status, 520 530 const gss_ctx_id_t context_handle, … … 553 563 switch (keytype) { 554 564 case KEYTYPE_DES : 565 #ifdef HEIM_WEAK_CRYPTO 555 566 ret = wrap_des (minor_status, ctx, context, conf_req_flag, 556 567 qop_req, input_message_buffer, conf_state, 557 568 output_message_buffer, key); 569 #else 570 ret = GSS_S_FAILURE; 571 #endif 558 572 break; 559 573 case KEYTYPE_DES3 : -
trunk/server/source4/heimdal/lib/gssapi/mech/context.c
r414 r745 1 1 #include "mech_locl.h" 2 2 #include "heim_threads.h" 3 4 RCSID("$Id$");5 3 6 4 struct mg_thread_ctx { … … 88 86 if (value != mg->maj_stat || mg->maj_error.length == 0) 89 87 break; 90 string->value = malloc(mg->maj_error.length );88 string->value = malloc(mg->maj_error.length + 1); 91 89 string->length = mg->maj_error.length; 92 90 memcpy(string->value, mg->maj_error.value, mg->maj_error.length); 91 ((char *) string->value)[string->length] = '\0'; 93 92 return GSS_S_COMPLETE; 94 93 } … … 96 95 if (value != mg->min_stat || mg->min_error.length == 0) 97 96 break; 98 string->value = malloc(mg->min_error.length );97 string->value = malloc(mg->min_error.length + 1); 99 98 string->length = mg->min_error.length; 100 99 memcpy(string->value, mg->min_error.value, mg->min_error.length); 100 ((char *) string->value)[string->length] = '\0'; 101 101 return GSS_S_COMPLETE; 102 102 } -
trunk/server/source4/heimdal/lib/gssapi/mech/cred.h
r414 r745 29 29 30 30 struct _gss_mechanism_cred { 31 SLIST_ENTRY(_gss_mechanism_cred) gmc_link;31 HEIM_SLIST_ENTRY(_gss_mechanism_cred) gmc_link; 32 32 gssapi_mech_interface gmc_mech; /* mechanism ops for MC */ 33 33 gss_OID gmc_mech_oid; /* mechanism oid for MC */ 34 34 gss_cred_id_t gmc_cred; /* underlying MC */ 35 35 }; 36 SLIST_HEAD(_gss_mechanism_cred_list, _gss_mechanism_cred);36 HEIM_SLIST_HEAD(_gss_mechanism_cred_list, _gss_mechanism_cred); 37 37 38 38 struct _gss_cred { -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_accept_sec_context.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 static OM_uint32 … … 143 142 144 143 145 OM_uint32 gss_accept_sec_context(OM_uint32 *minor_status, 144 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 145 gss_accept_sec_context(OM_uint32 *minor_status, 146 146 gss_ctx_id_t *context_handle, 147 147 const gss_cred_id_t acceptor_cred_handle, … … 162 162 gss_cred_id_t acceptor_mc, delegated_mc; 163 163 gss_name_t src_mn; 164 gss_OID mech_ret_type = NULL; 164 165 165 166 *minor_status = 0; … … 209 210 210 211 if (cred) { 211 SLIST_FOREACH(mc, &cred->gc_mc, gmc_link)212 HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) 212 213 if (mc->gmc_mech == m) 213 214 break; … … 229 230 input_chan_bindings, 230 231 &src_mn, 231 mech_type,232 &mech_ret_type, 232 233 output_token, 233 234 &mech_ret_flags, … … 242 243 } 243 244 245 if (mech_type) 246 *mech_type = mech_ret_type; 247 244 248 if (src_name && src_mn) { 245 249 /* … … 261 265 if (!delegated_cred_handle) { 262 266 m->gm_release_cred(minor_status, &delegated_mc); 263 if (ret_flags) 264 *ret_flags &= ~GSS_C_DELEG_FLAG; 267 mech_ret_flags &= 268 ~(GSS_C_DELEG_FLAG|GSS_C_DELEG_POLICY_FLAG); 269 } else if (gss_oid_equal(mech_ret_type, &m->gm_mech_oid) == 0) { 270 /* 271 * If the returned mech_type is not the same 272 * as the mech, assume its pseudo mech type 273 * and the returned type is already a 274 * mech-glue object 275 */ 276 *delegated_cred_handle = delegated_mc; 277 265 278 } else if (delegated_mc) { 266 279 struct _gss_cred *dcred; … … 273 286 return (GSS_S_FAILURE); 274 287 } 275 SLIST_INIT(&dcred->gc_mc);288 HEIM_SLIST_INIT(&dcred->gc_mc); 276 289 dmc = malloc(sizeof(struct _gss_mechanism_cred)); 277 290 if (!dmc) { … … 284 297 dmc->gmc_mech_oid = &m->gm_mech_oid; 285 298 dmc->gmc_cred = delegated_mc; 286 SLIST_INSERT_HEAD(&dcred->gc_mc, dmc, gmc_link);299 HEIM_SLIST_INSERT_HEAD(&dcred->gc_mc, dmc, gmc_link); 287 300 288 301 *delegated_cred_handle = (gss_cred_id_t) dcred; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_acquire_cred.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_acquire_cred(OM_uint32 *minor_status, 34 33 const gss_name_t desired_name, … … 92 91 return (GSS_S_FAILURE); 93 92 } 94 SLIST_INIT(&cred->gc_mc);93 HEIM_SLIST_INIT(&cred->gc_mc); 95 94 96 95 if (mechs == GSS_C_NO_OID_SET) … … 147 146 } 148 147 149 SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link);148 HEIM_SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link); 150 149 } 151 150 … … 154 153 * an error. 155 154 */ 156 if (! SLIST_FIRST(&cred->gc_mc)) {155 if (!HEIM_SLIST_FIRST(&cred->gc_mc)) { 157 156 free(cred); 158 157 if (actual_mechs) -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_add_cred.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 static struct _gss_mechanism_cred * … … 72 71 } 73 72 74 OM_uint32 GSSAPI_LIB_FUNCTION 73 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 75 74 gss_add_cred(OM_uint32 *minor_status, 76 75 const gss_cred_id_t input_cred_handle, … … 108 107 return (GSS_S_FAILURE); 109 108 } 110 SLIST_INIT(&new_cred->gc_mc);109 HEIM_SLIST_INIT(&new_cred->gc_mc); 111 110 112 111 /* … … 118 117 target_mc = 0; 119 118 if (cred) { 120 SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {119 HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { 121 120 if (gss_oid_equal(mc->gmc_mech_oid, desired_mech)) { 122 121 target_mc = mc; … … 129 128 return (GSS_S_FAILURE); 130 129 } 131 SLIST_INSERT_HEAD(&new_cred->gc_mc, copy_mc, gmc_link);130 HEIM_SLIST_INSERT_HEAD(&new_cred->gc_mc, copy_mc, gmc_link); 132 131 } 133 132 } … … 180 179 return (major_status); 181 180 } 182 SLIST_INSERT_HEAD(&new_cred->gc_mc, mc, gmc_link);181 HEIM_SLIST_INSERT_HEAD(&new_cred->gc_mc, mc, gmc_link); 183 182 *output_cred_handle = (gss_cred_id_t) new_cred; 184 183 -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_add_oid_set_member.c
r414 r745 33 33 34 34 #include "mech_locl.h" 35 RCSID("$Id$");36 35 37 OM_uint32 GSSAPI_LIB_FUNCTION 36 /** 37 * Add a oid to the oid set, function does not make a copy of the oid, 38 * so the pointer to member_oid needs to be stable for the whole time 39 * oid_set is used. 40 * 41 * If there is a duplicate member of the oid, the new member is not 42 * added to to the set. 43 * 44 * @param minor_status minor status code. 45 * @param member_oid member to add to the oid set 46 * @param oid_set oid set to add the member too 47 * 48 * @returns a gss_error code, see gss_display_status() about printing 49 * the error code. 50 * 51 * @ingroup gssapi 52 */ 53 54 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 38 55 gss_add_oid_set_member (OM_uint32 * minor_status, 39 56 const gss_OID member_oid, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_aeap.c
r414 r745 44 44 45 45 46 OM_uint32 GSSAPI_LIB_FUNCTION 46 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 47 47 gss_wrap_iov(OM_uint32 * minor_status, 48 48 gss_ctx_id_t context_handle, … … 82 82 */ 83 83 84 OM_uint32 GSSAPI_LIB_FUNCTION 84 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 85 85 gss_unwrap_iov(OM_uint32 *minor_status, 86 86 gss_ctx_id_t context_handle, … … 125 125 */ 126 126 127 OM_uint32 GSSAPI_LIB_FUNCTION 127 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 128 128 gss_wrap_iov_length(OM_uint32 * minor_status, 129 129 gss_ctx_id_t context_handle, … … 158 158 /** 159 159 * Free all buffer allocated by gss_wrap_iov() or gss_unwrap_iov() by 160 * looking at the GSS_IOV_BUFFER_ TYPE_FLAG_ALLOCATED flag.161 * 162 * @ingroup gssapi 163 */ 164 165 OM_uint32 GSSAPI_LIB_FUNCTION 160 * looking at the GSS_IOV_BUFFER_FLAG_ALLOCATED flag. 161 * 162 * @ingroup gssapi 163 */ 164 165 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 166 166 gss_release_iov_buffer(OM_uint32 *minor_status, 167 167 gss_iov_buffer_desc *iov, … … 177 177 178 178 for (i = 0; i < iov_count; i++) { 179 if ((iov[i].type & GSS_IOV_BUFFER_ TYPE_FLAG_ALLOCATED) == 0)179 if ((iov[i].type & GSS_IOV_BUFFER_FLAG_ALLOCATED) == 0) 180 180 continue; 181 181 gss_release_buffer(&junk, &iov[i].buffer); 182 iov[i].type &= ~GSS_IOV_BUFFER_ TYPE_FLAG_ALLOCATED;182 iov[i].type &= ~GSS_IOV_BUFFER_FLAG_ALLOCATED; 183 183 } 184 184 return GSS_S_COMPLETE; … … 195 195 */ 196 196 197 static gss_OID_desc gss_c_attr_stream_sizes_desc =197 gss_OID_desc GSSAPI_LIB_FUNCTION __gss_c_attr_stream_sizes_oid_desc = 198 198 {10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03")}; 199 199 200 gss_OID GSSAPI_LIB_VARIABLE GSS_C_ATTR_STREAM_SIZES = 201 &gss_c_attr_stream_sizes_desc; 202 203 OM_uint32 GSSAPI_LIB_FUNCTION 200 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 204 201 gss_context_query_attributes(OM_uint32 *minor_status, 205 gss_OID attribute, 202 const gss_ctx_id_t context_handle, 203 const gss_OID attribute, 206 204 void *data, 207 205 size_t len) -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_buffer_set.c
r414 r745 32 32 33 33 #include "mech_locl.h" 34 RCSID("$Id$");35 34 36 OM_uint32 GSSAPI_LIB_FUNCTION 35 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 36 gss_create_empty_buffer_set 38 37 (OM_uint32 * minor_status, … … 56 55 } 57 56 58 OM_uint32 GSSAPI_LIB_FUNCTION 57 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 59 58 gss_add_buffer_set_member 60 59 (OM_uint32 * minor_status, … … 98 97 } 99 98 100 OM_uint32 GSSAPI_LIB_FUNCTION 99 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 101 100 gss_release_buffer_set(OM_uint32 * minor_status, 102 101 gss_buffer_set_t *buffer_set) -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_canonicalize_name.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 /** … … 54 53 */ 55 54 56 OM_uint32 GSSAPI_LIB_FUNCTION 55 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 57 56 gss_canonicalize_name(OM_uint32 *minor_status, 58 57 const gss_name_t input_name, … … 101 100 } 102 101 103 SLIST_INIT(&name->gn_mn);102 HEIM_SLIST_INIT(&name->gn_mn); 104 103 mn->gmn_mech = m; 105 104 mn->gmn_mech_oid = &m->gm_mech_oid; 106 105 mn->gmn_name = new_canonical_name; 107 SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);106 HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link); 108 107 109 108 *output_name = (gss_name_t) name; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_compare_name.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_compare_name(OM_uint32 *minor_status, 34 33 const gss_name_t name1_arg, … … 57 56 struct _gss_mechanism_name *mn2; 58 57 59 SLIST_FOREACH(mn1, &name1->gn_mn, gmn_link) {58 HEIM_SLIST_FOREACH(mn1, &name1->gn_mn, gmn_link) { 60 59 OM_uint32 major_status; 61 60 -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_context_time.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_context_time(OM_uint32 *minor_status, 34 33 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_create_empty_oid_set.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_create_empty_oid_set(OM_uint32 *minor_status, 34 33 gss_OID_set *oid_set) -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_cred.c
r414 r745 43 43 */ 44 44 45 OM_uint32 GSSAPI_LIB_FUNCTION 45 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 46 46 gss_export_cred(OM_uint32 * minor_status, 47 47 gss_cred_id_t cred_handle, … … 63 63 } 64 64 65 SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {65 HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { 66 66 if (mc->gmc_mech->gm_export_cred == NULL) { 67 67 *minor_status = 0; … … 76 76 } 77 77 78 SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {78 HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { 79 79 80 80 major = mc->gmc_mech->gm_export_cred(minor_status, … … 108 108 } 109 109 110 OM_uint32 GSSAPI_LIB_FUNCTION 110 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 111 111 gss_import_cred(OM_uint32 * minor_status, 112 112 gss_buffer_t token, … … 139 139 return GSS_S_FAILURE; 140 140 } 141 SLIST_INIT(&cred->gc_mc);141 HEIM_SLIST_INIT(&cred->gc_mc); 142 142 143 143 *cred_handle = (gss_cred_id_t)cred; … … 202 202 mc->gmc_cred = mcred; 203 203 204 SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link);204 HEIM_SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link); 205 205 } 206 206 krb5_storage_free(sp); 207 207 sp = NULL; 208 208 209 if ( SLIST_EMPTY(&cred->gc_mc)) {209 if (HEIM_SLIST_EMPTY(&cred->gc_mc)) { 210 210 major = GSS_S_NO_CRED; 211 211 goto out; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_decapsulate_token.c
r414 r745 33 33 34 34 #include "mech_locl.h" 35 RCSID("$Id$");36 35 37 OM_uint32 GSSAPI_LIB_FUNCTION 38 gss_decapsulate_token( gss_buffer_t input_token,39 gss_OID oid,36 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 gss_decapsulate_token(const gss_buffer_t input_token, 38 const gss_OID oid, 40 39 gss_buffer_t output_token) 41 40 { -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_delete_sec_context.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_delete_sec_context(OM_uint32 *minor_status, 34 33 gss_ctx_id_t *context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_display_name.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_display_name(OM_uint32 *minor_status, 34 33 const gss_name_t input_name, … … 69 68 return (GSS_S_COMPLETE); 70 69 } else { 71 SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {70 HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) { 72 71 major_status = mn->gmn_mech->gm_display_name( 73 72 minor_status, mn->gmn_name, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_display_status.c
r414 r745 60 60 61 61 #include "mech_locl.h" 62 RCSID("$Id$");63 62 64 63 static const char * … … 137 136 138 137 139 OM_uint32 GSSAPI_LIB_FUNCTION 138 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 140 139 gss_display_status(OM_uint32 *minor_status, 141 140 OM_uint32 status_value, … … 162 161 switch (status_type) { 163 162 case GSS_C_GSS_CODE: { 164 char *buf; 163 char *buf = NULL; 164 int e; 165 165 166 166 if (GSS_SUPPLEMENTARY_INFO(status_value)) 167 asprintf(&buf, "%s", supplementary_error(167 e = asprintf(&buf, "%s", supplementary_error( 168 168 GSS_SUPPLEMENTARY_INFO(status_value))); 169 169 else 170 asprintf (&buf, "%s %s",170 e = asprintf (&buf, "%s %s", 171 171 calling_error(GSS_CALLING_ERROR(status_value)), 172 172 routine_error(GSS_ROUTINE_ERROR(status_value))); 173 173 174 if ( buf == NULL)174 if (e < 0 || buf == NULL) 175 175 break; 176 176 … … 183 183 OM_uint32 maj_junk, min_junk; 184 184 gss_buffer_desc oid; 185 char *buf; 185 char *buf = NULL; 186 int e; 186 187 187 188 maj_junk = gss_oid_to_str(&min_junk, mech_type, &oid); … … 190 191 oid.length = 7; 191 192 } 192 193 asprintf (&buf, "unknown mech-code %lu for mech %.*s",193 194 e = asprintf (&buf, "unknown mech-code %lu for mech %.*s", 194 195 (unsigned long)status_value, 195 196 (int)oid.length, (char *)oid.value); … … 197 198 gss_release_buffer(&min_junk, &oid); 198 199 199 if ( buf == NULL)200 if (e < 0 || buf == NULL) 200 201 break; 201 202 -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_duplicate_name.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 gss_duplicate_name(OM_uint32 *minor_status, 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 32 gss_duplicate_name(OM_uint32 *minor_status, 33 33 const gss_name_t src_name, 34 34 gss_name_t *dest_name) … … 54 54 new_name = (struct _gss_name *) *dest_name; 55 55 56 SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {56 HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) { 57 57 struct _gss_mechanism_name *mn2; 58 58 _gss_find_mn(minor_status, new_name, … … 66 66 } 67 67 memset(new_name, 0, sizeof(struct _gss_name)); 68 SLIST_INIT(&new_name->gn_mn);68 HEIM_SLIST_INIT(&new_name->gn_mn); 69 69 *dest_name = (gss_name_t) new_name; 70 70 71 SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {71 HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) { 72 72 struct _gss_mechanism_name *new_mn; 73 73 … … 87 87 continue; 88 88 } 89 SLIST_INSERT_HEAD(&new_name->gn_mn, new_mn, gmn_link);89 HEIM_SLIST_INSERT_HEAD(&new_name->gn_mn, new_mn, gmn_link); 90 90 } 91 91 -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_duplicate_oid.c
r414 r745 33 33 34 34 #include "mech_locl.h" 35 RCSID("$Id$");36 35 37 OM_uint32 gss_duplicate_oid ( 36 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 gss_duplicate_oid ( 38 38 OM_uint32 *minor_status, 39 39 gss_OID src_oid, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_encapsulate_token.c
r414 r745 33 33 34 34 #include "mech_locl.h" 35 RCSID("$Id$");36 35 37 OM_uint32 GSSAPI_LIB_FUNCTION 38 gss_encapsulate_token( gss_buffer_t input_token,39 gss_OID oid,36 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 gss_encapsulate_token(const gss_buffer_t input_token, 38 const gss_OID oid, 40 39 gss_buffer_t output_token) 41 40 { -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_export_name.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_export_name(OM_uint32 *minor_status, 34 33 const gss_name_t input_name, … … 45 44 * list. 46 45 */ 47 mn = SLIST_FIRST(&name->gn_mn);46 mn = HEIM_SLIST_FIRST(&name->gn_mn); 48 47 if (!mn) { 49 48 *minor_status = 0; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_export_sec_context.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_export_sec_context(OM_uint32 *minor_status, 34 33 gss_ctx_id_t *context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_get_mic.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_get_mic(OM_uint32 *minor_status, 34 33 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_import_name.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 static OM_uint32 … … 140 139 } 141 140 142 OM_uint32 GSSAPI_LIB_FUNCTION 141 /** 142 * Import a name internal or mechanism name 143 * 144 * Type of name and their format: 145 * - GSS_C_NO_OID 146 * - GSS_C_NT_USER_NAME 147 * - GSS_C_NT_HOSTBASED_SERVICE 148 * - GSS_C_NT_EXPORT_NAME 149 * - GSS_C_NT_ANONYMOUS 150 * - GSS_KRB5_NT_PRINCIPAL_NAME 151 * 152 * For more information about @ref internalVSmechname. 153 * 154 * @param minor_status minor status code 155 * @param input_name_buffer import name buffer 156 * @param input_name_type type of the import name buffer 157 * @param output_name the resulting type, release with 158 * gss_release_name(), independent of input_name 159 * 160 * @returns a gss_error code, see gss_display_status() about printing 161 * the error code. 162 * 163 * @ingroup gssapi 164 */ 165 166 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 143 167 gss_import_name(OM_uint32 *minor_status, 144 168 const gss_buffer_t input_name_buffer, … … 186 210 } 187 211 188 SLIST_INIT(&name->gn_mn);212 HEIM_SLIST_INIT(&name->gn_mn); 189 213 190 214 major_status = _gss_copy_oid(minor_status, … … 205 229 */ 206 230 207 SLIST_FOREACH(m, &_gss_mechs, gm_link) {231 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 208 232 int present = 0; 209 233 … … 234 258 mn->gmn_mech = &m->gm_mech; 235 259 mn->gmn_mech_oid = &m->gm_mech_oid; 236 SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);260 HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link); 237 261 } 238 262 … … 241 265 */ 242 266 243 mn = SLIST_FIRST(&name->gn_mn);267 mn = HEIM_SLIST_FIRST(&name->gn_mn); 244 268 if (!mn) { 245 269 *minor_status = 0; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_import_sec_context.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_import_sec_context(OM_uint32 *minor_status, 34 33 const gss_buffer_t interprocess_token, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_indicate_mechs.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_indicate_mechs(OM_uint32 *minor_status, 34 33 gss_OID_set *mech_set) … … 45 44 return (major_status); 46 45 47 SLIST_FOREACH(m, &_gss_mechs, gm_link) {46 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 48 47 if (m->gm_mech.gm_indicate_mechs) { 49 48 major_status = m->gm_mech.gm_indicate_mechs( -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_init_sec_context.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 static gss_cred_id_t … … 39 38 return GSS_C_NO_CREDENTIAL; 40 39 41 SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {40 HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { 42 41 if (gss_oid_equal(mech_type, mc->gmc_mech_oid)) 43 42 return mc->gmc_cred; … … 46 45 } 47 46 48 OM_uint32 GSSAPI_LIB_FUNCTION 47 /** 48 * As the initiator build a context with an acceptor. 49 * 50 * Returns in the major 51 * - GSS_S_COMPLETE - if the context if build 52 * - GSS_S_CONTINUE_NEEDED - if the caller needs to continue another 53 * round of gss_i nit_sec_context 54 * - error code - any other error code 55 * 56 * @param minor_status minor status code. 57 * 58 * @param initiator_cred_handle the credential to use when building 59 * the context, if GSS_C_NO_CREDENTIAL is passed, the default 60 * credential for the mechanism will be used. 61 * 62 * @param context_handle a pointer to a context handle, will be 63 * returned as long as there is not an error. 64 * 65 * @param target_name the target name of acceptor, created using 66 * gss_import_name(). The name is can be of any name types the 67 * mechanism supports, check supported name types with 68 * gss_inquire_names_for_mech(). 69 * 70 * @param input_mech_type mechanism type to use, if GSS_C_NO_OID is 71 * used, Kerberos (GSS_KRB5_MECHANISM) will be tried. Other 72 * available mechanism are listed in the @ref gssapi_mechs_intro 73 * section. 74 * 75 * @param req_flags flags using when building the context, see @ref 76 * gssapi_context_flags 77 * 78 * @param time_req time requested this context should be valid in 79 * seconds, common used value is GSS_C_INDEFINITE 80 * 81 * @param input_chan_bindings Channel bindings used, if not exepected 82 * otherwise, used GSS_C_NO_CHANNEL_BINDINGS 83 * 84 * @param input_token input token sent from the acceptor, for the 85 * initial packet the buffer of { NULL, 0 } should be used. 86 * 87 * @param actual_mech_type the actual mech used, MUST NOT be freed 88 * since it pointing to static memory. 89 * 90 * @param output_token if there is an output token, regardless of 91 * complete, continue_needed, or error it should be sent to the 92 * acceptor 93 * 94 * @param ret_flags return what flags was negotitated, caller should 95 * check if they are accetable. For example, if 96 * GSS_C_MUTUAL_FLAG was negotiated with the acceptor or not. 97 * 98 * @param time_rec amount of time this context is valid for 99 * 100 * @returns a gss_error code, see gss_display_status() about printing 101 * the error code. 102 * 103 * @ingroup gssapi 104 */ 105 106 107 108 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 49 109 gss_init_sec_context(OM_uint32 * minor_status, 50 110 const gss_cred_id_t initiator_cred_handle, … … 120 180 * If we have a cred, find the cred for this mechanism. 121 181 */ 122 cred_handle = _gss_mech_cred_find(initiator_cred_handle, mech_type); 182 if (m->gm_flags & GM_USE_MG_CRED) 183 cred_handle = initiator_cred_handle; 184 else 185 cred_handle = _gss_mech_cred_find(initiator_cred_handle, mech_type); 123 186 124 187 major_status = m->gm_init_sec_context(minor_status, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_inquire_context.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_inquire_context(OM_uint32 *minor_status, 34 33 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_inquire_cred.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 #define AUSAGE 1 … … 44 43 } 45 44 46 OM_uint32 GSSAPI_LIB_FUNCTION 45 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 47 46 gss_inquire_cred(OM_uint32 *minor_status, 48 47 const gss_cred_id_t cred_handle, … … 80 79 return (GSS_S_FAILURE); 81 80 } 82 SLIST_INIT(&name->gn_mn);81 HEIM_SLIST_INIT(&name->gn_mn); 83 82 } else { 84 83 name = NULL; … … 98 97 struct _gss_mechanism_cred *mc; 99 98 100 SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {99 HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { 101 100 gss_name_t mc_name; 102 101 OM_uint32 mc_lifetime; … … 118 117 mn->gmn_mech_oid = mc->gmc_mech_oid; 119 118 mn->gmn_name = mc_name; 120 SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);119 HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link); 121 120 } else { 122 121 mc->gmc_mech->gm_release_name(minor_status, … … 133 132 } 134 133 } else { 135 SLIST_FOREACH(m, &_gss_mechs, gm_link) {134 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 136 135 gss_name_t mc_name; 137 136 OM_uint32 mc_lifetime; … … 155 154 mn->gmn_mech_oid = &m->gm_mech_oid; 156 155 mn->gmn_name = mc_name; 157 SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);156 HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link); 158 157 } else if (mc_name) { 159 158 m->gm_mech.gm_release_name(minor_status, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_inquire_cred_by_mech.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_inquire_cred_by_mech(OM_uint32 *minor_status, 34 33 const gss_cred_id_t cred_handle, … … 62 61 if (cred_handle != GSS_C_NO_CREDENTIAL) { 63 62 struct _gss_cred *cred = (struct _gss_cred *) cred_handle; 64 SLIST_FOREACH(mcp, &cred->gc_mc, gmc_link)63 HEIM_SLIST_FOREACH(mcp, &cred->gc_mc, gmc_link) 65 64 if (mcp->gmc_mech == m) 66 65 break; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_inquire_cred_by_oid.c
r414 r745 32 32 33 33 #include "mech_locl.h" 34 RCSID("$Id$");35 34 36 OM_uint32 GSSAPI_LIB_FUNCTION 35 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 36 gss_inquire_cred_by_oid (OM_uint32 *minor_status, 38 37 const gss_cred_id_t cred_handle, … … 52 51 return GSS_S_NO_CRED; 53 52 54 SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {53 HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { 55 54 gss_buffer_set_t rset = GSS_C_NO_BUFFER_SET; 56 55 int i; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_inquire_mechs_for_name.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_inquire_mechs_for_name(OM_uint32 *minor_status, 34 33 const gss_name_t input_name, … … 54 53 * the mechanism to the set. 55 54 */ 56 SLIST_FOREACH(m, &_gss_mechs, gm_link) {55 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 57 56 major_status = gss_inquire_names_for_mech(minor_status, 58 57 &m->gm_mech_oid, &name_types); -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_inquire_names_for_mech.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_inquire_names_for_mech(OM_uint32 *minor_status, 34 33 const gss_OID mechanism, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_inquire_sec_context_by_oid.c
r414 r745 32 32 33 33 #include "mech_locl.h" 34 RCSID("$Id$");35 34 36 OM_uint32 GSSAPI_LIB_FUNCTION 35 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 36 gss_inquire_sec_context_by_oid (OM_uint32 *minor_status, 38 37 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_krb5.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 #include <krb5.h> … … 34 33 35 34 36 OM_uint32 GSSAPI_LIB_FUNCTION 35 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 36 gss_krb5_copy_ccache(OM_uint32 *minor_status, 38 37 gss_cred_id_t cred, … … 44 43 krb5_ccache id; 45 44 OM_uint32 ret; 46 char *str ;45 char *str = NULL; 47 46 48 47 ret = gss_inquire_cred_by_oid(minor_status, … … 69 68 (char *)data_set->elements[0].value); 70 69 gss_release_buffer_set(minor_status, &data_set); 71 if (kret == -1) {70 if (kret < 0 || str == NULL) { 72 71 *minor_status = ENOMEM; 73 72 return GSS_S_FAILURE; … … 92 91 } 93 92 94 OM_uint32 GSSAPI_LIB_FUNCTION 93 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 95 94 gss_krb5_import_cred(OM_uint32 *minor_status, 96 95 krb5_ccache id, … … 187 186 } 188 187 189 OM_uint32 GSSAPI_LIB_FUNCTION 188 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 190 189 gsskrb5_register_acceptor_identity(const char *identity) 191 190 { … … 199 198 buffer.length = strlen(identity); 200 199 201 SLIST_FOREACH(m, &_gss_mechs, gm_link) {200 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 202 201 if (m->gm_mech.gm_set_sec_context_option == NULL) 203 202 continue; … … 209 208 } 210 209 211 OM_uint32 GSSAPI_LIB_FUNCTION 210 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 212 211 krb5_gss_register_acceptor_identity(const char *identity) 213 212 { … … 216 215 217 216 218 OM_uint32 GSSAPI_LIB_FUNCTION 217 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 219 218 gsskrb5_set_dns_canonicalize(int flag) 220 219 { … … 229 228 buffer.length = sizeof(b); 230 229 231 SLIST_FOREACH(m, &_gss_mechs, gm_link) {230 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 232 231 if (m->gm_mech.gm_set_sec_context_option == NULL) 233 232 continue; … … 261 260 } 262 261 263 OM_uint32 GSSAPI_LIB_FUNCTION 262 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 264 263 gss_krb5_export_lucid_sec_context(OM_uint32 *minor_status, 265 264 gss_ctx_id_t *context_handle, … … 404 403 } 405 404 406 OM_uint32 GSSAPI_LIB_FUNCTION 405 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 407 406 gss_krb5_free_lucid_sec_context(OM_uint32 *minor_status, void *c) 408 407 { … … 432 431 */ 433 432 434 OM_uint32 GSSAPI_LIB_FUNCTION 433 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 435 434 gss_krb5_set_allowable_enctypes(OM_uint32 *minor_status, 436 435 gss_cred_id_t cred, … … 486 485 */ 487 486 488 OM_uint32 GSSAPI_LIB_FUNCTION 487 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 489 488 gsskrb5_set_send_to_kdc(struct gsskrb5_send_to_kdc *c) 490 489 { … … 503 502 } 504 503 505 SLIST_FOREACH(m, &_gss_mechs, gm_link) {504 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 506 505 if (m->gm_mech.gm_set_sec_context_option == NULL) 507 506 continue; … … 517 516 */ 518 517 519 OM_uint32 GSSAPI_LIB_FUNCTION 518 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 520 519 gss_krb5_ccache_name(OM_uint32 *minor_status, 521 520 const char *name, … … 534 533 buffer.length = strlen(name); 535 534 536 SLIST_FOREACH(m, &_gss_mechs, gm_link) {535 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 537 536 if (m->gm_mech.gm_set_sec_context_option == NULL) 538 537 continue; … … 549 548 */ 550 549 551 OM_uint32 GSSAPI_LIB_FUNCTION 550 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 552 551 gsskrb5_extract_authtime_from_sec_context(OM_uint32 *minor_status, 553 552 gss_ctx_id_t context_handle, … … 604 603 */ 605 604 606 OM_uint32 GSSAPI_LIB_FUNCTION 605 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 607 606 gsskrb5_extract_authz_data_from_sec_context(OM_uint32 *minor_status, 608 607 gss_ctx_id_t context_handle, … … 777 776 */ 778 777 779 OM_uint32 GSSAPI_LIB_FUNCTION 778 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 780 779 gsskrb5_extract_service_keyblock(OM_uint32 *minor_status, 781 780 gss_ctx_id_t context_handle, … … 788 787 } 789 788 790 OM_uint32 GSSAPI_LIB_FUNCTION 789 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 791 790 gsskrb5_get_initiator_subkey(OM_uint32 *minor_status, 792 791 gss_ctx_id_t context_handle, … … 799 798 } 800 799 801 OM_uint32 GSSAPI_LIB_FUNCTION 800 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 802 801 gsskrb5_get_subkey(OM_uint32 *minor_status, 803 802 gss_ctx_id_t context_handle, … … 810 809 } 811 810 812 OM_uint32 GSSAPI_LIB_FUNCTION 811 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 813 812 gsskrb5_set_default_realm(const char *realm) 814 813 { … … 822 821 buffer.length = strlen(realm); 823 822 824 SLIST_FOREACH(m, &_gss_mechs, gm_link) {823 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 825 824 if (m->gm_mech.gm_set_sec_context_option == NULL) 826 825 continue; … … 832 831 } 833 832 834 OM_uint32 GSSAPI_LIB_FUNCTION 833 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 835 834 gss_krb5_get_tkt_flags(OM_uint32 *minor_status, 836 835 gss_ctx_id_t context_handle, … … 871 870 } 872 871 873 OM_uint32 GSSAPI_LIB_FUNCTION 872 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 874 873 gsskrb5_set_time_offset(int offset) 875 874 { … … 884 883 buffer.length = sizeof(o); 885 884 886 SLIST_FOREACH(m, &_gss_mechs, gm_link) {885 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 887 886 if (m->gm_mech.gm_set_sec_context_option == NULL) 888 887 continue; … … 894 893 } 895 894 896 OM_uint32 GSSAPI_LIB_FUNCTION 895 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 897 896 gsskrb5_get_time_offset(int *offset) 898 897 { … … 907 906 buffer.length = sizeof(o); 908 907 909 SLIST_FOREACH(m, &_gss_mechs, gm_link) {908 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 910 909 if (m->gm_mech.gm_set_sec_context_option == NULL) 911 910 continue; … … 922 921 } 923 922 924 OM_uint32 GSSAPI_LIB_FUNCTION 923 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 925 924 gsskrb5_plugin_register(struct gsskrb5_krb5_plugin *c) 926 925 { … … 934 933 buffer.length = sizeof(*c); 935 934 936 SLIST_FOREACH(m, &_gss_mechs, gm_link) {935 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 937 936 if (m->gm_mech.gm_set_sec_context_option == NULL) 938 937 continue; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_mech_switch.c
r414 r745 29 29 #include "mech_locl.h" 30 30 #include <heim_threads.h> 31 RCSID("$Id$");32 31 33 32 #ifndef _PATH_GSS_MECH … … 178 177 return 0; 179 178 180 m = malloc(sizeof(*m));179 m = calloc(1, sizeof(*m)); 181 180 if (m == NULL) 182 return 1;181 return ENOMEM; 183 182 m->gm_so = NULL; 184 183 m->gm_mech = *mech; … … 189 188 /* pick up the oid sets of names */ 190 189 191 if (m->gm_mech.gm_inquire_names_for_mech) {190 if (m->gm_mech.gm_inquire_names_for_mech) 192 191 (*m->gm_mech.gm_inquire_names_for_mech)(&minor_status, 193 192 &m->gm_mech.gm_mech_oid, &m->gm_name_types); 194 } else { 193 194 if (m->gm_name_types == NULL) 195 195 gss_create_empty_oid_set(&minor_status, &m->gm_name_types); 196 } 197 198 SLIST_INSERT_HEAD(&_gss_mechs, m, gm_link); 196 197 HEIM_SLIST_INSERT_HEAD(&_gss_mechs, m, gm_link); 199 198 return 0; 200 199 } … … 213 212 struct _gss_mech_switch *m; 214 213 void *so; 214 gss_OID_desc mech_oid; 215 int found; 215 216 216 217 217 218 HEIMDAL_MUTEX_lock(&_gss_mech_mutex); 218 219 219 if ( SLIST_FIRST(&_gss_mechs)) {220 if (HEIM_SLIST_FIRST(&_gss_mechs)) { 220 221 HEIMDAL_MUTEX_unlock(&_gss_mech_mutex); 221 222 return; … … 242 243 243 244 while (fgets(buf, sizeof(buf), fp)) { 245 _gss_mo_init *mi; 246 244 247 if (*buf == '#') 245 248 continue; … … 255 258 continue; 256 259 260 if (_gss_string_to_oid(oid, &mech_oid)) 261 continue; 262 263 /* 264 * Check for duplicates, already loaded mechs. 265 */ 266 found = 0; 267 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 268 if (gss_oid_equal(&m->gm_mech.gm_mech_oid, &mech_oid)) { 269 found = 1; 270 free(mech_oid.elements); 271 break; 272 } 273 } 274 if (found) 275 continue; 276 257 277 #ifndef RTLD_LOCAL 258 278 #define RTLD_LOCAL 0 259 279 #endif 260 280 261 so = dlopen(lib, RTLD_LAZY | RTLD_LOCAL); 281 #ifndef RTLD_GROUP 282 #define RTLD_GROUP 0 283 #endif 284 285 so = dlopen(lib, RTLD_LAZY | RTLD_LOCAL | RTLD_GROUP); 262 286 if (!so) { 263 287 /* fprintf(stderr, "dlopen: %s\n", dlerror()); */ 288 free(mech_oid.elements); 264 289 continue; 265 290 } 266 291 267 292 m = malloc(sizeof(*m)); 268 if (!m) 293 if (!m) { 294 free(mech_oid.elements); 269 295 break; 296 } 270 297 m->gm_so = so; 271 if (_gss_string_to_oid(oid, &m->gm_mech.gm_mech_oid)) { 272 free(m); 273 continue; 274 } 298 m->gm_mech.gm_mech_oid = mech_oid; 299 m->gm_mech.gm_flags = 0; 275 300 276 301 major_status = gss_add_oid_set_member(&minor_status, … … 319 344 OPTSYM(unwrap_iov); 320 345 OPTSYM(wrap_iov_length); 321 322 SLIST_INSERT_HEAD(&_gss_mechs, m, gm_link); 346 OPTSYM(display_name_ext); 347 OPTSYM(inquire_name); 348 OPTSYM(get_name_attribute); 349 OPTSYM(set_name_attribute); 350 OPTSYM(delete_name_attribute); 351 OPTSYM(export_name_composite); 352 353 mi = dlsym(so, "gss_mo_init"); 354 if (mi != NULL) { 355 major_status = mi(&minor_status, 356 &mech_oid, 357 &m->gm_mech.gm_mo, 358 &m->gm_mech.gm_mo_num); 359 if (GSS_ERROR(major_status)) 360 goto bad; 361 } 362 363 HEIM_SLIST_INSERT_HEAD(&_gss_mechs, m, gm_link); 323 364 continue; 324 365 … … 335 376 336 377 gssapi_mech_interface 337 __gss_get_mechanism(gss_ OID mech)378 __gss_get_mechanism(gss_const_OID mech) 338 379 { 339 380 struct _gss_mech_switch *m; 340 381 341 382 _gss_load_mech(); 342 SLIST_FOREACH(m, &_gss_mechs, gm_link) {383 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 343 384 if (gss_oid_equal(&m->gm_mech.gm_mech_oid, mech)) 344 385 return &m->gm_mech; -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_names.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 OM_uint32 … … 40 39 *output_mn = NULL; 41 40 42 SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {41 HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) { 43 42 if (gss_oid_equal(mech, mn->gmn_mech_oid)) 44 43 break; … … 74 73 mn->gmn_mech = m; 75 74 mn->gmn_mech_oid = &m->gm_mech_oid; 76 SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);75 HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link); 77 76 } 78 77 *output_mn = mn; … … 101 100 } 102 101 103 SLIST_INIT(&name->gn_mn);102 HEIM_SLIST_INIT(&name->gn_mn); 104 103 mn->gmn_mech = m; 105 104 mn->gmn_mech_oid = &m->gm_mech_oid; 106 105 mn->gmn_name = new_mn; 107 SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);106 HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link); 108 107 109 108 return (name); -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_oid_equal.c
r414 r745 33 33 34 34 #include "mech_locl.h" 35 RCSID("$Id$");36 35 37 int GSSAPI_LIB_FUNCTION 38 gss_oid_equal(const gss_OID a, const gss_OID b) 36 /** 37 * Compare two GSS-API OIDs with each other. 38 * 39 * GSS_C_NO_OID matches nothing, not even it-self. 40 * 41 * @param a first oid to compare 42 * @param b second oid to compare 43 * 44 * @return non-zero when both oid are the same OID, zero when they are 45 * not the same. 46 * 47 * @ingroup gssapi 48 */ 49 50 GSSAPI_LIB_FUNCTION int GSSAPI_LIB_CALL 51 gss_oid_equal(gss_const_OID a, gss_const_OID b) 39 52 { 40 if (a == b )53 if (a == b && a != GSS_C_NO_OID) 41 54 return 1; 42 55 if (a == GSS_C_NO_OID || b == GSS_C_NO_OID || a->length != b->length) -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_oid_to_str.c
r414 r745 33 33 34 34 #include "mech_locl.h" 35 RCSID("$Id$");36 35 37 OM_uint32 GSSAPI_LIB_FUNCTION 36 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 38 37 gss_oid_to_str(OM_uint32 *minor_status, gss_OID oid, gss_buffer_t oid_str) 39 38 { … … 67 66 return GSS_S_COMPLETE; 68 67 } 68 69 GSSAPI_LIB_FUNCTION const char * GSSAPI_LIB_CALL 70 gss_oid_to_name(gss_const_OID oid) 71 { 72 size_t i; 73 74 for (i = 0; _gss_ont_mech[i].oid; i++) { 75 if (gss_oid_equal(oid, _gss_ont_mech[i].oid)) 76 return _gss_ont_mech[i].name; 77 } 78 return NULL; 79 } 80 81 GSSAPI_LIB_FUNCTION gss_OID GSSAPI_LIB_CALL 82 gss_name_to_oid(const char *name) 83 { 84 size_t i, partial = (size_t)-1; 85 86 for (i = 0; _gss_ont_mech[i].oid; i++) { 87 if (strcasecmp(name, _gss_ont_mech[i].short_desc) == 0) 88 return _gss_ont_mech[i].oid; 89 if (strncasecmp(name, _gss_ont_mech[i].short_desc, strlen(name)) == 0) { 90 if (partial != (size_t)-1) 91 return NULL; 92 partial = i; 93 } 94 } 95 if (partial != (size_t)-1) 96 return _gss_ont_mech[partial].oid; 97 return NULL; 98 } -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_process_context_token.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_process_context_token(OM_uint32 *minor_status, 34 33 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_pseudo_random.c
r414 r745 35 35 36 36 #include "mech_locl.h" 37 RCSID("$Id$");38 37 39 OM_uint32 GSSAPI_LIB_FUNCTION 38 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 40 39 gss_pseudo_random(OM_uint32 *minor_status, 41 40 gss_ctx_id_t context, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_release_buffer.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_release_buffer(OM_uint32 *minor_status, 34 33 gss_buffer_t buffer) -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_release_cred.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 /** 32 * Release a credentials 33 * 34 * Its ok to release the GSS_C_NO_CREDENTIAL/NULL credential, it will 35 * return a GSS_S_COMPLETE error code. On return cred_handle is set ot 36 * GSS_C_NO_CREDENTIAL. 37 * 38 * Example: 39 * 40 * @code 41 * gss_cred_id_t cred = GSS_C_NO_CREDENTIAL; 42 * major = gss_release_cred(&minor, &cred); 43 * @endcode 44 * 45 * @param minor_status minor status return code, mech specific 46 * @param cred_handle a pointer to the credential too release 47 * 48 * @return an gssapi error code 49 * 50 * @ingroup gssapi 51 */ 52 53 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 54 gss_release_cred(OM_uint32 *minor_status, gss_cred_id_t *cred_handle) 34 55 { … … 39 60 return (GSS_S_COMPLETE); 40 61 41 while ( SLIST_FIRST(&cred->gc_mc)) {42 mc = SLIST_FIRST(&cred->gc_mc);43 SLIST_REMOVE_HEAD(&cred->gc_mc, gmc_link);62 while (HEIM_SLIST_FIRST(&cred->gc_mc)) { 63 mc = HEIM_SLIST_FIRST(&cred->gc_mc); 64 HEIM_SLIST_REMOVE_HEAD(&cred->gc_mc, gmc_link); 44 65 mc->gmc_mech->gm_release_cred(minor_status, &mc->gmc_cred); 45 66 free(mc); -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_release_name.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 /** 32 * Free a name 33 * 34 * import_name can point to NULL or be NULL, or a pointer to a 35 * gss_name_t structure. If it was a pointer to gss_name_t, the 36 * pointer will be set to NULL on success and failure. 37 * 38 * @param minor_status minor status code 39 * @param input_name name to free 40 * 41 * @returns a gss_error code, see gss_display_status() about printing 42 * the error code. 43 * 44 * @ingroup gssapi 45 */ 46 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 47 gss_release_name(OM_uint32 *minor_status, 34 48 gss_name_t *input_name) … … 45 59 if (name->gn_type.elements) 46 60 free(name->gn_type.elements); 47 while ( SLIST_FIRST(&name->gn_mn)) {61 while (HEIM_SLIST_FIRST(&name->gn_mn)) { 48 62 struct _gss_mechanism_name *mn; 49 mn = SLIST_FIRST(&name->gn_mn);50 SLIST_REMOVE_HEAD(&name->gn_mn, gmn_link);63 mn = HEIM_SLIST_FIRST(&name->gn_mn); 64 HEIM_SLIST_REMOVE_HEAD(&name->gn_mn, gmn_link); 51 65 mn->gmn_mech->gm_release_name(minor_status, 52 66 &mn->gmn_name); -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_release_oid.c
r414 r745 34 34 #include "mech_locl.h" 35 35 36 RCSID("$Id$");37 36 38 OM_uint32 GSSAPI_LIB_FUNCTION 37 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 39 38 gss_release_oid(OM_uint32 *minor_status, gss_OID *oid) 40 39 { -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_release_oid_set.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_release_oid_set(OM_uint32 *minor_status, 34 33 gss_OID_set *set) -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_seal.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_seal(OM_uint32 *minor_status, 34 33 gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_set_cred_option.c
r414 r745 32 32 33 33 #include "mech_locl.h" 34 RCSID("$Id$");35 34 36 OM_uint32 GSSAPI_LIB_FUNCTION 35 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 36 gss_set_cred_option (OM_uint32 *minor_status, 38 37 gss_cred_id_t *cred_handle, … … 56 55 return GSS_S_FAILURE; 57 56 58 SLIST_INIT(&cred->gc_mc);57 HEIM_SLIST_INIT(&cred->gc_mc); 59 58 60 SLIST_FOREACH(m, &_gss_mechs, gm_link) {59 HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) { 61 60 62 61 if (m->gm_mech.gm_set_cred_option == NULL) … … 83 82 } 84 83 one_ok = 1; 85 SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link);84 HEIM_SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link); 86 85 } 87 86 *cred_handle = (gss_cred_id_t)cred; … … 93 92 gssapi_mech_interface m; 94 93 95 SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {94 HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { 96 95 m = mc->gmc_mech; 97 96 -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_set_sec_context_option.c
r414 r745 32 32 33 33 #include "mech_locl.h" 34 RCSID("$Id$");35 34 36 OM_uint32 GSSAPI_LIB_FUNCTION 35 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 37 36 gss_set_sec_context_option (OM_uint32 *minor_status, 38 37 gss_ctx_id_t *context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_sign.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_sign(OM_uint32 *minor_status, 34 33 gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_test_oid_set_member.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_test_oid_set_member(OM_uint32 *minor_status, 34 33 const gss_OID member, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_unseal.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_unseal(OM_uint32 *minor_status, 34 33 gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_unwrap.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_unwrap(OM_uint32 *minor_status, 34 33 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_utils.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 31 OM_uint32 -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_verify.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_verify(OM_uint32 *minor_status, 34 33 gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_verify_mic.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_verify_mic(OM_uint32 *minor_status, 34 33 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_wrap.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 /** 32 * Wrap a message using either confidentiality (encryption + 33 * signature) or sealing (signature). 34 * 35 * @param minor_status minor status code. 36 * @param context_handle context handle. 37 * @param conf_req_flag if non zero, confidentiality is requestd. 38 * @param qop_req type of protection needed, in most cases it GSS_C_QOP_DEFAULT should be passed in. 39 * @param input_message_buffer messages to wrap 40 * @param conf_state returns non zero if confidentiality was honoured. 41 * @param output_message_buffer the resulting buffer, release with gss_release_buffer(). 42 * 43 * @ingroup gssapi 44 */ 45 46 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 47 gss_wrap(OM_uint32 *minor_status, 34 48 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/gss_wrap_size_limit.c
r414 r745 28 28 29 29 #include "mech_locl.h" 30 RCSID("$Id$");31 30 32 OM_uint32 GSSAPI_LIB_FUNCTION 31 GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 33 32 gss_wrap_size_limit(OM_uint32 *minor_status, 34 33 const gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/mech/mech_locl.h
r414 r745 65 65 66 66 #define _mg_buffer_zero(buffer) \ 67 do { (buffer)->value = NULL; (buffer)->length = 0; } while(0) 67 do { \ 68 if (buffer) { \ 69 (buffer)->value = NULL; \ 70 (buffer)->length = 0; \ 71 } \ 72 } while(0) 73 74 #define _mg_oid_set_zero(oid_set) \ 75 do { \ 76 if (oid_set) { \ 77 (oid_set)->elements = NULL; \ 78 (oid_set)->count = 0; \ 79 } \ 80 } while(0) -
trunk/server/source4/heimdal/lib/gssapi/mech/mech_switch.h
r414 r745 31 31 32 32 struct _gss_mech_switch { 33 SLIST_ENTRY(_gss_mech_switch) gm_link;33 HEIM_SLIST_ENTRY(_gss_mech_switch) gm_link; 34 34 gss_OID_desc gm_mech_oid; 35 35 gss_OID_set gm_name_types; … … 37 37 gssapi_mech_interface_desc gm_mech; 38 38 }; 39 SLIST_HEAD(_gss_mech_switch_list, _gss_mech_switch);39 HEIM_SLIST_HEAD(_gss_mech_switch_list, _gss_mech_switch); 40 40 extern struct _gss_mech_switch_list _gss_mechs; 41 41 extern gss_OID_set _gss_mech_oids; -
trunk/server/source4/heimdal/lib/gssapi/mech/mechqueue.h
r414 r745 35 35 #define _MECHQUEUE_H_ 36 36 37 #ifndef SLIST_HEAD38 39 37 /* 40 38 * Singly-linked List definitions. 41 39 */ 42 #define SLIST_HEAD(name, type) \40 #define HEIM_SLIST_HEAD(name, type) \ 43 41 struct name { \ 44 42 struct type *slh_first; /* first element */ \ 45 43 } 46 44 47 #define SLIST_HEAD_INITIALIZER(head) \45 #define HEIM_SLIST_HEAD_INITIALIZER(head) \ 48 46 { NULL } 49 47 50 #define SLIST_ENTRY(type) \48 #define HEIM_SLIST_ENTRY(type) \ 51 49 struct { \ 52 50 struct type *sle_next; /* next element */ \ … … 56 54 * Singly-linked List functions. 57 55 */ 58 #define SLIST_INIT(head) do { \56 #define HEIM_SLIST_INIT(head) do { \ 59 57 (head)->slh_first = NULL; \ 60 58 } while (/*CONSTCOND*/0) 61 59 62 #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \60 #define HEIM_SLIST_INSERT_AFTER(slistelm, elm, field) do { \ 63 61 (elm)->field.sle_next = (slistelm)->field.sle_next; \ 64 62 (slistelm)->field.sle_next = (elm); \ 65 63 } while (/*CONSTCOND*/0) 66 64 67 #define SLIST_INSERT_HEAD(head, elm, field) do { \65 #define HEIM_SLIST_INSERT_HEAD(head, elm, field) do { \ 68 66 (elm)->field.sle_next = (head)->slh_first; \ 69 67 (head)->slh_first = (elm); \ 70 68 } while (/*CONSTCOND*/0) 71 69 72 #define SLIST_REMOVE_HEAD(head, field) do { \70 #define HEIM_SLIST_REMOVE_HEAD(head, field) do { \ 73 71 (head)->slh_first = (head)->slh_first->field.sle_next; \ 74 72 } while (/*CONSTCOND*/0) 75 73 76 #define SLIST_REMOVE(head, elm, type, field) do { \74 #define HEIM_SLIST_REMOVE(head, elm, type, field) do { \ 77 75 if ((head)->slh_first == (elm)) { \ 78 SLIST_REMOVE_HEAD((head), field); \76 HEIM_SLIST_REMOVE_HEAD((head), field); \ 79 77 } \ 80 78 else { \ … … 87 85 } while (/*CONSTCOND*/0) 88 86 89 #define SLIST_FOREACH(var, head, field) \87 #define HEIM_SLIST_FOREACH(var, head, field) \ 90 88 for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) 91 89 … … 93 91 * Singly-linked List access methods. 94 92 */ 95 #define SLIST_EMPTY(head) ((head)->slh_first == NULL) 96 #define SLIST_FIRST(head) ((head)->slh_first) 97 #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) 98 99 #endif /* SLIST_HEAD */ 93 #define HEIM_SLIST_EMPTY(head) ((head)->slh_first == NULL) 94 #define HEIM_SLIST_FIRST(head) ((head)->slh_first) 95 #define HEIM_SLIST_NEXT(elm, field) ((elm)->field.sle_next) 100 96 101 97 #endif /* !_MECHQUEUE_H_ */ -
trunk/server/source4/heimdal/lib/gssapi/mech/name.h
r414 r745 29 29 30 30 struct _gss_mechanism_name { 31 SLIST_ENTRY(_gss_mechanism_name) gmn_link;31 HEIM_SLIST_ENTRY(_gss_mechanism_name) gmn_link; 32 32 gssapi_mech_interface gmn_mech; /* mechanism ops for MN */ 33 33 gss_OID gmn_mech_oid; /* mechanism oid for MN */ 34 34 gss_name_t gmn_name; /* underlying MN */ 35 35 }; 36 SLIST_HEAD(_gss_mechanism_name_list, _gss_mechanism_name);36 HEIM_SLIST_HEAD(_gss_mechanism_name_list, _gss_mechanism_name); 37 37 38 38 struct _gss_name { -
trunk/server/source4/heimdal/lib/gssapi/spnego/accept_sec_context.c
r414 r745 34 34 #include "spnego_locl.h" 35 35 36 RCSID("$Id$");37 38 36 static OM_uint32 39 37 send_reject (OM_uint32 *minor_status, … … 375 373 return GSS_S_FAILURE; 376 374 } 377 asprintf(&str, "host@%s", hostname); 375 i = asprintf(&str, "host@%s", hostname); 376 if (i < 0 || str == NULL) { 377 *minor_status = ENOMEM; 378 return GSS_S_FAILURE; 379 } 378 380 host = str; 379 381 } … … 471 473 472 474 473 static OM_uint32 475 static OM_uint32 GSSAPI_CALLCONV 474 476 acceptor_start 475 477 (OM_uint32 * minor_status, … … 497 499 gss_OID preferred_mech_type = GSS_C_NO_OID; 498 500 gssspnego_ctx ctx; 499 gssspnego_cred acceptor_cred = (gssspnego_cred)acceptor_cred_handle;500 501 int get_mic = 0; 501 502 int first_ok = 0; … … 565 566 566 567 if (ret == 0 && ni->mechToken != NULL) { 567 gss_cred_id_t mech_delegated_cred = GSS_C_NO_CREDENTIAL;568 gss_cred_id_t mech_cred;569 568 gss_buffer_desc ibuf; 570 569 … … 573 572 mech_input_token = &ibuf; 574 573 575 if (acceptor_cred != NULL)576 mech_cred = acceptor_cred->negotiated_cred_id;577 else578 mech_cred = GSS_C_NO_CREDENTIAL;579 580 574 if (ctx->mech_src_name != GSS_C_NO_NAME) 581 575 gss_release_name(&junk, &ctx->mech_src_name); … … 583 577 ret = gss_accept_sec_context(minor_status, 584 578 &ctx->negotiated_ctx_id, 585 mech_cred,579 acceptor_cred_handle, 586 580 mech_input_token, 587 581 input_chan_bindings, … … 591 585 &ctx->mech_flags, 592 586 &ctx->mech_time_rec, 593 &mech_delegated_cred); 594 595 if (mech_delegated_cred && delegated_cred_handle) { 596 _gss_spnego_alloc_cred(&junk, 597 mech_delegated_cred, 598 delegated_cred_handle); 599 } else if (mech_delegated_cred != GSS_C_NO_CREDENTIAL) 600 gss_release_cred(&junk, &mech_delegated_cred); 587 delegated_cred_handle); 601 588 602 589 if (ret == GSS_S_COMPLETE || ret == GSS_S_CONTINUE_NEEDED) { 603 590 ctx->preferred_mech_type = preferred_mech_type; 604 ctx->negotiated_mech_type = preferred_mech_type;605 591 if (ret == GSS_S_COMPLETE) 606 592 ctx->open = 1; … … 647 633 648 634 ctx->preferred_mech_type = preferred_mech_type; 649 ctx->negotiated_mech_type = preferred_mech_type;650 635 } 651 636 … … 705 690 706 691 707 static OM_uint32 692 static OM_uint32 GSSAPI_CALLCONV 708 693 acceptor_continue 709 694 (OM_uint32 * minor_status, … … 720 705 ) 721 706 { 722 OM_uint32 ret, ret2, minor , junk;707 OM_uint32 ret, ret2, minor; 723 708 NegotiationToken nt; 724 709 size_t nt_len; … … 729 714 gss_buffer_desc mech_buf; 730 715 gssspnego_ctx ctx; 731 gssspnego_cred acceptor_cred = (gssspnego_cred)acceptor_cred_handle;732 716 733 717 mech_buf.value = NULL; … … 775 759 776 760 if (mech_input_token != GSS_C_NO_BUFFER) { 777 gss_cred_id_t mech_cred;778 gss_cred_id_t mech_delegated_cred = GSS_C_NO_CREDENTIAL;779 780 if (acceptor_cred != NULL)781 mech_cred = acceptor_cred->negotiated_cred_id;782 else783 mech_cred = GSS_C_NO_CREDENTIAL;784 761 785 762 if (ctx->mech_src_name != GSS_C_NO_NAME) … … 788 765 ret = gss_accept_sec_context(&minor, 789 766 &ctx->negotiated_ctx_id, 790 mech_cred,767 acceptor_cred_handle, 791 768 mech_input_token, 792 769 input_chan_bindings, … … 796 773 &ctx->mech_flags, 797 774 &ctx->mech_time_rec, 798 &mech_delegated_cred); 799 800 if (mech_delegated_cred && delegated_cred_handle) { 801 _gss_spnego_alloc_cred(&junk, 802 mech_delegated_cred, 803 delegated_cred_handle); 804 } else if (mech_delegated_cred != GSS_C_NO_CREDENTIAL) 805 gss_release_cred(&junk, &mech_delegated_cred); 775 delegated_cred_handle); 806 776 807 777 if (ret == GSS_S_COMPLETE || ret == GSS_S_CONTINUE_NEEDED) { … … 907 877 } 908 878 909 OM_uint32 879 OM_uint32 GSSAPI_CALLCONV 910 880 _gss_spnego_accept_sec_context 911 881 (OM_uint32 * minor_status, -
trunk/server/source4/heimdal/lib/gssapi/spnego/compat.c
r414 r745 33 33 #include "spnego_locl.h" 34 34 35 RCSID("$Id$");36 37 35 /* 38 36 * Apparently Microsoft got the OID wrong, and used … … 52 50 * Allocate a SPNEGO context handle 53 51 */ 54 OM_uint32 _gss_spnego_alloc_sec_context (OM_uint32 * minor_status, 55 gss_ctx_id_t *context_handle) 52 OM_uint32 GSSAPI_CALLCONV 53 _gss_spnego_alloc_sec_context (OM_uint32 * minor_status, 54 gss_ctx_id_t *context_handle) 56 55 { 57 56 gssspnego_ctx ctx; … … 94 93 * the lock before this is called. 95 94 */ 96 OM_uint32 _gss_spnego_internal_delete_sec_context95 OM_uint32 GSSAPI_CALLCONV _gss_spnego_internal_delete_sec_context 97 96 (OM_uint32 *minor_status, 98 97 gss_ctx_id_t *context_handle, … … 143 142 144 143 free(ctx); 145 *context_handle = NULL;146 144 147 145 return ret; … … 154 152 */ 155 153 156 OM_uint32 154 OM_uint32 GSSAPI_CALLCONV 157 155 _gss_spnego_require_mechlist_mic(OM_uint32 *minor_status, 158 156 gssspnego_ctx ctx, … … 232 230 233 231 234 OM_uint32 232 OM_uint32 GSSAPI_CALLCONV 235 233 _gss_spnego_indicate_mechtypelist (OM_uint32 *minor_status, 236 234 gss_name_t target_name, 237 235 OM_uint32 (*func)(gss_name_t, gss_OID), 238 236 int includeMSCompatOID, 239 const gss spnego_credcred_handle,237 const gss_cred_id_t cred_handle, 240 238 MechTypeList *mechtypelist, 241 239 gss_OID *preferred_mech) … … 249 247 mechtypelist->val = NULL; 250 248 251 if (cred_handle != NULL) {249 if (cred_handle) { 252 250 ret = gss_inquire_cred(minor_status, 253 cred_handle ->negotiated_cred_id,251 cred_handle, 254 252 NULL, 255 253 NULL, -
trunk/server/source4/heimdal/lib/gssapi/spnego/context_stubs.c
r414 r745 33 33 #include "spnego_locl.h" 34 34 35 RCSID("$Id$");36 37 35 static OM_uint32 38 36 spnego_supported_mechs(OM_uint32 *minor_status, gss_OID_set *mechs) … … 69 67 70 68 71 OM_uint32 _gss_spnego_process_context_token69 OM_uint32 GSSAPI_CALLCONV _gss_spnego_process_context_token 72 70 (OM_uint32 *minor_status, 73 71 const gss_ctx_id_t context_handle, … … 102 100 } 103 101 104 OM_uint32 _gss_spnego_delete_sec_context102 OM_uint32 GSSAPI_CALLCONV _gss_spnego_delete_sec_context 105 103 (OM_uint32 *minor_status, 106 104 gss_ctx_id_t *context_handle, … … 122 120 } 123 121 124 OM_uint32 _gss_spnego_context_time122 OM_uint32 GSSAPI_CALLCONV _gss_spnego_context_time 125 123 (OM_uint32 *minor_status, 126 124 const gss_ctx_id_t context_handle, … … 146 144 } 147 145 148 OM_uint32 _gss_spnego_get_mic146 OM_uint32 GSSAPI_CALLCONV _gss_spnego_get_mic 149 147 (OM_uint32 *minor_status, 150 148 const gss_ctx_id_t context_handle, … … 172 170 } 173 171 174 OM_uint32 _gss_spnego_verify_mic172 OM_uint32 GSSAPI_CALLCONV _gss_spnego_verify_mic 175 173 (OM_uint32 * minor_status, 176 174 const gss_ctx_id_t context_handle, … … 201 199 } 202 200 203 OM_uint32 _gss_spnego_wrap201 OM_uint32 GSSAPI_CALLCONV _gss_spnego_wrap 204 202 (OM_uint32 * minor_status, 205 203 const gss_ctx_id_t context_handle, … … 234 232 } 235 233 236 OM_uint32 _gss_spnego_unwrap234 OM_uint32 GSSAPI_CALLCONV _gss_spnego_unwrap 237 235 (OM_uint32 * minor_status, 238 236 const gss_ctx_id_t context_handle, … … 265 263 } 266 264 267 OM_uint32 _gss_spnego_compare_name265 OM_uint32 GSSAPI_CALLCONV _gss_spnego_compare_name 268 266 (OM_uint32 *minor_status, 269 267 const gss_name_t name1, … … 289 287 } 290 288 291 OM_uint32 _gss_spnego_display_name289 OM_uint32 GSSAPI_CALLCONV _gss_spnego_display_name 292 290 (OM_uint32 * minor_status, 293 291 const gss_name_t input_name, … … 307 305 } 308 306 309 OM_uint32 _gss_spnego_import_name307 OM_uint32 GSSAPI_CALLCONV _gss_spnego_import_name 310 308 (OM_uint32 * minor_status, 311 309 const gss_buffer_t name_buffer, … … 343 341 } 344 342 345 OM_uint32 _gss_spnego_export_name343 OM_uint32 GSSAPI_CALLCONV _gss_spnego_export_name 346 344 (OM_uint32 * minor_status, 347 345 const gss_name_t input_name, … … 362 360 } 363 361 364 OM_uint32 _gss_spnego_release_name362 OM_uint32 GSSAPI_CALLCONV _gss_spnego_release_name 365 363 (OM_uint32 * minor_status, 366 364 gss_name_t * input_name … … 383 381 } 384 382 385 OM_uint32 _gss_spnego_inquire_context (383 OM_uint32 GSSAPI_CALLCONV _gss_spnego_inquire_context ( 386 384 OM_uint32 * minor_status, 387 385 const gss_ctx_id_t context_handle, … … 450 448 } 451 449 452 OM_uint32 _gss_spnego_wrap_size_limit (450 OM_uint32 GSSAPI_CALLCONV _gss_spnego_wrap_size_limit ( 453 451 OM_uint32 * minor_status, 454 452 const gss_ctx_id_t context_handle, … … 481 479 } 482 480 483 OM_uint32 _gss_spnego_export_sec_context (481 OM_uint32 GSSAPI_CALLCONV _gss_spnego_export_sec_context ( 484 482 OM_uint32 * minor_status, 485 483 gss_ctx_id_t * context_handle, … … 524 522 } 525 523 526 OM_uint32 _gss_spnego_import_sec_context (524 OM_uint32 GSSAPI_CALLCONV _gss_spnego_import_sec_context ( 527 525 OM_uint32 * minor_status, 528 526 const gss_buffer_t interprocess_token, … … 560 558 } 561 559 562 OM_uint32 _gss_spnego_inquire_names_for_mech (560 OM_uint32 GSSAPI_CALLCONV _gss_spnego_inquire_names_for_mech ( 563 561 OM_uint32 * minor_status, 564 562 const gss_OID mechanism, … … 603 601 } 604 602 605 OM_uint32 _gss_spnego_inquire_mechs_for_name (603 OM_uint32 GSSAPI_CALLCONV _gss_spnego_inquire_mechs_for_name ( 606 604 OM_uint32 * minor_status, 607 605 const gss_name_t input_name, … … 624 622 } 625 623 626 OM_uint32 _gss_spnego_canonicalize_name (624 OM_uint32 GSSAPI_CALLCONV _gss_spnego_canonicalize_name ( 627 625 OM_uint32 * minor_status, 628 626 const gss_name_t input_name, … … 635 633 } 636 634 637 OM_uint32 _gss_spnego_duplicate_name (635 OM_uint32 GSSAPI_CALLCONV _gss_spnego_duplicate_name ( 638 636 OM_uint32 * minor_status, 639 637 const gss_name_t src_name, … … 644 642 } 645 643 644 OM_uint32 GSSAPI_CALLCONV 645 _gss_spnego_wrap_iov(OM_uint32 * minor_status, 646 gss_ctx_id_t context_handle, 647 int conf_req_flag, 648 gss_qop_t qop_req, 649 int * conf_state, 650 gss_iov_buffer_desc *iov, 651 int iov_count) 652 { 653 gssspnego_ctx ctx = (gssspnego_ctx)context_handle; 654 655 *minor_status = 0; 656 657 if (ctx == NULL || ctx->negotiated_ctx_id == GSS_C_NO_CONTEXT) 658 return GSS_S_NO_CONTEXT; 659 660 return gss_wrap_iov(minor_status, ctx->negotiated_ctx_id, 661 conf_req_flag, qop_req, conf_state, 662 iov, iov_count); 663 } 664 665 OM_uint32 GSSAPI_CALLCONV 666 _gss_spnego_unwrap_iov(OM_uint32 *minor_status, 667 gss_ctx_id_t context_handle, 668 int *conf_state, 669 gss_qop_t *qop_state, 670 gss_iov_buffer_desc *iov, 671 int iov_count) 672 { 673 gssspnego_ctx ctx = (gssspnego_ctx)context_handle; 674 675 *minor_status = 0; 676 677 if (ctx == NULL || ctx->negotiated_ctx_id == GSS_C_NO_CONTEXT) 678 return GSS_S_NO_CONTEXT; 679 680 return gss_unwrap_iov(minor_status, 681 ctx->negotiated_ctx_id, 682 conf_state, qop_state, 683 iov, iov_count); 684 } 685 686 OM_uint32 GSSAPI_CALLCONV 687 _gss_spnego_wrap_iov_length(OM_uint32 * minor_status, 688 gss_ctx_id_t context_handle, 689 int conf_req_flag, 690 gss_qop_t qop_req, 691 int *conf_state, 692 gss_iov_buffer_desc *iov, 693 int iov_count) 694 { 695 gssspnego_ctx ctx = (gssspnego_ctx)context_handle; 696 697 *minor_status = 0; 698 699 if (ctx == NULL || ctx->negotiated_ctx_id == GSS_C_NO_CONTEXT) 700 return GSS_S_NO_CONTEXT; 701 702 return gss_wrap_iov_length(minor_status, ctx->negotiated_ctx_id, 703 conf_req_flag, qop_req, conf_state, 704 iov, iov_count); 705 } 706 646 707 #if 0 647 OM_uint32 _gss_spnego_unwrap_ex 648 (OM_uint32 * minor_status, 649 const gss_ctx_id_t context_handle, 650 const gss_buffer_t token_header_buffer, 651 const gss_buffer_t associated_data_buffer, 652 const gss_buffer_t input_message_buffer, 653 gss_buffer_t output_message_buffer, 654 int * conf_state, 655 gss_qop_t * qop_state) 656 { 657 gssspnego_ctx ctx; 658 659 *minor_status = 0; 660 661 if (context_handle == GSS_C_NO_CONTEXT) { 662 return GSS_S_NO_CONTEXT; 663 } 664 665 ctx = (gssspnego_ctx)context_handle; 666 667 if (ctx->negotiated_ctx_id == GSS_C_NO_CONTEXT) { 668 return GSS_S_NO_CONTEXT; 669 } 670 671 return gss_unwrap_ex(minor_status, 672 ctx->negotiated_ctx_id, 673 token_header_buffer, 674 associated_data_buffer, 675 input_message_buffer, 676 output_message_buffer, 677 conf_state, 678 qop_state); 679 } 680 681 OM_uint32 _gss_spnego_wrap_ex 682 (OM_uint32 * minor_status, 683 const gss_ctx_id_t context_handle, 684 int conf_req_flag, 685 gss_qop_t qop_req, 686 const gss_buffer_t associated_data_buffer, 687 const gss_buffer_t input_message_buffer, 688 int * conf_state, 689 gss_buffer_t output_token_buffer, 690 gss_buffer_t output_message_buffer 691 ) 692 { 693 gssspnego_ctx ctx; 694 695 *minor_status = 0; 696 697 if (context_handle == GSS_C_NO_CONTEXT) { 698 return GSS_S_NO_CONTEXT; 699 } 700 701 ctx = (gssspnego_ctx)context_handle; 702 703 if (ctx->negotiated_ctx_id == GSS_C_NO_CONTEXT) { 704 return GSS_S_NO_CONTEXT; 705 } 706 707 if ((ctx->mech_flags & GSS_C_DCE_STYLE) == 0 && 708 associated_data_buffer->length != input_message_buffer->length) { 709 *minor_status = EINVAL; 710 return GSS_S_BAD_QOP; 711 } 712 713 return gss_wrap_ex(minor_status, 714 ctx->negotiated_ctx_id, 715 conf_req_flag, 716 qop_req, 717 associated_data_buffer, 718 input_message_buffer, 719 conf_state, 720 output_token_buffer, 721 output_message_buffer); 722 } 723 724 OM_uint32 _gss_spnego_complete_auth_token 708 OM_uint32 GSSAPI_CALLCONV _gss_spnego_complete_auth_token 725 709 (OM_uint32 * minor_status, 726 710 const gss_ctx_id_t context_handle, … … 747 731 #endif 748 732 749 OM_uint32 _gss_spnego_inquire_sec_context_by_oid733 OM_uint32 GSSAPI_CALLCONV _gss_spnego_inquire_sec_context_by_oid 750 734 (OM_uint32 * minor_status, 751 735 const gss_ctx_id_t context_handle, … … 773 757 } 774 758 775 OM_uint32 _gss_spnego_set_sec_context_option759 OM_uint32 GSSAPI_CALLCONV _gss_spnego_set_sec_context_option 776 760 (OM_uint32 * minor_status, 777 761 gss_ctx_id_t * context_handle, … … 800 784 801 785 802 OM_uint32 786 OM_uint32 GSSAPI_CALLCONV 803 787 _gss_spnego_pseudo_random(OM_uint32 *minor_status, 804 788 gss_ctx_id_t context_handle, -
trunk/server/source4/heimdal/lib/gssapi/spnego/cred_stubs.c
r414 r745 33 33 #include "spnego_locl.h" 34 34 35 RCSID("$Id$"); 36 37 OM_uint32 35 OM_uint32 GSSAPI_CALLCONV 38 36 _gss_spnego_release_cred(OM_uint32 *minor_status, gss_cred_id_t *cred_handle) 39 37 { 40 gssspnego_cred cred;41 38 OM_uint32 ret; 42 39 43 40 *minor_status = 0; 44 41 45 if ( *cred_handle == GSS_C_NO_CREDENTIAL) {42 if (cred_handle == NULL || *cred_handle == GSS_C_NO_CREDENTIAL) 46 43 return GSS_S_COMPLETE; 47 } 48 cred = (gssspnego_cred)*cred_handle; 49 50 ret = gss_release_cred(minor_status, &cred->negotiated_cred_id); 51 52 free(cred); 44 45 ret = gss_release_cred(minor_status, cred_handle); 46 53 47 *cred_handle = GSS_C_NO_CREDENTIAL; 54 48 55 49 return ret; 56 }57 58 OM_uint3259 _gss_spnego_alloc_cred(OM_uint32 *minor_status,60 gss_cred_id_t mech_cred_handle,61 gss_cred_id_t *cred_handle)62 {63 gssspnego_cred cred;64 65 if (*cred_handle != GSS_C_NO_CREDENTIAL) {66 *minor_status = EINVAL;67 return GSS_S_FAILURE;68 }69 70 cred = calloc(1, sizeof(*cred));71 if (cred == NULL) {72 *cred_handle = GSS_C_NO_CREDENTIAL;73 *minor_status = ENOMEM;74 return GSS_S_FAILURE;75 }76 77 cred->negotiated_cred_id = mech_cred_handle;78 79 *cred_handle = (gss_cred_id_t)cred;80 81 return GSS_S_COMPLETE;82 50 } 83 51 … … 87 55 * more functionality. 88 56 */ 89 OM_uint32 _gss_spnego_acquire_cred57 OM_uint32 GSSAPI_CALLCONV _gss_spnego_acquire_cred 90 58 (OM_uint32 *minor_status, 91 59 const gss_name_t desired_name, … … 104 72 gss_OID_set mechs; 105 73 int i, j; 106 gss_cred_id_t cred_handle = GSS_C_NO_CREDENTIAL;107 gssspnego_cred cred;108 74 109 75 *output_cred_handle = GSS_C_NO_CREDENTIAL; … … 141 107 actual_desired_mechs.count = j; 142 108 143 ret = _gss_spnego_alloc_cred(minor_status, GSS_C_NO_CREDENTIAL,144 &cred_handle);145 if (ret != GSS_S_COMPLETE)146 goto out;147 148 cred = (gssspnego_cred)cred_handle;149 109 ret = gss_acquire_cred(minor_status, name, 150 110 time_req, &actual_desired_mechs, 151 111 cred_usage, 152 &cred->negotiated_cred_id,112 output_cred_handle, 153 113 actual_mechs, time_rec); 154 114 if (ret != GSS_S_COMPLETE) 155 115 goto out; 156 157 *output_cred_handle = cred_handle;158 116 159 117 out: … … 164 122 } 165 123 if (ret != GSS_S_COMPLETE) { 166 _gss_spnego_release_cred(&tmp, &cred_handle);167 } 168 169 return ret; 170 } 171 172 OM_uint32 _gss_spnego_inquire_cred124 _gss_spnego_release_cred(&tmp, output_cred_handle); 125 } 126 127 return ret; 128 } 129 130 OM_uint32 GSSAPI_CALLCONV _gss_spnego_inquire_cred 173 131 (OM_uint32 * minor_status, 174 132 const gss_cred_id_t cred_handle, … … 179 137 ) 180 138 { 181 gssspnego_cred cred;182 139 spnego_name sname = NULL; 183 140 OM_uint32 ret; … … 196 153 } 197 154 198 cred = (gssspnego_cred)cred_handle;199 200 155 ret = gss_inquire_cred(minor_status, 201 cred ->negotiated_cred_id,156 cred_handle, 202 157 sname ? &sname->mech : NULL, 203 158 lifetime, … … 215 170 } 216 171 217 OM_uint32 _gss_spnego_add_cred ( 218 OM_uint32 * minor_status, 219 const gss_cred_id_t input_cred_handle, 220 const gss_name_t desired_name, 221 const gss_OID desired_mech, 222 gss_cred_usage_t cred_usage, 223 OM_uint32 initiator_time_req, 224 OM_uint32 acceptor_time_req, 225 gss_cred_id_t * output_cred_handle, 226 gss_OID_set * actual_mechs, 227 OM_uint32 * initiator_time_rec, 228 OM_uint32 * acceptor_time_rec 229 ) 230 { 231 gss_cred_id_t spnego_output_cred_handle = GSS_C_NO_CREDENTIAL; 232 OM_uint32 ret, tmp; 233 gssspnego_cred input_cred, output_cred; 234 235 *output_cred_handle = GSS_C_NO_CREDENTIAL; 236 237 ret = _gss_spnego_alloc_cred(minor_status, GSS_C_NO_CREDENTIAL, 238 &spnego_output_cred_handle); 239 if (ret) 240 return ret; 241 242 input_cred = (gssspnego_cred)input_cred_handle; 243 output_cred = (gssspnego_cred)spnego_output_cred_handle; 244 245 ret = gss_add_cred(minor_status, 246 input_cred->negotiated_cred_id, 247 desired_name, 248 desired_mech, 249 cred_usage, 250 initiator_time_req, 251 acceptor_time_req, 252 &output_cred->negotiated_cred_id, 253 actual_mechs, 254 initiator_time_rec, 255 acceptor_time_rec); 256 if (ret) { 257 _gss_spnego_release_cred(&tmp, &spnego_output_cred_handle); 258 return ret; 259 } 260 261 *output_cred_handle = spnego_output_cred_handle; 262 263 return GSS_S_COMPLETE; 264 } 265 266 OM_uint32 _gss_spnego_inquire_cred_by_mech ( 172 OM_uint32 GSSAPI_CALLCONV _gss_spnego_inquire_cred_by_mech ( 267 173 OM_uint32 * minor_status, 268 174 const gss_cred_id_t cred_handle, … … 274 180 ) 275 181 { 276 gssspnego_cred cred;277 182 spnego_name sname = NULL; 278 183 OM_uint32 ret; … … 291 196 } 292 197 293 cred = (gssspnego_cred)cred_handle;294 295 198 ret = gss_inquire_cred_by_mech(minor_status, 296 cred ->negotiated_cred_id,199 cred_handle, 297 200 mech_type, 298 201 sname ? &sname->mech : NULL, … … 312 215 } 313 216 314 OM_uint32 _gss_spnego_inquire_cred_by_oid217 OM_uint32 GSSAPI_CALLCONV _gss_spnego_inquire_cred_by_oid 315 218 (OM_uint32 * minor_status, 316 219 const gss_cred_id_t cred_handle, … … 318 221 gss_buffer_set_t *data_set) 319 222 { 320 gssspnego_cred cred;321 223 OM_uint32 ret; 322 224 … … 325 227 return GSS_S_NO_CRED; 326 228 } 327 cred = (gssspnego_cred)cred_handle;328 229 329 230 ret = gss_inquire_cred_by_oid(minor_status, 330 cred ->negotiated_cred_id,231 cred_handle, 331 232 desired_object, 332 233 data_set); … … 335 236 } 336 237 337 OM_uint32 238 OM_uint32 GSSAPI_CALLCONV 338 239 _gss_spnego_set_cred_option (OM_uint32 *minor_status, 339 240 gss_cred_id_t *cred_handle, … … 341 242 const gss_buffer_t value) 342 243 { 343 gssspnego_cred cred;344 345 244 if (cred_handle == NULL || *cred_handle == GSS_C_NO_CREDENTIAL) { 346 245 *minor_status = 0; … … 348 247 } 349 248 350 cred = (gssspnego_cred)*cred_handle;351 249 return gss_set_cred_option(minor_status, 352 &cred->negotiated_cred_id,250 cred_handle, 353 251 object, 354 252 value); … … 356 254 357 255 358 OM_uint32 256 OM_uint32 GSSAPI_CALLCONV 359 257 _gss_spnego_export_cred (OM_uint32 *minor_status, 360 258 gss_cred_id_t cred_handle, 361 259 gss_buffer_t value) 362 260 { 363 gssspnego_cred cred = (gssspnego_cred)cred_handle; 364 365 return gss_export_cred(minor_status, cred->negotiated_cred_id, value); 366 } 367 368 OM_uint32 261 return gss_export_cred(minor_status, cred_handle, value); 262 } 263 264 OM_uint32 GSSAPI_CALLCONV 369 265 _gss_spnego_import_cred (OM_uint32 *minor_status, 370 266 gss_buffer_t value, 371 267 gss_cred_id_t *cred_handle) 372 268 { 373 gssspnego_cred cred; 374 OM_uint32 major; 375 376 *cred_handle = GSS_C_NO_CREDENTIAL; 377 378 cred = calloc(1, sizeof(*cred)); 379 if (cred == NULL) { 380 *minor_status = ENOMEM; 381 return GSS_S_FAILURE; 382 } 383 384 major = gss_import_cred(minor_status, value, &cred->negotiated_cred_id); 385 if (major == GSS_S_COMPLETE) 386 *cred_handle = (gss_cred_id_t)cred; 387 else 388 free(cred); 389 390 return major; 391 } 392 269 return gss_import_cred(minor_status, value, cred_handle); 270 } 271 -
trunk/server/source4/heimdal/lib/gssapi/spnego/external.c
r414 r745 34 34 #include <gssapi_mech.h> 35 35 36 RCSID("$Id$");37 38 36 /* 39 37 * RFC2478, SPNEGO: … … 43 41 */ 44 42 43 static gss_mo_desc spnego_mo[] = { 44 { 45 GSS_C_MA_SASL_MECH_NAME, 46 GSS_MO_MA, 47 "SASL mech name", 48 "SPNEGO", 49 _gss_mo_get_ctx_as_string, 50 NULL 51 }, 52 { 53 GSS_C_MA_MECH_NAME, 54 GSS_MO_MA, 55 "Mechanism name", 56 "SPNEGO", 57 _gss_mo_get_ctx_as_string, 58 NULL 59 }, 60 { 61 GSS_C_MA_MECH_DESCRIPTION, 62 GSS_MO_MA, 63 "Mechanism description", 64 "Heimdal SPNEGO Mechanism", 65 _gss_mo_get_ctx_as_string, 66 NULL 67 }, 68 { 69 GSS_C_MA_MECH_NEGO, 70 GSS_MO_MA 71 }, 72 { 73 GSS_C_MA_MECH_PSEUDO, 74 GSS_MO_MA 75 } 76 }; 77 45 78 static gssapi_mech_interface_desc spnego_mech = { 46 79 GMI_VERSION, 47 80 "spnego", 48 81 {6, (void *)"\x2b\x06\x01\x05\x05\x02"}, 82 0, 49 83 _gss_spnego_acquire_cred, 50 84 _gss_spnego_release_cred, … … 68 102 _gss_spnego_inquire_context, 69 103 _gss_spnego_wrap_size_limit, 70 _gss_spnego_add_cred,104 gss_add_cred, 71 105 _gss_spnego_inquire_cred_by_mech, 72 106 _gss_spnego_export_sec_context, … … 81 115 _gss_spnego_set_cred_option, 82 116 _gss_spnego_pseudo_random, 117 _gss_spnego_wrap_iov, 118 _gss_spnego_unwrap_iov, 119 _gss_spnego_wrap_iov_length, 120 NULL, 121 _gss_spnego_export_cred, 122 _gss_spnego_import_cred, 83 123 NULL, 84 124 NULL, 85 125 NULL, 86 126 NULL, 87 _gss_spnego_export_cred, 88 _gss_spnego_import_cred 127 NULL, 128 NULL, 129 NULL, 130 spnego_mo, 131 sizeof(spnego_mo) / sizeof(spnego_mo[0]) 89 132 }; 90 133 … … 94 137 return &spnego_mech; 95 138 } 96 97 static gss_OID_desc _gss_spnego_mechanism_desc =98 {6, (void *)"\x2b\x06\x01\x05\x05\x02"};99 100 gss_OID GSS_SPNEGO_MECHANISM = &_gss_spnego_mechanism_desc; -
trunk/server/source4/heimdal/lib/gssapi/spnego/init_sec_context.c
r414 r745 34 34 #include "spnego_locl.h" 35 35 36 RCSID("$Id$");37 38 36 /* 39 37 * Is target_name an sane target for `mechÂŽ. … … 180 178 spnego_initial 181 179 (OM_uint32 * minor_status, 182 gss spnego_credcred,180 gss_cred_id_t cred, 183 181 gss_ctx_id_t * context_handle, 184 182 const gss_name_t target_name, … … 255 253 /* generate optimistic token */ 256 254 sub = gss_init_sec_context(&minor, 257 (cred != NULL) ? cred->negotiated_cred_id : 258 GSS_C_NO_CREDENTIAL, 255 cred, 259 256 &ctx->negotiated_ctx_id, 260 257 ctx->target_name, … … 378 375 spnego_reply 379 376 (OM_uint32 * minor_status, 380 const gss spnego_credcred,377 const gss_cred_id_t cred, 381 378 gss_ctx_id_t * context_handle, 382 379 const gss_name_t target_name, … … 499 496 was requested explicitly */ 500 497 ret = gss_init_sec_context(&minor, 501 (cred != NULL) ? cred->negotiated_cred_id : 502 GSS_C_NO_CREDENTIAL, 498 cred, 503 499 &ctx->negotiated_ctx_id, 504 500 ctx->target_name, … … 614 610 } 615 611 616 OM_uint32 _gss_spnego_init_sec_context 612 OM_uint32 GSSAPI_CALLCONV 613 _gss_spnego_init_sec_context 617 614 (OM_uint32 * minor_status, 618 615 const gss_cred_id_t initiator_cred_handle, … … 630 627 ) 631 628 { 632 gssspnego_cred cred = (gssspnego_cred)initiator_cred_handle;633 634 629 if (*context_handle == GSS_C_NO_CONTEXT) 635 630 return spnego_initial (minor_status, 636 cred,631 initiator_cred_handle, 637 632 context_handle, 638 633 target_name, … … 648 643 else 649 644 return spnego_reply (minor_status, 650 cred,645 initiator_cred_handle, 651 646 context_handle, 652 647 target_name, -
trunk/server/source4/heimdal/lib/gssapi/spnego/spnego_locl.h
r414 r745 45 45 #endif 46 46 47 #include <roken.h> 48 47 49 #ifdef HAVE_PTHREAD_H 48 50 #include <pthread.h> … … 70 72 #include <der.h> 71 73 72 #include <roken.h>73 74 74 #define ALLOC(X, N) (X) = calloc((N), sizeof(*(X))) 75 76 typedef struct {77 gss_cred_id_t negotiated_cred_id;78 } *gssspnego_cred;79 75 80 76 typedef struct {
Note:
See TracChangeset
for help on using the changeset viewer.