You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hawq.apache.org by bhuvnesh2703 <gi...@git.apache.org> on 2016/05/05 00:25:15 UTC

[GitHub] incubator-hawq pull request: HAWQ-717: Use password as fed by the ...

GitHub user bhuvnesh2703 opened a pull request:

    https://github.com/apache/incubator-hawq/pull/637

    HAWQ-717: Use password as fed by the user

    Use password as fed by the user

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/incubator-hawq HAWQ-717

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-hawq/pull/637.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #637
    
----
commit 8e1384cc6d0016356776e87de1f4e48d06c7c8c4
Author: Bhuvnesh Chaudhary <bc...@pivotal.io>
Date:   2016-05-05T00:10:39Z

    HAWQ-717: Use password as fed by the user

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-717: Use password as fed by the ...

Posted by radarwave <gi...@git.apache.org>.
Github user radarwave commented on the pull request:

    https://github.com/apache/incubator-hawq/pull/637#issuecomment-217145625
  
    Looks good to me. +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-717: Use password as fed by the ...

Posted by bhuvnesh2703 <gi...@git.apache.org>.
Github user bhuvnesh2703 commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/637#discussion_r62264233
  
    --- Diff: tools/bin/hawq ---
    @@ -82,7 +83,13 @@ def main():
         if len(sys.argv) > 2:
             hawq_command = sys.argv[1]
             second_arg = sys.argv[2]
    -        sub_args = " ".join(sys.argv[2:])
    +        sub_args_list = sys.argv[2:]
    +        # Password can have special characters like semicolon (;), quotes(", ') etc, convert input password to a string
    +        if hawq_command == 'ssh-exkeys' and '-p' in sub_args_list:
    +            password_index = sub_args_list.index('-p') + 1
    +            if len(sub_args_list) > password_index:
    +              sub_arg_list[password_index] = json.dumps(sub_args_list[password_index])
    --- End diff --
    
    This is because we are printing that on the python console.
    So essentially, to json.dumps a string is passed which foo zzz
    json.dumps adds double quotes to it = "foo zzz"
    since on the python console the result is printed, to show that its a string python console adds single quotes to it.
    
    if you do the same using the script you will just get "foo zzz"
    ```
    cat t1.py
    [gpadmin@c6401 ~]$ cat t1.py
    import json
    print json.dumps('foo zzz')
    
    [gpadmin@c6401 ~]$ python t1.py
    "foo zzz"
    [gpadmin@c6401 ~]$ python
    Python 2.6.2 (r262:71600, May 12 2009, 15:34:31)
    [GCC 4.1.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import json
    >>> json.dumps('foo zzz')
    '"foo zzz"'
    >>> quit()
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-717: Use password as fed by the ...

Posted by denalex <gi...@git.apache.org>.
Github user denalex commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/637#discussion_r62226354
  
    --- Diff: tools/bin/hawq ---
    @@ -82,7 +83,13 @@ def main():
         if len(sys.argv) > 2:
             hawq_command = sys.argv[1]
             second_arg = sys.argv[2]
    -        sub_args = " ".join(sys.argv[2:])
    +        sub_args_list = sys.argv[2:]
    +        # Password can have special characters like semicolon (;), quotes(", ') etc, convert input password to a string
    +        if hawq_command == 'ssh-exkeys' and '-p' in sub_args_list:
    +            password_index = sub_args_list.index('-p') + 1
    +            if len(sub_args_list) > password_index:
    +              sub_arg_list[password_index] = json.dumps(sub_args_list[password_index])
    --- End diff --
    
    a bit cautious about using json here. Tried this from python shell:
    >>> json.dumps('foo zzz')
    '"foo zzz"'
    So it seems the call preserved single quotes but also added double quotes inside the value, which would essentially change the password, no ? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-717: Use password as fed by the ...

Posted by bhuvnesh2703 <gi...@git.apache.org>.
Github user bhuvnesh2703 closed the pull request at:

    https://github.com/apache/incubator-hawq/pull/637


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---