Commit c060b5fd c060b5fddd1ae0a06089df418c4cb4393b2de615 by Sergey Poznyakoff

* TODO, NEWS: Update.

* mailbox/msrv.c: New file.
* mailbox/Makefile.am: Add msrv.c.
* include/mailutils/server.h (mu_tcp_server_conn_fp): Take
sockaddr as argument
(mu_tcp_server_create,mu_tcp_server_get_sockaddr): Likewise.
(mu_m_server_*): New prototypes.
* include/mailutils/types.hin (mu_m_server_t): New type.
* mailbox/acl.c: Fix debugging output.
(mu_sockaddr_to_str, mu_sockaddr_to_astr): New functions.

* mailbox/tcpsrv.c: Handle AF_INET and AF_UNIX sockets.
* examples/echosrv.c: Update mu_tcp_server_* calls.
* examples/config/Makefile.am: Remove comsat.conf and
mailutils.rc.

* imap4d/imap4d.c, imap4d/imap4d.h, imap4d/signal.c,
maidag/lmtp.c, maidag/maidag.c, maidag/maidag.h, pop3d/extra.c,
pop3d/pop3d.c, pop3d/pop3d.h, pop3d/signal.c: Rewrite using
m-server.

* include/mailutils/cfg.h (mu_offsetof): Bug fix.
* mailbox/cfg_driver.c (dup_container): Bugfix. Offset was not
copied.
(mu_cfg_section_add_params): If identifier starts with a dot, it
is hidden, i.e. its substatements are copied directly into the
parent structure.
* mailbox/cfg_lexer.c (isword): Take care of opening braces.
(default_lexer): Several fixes.
* mailbox/cfg_parser.y (mu_cfg_parse): Initialize debugging level
from global settings.
(_scan_tree_helper): Ensure debugging object has correct locus
information before calling the section parser.
(mu_cfg_scan_tree): If no debugging object is supplied, use the
one from diag.c
* mailbox/daemon.c (mu_daemon_create_pidfile): Return a meaningful
error code.
* mailbox/debug.c (mu_debug_create): Initialize printer to NULL.
(mu_debug_vprintf): If printer is NULL, use
mu_debug_default_printer.
(mu_debug_check_level): Bugfix.

* mailbox/server.c: Minor indentation fix.
* mailbox/syslog.c (mu_diag_syslog_printer): Chop off \r as well.
* mailbox/folder.c (mu_folder_create_from_record): Bugfixes.

* include/mailutils/debug.hm4 (mu_sockaddr_to_str)
(mu_sockaddr_to_astr): New functions.

* include/mailutils/.cvsignore: Add debug.h

* po/POTFILES.in: Update.
1 parent c51fa40b
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002, 2003, 2005,
2007 Free Software Foundation, Inc.
2007, 2008 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
......@@ -202,6 +202,22 @@ pop3d_is_master ()
return ostream == NULL;
}
static void
transcript (const char *pfx, const char *buf)
{
if (pop3d_transcript)
{
int len = strlen (buf);
if (len > 0 && buf[len-1] == '\n')
{
len--;
if (len > 0 && buf[len-1] == '\r')
len--;
}
mu_diag_output (MU_DIAG_DEBUG, "%s: %-.*s", pfx, len, buf);
}
}
void
pop3d_outf (const char *fmt, ...)
{
......@@ -216,8 +232,7 @@ pop3d_outf (const char *fmt, ...)
if (!buf)
pop3d_abquit (ERR_NO_MEM);
if (mu_gocs_daemon.transcript)
mu_diag_output (MU_DIAG_DEBUG, "sent: %s", buf);
transcript ("sent", buf);
rc = mu_stream_sequential_write (ostream, buf, strlen (buf));
free (buf);
......@@ -232,7 +247,6 @@ pop3d_outf (const char *fmt, ...)
}
}
/* Gets a line of input from the client, caller should free() */
char *
pop3d_readline (char *buffer, size_t size)
......@@ -240,7 +254,7 @@ pop3d_readline (char *buffer, size_t size)
int rc;
size_t nbytes;
alarm (mu_gocs_daemon.timeout);
alarm (idle_timeout);
rc = mu_stream_sequential_readline (istream, buffer, size, &nbytes);
alarm (0);
......@@ -259,8 +273,7 @@ pop3d_readline (char *buffer, size_t size)
pop3d_abquit (ERR_NO_OFILE);
}
if (mu_gocs_daemon.transcript)
mu_diag_output (MU_DIAG_DEBUG, "recv: %s", buffer);
transcript ("recv", buffer);
/* Caller should not free () this ... should we strdup() then? */
return buffer;
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2007 Free Software Foundation, Inc.
2004, 2005, 2007, 2008 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
......@@ -156,6 +156,7 @@ extern int expire_on_exit;
#include <mailutils/url.h>
#include <mailutils/md5.h>
#include <mailutils/acl.h>
#include <mailutils/server.h>
/* For Berkley DB2 APOP password file */
#ifdef HAVE_DB_H
......@@ -205,6 +206,9 @@ extern int expire_on_exit;
#define ERR_TLS_IO 18
#define ERR_LOGIN_DELAY 19
typedef struct mu_pop_server *mu_pop_server_t;
extern mu_pop_server_t pop3srv;
extern mu_mailbox_t mbox;
extern int state;
extern int initial_state;
......@@ -220,6 +224,8 @@ extern int tls_done;
#endif /* WITH_TLS */
extern int undelete_on_startup;
extern struct mu_auth_data *auth_data;
extern unsigned int idle_timeout;
extern int pop3d_transcript;
extern void pop3d_bye (void);
extern int pop3d_abquit (int);
......@@ -238,7 +244,6 @@ extern int pop3d_retr (const char *);
extern int pop3d_rset (const char *);
extern void process_cleanup (void);
extern RETSIGTYPE pop3d_sigchld (int);
extern RETSIGTYPE pop3d_signal (int);
extern int pop3d_stat (const char *);
#ifdef WITH_TLS
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2007, 2008
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
......@@ -19,30 +19,6 @@
#include "pop3d.h"
static int need_cleanup = 0;
void
process_cleanup ()
{
pid_t pid;
int status;
if (need_cleanup)
{
need_cleanup = 0;
while ( (pid = waitpid (-1, &status, WNOHANG)) > 0)
--children;
}
}
RETSIGTYPE
pop3d_sigchld (int signo MU_ARG_UNUSED)
{
need_cleanup = 1;
#ifndef HAVE_SIGACTION
signal (signo, pop3d_sigchld);
#endif
}
/* Default signal handler to call the pop3d_abquit() function */
......