| 1 | /* |
| 2 | * Copyright (c) 2011, PADL Software Pty Ltd. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * |
| 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * |
| 16 | * 3. Neither the name of PADL Software nor the names of its contributors |
| 17 | * may be used to endorse or promote products derived from this software |
| 18 | * without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY PADL SOFTWARE AND CONTRIBUTORS ``AS IS'' AND |
| 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL PADL SOFTWARE OR CONTRIBUTORS BE LIABLE |
| 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | * SUCH DAMAGE. |
| 31 | */ |
| 32 | |
| 33 | #include "mech_locl.h"cxx . . $ `<file>/lib/gssapi/mech/mech_locl.h`/ |
| 34 | |
| 35 | GSSAPI_LIB_FUNCTIONcxx . . $ `lib/gssapi/gssapi/gssapi.h:50:9`! OM_uint32cxx . . $ OM_uint32# GSSAPI_LIB_CALLcxx . . $ `lib/gssapi/gssapi/gssapi.h:51:9`! |
| 36 | gss_acquire_cred_with_passwordcxx . . $ gss_acquire_cred_with_password(e4c0aacc5f0c6214).(OM_uint32cxx . . $ OM_uint32# *minor_status, |
| 37 | gss_const_name_tcxx . . $ gss_const_name_t# desired_name, |
| 38 | const gss_buffer_tcxx . . $ gss_buffer_t# password, |
| 39 | OM_uint32cxx . . $ OM_uint32# time_req, |
| 40 | const gss_OID_setcxx . . $ gss_OID_set# desired_mechs, |
| 41 | gss_cred_usage_tcxx . . $ gss_cred_usage_t# cred_usage, |
| 42 | gss_cred_id_tcxx . . $ gss_cred_id_t# *output_cred_handle, |
| 43 | gss_OID_setcxx . . $ gss_OID_set# *actual_mechs, |
| 44 | OM_uint32cxx . . $ OM_uint32# *time_rec) |
| 45 | { |
| 46 | OM_uint32cxx . . $ OM_uint32# major_status, tmp_minor; |
| 47 | |
| 48 | if (desired_mechs == GSS_C_NO_OID_SETcxx . . $ `lib/gssapi/gssapi/gssapi.h:217:9`!) { |
| 49 | major_status = _gss_acquire_cred_extcxx . . $ _gss_acquire_cred_ext(11a8fc5f370b4ebc).(minor_status, |
| 50 | desired_name, |
| 51 | GSS_C_CRED_PASSWORDcxx . . $ `lib/gssapi/gssapi_mech.h:578:9`!, |
| 52 | password, |
| 53 | time_req, |
| 54 | GSS_C_NO_OIDcxx . . $ `lib/gssapi/gssapi/gssapi.h:216:9`!, |
| 55 | cred_usage, |
| 56 | output_cred_handle); |
| 57 | if (GSS_ERRORcxx . . $ `lib/gssapi/gssapi/gssapi.h:407:9`!(major_status)) |
| 58 | return major_status; |
| 59 | } else { |
| 60 | size_t i; |
| 61 | struct _gss_credcxx . . $ _gss_cred# *new_cred; |
| 62 | |
| 63 | new_cred = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*new_cred)); |
| 64 | if (new_cred == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 65 | *minor_status = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 66 | return GSS_S_FAILUREcxx . . $ `lib/gssapi/gssapi/gssapi.h:442:9`!; |
| 67 | } |
| 68 | HEIM_SLIST_INITcxx . . $ `lib/gssapi/mech/mechqueue.h:56:9`!(&new_cred->gc_mc); |
| 69 | |
| 70 | for (i = 0; i < desired_mechs->countcxx . . $ gss_OID_set_desc_struct#count.; i++) { |
| 71 | struct _gss_credcxx . . $ _gss_cred# *tmp_cred = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 72 | struct _gss_mechanism_credcxx . . $ _gss_mechanism_cred# *mc; |
| 73 | |
| 74 | major_status = _gss_acquire_cred_extcxx . . $ _gss_acquire_cred_ext(11a8fc5f370b4ebc).(minor_status, |
| 75 | desired_name, |
| 76 | GSS_C_CRED_PASSWORDcxx . . $ `lib/gssapi/gssapi_mech.h:578:9`!, |
| 77 | password, |
| 78 | time_req, |
| 79 | &desired_mechs->elementscxx . . $ gss_OID_set_desc_struct#elements.[i], |
| 80 | cred_usage, |
| 81 | (gss_cred_id_tcxx . . $ gss_cred_id_t# *)&tmp_cred); |
| 82 | if (GSS_ERRORcxx . . $ `lib/gssapi/gssapi/gssapi.h:407:9`!(major_status)) |
| 83 | continue; |
| 84 | |
| 85 | mc = HEIM_SLIST_FIRSTcxx . . $ `lib/gssapi/mech/mechqueue.h:94:9`!(&tmp_cred->gc_mc); |
| 86 | if (mc) { |
| 87 | HEIM_SLIST_REMOVE_HEADcxx . . $ `lib/gssapi/mech/mechqueue.h:70:9`!(&tmp_cred->gc_mc, gmc_link); |
| 88 | HEIM_SLIST_INSERT_HEADcxx . . $ `lib/gssapi/mech/mechqueue.h:65:9`!(&new_cred->gc_mc, mc, gmc_link); |
| 89 | } |
| 90 | |
| 91 | gss_release_credcxx . . $ gss_release_cred(a0ef91bb08bbfd35).(&tmp_minor, (gss_cred_id_tcxx . . $ gss_cred_id_t# *)&tmp_cred); |
| 92 | } |
| 93 | |
| 94 | if (!HEIM_SLIST_FIRSTcxx . . $ `lib/gssapi/mech/mechqueue.h:94:9`!(&new_cred->gc_mc)) { |
| 95 | freecxx . . $ free(5d22bdacc48458e8).(new_cred); |
| 96 | if (desired_mechs->countcxx . . $ gss_OID_set_desc_struct#count. > 1) |
| 97 | *minor_status = 0; |
| 98 | return GSS_S_NO_CREDcxx . . $ `lib/gssapi/gssapi/gssapi.h:436:9`!; |
| 99 | } |
| 100 | |
| 101 | *output_cred_handle = (gss_cred_id_tcxx . . $ gss_cred_id_t#)new_cred; |
| 102 | } |
| 103 | |
| 104 | if (actual_mechs != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! || time_rec != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 105 | major_status = gss_inquire_credcxx . . $ gss_inquire_cred(6a795fde9b30f171).(minor_status, |
| 106 | *output_cred_handle, |
| 107 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 108 | time_rec, |
| 109 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 110 | actual_mechs); |
| 111 | if (GSS_ERRORcxx . . $ `lib/gssapi/gssapi/gssapi.h:407:9`!(major_status)) { |
| 112 | gss_release_credcxx . . $ gss_release_cred(a0ef91bb08bbfd35).(&tmp_minor, output_cred_handle); |
| 113 | return major_status; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | *minor_status = 0; |
| 118 | return GSS_S_COMPLETEcxx . . $ `lib/gssapi/gssapi/gssapi.h:383:9`!; |
| 119 | } |