77 |
{"ticket", 't', "TICKET", 0, |
{"ticket", 't', "TICKET", 0, |
78 |
"Ticket file for mailbox authentication", 0}, |
"Ticket file for mailbox authentication", 0}, |
79 |
|
|
|
{"mailer-url", 'M', "MAILER", 0, |
|
|
"Mailer URL (defaults to \"sendmail:\"). Use `--mailer-url none' to disable creating the mailer (it will disable reject and redirect actions as well)", 0}, |
|
|
|
|
80 |
{"debug", 'd', "FLAGS", OPTION_ARG_OPTIONAL, |
{"debug", 'd', "FLAGS", OPTION_ARG_OPTIONAL, |
81 |
"Debug flags (defaults to \"" D_DEFAULT "\")", 0}, |
"Debug flags (defaults to \"" D_DEFAULT "\")", 0}, |
82 |
|
|
97 |
int debug_level; |
int debug_level; |
98 |
int sieve_debug; |
int sieve_debug; |
99 |
int verbose; |
int verbose; |
|
char *mailer; |
|
100 |
char *script; |
char *script; |
101 |
}; |
}; |
102 |
|
|
111 |
case ARGP_KEY_INIT: |
case ARGP_KEY_INIT: |
112 |
if (!opts->tickets) |
if (!opts->tickets) |
113 |
opts->tickets = mu_tilde_expansion ("~/.tickets", "/", NULL); |
opts->tickets = mu_tilde_expansion ("~/.tickets", "/", NULL); |
|
if (!opts->mailer) |
|
|
opts->mailer = strdup ("sendmail:"); |
|
114 |
if (!opts->debug_level) |
if (!opts->debug_level) |
115 |
opts->debug_level = MU_DEBUG_ERROR; |
opts->debug_level = MU_DEBUG_ERROR; |
116 |
log_facility = 0; |
log_facility = 0; |
149 |
opts->tickets = mu_tilde_expansion (arg, "/", NULL); |
opts->tickets = mu_tilde_expansion (arg, "/", NULL); |
150 |
break; |
break; |
151 |
|
|
|
case 'M': |
|
|
free (opts->mailer); |
|
|
opts->mailer = strdup (arg); |
|
|
break; |
|
|
|
|
152 |
case 'd': |
case 'd': |
153 |
if (!arg) |
if (!arg) |
154 |
arg = D_DEFAULT; |
arg = D_DEFAULT; |
217 |
"mailbox", |
"mailbox", |
218 |
"license", |
"license", |
219 |
"logging", |
"logging", |
220 |
|
"mailer", |
221 |
NULL |
NULL |
222 |
}; |
}; |
223 |
|
|
299 |
wicket_t wicket = 0; |
wicket_t wicket = 0; |
300 |
ticket_t ticket = 0; |
ticket_t ticket = 0; |
301 |
mu_debug_t debug = 0; |
mu_debug_t debug = 0; |
|
mailer_t mailer = 0; |
|
302 |
mailbox_t mbox = 0; |
mailbox_t mbox = 0; |
303 |
int rc; |
int rc; |
304 |
struct options opts = {0}; |
struct options opts = {0}; |
390 |
|
|
391 |
sieve_set_debug_level (mach, debug, opts.sieve_debug); |
sieve_set_debug_level (mach, debug, opts.sieve_debug); |
392 |
|
|
|
/* Create a mailer. */ |
|
|
if (strcmp (opts.mailer, "none")) |
|
|
{ |
|
|
if ((rc = mailer_create (&mailer, opts.mailer))) |
|
|
{ |
|
|
mu_error ("mailer create <%s> failed: %s\n", |
|
|
opts.mailer, mu_errstring (rc)); |
|
|
goto cleanup; |
|
|
} |
|
|
if (debug && (rc = mailer_set_debug (mailer, debug))) |
|
|
{ |
|
|
mu_error ("mailer_set_debug failed: %s\n", |
|
|
mu_errstring (rc)); |
|
|
goto cleanup; |
|
|
} |
|
|
sieve_set_mailer (mach, mailer); |
|
|
} |
|
393 |
/* Create, give a ticket to, and open the mailbox. */ |
/* Create, give a ticket to, and open the mailbox. */ |
394 |
if ((rc = mailbox_create_default (&mbox, opts.mbox)) != 0) |
if ((rc = mailbox_create_default (&mbox, opts.mbox)) != 0) |
395 |
{ |
{ |