Lines Matching refs:utils
91 static int uef_init(const sasl_utils_t *utils);
235 const sasl_utils_t *utils; member
329 DigestCalcResponse(const sasl_utils_t * utils, in DigestCalcResponse() argument
349 utils->MD5Init(&Md5Ctx); in DigestCalcResponse()
352 utils->MD5Update(&Md5Ctx, pszMethod, strlen((char *) pszMethod)); in DigestCalcResponse()
354 utils->MD5Update(&Md5Ctx, (unsigned char *) COLON, 1); in DigestCalcResponse()
357 utils->MD5Update(&Md5Ctx, pszDigestUri, strlen((char *) pszDigestUri)); in DigestCalcResponse()
360 utils->MD5Update(&Md5Ctx, COLON, 1); in DigestCalcResponse()
361 utils->MD5Update(&Md5Ctx, HEntity, HASHHEXLEN); in DigestCalcResponse()
363 utils->MD5Final(HA2, &Md5Ctx); in DigestCalcResponse()
367 utils->MD5Init(&Md5Ctx); in DigestCalcResponse()
368 utils->MD5Update(&Md5Ctx, HA1, HASHHEXLEN); in DigestCalcResponse()
369 utils->MD5Update(&Md5Ctx, COLON, 1); in DigestCalcResponse()
370 utils->MD5Update(&Md5Ctx, pszNonce, strlen((char *) pszNonce)); in DigestCalcResponse()
371 utils->MD5Update(&Md5Ctx, COLON, 1); in DigestCalcResponse()
375 utils->MD5Update(&Md5Ctx, (unsigned char *)ncvalue, strlen(ncvalue)); in DigestCalcResponse()
377 utils->MD5Update(&Md5Ctx, ncvalue, strlen(ncvalue)); in DigestCalcResponse()
379 utils->MD5Update(&Md5Ctx, COLON, 1); in DigestCalcResponse()
380 utils->MD5Update(&Md5Ctx, pszCNonce, strlen((char *) pszCNonce)); in DigestCalcResponse()
381 utils->MD5Update(&Md5Ctx, COLON, 1); in DigestCalcResponse()
382 utils->MD5Update(&Md5Ctx, pszQop, strlen((char *) pszQop)); in DigestCalcResponse()
383 utils->MD5Update(&Md5Ctx, COLON, 1); in DigestCalcResponse()
385 utils->MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN); in DigestCalcResponse()
386 utils->MD5Final(RespHash, &Md5Ctx); in DigestCalcResponse()
412 void MD5_UTF8_8859_1(const sasl_utils_t * utils, in MD5_UTF8_8859_1() argument
425 utils->MD5Update(ctx, base, len); in MD5_UTF8_8859_1()
432 utils->MD5Update(ctx, base, scan - base); in MD5_UTF8_8859_1()
436 utils->MD5Update(ctx, &cbuf, 1); in MD5_UTF8_8859_1()
442 static void DigestCalcSecret(const sasl_utils_t * utils, in DigestCalcSecret() argument
457 utils->MD5Init(&Md5Ctx); in DigestCalcSecret()
461 MD5_UTF8_8859_1(utils, &Md5Ctx, In_8859_1, in DigestCalcSecret()
464 utils->MD5Update(&Md5Ctx, COLON, 1); in DigestCalcSecret()
468 utils->MD5Update(&Md5Ctx, pszRealm, strlen((char *) pszRealm)); in DigestCalcSecret()
471 utils->MD5Update(&Md5Ctx, COLON, 1); in DigestCalcSecret()
475 MD5_UTF8_8859_1(utils, &Md5Ctx, In_8859_1, in DigestCalcSecret()
478 utils->MD5Final(HA1, &Md5Ctx); in DigestCalcSecret()
481 static unsigned char *create_nonce(const sasl_utils_t * utils) in create_nonce() argument
486 char *ret = (char *) utils->malloc(NONCE_SIZE); in create_nonce()
500 utils->rand(utils->rpool, (char *) ret, NONCE_SIZE); in create_nonce()
503 utils->rand(utils->rpool, (char *) ret, NONCE_SIZE); in create_nonce()
509 base64buf = (unsigned char *) utils->malloc(base64len + 1); in create_nonce()
512 utils->log(utils->conn, SASL_LOG_ERR, in create_nonce()
515 utils->seterror(utils->conn, 0, "Unable to allocate final buffer"); in create_nonce()
523 if (utils->encode64(ret, NONCE_SIZE, in create_nonce()
525 utils->free(ret); in create_nonce()
528 utils->free(ret); in create_nonce()
533 static int add_to_challenge(const sasl_utils_t *utils, in add_to_challenge() argument
543 ret = _plug_buf_alloc(utils, str, buflen, in add_to_challenge()
832 c = (des_context_t *) text->utils->malloc(2 * sizeof(des_context_t));
959 c = (des_context_t *) text->utils->malloc(2 * sizeof(des_context_t));
986 if (text->cipher_enc_context) text->utils->free(text->cipher_enc_context);
1099 if(text->cipher_enc_context) text->utils->free(text->cipher_enc_context);
1100 if(text->cipher_dec_context) text->utils->free(text->cipher_dec_context);
1118 (cipher_context_t *) text->utils->malloc(sizeof(rc4_context_t));
1122 (cipher_context_t *) text->utils->malloc(sizeof(rc4_context_t));
1125 text->utils->free(text->cipher_enc_context);
1292 enc_context = text->utils->malloc(sizeof (uef_context_t));
1299 text->utils->free(enc_context);
1301 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1310 text->utils->free(enc_context);
1313 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1325 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1331 dec_context = text->utils->malloc(sizeof(uef_context_t));
1339 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1342 text->utils->free(dec_context);
1362 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1366 text->utils->free(dec_context);
1375 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1421 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1428 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1435 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1439 text->utils->free(enc_context);
1445 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1452 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1460 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1464 text->utils->free(dec_context);
1488 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1500 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1528 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1539 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1569 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1576 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1633 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1664 const sasl_utils_t *utils, argument
1670 utils->MD5Init(&Md5Ctx);
1671 utils->MD5Update(&Md5Ctx, key, keylen);
1673 utils->MD5Update(&Md5Ctx, (const unsigned char *) SEALING_SERVER_CLIENT,
1676 utils->MD5Update(&Md5Ctx, (const unsigned char *) SEALING_CLIENT_SERVER,
1679 utils->MD5Final((unsigned char *) enckey, &Md5Ctx);
1681 utils->MD5Init(&Md5Ctx);
1682 utils->MD5Update(&Md5Ctx, key, keylen);
1684 utils->MD5Update(&Md5Ctx, (const unsigned char *)SEALING_SERVER_CLIENT,
1687 utils->MD5Update(&Md5Ctx, (const unsigned char *)SEALING_CLIENT_SERVER,
1690 utils->MD5Final((unsigned char *) deckey, &Md5Ctx);
1694 utils->MD5Init(&Md5Ctx);
1695 utils->MD5Update(&Md5Ctx, text->HA1, HASHLEN);
1697 utils->MD5Update(&Md5Ctx, (const unsigned char *)SIGNING_SERVER_CLIENT,
1700 utils->MD5Update(&Md5Ctx, (const unsigned char *)SIGNING_CLIENT_SERVER,
1703 utils->MD5Final(text->Ki_send, &Md5Ctx);
1706 utils->MD5Init(&Md5Ctx);
1707 utils->MD5Update(&Md5Ctx, text->HA1, HASHLEN);
1709 utils->MD5Update(&Md5Ctx, (const unsigned char *)SIGNING_SERVER_CLIENT,
1712 utils->MD5Update(&Md5Ctx, (const unsigned char *)SIGNING_CLIENT_SERVER,
1715 utils->MD5Final(text->Ki_receive, &Md5Ctx);
1741 PARAMERROR(text->utils);
1746 ret = _plug_iovec_to_buf(text->utils, invec, numiov, &text->enc_in_buf);
1757 ret = _plug_buf_alloc(text->utils, &(text->encode_buf),
1777 text->utils->hmac_md5((const unsigned char *) text->encode_buf,
1854 text->buffer=text->utils->malloc(text->size+5);
1856 text->buffer=text->utils->realloc(text->buffer,
1894 result = _plug_buf_alloc(text->utils, &text->decode_once_buf,
1923 text->utils->seterror(text->utils->conn, 0,
1926 text->utils->seterror(text->utils->conn, 0, "Wrong Version");
1934 result = _plug_buf_alloc(text->utils, &text->decode_tmp_buf,
1943 text->utils->hmac_md5((const unsigned char *) text->decode_tmp_buf,
1952 text->utils->log(text->utils->conn, SASL_LOG_ERR,
1956 text->utils->seterror(text->utils->conn, 0,
1969 text->utils->log(text->utils->conn, SASL_LOG_ERR,
1972 text->utils->seterror(text->utils->conn, 0,
1993 ret = _plug_decode(text->utils, context, input, inputlen,
2017 PARAMERROR( text->utils );
2022 ret = _plug_iovec_to_buf(text->utils, invec, numiov,
2036 ret = _plug_buf_alloc(text->utils, &(text->encode_buf),
2048 text->utils->hmac_md5((unsigned char *)text->encode_buf,
2052 text->utils->hmac_md5(text->encode_buf, inblob->curlen + 4,
2094 ret = _plug_buf_alloc(text->utils, &(text->MAC_buf),
2105 text->utils->hmac_md5((unsigned char *)text->MAC_buf, inputlen + 4,
2109 text->utils->hmac_md5(text->MAC_buf, inputlen + 4,
2140 text->utils->log(text->utils->conn, SASL_LOG_ERR,
2144 text->utils->seterror(text->utils->conn, 0, "MAC doesn't match");
2152 result = _plug_buf_alloc(text->utils, &text->decode_once_buf,
2205 text->buffer=text->utils->malloc(text->size+5);
2207 text->buffer=text->utils->realloc(text->buffer,text->size+5);
2254 ret = _plug_decode(text->utils, context, input, inputlen,
2264 digestmd5_common_mech_dispose(void *conn_context, const sasl_utils_t *utils) argument
2268 if (!text || !utils) return;
2270 if (text->authid) utils->free(text->authid);
2271 if (text->realm) utils->free(text->realm);
2272 if (text->nonce) utils->free(text->nonce);
2273 if (text->cnonce) utils->free(text->cnonce);
2278 if (text->response_value) utils->free(text->response_value);
2280 if (text->buffer) utils->free(text->buffer);
2281 if (text->encode_buf) utils->free(text->encode_buf);
2282 if (text->decode_buf) utils->free(text->decode_buf);
2283 if (text->decode_once_buf) utils->free(text->decode_once_buf);
2284 if (text->decode_tmp_buf) utils->free(text->decode_tmp_buf);
2285 if (text->out_buf) utils->free(text->out_buf);
2286 if (text->MAC_buf) utils->free(text->MAC_buf);
2289 if (text->enc_in_buf->data) utils->free(text->enc_in_buf->data);
2290 utils->free(text->enc_in_buf);
2293 utils->free(conn_context);
2298 const sasl_utils_t *utils) argument
2302 if (reauth->authid) utils->free(reauth->authid);
2303 if (reauth->realm) utils->free(reauth->realm);
2304 if (reauth->nonce) utils->free(reauth->nonce);
2305 if (reauth->cnonce) utils->free(reauth->cnonce);
2308 if (reauth->u.c.serverFQDN) utils->free(reauth->u.c.serverFQDN);
2315 digestmd5_common_mech_free(void *glob_context, const sasl_utils_t *utils) argument
2323 clear_reauth_entry(&reauth_cache->e[n], reauth_cache->i_am, utils);
2324 if (reauth_cache->e) utils->free(reauth_cache->e);
2326 if (reauth_cache->mutex) utils->mutex_free(reauth_cache->mutex);
2328 utils->free(reauth_cache);
2343 const sasl_utils_t * utils, argument
2353 utils->MD5Init(&Md5Ctx);
2354 utils->MD5Update(&Md5Ctx, HA1, HASHLEN);
2355 utils->MD5Update(&Md5Ctx, COLON, 1);
2356 utils->MD5Update(&Md5Ctx, pszNonce, strlen((char *) pszNonce));
2357 utils->MD5Update(&Md5Ctx, COLON, 1);
2358 utils->MD5Update(&Md5Ctx, pszCNonce, strlen((char *) pszCNonce));
2360 utils->MD5Update(&Md5Ctx, COLON, 1);
2361 utils->MD5Update(&Md5Ctx, authorization_id, strlen((char *) authorization_id));
2363 utils->MD5Final(HA1, &Md5Ctx);
2373 const sasl_utils_t * utils, argument
2392 utils,
2399 DigestCalcResponse(utils,
2412 result = utils->malloc(HASHHEXLEN + 1);
2423 DigestCalcResponse(utils,
2436 *response_value = utils->malloc(HASHHEXLEN + 1);
2456 params->utils->log(params->utils->conn, SASL_LOG_ERR,
2459 params->utils->seterror(params->utils->conn, 0,
2468 params->utils->log(params->utils->conn, SASL_LOG_ERR,
2471 params->utils->seterror(params->utils->conn, 0,
2540 text = sparams->utils->malloc(sizeof(server_context_t));
2573 sparams->utils->log(sparams->utils->conn, SASL_LOG_DEBUG,
2609 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2634 nonce = create_nonce(sparams->utils);
2638 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2641 SETERROR(sparams->utils, "internal erorr: failed creating a nonce");
2651 result = _plug_buf_alloc(sparams->utils, &(text->out_buf),
2655 sparams->utils->free(nonce);
2666 if (realm && add_to_challenge(sparams->utils,
2671 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2673 sparams->utils->free(nonce);
2675 SETERROR(sparams->utils, "internal error: add_to_challenge failed");
2688 if (add_to_challenge(sparams->utils,
2693 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2695 sparams->utils->free(nonce);
2697 SETERROR(sparams->utils, "internal error: add_to_challenge 3 failed");
2708 if (add_to_challenge(sparams->utils,
2713 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2715 sparams->utils->free(nonce);
2717 SETERROR(sparams->utils,
2726 add_to_challenge(sparams->utils,
2730 sparams->utils->free(nonce);
2731 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2735 SETERROR(sparams->utils, "internal error: add_to_challenge failed");
2750 if (add_to_challenge(sparams->utils,
2755 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2758 SETERROR(sparams->utils,
2766 if (add_to_challenge(sparams->utils,
2771 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2773 sparams->utils->free(nonce);
2775 SETERROR(sparams->utils, "internal error: add_to_challenge 6 failed");
2792 if (add_to_challenge(sparams->utils,
2797 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2799 sparams->utils->free(nonce);
2801 SETERROR(sparams->utils, "internal error: add_to_challenge 7 failed");
2811 sparams->utils->free(nonce);
2812 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2815 SETERROR(sparams->utils,
2822 _plug_strdup(sparams->utils, realm, &text->realm, NULL);
2880 sparams->utils->log(sparams->utils->conn, SASL_LOG_DEBUG,
2883 in = sparams->utils->malloc(clientinlen + 1);
2911 _plug_strdup(sparams->utils, value, &username, NULL);
2913 _plug_strdup(sparams->utils, value, &authorization_id, NULL);
2915 _plug_strdup(sparams->utils, value, (char **) &cnonce, NULL);
2919 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2922 SETERROR(sparams->utils,
2931 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2934 SETERROR(sparams->utils,
2940 _plug_strdup(sparams->utils, value, &realm, NULL);
2942 _plug_strdup(sparams->utils, value, (char **) &nonce, NULL);
2944 _plug_strdup(sparams->utils, value, &qop, NULL);
2952 _plug_strdup(sparams->utils, value, &digesturi, NULL);
2962 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2965 SETERROR(sparams->utils,
2974 _plug_strdup(sparams->utils, value, &response, NULL);
2976 _plug_strdup(sparams->utils, value, &cipher, NULL);
2982 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2985 SETERROR(sparams->utils,
2992 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2995 SETERROR(sparams->utils, "invalid maxbuf parameter");
3002 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3005 SETERROR(sparams->utils,
3014 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3017 SETERROR(sparams->utils, "client doesn't support UTF-8");
3022 _plug_strdup(sparams->utils, value, &charset, NULL);
3024 sparams->utils->log(sparams->utils->conn, SASL_LOG_DEBUG,
3051 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3054 SETERROR(sparams->utils, "required parameters missing");
3064 if (sparams->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
3068 _plug_strdup(sparams->utils, text->reauth->e[val].realm,
3071 _plug_strdup(sparams->utils, (char *)text->reauth->e[val].nonce,
3074 _plug_strdup(sparams->utils, text->reauth->e[val].nonce,
3079 _plug_strdup(sparams->utils, (char *)text->reauth->e[val].cnonce,
3082 _plug_strdup(sparams->utils, text->reauth->e[val].cnonce,
3087 sparams->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
3103 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3107 SETERROR(sparams->utils,
3115 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3119 SETERROR(sparams->utils,
3127 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3130 SETERROR(sparams->utils,
3138 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3142 SETERROR(sparams->utils,
3149 result = sparams->utils->prop_request(sparams->propctx, password_request);
3152 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3155 SETERROR(sparams->utils, "unable to resquest user password");
3162 result = sparams->canon_user(sparams->utils->conn,
3166 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3169 SETERROR(sparams->utils, "unable canonify user and get auxprops");
3175 result = sparams->canon_user(sparams->utils->conn,
3178 result = sparams->canon_user(sparams->utils->conn,
3185 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3188 SETERROR(sparams->utils, "unable authorization ID");
3193 result = sparams->utils->prop_getnames(sparams->propctx, password_request,
3200 sparams->utils->seterror(sparams->utils->conn, 0,
3203 sparams->utils->seterror(sparams->utils->conn, 0,
3214 sparams->utils->seterror(sparams->utils->conn,0,
3217 sparams->utils->seterror(sparams->utils->conn,0,
3224 sec = sparams->utils->malloc(sizeof(sasl_secret_t) + len);
3227 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3230 SETERROR(sparams->utils, "unable to allocate secret");
3255 DigestCalcSecret(sparams->utils, (unsigned char *)username,
3259 DigestCalcSecret(sparams->utils, username,
3273 _plug_free_secret(sparams->utils, &sec);
3279 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3282 sparams->utils->seterror(sparams->utils->conn, 0,
3295 _plug_strdup(sparams->utils, "auth", &qop, NULL);
3329 sparams->utils->log(sparams->utils->conn, SASL_LOG_WARN,
3332 SETERROR(sparams->utils, "client requested invalid cipher");
3353 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3356 SETERROR(sparams->utils,
3364 sparams->utils,
3376 SETERROR(sparams->utils, "internal error: unable to create response");
3385 SETERROR(sparams->utils,
3388 SETERROR(sparams->utils,
3400 SETERROR(sparams->utils, gettext("server nonce expired"));
3402 SETERROR(sparams->utils, "server nonce expired");
3441 text->utils = sparams->utils;
3451 create_layer_keys(text, sparams->utils,text->HA1,n,enckey,deckey);
3459 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3467 sparams->utils->seterror(sparams->utils->conn, 0,
3493 result = _plug_buf_alloc(sparams->utils, &(text->out_buf),
3515 sparams->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
3523 clear_reauth_entry(&text->reauth->e[val], SERVER, sparams->utils);
3531 clear_reauth_entry(&text->reauth->e[val], SERVER, sparams->utils);
3541 clear_reauth_entry(&text->reauth->e[val], SERVER, sparams->utils);
3547 sparams->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
3551 if (in_start) sparams->utils->free (in_start);
3554 sparams->utils->free (username);
3557 sparams->utils->free (authorization_id);
3560 sparams->utils->free (realm);
3562 sparams->utils->free (nonce);
3564 sparams->utils->free (cnonce);
3566 sparams->utils->free (response);
3568 sparams->utils->free (cipher);
3570 sparams->utils->free(serverresponse);
3572 sparams->utils->free (charset);
3574 sparams->utils->free (digesturi);
3576 sparams->utils->free (qop);
3578 _plug_free_secret(sparams->utils, &sec);
3632 sparams->utils->log(sparams->utils->conn, SASL_LOG_WARN,
3635 sparams->utils->log(NULL, SASL_LOG_WARN,
3656 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3659 sparams->utils->log(NULL, SASL_LOG_ERR,
3671 digestmd5_server_mech_dispose(void *conn_context, const sasl_utils_t *utils) argument
3675 if (!stext || !utils) return;
3677 digestmd5_common_mech_dispose(conn_context, utils);
3708 int digestmd5_server_plug_init(sasl_utils_t *utils, argument
3725 if ((ret = uef_init(utils)) != SASL_OK)
3730 reauth_cache = utils->malloc(sizeof(reauth_cache_t));
3737 utils->getopt(utils->getopt_context, "DIGEST-MD5", "reauth_timeout",
3750 reauth_cache->mutex = utils->mutex_alloc();
3756 reauth_cache->e = utils->malloc(reauth_cache->size *
3805 const sasl_utils_t * utils, argument
3817 DigestCalcSecret(utils,
3825 utils->MD5Init(&Md5Ctx);
3826 utils->MD5Update(&Md5Ctx, HA1, HASHLEN);
3827 utils->MD5Update(&Md5Ctx, COLON, 1);
3828 utils->MD5Update(&Md5Ctx, pszNonce, strlen((char *) pszNonce));
3829 utils->MD5Update(&Md5Ctx, COLON, 1);
3830 utils->MD5Update(&Md5Ctx, pszCNonce, strlen((char *) pszCNonce));
3832 utils->MD5Update(&Md5Ctx, COLON, 1);
3833 utils->MD5Update(&Md5Ctx, pszAuthorization_id,
3836 utils->MD5Final(HA1, &Md5Ctx);
3848 const sasl_utils_t * utils, argument
3867 PARAMERROR( utils );
3882 utils,
3891 DigestCalcResponse(utils,
3904 result = utils->malloc(HASHHEXLEN + 1);
3913 DigestCalcResponse(utils,
3928 utils->free(*response_value);
3930 *response_value = utils->malloc(HASHHEXLEN + 1);
3985 digesturi = params->utils->malloc(strlen(params->service) + 1 +
4004 params->utils,
4033 result =_plug_buf_alloc(params->utils, &(text->out_buf),
4040 if (add_to_challenge(params->utils,
4048 if (add_to_challenge(params->utils,
4060 if (add_to_challenge(params->utils,
4066 if (add_to_challenge(params->utils,
4073 if (add_to_challenge(params->utils,
4079 if (add_to_challenge(params->utils,
4086 if (add_to_challenge(params->utils,
4098 if (add_to_challenge(params->utils,
4103 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4106 SETERROR(params->utils,
4114 if (add_to_challenge(params->utils,
4122 if (add_to_challenge(params->utils,
4128 if (add_to_challenge(params->utils,
4167 text->utils = params->utils;
4180 create_layer_keys(text, params->utils, text->HA1, nbits,
4189 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4203 if (digesturi) params->utils->free(digesturi);
4204 if (response) params->utils->free(response);
4232 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4235 params->utils->seterror(params->utils->conn, 0,
4241 in_start = in = params->utils->malloc(serverinlen + 1);
4250 text->cnonce = create_nonce(params->utils);
4253 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4256 params->utils->seterror(params->utils->conn, 0,
4272 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4275 params->utils->seterror(params->utils->conn, 0, "Parse error");
4285 realms = params->utils->malloc(sizeof(char *) * (nrealm + 1));
4287 realms = params->utils->realloc(realms,
4295 _plug_strdup(params->utils, value, &realms[nrealm-1], NULL);
4298 _plug_strdup(params->utils, value, (char **) &text->nonce,
4315 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4326 params->utils->seterror(params->utils->conn, 0,
4329 params->utils->seterror(params->utils->conn, 0,
4355 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4365 _plug_free_secret(params->utils, &ctext->password);
4380 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4384 params->utils->seterror(params->utils->conn, 0,
4391 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4394 params->utils->seterror(params->utils->conn, 0,
4402 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4406 params->utils->seterror(params->utils->conn, 0,
4416 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4419 params->utils->seterror(params->utils->conn, 0,
4432 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4435 params->utils->seterror(params->utils->conn, 0,
4446 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4449 params->utils->seterror(params->utils->conn, 0,
4456 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4464 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4467 params->utils->seterror(params->utils->conn, 0,
4477 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4480 params->utils->seterror(params->utils->conn, 0,
4536 params->utils->seterror(params->utils->conn, 0,
4539 params->utils->seterror(params->utils->conn, 0,
4564 params->utils->seterror(params->utils->conn, 0,
4567 params->utils->seterror(params->utils->conn, 0,
4575 params->utils->seterror(params->utils->conn, 0,
4578 params->utils->seterror(params->utils->conn, 0,
4590 if (in_start) params->utils->free(in_start);
4597 params->utils->free(realms[lup]);
4599 params->utils->free(realms);
4622 auth_result = _plug_get_authid(params->utils, &authid, prompt_need);
4631 user_result = _plug_get_userid(params->utils, &userid, prompt_need);
4640 pass_result = _plug_get_password(params->utils, &ctext->password,
4656 realm_result = _plug_get_realm(params->utils,
4675 params->utils->free(*prompt_need);
4685 realm_chal = params->utils->malloc(3+strlen(params->serverFQDN));
4696 _plug_make_prompts(params->utils, &ctext->h, prompt_need,
4698 convert_prompt(params->utils, &ctext->h,
4703 convert_prompt(params->utils, &ctext->h,
4708 convert_prompt(params->utils, &ctext->h,
4714 convert_prompt(params->utils, &ctext->h,
4718 _plug_make_prompts(params->utils, prompt_need,
4741 result = params->canon_user(params->utils->conn, authid, 0,
4746 result = params->canon_user(params->utils->conn,
4750 result = params->canon_user(params->utils->conn,
4758 _plug_strdup(params->utils, realm, (char **) &text->realm, NULL);
4772 text = params->utils->malloc(sizeof(client_context_t));
4800 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4808 if (params->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
4815 if (text->realm) params->utils->free(text->realm);
4816 if (text->nonce) params->utils->free(text->nonce);
4817 if (text->cnonce) params->utils->free(text->cnonce);
4820 _plug_strdup(params->utils, text->reauth->e[val].realm,
4823 _plug_strdup(params->utils, (char *)text->reauth->e[val].nonce,
4826 _plug_strdup(params->utils, text->reauth->e[val].nonce,
4831 _plug_strdup(params->utils, (char *)text->reauth->e[val].cnonce,
4834 _plug_strdup(params->utils, text->reauth->e[val].cnonce,
4841 params->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
4881 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4899 params->utils->free(realms);
4929 params->utils->free(realms[lup]);
4931 params->utils->free(realms);
4952 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4956 in_start = in = params->utils->malloc(serverinlen + 1);
4969 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4972 params->utils->seterror(params->utils->conn, 0,
4982 params->utils->seterror(params->utils->conn, 0,
4985 params->utils->seterror(params->utils->conn, 0,
4997 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
5003 params->utils->free(in_start);
5005 if (params->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
5011 clear_reauth_entry(&text->reauth->e[val], CLIENT, params->utils);
5012 _plug_strdup(params->utils, oparams->authid,
5018 _plug_strdup(params->utils, params->serverFQDN,
5033 clear_reauth_entry(&text->reauth->e[val], CLIENT, params->utils);
5039 params->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
5072 if (params->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
5076 params->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
5109 if (params->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
5110 clear_reauth_entry(&text->reauth->e[val], CLIENT, params->utils);
5112 params->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
5115 if (text->realm) params->utils->free(text->realm);
5116 if (text->nonce) params->utils->free(text->nonce);
5117 if (text->cnonce) params->utils->free(text->cnonce);
5136 params->utils->log(params->utils->conn, SASL_LOG_ERR,
5139 params->utils->log(NULL, SASL_LOG_ERR,
5149 digestmd5_client_mech_dispose(void *conn_context, const sasl_utils_t *utils) argument
5153 if (!ctext || !utils) return;
5156 convert_prompt(utils, &ctext->h, NULL);
5159 if (ctext->free_password) _plug_free_secret(utils, &ctext->password);
5161 digestmd5_common_mech_dispose(conn_context, utils);
5191 int digestmd5_client_plug_init(sasl_utils_t *utils, argument
5206 if ((ret = uef_init(utils)) != SASL_OK)
5211 reauth_cache = utils->malloc(sizeof(reauth_cache_t));
5218 reauth_cache->mutex = utils->mutex_alloc();
5224 reauth_cache->e = utils->malloc(reauth_cache->size *
5256 getSlotID(const sasl_utils_t *utils, CK_MECHANISM_TYPE mech_type, argument
5270 utils->log(utils->conn, SASL_LOG_DEBUG,
5276 pSlotList = utils->calloc(sizeof (CK_SLOT_ID), ulSlotCount);
5283 utils->log(utils->conn, SASL_LOG_DEBUG,
5294 utils->log(utils->conn, SASL_LOG_DEBUG,
5298 utils->free(pSlotList);
5302 utils->calloc(sizeof (CK_MECHANISM_TYPE), ulMechTypeCount);
5304 utils->free(pSlotList);
5310 utils->log(utils->conn, SASL_LOG_DEBUG,
5314 utils->free(pMechTypeList);
5315 utils->free(pSlotList);
5323 utils->free(pMechTypeList);
5328 utils->free(pSlotList);
5337 uef_init(const sasl_utils_t *utils) argument
5354 utils->log(utils->conn, SASL_LOG_DEBUG,
5360 got_rc4 = getSlotID(utils, CKM_RC4, &rc4_slot_id) == SASL_OK;
5362 utils->log(utils->conn, SASL_LOG_WARN, "Could not get rc4");
5364 got_des = getSlotID(utils, CKM_DES_CBC, &des_slot_id) == SASL_OK;
5366 utils->log(utils->conn, SASL_LOG_WARN, "Could not get des");
5368 got_3des = getSlotID(utils, CKM_DES3_CBC, &des3_slot_id) == SASL_OK;
5370 utils->log(utils->conn, SASL_LOG_WARN, "Could not get 3des");