50 if (challenge == NULL)
60 *mech_data = challenge;
68 const char *input,
size_t input_len,
69 char **output,
size_t *output_len)
71 char *challenge = mech_data;
74 char *username = NULL;
80 *output_len = strlen (challenge);
81 *output = strdup (challenge);
86 if (input_len <=
MD5LEN * 2)
89 if (input[input_len -
MD5LEN * 2 - 1] !=
' ')
92 username = calloc (1, input_len -
MD5LEN * 2);
96 memcpy (username, input, input_len -
MD5LEN * 2 - 1);
114 normkey, strlen (normkey), hash);
118 if (memcmp (&input[input_len -
MD5LEN * 2], hash, 2 *
MD5LEN) == 0)
133 char *challenge = mech_data;
int cram_md5_challenge(char challenge[CRAM_MD5_CHALLENGE_LEN])
#define CRAM_MD5_CHALLENGE_LEN
int _gsasl_cram_md5_server_step(Gsasl_session *sctx, void *mech_data, const char *input, size_t input_len, char **output, size_t *output_len)
void _gsasl_cram_md5_server_finish(Gsasl_session *sctx _GL_UNUSED, void *mech_data)
int _gsasl_cram_md5_server_start(Gsasl_session *sctx _GL_UNUSED, void **mech_data)
void cram_md5_digest(const char *challenge, size_t challengelen, const char *secret, size_t secretlen, char response[CRAM_MD5_DIGEST_LEN])
#define CRAM_MD5_DIGEST_LEN
@ GSASL_AUTHENTICATION_ERROR
@ GSASL_MECHANISM_PARSE_ERROR
_GSASL_API int gsasl_property_set(Gsasl_session *sctx, Gsasl_property prop, const char *data)
_GSASL_API const char * gsasl_property_get(Gsasl_session *sctx, Gsasl_property prop)
_GSASL_API int gsasl_saslprep(const char *in, Gsasl_saslprep_flags flags, char **out, int *stringpreprc)