-int spam(uschar **listptr) {
- int sep = 0;
- uschar *list = *listptr;
- uschar *user_name;
- uschar user_name_buffer[128];
- unsigned long mbox_size;
- FILE *mbox_file;
- int spamd_sock;
- uschar spamd_buffer[32600];
- int i, j, offset, result;
- uschar spamd_version[8];
- uschar spamd_score_char;
- double spamd_threshold, spamd_score;
- int spamd_report_offset;
- uschar *p,*q;
- int override = 0;
- time_t start;
- size_t read, wrote;
- struct sockaddr_un server;
-#ifndef NO_POLL_H
- struct pollfd pollfd;
-#else /* Patch posted by Erik ? for OS X */
- struct timeval select_tv; /* and applied by PH */
- fd_set select_fd;
-#endif
- uschar *spamd_address_work;
-
- /* stop compiler warning */
- result = 0;
-
- /* find the username from the option list */
- if ((user_name = string_nextinlist(&list, &sep,
- user_name_buffer,
- sizeof(user_name_buffer))) == NULL) {
- /* no username given, this means no scanning should be done */
- return FAIL;
- };
-
- /* if username is "0" or "false", do not scan */
- if ( (Ustrcmp(user_name,"0") == 0) ||
- (strcmpic(user_name,US"false") == 0) ) {
- return FAIL;
- };
-
- /* if there is an additional option, check if it is "true" */
- if (strcmpic(list,US"true") == 0) {
- /* in that case, always return true later */
- override = 1;
- };
-
- /* expand spamd_address if needed */
- if (*spamd_address == '$') {
- spamd_address_work = expand_string(spamd_address);
- if (spamd_address_work == NULL) {
- log_write(0, LOG_MAIN|LOG_PANIC,
- "spamassassin acl condition: spamd_address starts with $, but expansion failed: %s", expand_string_message);
- return DEFER;
- }
+static const uschar * loglabel = US"spam acl condition:";
+
+
+static int
+spamd_param_init(spamd_address_container *spamd)
+{
+/* default spamd server weight, time and backup value */
+spamd->is_failed = FALSE;
+spamd->is_backup = FALSE;
+spamd->weight = SPAMD_WEIGHT;
+spamd->timeout = SPAMD_TIMEOUT;
+spamd->retry = 0;
+return 0;
+}
+
+
+static int
+spamd_param(const uschar *param, spamd_address_container *spamd)
+{
+static int timesinceday = -1;
+const uschar * s;
+const uschar * name;
+
+/* check backup parameter */
+if (Ustrcmp(param, "backup") == 0)
+ {
+ spamd->is_backup = TRUE;
+ return 0; /* OK */
+ }
+
+/*XXX more clever parsing could discard embedded spaces? */
+
+/* check weight parameter */
+if (sscanf(param, "weight=%u", &spamd->weight))
+ {
+ if (spamd->weight == 0) /* this server disabled: skip it */
+ return 1;
+ return 0; /* OK */