ze-filter  (ze-filter-0.8.0-develop-180218)
mlfi_connect.c
Go to the documentation of this file.
1 
2 /*
3  *
4  * ze-filter - Mail Server Filter for sendmail
5  *
6  * Copyright (c) 2001-2018 - Jose-Marcio Martins da Cruz
7  *
8  * Auteur : Jose Marcio Martins da Cruz
9  * jose.marcio.mc@gmail.org
10  *
11  * Historique :
12  * Creation : janvier 2002
13  *
14  * This program is free software, but with restricted license :
15  *
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * More details about ze-filter license can be found at ze-filter
22  * web site : http://foss.jose-marcio.org
23  */
24 
25 
26 /* ****************************************************************************
27  * *
28  * *
29  ******************************************************************************/
30 
31 #define CHECK_SM_MAC_DEF(value, label, id) \
32  do \
33  { \
34  if (value == NULL) { \
35  static int nb = 0; \
36  if (nb++ < 32) \
37  ZE_MessageWarning(10, "%s : %s macro value is NULL" \
38  " - maybe undefined at MTA configuration", \
39  STREMPTY(id, "NOID"), \
40  label); \
41  } \
42  } while (0)
43 
44 sfsistat
45 mlfi_connect(ctx, hostname, hostaddr)
46  SMFICTX *ctx;
47  char *hostname;
48  _SOCK_ADDR *hostaddr;
49 {
50  CTXPRIV_T *priv = NULL;
51  char ip[64];
52  char *ident = NULL;
53  time_t conn_id = time(NULL);
54  int res = SMFIS_CONTINUE;
55 
56  int res_resolve = RESOLVE_NULL;
57  int ip_class;
58  int serv_rate;
59  CONNID_T id;
60  int nb_open = 0;
61  char *mailserver = NULL;
62 
63  char *msg = NULL;
64 
65  char *client_name, *client_addr, *client_ptr, *client_resolve;
66 
68 
69  nb_open = count_connections(1);
70 
71  memset(&id, 0, sizeof (id));
72  memset(ip, 0, sizeof (ip));
73  new_conn_id(&id);
74 
76 
77  /*
78  ** Allocate contextual private data
79  */
80  priv = NULL;
81  priv = MLFIPRIV(ctx);
82  if (priv == NULL) {
83  priv = malloc(sizeof (CTXPRIV_T));
84  if (priv == NULL) {
85  ZE_LogSysError("malloc(priv) error");
86 
87  (void) jsmfi_setreply(ctx, "421", "4.5.1",
88  "I'm too busy now. Try again later !");
89  res = SMFIS_TEMPFAIL;
90 
91  goto error;
92  }
93  memset(priv, 0, sizeof (CTXPRIV_T));
94 
95  if (smfi_setpriv(ctx, priv) != MI_SUCCESS) {
96  FREE(priv);
97  ZE_LogMsgError(0, "smfi_setpriv(priv) error");
98 
99  (void) jsmfi_setreply(ctx, "421", "4.5.1",
100  "I'm too busy now. Try again later !");
101  res = SMFIS_TEMPFAIL;
102 
103  goto error;
104  }
105  } else {
106  static int nx = 0;
107 
108  if (nx++ < 10)
109  ZE_MessageInfo(10,
110  "private storage area already allocated for this connection");
111  }
112 
113 
115 
116  priv->conn_id = conn_id;
117  priv->id = id;
118 
119 #if HAVE_GETHRTIME
120  priv->t_open = gethrtime();
121 #else
122  priv->t_open = zeTime_ms();
123 #endif
124  priv->fd = -1;
125 
126 #if _FFR_DELAYED_REJECT
128 #endif
129 
130  /*
131  ** Create and update macro list
132  */
133  priv->sm = sm_macro_new();
134  sm_macro_update(ctx, priv->sm);
135 #if 0
136  sm_macro_log_all(CONNID_STR(priv->id), priv->sm);
137 #endif
138 
139 #if 1
140  client_name = sm_macro_get_str(priv->sm, "{client_name}");
141  client_addr = sm_macro_get_str(priv->sm, "{client_addr}");
142  client_ptr = sm_macro_get_str(priv->sm, "{client_ptr}");
143  client_resolve = sm_macro_get_str(priv->sm, "{client_resolve}");
144  ident = sm_macro_get_str(priv->sm, "_");
145 #else
146  client_name = smfi_getsymval(ctx, "{client_name}");
147  client_addr = smfi_getsymval(ctx, "{client_addr}");
148  client_ptr = smfi_getsymval(ctx, "{client_ptr}");
149  client_resolve = smfi_getsymval(ctx, "{client_resolve}");
150  ident = smfi_getsymval(ctx, "_");
151 #endif
152 
153  CHECK_SM_MAC_DEF(client_name, "{client_name}", CONNID_STR(priv->id));
154  CHECK_SM_MAC_DEF(client_addr, "{client_addr}", CONNID_STR(priv->id));
155  CHECK_SM_MAC_DEF(client_ptr, "{client_ptr}", CONNID_STR(priv->id));
156  CHECK_SM_MAC_DEF(client_resolve, "{client_resolve}", CONNID_STR(priv->id));
157  /*
158  * CHECK_SM_MAC_DEF(ident, "_ (ident)", CONNID_STR(priv->id));
159  */
160 
161  ident = STREMPTY(ident, hostname);
162  ident = STREMPTY(ident, client_name);
163  ident = STREMPTY(ident, client_addr);
164  ident = STREMPTY(ident, client_ptr);
165  ident = STREMPTY(ident, "unknown");
166 
167  mailserver = smfi_getsymval(ctx, "j");
168  mailserver = STREMPTY(mailserver, my_hostname);
169 
170  /*
171  ** Let's log connection...
172  */
173  {
174  char *name = NULL;
175  char *addr = NULL;
176  char buf[128];
177  char daemon[128];
178  char *dport, *dname, *daddr;
179 
180  name = STREMPTY(hostname, client_name);
181  name = STREMPTY(name, "unknown");
182  addr = STREMPTY(client_addr, "x.x.x.x");
183 
184  if (strlen(ident) == 0 || STRCASEEQUAL(ident, "unknown"))
185  snprintf(buf, sizeof (buf), "%s [%s]", name, addr);
186  else
187  snprintf(buf, sizeof (buf), "%s", ident);
188 
189  dport = sm_macro_get_str(priv->sm, "{daemon_port}");
190  dname = sm_macro_get_str(priv->sm, "{daemon_name}");
191 #if 1
192  daddr = sm_macro_get_str(priv->sm, "{if_addr}");
193  if (daddr == NULL)
194 #endif
195  daddr = sm_macro_get_str(priv->sm, "{daemon_addr}");
196 
197 #if 1
198  snprintf(daemon, sizeof (daemon), "%s:%s:%s", STREMPTY(dname, "-"),
199  STREMPTY(daddr, "-"), STREMPTY(dport, "-"));
200 #else
201  snprintf(daemon, sizeof (daemon), "%s:%s", STREMPTY(dname, "-"),
202  STREMPTY(dport, "-"));
203 #endif
204  if ((priv->daemon = strdup(daemon)) == NULL) {
205  ZE_LogSysError("strdup(%s) error", daemon);
206  }
207 
208  if (cf_get_int(CF_CLUSTER) == OPT_YES)
209  ZE_MessageNotice(9, "%s-%s : %s Connect from %s", CONNID_STR(priv->id),
210  mailserver, daemon, buf);
211  else
212  ZE_MessageNotice(9, "%s : %s Connect from %s", CONNID_STR(priv->id),
213  daemon, buf);
214  }
215 
216  if (client_addr != NULL && client_ptr != NULL) {
217  if (!STREQUAL(client_addr, "127.0.0.1")) {
218  if (STRCASEEQUAL(client_ptr, "localhost") ||
219  STRNCASEEQUAL(client_ptr, "localhost.", strlen("localhost."))) {
220  ZE_MessageNotice(9, "%s Fake localhost : ADDR=%s PTR=%s",
221  CONNID_STR(priv->id), client_addr, client_ptr);
222  }
223  }
224  }
225 
226  /*
227  ** Set more private data values
228  */
229  if ((ident != NULL) && ((priv->ident = strdup(ident)) == NULL)) {
230  ZE_LogSysError("strdup priv->ident error (%s)", CONNID_STR(priv->id));
231  res = SMFIS_TEMPFAIL;
232  log_msg_context(ctx, "Can't allocate memory for ident value");
233 
234  goto fin;
235  }
236 
237  if ((mailserver != NULL) && ((priv->mailserver = strdup(mailserver)) == NULL)) {
238  ZE_LogSysError("strdup priv->mailserver error (%s)", CONNID_STR(priv->id));
239  res = SMFIS_TEMPFAIL;
240  log_msg_context(ctx, "Can't allocate memory for mailserver value");
241 
242  goto fin;
243  }
244 
245  /*
246  ** Let's check callback parameter values
247  */
248  if (hostname == NULL || strlen(hostname) == 0) {
249  char *name = NULL;
250  char *addr = NULL;
251  char *ptr = NULL;
252 
253  name = STRNULL(client_name, "unknown");
254  addr = STRNULL(client_addr, "unknown");
255  ptr = STRNULL(client_ptr, "unknown");
256 
257  (void) jsmfi_setreply(ctx, "421", "4.5.1",
258  "Can't get your hostname. Try again later !");
259  res = SMFIS_TEMPFAIL;
260 
262  ZE_MessageInfo(9,
263  "%s %s : hostname parameter NULL : name=%s addr=%s ptr=%s",
264  CONNID_STR(priv->id), ident, name, addr, ptr);
265 
266  goto fin;
267  }
268 
269  if (hostaddr == NULL) {
270  char *name = NULL;
271  char *addr = NULL;
272  char *ptr = NULL;
273 
274  name = STRNULL(client_name, "unknown");
275  addr = STRNULL(client_addr, "unknown");
276  ptr = STRNULL(client_ptr, "unknown");
277 
278  (void) jsmfi_setreply(ctx, "421", "4.5.1",
279  "Can't get your IP address. Try again later !");
280  res = SMFIS_TEMPFAIL;
281 
282  log_msg_context(ctx, "Can't get client IP address");
283  ZE_MessageInfo(9,
284  "%s %s : hostname parameter NULL : name=%s addr=%s ptr=%s",
285  CONNID_STR(priv->id), ident, name, addr, ptr);
286 
287  goto fin;
288  }
289 
290  /*
291  ** Let's handle client_resolve result
292  */
293  {
294  ZE_MessageInfo(15, "%s Let's get {client_resolve} value",
295  CONNID_STR(priv->id));
296 
297  res_resolve = RESOLVE_NULL;
298  if (client_resolve != NULL) {
299  if (strcasecmp(client_resolve, "OK") == 0)
300  res_resolve = RESOLVE_OK;
301  else if (strcasecmp(client_resolve, "FAIL") == 0)
302  res_resolve = RESOLVE_FAIL;
303  else if (strcasecmp(client_resolve, "FORGED") == 0)
304  res_resolve = RESOLVE_FORGED;
305  else if (strcasecmp(client_resolve, "TEMPFAIL") == 0)
306  res_resolve = RESOLVE_TEMPFAIL;
307  else if (strcasecmp(client_resolve, "TEMP") == 0)
308  res_resolve = RESOLVE_TEMPFAIL;
309  else
310  ZE_MessageWarning(9, "%s {client_resolve} returned %s",
311  CONNID_STR(priv->id), client_resolve);
312  }
313  ZE_MessageInfo(15, "%s Resolve result : %s %s", CONNID_STR(priv->id),
314  STRNULL(client_addr, "unknown"), STRNULL(client_resolve,
315  ""));
316  priv->resolve_res = res_resolve;
317  }
318 
319  /*
320  ** Let's get peer IP address
321  */
322  {
323  sa_family_t addr_family = AF_INET;
324 
325  /*
326  * TO BE DONE - check this against others --- IPV6
327  */
328  addr_family = hostaddr->sa_family;
329  priv->addr_family = addr_family;
330  switch (addr_family) {
331  case AF_INET:
332  {
333  struct sockaddr_in *sin = (struct sockaddr_in *) hostaddr;
334 
335  if (!jinet_ntop(AF_INET, &sin->sin_addr, ip, sizeof (ip))) {
336  ZE_MessageError(8, "%08lX mlfi_connect : inet_ntop : %s", conn_id,
337  strerror(errno));
338  (void) jsmfi_setreply(ctx, "421", "4.5.1",
339  "Unknown network error. Try again later !");
340  res = SMFIS_TEMPFAIL;
341  log_msg_context(ctx, "Can't convert client address (inet_ntop)");
342  goto fin;
343  }
344  }
345  break;
346 
347  case AF_INET6:
348  {
349  struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) hostaddr;
350 
351  if (!jinet_ntop(AF_INET6, &sin6->sin6_addr, ip, sizeof (ip))) {
352  ZE_MessageError(8, "%08lX mlfi_connect : inet_ntop : %s", conn_id,
353  strerror(errno));
354  (void) jsmfi_setreply(ctx, "421", "4.5.1",
355  "Unknown network error. Try again later !");
356  res = SMFIS_TEMPFAIL;
357  log_msg_context(ctx, "Can't convert client address (inet_ntop)");
358  goto fin;
359  }
360  }
361  break;
362  default:
363  ZE_MessageWarning(10, "%s : Unknown address family : %d",
364  CONNID_STR(priv->id), addr_family);
365  break;
366  }
367  priv->addr_family = addr_family;
368  ZE_MessageInfo(11, "%s Got IP : %s : family %d", CONNID_STR(priv->id), ip,
369  addr_family);
370  }
371 
372  if ((strlen(ip) > 0) && ((priv->peer_addr = strdup(ip)) == NULL)) {
373  ZE_LogSysError("strdup priv->ip error (%s)", CONNID_STR(priv->id));
374  res = SMFIS_TEMPFAIL;
375 
376  log_msg_context(ctx, "Internal filter error");
377 
378  goto fin;
379  }
380 
381  /*
382  ** Update address resolve cache
383  */
385  if (strlen(ip) > 0 && strlen(hostname) > 0)
386  resolve_cache_add("PTR", ip, hostname);
387  }
388 
389  /*
390  ** Let's get peer host name
391  */
392  {
393  char *name = NULL;
394  char tname[64];
395 
396  FREE(priv->peer_name);
397 
398  memset(tname, 0, sizeof (tname));
399 
400  name = sm_macro_get_str(priv->sm, "{client_name}");
401  if (name == NULL || strlen(name) == 0) {
402  ZE_MessageInfo(11, "%-15s Can't get {client_name} macro value for : %-6s",
403  CONNID_STR(priv->id), ip);
404  name = hostname;
405  }
406  if (name == NULL || strlen(name) == 0) {
407  ZE_MessageInfo(11, "%-15s Can't get hostname parameter value for : %-6s",
408  CONNID_STR(priv->id), ip);
409  name = sm_macro_get_str(priv->sm, "{client_ptr}");
410  }
411  if (name == NULL || strlen(name) == 0) {
412  ZE_MessageInfo(11, "%-15s Can't get {client_ptr} macro value for : %-6s",
413  CONNID_STR(priv->id), ip);
414  }
415 
416  if (name != NULL && STRCASEEQUAL(name, "unknown")) {
417  snprintf(tname, sizeof (tname), "[%s]", priv->peer_addr);
418  name = tname;
419  priv->resolve_res = res_resolve = RESOLVE_FAIL;
420  }
421 
422  if ((priv->peer_name = strdup(name)) == NULL) {
423  ZE_LogSysError("strdup({client_ptr}) (%s)", CONNID_STR(priv->id));
424  res = SMFIS_TEMPFAIL;
425  log_msg_context(ctx, "Internal filter error");
426 
427  goto fin;
428  }
429 
430  if (priv->peer_name == NULL) {
431  ZE_LogMsgError(0, "%s Can't get peer hostname", CONNID_STR(priv->id));
432  res = SMFIS_TEMPFAIL;
433  log_msg_context(ctx, "Internal filter error");
434 
435  goto fin;
436  }
437  }
438 
439  /*
440  **Check if hostname is valid
441  */
442 #if 0
443 #define HOSTNAME_IPV4 "[[]?[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+[]]?"
444 #define HOSTNAME_IPV6 "[[]?(ipv6:)?[0-9a-z:]+"
445 
446  if (res != SMFIS_CONTINUE || IS_KNOWN(ip_class))
447  goto hostname_check_ok;
448  if (zeStrRegex(priv->peer_name, HOSTNAME_IPV4, NULL, NULL, TRUE))
449  goto hostname_check_ok;
450  if (zeStrRegex(priv->peer_name, HOSTNAME_IPV6, NULL, NULL, TRUE))
451  goto hostname_check_ok;
452 
453  {
454  bool badname = FALSE;
455 
456  badname = zeStrRegex(priv->peer_name, "[^a-z0-9.-]+", NULL, NULL, TRUE);
457  if (badname) {
459  ZE_MessageInfo(9, "%s SPAM CHECK - Invalid priv->peer_name %s",
460  CONNID_STR(priv->id), priv->peer_name);
461  if (0) {
462  ZE_MessageInfo(9, "%s - %s Invalid hostname %s",
463  CONNID_STR(priv->id), priv->peer_addr, priv->peer_name);
464 
465  (void) jsmfi_setreply(ctx, "421", "4.5.1", "Invalid priv->peer_name !");
466  res = SMFIS_TEMPFAIL;
467  log_msg_context(ctx, "Invalid client hostname");
468 
469  goto fin;
470  }
471  }
472  }
473 
474 hostname_check_ok:
475 #endif
476 
477  /*
478  ** Let's check network class
479  */
480  {
481  char class[64];
482 
483  memset(class, 0, sizeof (class));
484  ip_class = GetClientNetClass(ip, hostname, NULL, class, sizeof (class));
485  priv->netclass.class = ip_class;
486 
487  if (strlen(class) == 0) {
488  char *p = NULL;
489 
490  p = NET_CLASS_LABEL(ip_class);
491  if (p != NULL)
492  strlcpy(priv->netclass.label, p, sizeof (priv->netclass.label));
493  } else
494  strlcpy(priv->netclass.label, class, sizeof (priv->netclass.label));
495  }
496 
497  if (IS_UNKNOWN(ip_class) && strlen(priv->netclass.label) == 0) {
498  if (check_iprbwl_table(CONNID_STR(priv->id), ip, hostname, &priv->rbwl) !=
499  0) {
500  ZE_MessageInfo(12,
501  "%s RBWL check list=(%s) code=(%s) class=(%s) addr=(%s) name=(%s)",
502  CONNID_STR(priv->id), priv->rbwl.rbwl, priv->rbwl.code,
503  priv->rbwl.netclass, ip, hostname);
504 
505  strlcpy(priv->netclass.label, priv->rbwl.netclass,
506  sizeof (priv->netclass.label));
507 
508  if (STRCASEEQUAL(priv->netclass.label, "LOCAL")) {
509  priv->netclass.class = NET_LOCAL;
510  ip_class = NET_LOCAL;
511  }
512  if (STRCASEEQUAL(priv->netclass.label, "DOMAIN")) {
513  priv->netclass.class = NET_DOMAIN;
514  ip_class = NET_DOMAIN;
515  }
516  if (STRCASEEQUAL(priv->netclass.label, "FRIEND")) {
517  priv->netclass.class = NET_FRIEND;
518  ip_class = NET_FRIEND;
519  }
520  }
521  }
522 
523  if (STRCASEEQUAL(priv->netclass.label, "UNKNOWN")) {
524  char *p = NULL;
525 
526  switch (priv->resolve_res) {
527  case RESOLVE_FAIL:
529  break;
530  case RESOLVE_FORGED:
532  break;
533  default:
534  break;
535  }
536  if (p != NULL && strlen(p) > 0)
537  strlcpy(priv->netclass.label, p, sizeof (priv->netclass.label));
538  }
539  {
540  static int n = 0;
541 
542  if (n++ < 1000)
543  ZE_MessageInfo(11, "%s : %15s %-17s %s", CONNID_STR(priv->id),
544  priv->netclass.label, ip, hostname);
545  }
546 
547  /*
548  ** Let's udpate Throttle computation data
549  */
550  serv_rate = smtprate_add_entry(RATE_CONN, ip, hostname, 1, conn_id);
551  priv->serv_rate = serv_rate;
552  ZE_MessageInfo(15, "%s Server connection rate : %d", CONNID_STR(priv->id),
553  serv_rate);
554 
555  /*
556  ** Check global CPU load
557  */
558  res = check_cpu_load(ctx, CONNID_STR(priv->id), ip, ip_class);
559  if (res != SMFIS_CONTINUE) {
560  (void) jsmfi_setreply(ctx, "421", "4.5.1",
561  "I'm too busy. Try again later !");
562 
563  log_msg_context(ctx, "Server CPU load too high");
564 
565  goto fin;
566  }
567 
568  /*
569  ** Check number of open connections
570  */
571  res = check_filter_open_connections(ctx, CONNID_STR(priv->id), ip, ip_class);
572  if (res != SMFIS_CONTINUE) {
573  (void) jsmfi_setreply(ctx, "421", "4.5.1",
574  "I'm too busy. Try again later !");
575 
576  log_msg_context(ctx, "Simultaneous open connections too high");
577 
578  goto fin;
579  }
580 
581  /*
582  ** Let's check the number of file descriptors in use
583  */
584  {
585  int fd_check_res;
586 
587  fd_check_res = check_file_descriptors();
588  if (fd_check_res != 0) {
589  switch (fd_check_res) {
590  case FD_LEVEL_OK:
591  break;
592  case FD_LEVEL_SHORT:
593  if (!IS_LOCAL(ip_class) && !IS_DOMAIN(ip_class))
594  res = SMFIS_TEMPFAIL;
595  break;
596  case FD_LEVEL_HI:
597  res = SMFIS_TEMPFAIL;
598  break;
599  default:
600  break;
601  }
602 
603  /*
604  * shall remark that smfi_setreply doesn't work at mlfi_connect step
605  */
606  if (res != SMFIS_CONTINUE) {
607  (void) jsmfi_setreply(ctx, "421", "4.5.1",
608  "I'm too busy. Try again later !");
609  log_msg_context(ctx, "Too many file descriptors in use");
610 
611  goto fin;
612  }
613  }
614  }
615 
616  /*
617  ** Let's check open connections for this address
618  */
619  priv->nb_open = connopen_check_host(ip, hostname, 1);
620 
621 #if _FFR_MODULES
622  /*
623  ** ze-filter modules
624  **
625  */
626  if (do_module_callback(ctx, 0, &res))
627  goto fin;
628  if (res != SMFIS_CONTINUE)
629  goto fin;
630 #endif /* _FFR_MODULES */
631 
632 
633  /*
634  * return at connection call ????
635  */
636  if (res == SMFIS_CONTINUE && ctx != NULL)
637  res = validate_connection(ctx);
638 
639  if (res != SMFIS_CONTINUE)
640  goto fin;
641 
642  /*
643  ** That's all folks !
644  */
645 
646  goto fin;
647 
648 error:
649  /*
650  * with cleanup after error
651  */
652  if (res != SMFIS_CONTINUE)
653  log_msg_context(ctx, STRNULL(msg, "UNKNOWN REASON"));
654 
655 fin:
656  /*
657  * without cleanup after error
658  */
659 
661 
662 
663  /*
664  * continue processing
665  */
666  return res;
667 }
#define CF_RESOLVE_CACHE_ENABLE
Definition: cfh-defs.h:84
char rbwl[64]
Definition: ze-dns-iprbwl.h:36
int smtprate_add_entry(int, char *, char *, int, time_t)
Definition: ze-smtprate.c:363
#define NET_DOMAIN
Definition: ze-netclass.h:34
bool resolve_cache_add(char *prefix, char *key, char *value)
void stats_inc(int, long)
Definition: ze-stats.c:401
#define CALLBACK_CONNECT
Definition: ze-callback.h:28
#define SMFIS_TEMPFAIL
char code[64]
Definition: ze-dns-iprbwl.h:38
int jsmfi_setreply(SMFICTX *, char *, char *, char *)
Definition: ze-libmilter.c:99
#define FREE(x)
Definition: macros.h:37
#define CF_RESOLVE_FAIL_NETCLASS
Definition: cfh-defs.h:188
char * peer_addr
uint64_t zeTime_ms()
Definition: zeTime.c:34
#define STRNULL(x, r)
Definition: macros.h:81
#define STRNCASEEQUAL(a, b, n)
Definition: macros.h:75
time_t conn_id
#define FD_LEVEL_HI
Definition: ze-resource.h:34
int GetClientNetClass(char *ip, char *name, netclass_T *class, char *label, size_t sz)
Definition: ze-netclass.c:49
#define FALSE
Definition: macros.h:160
#define SMFIS_CONTINUE
#define strlcpy
Definition: zeString.h:32
#define IS_LOCAL(class)
Definition: ze-netclass.h:46
#define ZE_LogMsgError(level,...)
Definition: zeSyslog.h:113
bool zeStrRegex(char *, char *, long *, long *, bool)
Definition: zeStrings.c:544
#define STREQUAL(a, b)
Definition: macros.h:78
#define RESOLVE_TEMPFAIL
Definition: ze-filter.h:174
#define OPT_YES
Definition: ze-cf.h:45
#define RESOLVE_FORGED
Definition: ze-filter.h:173
#define CF_LOG_LEVEL_ORACLE
Definition: cfh-defs.h:126
#define NET_FRIEND
Definition: ze-netclass.h:35
sm_mac_T * sm_macro_new()
Definition: ze-smmacros.c:114
sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
Definition: mlfi_connect.c:45
int cf_get_int(int id)
Definition: ze-cf.c:803
#define MLFIPRIV(ctx)
#define INIT_CALLBACK(p, which)
Definition: ze-filter.c:125
#define MSG_NO_PEER_HOSTNAME
Definition: ze-reply.h:53
#define FREE_DELAYED_RESULT(dres)
Definition: ze-filter.c:171
sa_family_t addr_family
char my_hostname[]
Definition: ze-filter.c:89
void sm_macro_update(SMFICTX *, sm_mac_T *)
Definition: ze-smmacros.c:150
CONNID_T id
int count_connections(int)
Definition: ze-filter.c:300
char * mailserver
#define IS_KNOWN(class)
Definition: ze-netclass.h:50
#define ZE_MessageNotice(level,...)
Definition: zeSyslog.h:91
#define INIT_CALLBACK_DELAY()
Definition: ze-filter.c:135
#define FD_LEVEL_SHORT
Definition: ze-resource.h:33
char netclass[20]
Definition: ze-dns-iprbwl.h:39
iprbwl_T rbwl
#define RESOLVE_OK
Definition: ze-filter.h:171
#define IS_UNKNOWN(class)
Definition: ze-netclass.h:51
time_t t_open
#define ZE_MessageInfo(level,...)
Definition: zeSyslog.h:90
#define NET_LOCAL
Definition: ze-netclass.h:33
#define IS_DOMAIN(class)
Definition: ze-netclass.h:45
char * daemon
#define FD_LEVEL_OK
Definition: ze-resource.h:32
#define TRUE
Definition: macros.h:157
#define ZE_MessageWarning(level,...)
Definition: zeSyslog.h:92
int check_file_descriptors(void)
Definition: ze-resource.c:189
#define CF_CLUSTER
Definition: cfh-defs.h:58
dresult_T delayed_result
#define ZE_LogSysError(...)
Definition: zeSyslog.h:129
#define ZE_MessageError(level,...)
Definition: zeSyslog.h:93
char * cf_get_str(int id)
Definition: ze-cf.c:854
sfsistat validate_connection(SMFICTX *)
#define STREMPTY(x, r)
Definition: macros.h:82
char * peer_name
#define CF_RESOLVE_FORGED_NETCLASS
Definition: cfh-defs.h:189
int connopen_check_host(char *, char *, int)
Definition: ze-connopen.c:151
bool do_module_callback(SMFICTX *ctx, int step, int *result)
Definition: ze-mod-tools.c:84
char * ident
#define STAT_CONNECT
Definition: ze-stats.h:29
sm_mac_T * sm
#define CONNID_STR(connid)
Definition: ze-filter.h:113
#define CHECK_CALLBACK_DELAY()
Definition: ze-filter.c:146
#define STRCASEEQUAL(a, b)
Definition: macros.h:72
void sm_macro_log_all(char *id, sm_mac_T *sm)
Definition: ze-smmacros.c:229
netclass_T netclass
uint32_t check_iprbwl_table(char *id, char *ip, char *name, iprbwl_T *rbwl)
char label[32]
Definition: ze-netclass.h:72
char * sm_macro_get_str(sm_mac_T *, char *)
Definition: ze-smmacros.c:191
#define NET_CLASS_LABEL(class)
Definition: ze-netclass.h:57
#define CHECK_SM_MAC_DEF(value, label, id)
Definition: mlfi_connect.c:31
void log_msg_context(SMFICTX *ctx, char *why)
char * jinet_ntop(int, void *, char *, size_t)
Definition: ze-inet.c:34
int msg[MAX_SCORE+2]
Definition: ze-stats.c:41
#define RESOLVE_NULL
Definition: ze-filter.h:170
#define RATE_CONN
Definition: ze-smtprate.h:51
#define RESOLVE_FAIL
Definition: ze-filter.h:172