Teaching an old dog new tricks
No Matches
lib.h File Reference

Support of Mixmaster anonymous remailer. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


int mix_send_message (struct ListHead *chain, const char *tempfile)
 Send an email via Mixmaster.
int mix_check_message (struct Email *e)
 Safety-check the message before passing it to mixmaster.
void dlg_mixmaster (struct ListHead *chainhead)
 Create a Mixmaster chain -.

Detailed Description

Support of Mixmaster anonymous remailer.

  • Thomas Roessler

This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see

Definition in file lib.h.

Function Documentation

◆ mix_send_message()

int mix_send_message ( struct ListHead *  chain,
const char *  tempfile 

Send an email via Mixmaster.

chainString list of hosts
tempfileTemporary file containing email
Return values
>=0Success (Mixmaster's return code)

Definition at line 101 of file mixmaster.c.

103 int i = 0;
104 struct Buffer *cmd = buf_pool_get();
105 struct Buffer *cd_quoted = buf_pool_get();
107 const char *const c_mixmaster = cs_subset_string(NeoMutt->sub, "mixmaster");
108 buf_printf(cmd, "cat %s | %s -m ", tempfile, c_mixmaster);
110 struct ListNode *np = NULL;
111 STAILQ_FOREACH(np, chain, entries)
112 {
113 buf_addstr(cmd, (i != 0) ? "," : " -l ");
114 buf_quote_filename(cd_quoted, (char *) np->data, true);
115 buf_addstr(cmd, buf_string(cd_quoted));
116 i = 1;
117 }
119 mutt_endwin();
121 i = mutt_system(cmd->data);
122 if (i != 0)
123 {
124 fprintf(stderr, _("Error sending message, child exited %d\n"), i);
125 if (!OptNoCurses)
126 {
128 mutt_error(_("Error sending message"));
129 }
130 }
132 buf_pool_release(&cmd);
133 buf_pool_release(&cd_quoted);
134 unlink(tempfile);
135 return i;
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:173
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:238
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition: curs_lib.c:188
void mutt_endwin(void)
Shutdown curses.
Definition: curs_lib.c:154
void buf_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell's quoting rules.
Definition: file.c:936
bool OptNoCurses
(pseudo) when sending in batch mode
Definition: globals.c:80
#define mutt_error(...)
Definition: logging2.h:92
#define _(a)
Definition: message.h:28
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:52
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
String manipulation buffer.
Definition: buffer.h:34
char * data
Pointer to data.
Definition: buffer.h:35
A List node for strings.
Definition: list.h:35
char * data
Definition: list.h:36
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mix_check_message()

int mix_check_message ( struct Email e)

Safety-check the message before passing it to mixmaster.

Return values

Definition at line 50 of file mixmaster.c.

52 bool need_hostname = false;
54 if (!TAILQ_EMPTY(&e->env->cc) || !TAILQ_EMPTY(&e->env->bcc))
55 {
56 mutt_error(_("Mixmaster doesn't accept Cc or Bcc headers"));
57 return -1;
58 }
60 /* When using mixmaster, we MUST qualify any addresses since
61 * the message will be delivered through remote systems.
62 *
63 * use_domain won't be respected at this point, hidden_host will.
64 */
66 struct Address *a = NULL;
67 TAILQ_FOREACH(a, &e->env->to, entries)
68 {
69 if (!a->group && !buf_find_char(a->mailbox, '@'))
70 {
71 need_hostname = true;
72 break;
73 }
74 }
76 if (need_hostname)
77 {
78 const char *fqdn = mutt_fqdn(true, NeoMutt->sub);
79 if (!fqdn)
80 {
81 mutt_error(_("Please set the hostname variable to a proper value when using mixmaster"));
82 return -1;
83 }
85 /* Cc and Bcc are empty at this point. */
86 mutt_addrlist_qualify(&e->env->to, fqdn);
89 }
91 return 0;
void mutt_addrlist_qualify(struct AddressList *al, const char *host)
Expand local names in an Address list using a hostname.
Definition: address.c:677
const char * buf_find_char(const struct Buffer *buf, const char c)
Return a pointer to a char found in the buffer.
Definition: buffer.c:623
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define TAILQ_EMPTY(head)
Definition: queue.h:721
const char * mutt_fqdn(bool may_hide_host, const struct ConfigSubset *sub)
Get the Fully-Qualified Domain Name.
Definition: sendlib.c:705
An email address.
Definition: address.h:36
bool group
Group mailbox?
Definition: address.h:39
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
struct Envelope * env
Envelope information.
Definition: email.h:66
struct AddressList to
Email's 'To' list.
Definition: envelope.h:60
struct AddressList reply_to
Email's 'reply-to'.
Definition: envelope.h:64
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
Definition: envelope.h:65
struct AddressList cc
Email's 'Cc' list.
Definition: envelope.h:61
struct AddressList bcc
Email's 'Bcc' list.
Definition: envelope.h:62
+ Here is the call graph for this function:
+ Here is the caller graph for this function: