~ubuntu-branches/ubuntu/karmic/cyrus-imapd-2.2/karmic

« back to all changes in this revision

Viewing changes to lib/auth_krb5.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-07-11 18:51:39 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060711185139-gl3oe4tppp7g3euf
Tags: 2.2.13-4ubuntu1
Synchronize with Debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* auth_krb5.c -- Kerberos V authorization for Cyrus IMAP
2
 
 * $Id: auth_krb5.c,v 1.3 2004/01/16 15:28:58 rjs3 Exp $
 
2
 * $Id: auth_krb5.c,v 1.4 2005/02/16 20:38:01 shadow Exp $
3
3
 * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
4
4
 *
5
5
 * Redistribution and use in source and binary forms, with or without
42
42
 
43
43
#include <config.h>
44
44
#include <stdlib.h>
 
45
 
 
46
#include "auth.h"
 
47
#include "exitcodes.h"
 
48
 
 
49
#ifdef HAVE_GSSAPI_H
 
50
 
45
51
#include <limits.h>
46
52
#include <stdio.h>
47
53
#include <ctype.h>
53
59
#include "auth.h"
54
60
#include "xmalloc.h"
55
61
 
56
 
const char *auth_method_desc = "krb5";
57
 
 
58
62
struct auth_state {
59
63
    char *userid; /* Canonified Userid */
60
64
};
67
71
 *      2       User is in the group that is identifier
68
72
 *      3       User is identifer
69
73
 */
70
 
int auth_memberof(struct auth_state *auth_state, const char *identifier)
 
74
static int mymemberof(struct auth_state *auth_state, const char *identifier)
71
75
{
72
76
    char *ident;
73
77
    int ret=0;
92
96
 * Returns a pointer to a static buffer containing the canonical form
93
97
 * or NULL if 'identifier' is invalid.
94
98
 */
95
 
char *auth_canonifyid(const char *identifier, size_t len)
 
99
static char *mycanonifyid(const char *identifier, size_t len)
96
100
{
97
101
    static char *retbuf = NULL;
98
102
    krb5_context context;
172
176
/*
173
177
 * Set the current user to 'identifier'.
174
178
 */
175
 
struct auth_state *auth_newstate(const char *identifier)
 
179
static struct auth_state *mynewstate(const char *identifier)
176
180
{
177
181
    struct auth_state *newstate;
178
182
    char *ident;
185
189
    return newstate;
186
190
}
187
191
 
188
 
void auth_freestate(struct auth_state *auth_state)
 
192
static void myfreestate(struct auth_state *auth_state)
189
193
{
190
194
    if(!auth_state) return;
191
195
    
193
197
    free(auth_state);
194
198
}
195
199
 
196
 
 
 
200
#else /* HAVE_GSSAPI_H */
 
201
 
 
202
static int mymemberof(
 
203
    struct auth_state *auth_state __attribute__((unused)), 
 
204
    const char *identifier __attribute__((unused)))
 
205
{
 
206
        fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
 
207
}
 
208
 
 
209
static char *mycanonifyid(
 
210
    const char *identifier __attribute__((unused)), 
 
211
    size_t len __attribute__((unused)))
 
212
{
 
213
        fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
 
214
}
 
215
 
 
216
static struct auth_state *mynewstate(
 
217
    const char *identifier __attribute__((unused)))
 
218
{
 
219
        fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
 
220
}
 
221
 
 
222
static void myfreestate(
 
223
    struct auth_state *auth_state __attribute__((unused)))
 
224
{
 
225
        fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
 
226
}
 
227
 
 
228
#endif
 
229
 
 
230
struct auth_mech auth_krb5 = 
 
231
{
 
232
    "krb5",             /* name */
 
233
 
 
234
    &mycanonifyid,
 
235
    &mymemberof,
 
236
    &mynewstate,
 
237
    &myfreestate,
 
238
};