49 if (challenge == NULL)
59 *mech_data = challenge;
67 const char *input,
size_t input_len,
68 char **output,
size_t *output_len)
70 char *challenge = mech_data;
73 char *username = NULL;
79 *output_len = strlen (challenge);
80 *output = strdup (challenge);
85 if (input_len <=
MD5LEN * 2)
88 if (input[input_len -
MD5LEN * 2 - 1] !=
' ')
91 username = calloc (1, input_len -
MD5LEN * 2);
95 memcpy (username, input, input_len -
MD5LEN * 2 - 1);
113 normkey, strlen (normkey), hash);
117 if (memcmp (&input[input_len -
MD5LEN * 2], hash, 2 *
MD5LEN) == 0)
132 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)