if (mbox_file == NULL) {
/* error while spooling */
log_write(0, LOG_MAIN|LOG_PANIC,
if (mbox_file == NULL) {
/* error while spooling */
log_write(0, LOG_MAIN|LOG_PANIC,
while ((address = string_nextinlist(&spamd_address_list_ptr, &sep,
address_buffer,
sizeof(address_buffer))) != NULL) {
while ((address = string_nextinlist(&spamd_address_list_ptr, &sep,
address_buffer,
sizeof(address_buffer))) != NULL) {
spamd_address_container *this_spamd =
(spamd_address_container *)store_get(sizeof(spamd_address_container));
spamd_address_container *this_spamd =
(spamd_address_container *)store_get(sizeof(spamd_address_container));
/* grok spamd address and port */
if( sscanf(CS address, "%s %u", this_spamd->tcp_addr, &(this_spamd->tcp_port)) != 2 ) {
log_write(0, LOG_MAIN,
"spam acl condition: warning - invalid spamd address: '%s'", address);
continue;
};
/* grok spamd address and port */
if( sscanf(CS address, "%s %u", this_spamd->tcp_addr, &(this_spamd->tcp_port)) != 2 ) {
log_write(0, LOG_MAIN,
"spam acl condition: warning - invalid spamd address: '%s'", address);
continue;
};
/* check if we have at least one server */
if (!num_servers) {
log_write(0, LOG_MAIN|LOG_PANIC,
/* check if we have at least one server */
if (!num_servers) {
log_write(0, LOG_MAIN|LOG_PANIC,
debug_printf("trying server %s, port %u\n",
spamd_address_vector[current_server]->tcp_addr,
spamd_address_vector[current_server]->tcp_port);
debug_printf("trying server %s, port %u\n",
spamd_address_vector[current_server]->tcp_addr,
spamd_address_vector[current_server]->tcp_port);
/* contact a spamd */
if ( (spamd_sock = ip_socket(SOCK_STREAM, AF_INET)) < 0) {
log_write(0, LOG_MAIN|LOG_PANIC,
"spam acl condition: error creating IP socket for spamd");
fclose(mbox_file);
/* contact a spamd */
if ( (spamd_sock = ip_socket(SOCK_STREAM, AF_INET)) < 0) {
log_write(0, LOG_MAIN|LOG_PANIC,
"spam acl condition: error creating IP socket for spamd");
fclose(mbox_file);
if (ip_connect( spamd_sock,
AF_INET,
spamd_address_vector[current_server]->tcp_addr,
if (ip_connect( spamd_sock,
AF_INET,
spamd_address_vector[current_server]->tcp_addr,
log_write(0, LOG_MAIN|LOG_PANIC,
"spam acl condition: warning - spamd connection to %s, port %u failed: %s",
spamd_address_vector[current_server]->tcp_addr,
log_write(0, LOG_MAIN|LOG_PANIC,
"spam acl condition: warning - spamd connection to %s, port %u failed: %s",
spamd_address_vector[current_server]->tcp_addr,
/* we're done sending, close socket for writing */
shutdown(spamd_sock,SHUT_WR);
/* we're done sending, close socket for writing */
shutdown(spamd_sock,SHUT_WR);
/* read spamd response */
memset(spamd_buffer, 0, sizeof(spamd_buffer));
offset = 0;
/* read spamd response */
memset(spamd_buffer, 0, sizeof(spamd_buffer));
offset = 0;
/* dig in the spamd output and put the report in a multiline header, if requested */
if( sscanf(CS spamd_buffer,"SPAMD/%s 0 EX_OK\r\nContent-length: %*u\r\n\r\n%lf/%lf\r\n%n",
spamd_version,&spamd_score,&spamd_threshold,&spamd_report_offset) != 3 ) {
/* dig in the spamd output and put the report in a multiline header, if requested */
if( sscanf(CS spamd_buffer,"SPAMD/%s 0 EX_OK\r\nContent-length: %*u\r\n\r\n%lf/%lf\r\n%n",
spamd_version,&spamd_score,&spamd_threshold,&spamd_report_offset) != 3 ) {
/* try to fall back to pre-2.50 spamd output */
if( sscanf(CS spamd_buffer,"SPAMD/%s 0 EX_OK\r\nSpam: %*s ; %lf / %lf\r\n\r\n%n",
spamd_version,&spamd_score,&spamd_threshold,&spamd_report_offset) != 3 ) {
/* try to fall back to pre-2.50 spamd output */
if( sscanf(CS spamd_buffer,"SPAMD/%s 0 EX_OK\r\nSpam: %*s ; %lf / %lf\r\n\r\n%n",
spamd_version,&spamd_score,&spamd_threshold,&spamd_report_offset) != 3 ) {
/* remember user name and "been here" for it */
Ustrcpy(prev_user_name, user_name);
spam_ok = 1;
/* remember user name and "been here" for it */
Ustrcpy(prev_user_name, user_name);
spam_ok = 1;