curl_sasl.h 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef HEADER_CURL_SASL_H
  2. #define HEADER_CURL_SASL_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at http://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. ***************************************************************************/
  24. #include "pingpong.h"
  25. /* Authentication mechanism flags */
  26. #define SASL_MECH_LOGIN (1 << 0)
  27. #define SASL_MECH_PLAIN (1 << 1)
  28. #define SASL_MECH_CRAM_MD5 (1 << 2)
  29. #define SASL_MECH_DIGEST_MD5 (1 << 3)
  30. #define SASL_MECH_GSSAPI (1 << 4)
  31. #define SASL_MECH_EXTERNAL (1 << 5)
  32. #define SASL_MECH_NTLM (1 << 6)
  33. /* Authentication mechanism values */
  34. #define SASL_AUTH_NONE 0
  35. #define SASL_AUTH_ANY ~0
  36. /* This is used to generate a base64 encoded PLAIN authentication message */
  37. CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data,
  38. const char *userp,
  39. const char *passwdp,
  40. char **outptr, size_t *outlen);
  41. /* This is used to generate a base64 encoded LOGIN authentication message
  42. containing either the user name or password details */
  43. CURLcode Curl_sasl_create_login_message(struct SessionHandle *data,
  44. const char *valuep, char **outptr,
  45. size_t *outlen);
  46. #ifndef CURL_DISABLE_CRYPTO_AUTH
  47. /* This is used to generate a base64 encoded CRAM-MD5 response message */
  48. CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
  49. const char *chlg64,
  50. const char *user,
  51. const char *passwdp,
  52. char **outptr, size_t *outlen);
  53. /* This is used to generate a base64 encoded DIGEST-MD5 response message */
  54. CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
  55. const char *chlg64,
  56. const char *user,
  57. const char *passwdp,
  58. const char *service,
  59. char **outptr, size_t *outlen);
  60. #endif
  61. #ifdef USE_NTLM
  62. /* This is used to generate a base64 encoded NTLM type-1 message */
  63. CURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,
  64. const char *passwdp,
  65. struct ntlmdata *ntlm,
  66. char **outptr,
  67. size_t *outlen);
  68. /* This is used to decode an incoming NTLM type-2 message and generate a
  69. base64 encoded type-3 response */
  70. CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
  71. const char *header,
  72. const char *userp,
  73. const char *passwdp,
  74. struct ntlmdata *ntlm,
  75. char **outptr, size_t *outlen);
  76. #endif /* USE_NTLM */
  77. /* This is used to cleanup any libraries or curl modules used by the sasl
  78. functions */
  79. void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused);
  80. #endif /* HEADER_CURL_SASL_H */