2
* scod - a minimal sasl implementation for jabberd2
3
* Copyright (c) 2003 Robert Norris
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
20
/* ANONYMOUS mechanism */
24
static int _anonymous_client_start(scod_mech_t mech, scod_t sd, char **resp, int *resplen) {
25
log_debug(ZONE, "ANONYMOUS client start");
30
static int _anonymous_server_start(scod_mech_t mech, scod_t sd, const char *resp, int resplen, char **chal, int *challen) {
33
log_debug(ZONE, "ANONYMOUS server start");
35
if((mech->ctx->cb)(sd, sd_cb_ANONYMOUS_GEN_AUTHZID, NULL, (void **) authzid, mech->ctx->cbarg) != 0) {
36
log_debug(ZONE, "app failed to generate authzid, auth failed");
37
return sd_auth_AUTH_FAILED;
40
sd->authzid = strdup(authzid);
45
int scod_mech_anonymous_init(scod_mech_t mech) {
46
log_debug(ZONE, "initialising ANONYMOUS mechanism");
48
mech->name = "ANONYMOUS";
50
mech->client_start = _anonymous_client_start;
51
mech->server_start = _anonymous_server_start;