curl_gssapi.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. *
  10. * This software is licensed as described in the file COPYING, which
  11. * you should have received as part of this distribution. The terms
  12. * are also available at http://curl.haxx.se/docs/copyright.html.
  13. *
  14. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. * copies of the Software, and permit persons to whom the Software is
  16. * furnished to do so, under the terms of the COPYING file.
  17. *
  18. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. * KIND, either express or implied.
  20. *
  21. ***************************************************************************/
  22. #include "setup.h"
  23. #ifdef HAVE_GSSAPI
  24. #include "curl_gssapi.h"
  25. #include "sendf.h"
  26. OM_uint32 Curl_gss_init_sec_context(
  27. struct SessionHandle *data,
  28. OM_uint32 * minor_status,
  29. gss_ctx_id_t * context,
  30. gss_name_t target_name,
  31. gss_channel_bindings_t input_chan_bindings,
  32. gss_buffer_t input_token,
  33. gss_buffer_t output_token,
  34. OM_uint32 * ret_flags)
  35. {
  36. OM_uint32 req_flags = GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG;
  37. if(data->set.gssapi_delegation & CURLGSSAPI_DELEGATION_POLICY_FLAG) {
  38. #ifdef GSS_C_DELEG_POLICY_FLAG
  39. req_flags |= GSS_C_DELEG_POLICY_FLAG;
  40. #else
  41. infof(data, "warning: support for CURLGSSAPI_DELEGATION_POLICY_FLAG not "
  42. "compiled in\n");
  43. #endif
  44. }
  45. if(data->set.gssapi_delegation & CURLGSSAPI_DELEGATION_FLAG)
  46. req_flags |= GSS_C_DELEG_FLAG;
  47. return gss_init_sec_context(minor_status,
  48. GSS_C_NO_CREDENTIAL, /* cred_handle */
  49. context,
  50. target_name,
  51. GSS_C_NO_OID, /* mech_type */
  52. req_flags,
  53. 0, /* time_req */
  54. input_chan_bindings,
  55. input_token,
  56. NULL, /* actual_mech_type */
  57. output_token,
  58. ret_flags,
  59. NULL /* time_rec */);
  60. }
  61. #endif /* HAVE_GSSAPI */