On 8/2/2011 2:29 AM, Wietse Venema wrote:
Hari Hendaryanto:
Hello,

I've created a patch that mimicked tcp_table. however, the table lookups
are directed to a unix domain socket instead of tcp servers.
Actually, the patch itself is a modification of the source code of
tcp_table.

Map names have the form usock:/path/to/socket

If i'm not on the right path, can i request similiar feature.? (it would
be great to have both tcp|unix-domain-socket_table)
tcp_table is great, its simple protocol allows us to talk to various
applications.

This really sounds like a name space design issue, since the
map-specific protocol does not change.

     foo:tcp:host:port
     foo:unix:/pathname
     foo:tls:tcp:host:port

This needs further thought.

        Wietse



I have another scenario

tcp:host:port
tcp:/path/name

The reason why i wanted this feature is, by using unix domain socket i can protect my backend server from interference on multiuser environment. while tcp server is adequate for my single administrator/user environment server.

TIA


Powered By http://www.3g-net.net
diff -Nur postfix-2.8.4.orig/src/util/dict_tcp.c 
postfix-2.8.4/src/util/dict_tcp.c
--- postfix-2.8.4.orig/src/util/dict_tcp.c      2011-08-03 09:08:47.004900911 
+0700
+++ postfix-2.8.4/src/util/dict_tcp.c   2011-08-03 09:05:20.022106313 +0700
@@ -117,15 +117,22 @@
 static int dict_tcp_connect(DICT_TCP *dict_tcp)
 {
     int     fd;
+    char   *cp;
 
     /*
      * Connect to the server. Enforce a time limit on all operations so that
      * we do not get stuck.
      */
-    if ((fd = inet_connect(dict_tcp->dict.name, NON_BLOCKING, DICT_TCP_TMOUT)) 
< 0) {
-       msg_warn("connect to TCP map %s: %m", dict_tcp->dict.name);
-       return (-1);
+    if ((cp = strchr(dict_tcp->dict.name, ':')) != 0)
+        fd = inet_connect(dict_tcp->dict.name, NON_BLOCKING, DICT_TCP_TMOUT);
+    else if ((cp = strchr(dict_tcp->dict.name, '/')) != 0)
+        fd = unix_connect(dict_tcp->dict.name, NON_BLOCKING, DICT_TCP_TMOUT);
+
+    if (fd < 0) {
+        msg_warn("connect to TCP map %s: %m", dict_tcp->dict.name);
+        return (-1);
     }
+
     dict_tcp->fp = vstream_fdopen(fd, O_RDWR);
     vstream_control(dict_tcp->fp,
                    VSTREAM_CTL_TIMEOUT, DICT_TCP_TMOUT,

Reply via email to