Repository: incubator-ranger
Updated Branches:
  refs/heads/master 92d20fe1d -> 85f272920


RANGER-1187:call pam_end before exit

Signed-off-by: Don Bosco Durai <bo...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/85f27292
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/85f27292
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/85f27292

Branch: refs/heads/master
Commit: 85f27292053d2a08c16b61ac40b4088d55da5d85
Parents: 92d20fe
Author: zhangqiang2 <zhangqia...@zte.com.cn>
Authored: Fri Oct 28 18:15:59 2016 +0800
Committer: Don Bosco Durai <bo...@apache.org>
Committed: Thu Nov 3 19:56:19 2016 -0700

----------------------------------------------------------------------
 unixauthpam/src/main/c/pamCredValidator.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/85f27292/unixauthpam/src/main/c/pamCredValidator.c
----------------------------------------------------------------------
diff --git a/unixauthpam/src/main/c/pamCredValidator.c 
b/unixauthpam/src/main/c/pamCredValidator.c
index ab19080..df84a3e 100644
--- a/unixauthpam/src/main/c/pamCredValidator.c
+++ b/unixauthpam/src/main/c/pamCredValidator.c
@@ -71,12 +71,18 @@ int main(int ac, char **av, char **ev)
        if (retval != PAM_SUCCESS) {
                /* why expose this? */
                fprintf(stdout, "FAILED: [%s] does not exists.\n", username) ;
+               if (pamh) {
+                       pam_end(pamh, retval);
+               }
                exit(1);
        }
 
        retval = pam_authenticate(pamh, 0);
        if (retval != PAM_SUCCESS) {
                fprintf(stdout, "FAILED: Password did not match.\n") ;
+               if (pamh) {
+                       pam_end(pamh, retval);
+               }               
                exit(1);
        }
 
@@ -84,12 +90,18 @@ int main(int ac, char **av, char **ev)
        retval = pam_acct_mgmt(pamh, 0);
        if (retval != PAM_SUCCESS) {
                fprintf(stdout, "FAILED: [%s] is not authorized.\n", username) ;
+               if (pamh) {
+                       pam_end(pamh, retval);
+               }
                exit(1);
        }
 
        /* establish the requested credentials */
        if ((retval = pam_setcred(pamh, PAM_ESTABLISH_CRED)) != PAM_SUCCESS) {
                        fprintf(stdout, "FAILED: Error setting credentials for 
[%s].\n", username) ;
+                       if (pamh) {
+                               pam_end(pamh, retval);
+                       }
                exit(1);
        }
 

Reply via email to