srand(seed);
srandom(seed);
- syslog(LOG_INFO, "Initializing ipgm secret\n");
- config.c_ipgm_secret = rand();
put_config();
syslog(LOG_DEBUG, "master_startup() finished\n");
}
-/*
- * Perform privilege escalation for an internal program
- */
-void cmd_ipgm(char *argbuf)
-{
- int secret;
-
- secret = extract_int(argbuf, 0);
-
- /* For security reasons, we do NOT allow this command to run
- * over the network. Local sockets only.
- */
- if (!CC->is_local_socket) {
- sleep(5);
- cprintf("%d Authentication failed.\n", ERROR + PASSWORD_REQUIRED);
- }
- else if (secret == config.c_ipgm_secret) {
- CC->internal_pgm = 1;
- strcpy(CC->curr_user, "<internal program>");
- CC->cs_flags = CC->cs_flags|CS_STEALTH;
- cprintf("%d Authenticated as an internal program.\n", CIT_OK);
- }
- else {
- sleep(5);
- cprintf("%d Authentication failed.\n", ERROR + PASSWORD_REQUIRED);
- syslog(LOG_ERR, "Warning: ipgm authentication failed.\n");
- CC->kill_me = KILLME_AUTHFAILED;
- }
-}
-
/*
* Shut down the server
CtdlRegisterProtoHook(cmd_echo, "ECHO", "echo text back to the client");
CtdlRegisterProtoHook(cmd_more, "MORE", "fetch the paginator prompt");
CtdlRegisterProtoHook(cmd_iden, "IDEN", "identify the client software and location");
- CtdlRegisterProtoHook(cmd_ipgm, "IPGM", "perform privilege escalation for internal programs");
CtdlRegisterProtoHook(cmd_term, "TERM", "terminate another running session");
CtdlRegisterProtoHook(cmd_down, "DOWN", "perform a server shutdown");
CtdlRegisterProtoHook(cmd_halt, "HALT", "halt the server without exiting the server process");
* Store a piece of data. Returns 0 if the operation was successful. If a
* key already exists it should be overwritten.
*/
-int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
+int cdb_store(int cdb, void *ckey, int ckeylen, void *cdata, int cdatalen)
{
DBT dkey, ddata;
* a struct cdbdata which it is the caller's responsibility to free later on
* using the cdb_free() routine.
*/
-struct cdbdata *cdb_fetch(int cdb, const void *key, int keylen)
+struct cdbdata *cdb_fetch(int cdb, void *key, int keylen)
{
struct cdbdata *tempcdb;
void open_databases (void);
void close_databases (void);
-int cdb_store (int cdb, const void *key, int keylen, void *data, int datalen);
+int cdb_store (int cdb, void *key, int keylen, void *data, int datalen);
int cdb_delete (int cdb, void *key, int keylen);
-struct cdbdata *cdb_fetch (int cdb, const void *key, int keylen);
+struct cdbdata *cdb_fetch (int cdb, void *key, int keylen);
void cdb_free (struct cdbdata *cdb);
void cdb_rewind (int cdb);
struct cdbdata *cdb_next_item (int cdb);
* API declarations from serv_extensions.h
*/
void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name);
+
/*
- * Global system configuration. Don't change anything here. It's all in dtds/config-defs.h now.
+ * Global system configuration
*/
struct config {
-#include "datadefinitions.h"
-#include "dtds/config-defs.h"
-#include "undef_data.h"
+ char c_nodename[16]; /* short name of this node on a Citadel network */
+ char c_fqdn[64]; /* this site's fully qualified domain name */
+ char c_humannode[21]; /* human-readable site name */
+ char c_phonenum[16]; /* telephone number */
+ uid_t c_ctdluid; /* uid of posix account under which Citadel will run */
+ char c_creataide; /* 1 = creating a room auto-grants room aide privileges */
+ int c_sleeping; /* watchdog timer (seconds) */
+ char c_initax; /* initial access level for new users */
+ char c_regiscall; /* after c_regiscall logins user will be asked to register */
+ char c_twitdetect; /* automatically move messages from problem users to trashcan */
+ char c_twitroom[ROOMNAMELEN]; /* name of trashcan */
+ char c_moreprompt[80]; /* paginator prompt */
+ char c_restrict; /* require per-user permission to send Internet mail */
+ long c_niu_1;
+ char c_site_location[32]; /* geographic location of this Citadel site */
+ char c_sysadm[26]; /* name of system administrator */
+ char c_niu_2[15];
+ int c_niu_3;
+ int c_maxsessions; /* maximum number of concurrent sessions allowed */
+ char c_ip_addr[20]; /* bind address for listening sockets */
+ int c_port_number; /* port number for Citadel protocol (usually 504) */
+ int c_niu_4;
+ struct ExpirePolicy c_ep; /* default expire policy for the entire site */
+ int c_userpurge; /* user purge time (in days) */
+ int c_roompurge; /* room purge time (in days) */
+ char c_logpages[ROOMNAMELEN];
+ char c_createax;
+ long c_maxmsglen;
+ int c_min_workers;
+ int c_max_workers;
+ int c_pop3_port;
+ int c_smtp_port;
+ int c_rfc822_strict_from;
+ int c_aide_zap;
+ int c_imap_port;
+ time_t c_net_freq;
+ char c_disable_newu;
+ char c_enable_fulltext;
+ char c_baseroom[ROOMNAMELEN];
+ char c_aideroom[ROOMNAMELEN];
+ int c_purge_hour;
+ struct ExpirePolicy c_mbxep;
+ char c_ldap_host[128];
+ int c_ldap_port;
+ char c_ldap_base_dn[256];
+ char c_ldap_bind_dn[256];
+ char c_ldap_bind_pw[256];
+ int c_msa_port;
+ int c_imaps_port;
+ int c_pop3s_port;
+ int c_smtps_port;
+ char c_auto_cull;
+ char c_instant_expunge;
+ char c_allow_spoofing;
+ char c_journal_email;
+ char c_journal_pubmsgs;
+ char c_journal_dest[128];
+ char c_default_cal_zone[128];
+ int c_pftcpdict_port;
+ int c_managesieve_port;
+ int c_auth_mode;
+ char c_funambol_host[256];
+ int c_funambol_port;
+ char c_funambol_source[256];
+ char c_funambol_auth[256];
+ char c_rbl_at_greeting;
+ char c_master_user[32];
+ char c_master_pass[32];
+ char c_pager_program[256];
+ char c_imap_keep_from;
+ int c_xmpp_c2s_port;
+ int c_xmpp_s2s_port;
+ time_t c_pop3_fetch;
+ time_t c_pop3_fastest;
+ int c_spam_flag_only;
+ int c_guest_logins;
};
extern struct config config;
+++ /dev/null
-/*
- * this file contains the defines that convert our x-macros to datatypes
- */
-#define CFG_VALUE(a,b) a
-#define SUBSTRUCT(a) a
-#define SUBSTRUCT_ELEMENT(a)
-#define PROTOCOL_ONLY(a)
-#define SERVER_PRIVATE(a) a
-#define NO_ARTV(a) a
-
-#define LONG(a) long a
-#define UNSIGNED(a) unsigned a
-#define UNSIGNED_INT(a) unsigned int a
-#define INTEGER(a) int a
-
-#define UNSIGNED_SHORT(a) unsigned short a
-#define UINT8(a) cit_uint8_t a
-#define CHAR(a) char a
-
-#define TIME(a) time_t a
-#define UID_T(a) uid_t a
-
-#define STRING_BUF(a, b) char a[b]
-#define STRING(a) char *a
+++ /dev/null
-/*
- * Global system configuration.
- *
- * Developers: please do NOT remove the fields labelled "not in use". We
- * can't simply remove them from the struct, because this gets written to
- * disk, and if you change it then you'll break all existing systems.
- * However, if you'd like to reclaim some of that space for another use, feel
- * free to do so, as long as the sizes are kept identical.
- */
-
-CFG_VALUE(STRING_BUF(c_nodename, 16), " Unqualified \"short\" nodename ");
-CFG_VALUE(STRING_BUF(c_fqdn, 64), " Fully Qualified Domain Name ");
-CFG_VALUE(STRING_BUF(c_humannode, 21), " long name of system ");
-CFG_VALUE(STRING_BUF(c_phonenum, 16), " Dialup number of system ");
-CFG_VALUE(UID_T(c_ctdluid), " UID under which we run Citadel ");
-CFG_VALUE(CHAR(c_creataide), " room creator = room aide flag ");
-CFG_VALUE(INTEGER(c_sleeping), " watchdog timer setting ");
-CFG_VALUE(CHAR(c_initax), " initial access level ");
-CFG_VALUE(CHAR(c_regiscall), " call number to register on ");
-CFG_VALUE(CHAR(c_twitdetect), " twit detect flag ");
-CFG_VALUE(STRING_BUF(c_twitroom, ROOMNAMELEN), " twit detect msg move to room ");
-CFG_VALUE(STRING_BUF(c_moreprompt, 80), " paginator prompt ");
-CFG_VALUE(CHAR(c_restrict), " restrict internet mail flag ");
-NO_ARTV(CFG_VALUE(LONG(c_niu_1), " (not in use) "));
-CFG_VALUE(STRING_BUF(c_site_location, 32), " physical location of server ");
-CFG_VALUE(STRING_BUF(c_sysadm, 26), " name of system administrator ");
-NO_ARTV(CFG_VALUE(STRING_BUF(c_niu_2, 15), " (not in use) "));
-CFG_VALUE(INTEGER(c_setup_level), " (not in use) ");
-CFG_VALUE(INTEGER(c_maxsessions), " maximum concurrent sessions ");
-/* c_ip_addr is out of sortorder; its located after c_ldap_bind_pw in the old export */
-CFG_VALUE(STRING_BUF(c_ip_addr, 20), " IP address to listen on ");
-CFG_VALUE(INTEGER(c_port_number), " Cit listener port (usually 504) ");
-NO_ARTV(CFG_VALUE(INTEGER(c_ipgm_secret), " internal program authentication "));
-CFG_VALUE(SUBSTRUCT(struct ExpirePolicy c_ep), " System default msg expire policy ");
-SUBSTRUCT_ELEMENT(INTEGER(c_ep.expire_mode);)
-SUBSTRUCT_ELEMENT(INTEGER(c_ep.expire_value);)
-CFG_VALUE(INTEGER(c_userpurge), " System default user purge (days) ");
-CFG_VALUE(INTEGER(c_roompurge), " System default room purge (days) ");
-CFG_VALUE(STRING_BUF(c_logpages, ROOMNAMELEN), " Room to log pages to (or not) ");
-CFG_VALUE(CHAR(c_createax), " Axlevel required to create rooms ");
-CFG_VALUE(LONG(c_maxmsglen), " Maximum message length ");
-CFG_VALUE(INTEGER(c_min_workers), " Lower limit on number of threads ");
-CFG_VALUE(INTEGER(c_max_workers), " Upper limit on number of threads ");
-CFG_VALUE(INTEGER(c_pop3_port), " POP3 listener port (usually 110) ");
-CFG_VALUE(INTEGER(c_smtp_port), " SMTP listener port (usually 25) ");
-////purge_hour? mbxexp? ldap_host? ldap_port?
-CFG_VALUE(INTEGER(c_rfc822_strict_from), " 1 = don't correct From: forgeries");
-CFG_VALUE(INTEGER(c_aide_zap), " Are Aides allowed to zap rooms? ");
-CFG_VALUE(INTEGER(c_imap_port), " IMAP listener port (usually 143) ");
-CFG_VALUE(TIME(c_net_freq), " how often to run the networker ");
-CFG_VALUE(CHAR(c_disable_newu), " disable NEWU command ");
-CFG_VALUE(CHAR(c_enable_fulltext), " enable full text indexing ");
-CFG_VALUE(STRING_BUF(c_baseroom, ROOMNAMELEN), " Name of baseroom (Lobby) ");
-CFG_VALUE(STRING_BUF(c_aideroom, ROOMNAMELEN), " Name of aideroom (Aide) ");
-CFG_VALUE(INTEGER(c_purge_hour), " Hour during which db purges run ");
-CFG_VALUE(SUBSTRUCT(struct ExpirePolicy c_mbxep), " Expire policy for mailbox rooms ");
-SUBSTRUCT_ELEMENT(INTEGER(c_mbxep.expire_mode);)
-SUBSTRUCT_ELEMENT(INTEGER(c_mbxep.expire_value);)
-CFG_VALUE(STRING_BUF(c_ldap_host, 128), " Host where LDAP service lives ");
-CFG_VALUE(INTEGER(c_ldap_port), " Port on host where LDAP lives ");
-CFG_VALUE(STRING_BUF(c_ldap_base_dn, 256), " LDAP base DN ");
-CFG_VALUE(STRING_BUF(c_ldap_bind_dn, 256), " LDAP bind DN ");
-CFG_VALUE(STRING_BUF(c_ldap_bind_pw, 256), " LDAP bind password ");
-CFG_VALUE(INTEGER(c_msa_port), " SMTP MSA listener port (usu 587) ");
-CFG_VALUE(INTEGER(c_imaps_port), " IMAPS listener port (usually 993)");
-CFG_VALUE(INTEGER(c_pop3s_port), " POP3S listener port (usually 995)");
-CFG_VALUE(INTEGER(c_smtps_port), " SMTPS listener port (usually 465)");
-CFG_VALUE(CHAR(c_auto_cull), " Cull db logs automatically? ");
-CFG_VALUE(CHAR(c_instant_expunge), " IMAP instant expunge deleted msgs");
-CFG_VALUE(CHAR(c_allow_spoofing), " SMTP allow spoofing of my domains");
-CFG_VALUE(CHAR(c_journal_email), " Perform journaling of email ");
-CFG_VALUE(CHAR(c_journal_pubmsgs), " Perform journaling of non-email ");
-CFG_VALUE(STRING_BUF(c_journal_dest, 128), " Where to send journalized msgs ");
-CFG_VALUE(STRING_BUF(c_default_cal_zone, 128), " Default calendar time zone ");
-CFG_VALUE(INTEGER(c_pftcpdict_port), " postfix tcptable support, see http://www.postfix.org/tcp_table.5.html ");
-CFG_VALUE(INTEGER(c_managesieve_port), " managesieve port. ");
-CFG_VALUE(INTEGER(c_auth_mode), " 0 = built-in Citadel auth), 1 = underlying host system auth ");
-CFG_VALUE(STRING_BUF(c_funambol_host, 256), " Funambol host. Blank to disable ");
-CFG_VALUE(INTEGER(c_funambol_port), " Funambol port ");
-CFG_VALUE(STRING_BUF(c_funambol_source, 256), " Funambol sync source ");
-CFG_VALUE(STRING_BUF(c_funambol_auth, 256), " Funambol auth details ");
-CFG_VALUE(CHAR(c_rbl_at_greeting), " Check RBL's at connect instead of after RCPT ");
-CFG_VALUE(STRING_BUF(c_master_user, 32), " Master user name ");
-CFG_VALUE(STRING_BUF(c_master_pass, 32), " Master user password ");
-CFG_VALUE(STRING_BUF(c_pager_program, 256), " External pager program (blank to disable)");
-CFG_VALUE(CHAR(c_imap_keep_from), " IMAP keep original from header in msgs");
-CFG_VALUE(INTEGER(c_xmpp_c2s_port), " XMPP client-to-server port (usually 5222)");
-CFG_VALUE(INTEGER(c_xmpp_s2s_port), " XMPP server-to-server port (usually 5269)");
-CFG_VALUE(TIME(c_pop3_fetch), " How often to fetch POP3 messages");
-CFG_VALUE(TIME(c_pop3_fastest), " Users can specify POP3 fetching this often");
-CFG_VALUE(INTEGER(c_spam_flag_only), " 1 = flag instead of reject spam");
-CFG_VALUE(INTEGER(c_guest_logins), " 1 = enable anonymous guest logins");
+++ /dev/null
-INTEGER(expire_mode);
-INTEGER(expire_value);
+++ /dev/null
-/**
- * this file contains the definitions for the floors transmitted via the citadel protocol.
- */
-
-SERVER_PRIVATE(UNSIGNED_SHORT(f_flags)); /* flags */
-PROTOCOL_ONLY(INTEGER(id)); /* the floor id. its implicit in its location in the file, but here once more for the protocol. */
-STRING_BUF(f_name, 256); /* our name. */
-INTEGER(f_ref_count); /* how many sub elements do we contain? */
-
-SUBSTRUCT(struct ExpirePolicy f_ep); /* Message expiration policy */
-SUBSTRUCT_ELEMENT(INTEGER(f_ep.expire_mode));
-SUBSTRUCT_ELEMENT(INTEGER(f_ep.expire_value));
+++ /dev/null
-SERVER_PRIVATE(struct march *next);
-STRING_BUF(march_name, ROOMNAMELEN);
-UNSIGNED_INT(march_flags); /// todo: this was unsigned int; is this the same as uint?
-CHAR(march_floor);
-CHAR(march_order);
-UNSIGNED_INT(march_flags2);
-INTEGER(march_access);
+++ /dev/null
-/*
- * Room records.
- */
-
-STRING_BUF(QRname,ROOMNAMELEN); /* Name of room */
-STRING_BUF(QRpasswd,10); /* Only valid if it's a private rm */
-LONG(QRroomaide); /* User number of room aide */
-LONG(QRhighest); /* Highest message NUMBER in room */
-TIME(QRgen); /* Generation number of room */
-UNSIGNED(QRflags); /* See flag values below */
-STRING_BUF(QRdirname,15); /* Directory name, if applicable */
-LONG(QRinfo); /* Info file update relative to msgs*/
-CHAR(QRfloor); /* Which floor this room is on */
-TIME(QRmtime); /* Date/time of last post */
-SUBSTRUCT(struct ExpirePolicy QRep); /* Message expiration policy */
-SUBSTRUCT_ELEMENT(INTEGER(QRep.expire_mode));
-SUBSTRUCT_ELEMENT(INTEGER(QRep.expire_value));
-LONG(QRnumber); /* Globally unique room number */
-CHAR(QRorder); /* Sort key for room listing order */
-UNSIGNED(QRflags2); /* Additional flags */
-INTEGER(QRdefaultview); /* How to display the contents */
+++ /dev/null
-/* User record */
-
-INTEGER(version); /* Cit vers. which created this rec */
-UID_T(uid); /* Associate with a unix account? */
-STRING_BUF(password,32); /* password (for Citadel-only users)*/
-UNSIGNED(flags); /* See US_ flags below TODO: is this really the same? */
-LONG(timescalled); /* Total number of logins */
-LONG(posted); /* Number of messages posted (ever) */
-UINT8(axlevel); /* Access level */
-LONG(usernum); /* User number (never recycled) */
-TIME(lastcall); /* Last time the user called */
-INTEGER(USuserpurge); /* Purge time (in days) for user */
-STRING_BUF(fullname,64); /* Name for Citadel messages & mail */
+++ /dev/null
-/*
- * this file contains the defines that convert our x-macros to datatypes
- */
-
-#define PROTOCOL_ONLY(a) a
-#define SERVER_PRIVATE(a)
-
-#define UNSIGNED_SHORT(a) $data[a] = array_unshift($inarray)
-#define INTEGER(a) $data[a] = array_unshift($inarray)
-
-#define STRING_BUF(a, b) $data[a] = array_unshift($inarray)
-#define STRING(a) $data[a] = array_unshift($inarray)
-
+++ /dev/null
-/*
- * this file contains the defines that convert our x-macros to datatypes
- */
-
-#undef SUBSTRUCT
-#undef SUBSTRUCT_ELEMENT
-#undef CFG_VALUE
-#undef PROTOCOL_ONLY
-#undef SERVER_PRIVATE
-#undef NO_ARTV
-
-#undef UNSIGNED
-#undef UNSIGNED_INT
-#undef LONG
-#undef INTEGER
-#undef UINT8
-#undef UNSIGNED_SHORT
-#undef CHAR
-
-#undef TIME
-#undef UID_T
-
-#undef STRING_BUF
-#undef STRING
-
-
-
syslog(LOG_DEBUG, "Called as: %s", argv[0]);
syslog(LOG_INFO, "%s", libcitadel_version_string());
- /* Load site-specific parameters, and set the ipgm secret */
+ /* Load site-specific configuration */
syslog(LOG_INFO, "Loading citadel.config");
get_config();
- config.c_ipgm_secret = rand();
/* get_control() MUST MUST MUST be called BEFORE the databases are opened!! */
syslog(LOG_INFO, "Acquiring control record");