diff -urN ../exim-p0f3-dlfunc-0.1.orig/exim-p0f3-dlfunc.c ./exim-p0f3-dlfunc.c --- ../exim-p0f3-dlfunc-0.1.orig/exim-p0f3-dlfunc.c 2012-07-04 12:34:14.000000000 +0300 +++ ./exim-p0f3-dlfunc.c 2020-02-22 03:17:03.015245000 +0200 @@ -45,6 +45,19 @@ /* Exim4 dlfunc API header: */ #include "local_scan.h" +# define string_copy(s) string_copy_function(s) +# define string_copyn(s, n) string_copyn_function((s), (n)) +# define string_copy_taint(s, t) string_copy_taint_function((s), (t)) + +extern uschar * string_copy_function(const uschar *); +extern uschar * string_copyn_function(const uschar *, int n); +extern uschar * string_copy_taint_function(const uschar *, BOOL tainted); + +#define string_sprintf(fmt, ...) \ + string_sprintf_trc(fmt, US __FUNCTION__, __LINE__, __VA_ARGS__) +extern uschar *string_sprintf_trc(const char *, const uschar *, unsigned, ...) ALMOST_PRINTF(1,4); + + /***************************************************************************** * Configuration settings: *****************************************************************************/ @@ -140,7 +153,7 @@ return ERROR; } - if (strlen(argv[0]) >= sizeof sun.sun_path - 1) { /* - 1 for \0 */ + if (strlen((const char *)argv[0]) >= sizeof sun.sun_path - 1) { /* - 1 for \0 */ *yield = string_copy(US"Socket path is too long."); return ERROR; } @@ -163,19 +176,19 @@ s = socket(PF_UNIX, SOCK_STREAM, 0); if (s < 0) { - *yield = string_sprintf(US"Call to socket() failed" + *yield = string_sprintf("Call to socket() failed" " (errno = %d).", errno); return FAIL; } memset(&sun, 0, sizeof sun); sun.sun_family = AF_UNIX; - strcpy(sun.sun_path, argv[0]); + strcpy(sun.sun_path, (const char *)argv[0]); /* Note: We ignore sun.sun_len which only exists on some platforms. * It is poorly documented and ignored by most(?) OSes anyway. */ if (connect(s, (struct sockaddr *) &sun, sizeof sun) != 0) { - log_write(0, LOG_MAIN, US"p0f: Can't connect to API socket %s" + log_write(0, LOG_MAIN, "p0f: Can't connect to API socket %s" " (errno = %d)." " p0f daemon down or socket name incorrect?", argv[0], errno); @@ -192,11 +205,11 @@ if (ret != sizeof q) { if (ret < 0) log_write(0, LOG_MAIN, - US"p0f: Error %d writing to API socket.", + "p0f: Error %d writing to API socket.", errno); else log_write(0, LOG_MAIN, - US"p0f: Short write to API socket."); + "p0f: Short write to API socket."); *yield = string_copy(P0F_OS_LOOKUP_FAILED); close(s); @@ -209,11 +222,11 @@ if (ret != sizeof r) { if (ret < 0) log_write(0, LOG_MAIN, - US"p0f: Error %d reading from API socket.", + "p0f: Error %d reading from API socket.", errno); else log_write(0, LOG_MAIN, - US"p0f: Short read from API socket."); + "p0f: Short read from API socket."); *yield = string_copy(P0F_OS_LOOKUP_FAILED); close(s); @@ -224,13 +237,13 @@ /* check response status: */ if (r.magic != P0F3_RESP_MAGIC) { - log_write(0, LOG_MAIN, US"p0f: Bad response magic."); + log_write(0, LOG_MAIN, "p0f: Bad response magic."); *yield = string_copy(P0F_OS_LOOKUP_FAILED); return OK; } if (r.status == P0F3_STATUS_BADQUERY) { - log_write(0, LOG_MAIN, US"p0f: We were misunderstood."); + log_write(0, LOG_MAIN, "p0f: We were misunderstood."); *yield = string_copy(P0F_OS_LOOKUP_FAILED); return OK; }