On 12/11/14 15:55, Martin Basti wrote:
Part of ticket: https://fedorahosted.org/freeipa/ticket/4657

And here is the patch, sorry :-)


--
Martin Basti

From 4e1c366543e4b70ebd79cb1d143eccdebb9a5b2d Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 29 Oct 2014 14:45:45 +0100
Subject: [PATCH] Fix pk11helper module compiler warnings

Ticket: https://fedorahosted.org/freeipa/ticket/4657
---
 ipapython/ipap11helper/library.c   | 10 +++-------
 ipapython/ipap11helper/library.h   |  2 +-
 ipapython/ipap11helper/p11helper.c |  3 ++-
 ipapython/ipap11helper/setup.py    |  1 -
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/ipapython/ipap11helper/library.c b/ipapython/ipap11helper/library.c
index 51e24ebc2be5953a6820b768e75a3e8ccb026a64..fc4c1e41c9b3d3eb5ac5a0af7895bdf6a173a79e 100644
--- a/ipapython/ipap11helper/library.c
+++ b/ipapython/ipap11helper/library.c
@@ -44,7 +44,7 @@
 #include <dlfcn.h>
 
 // Load the PKCS#11 library
-CK_C_GetFunctionList loadLibrary(char* module, void** moduleHandle)
+CK_C_GetFunctionList loadLibrary(const char* module, void** moduleHandle)
 {
 	CK_C_GetFunctionList pGetFunctionList = NULL;
 
@@ -54,13 +54,9 @@ CK_C_GetFunctionList loadLibrary(char* module, void** moduleHandle)
 	if (module)
 	{
 		pDynLib = dlopen(module, RTLD_NOW | RTLD_LOCAL);
+	} else {
+		return NULL;
 	}
-	/*
-	else
-	{
-		pDynLib = dlopen(DEFAULT_PKCS11_LIB, RTLD_NOW | RTLD_LOCAL);
-	}
-	*/
 
 	if (pDynLib == NULL)
 	{
diff --git a/ipapython/ipap11helper/library.h b/ipapython/ipap11helper/library.h
index 2ceb9e375b457be298d683d784481326fd878c7f..afcbd9fd2e43106cd5592ba8a91b1da337452388 100644
--- a/ipapython/ipap11helper/library.h
+++ b/ipapython/ipap11helper/library.h
@@ -42,7 +42,7 @@
 
 #include <p11-kit/pkcs11.h>
 
-CK_C_GetFunctionList loadLibrary(char* module, void** moduleHandle);
+CK_C_GetFunctionList loadLibrary(const char* module, void** moduleHandle);
 void unloadLibrary(void* moduleHandle);
 
 #endif // !_SOFTHSM_V2_BIN_LIBRARY_H
diff --git a/ipapython/ipap11helper/p11helper.c b/ipapython/ipap11helper/p11helper.c
index 038c26c4520cc8f71edbee15b0ccd9bf292d7588..c1d100772e03660aeee831c76c1db96b6af49d76 100644
--- a/ipapython/ipap11helper/p11helper.c
+++ b/ipapython/ipap11helper/p11helper.c
@@ -1659,10 +1659,11 @@ P11_Helper_set_attribute(P11_Helper* self, PyObject *args, PyObject *kwds) {
                 goto final;
             }
             if (PyString_AsStringAndSize(value, (char **) &attribute.pValue,
-                    &attribute.ulValueLen) == -1) {
+                    &len) == -1) {
                 ret = NULL;
                 goto final;
             }
+            attribute.ulValueLen = len;
             break;
         case CKA_LABEL:
             if (!PyUnicode_Check(value)) {
diff --git a/ipapython/ipap11helper/setup.py b/ipapython/ipap11helper/setup.py
index 338cdcb2ebf30fe6b0b29d7b11ac03f0a14cbe3c..e8e824a3386db7653b33d539a05927b8de9f029d 100644
--- a/ipapython/ipap11helper/setup.py
+++ b/ipapython/ipap11helper/setup.py
@@ -23,7 +23,6 @@ module = Extension('_ipap11helper',
                        '-ggdb3',
                        '-O2',
                        '-W',
-                       '-pedantic',
                        '-Wall',
                        '-Wno-unused-parameter',
                        '-Wbad-function-cast',
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to