1 --- mutt-1.5.9/Makefile.am.orig 2005-03-31 20:44:06.543128320 +0200
2 +++ mutt-1.5.9/Makefile.am 2005-03-31 20:48:44.552864416 +0200
4 mutt_tunnel.c pop.c pop_auth.c pop_lib.c smime.c pgp.c pgpinvoke.c pgpkey.c \
5 pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \
6 browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c \
8 crypt-mod-pgp-classic.c crypt-mod-smime-classic.c \
9 pgppacket.c mutt_idna.h hcache.c mutt_ssl_gnutls.c \
12 makedoc.c stamp-doc-rc README.SSL smime.h\
13 muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
14 ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
16 snprintf.c regex.c crypt-gpgme.h
18 EXTRA_SCRIPTS = smime_keys
19 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/configure.in mutt-1.5.3/configure.in
20 --- mutt-1.5.3/configure.in Tue Dec 17 04:35:21 2002
21 +++ mutt-1.5.3/configure.in Wed Mar 5 11:50:47 2003
23 AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
28 +if test x$use_libesmtp = xyes; then
29 + CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
30 + MUTTLIBS="$MUTTLIBS $mutt_libesmtp_libs"
31 + MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_libesmtp.o"
33 + AC_DEFINE(USE_LIBESMTP,
35 + [Define to enable the use of libesmtp])
37 +dnl -- end libesmtp --
39 AC_OUTPUT(Makefile intl/Makefile m4/Makefile
40 po/Makefile.in doc/Makefile contrib/Makefile
42 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/globals.h mutt-1.5.3/globals.h
43 --- mutt-1.5.3/globals.h Mon Sep 9 15:05:44 2002
44 +++ mutt-1.5.3/globals.h Wed Mar 5 11:50:48 2003
47 WHERE char *Signature;
48 WHERE char *SimpleSearch;
49 +#if defined(USE_LIBESMTP)
50 +WHERE char *SmtpAuthUser;
51 +WHERE char *SmtpAuthPass;
52 +WHERE char *SmtpHost;
53 +WHERE unsigned short SmtpPort;
55 WHERE char *Spoolfile;
56 #if defined(USE_SSL) || defined(USE_NSS)
57 WHERE char *SslCertFile INITVAL (NULL);
58 --- mutt-1.5.9/init.h.orig 2005-03-31 20:44:06.454141848 +0200
59 +++ mutt-1.5.9/init.h 2005-03-31 20:49:49.479993992 +0200
64 +# ifndef USE_LIBESMTP
65 +# define USE_LIBESMTP
69 struct option_t MuttVars[] = {
70 @@ -1987,6 +1990,39 @@
75 +#if defined(USE_LIBESMTP)
76 + { "smtp_auth_username", DT_STR, R_NONE, UL &SmtpAuthUser, 0 },
79 + ** Defines the username to use with SMTP AUTH. Setting this variable will
80 + ** cause mutt to attempt to use SMTP AUTH when sending.
82 + { "smtp_auth_password", DT_STR, R_NONE, UL &SmtpAuthPass, 0 },
85 + ** Defines the password to use with SMTP AUTH. If ``$$smtp_auth_username''
86 + ** is set, but this variable is not, you will be prompted for a password
89 + { "smtp_host", DT_STR, R_NONE, UL &SmtpHost, 0 },
92 + ** Defines the SMTP host which will be used to deliver mail, as opposed
93 + ** to invoking the sendmail binary. Setting this variable overrides the
94 + ** value of ``$$sendmail'', and any associated variables.
96 + { "smtp_port", DT_NUM, R_NONE, UL &SmtpPort, 25 },
99 + ** Defines the port that the SMTP host is listening on for mail delivery.
100 + ** Must be specified as a number.
102 + ** Defaults to 25, the standard SMTP port, but RFC 2476-compliant SMTP
103 + ** servers will probably desire 587, the mail submission port.
107 #if defined(USE_SSL)||defined(USE_NSS)||defined(USE_GNUTLS)
109 { "ssl_client_cert", DT_PATH, R_NONE, UL &SslClientCert, 0 },
110 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/m4/libesmtp.m4 mutt-1.5.3/m4/libesmtp.m4
111 --- mutt-1.5.3/m4/libesmtp.m4 Wed Dec 31 18:00:00 1969
112 +++ mutt-1.5.3/m4/libesmtp.m4 Wed Mar 5 11:52:36 2003
116 +dnl Search for libesmtp, by Steven Engelhardt <sengelha@yahoo.com>
118 +dnl libesmtp often requires linking against -lpthread or -lc_r (BSD).
119 +dnl This macro attempts to centralize this code.
121 +AC_DEFUN([MUTT_AM_LIBESMTP],
125 + [ --with-libesmtp=DIR Compile in support for libesmtp for the MTA],
126 + [ if test "$with_libesmtp" != "no"
128 + mutt_libesmtp_check_path="$PATH"
130 + if test "$with_libesmtp" != "yes"
132 + mutt_libesmtp_check_path="$tmp_path:$withval/bin"
135 + dnl 1. Find libesmtp-config
136 + AC_PATH_PROG([mutt_libesmtp_config_path],
139 + [$mutt_libesmtp_check_path])
141 + if test "$mutt_libesmtp_config_path" = "no"
143 + AC_MSG_ERROR([libesmtp-config binary not found.])
146 + dnl 2. Get CFLAGS and LIBS from libesmtp-config
147 + mutt_libesmtp_cflags=`$mutt_libesmtp_config_path --cflags`
148 + mutt_libesmtp_libs=`$mutt_libesmtp_config_path --libs`
150 + dnl 3. Verify libesmtp.h can be found with these settings
151 + temp_CFLAGS="$CFLAGS"
152 + CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
153 + AC_CHECK_HEADER([libesmtp.h],
155 + AC_MSG_ERROR([Could not find libesmtp.h]))
156 + CFLAGS="$temp_CFLAGS"
158 + dnl 4. Verify the libesmtp library can be linked in
159 + temp_CFLAGS="$CFLAGS"
161 + CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
162 + LIBS="$LIBS $mutt_libesmtp_libs"
163 + AC_CHECK_LIB([esmtp],
164 + [smtp_create_session],
166 + AC_MSG_ERROR([Could not find libesmtp]))
167 + CFLAGS="$temp_CFLAGS"
170 + dnl 5. Export use_libesmtp variable so configure.in can
171 + dnl act accordingly.
177 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/main.c mutt-1.5.3/main.c
178 --- mutt-1.5.3/main.c Wed Dec 11 05:20:05 2002
179 +++ mutt-1.5.3/main.c Wed Mar 5 11:50:48 2003
193 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/mutt_libesmtp.c mutt-1.5.3/mutt_libesmtp.c
194 --- mutt-1.5.3/mutt_libesmtp.c Wed Dec 31 18:00:00 1969
195 +++ mutt-1.5.3/mutt_libesmtp.c Wed Mar 5 11:53:42 2003
198 +# include "config.h"
202 +#include <auth-client.h>
203 +#include <libesmtp.h>
205 +static char authpass[STRING] = "";
212 +#define MSGFAIL(msg) \
214 + mutt_error("%s", msg); \
217 +#define LIBCFAIL(msg) \
219 + mutt_error("%s: %s", msg, strerror(errno)); \
222 +#define SMTPFAIL(msg) \
224 + _mutt_libesmtp_perror(msg); \
229 + * _mutt_libesmtp_ensure_init
230 + * Make sure the libESMTP support in mutt is initialized at some time.
233 +_mutt_libesmtp_ensure_init()
235 + static int libesmtp_init = 0;
237 + if (!libesmtp_init) {
239 + auth_client_init();
245 + * _mutt_libesmtp_perror
246 + * Prints 'msg', a colon, and then a string representation of the
247 + * libesmtp errno as a mutt error.
250 +_mutt_libesmtp_perror(const char* msg)
254 + mutt_error("%s: %s", msg, smtp_strerror(smtp_errno(), buf, sizeof(buf)));
258 + * _mutt_libesmtp_add_recipients
259 + * Adds every address in 'addr' as a recipient to the smtp message
260 + * 'message'. Note that this does not mean that they will necessarily
261 + * show up in the mail headers (e.g., when bcc'ing). Returns 0 upon
262 + * success, -1 upon failure (and prints an error message).
264 + * Very similar to sendlib.c::add_args
267 +_mutt_libesmtp_add_recipients(smtp_message_t message, ADDRESS *addr)
271 + for (; addr; addr = addr->next) {
272 + /* weed out group mailboxes, since those are for display only */
273 + if (addr->mailbox && !addr->group) {
274 + if (!smtp_add_recipient(message, addr->mailbox))
275 + SMTPFAIL("smtp_add_recipient");
284 +_mutt_libesmtp_auth_interact(auth_client_request_t request,
285 + char **result, int fields, void *arg)
289 + for (i = 0; i < fields; i++) {
290 + if (request[i].flags & AUTH_USER) {
291 + result[i] = SmtpAuthUser;
292 + } else if (request[i].flags & AUTH_PASS) {
293 + if (SmtpAuthPass) {
294 + result[i] = SmtpAuthPass;
296 + if (authpass[0] == '\0') {
297 + char prompt[STRING];
299 + snprintf(prompt, sizeof(prompt), "%s%s: ", request[i].prompt,
300 + (request[i].flags & AUTH_CLEARTEXT) ? " (not encrypted)" : "");
301 + mutt_get_password(prompt, authpass, sizeof(authpass));
303 + result[i] = authpass;
314 +_mutt_libesmtp_messagefp_cb(void **buf, int *len, void *arg)
319 + *buf = malloc(BUFLEN);
322 + rewind((FILE*) arg);
326 + if (fgets(*buf, BUFLEN - 2, (FILE*) arg) == NULL) {
329 + char* p = strchr(*buf, '\0');
331 + if (p[-1] == '\n' && p[-2] != '\r') {
332 + strcpy(p - 1, "\r\n");
335 + octets = p - (char*) *buf;
343 + * mutt_invoke_libesmtp
344 + * Sends a mail message to the provided recipients using libesmtp.
345 + * Returns 0 upon success, -1 upon failure (and prints an error
349 +mutt_invoke_libesmtp(ADDRESS *from, /* the sender */
350 + ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
351 + const char *msg, /* file containing message */
352 + int eightbit) /* message contains 8bit chars */
354 + int ret = 0; /* return value, default = success */
355 + smtp_session_t session;
356 + smtp_message_t message;
357 + char* hostportstr = NULL;
358 + size_t hostportlen;
360 + auth_context_t authctx = NULL;
361 + const smtp_status_t* status;
363 + _mutt_libesmtp_ensure_init();
365 + if ((session = smtp_create_session()) == NULL)
366 + SMTPFAIL("smtp_create_session");
368 + /* Create hostname:port string and tell libesmtp */
369 + /* len = SmtpHost len + colon + max port (65536 => 5 chars) + terminator */
370 + hostportlen = strlen(SmtpHost) + 7;
371 + hostportstr = safe_malloc(hostportlen);
372 + snprintf(hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort);
373 + if (!smtp_set_server(session, hostportstr))
374 + SMTPFAIL("smtp_set_server");
376 + if (SmtpAuthUser) {
377 + if ((authctx = auth_create_context()) == NULL)
378 + MSGFAIL("auth_create_context failed");
379 + auth_set_mechanism_flags(authctx, AUTH_PLUGIN_PLAIN, 0);
380 + auth_set_interact_cb(authctx, _mutt_libesmtp_auth_interact, NULL);
382 + if (!smtp_auth_set_context(session, authctx))
383 + SMTPFAIL("smtp_auth_set_context");
386 + if ((message = smtp_add_message(session)) == NULL)
387 + SMTPFAIL("smtp_add_message");
388 + /* Initialize envelope sender */
389 + if (!smtp_set_reverse_path(message, from->mailbox))
390 + SMTPFAIL("smtp_set_reverse_path");
392 + if ((fp = fopen(msg, "r")) == NULL)
394 + if (!smtp_set_messagecb(message, _mutt_libesmtp_messagefp_cb, fp))
395 + SMTPFAIL("smtp_set_messagecb");
396 + if (_mutt_libesmtp_add_recipients(message, to))
398 + if (_mutt_libesmtp_add_recipients(message, cc))
400 + if (_mutt_libesmtp_add_recipients(message, bcc))
402 + if (!smtp_start_session(session))
403 + SMTPFAIL("smtp_start_session");
405 + status = smtp_message_transfer_status(message);
406 + if (status->code < 200 || status->code > 299) {
408 + snprintf(buf, sizeof(buf), "SMTP error while sending: %d %s", status->code, status->text);
415 + if (hostportstr != NULL)
417 + if (session != NULL)
418 + smtp_destroy_session(session);
419 + if (authctx != NULL)
420 + auth_destroy_context(authctx);
422 + /* Forget user-entered SMTP AUTH password if send fails */
424 + authpass[0] = '\0';
428 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/mutt_libesmtp.h mutt-1.5.3/mutt_libesmtp.h
429 --- mutt-1.5.3/mutt_libesmtp.h Wed Dec 31 18:00:00 1969
430 +++ mutt-1.5.3/mutt_libesmtp.h Wed Mar 5 11:50:48 2003
432 +#if !defined(LIBESMTP_H)
436 +mutt_invoke_libesmtp (ADDRESS *from, /* the sender */
437 + ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
438 + const char *msg, /* file containing message */
439 + int eightbit); /* message contains 8bit chars */
441 +#endif /* !defined(LIBESMTP_H) */
442 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/protos.h mutt-1.5.3/protos.h
443 --- mutt-1.5.3/protos.h Wed Dec 11 16:31:25 2002
444 +++ mutt-1.5.3/protos.h Wed Mar 5 11:50:48 2003
446 int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t);
447 int mutt_get_tmp_attachment (BODY *);
448 int mutt_index_menu (void);
449 -int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char *, int);
450 +int mutt_invoke_mta (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char *, int);
451 int mutt_is_autoview (BODY *, const char *);
452 int mutt_is_mail_list (ADDRESS *);
453 int mutt_is_message_type(int, const char *);
454 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/send.c mutt-1.5.3/send.c
455 --- mutt-1.5.3/send.c Wed Dec 11 16:45:38 2002
456 +++ mutt-1.5.3/send.c Wed Mar 5 11:50:48 2003
458 return mix_send_message (msg->chain, tempfile);
461 - i = mutt_invoke_sendmail (msg->env->from, msg->env->to, msg->env->cc,
462 + i = mutt_invoke_mta (msg->env->from, msg->env->to, msg->env->cc,
463 msg->env->bcc, tempfile, (msg->content->encoding == ENC8BIT));
466 diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/sendlib.c mutt-1.5.3/sendlib.c
467 --- mutt-1.5.3/sendlib.c Tue Dec 10 14:57:11 2002
468 +++ mutt-1.5.3/sendlib.c Wed Mar 5 11:50:48 2003
471 #endif /* HAVE_SMIME */
474 +# include "mutt_libesmtp.h"
475 +#endif /* USE_LIBESMTP */
478 #define DISPOSITION(X) X==DISPATTACH?"attachment":"inline"
479 @@ -2009,7 +2012,7 @@
485 mutt_invoke_sendmail (ADDRESS *from, /* the sender */
486 ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
487 const char *msg, /* file containing message */
488 @@ -2105,6 +2108,20 @@
493 +mutt_invoke_mta (ADDRESS *from, /* the sender */
494 + ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
495 + const char *msg, /* file containing message */
496 + int eightbit) /* message contains 8bit chars */
500 + return mutt_invoke_libesmtp(from, to, cc, bcc, msg, eightbit);
503 + return mutt_invoke_sendmail(from, to, cc, bcc, msg, eightbit);
506 /* appends string 'b' to string 'a', and returns the pointer to the new
508 char *mutt_append_string (char *a, const char *b)
509 @@ -2261,7 +2278,7 @@
510 mutt_copy_bytes (fp, f, h->content->length);
513 - ret = mutt_invoke_sendmail (env_from, to, NULL, NULL, tempfile,
514 + ret = mutt_invoke_mta (env_from, to, NULL, NULL, tempfile,
515 h->content->encoding == ENC8BIT);
518 --- mutt-1.4.1.org/Muttrc.esmtp 1970-01-01 01:00:00.000000000 +0100
519 +++ mutt-1.4.1/Muttrc.esmtp 2003-08-21 14:57:35.000000000 +0200
521 +# enable minimalistic smtp support builtin to Mutt
522 +set sendmail = "builtin"
524 +# The name or address of your SMTP server.
525 +set smtp_serv = "fastmail.fm"
527 +# Your login name on the SMTP server. Mutt presents you
528 +# as ``smtp_user''@``smtp_host'', unless ``envelope_from''
529 +# is set, this will then be the message's envelope sender.
530 +# Defaults to your login name on the local system.
531 +set smtp_user = "ulferikson"
533 +# If set, Mutt will try to use ESMPT and ``AUTH LOGIN'' to
534 +# authenticate your user.
537 +# This variable specifies which port your SMTP server is