Lines Matching defs:utils

90 static int uef_init(const sasl_utils_t *utils);
233 /* copy of utils from the params structures */
234 const sasl_utils_t *utils;
328 DigestCalcResponse(const sasl_utils_t * utils,
348 utils->MD5Init(&Md5Ctx);
351 utils->MD5Update(&Md5Ctx, pszMethod, strlen((char *) pszMethod));
353 utils->MD5Update(&Md5Ctx, (unsigned char *) COLON, 1);
355 /* utils->MD5Update(&Md5Ctx, (unsigned char *) "AUTHENTICATE:", 13); */
356 utils->MD5Update(&Md5Ctx, pszDigestUri, strlen((char *) pszDigestUri));
359 utils->MD5Update(&Md5Ctx, COLON, 1);
360 utils->MD5Update(&Md5Ctx, HEntity, HASHHEXLEN);
362 utils->MD5Final(HA2, &Md5Ctx);
366 utils->MD5Init(&Md5Ctx);
367 utils->MD5Update(&Md5Ctx, HA1, HASHHEXLEN);
368 utils->MD5Update(&Md5Ctx, COLON, 1);
369 utils->MD5Update(&Md5Ctx, pszNonce, strlen((char *) pszNonce));
370 utils->MD5Update(&Md5Ctx, COLON, 1);
374 utils->MD5Update(&Md5Ctx, (unsigned char *)ncvalue, strlen(ncvalue));
376 utils->MD5Update(&Md5Ctx, ncvalue, strlen(ncvalue));
378 utils->MD5Update(&Md5Ctx, COLON, 1);
379 utils->MD5Update(&Md5Ctx, pszCNonce, strlen((char *) pszCNonce));
380 utils->MD5Update(&Md5Ctx, COLON, 1);
381 utils->MD5Update(&Md5Ctx, pszQop, strlen((char *) pszQop));
382 utils->MD5Update(&Md5Ctx, COLON, 1);
384 utils->MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN);
385 utils->MD5Final(RespHash, &Md5Ctx);
411 void MD5_UTF8_8859_1(const sasl_utils_t * utils,
424 utils->MD5Update(ctx, base, len);
431 utils->MD5Update(ctx, base, scan - base);
435 utils->MD5Update(ctx, &cbuf, 1);
441 static void DigestCalcSecret(const sasl_utils_t * utils,
456 utils->MD5Init(&Md5Ctx);
460 MD5_UTF8_8859_1(utils, &Md5Ctx, In_8859_1,
463 utils->MD5Update(&Md5Ctx, COLON, 1);
467 utils->MD5Update(&Md5Ctx, pszRealm, strlen((char *) pszRealm));
470 utils->MD5Update(&Md5Ctx, COLON, 1);
474 MD5_UTF8_8859_1(utils, &Md5Ctx, In_8859_1,
477 utils->MD5Final(HA1, &Md5Ctx);
480 static unsigned char *create_nonce(const sasl_utils_t * utils)
485 char *ret = (char *) utils->malloc(NONCE_SIZE);
499 utils->rand(utils->rpool, (char *) ret, NONCE_SIZE);
502 utils->rand(utils->rpool, (char *) ret, NONCE_SIZE);
508 base64buf = (unsigned char *) utils->malloc(base64len + 1);
511 utils->log(utils->conn, SASL_LOG_ERR,
514 utils->seterror(utils->conn, 0, "Unable to allocate final buffer");
522 if (utils->encode64(ret, NONCE_SIZE,
524 utils->free(ret);
527 utils->free(ret);
532 static int add_to_challenge(const sasl_utils_t *utils,
542 ret = _plug_buf_alloc(utils, str, buflen,
831 c = (des_context_t *) text->utils->malloc(2 * sizeof(des_context_t));
958 c = (des_context_t *) text->utils->malloc(2 * sizeof(des_context_t));
985 if (text->cipher_enc_context) text->utils->free(text->cipher_enc_context);
1098 if(text->cipher_enc_context) text->utils->free(text->cipher_enc_context);
1099 if(text->cipher_dec_context) text->utils->free(text->cipher_dec_context);
1117 (cipher_context_t *) text->utils->malloc(sizeof(rc4_context_t));
1121 (cipher_context_t *) text->utils->malloc(sizeof(rc4_context_t));
1124 text->utils->free(text->cipher_enc_context);
1291 enc_context = text->utils->malloc(sizeof (uef_context_t));
1298 text->utils->free(enc_context);
1300 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1309 text->utils->free(enc_context);
1312 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1324 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1330 dec_context = text->utils->malloc(sizeof(uef_context_t));
1338 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1341 text->utils->free(dec_context);
1361 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1365 text->utils->free(dec_context);
1374 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1420 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1427 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1434 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1438 text->utils->free(enc_context);
1444 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1451 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1459 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1463 text->utils->free(dec_context);
1487 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1499 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1527 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1538 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1568 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1575 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1632 text->utils->log(text->utils->conn, SASL_LOG_DEBUG,
1663 const sasl_utils_t *utils,
1669 utils->MD5Init(&Md5Ctx);
1670 utils->MD5Update(&Md5Ctx, key, keylen);
1672 utils->MD5Update(&Md5Ctx, (const unsigned char *) SEALING_SERVER_CLIENT,
1675 utils->MD5Update(&Md5Ctx, (const unsigned char *) SEALING_CLIENT_SERVER,
1678 utils->MD5Final((unsigned char *) enckey, &Md5Ctx);
1680 utils->MD5Init(&Md5Ctx);
1681 utils->MD5Update(&Md5Ctx, key, keylen);
1683 utils->MD5Update(&Md5Ctx, (const unsigned char *)SEALING_SERVER_CLIENT,
1686 utils->MD5Update(&Md5Ctx, (const unsigned char *)SEALING_CLIENT_SERVER,
1689 utils->MD5Final((unsigned char *) deckey, &Md5Ctx);
1693 utils->MD5Init(&Md5Ctx);
1694 utils->MD5Update(&Md5Ctx, text->HA1, HASHLEN);
1696 utils->MD5Update(&Md5Ctx, (const unsigned char *)SIGNING_SERVER_CLIENT,
1699 utils->MD5Update(&Md5Ctx, (const unsigned char *)SIGNING_CLIENT_SERVER,
1702 utils->MD5Final(text->Ki_send, &Md5Ctx);
1705 utils->MD5Init(&Md5Ctx);
1706 utils->MD5Update(&Md5Ctx, text->HA1, HASHLEN);
1708 utils->MD5Update(&Md5Ctx, (const unsigned char *)SIGNING_SERVER_CLIENT,
1711 utils->MD5Update(&Md5Ctx, (const unsigned char *)SIGNING_CLIENT_SERVER,
1714 utils->MD5Final(text->Ki_receive, &Md5Ctx);
1740 PARAMERROR(text->utils);
1745 ret = _plug_iovec_to_buf(text->utils, invec, numiov, &text->enc_in_buf);
1756 ret = _plug_buf_alloc(text->utils, &(text->encode_buf),
1776 text->utils->hmac_md5((const unsigned char *) text->encode_buf,
1853 text->buffer=text->utils->malloc(text->size+5);
1855 text->buffer=text->utils->realloc(text->buffer,
1893 result = _plug_buf_alloc(text->utils, &text->decode_once_buf,
1922 text->utils->seterror(text->utils->conn, 0,
1925 text->utils->seterror(text->utils->conn, 0, "Wrong Version");
1933 result = _plug_buf_alloc(text->utils, &text->decode_tmp_buf,
1942 text->utils->hmac_md5((const unsigned char *) text->decode_tmp_buf,
1951 text->utils->log(text->utils->conn, SASL_LOG_ERR,
1955 text->utils->seterror(text->utils->conn, 0,
1968 text->utils->log(text->utils->conn, SASL_LOG_ERR,
1971 text->utils->seterror(text->utils->conn, 0,
1992 ret = _plug_decode(text->utils, context, input, inputlen,
2016 PARAMERROR( text->utils );
2021 ret = _plug_iovec_to_buf(text->utils, invec, numiov,
2035 ret = _plug_buf_alloc(text->utils, &(text->encode_buf),
2047 text->utils->hmac_md5((unsigned char *)text->encode_buf,
2051 text->utils->hmac_md5(text->encode_buf, inblob->curlen + 4,
2093 ret = _plug_buf_alloc(text->utils, &(text->MAC_buf),
2104 text->utils->hmac_md5((unsigned char *)text->MAC_buf, inputlen + 4,
2108 text->utils->hmac_md5(text->MAC_buf, inputlen + 4,
2139 text->utils->log(text->utils->conn, SASL_LOG_ERR,
2143 text->utils->seterror(text->utils->conn, 0, "MAC doesn't match");
2151 result = _plug_buf_alloc(text->utils, &text->decode_once_buf,
2204 text->buffer=text->utils->malloc(text->size+5);
2206 text->buffer=text->utils->realloc(text->buffer,text->size+5);
2253 ret = _plug_decode(text->utils, context, input, inputlen,
2263 digestmd5_common_mech_dispose(void *conn_context, const sasl_utils_t *utils)
2267 if (!text || !utils) return;
2269 if (text->authid) utils->free(text->authid);
2270 if (text->realm) utils->free(text->realm);
2271 if (text->nonce) utils->free(text->nonce);
2272 if (text->cnonce) utils->free(text->cnonce);
2277 if (text->response_value) utils->free(text->response_value);
2279 if (text->buffer) utils->free(text->buffer);
2280 if (text->encode_buf) utils->free(text->encode_buf);
2281 if (text->decode_buf) utils->free(text->decode_buf);
2282 if (text->decode_once_buf) utils->free(text->decode_once_buf);
2283 if (text->decode_tmp_buf) utils->free(text->decode_tmp_buf);
2284 if (text->out_buf) utils->free(text->out_buf);
2285 if (text->MAC_buf) utils->free(text->MAC_buf);
2288 if (text->enc_in_buf->data) utils->free(text->enc_in_buf->data);
2289 utils->free(text->enc_in_buf);
2292 utils->free(conn_context);
2297 const sasl_utils_t *utils)
2301 if (reauth->authid) utils->free(reauth->authid);
2302 if (reauth->realm) utils->free(reauth->realm);
2303 if (reauth->nonce) utils->free(reauth->nonce);
2304 if (reauth->cnonce) utils->free(reauth->cnonce);
2307 if (reauth->u.c.serverFQDN) utils->free(reauth->u.c.serverFQDN);
2314 digestmd5_common_mech_free(void *glob_context, const sasl_utils_t *utils)
2322 clear_reauth_entry(&reauth_cache->e[n], reauth_cache->i_am, utils);
2323 if (reauth_cache->e) utils->free(reauth_cache->e);
2325 if (reauth_cache->mutex) utils->mutex_free(reauth_cache->mutex);
2327 utils->free(reauth_cache);
2342 const sasl_utils_t * utils,
2352 utils->MD5Init(&Md5Ctx);
2353 utils->MD5Update(&Md5Ctx, HA1, HASHLEN);
2354 utils->MD5Update(&Md5Ctx, COLON, 1);
2355 utils->MD5Update(&Md5Ctx, pszNonce, strlen((char *) pszNonce));
2356 utils->MD5Update(&Md5Ctx, COLON, 1);
2357 utils->MD5Update(&Md5Ctx, pszCNonce, strlen((char *) pszCNonce));
2359 utils->MD5Update(&Md5Ctx, COLON, 1);
2360 utils->MD5Update(&Md5Ctx, authorization_id, strlen((char *) authorization_id));
2362 utils->MD5Final(HA1, &Md5Ctx);
2372 const sasl_utils_t * utils,
2391 utils,
2398 DigestCalcResponse(utils,
2411 result = utils->malloc(HASHHEXLEN + 1);
2422 DigestCalcResponse(utils,
2435 *response_value = utils->malloc(HASHHEXLEN + 1);
2455 params->utils->log(params->utils->conn, SASL_LOG_ERR,
2458 params->utils->seterror(params->utils->conn, 0,
2467 params->utils->log(params->utils->conn, SASL_LOG_ERR,
2470 params->utils->seterror(params->utils->conn, 0,
2539 text = sparams->utils->malloc(sizeof(server_context_t));
2572 sparams->utils->log(sparams->utils->conn, SASL_LOG_DEBUG,
2608 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2633 nonce = create_nonce(sparams->utils);
2637 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2640 SETERROR(sparams->utils, "internal erorr: failed creating a nonce");
2650 result = _plug_buf_alloc(sparams->utils, &(text->out_buf),
2654 sparams->utils->free(nonce);
2665 if (realm && add_to_challenge(sparams->utils,
2670 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2672 sparams->utils->free(nonce);
2674 SETERROR(sparams->utils, "internal error: add_to_challenge failed");
2687 if (add_to_challenge(sparams->utils,
2692 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2694 sparams->utils->free(nonce);
2696 SETERROR(sparams->utils, "internal error: add_to_challenge 3 failed");
2707 if (add_to_challenge(sparams->utils,
2712 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2714 sparams->utils->free(nonce);
2716 SETERROR(sparams->utils,
2725 add_to_challenge(sparams->utils,
2729 sparams->utils->free(nonce);
2730 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2734 SETERROR(sparams->utils, "internal error: add_to_challenge failed");
2749 if (add_to_challenge(sparams->utils,
2754 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2757 SETERROR(sparams->utils,
2765 if (add_to_challenge(sparams->utils,
2770 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2772 sparams->utils->free(nonce);
2774 SETERROR(sparams->utils, "internal error: add_to_challenge 6 failed");
2791 if (add_to_challenge(sparams->utils,
2796 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2798 sparams->utils->free(nonce);
2800 SETERROR(sparams->utils, "internal error: add_to_challenge 7 failed");
2810 sparams->utils->free(nonce);
2811 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2814 SETERROR(sparams->utils,
2821 _plug_strdup(sparams->utils, realm, &text->realm, NULL);
2879 sparams->utils->log(sparams->utils->conn, SASL_LOG_DEBUG,
2882 in = sparams->utils->malloc(clientinlen + 1);
2910 _plug_strdup(sparams->utils, value, &username, NULL);
2912 _plug_strdup(sparams->utils, value, &authorization_id, NULL);
2914 _plug_strdup(sparams->utils, value, (char **) &cnonce, NULL);
2918 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2921 SETERROR(sparams->utils,
2930 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2933 SETERROR(sparams->utils,
2939 _plug_strdup(sparams->utils, value, &realm, NULL);
2941 _plug_strdup(sparams->utils, value, (char **) &nonce, NULL);
2943 _plug_strdup(sparams->utils, value, &qop, NULL);
2951 _plug_strdup(sparams->utils, value, &digesturi, NULL);
2961 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2964 SETERROR(sparams->utils,
2973 _plug_strdup(sparams->utils, value, &response, NULL);
2975 _plug_strdup(sparams->utils, value, &cipher, NULL);
2981 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2984 SETERROR(sparams->utils,
2991 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
2994 SETERROR(sparams->utils, "invalid maxbuf parameter");
3001 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3004 SETERROR(sparams->utils,
3013 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3016 SETERROR(sparams->utils, "client doesn't support UTF-8");
3021 _plug_strdup(sparams->utils, value, &charset, NULL);
3023 sparams->utils->log(sparams->utils->conn, SASL_LOG_DEBUG,
3050 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3053 SETERROR(sparams->utils, "required parameters missing");
3063 if (sparams->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
3067 _plug_strdup(sparams->utils, text->reauth->e[val].realm,
3070 _plug_strdup(sparams->utils, (char *)text->reauth->e[val].nonce,
3073 _plug_strdup(sparams->utils, text->reauth->e[val].nonce,
3078 _plug_strdup(sparams->utils, (char *)text->reauth->e[val].cnonce,
3081 _plug_strdup(sparams->utils, text->reauth->e[val].cnonce,
3086 sparams->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
3102 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3106 SETERROR(sparams->utils,
3114 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3118 SETERROR(sparams->utils,
3126 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3129 SETERROR(sparams->utils,
3137 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3141 SETERROR(sparams->utils,
3148 result = sparams->utils->prop_request(sparams->propctx, password_request);
3151 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3154 SETERROR(sparams->utils, "unable to resquest user password");
3161 result = sparams->canon_user(sparams->utils->conn,
3165 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3168 SETERROR(sparams->utils, "unable canonify user and get auxprops");
3174 result = sparams->canon_user(sparams->utils->conn,
3177 result = sparams->canon_user(sparams->utils->conn,
3184 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3187 SETERROR(sparams->utils, "unable authorization ID");
3192 result = sparams->utils->prop_getnames(sparams->propctx, password_request,
3199 sparams->utils->seterror(sparams->utils->conn, 0,
3202 sparams->utils->seterror(sparams->utils->conn, 0,
3213 sparams->utils->seterror(sparams->utils->conn,0,
3216 sparams->utils->seterror(sparams->utils->conn,0,
3223 sec = sparams->utils->malloc(sizeof(sasl_secret_t) + len);
3226 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3229 SETERROR(sparams->utils, "unable to allocate secret");
3254 DigestCalcSecret(sparams->utils, (unsigned char *)username,
3258 DigestCalcSecret(sparams->utils, username,
3272 _plug_free_secret(sparams->utils, &sec);
3278 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3281 sparams->utils->seterror(sparams->utils->conn, 0,
3294 _plug_strdup(sparams->utils, "auth", &qop, NULL);
3328 sparams->utils->log(sparams->utils->conn, SASL_LOG_WARN,
3331 SETERROR(sparams->utils, "client requested invalid cipher");
3352 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3355 SETERROR(sparams->utils,
3363 sparams->utils,
3375 SETERROR(sparams->utils, "internal error: unable to create response");
3384 SETERROR(sparams->utils,
3387 SETERROR(sparams->utils,
3399 SETERROR(sparams->utils, gettext("server nonce expired"));
3401 SETERROR(sparams->utils, "server nonce expired");
3440 text->utils = sparams->utils;
3450 create_layer_keys(text, sparams->utils,text->HA1,n,enckey,deckey);
3458 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3466 sparams->utils->seterror(sparams->utils->conn, 0,
3492 result = _plug_buf_alloc(sparams->utils, &(text->out_buf),
3514 sparams->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
3522 clear_reauth_entry(&text->reauth->e[val], SERVER, sparams->utils);
3530 clear_reauth_entry(&text->reauth->e[val], SERVER, sparams->utils);
3540 clear_reauth_entry(&text->reauth->e[val], SERVER, sparams->utils);
3546 sparams->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
3550 if (in_start) sparams->utils->free (in_start);
3553 sparams->utils->free (username);
3556 sparams->utils->free (authorization_id);
3559 sparams->utils->free (realm);
3561 sparams->utils->free (nonce);
3563 sparams->utils->free (cnonce);
3565 sparams->utils->free (response);
3567 sparams->utils->free (cipher);
3569 sparams->utils->free(serverresponse);
3571 sparams->utils->free (charset);
3573 sparams->utils->free (digesturi);
3575 sparams->utils->free (qop);
3577 _plug_free_secret(sparams->utils, &sec);
3631 sparams->utils->log(sparams->utils->conn, SASL_LOG_WARN,
3634 sparams->utils->log(NULL, SASL_LOG_WARN,
3655 sparams->utils->log(sparams->utils->conn, SASL_LOG_ERR,
3658 sparams->utils->log(NULL, SASL_LOG_ERR,
3670 digestmd5_server_mech_dispose(void *conn_context, const sasl_utils_t *utils)
3674 if (!stext || !utils) return;
3676 digestmd5_common_mech_dispose(conn_context, utils);
3707 int digestmd5_server_plug_init(sasl_utils_t *utils,
3724 if ((ret = uef_init(utils)) != SASL_OK)
3729 reauth_cache = utils->malloc(sizeof(reauth_cache_t));
3736 utils->getopt(utils->getopt_context, "DIGEST-MD5", "reauth_timeout",
3749 reauth_cache->mutex = utils->mutex_alloc();
3755 reauth_cache->e = utils->malloc(reauth_cache->size *
3804 const sasl_utils_t * utils,
3816 DigestCalcSecret(utils,
3824 utils->MD5Init(&Md5Ctx);
3825 utils->MD5Update(&Md5Ctx, HA1, HASHLEN);
3826 utils->MD5Update(&Md5Ctx, COLON, 1);
3827 utils->MD5Update(&Md5Ctx, pszNonce, strlen((char *) pszNonce));
3828 utils->MD5Update(&Md5Ctx, COLON, 1);
3829 utils->MD5Update(&Md5Ctx, pszCNonce, strlen((char *) pszCNonce));
3831 utils->MD5Update(&Md5Ctx, COLON, 1);
3832 utils->MD5Update(&Md5Ctx, pszAuthorization_id,
3835 utils->MD5Final(HA1, &Md5Ctx);
3847 const sasl_utils_t * utils,
3866 PARAMERROR( utils );
3881 utils,
3890 DigestCalcResponse(utils,
3903 result = utils->malloc(HASHHEXLEN + 1);
3912 DigestCalcResponse(utils,
3927 utils->free(*response_value);
3929 *response_value = utils->malloc(HASHHEXLEN + 1);
3984 digesturi = params->utils->malloc(strlen(params->service) + 1 +
4003 params->utils,
4032 result =_plug_buf_alloc(params->utils, &(text->out_buf),
4039 if (add_to_challenge(params->utils,
4047 if (add_to_challenge(params->utils,
4059 if (add_to_challenge(params->utils,
4065 if (add_to_challenge(params->utils,
4072 if (add_to_challenge(params->utils,
4078 if (add_to_challenge(params->utils,
4085 if (add_to_challenge(params->utils,
4097 if (add_to_challenge(params->utils,
4102 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4105 SETERROR(params->utils,
4113 if (add_to_challenge(params->utils,
4121 if (add_to_challenge(params->utils,
4127 if (add_to_challenge(params->utils,
4166 text->utils = params->utils;
4179 create_layer_keys(text, params->utils, text->HA1, nbits,
4188 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4202 if (digesturi) params->utils->free(digesturi);
4203 if (response) params->utils->free(response);
4231 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4234 params->utils->seterror(params->utils->conn, 0,
4240 in_start = in = params->utils->malloc(serverinlen + 1);
4249 text->cnonce = create_nonce(params->utils);
4252 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4255 params->utils->seterror(params->utils->conn, 0,
4271 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4274 params->utils->seterror(params->utils->conn, 0, "Parse error");
4284 realms = params->utils->malloc(sizeof(char *) * (nrealm + 1));
4286 realms = params->utils->realloc(realms,
4294 _plug_strdup(params->utils, value, &realms[nrealm-1], NULL);
4297 _plug_strdup(params->utils, value, (char **) &text->nonce,
4314 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4325 params->utils->seterror(params->utils->conn, 0,
4328 params->utils->seterror(params->utils->conn, 0,
4354 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4364 _plug_free_secret(params->utils, &ctext->password);
4379 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4383 params->utils->seterror(params->utils->conn, 0,
4390 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4393 params->utils->seterror(params->utils->conn, 0,
4401 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4405 params->utils->seterror(params->utils->conn, 0,
4415 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4418 params->utils->seterror(params->utils->conn, 0,
4431 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4434 params->utils->seterror(params->utils->conn, 0,
4445 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4448 params->utils->seterror(params->utils->conn, 0,
4455 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4463 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4466 params->utils->seterror(params->utils->conn, 0,
4476 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4479 params->utils->seterror(params->utils->conn, 0,
4535 params->utils->seterror(params->utils->conn, 0,
4538 params->utils->seterror(params->utils->conn, 0,
4563 params->utils->seterror(params->utils->conn, 0,
4566 params->utils->seterror(params->utils->conn, 0,
4574 params->utils->seterror(params->utils->conn, 0,
4577 params->utils->seterror(params->utils->conn, 0,
4589 if (in_start) params->utils->free(in_start);
4596 params->utils->free(realms[lup]);
4598 params->utils->free(realms);
4621 auth_result = _plug_get_authid(params->utils, &authid, prompt_need);
4630 user_result = _plug_get_userid(params->utils, &userid, prompt_need);
4639 pass_result = _plug_get_password(params->utils, &ctext->password,
4655 realm_result = _plug_get_realm(params->utils,
4674 params->utils->free(*prompt_need);
4684 realm_chal = params->utils->malloc(3+strlen(params->serverFQDN));
4695 _plug_make_prompts(params->utils, &ctext->h, prompt_need,
4697 convert_prompt(params->utils, &ctext->h,
4702 convert_prompt(params->utils, &ctext->h,
4707 convert_prompt(params->utils, &ctext->h,
4713 convert_prompt(params->utils, &ctext->h,
4717 _plug_make_prompts(params->utils, prompt_need,
4740 result = params->canon_user(params->utils->conn, authid, 0,
4745 result = params->canon_user(params->utils->conn,
4749 result = params->canon_user(params->utils->conn,
4757 _plug_strdup(params->utils, realm, (char **) &text->realm, NULL);
4771 text = params->utils->malloc(sizeof(client_context_t));
4799 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4807 if (params->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
4814 if (text->realm) params->utils->free(text->realm);
4815 if (text->nonce) params->utils->free(text->nonce);
4816 if (text->cnonce) params->utils->free(text->cnonce);
4819 _plug_strdup(params->utils, text->reauth->e[val].realm,
4822 _plug_strdup(params->utils, (char *)text->reauth->e[val].nonce,
4825 _plug_strdup(params->utils, text->reauth->e[val].nonce,
4830 _plug_strdup(params->utils, (char *)text->reauth->e[val].cnonce,
4833 _plug_strdup(params->utils, text->reauth->e[val].cnonce,
4840 params->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
4880 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4898 params->utils->free(realms);
4928 params->utils->free(realms[lup]);
4930 params->utils->free(realms);
4951 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
4955 in_start = in = params->utils->malloc(serverinlen + 1);
4968 params->utils->log(params->utils->conn, SASL_LOG_ERR,
4971 params->utils->seterror(params->utils->conn, 0,
4981 params->utils->seterror(params->utils->conn, 0,
4984 params->utils->seterror(params->utils->conn, 0,
4996 params->utils->log(params->utils->conn, SASL_LOG_DEBUG,
5002 params->utils->free(in_start);
5004 if (params->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
5010 clear_reauth_entry(&text->reauth->e[val], CLIENT, params->utils);
5011 _plug_strdup(params->utils, oparams->authid,
5017 _plug_strdup(params->utils, params->serverFQDN,
5032 clear_reauth_entry(&text->reauth->e[val], CLIENT, params->utils);
5038 params->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
5071 if (params->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
5075 params->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
5107 if (params->utils->mutex_lock(text->reauth->mutex) == SASL_OK) { /* LOCK */
5108 clear_reauth_entry(&text->reauth->e[val], CLIENT, params->utils);
5110 params->utils->mutex_unlock(text->reauth->mutex); /* UNLOCK */
5113 if (text->realm) params->utils->free(text->realm);
5114 if (text->nonce) params->utils->free(text->nonce);
5115 if (text->cnonce) params->utils->free(text->cnonce);
5133 params->utils->log(params->utils->conn, SASL_LOG_ERR,
5136 params->utils->log(NULL, SASL_LOG_ERR,
5146 digestmd5_client_mech_dispose(void *conn_context, const sasl_utils_t *utils)
5150 if (!ctext || !utils) return;
5153 convert_prompt(utils, &ctext->h, NULL);
5156 if (ctext->free_password) _plug_free_secret(utils, &ctext->password);
5158 digestmd5_common_mech_dispose(conn_context, utils);
5188 int digestmd5_client_plug_init(sasl_utils_t *utils,
5203 if ((ret = uef_init(utils)) != SASL_OK)
5208 reauth_cache = utils->malloc(sizeof(reauth_cache_t));
5215 reauth_cache->mutex = utils->mutex_alloc();
5221 reauth_cache->e = utils->malloc(reauth_cache->size *
5253 getSlotID(const sasl_utils_t *utils, CK_MECHANISM_TYPE mech_type,
5267 utils->log(utils->conn, SASL_LOG_DEBUG,
5273 pSlotList = utils->calloc(sizeof (CK_SLOT_ID), ulSlotCount);
5280 utils->log(utils->conn, SASL_LOG_DEBUG,
5291 utils->log(utils->conn, SASL_LOG_DEBUG,
5295 utils->free(pSlotList);
5299 utils->calloc(sizeof (CK_MECHANISM_TYPE), ulMechTypeCount);
5301 utils->free(pSlotList);
5307 utils->log(utils->conn, SASL_LOG_DEBUG,
5311 utils->free(pMechTypeList);
5312 utils->free(pSlotList);
5320 utils->free(pMechTypeList);
5325 utils->free(pSlotList);
5334 uef_init(const sasl_utils_t *utils)
5351 utils->log(utils->conn, SASL_LOG_DEBUG,
5357 got_rc4 = getSlotID(utils, CKM_RC4, &rc4_slot_id) == SASL_OK;
5359 utils->log(utils->conn, SASL_LOG_WARN, "Could not get rc4");
5361 got_des = getSlotID(utils, CKM_DES_CBC, &des_slot_id) == SASL_OK;
5363 utils->log(utils->conn, SASL_LOG_WARN, "Could not get des");
5365 got_3des = getSlotID(utils, CKM_DES3_CBC, &des3_slot_id) == SASL_OK;
5367 utils->log(utils->conn, SASL_LOG_WARN, "Could not get 3des");