ranger git commit: RANGER-2172: Good coding practices for unix authentication Service in Ranger

2018-09-27 Thread pradeep
Repository: ranger
Updated Branches:
  refs/heads/ranger-0.7 53a7acd0d -> 822e76472


RANGER-2172: Good coding practices for unix authentication Service in Ranger

Signed-off-by: Sailaja Polavarapu 

(cherry picked from commit 1d47302f937e3fe1d565914c578faaf989e54424)


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

Branch: refs/heads/ranger-0.7
Commit: 822e76472c787aa1d18985430ecb5d5f0bc6457b
Parents: 53a7acd
Author: Vishal Suvagia 
Authored: Thu Sep 27 14:28:02 2018 +0530
Committer: Pradeep 
Committed: Thu Sep 27 14:30:41 2018 +0530

--
 src/main/assembly/usersync.xml| 4 ++--
 unixauthnative/src/main/c/credValidator.c | 7 +--
 unixauthpam/src/main/c/pamCredValidator.c | 9 ++---
 3 files changed, 13 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ranger/blob/822e7647/src/main/assembly/usersync.xml
--
diff --git a/src/main/assembly/usersync.xml b/src/main/assembly/usersync.xml
index 66cf3dd..5d1efe8 100644
--- a/src/main/assembly/usersync.xml
+++ b/src/main/assembly/usersync.xml
@@ -113,7 +113,7 @@


755
-   755
+   750
/native
unixauthnative/target
   
@@ -122,7 +122,7 @@


755
-   755
+   750
/native
unixauthpam/target
   

http://git-wip-us.apache.org/repos/asf/ranger/blob/822e7647/unixauthnative/src/main/c/credValidator.c
--
diff --git a/unixauthnative/src/main/c/credValidator.c 
b/unixauthnative/src/main/c/credValidator.c
index 1c17e92..e426bdd 100644
--- a/unixauthnative/src/main/c/credValidator.c
+++ b/unixauthnative/src/main/c/credValidator.c
@@ -23,11 +23,14 @@
 #include 
 #include 
 
+#define STRLEN 64
+
 int main(int ac, char **av, char **ev)
 {
-   char username[64] ;
-   char password[64] ;
+   char username[STRLEN] ;
+   char password[STRLEN] ;
char line[512] ;
+   char format[20];
struct passwd *pwp;
struct spwd *spwd ; 
 

http://git-wip-us.apache.org/repos/asf/ranger/blob/822e7647/unixauthpam/src/main/c/pamCredValidator.c
--
diff --git a/unixauthpam/src/main/c/pamCredValidator.c 
b/unixauthpam/src/main/c/pamCredValidator.c
index 0b45a6f..60d38ae 100644
--- a/unixauthpam/src/main/c/pamCredValidator.c
+++ b/unixauthpam/src/main/c/pamCredValidator.c
@@ -32,6 +32,8 @@
 #include 
 #include 
 
+#define STRLEN 64
+
 int pamconv(int num_msg, const struct pam_message **msg, struct pam_response 
**resp, void *appdata_ptr) {
   if (num_msg != 1 || msg[0]->msg_style != PAM_PROMPT_ECHO_OFF) {
fprintf(stderr, "ERROR: Unexpected PAM conversation '%d/%s'\n", 
msg[0]->msg_style, msg[0]->msg);
@@ -56,16 +58,17 @@ struct pam_conv conv = { pamconv, NULL };
 
 int main(int ac, char **av, char **ev)
 {
-   char username[64] ;
-   char password[64] ;
+   char username[STRLEN] ;
+   char password[STRLEN] ;
char line[512] ;
+   char format[20];
 
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) ;
+   sscanf(line, format, username,password) ;
conv.appdata_ptr = (char *) password;
 
retval = pam_start("ranger-remote", username, &conv, &pamh);



ranger git commit: RANGER-2172: Good coding practices for unix authentication Service in Ranger -- ranger-1 branch

2018-08-01 Thread spolavarapu
Repository: ranger
Updated Branches:
  refs/heads/ranger-1 0eaea72f8 -> a3a2c2ca3


RANGER-2172: Good coding practices for unix authentication Service in Ranger -- 
ranger-1 branch


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

Branch: refs/heads/ranger-1
Commit: a3a2c2ca35e05e5ff92ee286a47357174b51fae7
Parents: 0eaea72
Author: Sailaja Polavarapu 
Authored: Wed Aug 1 13:39:02 2018 -0700
Committer: Sailaja Polavarapu 
Committed: Wed Aug 1 13:39:02 2018 -0700

--
 src/main/assembly/usersync.xml|  4 ++--
 unixauthnative/src/main/c/credValidator.c | 11 +++
 unixauthpam/src/main/c/pamCredValidator.c | 10 +++---
 3 files changed, 16 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ranger/blob/a3a2c2ca/src/main/assembly/usersync.xml
--
diff --git a/src/main/assembly/usersync.xml b/src/main/assembly/usersync.xml
index a6bad1d..d170d8c 100644
--- a/src/main/assembly/usersync.xml
+++ b/src/main/assembly/usersync.xml
@@ -118,7 +118,7 @@


755
-   755
+   750
/native
unixauthnative/target
   
@@ -127,7 +127,7 @@


755
-   755
+   750
/native
unixauthpam/target
   

http://git-wip-us.apache.org/repos/asf/ranger/blob/a3a2c2ca/unixauthnative/src/main/c/credValidator.c
--
diff --git a/unixauthnative/src/main/c/credValidator.c 
b/unixauthnative/src/main/c/credValidator.c
index d706a93..189c2ca 100644
--- a/unixauthnative/src/main/c/credValidator.c
+++ b/unixauthnative/src/main/c/credValidator.c
@@ -23,17 +23,20 @@
 #include 
 #include 
 
+#define STRLEN 64
+
 int main(int ac, char **av, char **ev)
 {
-   char username[64] ;
-   char password[64] ;
+   char username[STRLEN] ;
+   char password[STRLEN] ;
char line[512] ;
+   char format[20];
struct passwd *pwp;
struct spwd *spwd ; 
 
fgets(line,512,stdin) ;
-
-   sscanf(line, "LOGIN:%s %s",username,password) ;
+   sprintf(format, "LOGIN:%%%ds %%%ds", STRLEN, STRLEN);
+   sscanf(line, format, username,password) ;
 
pwp = getpwnam(username) ;
 

http://git-wip-us.apache.org/repos/asf/ranger/blob/a3a2c2ca/unixauthpam/src/main/c/pamCredValidator.c
--
diff --git a/unixauthpam/src/main/c/pamCredValidator.c 
b/unixauthpam/src/main/c/pamCredValidator.c
index df84a3e..8e36903 100644
--- a/unixauthpam/src/main/c/pamCredValidator.c
+++ b/unixauthpam/src/main/c/pamCredValidator.c
@@ -32,6 +32,8 @@
 #include 
 #include 
 
+#define STRLEN 64
+
 int pamconv(int num_msg, const struct pam_message **msg, struct pam_response 
**resp, void *appdata_ptr) {
   if (num_msg != 1 || msg[0]->msg_style != PAM_PROMPT_ECHO_OFF) {
fprintf(stderr, "ERROR: Unexpected PAM conversation '%d/%s'\n", 
msg[0]->msg_style, msg[0]->msg);
@@ -56,15 +58,17 @@ struct pam_conv conv = { pamconv, NULL };
 
 int main(int ac, char **av, char **ev)
 {
-   char username[64] ;
-   char password[64] ;
+   char username[STRLEN] ;
+   char password[STRLEN] ;
char line[512] ;
+   char format[20];
 
int retval;
pam_handle_t *pamh = NULL;
 
+   sprintf(format, "LOGIN:%%%ds %%%ds", STRLEN, STRLEN);
fgets(line,512,stdin) ;
-   sscanf(line, "LOGIN:%s %s",username,password) ;
+   sscanf(line, format, username,password) ;
conv.appdata_ptr = (char *) password;
 
retval = pam_start("ranger-remote", username, &conv, &pamh);



ranger git commit: RANGER-2172: Good coding practices for unix authentication Service in Ranger -- ranger-1.1 branch

2018-08-01 Thread spolavarapu
Repository: ranger
Updated Branches:
  refs/heads/ranger-1.1 d6e384d48 -> c06ab7a50


RANGER-2172: Good coding practices for unix authentication Service in Ranger -- 
ranger-1.1 branch


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

Branch: refs/heads/ranger-1.1
Commit: c06ab7a50cbb7a5e521c550e2947136421c165b1
Parents: d6e384d
Author: Sailaja Polavarapu 
Authored: Wed Aug 1 13:37:05 2018 -0700
Committer: Sailaja Polavarapu 
Committed: Wed Aug 1 13:37:05 2018 -0700

--
 src/main/assembly/usersync.xml|  4 ++--
 unixauthnative/src/main/c/credValidator.c | 11 +++
 unixauthpam/src/main/c/pamCredValidator.c | 10 +++---
 3 files changed, 16 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ranger/blob/c06ab7a5/src/main/assembly/usersync.xml
--
diff --git a/src/main/assembly/usersync.xml b/src/main/assembly/usersync.xml
index a6bad1d..d170d8c 100644
--- a/src/main/assembly/usersync.xml
+++ b/src/main/assembly/usersync.xml
@@ -118,7 +118,7 @@


755
-   755
+   750
/native
unixauthnative/target
   
@@ -127,7 +127,7 @@


755
-   755
+   750
/native
unixauthpam/target
   

http://git-wip-us.apache.org/repos/asf/ranger/blob/c06ab7a5/unixauthnative/src/main/c/credValidator.c
--
diff --git a/unixauthnative/src/main/c/credValidator.c 
b/unixauthnative/src/main/c/credValidator.c
index d706a93..189c2ca 100644
--- a/unixauthnative/src/main/c/credValidator.c
+++ b/unixauthnative/src/main/c/credValidator.c
@@ -23,17 +23,20 @@
 #include 
 #include 
 
+#define STRLEN 64
+
 int main(int ac, char **av, char **ev)
 {
-   char username[64] ;
-   char password[64] ;
+   char username[STRLEN] ;
+   char password[STRLEN] ;
char line[512] ;
+   char format[20];
struct passwd *pwp;
struct spwd *spwd ; 
 
fgets(line,512,stdin) ;
-
-   sscanf(line, "LOGIN:%s %s",username,password) ;
+   sprintf(format, "LOGIN:%%%ds %%%ds", STRLEN, STRLEN);
+   sscanf(line, format, username,password) ;
 
pwp = getpwnam(username) ;
 

http://git-wip-us.apache.org/repos/asf/ranger/blob/c06ab7a5/unixauthpam/src/main/c/pamCredValidator.c
--
diff --git a/unixauthpam/src/main/c/pamCredValidator.c 
b/unixauthpam/src/main/c/pamCredValidator.c
index df84a3e..8e36903 100644
--- a/unixauthpam/src/main/c/pamCredValidator.c
+++ b/unixauthpam/src/main/c/pamCredValidator.c
@@ -32,6 +32,8 @@
 #include 
 #include 
 
+#define STRLEN 64
+
 int pamconv(int num_msg, const struct pam_message **msg, struct pam_response 
**resp, void *appdata_ptr) {
   if (num_msg != 1 || msg[0]->msg_style != PAM_PROMPT_ECHO_OFF) {
fprintf(stderr, "ERROR: Unexpected PAM conversation '%d/%s'\n", 
msg[0]->msg_style, msg[0]->msg);
@@ -56,15 +58,17 @@ struct pam_conv conv = { pamconv, NULL };
 
 int main(int ac, char **av, char **ev)
 {
-   char username[64] ;
-   char password[64] ;
+   char username[STRLEN] ;
+   char password[STRLEN] ;
char line[512] ;
+   char format[20];
 
int retval;
pam_handle_t *pamh = NULL;
 
+   sprintf(format, "LOGIN:%%%ds %%%ds", STRLEN, STRLEN);
fgets(line,512,stdin) ;
-   sscanf(line, "LOGIN:%s %s",username,password) ;
+   sscanf(line, format, username,password) ;
conv.appdata_ptr = (char *) password;
 
retval = pam_start("ranger-remote", username, &conv, &pamh);



ranger git commit: RANGER-2172: Good coding practices for unix authentication Service in Ranger

2018-07-31 Thread spolavarapu
Repository: ranger
Updated Branches:
  refs/heads/master edefd567c -> 1d47302f9


RANGER-2172: Good coding practices for unix authentication Service in Ranger


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

Branch: refs/heads/master
Commit: 1d47302f937e3fe1d565914c578faaf989e54424
Parents: edefd56
Author: Sailaja Polavarapu 
Authored: Tue Jul 31 16:22:07 2018 -0700
Committer: Sailaja Polavarapu 
Committed: Tue Jul 31 16:22:07 2018 -0700

--
 src/main/assembly/usersync.xml|  4 ++--
 unixauthnative/src/main/c/credValidator.c | 11 +++
 unixauthpam/src/main/c/pamCredValidator.c | 10 +++---
 3 files changed, 16 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ranger/blob/1d47302f/src/main/assembly/usersync.xml
--
diff --git a/src/main/assembly/usersync.xml b/src/main/assembly/usersync.xml
index a6bad1d..d170d8c 100644
--- a/src/main/assembly/usersync.xml
+++ b/src/main/assembly/usersync.xml
@@ -118,7 +118,7 @@


755
-   755
+   750
/native
unixauthnative/target
   
@@ -127,7 +127,7 @@


755
-   755
+   750
/native
unixauthpam/target
   

http://git-wip-us.apache.org/repos/asf/ranger/blob/1d47302f/unixauthnative/src/main/c/credValidator.c
--
diff --git a/unixauthnative/src/main/c/credValidator.c 
b/unixauthnative/src/main/c/credValidator.c
index d706a93..189c2ca 100644
--- a/unixauthnative/src/main/c/credValidator.c
+++ b/unixauthnative/src/main/c/credValidator.c
@@ -23,17 +23,20 @@
 #include 
 #include 
 
+#define STRLEN 64
+
 int main(int ac, char **av, char **ev)
 {
-   char username[64] ;
-   char password[64] ;
+   char username[STRLEN] ;
+   char password[STRLEN] ;
char line[512] ;
+   char format[20];
struct passwd *pwp;
struct spwd *spwd ; 
 
fgets(line,512,stdin) ;
-
-   sscanf(line, "LOGIN:%s %s",username,password) ;
+   sprintf(format, "LOGIN:%%%ds %%%ds", STRLEN, STRLEN);
+   sscanf(line, format, username,password) ;
 
pwp = getpwnam(username) ;
 

http://git-wip-us.apache.org/repos/asf/ranger/blob/1d47302f/unixauthpam/src/main/c/pamCredValidator.c
--
diff --git a/unixauthpam/src/main/c/pamCredValidator.c 
b/unixauthpam/src/main/c/pamCredValidator.c
index df84a3e..8e36903 100644
--- a/unixauthpam/src/main/c/pamCredValidator.c
+++ b/unixauthpam/src/main/c/pamCredValidator.c
@@ -32,6 +32,8 @@
 #include 
 #include 
 
+#define STRLEN 64
+
 int pamconv(int num_msg, const struct pam_message **msg, struct pam_response 
**resp, void *appdata_ptr) {
   if (num_msg != 1 || msg[0]->msg_style != PAM_PROMPT_ECHO_OFF) {
fprintf(stderr, "ERROR: Unexpected PAM conversation '%d/%s'\n", 
msg[0]->msg_style, msg[0]->msg);
@@ -56,15 +58,17 @@ struct pam_conv conv = { pamconv, NULL };
 
 int main(int ac, char **av, char **ev)
 {
-   char username[64] ;
-   char password[64] ;
+   char username[STRLEN] ;
+   char password[STRLEN] ;
char line[512] ;
+   char format[20];
 
int retval;
pam_handle_t *pamh = NULL;
 
+   sprintf(format, "LOGIN:%%%ds %%%ds", STRLEN, STRLEN);
fgets(line,512,stdin) ;
-   sscanf(line, "LOGIN:%s %s",username,password) ;
+   sscanf(line, format, username,password) ;
conv.appdata_ptr = (char *) password;
 
retval = pam_start("ranger-remote", username, &conv, &pamh);