diff options
author | Richard Maw <richard.maw@gmail.com> | 2016-12-18 21:03:16 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2016-12-18 21:52:49 +0000 |
commit | 39352e0132774dbb86e471a0b1e3e927f99b512c (patch) | |
tree | 0736c79bc047fcccd5883b43559d5a01b68f42cd /lib | |
parent | 4fb7da3e483e11a57188e946f6ea634d0928c4bc (diff) | |
download | gitano-39352e0132774dbb86e471a0b1e3e927f99b512c.tar.gz |
Fix updating htpasswd files
This would previously break because if it's updating htpasswd
it passes an empty argument rather than no argument.
Rather than stop it passing the empty argument
this patch instead passes -i flags unconditionally
and merges the flags argument.
This is to make it use the batch-input code-path
which doesn't attempt to use a tty for its input,
since it caused issues in the test suite
which fakes the server.
This requires changing it to only pass the password as input once.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitano/usercommand.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitano/usercommand.lua b/lib/gitano/usercommand.lua index e33921a..f9ddf1d 100644 --- a/lib/gitano/usercommand.lua +++ b/lib/gitano/usercommand.lua @@ -255,13 +255,13 @@ end local function update_htpasswd(user, passwd) local htpasswd_path = os.getenv("HOME") .. "/htpasswd" - local flags = io.open(htpasswd_path, "r") and "" or "-c" + local flags = io.open(htpasswd_path, "r") and "-i" or "-ic" local exit_code if passwd ~= '' then local proc = subprocess.spawn_simple({ "htpasswd", flags, htpasswd_path, user, - stdin = passwd .. '\n' .. passwd .. '\n', + stdin = passwd, stdout = subprocess.PIPE, stderr = subprocess.PIPE }) |