| 338 | | gsasl_base64_from(in, inlen, &buf, &buflen); |
| | 338 | ret = gsasl_base64_from(in, inlen, &buf, &buflen); |
| | 339 | if (ret != GSASL_OK) { |
| | 340 | _sx_debug(ZONE, "gsasl_base64_from failed, no sasl for this conn; (%d): %s", ret, gsasl_strerror(ret)); |
| | 341 | _sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_MALFORMED_REQUEST), 0); |
| | 342 | } |
| 353 | | gsasl_base64_from(in, inlen, &buf, &buflen); |
| | 357 | ret = gsasl_base64_from(in, inlen, &buf, &buflen); |
| | 358 | if (ret != GSASL_OK) { |
| | 359 | _sx_debug(ZONE, "gsasl_base64_from failed, no sasl for this conn; (%d): %s", ret, gsasl_strerror(ret)); |
| | 360 | _sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_MALFORMED_REQUEST), 0); |
| | 361 | } |
| | 362 | |
| 416 | | gsasl_base64_from(in, inlen, &buf, &buflen); |
| 417 | | _sx_debug(ZONE, "decoded data: %.*s", buflen, buf); |
| 418 | | |
| 419 | | /* process the data */ |
| 420 | | ret = gsasl_step(sd, buf, buflen, &out, &outlen); |
| 421 | | if(buf != NULL) free(buf); |
| 422 | | |
| 423 | | /* in progress */ |
| 424 | | if(ret == GSASL_OK || ret == GSASL_NEEDS_MORE) { |
| 425 | | _sx_debug(ZONE, "sasl handshake in progress (response: %.*s)", outlen, out); |
| 426 | | |
| 427 | | /* encode the response */ |
| 428 | | gsasl_base64_to(out, outlen, &buf, &buflen); |
| 429 | | |
| | 426 | ret = gsasl_base64_from(in, inlen, &buf, &buflen); |
| | 427 | |
| | 428 | if (ret == GSASL_OK) { |
| | 429 | _sx_debug(ZONE, "decoded data: %.*s", buflen, buf); |
| | 430 | |
| | 431 | /* process the data */ |
| | 432 | ret = gsasl_step(sd, buf, buflen, &out, &outlen); |
| | 433 | if(buf != NULL) free(buf); |
| | 434 | |
| | 435 | /* in progress */ |
| | 436 | if(ret == GSASL_OK || ret == GSASL_NEEDS_MORE) { |
| | 437 | _sx_debug(ZONE, "sasl handshake in progress (response: %.*s)", outlen, out); |
| | 438 | |
| | 439 | /* encode the response */ |
| | 440 | ret = gsasl_base64_to(out, outlen, &buf, &buflen); |
| | 441 | |
| | 442 | if (ret == GSASL_OK) { |
| | 443 | _sx_nad_write(s, _sx_sasl_response(s, buf, buflen), 0); |
| | 444 | if(buf != NULL) free(buf); |
| | 445 | } |
| | 446 | |
| | 447 | if(out != NULL) free(out); |
| | 448 | |
| | 449 | return; |
| | 450 | } |
| | 451 | |