[SCM] pam wrapper repository - branch master updated

Michael Adam obnox at samba.org
Thu Dec 10 22:52:31 UTC 2015


The branch, master has been updated
       via  7267de3 py: Fix strict aliasing rules in initpypamtest()
       via  7505e1c py: Fix strict aliasing rules in set_pypamtest_exception()
      from  59ecbfa py: Make sure we do not use failed uninitialized

https://git.samba.org/?p=pam_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7267de3e692d4e07645488cde7f54c2d4ffa426d
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 10 17:36:09 2015 +0100

    py: Fix strict aliasing rules in initpypamtest()
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 7505e1c7f93fae556bb92b19922791bc703b6be1
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 10 17:35:51 2015 +0100

    py: Fix strict aliasing rules in set_pypamtest_exception()
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 src/python/pypamtest.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index a1b5dd6..a773733 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -260,6 +260,10 @@ set_pypamtest_exception(PyObject *exc,
 	PyObject *obj = NULL;
 	/* repr_fmt is fixed and contains just %d expansions, so this is safe */
 	char test_repr[256] = { '\0' };
+	union {
+		char *str;
+		PyObject *obj;
+	} pypam_str_object;
 	const char *strerr;
 	const struct pam_testcase *failed = NULL;
 
@@ -291,7 +295,8 @@ set_pypamtest_exception(PyObject *exc,
 		PyErr_SetObject(exc, obj);
 	}
 
-	Py_XDECREF(test_repr);
+	pypam_str_object.str = test_repr;
+	Py_XDECREF(pypam_str_object.obj);
 	Py_XDECREF(obj);
 }
 
@@ -1008,6 +1013,10 @@ PyMODINIT_FUNC initpypamtest(void)
 #endif
 {
 	PyObject *m;
+	union {
+		PyTypeObject *type_obj;
+		PyObject *obj;
+	} pypam_object;
 	int ret;
 
 #if IS_PYTHON3
@@ -1069,18 +1078,19 @@ PyMODINIT_FUNC initpypamtest(void)
 		RETURN_ON_ERROR;
 	}
 
-	if (PyType_Ready(&pypamtest_test_case) < 0) {
+	pypam_object.type_obj = &pypamtest_test_case;
+	if (PyType_Ready(pypam_object.type_obj) < 0) {
 		RETURN_ON_ERROR;
 	}
-	Py_INCREF(&pypamtest_test_case);
-	PyModule_AddObject(m, "TestCase", (PyObject *) &pypamtest_test_case);
+	Py_INCREF(pypam_object.obj);
+	PyModule_AddObject(m, "TestCase", pypam_object.obj);
 
-	if (PyType_Ready(&pypamtest_test_result) < 0) {
+	pypam_object.type_obj = &pypamtest_test_result;
+	if (PyType_Ready(pypam_object.type_obj) < 0) {
 		RETURN_ON_ERROR;
 	}
-	Py_INCREF(&pypamtest_test_result);
-	PyModule_AddObject(m, "TestResult",
-			   (PyObject *) &pypamtest_test_result);
+	Py_INCREF(pypam_object.obj);
+	PyModule_AddObject(m, "TestResult", pypam_object.obj);
 
 #if IS_PYTHON3
 	return m;


-- 
pam wrapper repository



More information about the samba-cvs mailing list