summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-11-29 14:45:38 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-11-29 14:45:38 +0000
commitcec83dcab0f70d789b977ab53be8d0e391ad11f2 (patch)
tree5085a61289cdc8b14401d9520ca32e8489845c1d
parenta3a31df1d1c1606c5e20409289d1161bdcc5dfd9 (diff)
downloadmailutils-cec83dcab0f70d789b977ab53be8d0e391ad11f2.tar.gz
mailutils-cec83dcab0f70d789b977ab53be8d0e391ad11f2.tar.bz2
* comsat/action.c, comsat/comsat.c, imap4d/auth_gsasl.c,
imap4d/auth_gss.c, imap4d/authenticate.c, imap4d/bye.c, imap4d/close.c, imap4d/imap4d.c, imap4d/login.c, imap4d/search.c, imap4d/signal.c, imap4d/starttls.c, imap4d/util.c, maidag/lmtp.c, maidag/maidag.c, maidag/script.c, mail.local/main.c, mail.local/script.c, pop3d/apop.c, pop3d/bulletin.c, pop3d/extra.c, pop3d/lock.c, pop3d/logindelay.c, pop3d/pop3d.c, pop3d/quit.c, pop3d/signal.c, pop3d/user.c, libsieve/util.c: Use mu_diag_output instead of syslog. * sieve/sieve.c: New option --no-program-name, for testsuite. * sieve/testsuite/lib/sieve.exp: Call sieve with the --no-program-name option. * mailbox/cfg_lexer.c, mailbox/cfg_parser.y: Improve debugging. * mailbox/diag.c: New file. * mailbox/gdebug.c (mu_debug_level_from_string): New function. * mailbox/muerror.c (mu_verror, mu_error): Rewrite using mu_diag functions. * mailbox/syslog.c (mu_diag_level_to_syslog): New function. (mu_diag_syslog_printer): New function. * mh/mh_argp.c (mh_argp_parse): Set prigram name using mu_set_program_name. * mh/mh_init.c (mu_error_printer): No longer needed. * movemail/movemail.c (movemail_error_printer): No longer needed. * include/mailutils/Makefile.am (pkginclude_HEADERS): Add diag.h * include/mailutils/diag.h: New file. * include/mailutils/cfg.h (mu_cfg_lexer_t): Take mu_debug_t as its second argument. * include/mailutils/error.h: Include diag.h (mu_program_name,mu_set_program_name): Remove. Already declared in diag.h. (mu_error_set_print): Deprecated. * mailbox/Makefile.am (libmailutils_la_SOURCES): Add diag.c
-rw-r--r--ChangeLog40
-rw-r--r--comsat/action.c16
-rw-r--r--comsat/comsat.c40
-rw-r--r--imap4d/auth_gsasl.c12
-rw-r--r--imap4d/auth_gss.c10
-rw-r--r--imap4d/authenticate.c2
-rw-r--r--imap4d/bye.c18
-rw-r--r--imap4d/close.c4
-rw-r--r--imap4d/imap4d.c29
-rw-r--r--imap4d/login.c6
-rw-r--r--imap4d/search.c6
-rw-r--r--imap4d/signal.c4
-rw-r--r--imap4d/starttls.c2
-rw-r--r--imap4d/util.c18
-rw-r--r--include/mailutils/Makefile.am1
-rw-r--r--include/mailutils/cfg.h2
-rw-r--r--include/mailutils/diag.h62
-rw-r--r--include/mailutils/error.h6
-rw-r--r--libsieve/util.c10
-rw-r--r--maidag/lmtp.c12
-rw-r--r--maidag/maidag.c86
-rw-r--r--maidag/script.c2
-rw-r--r--mail.local/main.c62
-rw-r--r--mail.local/script.c2
-rw-r--r--mailbox/Makefile.am1
-rw-r--r--mailbox/cfg_lexer.c61
-rw-r--r--mailbox/cfg_parser.y28
-rw-r--r--mailbox/diag.c163
-rw-r--r--mailbox/gdebug.c65
-rw-r--r--mailbox/muerror.c81
-rw-r--r--mailbox/syslog.c43
-rw-r--r--mh/mh_argp.c9
-rw-r--r--mh/mh_init.c11
-rw-r--r--movemail/movemail.c13
-rw-r--r--pop3d/apop.c14
-rw-r--r--pop3d/bulletin.c6
-rw-r--r--pop3d/extra.c26
-rw-r--r--pop3d/lock.c2
-rw-r--r--pop3d/logindelay.c10
-rw-r--r--pop3d/pop3d.c31
-rw-r--r--pop3d/quit.c4
-rw-r--r--pop3d/signal.c4
-rw-r--r--pop3d/user.c16
-rw-r--r--sieve/sieve.c99
-rw-r--r--sieve/testsuite/lib/sieve.exp1
45 files changed, 772 insertions, 368 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e772dc98..ec0bb2742 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+2007-11-29 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * comsat/action.c, comsat/comsat.c, imap4d/auth_gsasl.c,
+ imap4d/auth_gss.c, imap4d/authenticate.c, imap4d/bye.c,
+ imap4d/close.c, imap4d/imap4d.c, imap4d/login.c, imap4d/search.c,
+ imap4d/signal.c, imap4d/starttls.c, imap4d/util.c, maidag/lmtp.c,
+ maidag/maidag.c, maidag/script.c, mail.local/main.c,
+ mail.local/script.c, pop3d/apop.c, pop3d/bulletin.c,
+ pop3d/extra.c, pop3d/lock.c, pop3d/logindelay.c, pop3d/pop3d.c,
+ pop3d/quit.c, pop3d/signal.c, pop3d/user.c, libsieve/util.c: Use
+ mu_diag_output instead of syslog.
+
+ * sieve/sieve.c: New option --no-program-name, for testsuite.
+ * sieve/testsuite/lib/sieve.exp: Call sieve with the
+ --no-program-name option.
+
+ * mailbox/cfg_lexer.c, mailbox/cfg_parser.y: Improve debugging.
+ * mailbox/diag.c: New file.
+ * mailbox/gdebug.c (mu_debug_level_from_string): New function.
+ * mailbox/muerror.c (mu_verror, mu_error): Rewrite using mu_diag
+ functions.
+ * mailbox/syslog.c (mu_diag_level_to_syslog): New function.
+ (mu_diag_syslog_printer): New function.
+
+ * mh/mh_argp.c (mh_argp_parse): Set prigram name using
+ mu_set_program_name.
+ * mh/mh_init.c (mu_error_printer): No longer needed.
+ * movemail/movemail.c (movemail_error_printer): No longer needed.
+
+ * include/mailutils/Makefile.am (pkginclude_HEADERS): Add diag.h
+ * include/mailutils/diag.h: New file.
+ * include/mailutils/cfg.h (mu_cfg_lexer_t): Take mu_debug_t as its
+ second argument.
+ * include/mailutils/error.h: Include diag.h
+ (mu_program_name,mu_set_program_name): Remove. Already declared in
+ diag.h.
+ (mu_error_set_print): Deprecated.
+
+ * mailbox/Makefile.am (libmailutils_la_SOURCES): Add diag.c
+
2007-11-28 Sergey Poznyakoff <gray@gnu.org.ua>
III. Use mu_debug_t for diagnostics in cfg framework.
diff --git a/comsat/action.c b/comsat/action.c
index c4616af29..2b4dba3e1 100644
--- a/comsat/action.c
+++ b/comsat/action.c
@@ -293,27 +293,27 @@ action_exec (FILE *tty, int line, int argc, char **argv)
if (argc == 0)
{
- syslog (LOG_ERR, _("%s:.biffrc:%d: No arguments for exec"), username, line);
+ mu_diag_output (MU_DIAG_ERROR, _("%s:.biffrc:%d: No arguments for exec"), username, line);
return;
}
if (argv[0][0] != '/')
{
- syslog (LOG_ERR, _("%s:.biffrc:%d: Not an absolute pathname"),
+ mu_diag_output (MU_DIAG_ERROR, _("%s:.biffrc:%d: Not an absolute pathname"),
username, line);
return;
}
if (stat (argv[0], &stb))
{
- syslog (LOG_ERR, _("%s:.biffrc:%d: cannot stat %s: %s"),
+ mu_diag_output (MU_DIAG_ERROR, _("%s:.biffrc:%d: cannot stat %s: %s"),
username, line, argv[0], strerror (errno));
return;
}
if (stb.st_mode & (S_ISUID|S_ISGID))
{
- syslog (LOG_ERR, _("%s:.biffrc:%d: will not execute set[ug]id programs"),
+ mu_diag_output (MU_DIAG_ERROR, _("%s:.biffrc:%d: will not execute set[ug]id programs"),
username, line);
return;
}
@@ -327,7 +327,7 @@ action_exec (FILE *tty, int line, int argc, char **argv)
dup2 (fileno (tty), 2);
fclose (tty);
execv (argv[0], argv);
- syslog (LOG_ERR, _("Cannot execute %s: %s"), argv[0], strerror (errno));
+ mu_diag_output (MU_DIAG_ERROR, _("Cannot execute %s: %s"), argv[0], strerror (errno));
exit (0);
}
}
@@ -345,7 +345,7 @@ open_rc (const char *filename, FILE *tty)
{
if (stb.st_uid != pw->pw_uid)
{
- syslog (LOG_NOTICE, _("%s's %s is not owned by %s"),
+ mu_diag_output (MU_DIAG_NOTICE, _("%s's %s is not owned by %s"),
username, filename, username);
return NULL;
}
@@ -353,7 +353,7 @@ open_rc (const char *filename, FILE *tty)
{
fprintf (tty, "%s\r\n",
_("Warning: your .biffrc has wrong permissions"));
- syslog (LOG_NOTICE, _("%s's %s has wrong permissions"),
+ mu_diag_output (MU_DIAG_NOTICE, _("%s's %s has wrong permissions"),
username, filename);
return NULL;
}
@@ -418,7 +418,7 @@ run_user_action (FILE *tty, const char *cr, mu_message_t msg)
{
fprintf (tty, _(".biffrc:%d: unknown keyword"), line);
fprintf (tty, "\r\n");
- syslog (LOG_ERR, _("%s:.biffrc:%d: unknown keyword %s"),
+ mu_diag_output (MU_DIAG_ERROR, _("%s:.biffrc:%d: unknown keyword %s"),
username, line, argv[0]);
break;
}
diff --git a/comsat/comsat.c b/comsat/comsat.c
index b0a8b815f..0f4ff9564 100644
--- a/comsat/comsat.c
+++ b/comsat/comsat.c
@@ -209,7 +209,13 @@ main (int argc, char **argv)
/* Set up error messaging */
openlog ("gnu-comsat", LOG_PID, log_facility);
- mu_error_set_print (mu_syslog_error_printer);
+
+ {
+ mu_debug_t debug;
+
+ mu_diag_get_debug (&debug);
+ mu_debug_set_print (debug, mu_diag_syslog_printer, NULL);
+ }
if (config_file)
read_config (config_file);
@@ -227,10 +233,10 @@ main (int argc, char **argv)
static RETSIGTYPE
sig_hup (int sig)
{
- syslog (LOG_NOTICE, _("Restarting"));
+ mu_diag_output (MU_DIAG_NOTICE, _("Restarting"));
if (xargv[0][0] != '/')
- syslog (LOG_ERR, _("Cannot restart: program must be invoked using absolute pathname"));
+ mu_diag_output (MU_DIAG_ERROR, _("Cannot restart: program must be invoked using absolute pathname"));
else
execvp (xargv[0], xargv);
@@ -290,7 +296,7 @@ comsat_daemon (int port)
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd == -1)
{
- syslog (LOG_CRIT, "socket: %m");
+ mu_diag_output (MU_DIAG_CRIT, "socket: %m");
exit (1);
}
@@ -301,11 +307,11 @@ comsat_daemon (int port)
if (bind (fd, (struct sockaddr *) &local_sin, sizeof local_sin) < 0)
{
- syslog (LOG_CRIT, "bind: %m");
+ mu_diag_output (MU_DIAG_CRIT, "bind: %m");
exit (1);
}
- syslog (LOG_NOTICE, _("GNU comsat started"));
+ mu_diag_output (MU_DIAG_NOTICE, _("GNU comsat started"));
last_request_time = last_overflow_time = time (NULL);
while (1)
@@ -319,7 +325,7 @@ comsat_daemon (int port)
if (rc == -1)
{
if (errno != EINTR)
- syslog (LOG_ERR, "select: %m");
+ mu_diag_output (MU_DIAG_ERROR, "select: %m");
continue;
}
@@ -332,7 +338,7 @@ comsat_daemon (int port)
unsigned delay;
delay = overflow_delay_time << (overflow_count + 1);
- syslog (LOG_NOTICE,
+ mu_diag_output (MU_DIAG_NOTICE,
ngettext ("Too many requests: pausing for %u second",
"Too many requests: pausing for %u seconds",
delay),
@@ -382,18 +388,18 @@ comsat_main (int fd)
{
if (errno == EINTR)
return 0;
- syslog (LOG_ERR, "recvfrom: %m");
+ mu_diag_output (MU_DIAG_ERROR, "recvfrom: %m");
return 1;
}
if (acl_match (&sin_from))
{
- syslog (LOG_ALERT, _("DENIED attempt to connect from %s"),
+ mu_diag_output (MU_DIAG_ALERT, _("DENIED attempt to connect from %s"),
inet_ntoa (sin_from.sin_addr));
return 1;
}
- syslog (LOG_INFO,
+ mu_diag_output (MU_DIAG_INFO,
ngettext ("Received %d byte from %s",
"Received %d bytes from %s", rdlen),
rdlen, inet_ntoa (sin_from.sin_addr));
@@ -404,7 +410,7 @@ comsat_main (int fd)
p = strchr (buffer, '@');
if (!p)
{
- syslog (LOG_ERR, _("Malformed input: %s"), buffer);
+ mu_diag_output (MU_DIAG_ERROR, _("Malformed input: %s"), buffer);
return 1;
}
*p++ = 0;
@@ -421,7 +427,7 @@ comsat_main (int fd)
if (pid == -1)
{
- syslog (LOG_ERR, "fork: %m");
+ mu_diag_output (MU_DIAG_ERROR, "fork: %m");
return 1;
}
@@ -537,7 +543,7 @@ find_user (const char *name, char *tty)
if (strncmp (ftty, PATH_TTY_PFX, strlen (PATH_TTY_PFX)))
{
/* An attempt to break security... */
- syslog (LOG_ALERT, _("Bad line name in utmp record: %s"), ftty);
+ mu_diag_output (MU_DIAG_ALERT, _("Bad line name in utmp record: %s"), ftty);
return NOT_HERE;
}
@@ -545,7 +551,7 @@ find_user (const char *name, char *tty)
{
if (!S_ISCHR (statb.st_mode))
{
- syslog (LOG_ALERT, _("Not a character device: %s"), ftty);
+ mu_diag_output (MU_DIAG_ALERT, _("Not a character device: %s"), ftty);
return NOT_HERE;
}
@@ -578,7 +584,7 @@ change_user (const char *user)
pw = getpwnam (user);
if (!pw)
{
- syslog (LOG_CRIT, _("No such user: %s"), user);
+ mu_diag_output (MU_DIAG_CRIT, _("No such user: %s"), user);
exit (1);
}
@@ -598,7 +604,7 @@ mailbox_path (const char *user)
if (!auth)
{
- syslog (LOG_ALERT, _("User nonexistent: %s"), user);
+ mu_diag_output (MU_DIAG_ALERT, _("User nonexistent: %s"), user);
return NULL;
}
diff --git a/imap4d/auth_gsasl.c b/imap4d/auth_gsasl.c
index 354ebf6f5..e303664f9 100644
--- a/imap4d/auth_gsasl.c
+++ b/imap4d/auth_gsasl.c
@@ -36,7 +36,7 @@ create_gsasl_stream (mu_stream_t *newstr, mu_stream_t transport, int flags)
rc = mu_gsasl_stream_create (newstr, transport, sess_ctx, flags);
if (rc)
{
- syslog (LOG_ERR, _("cannot create SASL stream: %s"),
+ mu_diag_output (MU_DIAG_ERROR, _("cannot create SASL stream: %s"),
mu_strerror (rc));
return RESP_NO;
}
@@ -46,7 +46,7 @@ create_gsasl_stream (mu_stream_t *newstr, mu_stream_t transport, int flags)
const char *p;
if (mu_stream_strerror (*newstr, &p))
p = mu_strerror (rc);
- syslog (LOG_ERR, _("cannot open SASL input stream: %s"), p);
+ mu_diag_output (MU_DIAG_ERROR, _("cannot open SASL input stream: %s"), p);
return RESP_NO;
}
@@ -87,7 +87,7 @@ auth_gsasl (struct imap4d_command *command,
rc = gsasl_server_start (ctx, auth_type, &sess_ctx);
if (rc != GSASL_OK)
{
- syslog (LOG_NOTICE, _("SASL gsasl_server_start: %s"),
+ mu_diag_output (MU_DIAG_NOTICE, _("SASL gsasl_server_start: %s"),
gsasl_strerror(rc));
return 0;
}
@@ -103,7 +103,7 @@ auth_gsasl (struct imap4d_command *command,
if (rc != GSASL_OK)
{
- syslog (LOG_NOTICE, _("GSASL error: %s"), gsasl_strerror (rc));
+ mu_diag_output (MU_DIAG_NOTICE, _("GSASL error: %s"), gsasl_strerror (rc));
free (output);
return RESP_NO;
}
@@ -116,7 +116,7 @@ auth_gsasl (struct imap4d_command *command,
if (*username == NULL)
{
- syslog (LOG_NOTICE, _("GSASL %s: cannot get username"), auth_type);
+ mu_diag_output (MU_DIAG_NOTICE, _("GSASL %s: cannot get username"), auth_type);
return RESP_NO;
}
@@ -306,7 +306,7 @@ auth_gsasl_init ()
rc = gsasl_init (&ctx);
if (rc != GSASL_OK)
{
- syslog (LOG_NOTICE, _("cannot initialize libgsasl: %s"),
+ mu_diag_output (MU_DIAG_NOTICE, _("cannot initialize libgsasl: %s"),
gsasl_strerror (rc));
}
diff --git a/imap4d/auth_gss.c b/imap4d/auth_gss.c
index ce4da5931..ff9590f66 100644
--- a/imap4d/auth_gss.c
+++ b/imap4d/auth_gss.c
@@ -68,7 +68,7 @@ display_status_1 (char *m, OM_uint32 code, int type)
msg.length = strlen (msg.value);
}
- syslog (LOG_ERR, _("GSS-API error %s (%s): %.*s"),
+ mu_diag_output (MU_DIAG_ERROR, _("GSS-API error %s (%s): %.*s"),
m, type == GSS_C_GSS_CODE ? _("major") : _("minor"),
(int) msg.length, (char *) msg.value);
@@ -251,7 +251,7 @@ auth_gssapi (struct imap4d_command *command,
mech = sec_level >> 24;
if ((mech & SUPPORTED_P_MECH) == 0)
{
- syslog (LOG_NOTICE,
+ mu_diag_output (MU_DIAG_NOTICE,
_("Client requested unsupported protection mechanism (%d)"),
mech);
gss_release_buffer (&min_stat, &outbuf);
@@ -265,7 +265,7 @@ auth_gssapi (struct imap4d_command *command,
*username = malloc (outbuf.length - 4 + 1);
if (!*username)
{
- syslog (LOG_NOTICE, _("Not enough memory"));
+ mu_diag_output (MU_DIAG_NOTICE, _("Not enough memory"));
gss_release_buffer (&min_stat, &outbuf);
maj_stat = gss_delete_sec_context (&min_stat, &context, &outbuf);
gss_release_buffer (&min_stat, &outbuf);
@@ -294,7 +294,7 @@ auth_gssapi (struct imap4d_command *command,
if (baduser)
{
- syslog (LOG_NOTICE, _("GSSAPI user %s is NOT authorized as %s"),
+ mu_diag_output (MU_DIAG_NOTICE, _("GSSAPI user %s is NOT authorized as %s"),
(char *) client_name.value, *username);
maj_stat = gss_delete_sec_context (&min_stat, &context, &outbuf);
gss_release_buffer (&min_stat, &outbuf);
@@ -304,7 +304,7 @@ auth_gssapi (struct imap4d_command *command,
}
else
{
- syslog (LOG_NOTICE, _("GSSAPI user %s is authorized as %s"),
+ mu_diag_output (MU_DIAG_NOTICE, _("GSSAPI user %s is authorized as %s"),
(char *) client_name.value, *username);
}
diff --git a/imap4d/authenticate.c b/imap4d/authenticate.c
index bdb319ec5..f0eacfaa2 100644
--- a/imap4d/authenticate.c
+++ b/imap4d/authenticate.c
@@ -134,7 +134,7 @@ imap4d_authenticate (struct imap4d_command *command, char *arg)
util_chdir (homedir);
namespace_init (homedir);
- syslog (LOG_INFO, _("User `%s' logged in"), adata.username);
+ mu_diag_output (MU_DIAG_INFO, _("User `%s' logged in"), adata.username);
return util_finish (command, RESP_OK,
"%s authentication successful", auth_type);
diff --git a/imap4d/bye.c b/imap4d/bye.c
index 3f5375f68..7b68744d7 100644
--- a/imap4d/bye.c
+++ b/imap4d/bye.c
@@ -41,41 +41,41 @@ imap4d_bye0 (int reason, struct imap4d_command *command)
{
case ERR_NO_MEM:
util_out (RESP_BYE, "Server terminating no more resources.");
- syslog (LOG_ERR, _("Out of memory"));
+ mu_diag_output (MU_DIAG_ERROR, _("Out of memory"));
break;
case ERR_SIGNAL:
- syslog (LOG_ERR, _("Quitting on signal"));
+ mu_diag_output (MU_DIAG_ERROR, _("Quitting on signal"));
exit (status);
case ERR_TIMEOUT:
util_out (RESP_BYE, "Session timed out");
if (state == STATE_NONAUTH)
- syslog (LOG_INFO, _("Session timed out for no user"));
+ mu_diag_output (MU_DIAG_INFO, _("Session timed out for no user"));
else
- syslog (LOG_INFO, _("Session timed out for user: %s"), auth_data->name);
+ mu_diag_output (MU_DIAG_INFO, _("Session timed out for user: %s"), auth_data->name);
break;
case ERR_NO_OFILE:
- syslog (LOG_INFO, _("No socket to send to"));
+ mu_diag_output (MU_DIAG_INFO, _("No socket to send to"));
break;
case ERR_MAILBOX_CORRUPTED:
- syslog (LOG_ERR, _("Mailbox modified by third party"));
+ mu_diag_output (MU_DIAG_ERROR, _("Mailbox modified by third party"));
break;
case OK:
util_out (RESP_BYE, "Session terminating.");
if (state == STATE_NONAUTH)
- syslog (LOG_INFO, _("Session terminating"));
+ mu_diag_output (MU_DIAG_INFO, _("Session terminating"));
else
- syslog (LOG_INFO, _("Session terminating for user: %s"), auth_data->name);
+ mu_diag_output (MU_DIAG_INFO, _("Session terminating for user: %s"), auth_data->name);
status = EXIT_SUCCESS;
break;
default:
util_out (RESP_BYE, "Quitting (reason unknown)");
- syslog (LOG_ERR, _("Quitting (numeric reason %d)"), reason);
+ mu_diag_output (MU_DIAG_ERROR, _("Quitting (numeric reason %d)"), reason);
break;
}
diff --git a/imap4d/close.c b/imap4d/close.c
index 25d832d72..6470c9b91 100644
--- a/imap4d/close.c
+++ b/imap4d/close.c
@@ -36,7 +36,7 @@ imap4d_close (struct imap4d_command *command, char *arg MU_ARG_UNUSED)
status = mu_mailbox_flush (mbox, 1);
if (status)
{
- syslog (LOG_ERR,
+ mu_diag_output (MU_DIAG_ERROR,
_("flushing mailbox failed: %s"), mu_strerror (status));
msg = "flushing mailbox failed";
}
@@ -47,7 +47,7 @@ imap4d_close (struct imap4d_command *command, char *arg MU_ARG_UNUSED)
status = mu_mailbox_close (mbox);
if (status)
{
- syslog (LOG_ERR, _("closing mailbox failed: %s"), mu_strerror (status));
+ mu_diag_output (MU_DIAG_ERROR, _("closing mailbox failed: %s"), mu_strerror (status));
msg = "closing mailbox failed";
}
mu_mailbox_destroy (&mbox);
diff --git a/imap4d/imap4d.c b/imap4d/imap4d.c
index aff76a0f4..cdf953974 100644
--- a/imap4d/imap4d.c
+++ b/imap4d/imap4d.c
@@ -272,7 +272,12 @@ main (int argc, char **argv)
/* Redirect any stdout error from the library to syslog, they
should not go to the client. */
- mu_error_set_print (mu_syslog_error_printer);
+ {
+ mu_debug_t debug;
+
+ mu_diag_get_debug (&debug);
+ mu_debug_set_print (debug, mu_diag_syslog_printer, NULL);
+ }
umask (S_IROTH | S_IWOTH | S_IXOTH); /* 007 */
@@ -317,17 +322,17 @@ imap4d_mainloop (int fd, FILE *infile, FILE *outfile)
struct sockaddr_in cs;
int len = sizeof cs;
- syslog (LOG_INFO, _("Incoming connection opened"));
+ mu_diag_output (MU_DIAG_INFO, _("Incoming connection opened"));
if (getpeername (fd, (struct sockaddr *) &cs, &len) < 0)
- syslog (LOG_ERR, _("Cannot obtain IP address of client: %s"),
+ mu_diag_output (MU_DIAG_ERROR, _("Cannot obtain IP address of client: %s"),
strerror (errno));
else
- syslog (LOG_INFO, _("Connect from %s"), inet_ntoa (cs.sin_addr));
+ mu_diag_output (MU_DIAG_INFO, _("Connect from %s"), inet_ntoa (cs.sin_addr));
text = "IMAP4rev1";
}
else
{
- syslog (LOG_INFO, _("Started in debugging mode"));
+ mu_diag_output (MU_DIAG_INFO, _("Started in debugging mode"));
text = "IMAP4rev1 Debugging mode";
}
@@ -392,7 +397,7 @@ imap4d_daemon (unsigned int maxchildren, unsigned int port)
listenfd = socket (PF_INET, SOCK_STREAM, 0);
if (listenfd == -1)
{
- syslog (LOG_ERR, "socket: %s", strerror (errno));
+ mu_diag_output (MU_DIAG_ERROR, "socket: %s", strerror (errno));
exit (1);
}
size = 1; /* Use size here to avoid making a new variable. */
@@ -405,23 +410,23 @@ imap4d_daemon (unsigned int maxchildren, unsigned int port)
if (bind (listenfd, (struct sockaddr *) &server, size) == -1)
{
- syslog (LOG_ERR, "bind: %s", strerror (errno));
+ mu_diag_output (MU_DIAG_ERROR, "bind: %s", strerror (errno));
exit (1);
}
if (listen (listenfd, 128) == -1)
{
- syslog (LOG_ERR, "listen: %s", strerror (errno));
+ mu_diag_output (MU_DIAG_ERROR, "listen: %s", strerror (errno));
exit (1);
}
- syslog (LOG_INFO, _("GNU imap4d started"));
+ mu_diag_output (MU_DIAG_INFO, _("GNU imap4d started"));
for (;;)
{
if (children > maxchildren)
{
- syslog (LOG_ERR, _("Too many children (%s)"),
+ mu_diag_output (MU_DIAG_ERROR, _("Too many children (%s)"),
mu_umaxtostr (0, children));
pause ();
continue;
@@ -432,13 +437,13 @@ imap4d_daemon (unsigned int maxchildren, unsigned int port)
{
if (errno == EINTR)
continue;
- syslog (LOG_ERR, "accept: %s", strerror (errno));
+ mu_diag_output (MU_DIAG_ERROR, "accept: %s", strerror (errno));
exit (1);
}
pid = fork ();
if (pid == -1)
- syslog (LOG_ERR, "fork: %s", strerror (errno));
+ mu_diag_output (MU_DIAG_ERROR, "fork: %s", strerror (errno));
else if (pid == 0) /* Child. */
{
int status;
diff --git a/imap4d/login.c b/imap4d/login.c
index 244760afb..c498df577 100644
--- a/imap4d/login.c
+++ b/imap4d/login.c
@@ -44,7 +44,7 @@ imap4d_login (struct imap4d_command *command, char *arg)
if (auth_data == NULL)
{
- syslog (LOG_INFO, _("User `%s': nonexistent"), username);
+ mu_diag_output (MU_DIAG_INFO, _("User `%s': nonexistent"), username);
return util_finish (command, RESP_NO, "User name or passwd rejected");
}
@@ -52,7 +52,7 @@ imap4d_login (struct imap4d_command *command, char *arg)
openlog ("gnu-imap4d", LOG_PID, log_facility);
if (rc)
{
- syslog (LOG_INFO, _("Login failed: %s"), username);
+ mu_diag_output (MU_DIAG_INFO, _("Login failed: %s"), username);
return util_finish (command, RESP_NO, "User name or passwd rejected");
}
@@ -67,7 +67,7 @@ imap4d_login (struct imap4d_command *command, char *arg)
util_chdir (homedir);
namespace_init (homedir);
- syslog (LOG_INFO, _("User `%s' logged in (source: %s)"), username,
+ mu_diag_output (MU_DIAG_INFO, _("User `%s' logged in (source: %s)"), username,
auth_data->source);
return util_finish (command, RESP_OK, "Completed");
}
diff --git a/imap4d/search.c b/imap4d/search.c
index 229c9a0fe..1f6c7bdb8 100644
--- a/imap4d/search.c
+++ b/imap4d/search.c
@@ -583,7 +583,7 @@ parse_equiv_key (struct parsebuf *pb)
if (!node)
{
/* shouldn't happen? */
- syslog(LOG_CRIT, _("%s:%d: INTERNAL ERROR (please report)"),
+ mu_diag_output (MU_DIAG_CRIT, _("%s:%d: INTERNAL ERROR (please report)"),
__FILE__, __LINE__);
abort ();
}
@@ -706,7 +706,7 @@ parse_simple_key (struct parsebuf *pb)
break;
default:
- syslog(LOG_CRIT, _("%s:%d: INTERNAL ERROR (please report)"),
+ mu_diag_output (MU_DIAG_CRIT, _("%s:%d: INTERNAL ERROR (please report)"),
__FILE__, __LINE__);
abort (); /* should never happen */
}
@@ -782,7 +782,7 @@ search_run (struct parsebuf *pb)
evaluate_node (pb->tree, pb, &value);
if (value.type != value_number)
{
- syslog(LOG_CRIT, _("%s:%d: INTERNAL ERROR (please report)"),
+ mu_diag_output (MU_DIAG_CRIT, _("%s:%d: INTERNAL ERROR (please report)"),
__FILE