* implemented a postfix tcp-dict table, first draft.
authorWilfried Göesgens <willi@citadel.org>
Wed, 23 Aug 2006 21:08:43 +0000 (21:08 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 23 Aug 2006 21:08:43 +0000 (21:08 +0000)
citadel/control.c
citadel/routines2.c
citadel/serv_extensions.h
citadel/serv_vcard.c
citadel/setup.c
citadel/techdoc/protocol.txt

index 68bbd51c77f8178bb4f26a36cdc89fc88aab03dc..eb0317b8a83fee3ebca02416b6b7dedb990cb70f 100644 (file)
@@ -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;
                }
index a0116d1e7e39ca06f839bb2a0340140e1d553f56..d0e82ed81f9e187980afa26e7491fa6c61fa0353 100644 (file)
@@ -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
index 9b669783993185d522258016a622dadb499341f0..288f7b9928f84c3ae7044ffb6462ca52679b7dbf 100644 (file)
@@ -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);
 /*
  */
 
index 51f7b29f56c810e4e3cbb08324923bf07eb74b26..cb34e55b0ac4221f437c0d204d1f13e706602a79 100644 (file)
@@ -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$";
+}
index 7c6e6f121781cb0f762801f703f3be3bf84789a7..75ade1484757eb7361af60ddb89fd0f66504cc73 100644 (file)
@@ -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) {
index 8038fcf8fc26646cff55b56c8f1c012793e82549..75b8bac48a6d97cacc3a83c74b3524a2f388ba2c 100644 (file)
@@ -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