[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS gsasl/lib/login
From: |
gsasl-commit |
Subject: |
CVS gsasl/lib/login |
Date: |
Sat, 18 Sep 2004 03:37:21 +0200 |
Update of /home/cvs/gsasl/lib/login
In directory dopio:/tmp/cvs-serv26977/lib/login
Modified Files:
login.c login.h
Log Message:
Make LOGIN client use new callback API.
Add password/authzid properties.
--- /home/cvs/gsasl/lib/login/login.c 2004/09/17 20:52:44 1.3
+++ /home/cvs/gsasl/lib/login/login.c 2004/09/18 01:37:21 1.4
@@ -33,17 +33,6 @@
_gsasl_login_client_start (Gsasl_session_ctx * sctx, void **mech_data)
{
struct _Gsasl_login_client_state *state;
- Gsasl_ctx *ctx;
-
- ctx = gsasl_client_ctx_get (sctx);
- if (ctx == NULL)
- return GSASL_CANNOT_GET_CTX;
-
- if (gsasl_client_callback_authorization_id_get (ctx) == NULL)
- return GSASL_NEED_CLIENT_AUTHORIZATION_ID_CALLBACK;
-
- if (gsasl_client_callback_password_get (ctx) == NULL)
- return GSASL_NEED_CLIENT_PASSWORD_CALLBACK;
state = malloc (sizeof (*state));
if (state == NULL)
@@ -59,58 +48,44 @@
int
_gsasl_login_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)
{
struct _Gsasl_login_client_state *state = mech_data;
- Gsasl_client_callback_authorization_id cb_authorization_id;
- Gsasl_client_callback_password cb_password;
- Gsasl_ctx *ctx;
+ const char *p;
char *tmp;
int res;
- ctx = gsasl_client_ctx_get (sctx);
- if (ctx == NULL)
- return GSASL_CANNOT_GET_CTX;
-
- cb_authorization_id = gsasl_client_callback_authorization_id_get (ctx);
- if (cb_authorization_id == NULL)
- return GSASL_NEED_CLIENT_AUTHORIZATION_ID_CALLBACK;
-
- cb_password = gsasl_client_callback_password_get (ctx);
- if (cb_password == NULL)
- return GSASL_NEED_CLIENT_PASSWORD_CALLBACK;
-
switch (state->step)
{
case 0:
- res = cb_authorization_id (sctx, output, output_len);
- if (res != GSASL_OK)
- return res;
- tmp = gsasl_stringprep_nfkc (output, *output_len);
+ p = gsasl_property_get (sctx, GSASL_CLIENT_AUTHZID);
+ if (!p)
+ return GSASL_NO_AUTHZID;
+
+ tmp = gsasl_stringprep_nfkc (p, -1);
if (tmp == NULL)
return GSASL_UNICODE_NORMALIZATION_ERROR;
- if (*output_len < strlen (tmp))
- return GSASL_TOO_SMALL_BUFFER;
- memcpy (output, tmp, strlen (tmp));
+
+ *output = tmp;
*output_len = strlen (tmp);
- free (tmp);
+
state->step++;
res = GSASL_NEEDS_MORE;
break;
case 1:
- res = cb_password (sctx, output, output_len);
- if (res != GSASL_OK)
- return res;
- tmp = gsasl_stringprep_nfkc (output, *output_len);
+ p = gsasl_property_get (sctx, GSASL_CLIENT_PASSWORD);
+ if (!p)
+ return GSASL_NO_PASSWORD;
+
+ tmp = gsasl_stringprep_nfkc (p, -1);
if (tmp == NULL)
return GSASL_UNICODE_NORMALIZATION_ERROR;
- if (*output_len < strlen (tmp))
- return GSASL_TOO_SMALL_BUFFER;
- memcpy (output, tmp, strlen (tmp));
+
+ *output = tmp;
*output_len = strlen (tmp);
- free (tmp);
+
state->step++;
res = GSASL_OK;
break;
@@ -176,8 +151,8 @@
int
_gsasl_login_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_login_server_state *state = mech_data;
Gsasl_server_callback_validate cb_validate;
--- /home/cvs/gsasl/lib/login/login.h 2004/09/17 20:52:44 1.3
+++ /home/cvs/gsasl/lib/login/login.h 2004/09/18 01:37:21 1.4
@@ -31,9 +31,8 @@
void **mech_data);
extern int _gsasl_login_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);
extern int _gsasl_login_client_finish (Gsasl_session_ctx * sctx,
void *mech_data);
@@ -41,8 +40,7 @@
void **mech_data);
extern int _gsasl_login_server_step (Gsasl_session_ctx * sctx,
void *mech_data,
- const char *input,
- size_t input_len,
+ const char *input, size_t input_len,
char *output, size_t * output_len);
extern int _gsasl_login_server_finish (Gsasl_session_ctx * sctx,
void *mech_data);
- CVS gsasl/lib/login, gsasl-commit, 2004/09/17
- CVS gsasl/lib/login,
gsasl-commit <=
- CVS gsasl/lib/login, gsasl-commit, 2004/09/18
- CVS gsasl/lib/login, gsasl-commit, 2004/09/18
- CVS gsasl/lib/login, gsasl-commit, 2004/09/20
- CVS gsasl/lib/login, gsasl-commit, 2004/09/20
- CVS gsasl/lib/login, gsasl-commit, 2004/09/24
- CVS gsasl/lib/login, gsasl-commit, 2004/09/24
- CVS gsasl/lib/login, gsasl-commit, 2004/09/24
- CVS gsasl/lib/login, gsasl-commit, 2004/09/26
- CVS gsasl/lib/login, gsasl-commit, 2004/09/30