Commit 5d286f5d 5d286f5d98dc932fff3754e3c992c40a765a3167 by Sergey Poznyakoff

* NEWS: Update.

* mailbox/Makefile.am: Replace tcpsrv.c with ipsrv.c.
* mailbox/tcpsrv.c: Replace with ...
* mailbox/ipsrv.c: ... this file, which supports both TCP and UDP.

* mailbox/msrv.c: Use mu_ip_server_t.
* mailbox/server.c (mu_server_destroy): Bugfix.
* comsat/comsat.c, comsat/comsat.h: Use m-server.

* maidag/lmtp.c, maidag/maidag.h, pop3d/pop3d.c: Update to match
changed m-server types.

* include/mailutils/server.h (mu_tcp_*): Replace with mu_ip_*.
Add new prototypes.
* include/mailutils/types.hin: Likewise.

* lib/tcpwrap.c, lib/tcpwrap.h (mu_tcp_wrapper_prefork): Update
signature to match mu_m_server_prefork_fp.

* examples/echosrv.c: Use mu_ip_server_t
* imap4d/idle.c, imap4d/imap4d.c, imap4d/imap4d.h,
imap4d/preauth.c, imap4d/util.c: Remove mu_gocs_daemon.
* include/mailutils/gocs.h, include/mailutils/libargp.h,
include/mailutils/libargp.h, libargp/cmdline.c,
libargp/common.c, libcfg/common.c, libcfg/init.c,
mailbox/daemon.c, mailbox/gocs.c: Remove mu_gocs_daemon.

* mailbox/amd.c (amd_open): Provide a null-locker.
* include/mailutils/locker.h, mailbox/locker.c
(mu_locker_mod_flags): New function.

* examples/config/mailutils.schema: LDAP schema for Mailutils.
* examples/config/Makefile.am: Add mailutils.schema

* dotlock/dotlock.c (main): Remove superfluous invocation of
mu_locker_set_flags.

* libproto/mbox/mbox.c (mbox_quick_get_message): Return
MU_ERR_NOENT if mailbox is empty.

* mailbox/tcpsrv.c (family_to_proto): Rename to
mu_address_family_to_domain.
* po/POTFILES.in: Update.
* pop3d/lock.c (pop3d_lock): use mu_locker_mod_flags, instead of
mu_locker_set_flags.
1 parent 6d0cedd1
2008-01-05 Sergey Poznyakoff <gray@gnu.org.ua>
* NEWS: Update.
* mailbox/Makefile.am: Replace tcpsrv.c with ipsrv.c.
* mailbox/tcpsrv.c: Replace with ...
* mailbox/ipsrv.c: ... this file, which supports both TCP and UDP.
* mailbox/msrv.c: Use mu_ip_server_t.
* mailbox/server.c (mu_server_destroy): Bugfix.
* comsat/comsat.c, comsat/comsat.h: Use m-server.
* maidag/lmtp.c, maidag/maidag.h, pop3d/pop3d.c: Update to match
changed m-server types.
* include/mailutils/server.h (mu_tcp_*): Replace with mu_ip_*.
Add new prototypes.
* include/mailutils/types.hin: Likewise.
* lib/tcpwrap.c, lib/tcpwrap.h (mu_tcp_wrapper_prefork): Update
signature to match mu_m_server_prefork_fp.
* examples/echosrv.c: Use mu_ip_server_t
* imap4d/idle.c, imap4d/imap4d.c, imap4d/imap4d.h,
imap4d/preauth.c, imap4d/util.c: Remove mu_gocs_daemon.
* include/mailutils/gocs.h, include/mailutils/libargp.h,
include/mailutils/libargp.h, libargp/cmdline.c,
libargp/common.c, libcfg/common.c, libcfg/init.c,
mailbox/daemon.c, mailbox/gocs.c: Remove mu_gocs_daemon.
* mailbox/amd.c (amd_open): Provide a null-locker.
* include/mailutils/locker.h, mailbox/locker.c
(mu_locker_mod_flags): New function.
* examples/config/mailutils.schema: LDAP schema for Mailutils.
* examples/config/Makefile.am: Add mailutils.schema
* dotlock/dotlock.c (main): Remove superfluous invocation of
mu_locker_set_flags.
* libproto/mbox/mbox.c (mbox_quick_get_message): Return
MU_ERR_NOENT if mailbox is empty.
* mailbox/tcpsrv.c (family_to_proto): Rename to
mu_address_family_to_domain.
* po/POTFILES.in: Update.
* pop3d/lock.c (pop3d_lock): use mu_locker_mod_flags, instead of
mu_locker_set_flags.
* include/mailutils/server.h (mu_m_server_prefork_fp): New
function type.
(mu_m_server_destroy, mu_m_server_set_prefork)
......
GNU mailutils NEWS -- history of user-visible changes. 2008-01-04
GNU mailutils NEWS -- history of user-visible changes. 2008-01-05
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
See the end of file for copying conditions.
......@@ -93,12 +93,13 @@ PREAUTH mode:
DES encrypted replies are understood.
3. prog - Imap4d invokes an external program to authenticate the
connection. Four arguments are supplied to the program:
connection. The command line is obtained from the supplied string,
by expandind the following variables:
1) Remote IP address in dotted-quad notation;
2) Remote port number;
3) Local IP address (currently "0.0.0.0");
4) Local port number.
1) ${client_address} - Remote IP address in dotted-quad notation;
2) ${client_port} - Remote port number;
3) ${server_address} - Local IP address;
4) ${server_port} - Local port number.
If the connection is authenticated, the program should print the
user name, followed by a newline character, on its standard
......
/* 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
......@@ -61,6 +62,7 @@
#include <mailutils/nls.h>
#include <mailutils/daemon.h>
#include <mailutils/acl.h>
#include <mailutils/server.h>
#ifndef INADDR_NONE
# define INADDR_NONE -1
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 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
......@@ -182,8 +182,6 @@ main (int argc, char *argv[])
return MU_DL_EX_ERROR;
}
mu_locker_set_flags (locker, flags);
if (force != 0)
mu_locker_set_expire_time (locker, force);
......
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
## Copyright (C) 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
......@@ -21,5 +21,6 @@ EXTRA_DIST = \
dot.biffrc\
gnu-imap4d.pam\
gnu-pop3d.pam\
mailutils.dict
mailutils.dict\
mailutils.schema
......
# This file is part of GNU Mailutils -- a suite of utilities for electronic
# mail
# Copyright (C) 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
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Mailutils 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 <http://www.gnu.org/licenses/>.
attributetype ( 1.3.6.1.4.1.11591.4.1.0 NAME 'mu-mailBox'
DESC 'The URL of the user mail box'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.11591.4.1.1 NAME 'mu-mailQuota'
DESC 'Maximum allowed size of the user mailbox'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
# Object Class Definitions
objectclass ( 1.3.6.1.4.1.11591.4.2.0 NAME 'mailutilsAccount'
DESC 'Abstraction of an account with Mailutils attributes'
SUP posixAccount AUXILIARY
MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory )
MAY ( userPassword $ loginShell $ gecos $ mu-mailBox $ mu-mailQuota ) )
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -37,7 +37,7 @@ mu_server_t server;
int
echo_conn (int fd, struct sockaddr *s, int len,
void *server_data, void *call_data,
mu_tcp_server_t srv)
mu_ip_server_t srv)
{
struct sockaddr_in srv_addr, *s_in = (struct sockaddr_in *)s;
int addrlen = sizeof srv_addr;
......@@ -45,7 +45,7 @@ echo_conn (int fd, struct sockaddr *s, int len,
char buf[512];
FILE *in, *out;
mu_tcp_server_get_sockaddr (srv, (struct sockaddr *)&srv_addr, &addrlen);
mu_ip_server_get_sockaddr (srv, (struct sockaddr *)&srv_addr, &addrlen);
pid = fork ();
if (pid == -1)
......@@ -63,7 +63,7 @@ echo_conn (int fd, struct sockaddr *s, int len,
return 0;
}
mu_tcp_server_shutdown (srv);
mu_ip_server_shutdown (srv);
in = fdopen (fd, "r");
out = fdopen (fd, "w");
......@@ -88,11 +88,11 @@ echo_conn (int fd, struct sockaddr *s, int len,
int
tcp_conn_handler (int fd, void *conn_data, void *server_data)
{
mu_tcp_server_t tcpsrv = (mu_tcp_server_t) conn_data;
int rc = mu_tcp_server_accept (tcpsrv, server_data);
mu_ip_server_t tcpsrv = (mu_ip_server_t) conn_data;
int rc = mu_ip_server_accept (tcpsrv, server_data);
if (rc && rc != EINTR)
{
mu_tcp_server_shutdown (tcpsrv);
mu_ip_server_shutdown (tcpsrv);
return MU_SERVER_CLOSE_CONN;
}
return MU_SERVER_SUCCESS;
......@@ -101,8 +101,8 @@ tcp_conn_handler (int fd, void *conn_data, void *server_data)
void
tcp_conn_free (void *conn_data, void *server_data)
{
mu_tcp_server_t tcpsrv = (mu_tcp_server_t) conn_data;
mu_tcp_server_destroy (&tcpsrv);
mu_ip_server_t tcpsrv = (mu_ip_server_t) conn_data;
mu_ip_server_destroy (&tcpsrv);
}
void
......@@ -110,7 +110,7 @@ create_server (char *arg)
{
char *p, *q;
struct sockaddr_in s;
mu_tcp_server_t tcpsrv;
mu_ip_server_t tcpsrv;
unsigned n;
p = strchr (arg, ':');
......@@ -134,11 +134,12 @@ create_server (char *arg)
}
s.sin_port = htons (n);
MU_ASSERT (mu_tcp_server_create (&tcpsrv, (struct sockaddr*) &s, sizeof s));
MU_ASSERT (mu_tcp_server_open (tcpsrv));
MU_ASSERT (mu_tcp_server_set_conn (tcpsrv, echo_conn));
MU_ASSERT (mu_ip_server_create (&tcpsrv, (struct sockaddr*) &s, sizeof s,
MU_IP_TCP));
MU_ASSERT (mu_ip_server_open (tcpsrv));
MU_ASSERT (mu_ip_server_set_conn (tcpsrv, echo_conn));
MU_ASSERT (mu_server_add_connection (server,
mu_tcp_server_get_fd (tcpsrv),
mu_ip_server_get_fd (tcpsrv),
tcpsrv,
tcp_conn_handler, tcp_conn_free));
}
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003, 2007 Free Software Foundation, Inc.
Copyright (C) 2003, 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
......@@ -49,7 +49,7 @@ imap4d_idle (struct imap4d_command *command, char *arg)
if (rc)
break;
}
else if (time (NULL) - start > mu_gocs_daemon.timeout)
else if (time (NULL) - start > idle_timeout)
imap4d_bye (ERR_TIMEOUT);
imap4d_sync ();
......
......@@ -371,7 +371,6 @@ static int
imap4d_mainloop (int fd, FILE *infile, FILE *outfile)
{
char *text;
struct sockaddr_in cs;
int debug_mode = isatty (fd);
/* Reset hup to exit. */
......@@ -416,7 +415,8 @@ imap4d_mainloop (int fd, FILE *infile, FILE *outfile)
}
int
imap4d_connection (int fd, void *data, time_t timeout, int transcript)
imap4d_connection (int fd, struct sockaddr *sa, int salen, void *data,
mu_ip_server_t srv, time_t timeout, int transcript)
{
idle_timeout = timeout;
imap4d_transcript = transcript;
......
......@@ -182,6 +182,8 @@ extern int preauth_only;
extern int ident_port;
extern char *ident_keyfile;
extern int ident_encrypt_only;
extern unsigned int idle_timeout;
extern int imap4d_transcript;
#ifndef HAVE_STRTOK_R
extern char *strtok_r (char *s, const char *delim, char **save_ptr);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
2005, 2006, 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
......@@ -20,13 +20,14 @@
/* Preauth support for imap4d */
#include "imap4d.h"
#include <mailutils/vartab.h>
#include "des.h"
/* Stdio preauth */
static char *
do_preauth_stdio (struct sockaddr_in *pcs)
do_preauth_stdio ()
{
struct passwd *pw = getpwuid (getuid ());
return pw ? strdup (pw->pw_name) : NULL;
......@@ -321,15 +322,32 @@ ident_decrypt (const char *file, const char *name)
}
static char *
do_preauth_ident (struct sockaddr_in *pcs)
do_preauth_ident (struct sockaddr *clt_sa, struct sockaddr *srv_sa)
{
mu_stream_t stream;
char hostaddr[16];
char *p = inet_ntoa (pcs->sin_addr);
int rc;
char *buf = NULL;
size_t size = 0;
char *name = NULL;
struct sockaddr_in *srv_addr, *clt_addr;
char *p;
if (!srv_sa || !clt_sa)
{
mu_diag_output (MU_DIAG_ERROR, _("Not enough data for IDENT preauth"));
return NULL;
}
if (srv_sa->sa_family != AF_INET)
{
mu_diag_output (MU_DIAG_ERROR,
_("Invalid socket family (%d) IDENT preauth"),
srv_sa->sa_family);
return NULL;
}
srv_addr = (struct sockaddr_in *) srv_sa;
clt_addr = (struct sockaddr_in *) clt_sa;
p = inet_ntoa (clt_addr->sin_addr);
memcpy (hostaddr, p, 15);
hostaddr[15] = 0;
......@@ -350,8 +368,9 @@ do_preauth_ident (struct sockaddr_in *pcs)
return NULL;
}
mu_stream_sequential_printf (stream, "%u , %u\r\n", ntohs (pcs->sin_port),
mu_gocs_daemon.port);
mu_stream_sequential_printf (stream, "%u , %u\r\n",
ntohs (clt_addr->sin_port),
ntohs (srv_addr->sin_port));
mu_stream_shutdown (stream, MU_STREAM_WRITE);
rc = mu_stream_sequential_getline (stream, &buf, &size, NULL);
......@@ -402,21 +421,35 @@ do_preauth_ident (struct sockaddr_in *pcs)
/* External (program) preauth */
static char *
do_preauth_program (struct sockaddr_in *pcs)
do_preauth_program (struct sockaddr *pcs, struct sockaddr *sa)
{
int rc;
mu_vartab_t vtab;
char *cmd;
FILE *fp;
char *p = inet_ntoa (pcs->sin_addr);
char *cmd = 0;
char *buf = NULL;
size_t size;
ssize_t rc;
asprintf (&cmd, "%s %s %u %s %u",
preauth_program,
p,
ntohs (pcs->sin_port),
"0.0.0.0", /* FIXME */
mu_gocs_daemon.port);
size_t size = 0;
mu_vartab_create (&vtab);
if (pcs && pcs->sa_family == AF_INET)
{
struct sockaddr_in *s_in = (struct sockaddr_in *)pcs;
mu_vartab_define (vtab, "client_address", inet_ntoa (s_in->sin_addr), 0);
mu_vartab_define (vtab, "client_port",
mu_umaxtostr (0, ntohs (s_in->sin_port)), 0);
}
if (sa && sa->sa_family == AF_INET)
{
struct sockaddr_in *s_in = (struct sockaddr_in *) sa;
mu_vartab_define (vtab, "server_address", inet_ntoa (s_in->sin_addr), 0);
mu_vartab_define (vtab, "server_port",
mu_umaxtostr (0, ntohs (s_in->sin_port)), 0);
}
rc = mu_vartab_expand (vtab, preauth_program, &cmd);
mu_vartab_destroy (&vtab);
if (rc)
return NULL;
fp = popen (cmd, "r");
free (cmd);
rc = getline (&buf, &size, fp);
......@@ -436,14 +469,30 @@ do_preauth_program (struct sockaddr_in *pcs)
int
imap4d_preauth_setup (int fd)
{
struct sockaddr_in cs;
int len = sizeof cs;
struct sockaddr clt_sa, *pclt_sa;
int clt_len = sizeof clt_sa;
struct sockaddr srv_sa, *psrv_sa;
int srv_len = sizeof srv_sa;
char *username = NULL;
if (getpeername (fd, (struct sockaddr *) &cs, &len) < 0)
if (getsockname (fd, &srv_sa, &srv_len) == -1)
{
psrv_sa = NULL;
srv_len = 0;
}
else
psrv_sa = &srv_sa;
if (getpeername (fd, (struct sockaddr *) &clt_sa, &clt_len) == -1)
{
mu_diag_output (MU_DIAG_ERROR,
_("Cannot obtain IP address of client: %s"),
strerror (errno));
pclt_sa = NULL;
clt_len = 0;
}
else
pclt_sa = &clt_sa;
auth_data = NULL;
switch (preauth_mode)
......@@ -452,15 +501,15 @@ imap4d_preauth_setup (int fd)
return 0;
case preauth_stdio:
username = do_preauth_stdio (&cs);
username = do_preauth_stdio ();
break;
case preauth_ident:
username = do_preauth_ident (&cs);
username = do_preauth_ident (pclt_sa, psrv_sa);
break;
case preauth_prog:
username = do_preauth_program (&cs);
username = do_preauth_program (pclt_sa, psrv_sa);
break;
}
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
2005, 2006, 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
......@@ -360,7 +360,7 @@ util_send (const char *format, ...)
if (!buf)
imap4d_bye (ERR_NO_MEM);
if (mu_gocs_daemon.transcript)
if (imap4d_transcript)
mu_diag_output (MU_DIAG_DEBUG, "sent: %s", buf);
status = mu_stream_sequential_write (ostream, buf, strlen (buf));
......@@ -414,7 +414,7 @@ util_out (int rc, const char *format, ...)
if (!buf)
imap4d_bye (ERR_NO_MEM);
if (mu_gocs_daemon.transcript)
if (imap4d_transcript)
mu_diag_output (MU_DIAG_DEBUG, "sent: %s", buf);
status = mu_stream_sequential_write (ostream, buf, strlen (buf));
......@@ -455,7 +455,7 @@ util_finish (struct imap4d_command *command, int rc, const char *format, ...)
strcat (buf, tempbuf);
free (tempbuf);
if (mu_gocs_daemon.transcript)
if (imap4d_transcript)
mu_diag_output (MU_DIAG_DEBUG, "sent: %s\r\n", buf);
mu_stream_sequential_write (ostream, buf, strlen (buf));
......@@ -503,7 +503,7 @@ imap4d_readline (void)
size_t sz;
int rc;
alarm (mu_gocs_daemon.timeout);
alarm (idle_timeout);
rc = mu_stream_sequential_readline (istream, buffer, sizeof (buffer), &sz);
if (sz == 0)
{
......@@ -577,7 +577,7 @@ imap4d_readline (void)
}
}
while (number > 0 || (total && line[total - 1] != '\n'));
if (mu_gocs_daemon.transcript)
if (imap4d_transcript)
mu_diag_output (MU_DIAG_DEBUG, "recv: %s", line);
return line;
}
......@@ -1035,7 +1035,7 @@ util_localname ()
#define WILD_ABORT 2
int
_wild_match (const char *expr, const char *name, const char *delim)
_wild_match (const char *expr, const char *name, char delim)
{
while (expr && *expr)
{
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -26,16 +26,6 @@
extern "C" {
#endif
struct mu_gocs_daemon
{
int mode;
size_t maxchildren;
unsigned int port;
unsigned int timeout;
int transcript;
char *pidfile;
};
struct mu_gocs_logging
{
int facility;
......@@ -104,7 +94,6 @@ int mu_gocs_enumerate (mu_list_action_t action, void *data);
int mu_gocs_mailbox_init (void *data);
int mu_gocs_locking_init (void *data);
int mu_gocs_daemon_init (void *data);
int mu_gocs_source_email_init (void *data);
int mu_gocs_mailer_init (void *data);
int mu_gocs_logging_init (void *data);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2004, 2005,
2007 Free Software Foundation, Inc.
2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -52,7 +52,6 @@ extern struct mu_cmdline_capa mu_mailbox_cmdline;
extern struct mu_cmdline_capa mu_locking_cmdline;
extern struct mu_cmdline_capa mu_address_cmdline;
extern struct mu_cmdline_capa mu_mailer_cmdline;
extern struct mu_cmdline_capa mu_daemon_cmdline;
extern struct mu_cmdline_capa mu_sieve_cmdline;
extern struct mu_cmdline_capa mu_debug_cmdline;
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -96,7 +96,6 @@ extern struct mu_cfg_capa mu_sql_cfg_capa;
extern struct mu_cfg_capa mu_tls_cfg_capa;
extern struct mu_cfg_capa mu_virtdomain_cfg_capa;
extern struct mu_cfg_capa mu_sieve_cfg_capa;
extern struct mu_cfg_capa mu_daemon_cfg_capa;
extern struct mu_cfg_capa mu_auth_cfg_capa;
extern struct mu_cfg_capa mu_ldap_cfg_capa;
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005, 2007 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2005, 2007,
2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -112,6 +113,8 @@ extern void mu_locker_destroy (mu_locker_t *);
/* Time is measured in seconds. */
extern int mu_locker_set_flags (mu_locker_t, int);
extern int mu_locker_mod_flags (mu_locker_t locker, int flags,
enum mu_locker_set_mode mode);
extern int mu_locker_set_expire_time (mu_locker_t, int);
extern int mu_locker_set_retries (mu_locker_t, int);
extern int mu_locker_set_retry_sleep (mu_locker_t, int);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -43,42 +43,57 @@ int mu_server_set_timeout (mu_server_t srv, struct timeval *to);
int mu_server_count (mu_server_t srv, size_t *pcount);
/* TCP server */
/* IP (TCP and UDP) server */
struct sockaddr;
typedef int (*mu_tcp_server_conn_fp) (int fd, struct sockaddr *s, int len,
typedef int (*mu_ip_server_conn_fp) (int fd, struct sockaddr *s, int len,
void *server_data, void *call_data,
mu_tcp_server_t srv);
typedef int (*mu_tcp_server_intr_fp) (void *data, void *call_data);
typedef void (*mu_tcp_server_free_fp) (void *data);
int mu_tcp_server_create (mu_tcp_server_t *psrv, struct sockaddr *addr,
int len);
int mu_tcp_server_destroy (mu_tcp_server_t *psrv);
int mu_tcp_server_set_debug (mu_tcp_server_t srv, mu_debug_t debug);
int mu_tcp_server_get_debug (mu_tcp_server_t srv, mu_debug_t *pdebug);
int mu_tcp_server_set_backlog (mu_tcp_server_t srv, int backlog);
int mu_tcp_server_set_ident (mu_tcp_server_t srv, const char *ident);
int mu_tcp_server_set_acl (mu_tcp_server_t srv, mu_acl_t acl);
int mu_tcp_server_set_conn (mu_tcp_server_t srv, mu_tcp_server_conn_fp conn);
int mu_tcp_server_set_intr (mu_tcp_server_t srv, mu_tcp_server_intr_fp intr);
int mu_tcp_server_set_data (mu_tcp_server_t srv,
void *data, mu_tcp_server_free_fp free);
int mu_tcp_server_open (mu_tcp_server_t srv);
int mu_tcp_server_shutdown (mu_tcp_server_t srv);
int mu_tcp_server_accept (mu_tcp_server_t srv, void *call_data);
int mu_tcp_server_loop (mu_tcp_server_t srv, void *call_data);
int mu_tcp_server_get_fd (mu_tcp_server_t srv);
int mu_tcp_server_get_sockaddr (mu_tcp_server_t srv, struct sockaddr *s,
mu_ip_server_t srv);
typedef int (*mu_ip_server_intr_fp) (void *data, void *call_data);
typedef void (*mu_ip_server_free_fp) (void *data);
#define MU_IP_TCP 0
#define MU_IP_UDP 1
int mu_ip_server_create (mu_ip_server_t *psrv, struct sockaddr *addr,
int len, int type);
int mu_ip_server_destroy (mu_ip_server_t *psrv);
int mu_ip_server_get_type (mu_ip_server_t srv, int *ptype);
int mu_ip_server_set_debug (mu_ip_server_t srv, mu_debug_t debug);
int mu_ip_server_get_debug (mu_ip_server_t srv, mu_debug_t *pdebug);
int mu_ip_server_set_ident (mu_ip_server_t srv, const char *ident);
int mu_ip_server_set_acl (mu_ip_server_t srv, mu_acl_t acl);
int mu_ip_server_set_conn (mu_ip_server_t srv, mu_ip_server_conn_fp conn);
int mu_ip_server_set_intr (mu_ip_server_t srv, mu_ip_server_intr_fp intr);
int mu_ip_server_set_data (mu_ip_server_t srv,
void *data, mu_ip_server_free_fp free);
int mu_ip_server_open (mu_ip_server_t srv);
int mu_ip_server_shutdown (mu_ip_server_t srv);
int mu_ip_server_accept (mu_ip_server_t srv, void *call_data);
int mu_ip_server_loop (mu_ip_server_t srv, void *call_data);
int mu_ip_server_get_fd (mu_ip_server_t srv);
int mu_ip_server_get_sockaddr (mu_ip_server_t srv, struct sockaddr *s,
int *size);
int mu_tcp_server_set_backlog (mu_ip_server_t srv, int backlog);
int mu_udp_server_set_bufsize (mu_ip_server_t srv, size_t size);
int mu_udp_server_get_bufsize (mu_ip_server_t srv, size_t *psize);
int mu_udp_server_get_rdata (mu_ip_server_t srv, char **pbuf,
size_t *pbufsize);
/* m-server */
typedef int (*mu_m_server_conn_fp) (int, void *, time_t, int);
typedef int (*mu_m_server_prefork_fp) (int, struct sockaddr *s, int size);
typedef struct mu_m_server_connect_data mu_m_server_connect_data_t;
typedef int (*mu_m_server_conn_fp) (int fd, struct sockaddr *sa, int salen,
void *data, mu_ip_server_t srv,
time_t timeout, int transcript);
typedef int (*mu_m_server_prefork_fp) (int, void *,
struct sockaddr *s, int size);
void mu_m_server_create (mu_m_server_t *psrv, const char *ident);
void mu_m_server_destroy (mu_m_server_t *pmsrv);
void mu_m_server_set_mode (mu_m_server_t srv, int mode);
void mu_m_server_set_type (mu_m_server_t srv, int type);
void mu_m_server_get_type (mu_m_server_t srv, int *ptype);
void mu_m_server_set_conn (mu_m_server_t srv, mu_m_server_conn_fp f);
void mu_m_server_set_prefork (mu_m_server_t srv, mu_m_server_prefork_fp fun);
void mu_m_server_set_data (mu_m_server_t srv, void *data);
......@@ -99,6 +114,9 @@ void mu_m_server_begin (mu_m_server_t msrv);
int mu_m_server_run (mu_m_server_t msrv);
void mu_m_server_end (mu_m_server_t msrv);
void mu_m_server_stop (int code);
int mu_m_server_check_acl (mu_m_server_t msrv, struct sockaddr *s, int salen);
void mu_m_server_cfg_init (void);
......
/* GNU Mailutils -- a suite of utilities for electronic mail -*- c -*-
Copyright (C) 1999, 2000, 2001, 2005, 2007 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2005, 2007,
2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -107,7 +108,7 @@ typedef char *mu_message_qid_t;
typedef int mu_log_level_t;
typedef struct _mu_acl *mu_acl_t;
typedef struct _mu_server *mu_server_t;
typedef struct _mu_tcp_server *mu_tcp_server_t;
typedef struct _mu_ip_server *mu_ip_server_t;
typedef struct _mu_m_server *mu_m_server_t;
#define MU_FOLDER_ATTRIBUTE_DIRECTORY 0x001
......
......@@ -142,7 +142,7 @@ mu_tcpwrapper_access (int fd)
#endif
int
mu_tcp_wrapper_prefork (int fd, struct sockaddr *sa, int salen)
mu_tcp_wrapper_prefork (int fd, void *data, struct sockaddr *sa, int salen)
{
if (mu_tcp_wrapper_enable && !mu_tcpwrapper_access (fd))
{
......
......@@ -31,7 +31,8 @@ extern int mu_tcp_wrapper_cb_hosts_deny_syslog (mu_debug_t debug, void *data,
char *arg);
extern int mu_tcpwrapper_access (int fd);
extern void mu_tcpwrapper_cfg_init (void);
extern int mu_tcp_wrapper_prefork (int fd, struct sockaddr *sa, int salen);
extern int mu_tcp_wrapper_prefork (int fd, void *data,
struct sockaddr *sa, int salen);
#ifdef WITH_LIBWRAP
# define TCP_WRAPPERS_CONFIG { "tcp-wrappers", mu_cfg_section },
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -29,7 +29,6 @@ static struct mu_cmdline_capa *all_cmdline_capa[] = {
&mu_locking_cmdline,
&mu_address_cmdline,
&mu_mailer_cmdline,
&mu_daemon_cmdline,
&mu_debug_cmdline,
&mu_pam_cmdline,
&mu_gsasl_cmdline,
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -22,7 +22,6 @@
#include "cmdline.h"
#include <string.h>
#include <mailutils/syslog.h>
#include <mailutils/daemon.h>
#include <mailutils/mailbox.h>
......@@ -488,91 +487,6 @@ struct mu_cmdline_capa mu_mailer_cmdline = {
};
/* ************************************************************************* */
/* Daemon */
/* ************************************************************************* */
/* Options used by programs that become daemons. */
static struct argp_option mu_daemon_argp_option[] = {
{"daemon", 'd', N_("NUMBER"), OPTION_ARG_OPTIONAL,
N_("Runs in daemon mode with a maximum of NUMBER children")},
{"inetd", 'i', 0, 0,
N_("Run in inetd mode"), 0},
{"port", 'p', N_("PORT"), 0,
N_("Listen on specified port number"), 0},
{"timeout", 't', N_("NUMBER"), OPTION_HIDDEN,
N_("Set idle timeout value to NUMBER seconds"), 0},
{"transcript", 'x', NULL, 0,
N_("Output session transcript via syslog"), 0},
{"pidfile", 'P', N_("FILE"), OPTION_HIDDEN,
N_("Set PID file"), 0},
{ NULL, 0, NULL, 0, NULL, 0 }
};
static error_t
mu_daemon_argp_parser (int key, char *arg, struct argp_state *state)
{
static struct mu_argp_node_list lst;
switch (key)
{
case 'd':
mu_argp_node_list_new (&lst, "mode", "daemon");
if (arg)
mu_argp_node_list_new (&lst, "max-children", arg);
break;
case 'i':
mu_argp_node_list_new (&lst, "mode", "inetd");
break;
case 'p':
mu_argp_node_list_new (&lst, "port", arg);
break;
case 'P':
mu_argp_node_list_new (&lst, "pidfile", arg);
break;
case 't':
mu_argp_node_list_new (&lst, "timeout", arg);
break;
case 'x':
mu_argp_node_list_new (&lst, "transcript", "yes");
break;
case ARGP_KEY_INIT:
mu_argp_node_list_init (&lst);
break;
case ARGP_KEY_FINI:
mu_argp_node_list_finish (&lst, "daemon", NULL);
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
}
struct argp mu_daemon_argp = {
mu_daemon_argp_option,
mu_daemon_argp_parser,
};
struct argp_child mu_daemon_argp_child = {
&mu_daemon_argp,
0,
N_("Daemon configuration options"),
0
};
struct mu_cmdline_capa mu_daemon_cmdline = {
"daemon", &mu_daemon_argp_child
};
static struct argp_option mu_debug_argp_options[] =
{
{ "debug-level", OPT_DEBUG_LEVEL, N_("LEVEL"), 0,
......@@ -590,7 +504,8 @@ mu_debug_argp_parser (int key, char *arg, struct argp_state *state)
switch (key)
{
case OPT_DEBUG_LEVEL:
mu_argp_node_list_new (&lst, "level", arg);
mu_global_debug_from_string (arg, "command line");
//mu_argp_node_list_new (&lst, "level", arg);
break;
case OPT_LINE_INFO:
......
/* This file is part of GNU Mailutils
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 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
......@@ -21,13 +21,11 @@
#include <stdlib.h>
#include <string.h>
#include "mailutils/libcfg.h"
#include <mailutils/daemon.h>
#include <mailutils/debug.h>
#include <mailutils/syslog.h>
#include <mailutils/mailbox.h>
#include <mu_umaxtostr.h>
static struct mu_gocs_daemon daemon_settings;
static struct mu_gocs_locking locking_settings;
static struct mu_gocs_logging logging_settings;
static struct mu_gocs_mailbox mailbox_settings;
......@@ -153,68 +151,6 @@ DCL_CFG_CAPA (logging);
/* ************************************************************************* */
/* Daemon */
/* ************************************************************************* */
static int
_cb_daemon_mode (mu_debug_t debug, void *data, char *arg)
{
if (strcmp (arg, "inetd") == 0
|| strcmp (arg, "interactive") == 0)
daemon_settings.mode = MODE_INTERACTIVE;
else if (strcmp (arg, "daemon") == 0)
daemon_settings.mode = MODE_DAEMON;
else
{
mu_cfg_format_error (debug, MU_DEBUG_ERROR, _("unknown daemon mode"));
return 1;
}
return 0;
}
static struct mu_cfg_param mu_daemon_param[] = {
{ "max-children", mu_cfg_ulong, &daemon_settings.maxchildren, 0, NULL,
N_("Maximum number of children processes to run simultaneously.") },
{ "mode", mu_cfg_callback, NULL, 0, _cb_daemon_mode,
N_("Set daemon mode (either inetd (or interactive) or daemon)."),
N_("mode") },
{ "transcript", mu_cfg_bool, &daemon_settings.transcript, 0, NULL,
N_("Log the session transcript.") },
{ "pidfile", mu_cfg_string, &daemon_settings.pidfile, 0, NULL,
N_("Store PID of the master process in this file."),
N_("file") },
{ "port", mu_cfg_ushort, &daemon_settings.port, 0, NULL,
N_("Listen on the specified port number.") },
{ "timeout", mu_cfg_ulong, &daemon_settings.timeout, 0, NULL,
N_("Set idle timeout.") },
{ NULL }
};
int
mu_daemon_section_parser
(enum mu_cfg_section_stage stage, const mu_cfg_node_t *node,
const char *section_label, void **section_data,
void *call_data, mu_cfg_tree_t *tree)
{
switch (stage)
{
case mu_cfg_section_start:
daemon_settings = mu_gocs_daemon;
break;
case mu_cfg_section_end:
mu_gocs_daemon = daemon_settings;
mu_gocs_store ("daemon", &daemon_settings);
}
return 0;
}
struct mu_cfg_capa mu_daemon_cfg_capa = {
"daemon", mu_daemon_param, mu_daemon_section_parser
};
/* ************************************************************************* */
/* Debug */
/* ************************************************************************* */
......
/* This file is part of GNU Mailutils
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 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
......@@ -37,7 +37,6 @@ struct mu_cfg_capa *cfg_capa_table[] = {
S (tls),
S (virtdomain),
S (sieve),
S (daemon),
S (ldap),
S (debug),
NULL
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003,
2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -1236,6 +1236,8 @@ mbox_quick_get_message (mu_mailbox_t mailbox, mu_message_qid_t qid,
status = mbox_scan1 (mailbox, offset, 0);
if (status != 0)
return status;
if (mud->messages_count == 0)
return MU_ERR_NOENT;
}
/* Quick access mode retrieves only one message */
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 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
......@@ -564,7 +564,8 @@ typedef union
} all_addr_t;
int
lmtp_connection (int fd, void *data, time_t timeout, int transcript)
lmtp_connection (int fd, struct sockaddr *sa, int salen, void *data,
mu_ip_server_t srv, time_t timeout, int transcript)
{
lmtp_transcript = transcript;
lmtp_loop (fdopen (fd, "r"), fdopen (fd, "w"), timeout);
......
......@@ -133,7 +133,8 @@ int switch_user_id (struct mu_auth_data *auth, int user);
int maidag_stdio_delivery (int argc, char **argv);
int maidag_lmtp_server (void);
int lmtp_connection (int fd, void *data, time_t timeout, int transcript);
int lmtp_connection (int fd, struct sockaddr *sa, int salen, void *data,
mu_ip_server_t srv, time_t timeout, int transcript);
void mailer_err (char *fmt, ...);
void notify_biff (mu_mailbox_t mbox, char *name, size_t size);
......
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007
## Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008
## Free Software Foundation, Inc.
##
## GNU Mailutils is free software; you can redistribute it and/or
......@@ -67,6 +67,7 @@ libmailutils_la_SOURCES = \
gocs.c\
header.c\
iterator.c\
ipsrv.c\
kwd.c\
list.c\
locale.c\
......@@ -106,7 +107,6 @@ libmailutils_la_SOURCES = \
system.c\
ticket.c\
tcp.c\
tcpsrv.c\
url.c\
vartab.c\
version.c\
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -347,6 +347,9 @@ amd_open (mu_mailbox_t mailbox, int flags)
if (!S_ISDIR (st.st_mode))
return EINVAL;
if (mailbox->locker == NULL)
mu_locker_create (&mailbox->locker, "/dev/null", 0);
return 0;
}
......@@ -582,7 +585,8 @@ _amd_delim (char *str)
}
static int
_amd_message_save (struct _amd_data *amd, struct _amd_message *mhm, int expunge)
_amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
int expunge)
{
mu_stream_t stream = NULL;
char *name = NULL, *buf = NULL, *msg_name;
......@@ -708,6 +712,7 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm, int expunge)
free (buf);
fclose (fp);
/* FIXME: This does not work for maildir. */
msg_name = amd->msg_file_name (mhm, mhm->deleted);
if (rename (name, msg_name))
status = errno;
......
......@@ -79,17 +79,4 @@ mu_daemon_remove_pidfile (void)
}
struct mu_gocs_daemon mu_gocs_daemon;
int
mu_gocs_daemon_init (void *data)
{
if (data)
{
struct mu_gocs_daemon *cfg = data;
mu_gocs_daemon = *cfg;
}
return 0;
}
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -297,7 +297,6 @@ static struct mu_gocs_entry std_gocs_table[] = {
{ "license", mu_gocs_dummy },
{ "mailbox", mu_gocs_mailbox_init },
{ "locking", mu_gocs_locking_init },
{ "daemon", mu_gocs_daemon_init },
{ "address", mu_gocs_source_email_init },
{ "mailer", mu_gocs_mailer_init },
{ "logging", mu_gocs_logging_init },
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -36,30 +36,53 @@
#include <mailutils/nls.h>
struct _mu_tcp_server
struct _mu_ip_server
{
char *ident;
struct sockaddr *addr;
int addrlen;
int backlog;
int fd;
int type;
mu_debug_t debug;
mu_acl_t acl;
mu_tcp_server_conn_fp f_conn;
mu_tcp_server_intr_fp f_intr;
mu_tcp_server_free_fp f_free;
mu_ip_server_conn_fp f_conn;
mu_ip_server_intr_fp f_intr;
mu_ip_server_free_fp f_free;
void *data;
union
{
struct
{
int backlog;
} tcp_data;
struct
{
char *buf;
size_t bufsize;
ssize_t rdsize;
} udp_data;
} v;
};
#define IDENTSTR(s) ((s)->ident ? (s)->ident : "default")
int
mu_tcp_server_create (mu_tcp_server_t *psrv, struct sockaddr *addr,
int addrlen)
mu_ip_server_create (mu_ip_server_t *psrv, struct sockaddr *addr,
int addrlen, int type)
{
struct _mu_tcp_server *srv;
struct _mu_ip_server *srv;
mu_log_level_t level;
switch (type)
{
case MU_IP_UDP:
case MU_IP_TCP:
break;
default:
return EINVAL;
}
srv = calloc (1, sizeof *srv);
if (!srv)
return ENOMEM;
......@@ -71,22 +94,32 @@ mu_tcp_server_create (mu_tcp_server_t *psrv, struct sockaddr *addr,
}
memcpy (srv->addr, addr, addrlen);
srv->addrlen = addrlen;
level = mu_global_debug_level ("tcp_server");
srv->type = type;
level = mu_global_debug_level ("ip_server");
if (level)
{
mu_debug_create (&srv->debug, NULL);
mu_debug_set_level (srv->debug, level);
}
srv->fd = -1;
srv->backlog = 4;
switch (type)
{
case MU_IP_UDP:
srv->v.udp_data.bufsize = 4096;
break;
case MU_IP_TCP:
srv->v.tcp_data.backlog = 4;
}
*psrv = srv;
return 0;
}
int
mu_tcp_server_destroy (mu_tcp_server_t *psrv)
mu_ip_server_destroy (mu_ip_server_t *psrv)
{
mu_tcp_server_t srv;
mu_ip_server_t srv;
if (!psrv)
return EINVAL;
srv = *psrv;
......@@ -97,13 +130,15 @@ mu_tcp_server_destroy (mu_tcp_server_t *psrv)
close (srv->fd);
free (srv->addr);
free (srv->ident);
if (srv->type == MU_IP_UDP && srv->v.udp_data.buf)
free (srv->v.udp_data.buf);
free (srv);
*psrv = NULL;
return 0;
}
int
mu_tcp_server_set_debug (mu_tcp_server_t srv, mu_debug_t debug)
mu_ip_server_set_debug (mu_ip_server_t srv, mu_debug_t debug)
{
if (!srv)
return EINVAL;
......@@ -113,7 +148,7 @@ mu_tcp_server_set_debug (mu_tcp_server_t srv, mu_debug_t debug)
}
int
mu_tcp_server_get_debug (mu_tcp_server_t srv, mu_debug_t *pdebug)
mu_ip_server_get_debug (mu_ip_server_t srv, mu_debug_t *pdebug)
{
if (!srv)
return EINVAL;
......@@ -122,16 +157,50 @@ mu_tcp_server_get_debug (mu_tcp_server_t srv, mu_debug_t *pdebug)
}
int
mu_tcp_server_set_backlog (mu_tcp_server_t srv, int backlog)
mu_ip_server_get_type (mu_ip_server_t srv, int *ptype)
{
if (!srv)
return EINVAL;
srv->backlog = backlog;
*ptype = srv->type;
return 0;
}
int
mu_tcp_server_set_backlog (mu_ip_server_t srv, int backlog)
{
if (!srv || srv->type != MU_IP_TCP)
return EINVAL;
srv->v.tcp_data.backlog = backlog;
return 0;
}
int
mu_tcp_server_set_ident (mu_tcp_server_t srv, const char *ident)
mu_udp_server_get_bufsize (mu_ip_server_t srv, size_t *psize)
{
if (!srv || srv->type != MU_IP_UDP)
return EINVAL;
*psize = srv->v.udp_data.bufsize;
return 0;
}
int
mu_udp_server_set_bufsize (mu_ip_server_t srv, size_t size)
{
if (!srv || srv->type != MU_IP_UDP)
return EINVAL;
srv->v.udp_data.bufsize = size;
if (srv->v.udp_data.buf)
{
char *p = realloc (srv->v.udp_data.buf, size);
if (!p)
return ENOMEM;
srv->v.udp_data.buf = p;
}
return 0;
}
int
mu_ip_server_set_ident (mu_ip_server_t srv, const char *ident)
{
if (!srv)
return EINVAL;
......@@ -144,7 +213,7 @@ mu_tcp_server_set_ident (mu_tcp_server_t srv, const char *ident)
}
int
mu_tcp_server_set_acl (mu_tcp_server_t srv, mu_acl_t acl)
mu_ip_server_set_acl (mu_ip_server_t srv, mu_acl_t acl)
{
if (!srv)
return EINVAL;
......@@ -153,7 +222,7 @@ mu_tcp_server_set_acl (mu_tcp_server_t srv, mu_acl_t acl)
}
int
mu_tcp_server_set_conn (mu_tcp_server_t srv, mu_tcp_server_conn_fp conn)
mu_ip_server_set_conn (mu_ip_server_t srv, mu_ip_server_conn_fp conn)
{
if (!srv)
return EINVAL;
......@@ -162,7 +231,7 @@ mu_tcp_server_set_conn (mu_tcp_server_t srv, mu_tcp_server_conn_fp conn)
}
int
mu_tcp_server_set_intr (mu_tcp_server_t srv, mu_tcp_server_intr_fp intr)
mu_ip_server_set_intr (mu_ip_server_t srv, mu_ip_server_intr_fp intr)
{
if (!srv)
return EINVAL;
......@@ -171,8 +240,8 @@ mu_tcp_server_set_intr (mu_tcp_server_t srv, mu_tcp_server_intr_fp intr)
}
int
mu_tcp_server_set_data (mu_tcp_server_t srv,
void *data, mu_tcp_server_free_fp free)
mu_ip_server_set_data (mu_ip_server_t srv,
void *data, mu_ip_server_free_fp free)
{
if (!srv)
return EINVAL;
......@@ -181,8 +250,8 @@ mu_tcp_server_set_data (mu_tcp_server_t srv,
return 0;
}
static int
family_to_proto (int family)
int
mu_address_family_to_domain (int family)
{
switch (family)
{
......@@ -198,7 +267,7 @@ family_to_proto (int family)
}
int
mu_tcp_server_open (mu_tcp_server_t srv)
mu_ip_server_open (mu_ip_server_t srv)
{
int fd;
......@@ -214,7 +283,8 @@ mu_tcp_server_open (mu_tcp_server_t srv)
free (p);
}
fd = socket (family_to_proto (srv->addr->sa_family), SOCK_STREAM, 0);
fd = socket (mu_address_family_to_domain (srv->addr->sa_family),
((srv->type == MU_IP_UDP) ? SOCK_DGRAM : SOCK_STREAM), 0);
if (fd == -1)
{
MU_DEBUG2 (srv->debug, MU_DEBUG_ERROR,
......@@ -275,20 +345,23 @@ mu_tcp_server_open (mu_tcp_server_t srv)
return errno;
}
if (listen (fd, srv->backlog) == -1)
if (srv->type == MU_IP_TCP)
{
if (listen (fd, srv->v.tcp_data.backlog) == -1)
{
MU_DEBUG2 (srv->debug, MU_DEBUG_ERROR,
"%s: listen: %s\n", IDENTSTR (srv), mu_strerror (errno));
close (fd);
return errno;
}
}
srv->fd = fd;
return 0;
}
int
mu_tcp_server_shutdown (mu_tcp_server_t srv)
mu_ip_server_shutdown (mu_ip_server_t srv)
{
if (!srv || srv->fd != -1)
return EINVAL;
......@@ -305,19 +378,20 @@ mu_tcp_server_shutdown (mu_tcp_server_t srv)
}
int
mu_tcp_server_accept (mu_tcp_server_t srv, void *call_data)
mu_ip_tcp_accept (mu_ip_server_t srv, void *call_data)
{
int rc;
int connfd;
union
{
struct sockaddr sa;
char buffer[512];
struct sockaddr_in s_in;
struct sockaddr_un s_un;
} client;
socklen_t size = sizeof (client);
if (!srv || srv->fd == -1)
if (!srv || srv->fd == -1 || srv->type == MU_IP_UDP)
return EINVAL;
connfd = accept (srv->fd, &client.sa, &size);
......@@ -327,7 +401,7 @@ mu_tcp_server_accept (mu_tcp_server_t srv, void *call_data)
if (ec == EINTR)
{
if (srv->f_intr && srv->f_intr (srv->data, call_data))
mu_tcp_server_shutdown (srv);
mu_ip_server_shutdown (srv);
}
return ec;
}
......@@ -351,23 +425,117 @@ mu_tcp_server_accept (mu_tcp_server_t srv, void *call_data)
}
}
rc = srv->f_conn (connfd, &client.sa, size, srv->data, call_data, srv);
if (rc)
mu_tcp_server_shutdown (srv);
close (connfd);
return rc;
}
int
mu_tcp_server_loop (mu_tcp_server_t srv, void *call_data)
mu_ip_udp_accept (mu_ip_server_t srv, void *call_data)
{
int rc;
union
{
struct sockaddr sa;
struct sockaddr_in s_in;
struct sockaddr_un s_un;
} client;
fd_set rdset;
socklen_t salen = sizeof (client);
ssize_t size;
if (!srv->v.udp_data.buf)
{
srv->v.udp_data.buf = malloc (srv->v.udp_data.bufsize);
if (!srv->v.udp_data.buf)
return ENOMEM;
}
FD_ZERO (&rdset);
FD_SET (srv->fd, &rdset);
for (;;)
{
rc = select (srv->fd + 1, &rdset, NULL, NULL, NULL);
if (rc == -1)
{
if (errno == EINTR)
{
if (srv->f_intr && srv->f_intr (srv->data, call_data))
break;
else
continue;
}
}
else
break;
}
if (rc == -1)
return errno;
size = recvfrom (srv->fd, srv->v.udp_data.buf, srv->v.udp_data.bufsize,
0, &client.sa, &salen);
if (size < 0)
{
MU_DEBUG2 (srv->debug, MU_DEBUG_ERROR,
"%s: recvfrom: %s",
IDENTSTR (srv), strerror (errno));
return MU_ERR_FAILURE;
}
srv->v.udp_data.rdsize = size;
if (srv->acl)
{
mu_acl_result_t res;
int rc = mu_acl_check_sockaddr (srv->acl, &client.sa, size, &res);
if (rc)
MU_DEBUG2 (srv->debug, MU_DEBUG_ERROR,
"%s: mu_acl_check_sockaddr: %s\n",
IDENTSTR (srv), strerror (rc));
if (res == mu_acl_result_deny)
{
char *p = mu_sockaddr_to_astr (srv->addr, srv->addrlen);
mu_diag_output (MU_DIAG_INFO, "Denying connection from %s", p);
free (p);
return 0;
}
}
rc = srv->f_conn (-1, &client.sa, size, srv->data, call_data, srv);
return rc;
}
int
mu_ip_server_accept (mu_ip_server_t srv, void *call_data)
{
int rc;
if (!srv || srv->fd == -1)
return EINVAL;
switch (srv->type)
{
case MU_IP_UDP:
rc = mu_ip_udp_accept (srv, call_data);
break;
case MU_IP_TCP:
rc = mu_ip_tcp_accept (srv, call_data);
}
if (rc)
mu_ip_server_shutdown (srv);
return rc;
}
int
mu_ip_server_loop (mu_ip_server_t srv, void *call_data)
{
if (!srv)
return EINVAL;
while (srv->fd != -1)
{
int rc = mu_tcp_server_accept (srv, call_data);
int rc = mu_ip_server_accept (srv, call_data);
if (rc && rc != EINTR)
{
mu_tcp_server_shutdown (srv);
mu_ip_server_shutdown (srv);
return rc;
}
}
......@@ -375,13 +543,23 @@ mu_tcp_server_loop (mu_tcp_server_t srv, void *call_data)
}
int
mu_tcp_server_get_fd (mu_tcp_server_t srv)
mu_ip_server_get_fd (mu_ip_server_t srv)
{
return srv->fd;
}
int
mu_tcp_server_get_sockaddr (mu_tcp_server_t srv, struct sockaddr *s, int *size)
mu_udp_server_get_rdata (mu_ip_server_t srv, char **pbuf, size_t *pbufsize)
{
if (!srv || srv->type != MU_IP_UDP)
return EINVAL;
*pbuf = srv->v.udp_data.buf;
*pbufsize = srv->v.udp_data.rdsize;
return 0;
}
int
mu_ip_server_get_sockaddr (mu_ip_server_t srv, struct sockaddr *s, int *size)
{
int len;
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005, 2006,
2007 Free Software Foundation, Inc.
2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -103,11 +103,15 @@ static int unlock_kernel (mu_locker_t);
static int prelock_common (mu_locker_t);
static struct locker_tab locker_tab[] = {
/* MU_LOCKER_TYPE_DOTLOCK */
{ init_dotlock, destroy_dotlock, prelock_common,
lock_dotlock, unlock_dotlock },
/* MU_LOCKER_TYPE_EXTERNAL */
{ init_external, destroy_external, prelock_common,
lock_external, unlock_external },
/* MU_LOCKER_TYPE_KERNEL */
{ init_kernel, NULL, NULL, lock_kernel, unlock_kernel },
/* MU_LOCKER_TYPE_NULL */
{ NULL, NULL, NULL, NULL, NULL }
};
......@@ -246,17 +250,37 @@ mu_locker_set_default_external_program (char *path)
}
int
mu_locker_set_flags (mu_locker_t locker, int flags)
mu_locker_mod_flags (mu_locker_t locker, int flags,
enum mu_locker_set_mode mode)
{
unsigned otype, ntype;
int new_flags;
if (!locker)
return MU_ERR_LOCKER_NULL;
switch (mode)
{
case mu_locker_assign:
new_flags = flags;
break;
case mu_locker_set_bit:
new_flags = locker->flags | flags;
break;
case mu_locker_clear_bit:
new_flags = locker->flags & ~flags;
break;
default:
return EINVAL;
}
otype = MU_LOCKER_TYPE (locker);
if (otype >= MU_LOCKER_NTYPES)
return EINVAL;
ntype = MU_LOCKER_FLAG_TO_TYPE (flags);
ntype = MU_LOCKER_FLAG_TO_TYPE (new_flags);
if (ntype >= MU_LOCKER_NTYPES)
return EINVAL;
......@@ -266,22 +290,28 @@ mu_locker_set_flags (mu_locker_t locker, int flags)
if (locker_tab[otype].destroy)
locker_tab[otype].destroy (locker);
locker->flags = flags;
if (locker_tab[otype].init)
locker->flags = new_flags;
if (locker_tab[ntype].init)
{
rc = locker_tab[otype].init (locker);
rc = locker_tab[ntype].init (locker);
if (rc)
locker->flags = MU_LOCKER_NULL;
return rc;
}
}
else
locker->flags = flags;
locker->flags = new_flags;
return 0;
}
int
mu_locker_set_flags (mu_locker_t locker, int flags)
{
return mu_locker_mod_flags (locker, flags, mu_locker_assign);
}
int
mu_locker_set_expire_time (mu_locker_t locker, int etime)
{
if (!locker)
......
......@@ -15,6 +15,10 @@
Public License along with this library; If not, see
<http://www.gnu.org/licenses/>. */
/* This is an `m-server' - a universal framework for multi-process TCP
servers. An `m-' stands for `mail-', or `multi-' or maybe `meta-',
I don't remember what. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
......@@ -62,28 +66,52 @@ set_signal (int sig, mu_sig_handler_t handler)
struct _mu_m_server
{
char *ident;
mu_server_t server;
mu_list_t srvlist;
mu_m_server_conn_fp conn;
mu_m_server_prefork_fp prefork;
void *data;
int mode;
int foreground;
size_t max_children;
char *pidfile;
unsigned short defport;
time_t timeout;
mu_acl_t acl;
sigset_t sigmask;
mu_sig_handler_t sigtab[NSIG];
char *ident; /* Server identifier, for logging purposes.*/
int deftype; /* Default server type: MU_IP_TCP/MU_IP_UDP */
mu_server_t server; /* The server object. */
mu_list_t srvlist; /* A list of configured mu_ip_server_t
objects. It is cleared after the objects
are opened and attached to the server. */
mu_m_server_conn_fp conn; /* Connection handler function. */
mu_m_server_prefork_fp prefork;/* Pre-fork function. */
void *data; /* User-supplied data for conn and prefork. */
int mode; /* Server mode: should be removed. */
int foreground; /* Should the server remain in foregorund? */
size_t max_children; /* Maximum number of sub-processes to run. */
char *pidfile; /* Name of a PID-file. */
unsigned short defport; /* Default port number. */
time_t timeout; /* Default idle timeout. */
mu_acl_t acl; /* Global access control list. */
sigset_t sigmask; /* A set of signals to handle by the
m-server. */
mu_sig_handler_t sigtab[NSIG]; /* Keeps old signal handlers. */
};
struct m_srv_config /* Configuration data for a single TCP server. */
{
mu_m_server_t msrv; /* Parent m-server. */
mu_ip_server_t tcpsrv; /* TCP server these data are for. */
mu_acl_t acl; /* Access control list for this server. */
int single_process; /* Should it run as a single process? */
int transcript; /* Enable session transcript. */
time_t timeout; /* Idle timeout for this server. */
};
static int need_cleanup = 0;
static int stop = 0;
static size_t children;
void
mu_m_server_stop (int code)
{
stop = code;
}
static int
mu_m_server_idle (void *server_data MU_ARG_UNUSED)
{
......@@ -156,6 +184,7 @@ mu_m_server_create (mu_m_server_t *psrv, const char *ident)
exit (1);
}
}
srv->deftype = MU_IP_TCP;
MU_ASSERT (mu_server_create (&srv->server));
mu_server_set_idle (srv->server, mu_m_server_idle);
sigemptyset (&srv->sigmask);
......@@ -168,6 +197,18 @@ mu_m_server_create (mu_m_server_t *psrv, const char *ident)
}
void
mu_m_server_set_type (mu_m_server_t srv, int type)
{
srv->deftype = type;
}
void
mu_m_server_get_type (mu_m_server_t srv, int *type)
{
*type = srv->deftype;
}
void
mu_m_server_set_sigset (mu_m_server_t srv, sigset_t *sigset)
{
srv->sigmask = *sigset;
......@@ -242,16 +283,6 @@ mu_m_server_timeout (mu_m_server_t srv)
return srv->timeout;
}
struct m_srv_config
{
mu_m_server_t msrv;
mu_tcp_server_t tcpsrv;
mu_acl_t acl;
int single_process;
int transcript;
time_t timeout;
};
void
m_srv_config_free (void *data)
{
......@@ -262,16 +293,16 @@ m_srv_config_free (void *data)
static int m_srv_conn (int fd, struct sockaddr *sa, int salen,
void *server_data, void *call_data,
mu_tcp_server_t srv);
mu_ip_server_t srv);
static struct m_srv_config *
add_server (mu_m_server_t msrv, struct sockaddr *s, int slen)
add_server (mu_m_server_t msrv, struct sockaddr *s, int slen, int type)
{
mu_tcp_server_t tcpsrv;
mu_ip_server_t tcpsrv;
struct m_srv_config *pconf;
MU_ASSERT (mu_tcp_server_create (&tcpsrv, s, slen));
MU_ASSERT (mu_tcp_server_set_conn (tcpsrv, m_srv_conn));
MU_ASSERT (mu_ip_server_create (&tcpsrv, s, slen, type)); /* FIXME: type */
MU_ASSERT (mu_ip_server_set_conn (tcpsrv, m_srv_conn));
pconf = calloc (1, sizeof (*pconf));
if (!pconf)
{
......@@ -282,7 +313,7 @@ add_server (mu_m_server_t msrv, struct sockaddr *s, int slen)
pconf->tcpsrv = tcpsrv;
pconf->single_process = 0;
pconf->timeout = msrv->timeout;
MU_ASSERT (mu_tcp_server_set_data (tcpsrv, pconf, m_srv_config_free));
MU_ASSERT (mu_ip_server_set_data (tcpsrv, pconf, m_srv_config_free));
if (!msrv->srvlist)
MU_ASSERT (mu_list_create (&msrv->srvlist));
MU_ASSERT (mu_list_append (msrv->srvlist, tcpsrv));
......@@ -306,9 +337,10 @@ mu_m_server_begin (mu_m_server_t msrv)
{
/* Add default server */
struct sockaddr_in s;
s.sin_family = AF_INET;
s.sin_addr.s_addr = htonl (INADDR_ANY);
s.sin_port = htons (msrv->defport);
add_server (msrv, (struct sockaddr *)&s, sizeof s);
add_server (msrv, (struct sockaddr *)&s, sizeof s, msrv->deftype);
}
if (!msrv->foreground)
......@@ -363,11 +395,11 @@ mu_m_server_destroy (mu_m_server_t *pmsrv)
static int
tcp_conn_handler (int fd, void *conn_data, void *server_data)
{
mu_tcp_server_t tcpsrv = (mu_tcp_server_t) conn_data;
int rc = mu_tcp_server_accept (tcpsrv, server_data);
mu_ip_server_t tcpsrv = (mu_ip_server_t) conn_data;
int rc = mu_ip_server_accept (tcpsrv, server_data);
if (rc && rc != EINTR)
{
mu_tcp_server_shutdown (tcpsrv);
mu_ip_server_shutdown (tcpsrv);
return MU_SERVER_CLOSE_CONN;
}
return stop ? MU_SERVER_SHUTDOWN : MU_SERVER_SUCCESS;
......@@ -376,8 +408,8 @@ tcp_conn_handler (int fd, void *conn_data, void *server_data)
static void
tcp_conn_free (void *conn_data, void *server_data)
{
mu_tcp_server_t tcpsrv = (mu_tcp_server_t) conn_data;
mu_tcp_server_destroy (&tcpsrv);
mu_ip_server_t tcpsrv = (mu_ip_server_t) conn_data;
mu_ip_server_destroy (&tcpsrv);
}
static int
......@@ -391,29 +423,29 @@ _open_conn (void *item, void *data)
addr;
int addrlen = sizeof addr;
char *p;
mu_tcp_server_t tcpsrv = item;
mu_ip_server_t tcpsrv = item;
mu_m_server_t msrv = data;
int rc = mu_tcp_server_open (tcpsrv);
int rc = mu_ip_server_open (tcpsrv);
if (rc)
{
mu_tcp_server_get_sockaddr (tcpsrv, &addr.sa, &addrlen);
mu_ip_server_get_sockaddr (tcpsrv, &addr.sa, &addrlen);
p = mu_sockaddr_to_astr (&addr.sa, addrlen);
mu_error (_("Cannot open connection on %s: %s"), p, mu_strerror (rc));
free (p);
return 0;
}
rc = mu_server_add_connection (msrv->server,
mu_tcp_server_get_fd (tcpsrv),
mu_ip_server_get_fd (tcpsrv),
tcpsrv,
tcp_conn_handler, tcp_conn_free);
if (rc)
{
mu_tcp_server_get_sockaddr (tcpsrv, &addr.sa, &addrlen);
mu_ip_server_get_sockaddr (tcpsrv, &addr.sa, &addrlen);
p = mu_sockaddr_to_astr (&addr.sa, addrlen);
mu_error (_("Cannot add connection %s: %s"), p, mu_strerror (rc));
free (p);
mu_tcp_server_shutdown (tcpsrv);
mu_tcp_server_destroy (&tcpsrv);
mu_ip_server_shutdown (tcpsrv);
mu_ip_server_destroy (&tcpsrv);
}
return 0;
}
......@@ -443,8 +475,8 @@ mu_m_server_run (mu_m_server_t msrv)
static int
check_global_acl (mu_m_server_t msrv, struct sockaddr *s, int salen)
int
mu_m_server_check_acl (mu_m_server_t msrv, struct sockaddr *s, int salen)
{
if (msrv->acl)
{
......@@ -488,12 +520,12 @@ check_global_acl (mu_m_server_t msrv, struct sockaddr *s, int salen)
int
m_srv_conn (int fd, struct sockaddr *sa, int salen,
void *server_data, void *call_data,
mu_tcp_server_t srv)
mu_ip_server_t srv)
{
int status;
struct m_srv_config *pconf = server_data;
if (check_global_acl (pconf->msrv, sa, salen))
if (mu_m_server_check_acl (pconf->msrv, sa, salen))
return 0;
if (!pconf->single_process)
......@@ -509,7 +541,8 @@ m_srv_conn (int fd, struct sockaddr *sa, int salen,
pause ();
return 0;
}
if (pconf->msrv->prefork && pconf->msrv->prefork (fd, sa, salen))
if (pconf->msrv->prefork
&& pconf->msrv->prefork (fd, pconf->msrv->data, sa, salen))
return 0;
pid = fork ();
......@@ -517,8 +550,8 @@ m_srv_conn (int fd, struct sockaddr *sa, int salen,
mu_diag_output (MU_DIAG_ERROR, "fork: %s", strerror (errno));
else if (pid == 0) /* Child. */
{
mu_tcp_server_shutdown (srv);
status = pconf->msrv->conn (fd, pconf->msrv->data,
mu_ip_server_shutdown (srv); /* FIXME: does it harm for MU_IP_UDP? */
status = pconf->msrv->conn (fd, sa, salen, pconf->msrv->data, srv,
pconf->timeout, pconf->transcript);
closelog ();
exit (status);
......@@ -528,10 +561,10 @@ m_srv_conn (int fd, struct sockaddr *sa, int salen,
children++;
}
}
else
pconf->msrv->conn (fd, pconf->msrv->data,
else if (pconf->msrv->prefork
&& pconf->msrv->prefork (fd, pconf->msrv->data, sa, salen) == 0)
pconf->msrv->conn (fd, sa, salen, pconf->msrv->data, srv,
pconf->timeout, pconf->transcript);
return 0;
}
......@@ -718,7 +751,7 @@ server_block_begin (mu_debug_t debug, char *arg, mu_m_server_t msrv,
}
}
*pdata = add_server (msrv, &s.s_sa, salen);
*pdata = add_server (msrv, &s.s_sa, salen, msrv->deftype);
return 0;
}
......@@ -743,7 +776,7 @@ server_section_parser (enum mu_cfg_section_stage stage,
{
struct m_srv_config *pconf = *section_data;
if (pconf->acl)
mu_tcp_server_set_acl (pconf->tcpsrv, pconf->acl);
mu_ip_server_set_acl (pconf->tcpsrv, pconf->acl);
}
break;
}
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -201,8 +201,12 @@ mu_server_destroy (mu_server_t *psrv)
if (!srv)
return 0;
for (p = srv->head; p; p = p->next)
for (p = srv->head; p; )
{
struct _mu_connection *next = p->next;
destroy_connection (srv, p);
p = next;
}
if (srv->f_free)
srv->f_free (srv->server_data);
......
#
# List of source files containing translatable strings.
# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2008 Free Software Foundation, Inc.
#
auth/pam.c
......@@ -8,7 +8,7 @@ auth/sql.c
auth/tls.c
auth/virtual.c
comsat/action.c
comsat/cfg.c
comsat/oldcfg.c
comsat/comsat.c
config/mailutils-config.c
dotlock/dotlock.c
......@@ -107,6 +107,7 @@ mailbox/cfg_lexer.c
mailbox/errors
mailbox/file_stream.c
mailbox/filter_iconv.c
mailbox/ipsrv.c
mailbox/message.c
mailbox/mu_auth.c
mailbox/mutil.c
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 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
......@@ -30,7 +30,7 @@ pop3d_lock ()
mu_mailbox_get_url (mbox, &url);
name = mu_url_to_string (url);
mu_mailbox_get_locker (mbox, &lock);
mu_locker_set_flags (lock, MU_LOCKER_PID);
mu_locker_mod_flags (lock, MU_LOCKER_PID, mu_locker_set_bit);
if ((status = mu_locker_lock (lock)))
{
mu_diag_output (MU_DIAG_NOTICE, _("Locking mailbox `%s' failed: %s"),
......
......@@ -447,7 +447,8 @@ pop3d_mainloop (int fd, FILE *infile, FILE *outfile)
}
int
pop3d_connection (int fd, void *data, time_t timeout, int transcript)
pop3d_connection (int fd, struct sockaddr *sa, int salen, void *data,
mu_ip_server_t srv, time_t timeout, int transcript)
{
idle_timeout = timeout;
pop3d_transcript = transcript;
......