Skip to contentSkip to conversation

autofs-5.1.9 - cast sasl_callback_t function pointers

PATCH In review David Disseldorp 1 participant 2 messages Mar 21, 2024 – Apr 16, 2024 Kernel automounter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 autofs-5.1.9 - cast sasl_callback_t function pointers

GCC 14+ uses -Werror=incompatible-pointer-types by default. sasl.h:sasl_callback_t doesn't offer a type-safe mechanism for setting @proc callback functions, so a cast is necessary.

---
 modules/cyrus-sasl.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
modules/cyrus-sasl.c +7 -7
index e742eaf..107e182 100644
@@ -109,17 +109,17 @@ static int getpass_func(sasl_conn_t *, void *, int, sasl_secret_t **);
 static int getuser_func(void *, int, const char **, unsigned *);
 
 static sasl_callback_t callbacks[] = {
-	{ SASL_CB_USER, &getuser_func, NULL },
-	{ SASL_CB_AUTHNAME, &getuser_func, NULL },
-	{ SASL_CB_PASS, &getpass_func, NULL },
+	{ SASL_CB_USER, (int (*)(void))&getuser_func, NULL },
+	{ SASL_CB_AUTHNAME, (int (*)(void))&getuser_func, NULL },
+	{ SASL_CB_PASS, (int (*)(void))&getpass_func, NULL },
 	{ SASL_CB_LIST_END, NULL, NULL },
 };
 
 static sasl_callback_t debug_callbacks[] = {
-	{ SASL_CB_LOG, &sasl_log_func, NULL },
-	{ SASL_CB_USER, &getuser_func, NULL },
-	{ SASL_CB_AUTHNAME, &getuser_func, NULL },
-	{ SASL_CB_PASS, &getpass_func, NULL },
+	{ SASL_CB_LOG, (int (*)(void))&sasl_log_func, NULL },
+	{ SASL_CB_USER, (int (*)(void))&getuser_func, NULL },
+	{ SASL_CB_AUTHNAME, (int (*)(void))&getuser_func, NULL },
+	{ SASL_CB_PASS, (int (*)(void))&getpass_func, NULL },
 	{ SASL_CB_LIST_END, NULL, NULL },
 };
 
Signature · 1 line
2.35.3
#1 lore raw

Hi,

Quoted 28 lines · David Disseldorp

GCC 14+ uses -Werror=incompatible-pointer-types by default. sasl.h:sasl_callback_t doesn't offer a type-safe mechanism for setting @proc callback functions, so a cast is necessary.

---
 modules/cyrus-sasl.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
modules/cyrus-sasl.c +3 -4
index e742eaf..107e182 100644
@@ -109,17 +109,17 @@ static int getpass_func(sasl_conn_t *, void *, int, sasl_secret_t **);
 static int getuser_func(void *, int, const char **, unsigned *);
 
 static sasl_callback_t callbacks[] = {
-	{ SASL_CB_USER, &getuser_func, NULL },
-	{ SASL_CB_AUTHNAME, &getuser_func, NULL },
-	{ SASL_CB_PASS, &getpass_func, NULL },
+	{ SASL_CB_USER, (int (*)(void))&getuser_func, NULL },
+	{ SASL_CB_AUTHNAME, (int (*)(void))&getuser_func, NULL },
+	{ SASL_CB_PASS, (int (*)(void))&getpass_func, NULL },
 	{ SASL_CB_LIST_END, NULL, NULL },
 };
 
 static sasl_callback_t debug_callbacks[] = {
-	{ SASL_CB_LOG, &sasl_log_func, NULL },

modules/cyrus-sasl.c static int getpass_func(sasl_conn_t *, void *, int, sasl_secret_t **); · line 125

Quoted 10 lines
modules/cyrus-sasl.c +4 -3
-	{ SASL_CB_USER, &getuser_func, NULL },
-	{ SASL_CB_AUTHNAME, &getuser_func, NULL },
-	{ SASL_CB_PASS, &getpass_func, NULL },
+	{ SASL_CB_LOG, (int (*)(void))&sasl_log_func, NULL },
+	{ SASL_CB_USER, (int (*)(void))&getuser_func, NULL },
+	{ SASL_CB_AUTHNAME, (int (*)(void))&getuser_func, NULL },
+	{ SASL_CB_PASS, (int (*)(void))&getpass_func, NULL },
 	{ SASL_CB_LIST_END, NULL, NULL },
 };
 

Does anyone have feedback on this proposed change?