4
* This file is part of libESMTP, a library for submission of RFC 2822
5
* formatted electronic mail messages using the SMTP protocol described
8
* Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
10
* This library is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU Lesser General Public
12
* License as published by the Free Software Foundation; either
13
* version 2.1 of the License, or (at your option) any later version.
15
* This library is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
* Lesser General Public License for more details.
20
* You should have received a copy of the GNU Lesser General Public
21
* License along with this library; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
/* Someday this will expand into a standalone SASL library. For now the
30
application must use the remainder of the SASL implementation's API
31
to set things up before calling smtp_start_session(). */
33
typedef struct auth_context *auth_context_t;
35
/* These flags are set for standard user authentication info */
36
#define AUTH_USER 0x0001
37
#define AUTH_REALM 0x0002
38
#define AUTH_PASS 0x0004
40
/* This flag is set for information passed in clear text on the wire */
41
#define AUTH_CLEARTEXT 0x0008
43
struct auth_client_request
45
const char *name; /* Name of field requested from the application,
46
e.g. "user", "passphrase" "realm" etc. */
47
unsigned flags; /* Alternative version of above */
48
const char *prompt; /* Text that the application can use to prompt
50
unsigned size; /* Maximum length of response allowed. 0 == no limit */
52
typedef const struct auth_client_request *auth_client_request_t;
53
typedef int (*auth_interact_t) (auth_client_request_t request,
54
char **result, int fields, void *arg);
55
typedef const char *(*auth_response_t) (void *ctx,
56
const char *challenge, int *len,
57
auth_interact_t interact, void *arg);
59
typedef int (*auth_recode_t) (void *ctx, char **dstbuf, int *dstlen,
60
const char *srcbuf, int srclen);
62
/* For enabling mechanisms */
63
#define AUTH_PLUGIN_ANONYMOUS 0x01 /* mechanism is anonymous */
64
#define AUTH_PLUGIN_PLAIN 0x02 /* mechanism uses plaintext passwords */
65
#define AUTH_PLUGIN_EXTERNAL 0x04 /* mechanism is EXTERNAL */
68
void auth_client_init(void);
69
void auth_client_exit(void);
70
auth_context_t auth_create_context(void);
71
int auth_destroy_context(auth_context_t context);
72
int auth_set_mechanism_flags (auth_context_t context,
73
unsigned set, unsigned clear);
74
int auth_set_mechanism_ssf (auth_context_t context, int min_ssf);
75
int auth_set_interact_cb (auth_context_t context,
76
auth_interact_t interact, void *arg);
77
int auth_client_enabled(auth_context_t context);
78
int auth_set_mechanism(auth_context_t context, const char *name);
79
const char *auth_mechanism_name (auth_context_t context);
80
const char *auth_response(auth_context_t context, const char *challenge, int *len);
81
int auth_get_ssf(auth_context_t context);
82
void auth_encode(char **dstbuf, int *dstlen, const char *srcbuf, int srclen, void *arg);
83
void auth_decode(char **dstbuf, int *dstlen, const char *srcbuf, int srclen, void *arg);
84
int auth_set_external_id (auth_context_t context, const char *identity);