summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-05-25 23:52:32 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-05-25 23:52:32 +0300
commit558a5b14c77602a3e416cd37e1e9bb4685967370 (patch)
tree1e3683960711fdd49c7da0df08a8b2623057b635 /examples
parentcbdb11e15c5c46c7e68602fde5de16bcd6ed4842 (diff)
downloadmailutils-558a5b14c77602a3e416cd37e1e9bb4685967370.tar.gz
mailutils-558a5b14c77602a3e416cd37e1e9bb4685967370.tar.bz2
* include/mailutils/secret.h: New file.
* include/mailutils/types.hin (mu_secret_t): New type. * include/mailutils/auth.h (mu_ticket_destroy): Remove 2nd arg (owner). (mu_ticket_ref, mu_ticket_unref): New functions. (mu_ticket_set_destroy): New function. (mu_ticket_set_pop): Remove. (mu_ticket_get_cred, mu_ticket_set_get_cred): New functions. (mu_ticket_get_data): Return data pointer. (mu_ticket_set_secret, mu_ticket_set_plain): New functions. (mu_wicket_create): Remove 2nd arg. (mu_wicket_set_filename, mu_wicket_get_filename): Remove. (mu_wicket_set_ticket): Remove. (mu_wicket_get_ticket): Change proto. (mu_wicket_set_destroy, mu_wicket_set_data) (mu_wicket_get_data, mu_wicket_set_get_ticket): New functions. (mu_file_wicket_create): New function. * include/mailutils/mailutils.h: Include secret.h [MU_COMPAT]: Remove. * include/mailutils/url.h (mu_url_sget_passwd, mu_url_aget_passwd) (mu_url_get_passwd) (mu_url_get_secret): New function. * libproto/include/auth0.h: Rewrite. * libproto/include/imap0.h (struct _f_imap): Replace passwd with mu_secret_t secret. * libproto/include/url0.h (struct _mu_url): Replace passwd with mu_secret_t secret. (_get_passwd): Replace with _get_secret * mailbox/secret.c: New function. * mailbox/Makefile.am (libmailutils_la_SOURCES): Add secret.c. * mailbox/ticket.c: Rewrite from scratch. * mailbox/wicket.c: Rewrite from scratch. * libproto/imap/folder.c: Rewrite using mu_secret_t. * libproto/pop/mbox.c: Rewrite using mu_secret_t. * libproto/mailer/prog.c, libproto/mailer/sendmail.c, mailbox/auth.c, mailbox/url.c, movemail/movemail.c: Reflect changes to ticket/wicket system. * mailbox/mbx_default.c: Use new mu_wicket_t functions. * python/libmu_py/auth.c (api_wicket_get_filename) (api_wicket_set_filename): Remove. Not applicable any more. * python/libmu_py/url.c (api_url_get_passwd): Temporarly commented out. * include/mailutils/Makefile.am (pkginclude_HEADERS): Add secret.h. * examples/url-parse.c: Use mu_secret_t calls. * imap4d/namespace.c: Minor changes. * libmu_auth/pam.c: Likewise.
Diffstat (limited to 'examples')
-rw-r--r--examples/url-parse.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/examples/url-parse.c b/examples/url-parse.c
index f53c3eb9d..d1a35c4af 100644
--- a/examples/url-parse.c
+++ b/examples/url-parse.c
@@ -1,5 +1,5 @@
/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2007, 2009 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@
#include <mailutils/error.h>
#include <mailutils/errno.h>
#include <mailutils/url.h>
+#include <mailutils/secret.h>
#define CAT2(a,b) a ## b
@@ -84,6 +85,7 @@ main ()
{
int rc;
const char *buf;
+ mu_secret_t secret;
str[strlen (str) - 1] = '\0'; /* chop newline */
if (strspn (str, " \t") == strlen (str))
@@ -104,7 +106,21 @@ main ()
GET_AND_PRINT (scheme, u, buf, rc);
GET_AND_PRINT (user, u, buf, rc);
- GET_AND_PRINT (passwd, u, buf, rc);
+
+ rc = mu_url_get_secret (u, &secret);
+ if (rc == MU_ERR_NOENT)
+ printf ("\tpasswd <>\n");
+ else if (rc)
+ {
+ mu_error ("cannot get %s: %s", "passwd", mu_strerror (rc));
+ exit (1);
+ }
+ else
+ {
+ printf ("\tpasswd <%s>\n", mu_secret_password (secret));
+ mu_secret_password_unref (secret);
+ }
+
GET_AND_PRINT (auth, u, buf, rc);
GET_AND_PRINT (host, u, buf, rc);

Return to:

Send suggestions and report system problems to the System administrator.