Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: -i only work when storing plain-text password #11

Open
1000i100 opened this issue Mar 10, 2021 · 1 comment
Open

BUG: -i only work when storing plain-text password #11

1000i100 opened this issue Mar 10, 2021 · 1 comment

Comments

@1000i100
Copy link

$ npx htpasswd -bBc htpasswd prototype 7ba4845
Adding password for user prototype.

$ npx htpasswd -v htpasswd prototype
New password:
Re-type new password:
Password for user prototype correct.

but :

$ echo 7ba4845 | npx htpasswd -iBc htpasswd prototype
Adding password for user prototype.

$ npx htpasswd -v htpasswd prototype
New password:
Re-type new password:
Password verification failed.

It's the same if i use :

$ npx htpasswd -bc htpasswd prototype 7ba4845
$ npx htpasswd -v htpasswd prototype
correct
$ echo 7ba4845 | npx htpasswd -ic htpasswd prototype
$ npx htpasswd -v htpasswd prototype
failed

but in plain text it work :

$ npx htpasswd -bpc htpasswd prototype 7ba4845
$ npx htpasswd -v htpasswd prototype
correct
$ echo 7ba4845 | npx htpasswd -ipc htpasswd prototype
$ npx htpasswd -v htpasswd prototype
correct
@te-online
Copy link

te-online commented Jan 11, 2023

I have a feeling this never worked, as the chunk param here is a Buffer and ends with a newline.

We can create a patch like this to fix the feature:

-    password += chunk;
+    password += chunk.toString().replace(/\n/, '');

in

password += chunk;

@gevorg are you interested in releasing a new version of this module with a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants