From 81f05d1bc08d9050b5abe1309c9ae6d2ba71c885 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Tue, 27 Feb 2007 20:49:26 +0000 Subject: [PATCH] * added include files containing structural information from our database backend. * added type definitions translating the structure information back into c-structs * added type definitions for serializing / deserializing our structurse to artv. * added code to serv_vanderley to auto dump our datastructurse * incremented the EXPORT_REV_MIN because of the sequence of config is changed to be similar to our storage backend. * added include flags to the makefiles. --- citadel/Makefile.in | 4 +- citadel/citadel.h | 57 ++++-- citadel/config.h | 137 +++++++------ citadel/debian/changelog | 2 +- citadel/include/artv_deserialize.h | 26 +++ citadel/include/artv_serialize.h | 27 +++ citadel/include/datadefinitions.h | 29 +++ citadel/include/dtds/config-defs.h | 72 +++++++ citadel/include/dtds/expirepolicy-defs.h | 2 + citadel/include/dtds/floor-defs.h | 12 ++ citadel/include/dtds/march-defs.h | 7 + citadel/include/dtds/room-defs.h | 21 ++ citadel/include/dtds/user-defs.h | 15 ++ citadel/include/php_datadefinitions.h | 15 ++ citadel/include/undef_data.h | 30 +++ citadel/serv_vandelay.c | 243 ++++++++++++++--------- 16 files changed, 523 insertions(+), 176 deletions(-) create mode 100644 citadel/include/artv_deserialize.h create mode 100644 citadel/include/artv_serialize.h create mode 100644 citadel/include/datadefinitions.h create mode 100644 citadel/include/dtds/config-defs.h create mode 100644 citadel/include/dtds/expirepolicy-defs.h create mode 100644 citadel/include/dtds/floor-defs.h create mode 100644 citadel/include/dtds/march-defs.h create mode 100644 citadel/include/dtds/room-defs.h create mode 100644 citadel/include/dtds/user-defs.h create mode 100644 citadel/include/php_datadefinitions.h create mode 100644 citadel/include/undef_data.h diff --git a/citadel/Makefile.in b/citadel/Makefile.in index a10bf3cb0..213cb4594 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -68,8 +68,8 @@ AUTH=@AUTH@ AUTOCONF=@AUTOCONF@ chkpwd_LIBS=@chkpwd_LIBS@ CC=@CC@ -CFLAGS=@CFLAGS@ -CPPFLAGS=@CPPFLAGS@ -I. +CFLAGS=@CFLAGS@ -I ./include/ +CPPFLAGS=@CPPFLAGS@ -I. -I ./include/ DATABASE=@DATABASE@ DEFS=@DEFS@ LDFLAGS=@LDFLAGS@ diff --git a/citadel/citadel.h b/citadel/citadel.h index 36ff572f4..8dfa7ca7e 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -49,7 +49,7 @@ extern "C" { */ #define REV_LEVEL 705 /* This version */ #define REV_MIN 591 /* Oldest compatible database */ -#define EXPORT_REV_MIN 704 /* Oldest compatible export files */ +#define EXPORT_REV_MIN 705 /* Oldest compatible export files */ #define SERVER_TYPE 0 /* zero for stock Citadel; other developers please obtain SERVER_TYPE codes for your implementations */ @@ -71,6 +71,11 @@ extern "C" { * Message expiration policy stuff */ struct ExpirePolicy { +/* +#include "datadefinitions.h" +#include "dtds/expirepolicy-defs.h" +#include "undef_data.h" +*/ int expire_mode; int expire_value; }; @@ -87,6 +92,11 @@ struct ExpirePolicy { * relevant rooms without having to ask the server each time where to go next. */ struct march { +/* +#include "datadefinitions.h" +#include "dtds/march-defs.h" +#include "undef_data.h" +*/ struct march *next; char march_name[ROOMNAMELEN]; unsigned int march_flags; @@ -111,6 +121,11 @@ struct march { * User records. */ struct ctdluser { /* User record */ +/* +#include "datadefinitions.h" +#include "dtds/user-defs.h" +#include "undef_data.h" +*/ int version; /* Cit vers. which created this rec */ uid_t uid; /* Associate with a unix account? */ char password[32]; /* password (for Citadel-only users)*/ @@ -137,21 +152,26 @@ struct ctdluser { /* User record */ * Room records. */ struct ctdlroom { - char QRname[ROOMNAMELEN]; /* Name of room */ - char 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_t QRgen; /* Generation number of room */ - unsigned QRflags; /* See flag values below */ - char QRdirname[15]; /* Directory name, if applicable */ - long QRinfo; /* Info file update relative to msgs*/ - char QRfloor; /* Which floor this room is on */ - time_t QRmtime; /* Date/time of last post */ - struct ExpirePolicy QRep; /* Message expiration policy */ - long QRnumber; /* Globally unique room number */ - char QRorder; /* Sort key for room listing order */ - unsigned QRflags2; /* Additional flags */ - int QRdefaultview; /* How to display the contents */ +/* +#include "datadefinitions.h" +#include "dtds/room-defs.h" +#include "undef_data.h" +*/ + char QRname[ROOMNAMELEN]; /* Name of room */ + char 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_t QRgen; /* Generation number of room */ + unsigned QRflags; /* See flag values below */ + char QRdirname[15]; /* Directory name, if applicable */ + long QRinfo; /* Info file update relative to msgs*/ + char QRfloor; /* Which floor this room is on */ + time_t QRmtime; /* Date/time of last post */ + struct ExpirePolicy QRep; /* Message expiration policy */ + long QRnumber; /* Globally unique room number */ + char QRorder; /* Sort key for room listing order */ + unsigned QRflags2; /* Additional flags */ + int QRdefaultview; /* How to display the contents */ }; /* Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED @@ -178,6 +198,11 @@ struct ctdlroom { * Floor record. The floor number is implicit in its location in the file. */ struct floor { +/* +#include "datadefinitions.h" +#include "dtds/floor-defs.h" +#include "undef_data.h" +*/ unsigned short f_flags; /* flags */ char f_name[256]; /* name of floor */ int f_ref_count; /* reference count */ diff --git a/citadel/config.h b/citadel/config.h index 176aaf45f..90d8bf604 100644 --- a/citadel/config.h +++ b/citadel/config.h @@ -15,72 +15,77 @@ * free to do so, as long as the sizes are kept identical. */ struct config { - char c_nodename[16]; /* Unqualified "short" nodename */ - char c_fqdn[64]; /* Fully Qualified Domain Name */ - char c_humannode[21]; /* Long name of system */ - char c_phonenum[16]; /* Dialup number of system */ - uid_t c_ctdluid; /* UID under which we run Citadel */ - char c_creataide; /* room creator = room aide flag */ - int c_sleeping; /* watchdog timer setting */ - char c_initax; /* initial access level */ - char c_regiscall; /* call number to register on */ - char c_twitdetect; /* twit detect flag */ - char c_twitroom[ROOMNAMELEN]; /* twit detect msg move to room */ - char c_moreprompt[80]; /* paginator prompt */ - char c_restrict; /* restrict Internet mail flag */ - long c_niu_1; /* (not in use) */ - char c_site_location[32]; /* physical location of server */ - char c_sysadm[26]; /* name of system administrator */ - char c_niu_2[15]; /* (not in use) */ - int c_setup_level; /* what rev level we've setup to */ - int c_maxsessions; /* maximum concurrent sessions */ - char c_ip_addr[20]; /* IP address to listen on */ - int c_port_number; /* Cit listener port (usually 504) */ - int c_ipgm_secret; /* Internal program authentication */ - struct ExpirePolicy c_ep; /* System default msg expire policy */ - int c_userpurge; /* System default user purge (days) */ - int c_roompurge; /* System default room purge (days) */ - char c_logpages[ROOMNAMELEN]; /* Room to log pages to (or not) */ - char c_createax; /* Axlevel required to create rooms */ - long c_maxmsglen; /* Maximum message length */ - int c_min_workers; /* Lower limit on number of threads */ - int c_max_workers; /* Upper limit on number of threads */ - int c_pop3_port; /* POP3 listener port (usually 110) */ - int c_smtp_port; /* SMTP listener port (usually 25) */ - int c_rfc822_strict_from; /* 1 = don't correct From: forgeries*/ - int c_aide_zap; /* Are Aides allowed to zap rooms? */ - int c_imap_port; /* IMAP listener port (usually 143) */ - time_t c_net_freq; /* how often to run the networker */ - char c_disable_newu; /* disable NEWU command */ - char c_enable_fulltext; /* enable full text indexing */ - char c_baseroom[ROOMNAMELEN]; /* Name of baseroom (Lobby) */ - char c_aideroom[ROOMNAMELEN]; /* Name of aideroom (Aide) */ - int c_purge_hour; /* Hour during which db purges run */ - struct ExpirePolicy c_mbxep; /* Expire policy for mailbox rooms */ - char c_ldap_host[128]; /* Host where LDAP service lives */ - int c_ldap_port; /* Port on host where LDAP lives */ - char c_ldap_base_dn[256]; /* LDAP base DN */ - char c_ldap_bind_dn[256]; /* LDAP bind DN */ - char c_ldap_bind_pw[256]; /* LDAP bind password */ - int c_msa_port; /* SMTP MSA listener port (usu 587) */ - int c_imaps_port; /* IMAPS listener port (usually 993)*/ - int c_pop3s_port; /* POP3S listener port (usually 995)*/ - int c_smtps_port; /* SMTPS listener port (usually 465)*/ - char c_auto_cull; /* Cull db logs automatically? */ - char c_instant_expunge; /* IMAP instant expunge deleted msgs*/ - char c_allow_spoofing; /* SMTP allow spoofing of my domains*/ - char c_journal_email; /* Perform journaling of email */ - char c_journal_pubmsgs; /* Perform journaling of non-email */ - char c_journal_dest[128]; /* Where to send journalized msgs */ - char c_default_cal_zone[128]; /* Default calendar time zone */ - int c_pftcpdict_port; /* postfix tcptable support, see http://www.postfix.org/tcp_table.5.html */ - int c_managesieve_port; /* managesieve port. */ - int c_auth_mode; /* 0 = built-in Citadel auth; 1 = underlying host system auth */ - char c_funambol_host[256]; /* Funambol host. Blank to disable */ - int c_funambol_port; /* Funambol port */ - char c_funambol_source[256]; /* Funambol sync source */ - char c_funambol_auth[256]; /* Funambol auth details */ - char c_rbl_at_greeting; /* Check RBL's at connect instead of after RCPT */ +#include "datadefinitions.h" +#include "dtds/config-defs.h" +#include "undef_data.h" + +/// char c_nodename[16]; /* Unqualified "short" nodename */ +/// char c_fqdn[64]; /* Fully Qualified Domain Name */ +/// char c_humannode[21]; /* Long name of system */ +/// char c_phonenum[16]; /* Dialup number of system */ +/// uid_t c_ctdluid; /* UID under which we run Citadel */ +/// char c_creataide; /* room creator = room aide flag */ +/// int c_sleeping; /* watchdog timer setting */ +/// char c_initax; /* initial access level */ +/// char c_regiscall; /* call number to register on */ +/// char c_twitdetect; /* twit detect flag */ +/// char c_twitroom[ROOMNAMELEN]; /* twit detect msg move to room */ +/// char c_moreprompt[80]; /* paginator prompt */ +/// char c_restrict; /* restrict Internet mail flag */ +/// long c_niu_1; /* (not in use) */ +/// char c_site_location[32]; /* physical location of server */ +/// char c_sysadm[26]; /* name of system administrator */ +/// char c_niu_2[15]; /* (not in use) */ +/// int c_setup_level; /* what rev level we've setup to */ +/// int c_maxsessions; /* maximum concurrent sessions */ +/// char c_ip_addr[20]; /* IP address to listen on */ +/// int c_port_number; /* Cit listener port (usually 504) */ +/// int c_ipgm_secret; /* Internal program authentication */ +/// struct ExpirePolicy c_ep; /* System default msg expire policy */ +/// int c_userpurge; /* System default user purge (days) */ +/// int c_roompurge; /* System default room purge (days) */ +/// char c_logpages[ROOMNAMELEN]; /* Room to log pages to (or not) */ +/// char c_createax; /* Axlevel required to create rooms */ +/// long c_maxmsglen; /* Maximum message length */ +/// int c_min_workers; /* Lower limit on number of threads */ +/// int c_max_workers; /* Upper limit on number of threads */ +/// int c_pop3_port; /* POP3 listener port (usually 110) */ +/// int c_smtp_port; /* SMTP listener port (usually 25) */ +/// int c_rfc822_strict_from; /* 1 = don't correct From: forgeries*/ +/// int c_aide_zap; /* Are Aides allowed to zap rooms? */ +/// int c_imap_port; /* IMAP listener port (usually 143) */ +/// time_t c_net_freq; /* how often to run the networker */ +/// char c_disable_newu; /* disable NEWU command */ +/// char c_enable_fulltext; /* enable full text indexing */ +/// char c_baseroom[ROOMNAMELEN]; /* Name of baseroom (Lobby) */ +/// char c_aideroom[ROOMNAMELEN]; /* Name of aideroom (Aide) */ +/// int c_purge_hour; /* Hour during which db purges run */ +/// struct ExpirePolicy c_mbxep; /* Expire policy for mailbox rooms */ +/// char c_ldap_host[128]; /* Host where LDAP service lives */ +/// int c_ldap_port; /* Port on host where LDAP lives */ +/// char c_ldap_base_dn[256]; /* LDAP base DN */ +/// char c_ldap_bind_dn[256]; /* LDAP bind DN */ +/// char c_ldap_bind_pw[256]; /* LDAP bind password */ +/// int c_msa_port; /* SMTP MSA listener port (usu 587) */ +/// int c_imaps_port; /* IMAPS listener port (usually 993)*/ +/// int c_pop3s_port; /* POP3S listener port (usually 995)*/ +/// int c_smtps_port; /* SMTPS listener port (usually 465)*/ +/// char c_auto_cull; /* Cull db logs automatically? */ +/// char c_instant_expunge; /* IMAP instant expunge deleted msgs*/ +/// char c_allow_spoofing; /* SMTP allow spoofing of my domains*/ +/// char c_journal_email; /* Perform journaling of email */ +/// char c_journal_pubmsgs; /* Perform journaling of non-email */ +/// char c_journal_dest[128]; /* Where to send journalized msgs */ +/// char c_default_cal_zone[128]; /* Default calendar time zone */ +/// int c_pftcpdict_port; /* postfix tcptable support, see http://www.postfix.org/tcp_table.5.html */ +/// int c_managesieve_port; /* managesieve port. */ +/// int c_auth_mode; /* 0 = built-in Citadel auth; 1 = underlying host system auth */ +/// char c_funambol_host[256]; /* Funambol host. Blank to disable */ +/// int c_funambol_port; /* Funambol port */ +/// char c_funambol_source[256]; /* Funambol sync source */ +/// char c_funambol_auth[256]; /* Funambol auth details */ +/// char c_rbl_at_greeting; /* Check RBL's at connect instead of after RCPT */ +/// }; diff --git a/citadel/debian/changelog b/citadel/debian/changelog index 78b8128f1..f0a2d7f82 100644 --- a/citadel/debian/changelog +++ b/citadel/debian/changelog @@ -2,7 +2,7 @@ citadel (7.05-1) stable; urgency=low * Citadel 7.05 release - -- Art Cancro Thu, 22 Feb 2007 06:12:00 -0500 + -- Art Cancro Thu, 22 Feb 2007 06:12:00 -0500 citadel (7.03-7) unstable; urgency=high diff --git a/citadel/include/artv_deserialize.h b/citadel/include/artv_deserialize.h new file mode 100644 index 000000000..22f65fda7 --- /dev/null +++ b/citadel/include/artv_deserialize.h @@ -0,0 +1,26 @@ + +/** + * this file contains the defines that cause our x-macros to serialize for artv export + */ +#define CFG_VALUE(a,b) a +#define PROTOCOL_ONLY(a) +#define SERVER_PRIVATE(a) a +#define NO_ARTV(a) +#define SUBSTRUCT(a) +#define SUBSTRUCT_ELEMENT(a) a + +#define UNSIGNED(a) client_getln(cbuf, sizeof cbuf); buf->a = atoi(cbuf) +#define UNSIGNED_INT(a) client_getln(cbuf, sizeof cbuf); buf->a = atoi(cbuf) +#define INTEGER(a) client_getln(cbuf, sizeof cbuf); buf->a = atoi(cbuf) +#define LONG(a) client_getln(cbuf, sizeof cbuf); buf->a = atol(cbuf) +#define UINT8(a) client_getln(cbuf, sizeof cbuf); buf->a = atoi(cbuf) +#define UNSIGNED_SHORT(a) client_getln(cbuf, sizeof cbuf); buf->a = atoi(cbuf) +#define CHAR(a) client_getln(cbuf, sizeof cbuf); buf->a = atoi(cbuf) + +#define TIME(a) client_getln(cbuf, sizeof cbuf); buf->a = atol(cbuf) +#define UID_T(a) client_getln(cbuf, sizeof cbuf); buf->a = atol(cbuf) + + + +#define STRING_BUF(a, b) client_getln(buf->a, b) +#define STRING(a) client_getln(buf->a, sizeof buf->a) diff --git a/citadel/include/artv_serialize.h b/citadel/include/artv_serialize.h new file mode 100644 index 000000000..eac490fd6 --- /dev/null +++ b/citadel/include/artv_serialize.h @@ -0,0 +1,27 @@ + +/** + * this file contains the defines that cause our x-macros to serialize for artv export + */ + +#define CFG_VALUE(a,b) a +#define NO_ARTV(a) +#define PROTOCOL_ONLY(a) +#define SERVER_PRIVATE(a) a +#define SUBSTRUCT(a) +#define SUBSTRUCT_ELEMENT(a) a + +#define UNSIGNED(a) cprintf("%u\n", buf->a) +#define UNSIGNED_INT(a) cprintf("%u\n", buf->a) +#define INTEGER(a) cprintf("%d\n", buf->a) +#define LONG(a) cprintf("%ld\n", buf->a) +#define UINT8(a) cprintf("%d\n", buf->a) +#define UNSIGNED_SHORT(a) cprintf("%u\n", buf->a) +#define CHAR(a) cprintf("%d\n", buf->a) + +#define TIME(a) cprintf("%ld\n", (long)buf->a) +#define UID_T(a) cprintf("%ld\n", (long)buf->a) + + + +#define STRING_BUF(a, b) cprintf("%s\n", buf->a) +#define STRING(a) cprintf("%s\n", buf->a) diff --git a/citadel/include/datadefinitions.h b/citadel/include/datadefinitions.h new file mode 100644 index 000000000..a3d04b7e6 --- /dev/null +++ b/citadel/include/datadefinitions.h @@ -0,0 +1,29 @@ + + +/** + * 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 + diff --git a/citadel/include/dtds/config-defs.h b/citadel/include/dtds/config-defs.h new file mode 100644 index 000000000..f4c828151 --- /dev/null +++ b/citadel/include/dtds/config-defs.h @@ -0,0 +1,72 @@ +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), " what rev level we've setup to "); +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 "); diff --git a/citadel/include/dtds/expirepolicy-defs.h b/citadel/include/dtds/expirepolicy-defs.h new file mode 100644 index 000000000..1ad6c6cdd --- /dev/null +++ b/citadel/include/dtds/expirepolicy-defs.h @@ -0,0 +1,2 @@ +INTEGER(expire_mode); +INTEGER(expire_value); diff --git a/citadel/include/dtds/floor-defs.h b/citadel/include/dtds/floor-defs.h new file mode 100644 index 000000000..cd78a7ea0 --- /dev/null +++ b/citadel/include/dtds/floor-defs.h @@ -0,0 +1,12 @@ +/** + * 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)); diff --git a/citadel/include/dtds/march-defs.h b/citadel/include/dtds/march-defs.h new file mode 100644 index 000000000..837525948 --- /dev/null +++ b/citadel/include/dtds/march-defs.h @@ -0,0 +1,7 @@ +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); diff --git a/citadel/include/dtds/room-defs.h b/citadel/include/dtds/room-defs.h new file mode 100644 index 000000000..cfd168275 --- /dev/null +++ b/citadel/include/dtds/room-defs.h @@ -0,0 +1,21 @@ +/* + * 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 */ diff --git a/citadel/include/dtds/user-defs.h b/citadel/include/dtds/user-defs.h new file mode 100644 index 000000000..0a9e9bda7 --- /dev/null +++ b/citadel/include/dtds/user-defs.h @@ -0,0 +1,15 @@ +/* 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 */ +UINT8(USscreenwidth); /* Screen width (for textmode users)*/ +UINT8(USscreenheight); /* Screen height(for textmode users)*/ diff --git a/citadel/include/php_datadefinitions.h b/citadel/include/php_datadefinitions.h new file mode 100644 index 000000000..430081705 --- /dev/null +++ b/citadel/include/php_datadefinitions.h @@ -0,0 +1,15 @@ + + +/** + * 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) + diff --git a/citadel/include/undef_data.h b/citadel/include/undef_data.h new file mode 100644 index 000000000..f3d772423 --- /dev/null +++ b/citadel/include/undef_data.h @@ -0,0 +1,30 @@ + + +/** + * 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 + + + diff --git a/citadel/serv_vandelay.c b/citadel/serv_vandelay.c index 9152160ea..ccbf04b4c 100644 --- a/citadel/serv_vandelay.c +++ b/citadel/serv_vandelay.c @@ -51,21 +51,26 @@ char artv_tempfilename1[PATH_MAX]; char artv_tempfilename2[PATH_MAX]; FILE *artv_global_message_list; -void artv_export_users_backend(struct ctdluser *usbuf, void *data) { +void artv_export_users_backend(struct ctdluser *buf, void *data) { cprintf("user\n"); - cprintf("%d\n", usbuf->version); - cprintf("%ld\n", (long)usbuf->uid); - cprintf("%s\n", usbuf->password); - cprintf("%u\n", usbuf->flags); - cprintf("%ld\n", usbuf->timescalled); - cprintf("%ld\n", usbuf->posted); - cprintf("%d\n", usbuf->axlevel); - cprintf("%ld\n", usbuf->usernum); - cprintf("%ld\n", (long)usbuf->lastcall); - cprintf("%d\n", usbuf->USuserpurge); - cprintf("%s\n", usbuf->fullname); - cprintf("%d\n", usbuf->USscreenwidth); - cprintf("%d\n", usbuf->USscreenheight); +/* +#include "artv_serialize.h" +#include "dtds/user-defs.h" +#include "undef_data.h" +*/ + cprintf("%d\n", buf->version); + cprintf("%ld\n", (long)buf->uid); + cprintf("%s\n", buf->password); + cprintf("%u\n", buf->flags); + cprintf("%ld\n", buf->timescalled); + cprintf("%ld\n", buf->posted); + cprintf("%d\n", buf->axlevel); + cprintf("%ld\n", buf->usernum); + cprintf("%ld\n", (long)buf->lastcall); + cprintf("%d\n", buf->USuserpurge); + cprintf("%s\n", buf->fullname); + cprintf("%d\n", buf->USscreenwidth); + cprintf("%d\n", buf->USscreenheight); } @@ -80,26 +85,36 @@ void artv_export_room_msg(long msgnum, void *userdata) { } -void artv_export_rooms_backend(struct ctdlroom *qrbuf, void *data) { +void artv_export_rooms_backend(struct ctdlroom *buf, void *data) { cprintf("room\n"); - cprintf("%s\n", qrbuf->QRname); - cprintf("%s\n", qrbuf->QRpasswd); - cprintf("%ld\n", qrbuf->QRroomaide); - cprintf("%ld\n", qrbuf->QRhighest); - cprintf("%ld\n", (long)qrbuf->QRgen); - cprintf("%u\n", qrbuf->QRflags); - cprintf("%s\n", qrbuf->QRdirname); - cprintf("%ld\n", qrbuf->QRinfo); - cprintf("%d\n", qrbuf->QRfloor); - cprintf("%ld\n", (long)qrbuf->QRmtime); - cprintf("%d\n", qrbuf->QRep.expire_mode); - cprintf("%d\n", qrbuf->QRep.expire_value); - cprintf("%ld\n", qrbuf->QRnumber); - cprintf("%d\n", qrbuf->QRorder); - cprintf("%u\n", qrbuf->QRflags2); - cprintf("%d\n", qrbuf->QRdefaultview); - - getroom(&CC->room, qrbuf->QRname); +/* +#include "artv_serialize.h" +#include "dtds/room-defs.h" +#include "undef_data.h" +*/ + cprintf("%s\n", buf->QRname); + cprintf("%s\n", buf->QRpasswd); + cprintf("%ld\n", buf->QRroomaide); + cprintf("%ld\n", buf->QRhighest); + cprintf("%ld\n", (long)buf->QRgen); + cprintf("%u\n", buf->QRflags); + cprintf("%s\n", buf->QRdirname); + cprintf("%ld\n", buf->QRinfo); + cprintf("%d\n", buf->QRfloor); + cprintf("%ld\n", (long)buf->QRmtime); + cprintf("%d\n", buf->QRep.expire_mode); + cprintf("%d\n", buf->QRep.expire_value); + cprintf("%ld\n", buf->QRnumber); + cprintf("%d\n", buf->QRorder); + cprintf("%u\n", buf->QRflags2); + cprintf("%d\n", buf->QRdefaultview); + + getroom(&CC->room, buf->QRname); + /* format of message list export is all message numbers output + * one per line terminated by a 0. + */ +//*/ + getroom(&CC->room, buf->QRname); /* format of message list export is all message numbers output * one per line terminated by a 0. */ @@ -133,18 +148,25 @@ void artv_export_rooms(void) { void artv_export_floors(void) { - struct floor flbuf; + struct floor qfbuf, *buf; int i; for (i=0; i < MAXFLOORS; ++i) { cprintf("floor\n"); cprintf("%d\n", i); - getfloor(&flbuf, i); - cprintf("%u\n", flbuf.f_flags); - cprintf("%s\n", flbuf.f_name); - cprintf("%d\n", flbuf.f_ref_count); - cprintf("%d\n", flbuf.f_ep.expire_mode); - cprintf("%d\n", flbuf.f_ep.expire_value); + getfloor(&qfbuf, i); + buf = &qfbuf; +/* +#include "artv_serialize.h" +#include "dtds/floor-defs.h" +#include "undef_data.h" +/*/ + cprintf("%u\n", buf->f_flags); + cprintf("%s\n", buf->f_name); + cprintf("%d\n", buf->f_ref_count); + cprintf("%d\n", buf->f_ep.expire_mode); + cprintf("%d\n", buf->f_ep.expire_value); +//*/ } } @@ -209,7 +231,7 @@ void artv_export_message(long msgnum) { /* write it in base64 */ CtdlMakeTempFileName(tempfile, sizeof tempfile); - snprintf(buf, sizeof buf, "./base64 -e >%s", tempfile); + snprintf(buf, sizeof buf, "%sbase64 -e >%s", ctdl_sbin_dir, tempfile); fp = popen(buf, "w"); fwrite(smr.ser, smr.len, 1, fp); pclose(fp); @@ -255,12 +277,20 @@ void artv_export_messages(void) { void artv_do_export(void) { + struct config *buf; + buf = &config; cprintf("%d Exporting all Citadel databases.\n", LISTING_FOLLOWS); cprintf("version\n%d\n", REV_LEVEL); /* export the config file */ cprintf("config\n"); + +#include "artv_serialize.h" +#include "dtds/config-defs.h" +#include "undef_data.h" + +/* cprintf("%s\n", config.c_nodename); cprintf("%s\n", config.c_fqdn); cprintf("%s\n", config.c_humannode); @@ -325,7 +355,7 @@ void artv_do_export(void) { cprintf("%s\n", config.c_funambol_source); cprintf("%s\n", config.c_funambol_auth); cprintf("%d\n", config.c_rbl_at_greeting); - +*/ /* Export the control file */ get_control(); cprintf("control\n"); @@ -347,9 +377,17 @@ void artv_do_export(void) { void artv_import_config(void) { - char buf[SIZ]; + char cbuf[SIZ]; + struct config *buf; + buf = &config; lprintf(CTDL_DEBUG, "Importing config file\n"); + +#include "artv_deserialize.h" +#include "dtds/config-defs.h" +#include "undef_data.h" + +/* client_getln(config.c_nodename, sizeof config.c_nodename); client_getln(config.c_fqdn, sizeof config.c_fqdn); client_getln(config.c_humannode, sizeof config.c_humannode); @@ -414,7 +452,7 @@ void artv_import_config(void) { client_getln(config.c_funambol_source, sizeof config.c_funambol_source); client_getln(config.c_funambol_auth, sizeof config.c_funambol_auth); client_getln(buf, sizeof buf); config.c_rbl_at_greeting = atoi(buf); - +*/ config.c_enable_fulltext = 0; /* always disable */ put_config(); lprintf(CTDL_INFO, "Imported config file\n"); @@ -437,54 +475,69 @@ void artv_import_control(void) { void artv_import_user(void) { - char buf[SIZ]; - struct ctdluser usbuf; - - client_getln(buf, sizeof buf); usbuf.version = atoi(buf); - client_getln(buf, sizeof buf); usbuf.uid = atoi(buf); - client_getln(usbuf.password, sizeof usbuf.password); - client_getln(buf, sizeof buf); usbuf.flags = atoi(buf); - client_getln(buf, sizeof buf); usbuf.timescalled = atol(buf); - client_getln(buf, sizeof buf); usbuf.posted = atol(buf); - client_getln(buf, sizeof buf); usbuf.axlevel = atoi(buf); - client_getln(buf, sizeof buf); usbuf.usernum = atol(buf); - client_getln(buf, sizeof buf); usbuf.lastcall = atol(buf); - client_getln(buf, sizeof buf); usbuf.USuserpurge = atoi(buf); - client_getln(usbuf.fullname, sizeof usbuf.fullname); - client_getln(buf, sizeof buf); usbuf.USscreenwidth = atoi(buf); - client_getln(buf, sizeof buf); usbuf.USscreenheight = atoi(buf); - putuser(&usbuf); + char cbuf[SIZ]; + struct ctdluser usbuf, *buf; + buf = &usbuf; +/* +#include "artv_deserialize.h" +#include "dtds/user-defs.h" +#include "undef_data.h" + +/*/ + client_getln(cbuf, sizeof cbuf); buf->version = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->uid = atoi(cbuf); + client_getln(buf->password, sizeof buf->password); + client_getln(cbuf, sizeof cbuf); buf->flags = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->timescalled = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->posted = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->axlevel = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->usernum = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->lastcall = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->USuserpurge = atoi(cbuf); + client_getln(buf->fullname, sizeof buf->fullname); + client_getln(cbuf, sizeof cbuf); buf->USscreenwidth = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->USscreenheight = atoi(cbuf); +//*/ + putuser(buf); } void artv_import_room(void) { - char buf[SIZ]; - struct ctdlroom qrbuf; + char cbuf[SIZ]; + struct ctdlroom qrbuf, *buf; long msgnum; int msgcount = 0; - client_getln(qrbuf.QRname, sizeof qrbuf.QRname); - client_getln(qrbuf.QRpasswd, sizeof qrbuf.QRpasswd); - client_getln(buf, sizeof buf); qrbuf.QRroomaide = atol(buf); - client_getln(buf, sizeof buf); qrbuf.QRhighest = atol(buf); - client_getln(buf, sizeof buf); qrbuf.QRgen = atol(buf); - client_getln(buf, sizeof buf); qrbuf.QRflags = atoi(buf); - client_getln(qrbuf.QRdirname, sizeof qrbuf.QRdirname); - client_getln(buf, sizeof buf); qrbuf.QRinfo = atol(buf); - client_getln(buf, sizeof buf); qrbuf.QRfloor = atoi(buf); - client_getln(buf, sizeof buf); qrbuf.QRmtime = atol(buf); - client_getln(buf, sizeof buf); qrbuf.QRep.expire_mode = atoi(buf); - client_getln(buf, sizeof buf); qrbuf.QRep.expire_value = atoi(buf); - client_getln(buf, sizeof buf); qrbuf.QRnumber = atol(buf); - client_getln(buf, sizeof buf); qrbuf.QRorder = atoi(buf); - client_getln(buf, sizeof buf); qrbuf.QRflags2 = atoi(buf); - client_getln(buf, sizeof buf); qrbuf.QRdefaultview = atoi(buf); - putroom(&qrbuf); + buf = &qrbuf; +/* +#include "artv_deserialize.h" +#include "dtds/room-defs.h" +#include "undef_data.h" + +/*/ + client_getln(buf->QRname, sizeof buf->QRname); + client_getln(buf->QRpasswd, sizeof buf->QRpasswd); + client_getln(cbuf, sizeof cbuf); buf->QRroomaide = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRhighest = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRgen = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRflags = atoi(cbuf); + client_getln(buf->QRdirname, sizeof buf->QRdirname); + client_getln(cbuf, sizeof cbuf); buf->QRinfo = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRfloor = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRmtime = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRep.expire_mode = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRep.expire_value = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRnumber = atol(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRorder = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRflags2 = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->QRdefaultview = atoi(cbuf); +//*/ + putroom(buf); lprintf(CTDL_INFO, "Imported room <%s>\n", qrbuf.QRname); /* format of message list export is all message numbers output * one per line terminated by a 0. */ - while (client_getln(buf, sizeof buf), msgnum = atol(buf), msgnum > 0) { + while (client_getln(cbuf, sizeof cbuf), msgnum = atol(cbuf), msgnum > 0) { CtdlSaveMsgPointerInRoom(qrbuf.QRname, msgnum, 0, NULL); ++msgcount; } @@ -493,17 +546,25 @@ void artv_import_room(void) { void artv_import_floor(void) { - struct floor flbuf; + struct floor flbuf, *buf; int i; - char buf[SIZ]; + char cbuf[SIZ]; - client_getln(buf, sizeof buf); i = atoi(buf); - client_getln(buf, sizeof buf); flbuf.f_flags = atoi(buf); - client_getln(flbuf.f_name, sizeof flbuf.f_name); - client_getln(buf, sizeof buf); flbuf.f_ref_count = atoi(buf); - client_getln(buf, sizeof buf); flbuf.f_ep.expire_mode = atoi(buf); - client_getln(buf, sizeof buf); flbuf.f_ep.expire_value = atoi(buf); - putfloor(&flbuf, i); + buf = & flbuf; + memset(buf, 0, sizeof(buf)); + client_getln(cbuf, sizeof cbuf); i = atoi(cbuf); +/* +#include "artv_deserialize.h" +#include "dtds/floor-defs.h" +#include "undef_data.h" +/*/ + client_getln(cbuf, sizeof cbuf); buf->f_flags = atoi(cbuf); + client_getln(buf->f_name, sizeof buf->f_name); + client_getln(cbuf, sizeof cbuf); buf->f_ref_count = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->f_ep.expire_mode = atoi(cbuf); + client_getln(cbuf, sizeof cbuf); buf->f_ep.expire_value = atoi(cbuf); +//*/ + putfloor(buf, i); lprintf(CTDL_INFO, "Imported floor #%d (%s)\n", i, flbuf.f_name); } @@ -554,7 +615,7 @@ void artv_import_message(void) { /* decode base64 message text */ CtdlMakeTempFileName(tempfile, sizeof tempfile); - snprintf(buf, sizeof buf, "./base64 -d >%s", tempfile); + snprintf(buf, sizeof buf, "%sbase64 -d >%s", ctdl_sbin_dir, tempfile); fp = popen(buf, "w"); while (client_getln(buf, sizeof buf), strcasecmp(buf, END_OF_MESSAGE)) { fprintf(fp, "%s\n", buf); -- 2.30.2