[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS gsasl/lib/anonymous
From: |
gsasl-commit |
Subject: |
CVS gsasl/lib/anonymous |
Date: |
Sat, 18 Sep 2004 02:58:36 +0200 |
Update of /home/cvs/gsasl/lib/anonymous
In directory dopio:/tmp/cvs-serv26762/lib/anonymous
Modified Files:
anonymous.c anonymous.h
Log Message:
Add new callback/property interface, thereby deprecating old callback system.
Move obsolete APIs from gsasl.h.in to gsasl-compat.h.
Include gsasl-compat.h in gsasl.h.in.
Fix the ANONYMOUS mechanism to use the new interface, including
the new allocating mechanism interface.
--- /home/cvs/gsasl/lib/anonymous/anonymous.c 2004/09/17 20:52:41 1.4
+++ /home/cvs/gsasl/lib/anonymous/anonymous.c 2004/09/18 00:58:35 1.5
@@ -34,9 +34,6 @@
if (ctx == NULL)
return GSASL_CANNOT_GET_CTX;
- if (gsasl_client_callback_anonymous_get (ctx) == NULL)
- return GSASL_NEED_SERVER_ANONYMOUS_CALLBACK;
-
step = (int *) malloc (sizeof (*step));
if (step == NULL)
return GSASL_MALLOC_ERROR;
@@ -51,29 +48,21 @@
int
_gsasl_anonymous_client_step (Gsasl_session_ctx * sctx,
void *mech_data,
- const char *input,
- size_t input_len,
- char *output, size_t * output_len)
+ const char *input, size_t input_len,
+ char **output, size_t * output_len)
{
int *step = mech_data;
- Gsasl_client_callback_anonymous cb_anonymous;
- Gsasl_ctx *ctx;
- int res;
+ const char *p;
if (*step > 0)
return GSASL_OK;
- ctx = gsasl_client_ctx_get (sctx);
- if (ctx == NULL)
- return GSASL_CANNOT_GET_CTX;
+ p = gsasl_property_get (sctx, GSASL_CLIENT_ANONYMOUS);
+ if (!p)
+ return GSASL_NO_ANONYMOUS_TOKEN;
- cb_anonymous = gsasl_client_callback_anonymous_get (ctx);
- if (cb_anonymous == NULL)
- return GSASL_NEED_CLIENT_ANONYMOUS_CALLBACK;
-
- res = cb_anonymous (sctx, output, output_len);
- if (res != GSASL_OK)
- return res;
+ *output = strdup (p);
+ *output_len = strlen (p);
(*step)++;
@@ -111,9 +100,6 @@
if (ctx == NULL)
return GSASL_CANNOT_GET_CTX;
- if (gsasl_server_callback_anonymous_get (ctx) == NULL)
- return GSASL_NEED_SERVER_ANONYMOUS_CALLBACK;
-
state = malloc (sizeof (*state));
if (state == NULL)
return GSASL_MALLOC_ERROR;
@@ -128,24 +114,14 @@
int
_gsasl_anonymous_server_step (Gsasl_session_ctx * sctx,
void *mech_data,
- const char *input,
- size_t input_len,
- char *output, size_t * output_len)
+ const char *input, size_t input_len,
+ char **output, size_t * output_len)
{
struct _Gsasl_anonymous_server_state *state = mech_data;
- Gsasl_server_callback_anonymous cb_anonymous;
- Gsasl_ctx *ctx;
char *token;
int res;
- ctx = gsasl_server_ctx_get (sctx);
- if (ctx == NULL)
- return GSASL_CANNOT_GET_CTX;
-
- cb_anonymous = gsasl_server_callback_anonymous_get (ctx);
- if (cb_anonymous == NULL)
- return GSASL_NEED_SERVER_ANONYMOUS_CALLBACK;
-
+ *output = NULL;
*output_len = 0;
switch (state->step)
@@ -163,14 +139,13 @@
token = malloc (input_len + 1);
if (token == NULL)
return GSASL_MALLOC_ERROR;
-
memcpy (token, input, input_len);
token[input_len] = '\0';
-
- res = cb_anonymous (sctx, token);
-
+ gsasl_property_set (sctx, GSASL_SERVER_ANONYMOUS, token);
free (token);
+ res = gsasl_callback (sctx, GSASL_SERVER_ANONYMOUS);
+
state->step++;
break;
--- /home/cvs/gsasl/lib/anonymous/anonymous.h 2004/09/17 20:52:41 1.3
+++ /home/cvs/gsasl/lib/anonymous/anonymous.h 2004/09/18 00:58:35 1.4
@@ -33,7 +33,7 @@
void *mech_data,
const char *input,
size_t input_len,
- char *output, size_t * output_len);
+ char **output, size_t * output_len);
extern int _gsasl_anonymous_client_finish (Gsasl_session_ctx * sctx,
void *mech_data);
@@ -41,9 +41,8 @@
void **mech_data);
extern int _gsasl_anonymous_server_step (Gsasl_session_ctx * sctx,
void *mech_data,
- const char *input,
- size_t input_len,
- char *output, size_t * output_len);
+ const char *input, size_t input_len,
+ char **output, size_t * output_len);
extern int _gsasl_anonymous_server_finish (Gsasl_session_ctx * sctx,
void *mech_data);
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/17
- CVS gsasl/lib/anonymous,
gsasl-commit <=
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/18
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/18
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/18
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/18
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/18
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/18
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/23
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/23
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/23
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/23