diff options
-rw-r--r-- | contrib/exim/local_scan.c | 122 | ||||
-rw-r--r-- | src/client/rspamc.c | 2 | ||||
-rw-r--r-- | src/rspamadm/configdump.c | 2 | ||||
-rw-r--r-- | src/rspamadm/confighelp.c | 2 | ||||
-rw-r--r-- | src/rspamadm/configtest.c | 2 | ||||
-rw-r--r-- | src/rspamadm/control.c | 8 | ||||
-rw-r--r-- | src/rspamadm/dkim_keygen.c | 2 | ||||
-rw-r--r-- | src/rspamadm/fuzzy_convert.c | 8 | ||||
-rw-r--r-- | src/rspamadm/lua_repl.c | 2 | ||||
-rw-r--r-- | src/rspamadm/pw.c | 2 | ||||
-rw-r--r-- | src/rspamadm/rspamadm.c | 2 | ||||
-rw-r--r-- | src/rspamadm/signtool.c | 58 | ||||
-rw-r--r-- | src/rspamadm/stat_convert.c | 2 | ||||
-rw-r--r-- | src/rspamd.c | 2 | ||||
-rw-r--r-- | test/rspamd_test_suite.c | 2 | ||||
-rw-r--r-- | utils/rspamd_http_bench.c | 2 | ||||
-rw-r--r-- | utils/rspamd_http_server.c | 2 |
17 files changed, 111 insertions, 111 deletions
diff --git a/contrib/exim/local_scan.c b/contrib/exim/local_scan.c index 1ac52f52a..42cd5adf8 100644 --- a/contrib/exim/local_scan.c +++ b/contrib/exim/local_scan.c @@ -1,26 +1,26 @@ /* - This program is RSPAMD agent for use with + This program is RSPAMD agent for use with exim (http://www.exim.org) MTA by its local_scan feature. To enable exim local scan please copy this file to exim source tree - Local/local_scan.c, edit Local/Makefile to add - - LOCAL_SCAN_SOURCE=Local/local_scan.c + Local/local_scan.c, edit Local/Makefile to add + + LOCAL_SCAN_SOURCE=Local/local_scan.c LOCAL_SCAN_HAS_OPTIONS=yes - - and compile exim. - + + and compile exim. + Comment out RSPAM_UNIXSOCKET definition below if you have remote RSPAMD daemon - + AND - + use Exim parameters daemonIP and daemonPort to configure remote RSPAMD daemon. - - For exim compilation with local scan feature details please visit + + For exim compilation with local scan feature details please visit http://www.exim.org/exim-html-4.50/doc/html/spec_toc.html#TOC333 - + For RSPAMD details please visit http://rspamd.sourceforge.net */ @@ -62,13 +62,13 @@ static uschar *temp_dir = US"/var/tmp"; static uschar *socket_name = US"/var/run/rspamd.sock"; static int strange = 0; -optionlist local_scan_options[] = -{ - {"rspam_ip", opt_stringptr, &daemonIP}, +optionlist local_scan_options[] = +{ + {"rspam_ip", opt_stringptr, &daemonIP}, {"rspam_port", opt_int, &daemonPort}, {"rspam_tmp", opt_stringptr, &temp_dir}, {"rspam_sock", opt_stringptr, &socket_name}, - + }; int local_scan_options_count = sizeof (local_scan_options) / sizeof (optionlist); @@ -107,9 +107,9 @@ static int ReadFd (int iFdMsg, int fd) char psMsg [MAX_SIZE_FILE]; /* max size SO can swallow */ int iLen, result = _OK; - if ((iLen = read (fd, psMsg, sizeof (psMsg))) > 0) + if ((iLen = read (fd, psMsg, sizeof (psMsg))) > 0) { - if (write (iFdMsg, psMsg, (unsigned int) iLen) != iLen) + if (write (iFdMsg, psMsg, (unsigned int) iLen) != iLen) result = ERR_WRITE; } else @@ -123,7 +123,7 @@ static int ReadFd (int iFdMsg, int fd) void CleanupInp (char *sName) { - if (sName) unlink (sName); + if (sName) unlink (sName); close (iFdInp); return; @@ -180,7 +180,7 @@ static int written (socket_t fd, const char *vptr, int n) size_t nleft; int nwritten; const char *ptr; - + ptr = vptr; nleft = n; while (nleft > 0) @@ -192,11 +192,11 @@ static int written (socket_t fd, const char *vptr, int n) else return (-1); } - + nleft -= nwritten; ptr += nwritten; } - + return (n); } @@ -212,22 +212,22 @@ static int SendEnvelope (char *sFile) log_write (0, LOG_MAIN, "rspam-exim: file %s is great %d bytes", sFile, MAX_SIZE_FILE); return ERR_WRITE; } - + /* send greeting */ // if(FakeSMTPCommand(sock, "PROCESS", "RSPAMC/1.0", sFile, 1, 0) != _OK) // return ERR_WRITE; if(FakeSMTPCommand(sock, "SYMBOLS", "RSPAMC/1.1", sFile, 1, 0) != _OK) // if(FakeSMTPCommand(sock, "CHECK", "RSPAMC/1.0", sFile, 1, 0) != _OK) return ERR_WRITE; - - + + /* sender IP */ if (FakeSMTPCommand (sock, "IP:", sender_host_address, sFile, 1, 0) != _OK) return ERR_WRITE; /* mail from */ - if (FakeSMTPCommand (sock, "From:", + if (FakeSMTPCommand (sock, "From:", strlen (sender_address) == 0 ? "MAILER-DAEMON" : (char*) sender_address, sFile, 1, 0) != _OK) return ERR_WRITE; @@ -244,7 +244,7 @@ static int SendEnvelope (char *sFile) sprintf(str, "%d", recipients_count); if (FakeSMTPCommand (sock, "Recipient-Number:", str, sFile, 1, 0) != _OK) return ERR_WRITE; - + /* envelope rcpto */ for (i = 0; i < recipients_count; i ++) { @@ -262,7 +262,7 @@ static int SendEnvelope (char *sFile) if (FakeSMTPCommand (sock, "\r\n", "", sFile, 1, 0) != _OK) return ERR_WRITE; - + if (written (sock, psBuf, bytesRead) != bytesRead) return ERR_WRITE; } @@ -285,9 +285,9 @@ int GetFiles (char *pInpFile, int local_scan_fd) */ int iStatus; struct header_line *h_line; - + iFdInp = mOpenTmp ((char *)temp_dir, "sp-inp", pInpFile); - if (iFdInp == -1) + if (iFdInp == -1) { return ERR_WRITE; } @@ -301,7 +301,7 @@ int GetFiles (char *pInpFile, int local_scan_fd) h_line = h_line->next; continue; } - + if (write (iFdInp, h_line->text, strlen (h_line->text)) != strlen (h_line->text)) { CleanupInp (""); @@ -314,9 +314,9 @@ int GetFiles (char *pInpFile, int local_scan_fd) CleanupInp (""); return ERR_WRITE; } - + /* Read msg */ - if ((iStatus = ReadFd (iFdInp, local_scan_fd))) + if ((iStatus = ReadFd (iFdInp, local_scan_fd))) { return iStatus; } @@ -367,7 +367,7 @@ int GetAndTransferMessage (int fd, char *sFile) else break; } - + iStatus = SendEnvelope (sFile); if (iStatus != _OK) { @@ -375,7 +375,7 @@ int GetAndTransferMessage (int fd, char *sFile) close (sock); return iStatus; } - + /* fprintf (stderr, "Transmit OK\n"); */ return _OK; } @@ -392,11 +392,11 @@ void header_del (uschar *hdr) h_line = h_line->next; continue; } - + if (strncasecmp (h_line->text, hdr, strlen(hdr)) == 0) { h_line->type = '*'; - while (h_line->next && + while (h_line->next && (*h_line->next->text == ' ' || *h_line->next->text == '\t')) { h_line = h_line->next; @@ -413,7 +413,7 @@ void AlterSubject (char *label) char *subject, *strP; h_line = header_list; - + while (h_line != NULL) { if (h_line->type == '*') /* internal header */ @@ -421,7 +421,7 @@ void AlterSubject (char *label) h_line = h_line->next; continue; } - + if (strncasecmp (h_line->text, "Subject", strlen("Subject")) == 0) { strP = strchr (h_line->text, ':'); @@ -441,17 +441,17 @@ void AlterSubject (char *label) header_add (' ', "Subject: %s%s", label, subject ? subject : ""); } -int +int io_read(int fd, char *buf, size_t size) { int nfd, next = 0, rcount = 15; size_t len = 0; fd_set fds; struct timeval tv; - + if((sock < 0) || (buf == NULL)) return -1; - + FD_ZERO(&fds); repeat_read: @@ -459,7 +459,7 @@ repeat_read: tv.tv_sec = 5; tv.tv_usec = 0; FD_SET(fd, &fds); - + // log_write(0, LOG_MAIN, "rspam-exim: before select"); if((nfd=select(fd+1, &fds, NULL, NULL, &tv)) == -1) { @@ -468,11 +468,11 @@ repeat_read: } // log_write(0, LOG_MAIN, "rspam-exim: select return %d fds, rcount %d, next %d", nfd, rcount, next); - + if((nfd>0) && (FD_ISSET(fd, &fds))) { next += len = read(fd, buf + next, size - next); // log_write(0, LOG_MAIN, "rspam-exim: read %d bytes", len); -// if(next<size) +// if(next<size) // goto repeat_read; } rcount--; @@ -490,7 +490,7 @@ int WaitForScanResult (uschar **resStr) char *hdr = NULL, *hdrv = NULL, *spmStr = NULL, *symbols=NULL, *urls=NULL; char answ [4096], state[6], metric[128], back; float sm=0, smd=0, smr=0; - + memset (answ, '\0', sizeof (answ)); // log_write(0, LOG_MAIN, "rspam-exim: before read from %d", sock); // Len = read (sock, answ, sizeof (answ) - 1); @@ -524,12 +524,12 @@ int WaitForScanResult (uschar **resStr) continue; } - /* Metric: default; False; 6.00 / 10.00 */ + /* Metric: default; False; 6.00 / 10.00 */ /* Process metric */ if (strncmp (tok, "Metric:", 7) == 0) { tmp = tok; - while( (*tmp++) && + while( (*tmp++) && ((*tmp!='\r') || (*tmp!='\n')) ); back = *tmp; @@ -553,11 +553,11 @@ int WaitForScanResult (uschar **resStr) *tmp = back; continue; } - + if (strncmp (tok, "Symbol:", 7) == 0) { tmp = tok; - while( (*tmp++) && + while( (*tmp++) && ((*tmp!='\r') || (*tmp!='\n')) ); back = *tmp; @@ -581,14 +581,14 @@ int WaitForScanResult (uschar **resStr) if (strncmp (tok, "Urls:", 5) == 0) { tmp = tok; - while( (*tmp++) && + while( (*tmp++) && ((*tmp!='\r') || (*tmp!='\n')) ); back = *tmp; *tmp = '\0'; if(urf>0) { tok[0] = tok[1]= tok[2]= tok[3]= tok[4] = ' '; - urls = string_sprintf ("%s\n%s", urls, tok+3); + urls = string_sprintf ("%s\n%s", urls, tok+3); } else { tok += 5; while(*tok && isspace(*tok)) tok++; @@ -600,7 +600,7 @@ int WaitForScanResult (uschar **resStr) } } - + /* do not forget the symbols */ if (symbols != NULL && strlen(symbols)) { @@ -626,9 +626,9 @@ int WaitForScanResult (uschar **resStr) header_del ((uschar *) "X-Spam-Urls"); header_add (' ', "%s: %s\n", "X-Spam-Urls", urls); } - + log_write (0, LOG_MAIN, "rspam-exim: For message from %s will return %s, mailfrom: <%s>, rcpto: <%s>", sender_host_address, rej == 2 ? "DISCARD" : rej == 1 ? "REJECT" : "ACCEPT", sender_address, recipients_list[0].address); - + } else { @@ -638,7 +638,7 @@ int WaitForScanResult (uschar **resStr) if((sm>0) && (smr>0) && (sm>=smr)) { result = LOCAL_SCAN_REJECT; - } + } return result; } @@ -656,7 +656,7 @@ local_scan(int fd, uschar **return_text) if ((sock = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { log_write(0, LOG_MAIN, "rspam-exim: socket() failed"); - exit (1); + exit (EXIT_FAILURE); } memset (&ssun, '\0', sizeof (struct sockaddr_un)); ssun.sun_family = AF_UNIX; @@ -664,14 +664,14 @@ local_scan(int fd, uschar **return_text) { close (sock); log_write(0, LOG_MAIN, "rspam-exim: UNIX socket name %s too long", socket_name); - exit (1); + exit (EXIT_FAILURE); } strcpy (ssun.sun_path, socket_name); #else if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0) { log_write(0, LOG_MAIN, "rspam-exim: socket() failed"); - exit (1); + exit (EXIT_FAILURE); } memset (&ssin, '\0', sizeof (struct sockaddr_in)); ssin.sin_family = AF_INET; @@ -686,14 +686,14 @@ local_scan(int fd, uschar **return_text) SPOOL_DATA_START_OFFSET; return REJECT_ON_ERROR ? LOCAL_SCAN_TEMPREJECT:LOCAL_SCAN_ACCEPT; } - + retval = WaitForScanResult (return_text); if(!strange) unlink (sFileInp); close (sock); SPOOL_DATA_START_OFFSET; - + return retval; } diff --git a/src/client/rspamc.c b/src/client/rspamc.c index f5b1bae61..fb995288d 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -1727,7 +1727,7 @@ rspamc_process_input (struct ev_loop *ev_base, struct rspamc_command *cmd, else { rspamd_fprintf (stderr, "cannot connect to %s: %s\n", connect_str, strerror (errno)); - exit (-errno); + exit (EXIT_FAILURE); } g_free (hostbuf); diff --git a/src/rspamadm/configdump.c b/src/rspamadm/configdump.c index bbdb58c17..36ea7eca7 100644 --- a/src/rspamadm/configdump.c +++ b/src/rspamadm/configdump.c @@ -256,7 +256,7 @@ rspamadm_configdump (gint argc, gchar **argv, const struct rspamadm_command *cmd fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); diff --git a/src/rspamadm/confighelp.c b/src/rspamadm/confighelp.c index c40891216..77a60be7a 100644 --- a/src/rspamadm/confighelp.c +++ b/src/rspamadm/confighelp.c @@ -218,7 +218,7 @@ rspamadm_confighelp (gint argc, gchar **argv, const struct rspamadm_command *cmd rspamd_fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); diff --git a/src/rspamadm/configtest.c b/src/rspamadm/configtest.c index c11458e42..8e6b335a9 100644 --- a/src/rspamadm/configtest.c +++ b/src/rspamadm/configtest.c @@ -103,7 +103,7 @@ rspamadm_configtest (gint argc, gchar **argv, const struct rspamadm_command *cmd fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); diff --git a/src/rspamadm/control.c b/src/rspamadm/control.c index 7bf2a3145..4a660492e 100644 --- a/src/rspamadm/control.c +++ b/src/rspamadm/control.c @@ -186,14 +186,14 @@ rspamadm_control (gint argc, gchar **argv, const struct rspamadm_command *_cmd) rspamd_fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); if (argc <= 1) { rspamd_fprintf (stderr, "command required\n"); - exit (1); + exit (EXIT_FAILURE); } cmd = argv[1]; @@ -220,13 +220,13 @@ rspamadm_control (gint argc, gchar **argv, const struct rspamadm_command *_cmd) } else { rspamd_fprintf (stderr, "unknown command: %s\n", cmd); - exit (1); + exit (EXIT_FAILURE); } if (!rspamd_parse_inet_address (&addr, control_path, strlen (control_path), RSPAMD_INET_ADDRESS_PARSE_DEFAULT)) { rspamd_fprintf (stderr, "bad control path: %s\n", control_path); - exit (1); + exit (EXIT_FAILURE); } diff --git a/src/rspamadm/dkim_keygen.c b/src/rspamadm/dkim_keygen.c index 64e71f36e..a1e7286ae 100644 --- a/src/rspamadm/dkim_keygen.c +++ b/src/rspamadm/dkim_keygen.c @@ -357,7 +357,7 @@ rspamadm_dkim_keygen (gint argc, gchar **argv, const struct rspamadm_command *cm fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); diff --git a/src/rspamadm/fuzzy_convert.c b/src/rspamadm/fuzzy_convert.c index 11386de65..b8d0c8d69 100644 --- a/src/rspamadm/fuzzy_convert.c +++ b/src/rspamadm/fuzzy_convert.c @@ -94,22 +94,22 @@ rspamadm_fuzzyconvert (gint argc, gchar **argv, const struct rspamadm_command *c rspamd_fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); if (!source_db) { rspamd_fprintf (stderr, "source db is missing\n"); - exit (1); + exit (EXIT_FAILURE); } if (!redis_host) { rspamd_fprintf (stderr, "redis host is missing\n"); - exit (1); + exit (EXIT_FAILURE); } if (!fuzzy_expiry) { rspamd_fprintf (stderr, "expiry is missing\n"); - exit (1); + exit (EXIT_FAILURE); } obj = ucl_object_typed_new (UCL_OBJECT); diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c index 945b5635c..3497a85b8 100644 --- a/src/rspamadm/lua_repl.c +++ b/src/rspamadm/lua_repl.c @@ -868,7 +868,7 @@ rspamadm_lua (gint argc, gchar **argv, const struct rspamadm_command *cmd) fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); diff --git a/src/rspamadm/pw.c b/src/rspamadm/pw.c index c8e59cbc4..c81c96a94 100644 --- a/src/rspamadm/pw.c +++ b/src/rspamadm/pw.c @@ -373,7 +373,7 @@ rspamadm_pw (gint argc, gchar **argv, const struct rspamadm_command *cmd) fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c index ae766aae6..0eef24404 100644 --- a/src/rspamadm/rspamadm.c +++ b/src/rspamadm/rspamadm.c @@ -435,7 +435,7 @@ main (gint argc, gchar **argv, gchar **env) fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } diff --git a/src/rspamadm/signtool.c b/src/rspamadm/signtool.c index 555937966..b236952e7 100644 --- a/src/rspamadm/signtool.c +++ b/src/rspamadm/signtool.c @@ -143,7 +143,7 @@ rspamadm_edit_file (const gchar *fname) if (fd_out == -1) { rspamd_fprintf (stderr, "cannot open %s: %s\n", fname, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } close (fd_out); @@ -154,7 +154,7 @@ rspamadm_edit_file (const gchar *fname) if (map == NULL) { rspamd_fprintf (stderr, "cannot open %s: %s\n", fname, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } } @@ -167,7 +167,7 @@ rspamadm_edit_file (const gchar *fname) if (fd_out == -1) { rspamd_fprintf (stderr, "cannot open tempfile %s: %s\n", tmppath, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } if (len > 0 && write (fd_out, map, len) == -1) { @@ -176,7 +176,7 @@ rspamadm_edit_file (const gchar *fname) unlink (tmppath); munmap (map, len); close (fd_out); - exit (errno); + exit (EXIT_FAILURE); } if (len > 0) { @@ -193,7 +193,7 @@ rspamadm_edit_file (const gchar *fname) rspamd_fprintf (stderr, "cannot exec %s: %e\n", editor, err); unlink (tmppath); - exit (errno); + exit (EXIT_FAILURE); } if (!g_spawn_async (NULL, child_argv, NULL, @@ -202,7 +202,7 @@ rspamadm_edit_file (const gchar *fname) rspamd_fprintf (stderr, "cannot exec %s: %e\n", editor, err); unlink (tmppath); - exit (errno); + exit (EXIT_FAILURE); } g_strfreev (child_argv); @@ -216,7 +216,7 @@ rspamadm_edit_file (const gchar *fname) rspamd_fprintf (stderr, "failed to wait for %s: %s\n", editor, strerror (errno)); unlink (tmppath); - exit (errno); + exit (EXIT_FAILURE); } } @@ -225,7 +225,7 @@ rspamadm_edit_file (const gchar *fname) unlink (tmppath); rspamd_fprintf (stderr, "%s returned error code: %d - %e\n", editor, retcode, err); - exit (retcode); + exit (EXIT_FAILURE); } #else if (retcode != 0) { @@ -242,7 +242,7 @@ rspamadm_edit_file (const gchar *fname) rspamd_fprintf (stderr, "cannot map %s: %s\n", tmppath, strerror (errno)); unlink (tmppath); - exit (errno); + exit (EXIT_FAILURE); } rspamd_snprintf (run_cmdline, sizeof (run_cmdline), "%s.new", fname); @@ -254,7 +254,7 @@ rspamadm_edit_file (const gchar *fname) strerror (errno)); unlink (tmppath); munmap (map, len); - exit (errno); + exit (EXIT_FAILURE); } if (write (fd_out, map, len) == -1) { @@ -264,7 +264,7 @@ rspamadm_edit_file (const gchar *fname) unlink (run_cmdline); close (fd_out); munmap (map, len); - exit (errno); + exit (EXIT_FAILURE); } unlink (tmppath); @@ -299,7 +299,7 @@ rspamadm_sign_file (const gchar *fname, struct rspamd_cryptobox_keypair *kp) if (fd_input == -1) { rspamd_fprintf (stderr, "cannot open %s: %s\n", fname, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } g_assert (fstat (fd_input, &st) != -1); @@ -311,7 +311,7 @@ rspamadm_sign_file (const gchar *fname, struct rspamd_cryptobox_keypair *kp) close (fd_input); rspamd_fprintf (stderr, "cannot open %s: %s\n", sigpath, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } map = mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fd_input, 0); @@ -321,7 +321,7 @@ rspamadm_sign_file (const gchar *fname, struct rspamd_cryptobox_keypair *kp) close (fd_sig); rspamd_fprintf (stderr, "cannot map %s: %s\n", fname, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } g_assert (rspamd_cryptobox_MAX_SIGBYTES >= @@ -337,7 +337,7 @@ rspamadm_sign_file (const gchar *fname, struct rspamd_cryptobox_keypair *kp) if (rename (sigpath, fname) == -1) { rspamd_fprintf (stderr, "cannot rename %s to %s: %s\n", sigpath, fname, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } unlink (sigpath); @@ -348,7 +348,7 @@ rspamadm_sign_file (const gchar *fname, struct rspamd_cryptobox_keypair *kp) if (write (fd_sig, sig, rspamd_cryptobox_signature_bytes (mode)) == -1) { rspamd_fprintf (stderr, "cannot write signature to %s: %s\n", sigpath, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } close (fd_sig); @@ -408,7 +408,7 @@ rspamadm_verify_file (const gchar *fname, const guchar *pk) if (fd_input == -1) { rspamd_fprintf (stderr, "cannot open %s: %s\n", fname, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } g_assert (fstat (fd_input, &st) != -1); @@ -420,7 +420,7 @@ rspamadm_verify_file (const gchar *fname, const guchar *pk) close (fd_input); rspamd_fprintf (stderr, "cannot open %s: %s\n", sigpath, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } map = mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fd_input, 0); @@ -430,7 +430,7 @@ rspamadm_verify_file (const gchar *fname, const guchar *pk) close (fd_sig); rspamd_fprintf (stderr, "cannot open %s: %s\n", sigpath, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } g_assert (fstat (fd_sig, &st_sig) != -1); @@ -440,7 +440,7 @@ rspamadm_verify_file (const gchar *fname, const guchar *pk) rspamd_fprintf (stderr, "invalid signature size %s: %ud\n", fname, (guint)st_sig.st_size); munmap (map, st.st_size); - exit (errno); + exit (EXIT_FAILURE); } map_sig = mmap (NULL, st_sig.st_size, PROT_READ, MAP_SHARED, fd_sig, 0); @@ -450,7 +450,7 @@ rspamadm_verify_file (const gchar *fname, const guchar *pk) munmap (map, st.st_size); rspamd_fprintf (stderr, "cannot map %s: %s\n", sigpath, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } ret = rspamd_cryptobox_verify (map_sig, st_sig.st_size, @@ -496,7 +496,7 @@ rspamadm_signtool (gint argc, gchar **argv, const struct rspamadm_command *cmd) rspamd_fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); @@ -507,11 +507,11 @@ rspamadm_signtool (gint argc, gchar **argv, const struct rspamadm_command *cmd) if (verify && (!pubkey && !pubkey_file)) { rspamd_fprintf (stderr, "no pubkey for verification\n"); - exit (1); + exit (EXIT_FAILURE); } else if (!verify && (!keypair_file)) { rspamd_fprintf (stderr, "no keypair for signing\n"); - exit (1); + exit (EXIT_FAILURE); } if (verify) { @@ -527,7 +527,7 @@ rspamadm_signtool (gint argc, gchar **argv, const struct rspamadm_command *cmd) if (fd == -1) { rspamd_fprintf (stderr, "cannot open %s: %s\n", pubkey_file, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } g_assert (fstat (fd, &st) != -1); @@ -539,7 +539,7 @@ rspamadm_signtool (gint argc, gchar **argv, const struct rspamadm_command *cmd) if (map == MAP_FAILED) { rspamd_fprintf (stderr, "cannot read %s: %s\n", pubkey_file, strerror (errno)); - exit (errno); + exit (EXIT_FAILURE); } /* XXX: assume base32 pubkey now */ @@ -555,7 +555,7 @@ rspamadm_signtool (gint argc, gchar **argv, const struct rspamadm_command *cmd) pubkey_file, (guint)flen, rspamd_cryptobox_pk_sig_bytes (mode)); - exit (errno); + exit (EXIT_FAILURE); } munmap (map, fsize); @@ -569,7 +569,7 @@ rspamadm_signtool (gint argc, gchar **argv, const struct rspamadm_command *cmd) pubkey_file, (guint)strlen (pubkey), rspamd_cryptobox_pk_sig_bytes (mode)); - exit (errno); + exit (EXIT_FAILURE); } } @@ -591,7 +591,7 @@ rspamadm_signtool (gint argc, gchar **argv, const struct rspamadm_command *cmd) (top = ucl_parser_get_object (parser)) == NULL) { rspamd_fprintf (stderr, "cannot load keypair: %s\n", ucl_parser_get_error (parser)); - exit (EINVAL); + exit (EXIT_FAILURE); } ucl_parser_free (parser); diff --git a/src/rspamadm/stat_convert.c b/src/rspamadm/stat_convert.c index cea366f76..38ce30a4d 100644 --- a/src/rspamadm/stat_convert.c +++ b/src/rspamadm/stat_convert.c @@ -129,7 +129,7 @@ rspamadm_statconvert (gint argc, gchar **argv, const struct rspamadm_command *cm rspamd_fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } g_option_context_free (context); diff --git a/src/rspamd.c b/src/rspamd.c index 978980706..987ac8c5c 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -178,7 +178,7 @@ read_cmd_line (gint *argc, gchar ***argv, struct rspamd_config *cfg) if (!g_option_context_parse (context, argc, argv, &error)) { fprintf (stderr, "option parsing failed: %s\n", error->message); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } cfg->rspamd_user = rspamd_user; diff --git a/test/rspamd_test_suite.c b/test/rspamd_test_suite.c index 7d0136708..8c0dc1c29 100644 --- a/test/rspamd_test_suite.c +++ b/test/rspamd_test_suite.c @@ -48,7 +48,7 @@ main (int argc, char **argv) if (!g_option_context_parse (context, &argc, &argv, &error)) { fprintf (stderr, "option parsing failed: %s\n", error->message); g_option_context_free (context); - exit (1); + exit (EXIT_FAILURE); } /* Setup logger */ diff --git a/utils/rspamd_http_bench.c b/utils/rspamd_http_bench.c index 14d2db4f9..030b0b4b6 100644 --- a/utils/rspamd_http_bench.c +++ b/utils/rspamd_http_bench.c @@ -335,7 +335,7 @@ main (int argc, char **argv) if (!g_option_context_parse (context, &argc, &argv, &error)) { rspamd_fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); - exit (1); + exit (EXIT_FAILURE); } rspamd_parse_inet_address (&addr, host, 0); diff --git a/utils/rspamd_http_server.c b/utils/rspamd_http_server.c index a1a91f599..f4b8e3b5f 100644 --- a/utils/rspamd_http_server.c +++ b/utils/rspamd_http_server.c @@ -264,7 +264,7 @@ main (int argc, gchar **argv) if (!g_option_context_parse (context, &argc, &argv, &error)) { rspamd_fprintf (stderr, "option parsing failed: %s\n", error->message); g_error_free (error); - exit (1); + exit (EXIT_FAILURE); } maps = g_hash_table_new (g_int_hash, g_int_equal); |