diff options
Diffstat (limited to 'plugins/FTPFileYM/curl/lib/curl_sasl.h')
-rw-r--r-- | plugins/FTPFileYM/curl/lib/curl_sasl.h | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/plugins/FTPFileYM/curl/lib/curl_sasl.h b/plugins/FTPFileYM/curl/lib/curl_sasl.h index 469c9a1e44..2b6a5a26aa 100644 --- a/plugins/FTPFileYM/curl/lib/curl_sasl.h +++ b/plugins/FTPFileYM/curl/lib/curl_sasl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -24,41 +24,61 @@ #include "pingpong.h" +/* Authentication mechanism values */ +#define SASL_AUTH_NONE 0 +#define SASL_AUTH_ANY ~0U + /* Authentication mechanism flags */ -#define SASL_MECH_LOGIN 0x0001 -#define SASL_MECH_PLAIN 0x0002 -#define SASL_MECH_CRAM_MD5 0x0004 -#define SASL_MECH_DIGEST_MD5 0x0008 -#define SASL_MECH_GSSAPI 0x0010 -#define SASL_MECH_EXTERNAL 0x0020 -#define SASL_MECH_NTLM 0x0040 +#define SASL_MECH_LOGIN (1 << 0) +#define SASL_MECH_PLAIN (1 << 1) +#define SASL_MECH_CRAM_MD5 (1 << 2) +#define SASL_MECH_DIGEST_MD5 (1 << 3) +#define SASL_MECH_GSSAPI (1 << 4) +#define SASL_MECH_EXTERNAL (1 << 5) +#define SASL_MECH_NTLM (1 << 6) +#define SASL_MECH_XOAUTH2 (1 << 7) + +/* Authentication mechanism strings */ +#define SASL_MECH_STRING_LOGIN "LOGIN" +#define SASL_MECH_STRING_PLAIN "PLAIN" +#define SASL_MECH_STRING_CRAM_MD5 "CRAM-MD5" +#define SASL_MECH_STRING_DIGEST_MD5 "DIGEST-MD5" +#define SASL_MECH_STRING_GSSAPI "GSSAPI" +#define SASL_MECH_STRING_EXTERNAL "EXTERNAL" +#define SASL_MECH_STRING_NTLM "NTLM" +#define SASL_MECH_STRING_XOAUTH2 "XOAUTH2" + +/* This is used to test whether the line starts with the given mechanism */ +#define sasl_mech_equal(line, wordlen, mech) \ + (wordlen == (sizeof(mech) - 1) / sizeof(char) && \ + !memcmp(line, mech, wordlen)) /* This is used to generate a base64 encoded PLAIN authentication message */ CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data, - const char* userp, - const char* passwdp, + const char *userp, + const char *passwdp, char **outptr, size_t *outlen); /* This is used to generate a base64 encoded LOGIN authentication message containing either the user name or password details */ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data, - const char* valuep, char **outptr, + const char *valuep, char **outptr, size_t *outlen); #ifndef CURL_DISABLE_CRYPTO_AUTH /* This is used to generate a base64 encoded CRAM-MD5 response message */ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, - const char* chlg64, - const char* user, - const char* passwdp, + const char *chlg64, + const char *user, + const char *passwdp, char **outptr, size_t *outlen); /* This is used to generate a base64 encoded DIGEST-MD5 response message */ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, - const char* chlg64, - const char* user, - const char* passwdp, - const char* service, + const char *chlg64, + const char *user, + const char *passwdp, + const char *service, char **outptr, size_t *outlen); #endif @@ -81,6 +101,13 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data, #endif /* USE_NTLM */ +/* This is used to generate a base64 encoded XOAUTH2 authentication message + containing the user name and bearer token */ +CURLcode Curl_sasl_create_xoauth2_message(struct SessionHandle *data, + const char *user, + const char *bearer, + char **outptr, size_t *outlen); + /* This is used to cleanup any libraries or curl modules used by the sasl functions */ void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused); |