Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/auth/mech-anonymous.c @ 9575:0a00dcc4f0ea HEAD
lib-storage: Allow shared namespace prefix to use %variable modifiers.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 26 May 2010 17:07:51 +0100 |
parents | 00cd9aacd03c |
children |
rev | line source |
---|---|
9532
00cd9aacd03c
Updated copyright notices to include year 2010.
Timo Sirainen <tss@iki.fi>
parents:
8605
diff
changeset
|
1 /* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */ |
1437
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
2 |
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
3 #include "common.h" |
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
4 #include "mech.h" |
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
5 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
6 static void |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
7 mech_anonymous_auth_continue(struct auth_request *request, |
3071 | 8 const unsigned char *data, size_t data_size) |
1437
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
9 { |
3065
29d83a8bb50d
Reorganized the code to have less global/static variables.
Timo Sirainen <tss@iki.fi>
parents:
3064
diff
changeset
|
10 i_assert(request->auth->anonymous_username != NULL); |
1437
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
11 |
3069 | 12 if (request->auth->verbose) { |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
13 /* temporarily set the user to the one that was given, |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
14 so that the log message goes right */ |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
15 request->user = |
2099
eac49325fa23
Logging changes. Make sure we don't write control characters to log and also
Timo Sirainen <tss@iki.fi>
parents:
2077
diff
changeset
|
16 p_strndup(pool_datastack_create(), data, data_size); |
3069 | 17 auth_request_log_info(request, "anonymous", "login"); |
1437
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
18 } |
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
19 |
3065
29d83a8bb50d
Reorganized the code to have less global/static variables.
Timo Sirainen <tss@iki.fi>
parents:
3064
diff
changeset
|
20 request->user = p_strdup(request->pool, |
29d83a8bb50d
Reorganized the code to have less global/static variables.
Timo Sirainen <tss@iki.fi>
parents:
3064
diff
changeset
|
21 request->auth->anonymous_username); |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1708
diff
changeset
|
22 |
3064
2d33734b16d5
Split auth_request* functions from mech.c to auth-request.c
Timo Sirainen <tss@iki.fi>
parents:
3058
diff
changeset
|
23 auth_request_success(request, NULL, 0); |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1708
diff
changeset
|
24 } |
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1708
diff
changeset
|
25 |
3072 | 26 static struct auth_request *mech_anonymous_auth_new(void) |
1437
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
27 { |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
28 struct auth_request *request; |
1437
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
29 pool_t pool; |
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
30 |
3318
04867ddac911
Grow default auth_request pools to 512 bytes per request.
Timo Sirainen <tss@iki.fi>
parents:
3072
diff
changeset
|
31 pool = pool_alloconly_create("anonymous_auth_request", 512); |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
32 request = p_new(pool, struct auth_request, 1); |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
33 request->pool = pool; |
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
34 return request; |
1437
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
35 } |
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
36 |
5640
8591bc9961d9
Constify struct mech_module.
Andrey Panin <pazke@donpac.ru>
parents:
4782
diff
changeset
|
37 const struct mech_module mech_anonymous = { |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1708
diff
changeset
|
38 "ANONYMOUS", |
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1708
diff
changeset
|
39 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
40 MEMBER(flags) MECH_SEC_ANONYMOUS, |
8605
84eea1977632
auth: Code cleanup for specifying what passdb features auth mechanisms need.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
41 MEMBER(passdb_need) MECH_PASSDB_NEED_NOTHING, |
2077
d5b20d679b8a
Removed hardcoded mechanism lists. It's now possible to add them
Timo Sirainen <tss@iki.fi>
parents:
1708
diff
changeset
|
42 |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
43 mech_anonymous_auth_new, |
4414
9017db478693
Added mech_generic_auth_internal() and mech_generic_auth_free() functions
Timo Sirainen <tss@iki.fi>
parents:
3766
diff
changeset
|
44 mech_generic_auth_initial, |
2736
0f31778d3c34
Changed dovecot-auth protocol to ASCII based. Should be easier now to write
Timo Sirainen <tss@iki.fi>
parents:
2099
diff
changeset
|
45 mech_anonymous_auth_continue, |
4414
9017db478693
Added mech_generic_auth_internal() and mech_generic_auth_free() functions
Timo Sirainen <tss@iki.fi>
parents:
3766
diff
changeset
|
46 mech_generic_auth_free |
1437
c27c6089e933
Added support for ANONYMOUS SASL mechanism.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
47 }; |