[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS gsasl/lib/securid
From: |
gsasl-commit |
Subject: |
CVS gsasl/lib/securid |
Date: |
Thu, 23 Sep 2004 03:14:10 +0200 |
Update of /home/cvs/gsasl/lib/securid
In directory dopio:/tmp/cvs-serv17060/lib/securid
Modified Files:
securid.h server.c
Log Message:
Make SECURID server use new APIs.
--- /home/cvs/gsasl/lib/securid/securid.h 2004/09/23 00:49:13 1.4
+++ /home/cvs/gsasl/lib/securid/securid.h 2004/09/23 01:14:05 1.5
@@ -44,8 +44,7 @@
void **mech_data);
extern int _gsasl_securid_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);
#endif /* SECURID_H */
--- /home/cvs/gsasl/lib/securid/server.c 2004/09/18 16:34:26 1.1
+++ /home/cvs/gsasl/lib/securid/server.c 2004/09/23 01:14:05 1.2
@@ -28,37 +28,27 @@
int
_gsasl_securid_server_start (Gsasl_session_ctx * sctx, void **mech_data)
{
- Gsasl_ctx *ctx;
-
- ctx = gsasl_server_ctx_get (sctx);
- if (ctx == NULL)
- return GSASL_CANNOT_GET_CTX;
-
- if (gsasl_server_callback_securid_get (ctx) == NULL)
- return GSASL_NEED_SERVER_SECURID_CALLBACK;
-
return GSASL_OK;
}
int
_gsasl_securid_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)
{
- Gsasl_server_callback_securid cb_securid;
const char *authorization_id = NULL;
const char *authentication_id = NULL;
const char *passcode = NULL;
+ const char *suggestedpin;
char *pin = NULL;
- Gsasl_ctx *ctx;
int res;
size_t len;
if (input_len == 0)
{
*output_len = 0;
+ *output = NULL;
return GSASL_NEEDS_MORE;
}
@@ -86,36 +76,44 @@
if (passcode == NULL)
return GSASL_MECHANISM_PARSE_ERROR;
- ctx = gsasl_server_ctx_get (sctx);
- if (ctx == NULL)
- return GSASL_CANNOT_GET_CTX;
-
- cb_securid = gsasl_server_callback_securid_get (ctx);
- if (cb_securid == NULL)
- return GSASL_NEED_SERVER_SECURID_CALLBACK;
-
- len = *output_len;
- res = cb_securid (sctx, authentication_id, authorization_id,
- passcode, pin, output, &len);
+ gsasl_property_set (sctx, GSASL_AUTHID, authentication_id);
+ gsasl_property_set (sctx, GSASL_AUTHZID, authorization_id);
+ gsasl_property_set (sctx, GSASL_PASSCODE, passcode);
+ if (pin)
+ gsasl_property_set (sctx, GSASL_PIN, pin);
+ else
+ gsasl_property_set (sctx, GSASL_PIN, NULL);
+
+ res = gsasl_callback (sctx, GSASL_SERVER_SECURID);
switch (res)
{
case GSASL_SECURID_SERVER_NEED_ADDITIONAL_PASSCODE:
- if (*output_len < strlen (PASSCODE))
- return GSASL_TOO_SMALL_BUFFER;
- memcpy (output, PASSCODE, strlen (PASSCODE));
+ *output = strdup (PASSCODE);
+ if (!*output)
+ return GSASL_MALLOC_ERROR;
*output_len = strlen (PASSCODE);
res = GSASL_NEEDS_MORE;
break;
case GSASL_SECURID_SERVER_NEED_NEW_PIN:
- memmove (output + strlen (PIN), output, len);
- memcpy (output, PIN, strlen (PIN));
- *output_len = len + strlen (PIN);
+ suggestedpin = gsasl_property_get (sctx, GSASL_SUGGESTED_PIN);
+ if (suggestedpin)
+ len = strlen (suggestedpin);
+ else
+ len = 0;
+ *output_len = strlen (PIN) + len;
+ *output = malloc (*output_len);
+ if (!*output)
+ return GSASL_MALLOC_ERROR;
+ memcpy (*output, PIN, strlen (PIN));
+ if (suggestedpin)
+ memcpy (*output + strlen (PIN), suggestedpin, len);
res = GSASL_NEEDS_MORE;
break;
default:
*output_len = 0;
+ *output = NULL;
break;
}
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/17
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/18
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/22
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/22
- CVS gsasl/lib/securid,
gsasl-commit <=
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/23
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/24
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/24
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/26
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/30
- CVS gsasl/lib/securid, gsasl-commit, 2004/09/30