/* $Id: dbmail.h 2017 2006-03-07 05:58:02Z aaron $ Copyright (C) 1999-2004 IC & S dbmail@ic-s.nl 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /** * \file dbmail.h * header file for a general configuration */ #ifndef _DBMAIL_H #define _DBMAIL_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef __FreeBSD__ #define _XOPEN_SOURCE #else #define _XOPEN_SOURCE 500 #endif #define __EXTENSIONS__ /* solaris */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef AUTHLDAP #define LDAP_DEPRECATED 1 #include #endif #include "list.h" #include "memblock.h" #include "dbmailtypes.h" #include "debug.h" #include "dsn.h" #include "acl.h" #include "misc.h" #include "pipe.h" #include "db.h" #include "auth.h" #include "sort.h" #include "imap4.h" #include "imapcommands.h" #include "server.h" #include "serverchild.h" #include "serverparent.h" #include "pool.h" #include "pop3.h" #include "quota.h" #include "lmtp.h" #include "dbmodule.h" #include "authmodule.h" #include "sortmodule.h" #include "dm_md5.h" #include "dm_cidr.h" #include "dm_imaputil.h" #include "dm_base64.h" #include "dm_getopt.h" #include "dm_match.h" #ifdef SIEVE #include #include #endif #include "timsieve.h" #ifdef HAVE_CRYPT_H #include #endif #ifdef HAVE_ENDIAN_H #include #endif #include "dbmail-message.h" #include "dbmail-user.h" #include "dbmail-mailbox.h" #include "dbmail-imapsession.h" #define GETCONFIGVALUE(key, sect, var) \ config_get_value(key, sect, var); \ if (strlen(var) > 0) \ TRACE(TRACE_DEBUG, "key "#key" section "#sect" var "#var" value [%s]", var) /* No final ';' so macro can be called "like a function" */ #define CONFIG_ERROR_LEVEL TRACE_WARNING #define PRINTF_THIS_IS_DBMAIL printf("This is DBMail version %s\n\n%s\n", DBMAIL_VERSION, COPYRIGHT) #define COPYRIGHT \ "Copyright (C) 1999-2004 IC & S, dbmail@ic-s.nl\n" \ "Copyright (C) 2001-2007 Aaron Stone, aaron@serendipity.cx\n" \ "Copyright (C) 2004-2007 NFG Net Facilities Group BV, support@nfg.nl\n" \ "\n" \ "Please see the AUTHORS and THANKS files for additional contributors.\n" \ "\n" \ "This program is free software; you can redistribute it and/or \n" \ "modify it under the terms of the GNU General Public License as\n" \ "published by the Free Software Foundation; either version 2 of\n" \ "the License, or (at your option) any later version.\n" \ "\n" \ "This program is distributed in the hope that it will be useful,\n" \ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \ "GNU General Public License for more details.\n" \ "\n" \ "You should have received a copy of the GNU General Public License\n" \ "along with this program; if not, write to the Free Software\n" \ "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n" \ "" /* include sql/sqlite/create_tables.sqlite for autocreation */ #define DM_SQLITECREATE \ @SQLITECREATE@ "" /** default directory and extension for pidfiles */ #define DEFAULT_PID_DIR "@DM_STATEDIR@" #define DEFAULT_PID_EXT ".pid" #define DEFAULT_STATE_DIR "@DM_STATEDIR@" #define DEFAULT_STATE_EXT ".state" /** default location of library files */ #define DEFAULT_LIBRARY_DIR "@DM_PKGLIBDIR@" /** default configuration file */ #define DEFAULT_CONFIG_FILE "@DM_CONFDIR@/dbmail.conf" /** default log files */ #define DEFAULT_LOG_FILE "@DM_LOGDIR@/dbmail.log" #define DEFAULT_ERROR_LOG "@DM_LOGDIR@/dbmail.err" /** prefix for #Users namespace */ #define NAMESPACE_USER "#Users" /** prefix for public namespace */ #define NAMESPACE_PUBLIC "#Public" /** seperator for namespaces and mailboxes and submailboxes */ #define MAILBOX_SEPARATOR "/" /** username for owner of public folders */ // FIXME: Should be #define PUBLIC_FOLDER_USER "__@!internal_public_user!@__" #define PUBLIC_FOLDER_USER "__public__" /* name of internal delivery user. */ #define DBMAIL_DELIVERY_USERNAME "__@!internal_delivery_user!@__" /* standard user for ACL anyone (see RFC 2086 and 4314) */ #define DBMAIL_ACL_ANYONE_USER "anyone" /* Consumers of this should be using POSTMASTER from dbmail.conf! */ #define DEFAULT_POSTMASTER "DBMAIL-MAILER@dbmail" #define AUTO_NOTIFY_SENDER "autonotify@dbmail" #define AUTO_NOTIFY_SUBJECT "NEW MAIL NOTIFICATION" /* input reading linelimit */ #define MAX_LINESIZE (65*1024) /* string length for query */ #define DEF_QUERYSIZE 1024 #define DEF_FRAGSIZE 64 /** default table prefix */ #define DEFAULT_DBPFX "dbmail_" #define MATCH(x,y) strcasecmp((x),(y))==0 #define min(x,y) ((x)<=(y)?(x):(y)) #define max(x,y) ((x)>=(y)?(x):(y)) /** * \brief read configuration from filename * \param cfilename name of configuration file * \return * - -1 on error * - 0 on success */ int config_read(const char *config_filename); /** * free all memory taken up by config. */ void config_free(void); /** * \brief get configuration value for an item * \param name name of configuration item * \param service_name name of service * \param value value of configuration item name * \return 0 * \attention value is set to a string beginning with a '\\0' * if no configuration item with name is found in items. */ int config_get_value(const field_t name, const char *service_name, /*@out@*/ field_t value); /* some common used functions reading config options */ /** \brief get parameters for database connection \param db_params list of database parameters (db_param_t) */ void GetDBParams(db_param_t * db_params); /** \brief set the overall trace level, using the value in cfg_items \param service_name name of service to get trace level for. \attention trace level is set to TRACE_ERROR if no trace level value is found * for service. */ void SetTraceLevel(const char *service_name); void pidfile_create(const char *pidFile, pid_t pid); void config_get_logfiles(serverConfig_t *config); char * config_get_pidfile(serverConfig_t *config, const char *name); char * config_get_statefile(serverConfig_t *config, const char *name); #endif