-Wcast-qual Re: [PATCHES v4] Another round of FreeBSD developer build fixes

Uri Simchoni uri at samba.org
Sun Nov 26 17:41:47 UTC 2017


On 11/26/2017 05:21 AM, Timur I. Bakeyev via samba-technical wrote:
> And last, but not least set of errors that pop up are related to
> pam_winbind:
> 

I already have a fix for pam_winbind that meets the "no pragma" policy -
see attached. I just haven't gotten to testing it on Linux yet.

I'm still contemplating on the sysacls stuff which is the remaining issue.

Thanks,
Uri.
-------------- next part --------------
From 11dde0ea1714d3890e0d4b0e524db03d890b86fc Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Sun, 19 Nov 2017 13:14:14 +0000
Subject: [PATCH] pam_winbind: avoid non-literal-format warning

Signed-off-by: Uri Simchoni <uri at samba.org>
---
 nsswitch/pam_winbind.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 3723b17ad42..e14fcfeb263 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -174,6 +174,10 @@ static inline void textdomain_init(void)
 
 
 /* some syslogging */
+static void _pam_log_int(const pam_handle_t *pamh,
+			 int err,
+			 const char *format,
+			 va_list args) PRINTF_ATTRIBUTE(3, 0);
 
 #ifdef HAVE_PAM_VSYSLOG
 static void _pam_log_int(const pam_handle_t *pamh,
@@ -189,21 +193,26 @@ static void _pam_log_int(const pam_handle_t *pamh,
 			 const char *format,
 			 va_list args)
 {
-	char *format2 = NULL;
+	char *base = NULL;
+	va_list args2;
 	const char *service;
 	int ret;
 
+	va_copy(args2, args);
+
 	pam_get_item(pamh, PAM_SERVICE, (const void **) &service);
 
-	ret = asprintf(&format2, "%s(%s): %s", MODULE_NAME, service, format);
+	ret = vasprintf(&base, format, args);
 	if (ret == -1) {
 		/* what else todo ? */
-		vsyslog(err, format, args);
+		vsyslog(err, format, args2);
+		va_end(args2);
 		return;
 	}
 
-	vsyslog(err, format2, args);
-	SAFE_FREE(format2);
+	syslog(err, "%s(%s): %s", MODULE_NAME, service, base);
+	SAFE_FREE(base);
+	va_end(args2);
 }
 #endif /* HAVE_PAM_VSYSLOG */
 
@@ -711,6 +720,11 @@ static int _make_remark(struct pwb_context *ctx,
 	return retval;
 }
 
+static int _make_remark_v(struct pwb_context *ctx,
+			  int type,
+			  const char *format,
+			  va_list args) PRINTF_ATTRIBUTE(3, 0);
+
 static int _make_remark_v(struct pwb_context *ctx,
 			  int type,
 			  const char *format,
-- 
2.14.1



More information about the samba-technical mailing list