You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by zs...@apache.org on 2018/12/14 14:35:08 UTC
ranger git commit: RANGER-2307: Better error message,
and a NULL check for the native code
Repository: ranger
Updated Branches:
refs/heads/master 51461487f -> bb03ae437
RANGER-2307: Better error message, and a NULL check for the native code
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/bb03ae43
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/bb03ae43
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/bb03ae43
Branch: refs/heads/master
Commit: bb03ae43754f38a14e8358138178dea07dcb745a
Parents: 5146148
Author: Zsombor Gegesy <zs...@apache.org>
Authored: Fri Dec 7 10:47:53 2018 +0100
Committer: Zsombor Gegesy <zs...@apache.org>
Committed: Thu Dec 13 14:01:19 2018 +0100
----------------------------------------------------------------------
unixauthnative/src/main/c/credValidator.c | 7 ++++++-
unixauthpam/src/main/c/pamCredValidator.c | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/bb03ae43/unixauthnative/src/main/c/credValidator.c
----------------------------------------------------------------------
diff --git a/unixauthnative/src/main/c/credValidator.c b/unixauthnative/src/main/c/credValidator.c
index e426bdd..d79eb3b 100644
--- a/unixauthnative/src/main/c/credValidator.c
+++ b/unixauthnative/src/main/c/credValidator.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <sys/types.h>
#include <crypt.h>
+#include <errno.h>
#define STRLEN 64
@@ -48,11 +49,15 @@ int main(int ac, char **av, char **ev)
spwd = getspnam(pwp->pw_name) ;
if (spwd == (struct spwd *)NULL) {
- fprintf(stdout, "FAILED: unable to get (shadow) password for %s\n", username) ;
+ fprintf(stdout, "FAILED: unable to get (shadow) password for '%s', because '%s'\n", username, strerror(errno));
exit(1) ;
}
else {
char *gen = crypt(password,spwd->sp_pwdp) ;
+ if (gen == (char *)NULL) {
+ fprintf(stdout, "FAILED: crypt failed with: '%s'\n", strerror(errno));
+ exit(1);
+ }
if (strcmp(spwd->sp_pwdp,gen) == 0) {
fprintf(stdout, "OK:\n") ;
exit(0);
http://git-wip-us.apache.org/repos/asf/ranger/blob/bb03ae43/unixauthpam/src/main/c/pamCredValidator.c
----------------------------------------------------------------------
diff --git a/unixauthpam/src/main/c/pamCredValidator.c b/unixauthpam/src/main/c/pamCredValidator.c
index 60d38ae..8ec9f0e 100644
--- a/unixauthpam/src/main/c/pamCredValidator.c
+++ b/unixauthpam/src/main/c/pamCredValidator.c
@@ -83,7 +83,7 @@ int main(int ac, char **av, char **ev)
retval = pam_authenticate(pamh, 0);
if (retval != PAM_SUCCESS) {
- fprintf(stdout, "FAILED: Password did not match.\n") ;
+ fprintf(stdout, "FAILED: Password did not match(%s).\n", pam_strerror(pamh, retval)) ;
if (pamh) {
pam_end(pamh, retval);
}