00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "internal.h"
00024
00050 int
00051 gsasl_step (Gsasl_session * sctx,
00052 const char *input, size_t input_len,
00053 char **output, size_t * output_len)
00054 {
00055 Gsasl_step_function step;
00056
00057 if (sctx->clientp)
00058 step = sctx->mech->client.step;
00059 else
00060 step = sctx->mech->server.step;
00061
00062 return step (sctx, sctx->mech_data, input, input_len, output, output_len);
00063 }
00064
00085 int
00086 gsasl_step64 (Gsasl_session * sctx, const char *b64input, char **b64output)
00087 {
00088 size_t input_len = 0, output_len = 0;
00089 char *input = NULL, *output = NULL;
00090 int res;
00091
00092 if (b64input)
00093 {
00094 res = gsasl_base64_from (b64input, strlen (b64input),
00095 &input, &input_len);
00096 if (res != GSASL_OK)
00097 return GSASL_BASE64_ERROR;
00098 }
00099
00100 res = gsasl_step (sctx, input, input_len, &output, &output_len);
00101
00102 if (input != NULL)
00103 free (input);
00104
00105 if (res == GSASL_OK || res == GSASL_NEEDS_MORE)
00106 {
00107 int tmpres = gsasl_base64_to (output, output_len, b64output, NULL);
00108
00109 if (output != NULL)
00110 free (output);
00111
00112 if (tmpres != GSASL_OK)
00113 return tmpres;
00114 }
00115
00116 return res;
00117 }