summaryrefslogtreecommitdiffabout
path: root/libmailutils/wicket/noauth.c
Unidiff
Diffstat (limited to 'libmailutils/wicket/noauth.c') (more/less context) (ignore whitespace changes)
-rw-r--r--libmailutils/wicket/noauth.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/libmailutils/wicket/noauth.c b/libmailutils/wicket/noauth.c
new file mode 100644
index 0000000..2a4da10
--- a/dev/null
+++ b/libmailutils/wicket/noauth.c
@@ -0,0 +1,65 @@
1/* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999-2019 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library. If not, see
16 <http://www.gnu.org/licenses/>. */
17
18#ifdef HAVE_CONFIG_H
19# include <config.h>
20#endif
21
22#include <stdlib.h>
23#include <mailutils/errno.h>
24#include <mailutils/auth.h>
25
26static int
27noauth_ticket_get_cred (mu_ticket_t ticket, mu_url_t url, const char *challenge,
28 char **pplain, mu_secret_t *psec)
29{
30 return MU_ERR_AUTH_FAILURE;
31}
32
33int
34mu_noauth_ticket_create (mu_ticket_t *pticket)
35{
36 mu_ticket_t ticket;
37 int rc;
38
39 rc = mu_ticket_create (&ticket, NULL);
40 if (rc)
41 return rc;
42 mu_ticket_set_get_cred (ticket, noauth_ticket_get_cred, NULL);
43 *pticket = ticket;
44 return 0;
45}
46
47static int
48noauth_get_ticket (mu_wicket_t wicket, void *data,
49 const char *user, mu_ticket_t *pticket)
50{
51 return mu_noauth_ticket_create (pticket);
52}
53
54int
55mu_noauth_wicket_create (mu_wicket_t *pwicket)
56{
57 mu_wicket_t wicket;
58 int rc;
59
60 rc = mu_wicket_create (&wicket);
61 if (rc)
62 return rc;
63 mu_wicket_set_get_ticket (wicket, noauth_get_ticket);
64 return 0;
65}

Return to:

Send suggestions and report system problems to the System administrator.