/*****************************************************************************

  POPular -- A POP3 server and proxy for large mail systems

  $Id: pconfig.h,v 1.37 2002/11/28 13:56:03 sqrt Exp $

  http://www.remote.org/jochen/mail/popular/

******************************************************************************

  Copyright (C) 1999-2002  Jochen Topf <jochen@remote.org>

  This program 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 2 of the License, or
  (at your option) any later version.

  This program 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, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA

*****************************************************************************/

/* max number of mailcheck requests before giving up */
#define MAILCHECK_MAX_REQUESTS 3

/* for pdeliver: store size of mail in file name, so we don't need stat() */
#define STORE_MAIL_SIZE_IN_NAME

/* shared memory version number */
#define SHMEM_VERSION 3

/* Max length used for some buffers */
#define MAXBUF 1024

/* Max number of arguments for pcontrol commands and pdm loading */
#define MAXARGS 30

/* Directory where all the mailboxes reside */
#define POPDIR "/pop"

/* Mode for creating mailboxes */
#define MAILDIRMODE 0755

/* Mode for creating mail files */
#define MAILFILEMODE 0644

/* This is the list of ports on which pproxy is allowed to listen on.
   Format must be numbers separated by commas. */
#define ALLOWED_PORTS 110, 111, 112, 113, 995, 996

/* This is the list of capabilities that will be sent to the client if the
   DEFAULT list is chosen for a virtual server. This must be a list of
   valid capabilities separated by CRLF */
#define DEFAULT_CAPA_LIST "TOP\r\nUSER\r\nUIDL\r\nPIPELINING\r\n"

/* maximum number of pcheckd children */
#define MAX_PCHECKD_CHILDREN 20

/* maximum number if bad commands in pop3 auth phase. if more bad commands
 * are received, the connection is dropped */
#define MAX_BAD_COMMANDS 5

/* maximum length of file and directory names */
#define MAX_FILE_LEN 254


/*****************************************************************************

  These are the max numbers of virtual servers, backends and sessions.
  These are not run time configurable, because they are stored in the shared
  memory and its size would change if these numbers change, which would
  confuse other processes attached to this memory.

*****************************************************************************/
#define MAX_VIRT_SERV   32
#define MAX_BACKEND     32
#define MAX_SESSION   1024


/*****************************************************************************

  These are the maximal lengths for some things. Static buffers of this
  length + 1 are used, so that there is enough space for the trailing \0.

*****************************************************************************/

/* POP username */
#define MAXLEN_USERNAME 80

/* POP password */
#define MAXLEN_PASSWORD 80

/* for all sorts of id's: virtual server, backend, namespace, etc. */
#define MAXLEN_ID 32

/* mailbox name, could be a long name with several (sub)directories */
#define MAXLEN_MAILBOX 80

/* POP protocol greeting banner */
#define MAXLEN_BANNER 80

/* popcheck packet */
#define MAXLEN_MAILCHECK 512

/* popcheck directory name */
#define MAXLEN_DIRNAME 512

/* id for logging */
#define MAXLEN_SESSION_ID 64

/* flags for XPOP */
#define MAXLEN_FLAGS 4

/* mail file. includes 4 bytes for "new/" or "cur/" */
#define MAXLEN_MAILFILE 256

/* max length of capability description */
#define MAXLEN_CAPA 1024

/* max length of library name for database modules (with directory) */
#define MAXLEN_SONAME 512


/*****************************************************************************
*****************************************************************************/

#define LOG_DIR "/var/log/popular"
#define RUN_DIR "/var/run/popular"


#define PCHECKD_PRG_NAME    "pcheckd"
#define PCHECKD_LOG_FILE    LOG_DIR "/" PCHECKD_PRG_NAME
#define PCHECKD_LOG_MODE    0644
#define PCHECKD_PID_FILE    PCHECKD_PRG_NAME ".pid"
#define PCHECKD_PID_TEMPL   PCHECKD_PRG_NAME ".%d.pid"

#define PPROXY_PRG_NAME     "pproxy"
#define PPROXY_LOG_FILE     LOG_DIR "/" PPROXY_PRG_NAME
#define PPROXY_LOG_MODE     0644
#define PPROXY_SOCK_FILE    PPROXY_PRG_NAME ".ctrl"
#define PPROXY_SOCK_TEMPL   PPROXY_PRG_NAME ".%d.ctrl"
#define PPROXY_SOCK_UMASK   0117
#define PPROXY_STATE_FILE   PPROXY_PRG_NAME ".state"
#define PPROXY_STATE_TEMPL  PPROXY_PRG_NAME ".%d.state"
#define PPROXY_PID_FILE     PPROXY_PRG_NAME ".pid"
#define PPROXY_PID_TEMPL    PPROXY_PRG_NAME ".%d.pid"
#define PPROXY_CAPA_DIR     CONF_DIR "/capa"
#define PPROXY_TLS_DIR      CONF_DIR "/tls"
#define PPROXY_PDM_DIR      INSTALL_PREFIX "/lib/popular"

#define PSERV_PRG_NAME      "pserv"
#define PSERV_LOG_FILE      LOG_DIR "/" PSERV_PRG_NAME
#define PSERV_LOG_MODE      0644
#define PSERV_SOCK_FILE     PSERV_PRG_NAME ".ctrl"
#define PSERV_SOCK_TEMPL    PSERV_PRG_NAME ".%d.ctrl"
#define PSERV_SOCK_UMASK    0117
#define PSERV_STATE_FILE    PSERV_PRG_NAME ".state"
#define PSERV_STATE_TEMPL   PSERV_PRG_NAME ".%d.state"
#define PSERV_PID_FILE      PSERV_PRG_NAME ".pid"
#define PSERV_PID_TEMPL     PSERV_PRG_NAME ".%d.pid"
#define PSERV_MAX_FILE      PSERV_PRG_NAME ".maxsession"
#define PSERV_POP_DIR       "/pop"
#define PSERV_CAPA_DIR      CONF_DIR "/capa"

#define PDELIVER_PRG_NAME   "pdeliver"
#define PDELIVER_LOG_FILE   LOG_DIR "/" PDELIVER_PRG_NAME
#define PDELIVER_LOG_MODE   0644

#define PCONTROL_PRG_NAME   "pcontrol"
#define PCONTROL_SOCK_FILE  PCONTROL_PRG_NAME ".%d.ctrl"
#define PCONTROL_SOCK_UMASK 0117

#define PTESTPDM_PRG_NAME   "ptestpdm"


/*****************************************************************************

  Misc defaults.

*****************************************************************************/
#define DEFAULT_MAX_SESSION 2	   /* default max sessions for pproxy/pserv*/
#define DEFAULT_LISTEN_BACKLOG 32  /* backlog parameter for listen(2) */

/* Timeout (in seconds) waiting for UDP packet when checking mailbox */
#define DEFAULT_TIMEOUT_CHECK 3

/* default timeout for idle sessions */
#define DEFAULT_TIMEOUT_IDLE 60*20

/* default timeout for authentication phase */
#define DEFAULT_TIMEOUT_AUTH 60*5

/* default timeout for session (minus authentication phase for pproxy */
#define DEFAULT_TIMEOUT_SESSION 60*60*6

/* default timeout for pproxying */
#define DEFAULT_TIMEOUT_PROXY 60*60*6


/*****************************************************************************

  Some defaults for UDP and TCP ports.

*****************************************************************************/
#define DEFAULT_PORT_CHECK   50110	/* UDP port to access pcheckd */
#define DEFAULT_PORT_POP3      110	/* official pop3/tcp port */
#define DEFAULT_PORT_IMAP4     143	/* official imap/tcp port */
#define DEFAULT_PORT_XPOP    50110	/* TCP port to access pserv backend */
#define DEFAULT_PORT_POP3TLS   995	/* official pop3s/tcp port */
#define DEFAULT_PORT_IMAP4TLS  993	/* official imaps/tcp port */


/*****************************************************************************

  Exit codes for all commands.

*****************************************************************************/
#define RCODE_OK       0        /* ok */
				/* pcheck: no mails available */
#define RCODE_NO_MAILS 1     	/* pcheck: mails available */
#define RCODE_QUOTA    1        /* pdeliver: quota exceeded */
#define RCODE_ERR      2        /* error */
#define RCODE_CERR     3        /* pcontrol: client error */
#define RCODE_CMDLINE  6        /* command line error */
#define RCODE_INTERNAL 9        /* internal error (should never happen) */


/*****************************************************************************

  File name and number of bytes used for seeding the PRNG (pseudo random
  number generator) for SSL/TLS use. If this is not defined, the PRNG will
  not be seeded! This is insecure! You have been warned! Use /dev/random
  here for maximum security (but it might have a longer startup time if
  not enough entropy is available). Use /dev/urandom for some security
  and fast startup times. You can also use a normal file if you have some
  other means of putting random bytes in there.

*****************************************************************************/
#ifdef USE_TLS
# define DEFAULT_RANDOM_BYTES 1024
#endif


/** THE END *****************************************************************/


syntax highlighted by Code2HTML, v. 0.9.1