The branch, master has been updated
       via  59ecbfa py: Make sure we do not use failed uninitialized
       via  52ec969 py: Make sure we do not dereference a NULL pointer
       via  776a184 libpamtest: Do not call pam_end() if tc is not set
       via  927a070 libpamtest: Make sure reply is initialized
      from  d98750e tests: Do not run python test if python is not present

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


- Log -----------------------------------------------------------------
commit 59ecbfa4fb64785c24fe3ce4bfa96a23f804eac3
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 10 17:32:18 2015 +0100

    py: Make sure we do not use failed uninitialized
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit 52ec969c2c074f2716c8c3bccd7940a84ddee92b
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 10 17:30:57 2015 +0100

    py: Make sure we do not dereference a NULL pointer
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit 776a18460f3e259a12a8b07ee52d70676fdb7258
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 10 17:13:52 2015 +0100

    libpamtest: Do not call pam_end() if tc is not set
    
    This fixes a build warning.
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit 927a070eb6d80fb155ccc033704522d336789c28
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Dec 10 17:10:55 2015 +0100

    libpamtest: Make sure reply is initialized
    
    Fixes a build warning
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

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

Summary of changes:
 src/libpamtest.c       | 6 +++---
 src/python/pypamtest.c | 9 +++++++--
 2 files changed, 10 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/libpamtest.c b/src/libpamtest.c
index 612cdc1..6d6efc6 100644
--- a/src/libpamtest.c
+++ b/src/libpamtest.c
@@ -70,7 +70,7 @@ enum pamtest_err _pamtest_conv(const char *service,
        pam_handle_t *ph;
        struct pam_conv conv;
        size_t tcindex;
-       struct pam_testcase *tc;
+       struct pam_testcase *tc = NULL;
        bool call_pam_end = true;
 
        conv.conv = conv_fn;
@@ -101,7 +101,7 @@ enum pamtest_err _pamtest_conv(const char *service,
                }
        }
 
-       if (call_pam_end == true) {
+       if (call_pam_end == true && tc != NULL) {
                rv = pam_end(ph, tc->op_rv);
                if (rv != PAM_SUCCESS) {
                        return PAMTEST_ERR_END;
@@ -198,7 +198,7 @@ static int pamtest_simple_conv(int num_msg,
 {
        int i, ri;
        int ret;
-       struct pam_response *reply;
+       struct pam_response *reply = NULL;
        const char *prompt;
        struct pamtest_conv_ctx *cctx = \
                                    (struct pamtest_conv_ctx *) appdata_ptr;
diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index 1538294..a1b5dd6 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -261,7 +261,12 @@ set_pypamtest_exception(PyObject *exc,
        /* repr_fmt is fixed and contains just %d expansions, so this is safe */
        char test_repr[256] = { '\0' };
        const char *strerr;
-       const struct pam_testcase *failed;
+       const struct pam_testcase *failed = NULL;
+
+       if (exc == NULL) {
+               PyErr_BadArgument();
+               return;
+       }
 
        strerr = pamtest_strerror(perr);
 
@@ -275,7 +280,7 @@ set_pypamtest_exception(PyObject *exc,
                }
        }
 
-       if (test_repr[0] != '\0') {
+       if (test_repr[0] != '\0' && failed != NULL) {
                PyErr_Format(exc,
                             "Error [%d]: Test case %s retured [%d]",
                             perr, test_repr, failed->op_rv);


-- 
pam wrapper repository

Reply via email to