summaryrefslogtreecommitdiffabout
path: root/libmailutils
Side-by-side diff
Diffstat (limited to 'libmailutils') (more/less context) (ignore whitespace changes)
-rw-r--r--libmailutils/Makefile.am5
-rw-r--r--libmailutils/base/wicket.c253
-rw-r--r--libmailutils/mailbox/folder.c49
-rw-r--r--libmailutils/mailbox/mbx_default.c43
-rw-r--r--libmailutils/url/create.c11
-rw-r--r--libmailutils/wicket/Makefile.am28
-rw-r--r--libmailutils/wicket/file.c266
-rw-r--r--libmailutils/wicket/noauth.c65
8 files changed, 427 insertions, 293 deletions
diff --git a/libmailutils/Makefile.am b/libmailutils/Makefile.am
index c940d9c..55b6238 100644
--- a/libmailutils/Makefile.am
+++ b/libmailutils/Makefile.am
@@ -18,7 +18,7 @@
SUBDIRS = \
auth base address list sockaddr cidr cfg cli diag\
filter locus mailbox mailer mime msgset opt server string stream stdstream\
- property url imapio datetime . tests
+ property url imapio datetime wicket . tests
lib_LTLIBRARIES = libmailutils.la
@@ -49,7 +49,8 @@ libmailutils_la_LIBADD = \
string/libstring.la\
stream/libstream.la\
stdstream/libstdstream.la\
- url/liburl.la
+ url/liburl.la\
+ wicket/libwicket.la
libmailutils_la_LDFLAGS = -version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@
diff --git a/libmailutils/base/wicket.c b/libmailutils/base/wicket.c
index c60ddff..22cd2c1 100644
--- a/libmailutils/base/wicket.c
+++ b/libmailutils/base/wicket.c
@@ -19,24 +19,9 @@
# include <config.h>
#endif
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pwd.h>
-#include <string.h>
#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <ctype.h>
#include <mailutils/errno.h>
-#include <mailutils/util.h>
-#include <mailutils/mu_auth.h>
-#include <mailutils/stream.h>
-#include <mailutils/cstr.h>
-#include <mailutils/nls.h>
-#include <mailutils/errno.h>
-
#include <mailutils/sys/auth.h>
#include <mailutils/sys/url.h>
@@ -135,241 +120,3 @@ mu_wicket_set_get_ticket (mu_wicket_t wicket,
return 0;
}
-
-/* A "file wicket" implementation */
-
-struct file_wicket
-{
- char *filename;
-};
-
-static void
-_file_wicket_destroy (mu_wicket_t wicket)
-{
- struct file_wicket *fw = mu_wicket_get_data (wicket);
- free (fw->filename);
- free (fw);
-}
-
-struct file_ticket
-{
- char *filename;
- char *user;
- mu_url_t tickurl;
-};
-
-static void
-file_ticket_destroy (mu_ticket_t ticket)
-{
- struct file_ticket *ft = mu_ticket_get_data (ticket);
- if (ft)
- {
- free (ft->filename);
- free (ft->user);
- mu_url_destroy (&ft->tickurl);
- free (ft);
- }
-}
-
-int
-file_ticket_get_cred (mu_ticket_t ticket, mu_url_t url, const char *challenge,
- char **pplain, mu_secret_t *psec)
-{
- struct file_ticket *ft = mu_ticket_get_data (ticket);
- int rc = 0;
-
- if (!ft->tickurl)
- {
- rc = mu_wicket_file_match_url (ft->filename, url,
- MU_URL_PARSE_ALL,
- &ft->tickurl);
- if (rc)
- return rc;
- }
- if (pplain)
- {
- if (ft->user)
- {
- *pplain = strdup (ft->user);
- if (!*pplain)
- rc = ENOMEM;
- }
- else
- rc = mu_url_aget_user (ft->tickurl, pplain);
- }
- else
- rc = mu_url_get_secret (ft->tickurl, psec);
- return rc;
-}
-
-static int
-_file_wicket_get_ticket (mu_wicket_t wicket, void *data,
- const char *user, mu_ticket_t *pticket)
-{
- int rc;
- mu_ticket_t ticket;
- struct file_wicket *fw = data;
- struct file_ticket *ft = calloc (1, sizeof (*ft));
- ft->filename = strdup (fw->filename);
- if (!ft->filename)
- {
- free (ft);
- return ENOMEM;
- }
- if (user)
- {
- ft->user = strdup (user);
- if (!ft->user)
- {
- free (ft->filename);
- free (ft);
- return ENOMEM;
- }
- }
- else
- ft->user = NULL;
-
- rc = mu_ticket_create (&ticket, NULL);
- if (rc)
- {
- free (ft->filename);
- free (ft->user);
- free (ft);
- return rc;
- }
-
- mu_ticket_set_destroy (ticket, file_ticket_destroy, NULL);
- mu_ticket_set_data (ticket, ft, NULL);
- mu_ticket_set_get_cred (ticket, file_ticket_get_cred, NULL);
-
- *pticket = ticket;
- return 0;
-}
-
-int
-mu_wicket_stream_match_url (mu_stream_t stream, struct mu_locus_point *loc,
- mu_url_t url, int parse_flags,
- mu_url_t *pticket_url)
-{
- int rc;
- mu_url_t u = NULL;
- char *buf = NULL;
- size_t bufsize = 0;
- size_t len;
- mu_url_t pret = NULL;
- int weight = 0;
- int line = loc->mu_line;
-
- while ((rc = mu_stream_getline (stream, &buf, &bufsize, &len)) == 0
- && len > 0)
- {
- char *p;
- int err;
- int n;
-
- loc->mu_line++;
- p = mu_str_stripws (buf);
-
- /* Skip empty lines and comments. */
- if (*p == 0 || *p == '#')
- continue;
-
- if ((err = mu_url_create_hint (&u, p, parse_flags, NULL)) != 0)
- {
- /* Skip erroneous entry */
- mu_error (_("%s:%u: cannot create URL: %s"),
- loc->mu_file, loc->mu_line, mu_strerror (err));
- continue;
- }
-
- if (!mu_url_has_flag (u, MU_URL_USER|MU_URL_SECRET))
- {
- mu_error (_("%s:%u: URL is missing required parts"),
- loc->mu_file, loc->mu_line);
- mu_url_destroy (&u);
- continue;
- }
-
- if (!mu_url_matches_ticket (u, url, &n))
- {
- mu_url_destroy (&u);
- continue;
- }
-
- if (!pret || n < weight)
- {
- pret = u;
- weight = n;
- line = loc->mu_line;
- if (weight == 0)
- break;
- }
- }
- free (buf);
-
- if (rc == 0)
- {
- if (pret)
- {
- *pticket_url = pret;
- loc->mu_line = line;
- }
- else
- rc = MU_ERR_NOENT;
- }
-
- return rc;
-}
-
-int
-mu_wicket_file_match_url (const char *name, mu_url_t url,
- int parse_flags,
- mu_url_t *pticket_url)
-{
- mu_stream_t stream;
- int rc;
- struct mu_locus_point loc;
-
- rc = mu_file_stream_create (&stream, name, MU_STREAM_READ);
- if (rc)
- return rc;
- loc.mu_file = (char*) name;
- loc.mu_line = 0;
- loc.mu_col = 0;
- rc = mu_wicket_stream_match_url (stream, &loc, url, parse_flags,
- pticket_url);
- mu_stream_close (stream);
- mu_stream_destroy (&stream);
- return rc;
-}
-
-int
-mu_file_wicket_create (mu_wicket_t *pwicket, const char *filename)
-{
- mu_wicket_t wicket;
- int rc;
- struct file_wicket *fw = calloc (1, sizeof (*fw));
-
- if (!fw)
- return ENOMEM;
- fw->filename = strdup (filename);
- if (!fw->filename)
- {
- free (fw);
- return ENOMEM;
- }
-
- rc = mu_wicket_create (&wicket);
- if (rc)
- {
- free (fw->filename);
- free (fw);
- return rc;
- }
- mu_wicket_set_data (wicket, fw);
- mu_wicket_set_destroy (wicket, _file_wicket_destroy);
- mu_wicket_set_get_ticket (wicket, _file_wicket_get_ticket);
- *pwicket = wicket;
- return 0;
-}
-
diff --git a/libmailutils/mailbox/folder.c b/libmailutils/mailbox/folder.c
index 64f997d..6773544 100644
--- a/libmailutils/mailbox/folder.c
+++ b/libmailutils/mailbox/folder.c
@@ -36,7 +36,7 @@
#include <mailutils/property.h>
#include <mailutils/mailbox.h>
#include <mailutils/imaputil.h>
-
+#include <mailutils/util.h>
#include <mailutils/sys/folder.h>
/* Internal folder list. */
@@ -121,6 +121,7 @@ mu_folder_create_from_record (mu_folder_t *pfolder, mu_url_t url,
if (folder != NULL)
{
folder->url = url;
+ folder->is_local = record->flags & MU_RECORD_LOCAL;
/* Initialize the internal foilder lock, now so the
concrete folder could use it. */
status = mu_monitor_create (&folder->monitor, 0, folder);
@@ -170,6 +171,52 @@ mu_folder_create (mu_folder_t *pfolder, const char *name)
return rc;
}
+int
+mu_folder_attach_ticket (mu_folder_t folder)
+{
+ mu_authority_t auth = NULL;
+ int rc = MU_ERR_NOENT;
+
+ if (mu_folder_get_authority (folder, &auth) == 0 && auth)
+ {
+ char *filename = mu_tilde_expansion (mu_ticket_file,
+ MU_HIERARCHY_DELIMITER, NULL);
+ mu_wicket_t wicket;
+
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_TRACE1,
+ ("Reading user ticket file %s", filename));
+ if ((rc = mu_file_wicket_create (&wicket, filename)) == 0)
+ {
+ mu_ticket_t ticket;
+
+ if ((rc = mu_wicket_get_ticket (wicket, NULL, &ticket)) == 0)
+ {
+ rc = mu_authority_set_ticket (auth, ticket);
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_TRACE1,
+ ("Retrieved and set ticket: %d", rc));
+ }
+ else
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("Error retrieving ticket: %s\n",
+ mu_strerror (rc)));
+ mu_wicket_destroy (&wicket);
+ }
+ else
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("Error creating wicket: %s\n", mu_strerror (rc)));
+ free (filename);
+ }
+ return rc;
+}
+
+int
+mu_folder_is_local (mu_folder_t folder)
+{
+ if (!folder)
+ return -1;
+ return folder->is_local;
+}
+
/* The folder is destroy if it is the last reference. */
void
mu_folder_destroy (mu_folder_t *pfolder)
diff --git a/libmailutils/mailbox/mbx_default.c b/libmailutils/mailbox/mbx_default.c
index 29890bf..bd9f876 100644
--- a/libmailutils/mailbox/mbx_default.c
+++ b/libmailutils/mailbox/mbx_default.c
@@ -344,44 +344,15 @@ percent_expand (const char *file, char **mbox)
return status;
}
-static void
-attach_auth_ticket (mu_mailbox_t mbox)
+int
+mu_mailbox_attach_ticket (mu_mailbox_t mbox)
{
+ int rc;
mu_folder_t folder = NULL;
- mu_authority_t auth = NULL;
- if (mu_mailbox_get_folder (mbox, &folder) == 0
- && mu_folder_get_authority (folder, &auth) == 0
- && auth)
- {
- char *filename = mu_tilde_expansion (mu_ticket_file,
- MU_HIERARCHY_DELIMITER, NULL);
- mu_wicket_t wicket;
- int rc;
-
- mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_TRACE1,
- ("Reading user ticket file %s", filename));
- if ((rc = mu_file_wicket_create (&wicket, filename)) == 0)
- {
- mu_ticket_t ticket;
-
- if ((rc = mu_wicket_get_ticket (wicket, NULL, &ticket)) == 0)
- {
- rc = mu_authority_set_ticket (auth, ticket);
- mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_TRACE1,
- ("Retrieved and set ticket: %d", rc));
- }
- else
- mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
- ("Error retrieving ticket: %s\n",
- mu_strerror (rc)));
- mu_wicket_destroy (&wicket);
- }
- else
- mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
- ("Error creating wicket: %s\n", mu_strerror (rc)));
- free (filename);
- }
+ if ((rc = mu_mailbox_get_folder (mbox, &folder)) == 0)
+ rc = mu_folder_attach_ticket (folder);
+ return rc;
}
/* Expand mailbox name according to the following rules:
@@ -490,7 +461,7 @@ mu_mailbox_create_default (mu_mailbox_t *pmbox, const char *mail)
status = mu_mailbox_create (pmbox, mboxname);
free (mboxname);
if (status == 0)
- attach_auth_ticket (*pmbox);
+ mu_mailbox_attach_ticket (*pmbox);
return status;
}
diff --git a/libmailutils/url/create.c b/libmailutils/url/create.c
index 124be32..3b19a4f 100644
--- a/libmailutils/url/create.c
+++ b/libmailutils/url/create.c
@@ -269,7 +269,16 @@ _mu_url_ctx_parse_host (struct mu_url_ctx *ctx, int has_host)
if (*ctx->cur == '/')
{
if (has_host)
- ctx->cur++;
+ {
+ ctx->cur++;
+ if (*ctx->cur == 0)
+ {
+ rc = str_assign (&url->path, "");
+ if (rc == 0)
+ url->flags |= MU_URL_PATH;
+ return rc;
+ }
+ }
return _mu_url_ctx_parse_path (ctx);
}
diff --git a/libmailutils/wicket/Makefile.am b/libmailutils/wicket/Makefile.am
new file mode 100644
index 0000000..b7f3528
--- a/dev/null
+++ b/libmailutils/wicket/Makefile.am
@@ -0,0 +1,28 @@
+# GNU Mailutils -- a suite of utilities for electronic mail
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General
+# Public License along with this library. If not, see
+# <http://www.gnu.org/licenses/>.
+
+noinst_LTLIBRARIES = libwicket.la
+libwicket_la_SOURCES = \
+ file.c\
+ noauth.c
+
+localedir = $(datadir)/locale
+AM_CPPFLAGS = \
+ @MU_LIB_COMMON_INCLUDES@ -I/libmailutils\
+ -DSYSCONFDIR=\"$(sysconfdir)\"\
+ -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\"\
+ -DLOCALEDIR=\"$(localedir)\"
diff --git a/libmailutils/wicket/file.c b/libmailutils/wicket/file.c
new file mode 100644
index 0000000..73e7e65
--- a/dev/null
+++ b/libmailutils/wicket/file.c
@@ -0,0 +1,266 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 1999-2019 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General
+ Public License along with this library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* A "file wicket" implementation */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <mailutils/errno.h>
+#include <mailutils/error.h>
+#include <mailutils/auth.h>
+#include <mailutils/url.h>
+#include <mailutils/stream.h>
+#include <mailutils/cstr.h>
+#include <mailutils/nls.h>
+
+struct file_wicket
+{
+ char *filename;
+};
+
+static void
+_file_wicket_destroy (mu_wicket_t wicket)
+{
+ struct file_wicket *fw = mu_wicket_get_data (wicket);
+ free (fw->filename);
+ free (fw);
+}
+
+struct file_ticket
+{
+ char *filename;
+ char *user;
+ mu_url_t tickurl;
+};
+
+static void
+file_ticket_destroy (mu_ticket_t ticket)
+{
+ struct file_ticket *ft = mu_ticket_get_data (ticket);
+ if (ft)
+ {
+ free (ft->filename);
+ free (ft->user);
+ mu_url_destroy (&ft->tickurl);
+ free (ft);
+ }
+}
+
+int
+file_ticket_get_cred (mu_ticket_t ticket, mu_url_t url, const char *challenge,
+ char **pplain, mu_secret_t *psec)
+{
+ struct file_ticket *ft = mu_ticket_get_data (ticket);
+ int rc = 0;
+
+ if (!ft->tickurl)
+ {
+ rc = mu_wicket_file_match_url (ft->filename, url,
+ MU_URL_PARSE_ALL,
+ &ft->tickurl);
+ if (rc)
+ return rc;
+ }
+ if (pplain)
+ {
+ if (ft->user)
+ {
+ *pplain = strdup (ft->user);
+ if (!*pplain)
+ rc = ENOMEM;
+ }
+ else
+ rc = mu_url_aget_user (ft->tickurl, pplain);
+ }
+ else
+ rc = mu_url_get_secret (ft->tickurl, psec);
+ return rc;
+}
+
+static int
+_file_wicket_get_ticket (mu_wicket_t wicket, void *data,
+ const char *user, mu_ticket_t *pticket)
+{
+ int rc;
+ mu_ticket_t ticket;
+ struct file_wicket *fw = data;
+ struct file_ticket *ft = calloc (1, sizeof (*ft));
+ ft->filename = strdup (fw->filename);
+ if (!ft->filename)
+ {
+ free (ft);
+ return ENOMEM;
+ }
+ if (user)
+ {
+ ft->user = strdup (user);
+ if (!ft->user)
+ {
+ free (ft->filename);
+ free (ft);
+ return ENOMEM;
+ }
+ }
+ else
+ ft->user = NULL;
+
+ rc = mu_ticket_create (&ticket, NULL);
+ if (rc)
+ {
+ free (ft->filename);
+ free (ft->user);
+ free (ft);
+ return rc;
+ }
+
+ mu_ticket_set_destroy (ticket, file_ticket_destroy, NULL);
+ mu_ticket_set_data (ticket, ft, NULL);
+ mu_ticket_set_get_cred (ticket, file_ticket_get_cred, NULL);
+
+ *pticket = ticket;
+ return 0;
+}
+
+int
+mu_wicket_stream_match_url (mu_stream_t stream, struct mu_locus_point *loc,
+ mu_url_t url, int parse_flags,
+ mu_url_t *pticket_url)
+{
+ int rc;
+ mu_url_t u = NULL;
+ char *buf = NULL;
+ size_t bufsize = 0;
+ size_t len;
+ mu_url_t pret = NULL;
+ int weight = 0;
+ int line = loc->mu_line;
+
+ while ((rc = mu_stream_getline (stream, &buf, &bufsize, &len)) == 0
+ && len > 0)
+ {
+ char *p;
+ int err;
+ int n;
+
+ loc->mu_line++;
+ p = mu_str_stripws (buf);
+
+ /* Skip empty lines and comments. */
+ if (*p == 0 || *p == '#')
+ continue;
+
+ if ((err = mu_url_create_hint (&u, p, parse_flags, NULL)) != 0)
+ {
+ /* Skip erroneous entry */
+ mu_error (_("%s:%u: cannot create URL: %s"),
+ loc->mu_file, loc->mu_line, mu_strerror (err));
+ continue;
+ }
+
+ if (!mu_url_has_flag (u, MU_URL_USER|MU_URL_SECRET))
+ {
+ mu_error (_("%s:%u: URL is missing required parts"),
+ loc->mu_file, loc->mu_line);
+ mu_url_destroy (&u);
+ continue;
+ }
+
+ if (!mu_url_matches_ticket (u, url, &n))
+ {
+ mu_url_destroy (&u);
+ continue;
+ }
+
+ if (!pret || n < weight)
+ {
+ pret = u;
+ weight = n;
+ line = loc->mu_line;
+ if (weight == 0)
+ break;
+ }
+ }
+ free (buf);
+
+ if (rc == 0)
+ {
+ if (pret)
+ {
+ *pticket_url = pret;
+ loc->mu_line = line;
+ }
+ else
+ rc = MU_ERR_NOENT;
+ }
+
+ return rc;
+}
+
+int
+mu_wicket_file_match_url (const char *name, mu_url_t url,
+ int parse_flags,
+ mu_url_t *pticket_url)
+{
+ mu_stream_t stream;
+ int rc;
+ struct mu_locus_point loc;
+
+ rc = mu_file_stream_create (&stream, name, MU_STREAM_READ);
+ if (rc)
+ return rc;
+ loc.mu_file = (char*) name;
+ loc.mu_line = 0;
+ loc.mu_col = 0;
+ rc = mu_wicket_stream_match_url (stream, &loc, url, parse_flags,
+ pticket_url);
+ mu_stream_close (stream);
+ mu_stream_destroy (&stream);
+ return rc;
+}
+
+int
+mu_file_wicket_create (mu_wicket_t *pwicket, const char *filename)
+{
+ mu_wicket_t wicket;
+ int rc;
+ struct file_wicket *fw = calloc (1, sizeof (*fw));
+
+ if (!fw)
+ return ENOMEM;
+ fw->filename = strdup (filename);
+ if (!fw->filename)
+ {
+ free (fw);
+ return ENOMEM;
+ }
+
+ rc = mu_wicket_create (&wicket);
+ if (rc)
+ {
+ free (fw->filename);
+ free (fw);
+ return rc;
+ }
+ mu_wicket_set_data (wicket, fw);
+ mu_wicket_set_destroy (wicket, _file_wicket_destroy);
+ mu_wicket_set_get_ticket (wicket, _file_wicket_get_ticket);
+ *pwicket = wicket;
+ return 0;
+}
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 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 1999-2019 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General
+ Public License along with this library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <mailutils/errno.h>
+#include <mailutils/auth.h>
+
+static int
+noauth_ticket_get_cred (mu_ticket_t ticket, mu_url_t url, const char *challenge,
+ char **pplain, mu_secret_t *psec)
+{
+ return MU_ERR_AUTH_FAILURE;
+}
+
+int
+mu_noauth_ticket_create (mu_ticket_t *pticket)
+{
+ mu_ticket_t ticket;
+ int rc;
+
+ rc = mu_ticket_create (&ticket, NULL);
+ if (rc)
+ return rc;
+ mu_ticket_set_get_cred (ticket, noauth_ticket_get_cred, NULL);
+ *pticket = ticket;
+ return 0;
+}
+
+static int
+noauth_get_ticket (mu_wicket_t wicket, void *data,
+ const char *user, mu_ticket_t *pticket)
+{
+ return mu_noauth_ticket_create (pticket);
+}
+
+int
+mu_noauth_wicket_create (mu_wicket_t *pwicket)
+{
+ mu_wicket_t wicket;
+ int rc;
+
+ rc = mu_wicket_create (&wicket);
+ if (rc)
+ return rc;
+ mu_wicket_set_get_ticket (wicket, noauth_get_ticket);
+ return 0;
+}

Return to:

Send suggestions and report system problems to the System administrator.