From 52273842747089900b3dfb3aa66f130d0ef91c48 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Wed, 23 Aug 2006 21:08:43 +0000 Subject: [PATCH] * implemented a postfix tcp-dict table, first draft. --- citadel/control.c | 5 ++++ citadel/routines2.c | 3 +- citadel/serv_extensions.h | 1 + citadel/serv_vcard.c | 53 ++++++++++++++++++++++++++++++++++++ citadel/setup.c | 1 + citadel/techdoc/protocol.txt | 1 + 6 files changed, 63 insertions(+), 1 deletion(-) diff --git a/citadel/control.c b/citadel/control.c index 68bbd51c7..eb0317b8a 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -222,6 +222,7 @@ void cmd_conf(char *argbuf) cprintf("%d\n", config.c_journal_pubmsgs); cprintf("%s\n", config.c_journal_dest); cprintf("%s\n", config.c_default_cal_zone); + cprintf("%d\n", config.c_pftcpdict_port); cprintf("000\n"); } @@ -420,6 +421,10 @@ void cmd_conf(char *argbuf) case 49: safestrncpy(config.c_default_cal_zone, buf, sizeof config.c_default_cal_zone); + break; + case 50: + config.c_pftcpdict_port = atoi(buf); + break; } ++a; } diff --git a/citadel/routines2.c b/citadel/routines2.c index a0116d1e7..d0e82ed81 100644 --- a/citadel/routines2.c +++ b/citadel/routines2.c @@ -644,7 +644,7 @@ void read_bio(CtdlIPC *ipc) void do_system_configuration(CtdlIPC *ipc) { -#define NUM_CONFIGS 50 +#define NUM_CONFIGS 51 char buf[SIZ]; char sc[NUM_CONFIGS][256]; @@ -743,6 +743,7 @@ void do_system_configuration(CtdlIPC *ipc) strprompt("SMTP MTA server port (-1 to disable)", &sc[24][0], 5); strprompt("SMTP MSA server port (-1 to disable)", &sc[38][0], 5); strprompt("SMTPS server port (-1 to disable)", &sc[41][0], 5); + strprompt("Postfix TCP Dictionary Port server port (-1 to disable)", &sc[50][0], 5); /* This logic flips the question around, because it's one of those * situations where 0=yes and 1=no diff --git a/citadel/serv_extensions.h b/citadel/serv_extensions.h index 9b6697839..288f7b992 100644 --- a/citadel/serv_extensions.h +++ b/citadel/serv_extensions.h @@ -34,6 +34,7 @@ char *serv_vandelay_init(void); char *serv_vcard_init(void); char *serv_fulltext_init(void); char *serv_autocompletion_init(void); +char *serv_postfix_tcpdict(void); /* */ diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index 51f7b29f5..cb34e55b0 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -876,6 +876,48 @@ void cmd_qdir(char *argbuf) { cprintf("%d %s\n", CIT_OK, citadel_addr); } +/* + * Query Directory, in fact an alias to match postfix tcp auth. + */ +void check_get(void) { + char citadel_addr[256]; + char internet_addr[256]; + + char cmdbuf[SIZ]; + + time(&CC->lastcmd); + memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */ + if (client_getln(cmdbuf, sizeof cmdbuf) < 1) { + lprintf(CTDL_CRIT, "Client disconnected: ending session.\n"); + CC->kill_me = 1; + return; + } + lprintf(CTDL_INFO, ": %s\n", cmdbuf); + while (strlen(cmdbuf) < 3) strcat(cmdbuf, " "); + + if (strcasecmp(cmdbuf, "GET ")); + { + + char *argbuf = &cmdbuf[4]; + //// if (CtdlAccessCheck(ac_logged_in)) return; + + extract_token(internet_addr, argbuf, 0, '|', sizeof internet_addr); + + if (CtdlDirectoryLookup(citadel_addr, internet_addr, sizeof citadel_addr) != 0) { + cprintf("500 %s was not found.\r\n", + internet_addr); + + } + + else cprintf("200 OK %s\r\n", internet_addr);//,citadel_addr); + } + CC->kill_me = 1; +} + +void check_get_greeting(void) { +/* dummy function, we have no greeting in this verry simple protocol. */ +} + /* * We don't know if the Contacts room exists so we just create it at login @@ -1142,3 +1184,14 @@ char *serv_vcard_init(void) return "$Id$"; } + + +char *serv_postfix_tcpdict(void) +{ + CtdlRegisterServiceHook(config.c_pftcpdict_port, /* Postfix */ + NULL, + check_get_greeting, + check_get, + NULL); + return "$Id$"; +} diff --git a/citadel/setup.c b/citadel/setup.c index 7c6e6f121..75ade1484 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -1299,6 +1299,7 @@ int main(int argc, char *argv[]) if (config.c_smtps_port == 0) config.c_smtps_port = 465; if (config.c_pop3s_port == 0) config.c_pop3s_port = 995; if (config.c_imaps_port == 0) config.c_imaps_port = 993; + if (config.c_pftcpdict_port == 0) config.c_pftcpdict_port = -1; /* Go through a series of dialogs prompting for config info */ if (setup_type != UI_SILENT) { diff --git a/citadel/techdoc/protocol.txt b/citadel/techdoc/protocol.txt index 8038fcf8f..75b8bac48 100644 --- a/citadel/techdoc/protocol.txt +++ b/citadel/techdoc/protocol.txt @@ -1890,6 +1890,7 @@ fails for any reason, ERROR is returned. 47. Flag (0 or 1) - perform journaling of non-email messages 48. Address to which journalized messages are to be sent 49. Default time zone (Olsen database name) for unzoned calendar items + 50. Port number for Postfix TCP Dict (http://www.postfix.org/tcp_table.5.html) CONF also accepts two additional commands: GETSYS and PUTSYS followed by an arbitrary MIME type (such as application/x-citadel-internet-config) which -- 2.30.2