[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 18:13:03 +0200 |
Update of /home/cvs/gsasl/lib/anonymous
In directory dopio:/tmp/cvs-serv31010/lib/anonymous
Modified Files:
Makefile.am
Added Files:
client.c server.c
Removed Files:
anonymous.c
Log Message:
Cleanup.
--- /home/cvs/gsasl/lib/anonymous/Makefile.am 2004/04/16 11:16:39 1.4
+++ /home/cvs/gsasl/lib/anonymous/Makefile.am 2004/09/18 16:13:03 1.5
@@ -21,4 +21,13 @@
AM_CPPFLAGS = -I$(srcdir)/../src -I$(builddir)/../src
noinst_LTLIBRARIES = libgsasl-anonymous.la
-libgsasl_anonymous_la_SOURCES = anonymous.h anonymous.c
+libgsasl_anonymous_la_SOURCES = anonymous.h
+
+if CLIENT
+libgsasl_cram_md5_la_SOURCES += client.c
+endif
+
+if SERVER
+libgsasl_cram_md5_la_SOURCES += server.c
+endif
+
--- /home/cvs/gsasl/lib/anonymous/client.c 2004/09/18 16:13:03 NONE
+++ /home/cvs/gsasl/lib/anonymous/client.c 2004/09/18 16:13:03 1.1
/* anonymous.c --- ANONYMOUS mechanism as defined in RFC 2245, client side.
* Copyright (C) 2002, 2003, 2004 Simon Josefsson
*
* This file is part of GNU SASL Library.
*
* GNU SASL Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* GNU SASL Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GNU SASL Library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
*/
#include "anonymous.h"
int
_gsasl_anonymous_client_start (Gsasl_session_ctx * sctx, void **mech_data)
{
int *step;
step = (int *) malloc (sizeof (*step));
if (step == NULL)
return GSASL_MALLOC_ERROR;
*step = 0;
*mech_data = step;
return GSASL_OK;
}
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)
{
int *step = mech_data;
const char *p;
if (*step > 0)
return GSASL_OK;
p = gsasl_property_get (sctx, GSASL_CLIENT_ANONYMOUS);
if (!p)
return GSASL_NO_ANONYMOUS_TOKEN;
*output = strdup (p);
if (!*output)
return GSASL_MALLOC_ERROR;
*output_len = strlen (p);
(*step)++;
return GSASL_OK;
}
int
_gsasl_anonymous_client_finish (Gsasl_session_ctx * sctx, void *mech_data)
{
int *step = mech_data;
free (step);
return GSASL_OK;
}
--- /home/cvs/gsasl/lib/anonymous/server.c 2004/09/18 16:13:03 NONE
+++ /home/cvs/gsasl/lib/anonymous/server.c 2004/09/18 16:13:03 1.1
/* anonymous.c --- ANONYMOUS mechanism as defined in RFC 2245, server side.
* Copyright (C) 2002, 2003, 2004 Simon Josefsson
*
* This file is part of GNU SASL Library.
*
* GNU SASL Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* GNU SASL Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GNU SASL Library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
*/
#include "anonymous.h"
struct _Gsasl_anonymous_server_state
{
int step;
};
int
_gsasl_anonymous_server_start (Gsasl_session_ctx * sctx, void **mech_data)
{
struct _Gsasl_anonymous_server_state *state;
state = malloc (sizeof (*state));
if (state == NULL)
return GSASL_MALLOC_ERROR;
state->step = 0;
*mech_data = state;
return GSASL_OK;
}
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)
{
struct _Gsasl_anonymous_server_state *state = mech_data;
char *token;
int res;
*output = NULL;
*output_len = 0;
switch (state->step)
{
case 0:
state->step++;
if (input_len == 0)
return GSASL_NEEDS_MORE;
/* fall through */
case 1:
if (input_len == 0)
return GSASL_MECHANISM_PARSE_ERROR;
token = malloc (input_len + 1);
if (token == NULL)
return GSASL_MALLOC_ERROR;
memcpy (token, input, input_len);
token[input_len] = '\0';
gsasl_property_set (sctx, GSASL_SERVER_ANONYMOUS, token);
free (token);
res = gsasl_callback (sctx, GSASL_SERVER_ANONYMOUS);
state->step++;
break;
default:
res = GSASL_MECHANISM_CALLED_TOO_MANY_TIMES;
break;
}
return res;
}
int
_gsasl_anonymous_server_finish (Gsasl_session_ctx * sctx, void *mech_data)
{
struct _Gsasl_anonymous_server_state *state = mech_data;
free (state);
return GSASL_OK;
}
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/17
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/17
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/18
- 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/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
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/24
- CVS gsasl/lib/anonymous, gsasl-commit, 2004/09/24