* techdoc/delivery-list.txt: added (syntax for delivery lists)
[citadel.git] / citadel / domain.c
1 #include <stdlib.h>
2 #include <unistd.h>
3 #include <netinet/in.h>
4 #include <arpa/nameser.h>
5 #include <resolv.h>
6 #include "domain.h"
7
8 #define SMART_HOST      "gatekeeper.wdcs.com"
9
10 /* 
11  * getmx()
12  *
13  * Return one or more MX's for a mail destination.
14  *
15  * Upon success, it fills 'mxbuf' with one or more MX hosts, separated by
16  * vertical bar characters, and returns the number of hosts as its return
17  * value.  If no MX's are found, it returns 0.
18  *
19  */
20 int getmx(char *mxbuf, char *dest) {
21         char answer[1024];
22         int ret;
23         int i;
24
25
26         /* If we're configured to send all mail to a smart-host, then our
27          * job here is really easy.
28          */
29         if (1) {        /* FIX */
30                 strcpy(mxbuf, SMART_HOST);
31                 return(1);
32         }
33
34         /* No smart-host?  Look up the best MX for a site.
35          */
36         ret = res_query(
37                 dest,
38                 C_IN, T_MX, answer, sizeof(answer)  );
39
40         lprintf(9, "res_query() returned %d\n", ret);
41         return(0); /* FIX not yet working!! */
42 }