Repository: ranger
Updated Branches:
  refs/heads/ranger-0.7 4bdfbd68e -> 8040bf338


RANGER-2172: Fixing minor issue with the no. of characters read using sscanf


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

Branch: refs/heads/ranger-0.7
Commit: 8040bf338397840d9f540da7585cf881db2b66d3
Parents: 4bdfbd6
Author: Sailaja Polavarapu <[email protected]>
Authored: Thu Aug 2 12:33:24 2018 -0700
Committer: Abhay Kulkarni <[email protected]>
Committed: Wed Sep 26 21:24:52 2018 -0700

----------------------------------------------------------------------
 unixauthnative/src/main/c/credValidator.c | 4 ++--
 unixauthpam/src/main/c/pamCredValidator.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/8040bf33/unixauthnative/src/main/c/credValidator.c
----------------------------------------------------------------------
diff --git a/unixauthnative/src/main/c/credValidator.c 
b/unixauthnative/src/main/c/credValidator.c
index d706a93..1c17e92 100644
--- a/unixauthnative/src/main/c/credValidator.c
+++ b/unixauthnative/src/main/c/credValidator.c
@@ -32,8 +32,8 @@ int main(int ac, char **av, char **ev)
        struct spwd *spwd ; 
 
        fgets(line,512,stdin) ;
-
-       sscanf(line, "LOGIN:%s %s",username,password) ;
+       sprintf(format, "LOGIN:%%%ds %%%ds", STRLEN-1, STRLEN-1);
+       sscanf(line, format, username,password) ;
 
        pwp = getpwnam(username) ;
 

http://git-wip-us.apache.org/repos/asf/ranger/blob/8040bf33/unixauthpam/src/main/c/pamCredValidator.c
----------------------------------------------------------------------
diff --git a/unixauthpam/src/main/c/pamCredValidator.c 
b/unixauthpam/src/main/c/pamCredValidator.c
index df84a3e..0b45a6f 100644
--- a/unixauthpam/src/main/c/pamCredValidator.c
+++ b/unixauthpam/src/main/c/pamCredValidator.c
@@ -63,6 +63,7 @@ int main(int ac, char **av, char **ev)
        int retval;
        pam_handle_t *pamh = NULL;
 
+       sprintf(format, "LOGIN:%%%ds %%%ds", STRLEN-1, STRLEN-1);
        fgets(line,512,stdin) ;
        sscanf(line, "LOGIN:%s %s",username,password) ;
        conv.appdata_ptr = (char *) password;

Reply via email to