~ubuntu-branches/ubuntu/oneiric/jabberd2/oneiric-security

« back to all changes in this revision

Viewing changes to scod/mech_anonymous.c

  • Committer: Bazaar Package Importer
  • Author(s): Nicolai Spohrer
  • Date: 2008-08-12 16:13:43 UTC
  • mfrom: (1.1.3 upstream) (0.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20080812161343-6trz3r97dtevxd17
Tags: 2.2.1-1ubuntu1
* Merge with Debian unstable (LP: #257130), remaining changes:
  - debian/control:
    + Modify Maintainer field as per spec
    + Depend on libdb4.6-dev instead of libdb4.4-dev
    + Added Conflicts and Replaces: ..., jabber for jabberd2
  - debian/rules: Added libtoolize call (jabberd2 ships with
     an older ltmain.sh version that conflicts with the
     current libtool version)
  - debian/init: create /var/run/jabber directory with correct
     permissions
* Dropped changes:
  - Debian already depends on libpq-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * scod - a minimal sasl implementation for jabberd2
3
 
 * Copyright (c) 2003 Robert Norris
4
 
 *
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.
9
 
 *
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.
14
 
 *
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
18
 
 */
19
 
 
20
 
/* ANONYMOUS mechanism */
21
 
 
22
 
#include "scod.h"
23
 
 
24
 
static int _anonymous_client_start(scod_mech_t mech, scod_t sd, char **resp, int *resplen) {
25
 
    log_debug(ZONE, "ANONYMOUS client start");
26
 
 
27
 
    return sd_SUCCESS;
28
 
}
29
 
 
30
 
static int _anonymous_server_start(scod_mech_t mech, scod_t sd, const char *resp, int resplen, char **chal, int *challen) {
31
 
    char authzid[3072];
32
 
 
33
 
    log_debug(ZONE, "ANONYMOUS server start");
34
 
 
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;
38
 
    }
39
 
 
40
 
    sd->authzid = strdup(authzid);
41
 
 
42
 
    return sd_SUCCESS;
43
 
}
44
 
 
45
 
int scod_mech_anonymous_init(scod_mech_t mech) {
46
 
    log_debug(ZONE, "initialising ANONYMOUS mechanism");
47
 
 
48
 
    mech->name = "ANONYMOUS";
49
 
 
50
 
    mech->client_start = _anonymous_client_start;
51
 
    mech->server_start = _anonymous_server_start;
52
 
 
53
 
    return 0;
54
 
}