[pve-devel] [PATCH common] fix #1363: dont encode unicode strings in passwords

Dominik Csapak d.csapak at proxmox.com
Fri Apr 28 16:06:29 CEST 2017


with the same reasoning as in commit
cfa3086d95c3a39b584b2d60aa53938e1f30b3dc
of pve-container

we should not utf8-encode the password before giving it to crypt()

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
i suppose this should also be applied to stable-4
 src/PVE/Tools.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 1f0ec75..aff4bcb 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1473,7 +1473,7 @@ sub encrypt_pw {
     # crypt does not want '+' in salt (see 'man crypt')
     $salt =~ s/\+/X/g;
 
-    return crypt(encode("utf8", $pw), "\$5\$$salt\$");
+    return crypt($pw, "\$5\$$salt\$");
 }
 
 1;
-- 
2.11.0





More information about the pve-devel mailing list