summaryrefslogtreecommitdiff
path: root/pop3d/pop3d.c
diff options
context:
space:
mode:
Diffstat (limited to 'pop3d/pop3d.c')
-rw-r--r--pop3d/pop3d.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c
index 254e7595c..1e110f4f5 100644
--- a/pop3d/pop3d.c
+++ b/pop3d/pop3d.c
@@ -1,5 +1,5 @@
/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2019 Free Software Foundation, Inc.
+ Copyright (C) 1999-2024 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
@@ -336,25 +336,27 @@ pop3d_mainloop (int ifd, int ofd, struct pop3d_srv_config *cfg)
/* FIXME: state should also be in the session? */
/* Prepare the shared secret for APOP. */
- {
- char *local_hostname;
+ if (apop_ok ())
+ {
+ char *local_hostname;
- status = mu_get_host_name (&local_hostname);
- if (status)
- {
- mu_diag_funcall (MU_DIAG_ERROR, "mu_get_host_name", NULL, status);
- exit (EXIT_FAILURE);
- }
-
- md5shared = mu_alloc (strlen (local_hostname) + 51);
+ status = mu_get_host_name (&local_hostname);
+ if (status)
+ {
+ mu_diag_funcall (MU_DIAG_ERROR, "mu_get_host_name", NULL, status);
+ exit (EXIT_FAILURE);
+ }
- snprintf (md5shared, strlen (local_hostname) + 50, "<%u.%u@%s>", getpid (),
- (unsigned)time (NULL), local_hostname);
- free (local_hostname);
- }
+ md5shared = mu_alloc (strlen (local_hostname) + 51);
- /* Lets boogie. */
- pop3d_outf ("+OK POP3 Ready %s\n", md5shared);
+ snprintf (md5shared, strlen (local_hostname) + 50, "<%u.%u@%s>",
+ getpid (),
+ (unsigned)time (NULL), local_hostname);
+ free (local_hostname);
+ pop3d_outf ("+OK POP3 Ready %s\n", md5shared);
+ }
+ else
+ pop3d_outf ("+OK POP3 Ready\n");
while (state != UPDATE && state != ABORT)
{
@@ -403,12 +405,7 @@ pop3d_connection (int fd, struct sockaddr *sa, int salen,
struct mu_srv_config *pconf,
void *data)
{
- struct pop3d_srv_config *cfg = (struct pop3d_srv_config *) pconf;
-
- idle_timeout = cfg->m_cfg.timeout;
- pop3d_transcript = cfg->m_cfg.transcript;
-
- pop3d_mainloop (fd, fd, cfg);
+ pop3d_mainloop (fd, fd, (struct pop3d_srv_config *) pconf);
return 0;
}
@@ -428,6 +425,13 @@ set_dbm_safety ()
}
#endif
+static void
+pop3d_config_default (struct mu_srv_config *mcfg, void *data)
+{
+ mcfg->timeout = idle_timeout;
+ mcfg->transcript = pop3d_transcript;
+}
+
int
main (int argc, char **argv)
{
@@ -451,10 +455,11 @@ main (int argc, char **argv)
mu_m_server_set_config_size (server, sizeof (struct pop3d_srv_config));
mu_m_server_set_conn (server, pop3d_connection);
mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork);
+ mu_m_server_set_config_default (server, pop3d_config_default);
mu_m_server_set_mode (server, MODE_INTERACTIVE);
mu_m_server_set_max_children (server, 20);
/* FIXME mu_m_server_set_pidfile (); */
- mu_m_server_set_default_port (server, 110);
+ mu_m_server_set_default_port (server, PORT_POP3);
mu_m_server_set_timeout (server, 600);
mu_m_server_set_strexit (server, mu_strexit);
mu_m_server_cfg_init (server, pop3d_srv_param);
@@ -537,6 +542,8 @@ main (int argc, char **argv)
struct pop3d_srv_config cfg;
memset (&cfg, 0, sizeof cfg);
+ idle_timeout = mu_m_server_timeout (server);
+
switch (stls_server_check (&cfg, "<inetd>"))
{
case MU_TLS_CONFIG_OK:

Return to:

Send suggestions and report system problems to the System administrator.