git: 3e2a7a2cbeb2 - main - nuageinit: add test about encrypted passwords

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Wed, 20 Nov 2024 10:04:08 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=3e2a7a2cbeb272b891c6931f2ae54ee6e5ec2c7d

commit 3e2a7a2cbeb272b891c6931f2ae54ee6e5ec2c7d
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-11-20 10:02:55 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-11-20 10:02:55 +0000

    nuageinit: add test about encrypted passwords
    
    While here fix fc34a2463c16fd47acbc8e5c3bbbb6b2ce1b1469 where the
    adduser_passwd.lua file was not added
---
 libexec/nuageinit/tests/adduser_passwd.lua | 20 ++++++++++++++++++++
 libexec/nuageinit/tests/nuage.sh           |  3 +++
 2 files changed, 23 insertions(+)

diff --git a/libexec/nuageinit/tests/adduser_passwd.lua b/libexec/nuageinit/tests/adduser_passwd.lua
new file mode 100644
index 000000000000..e2d9395d679d
--- /dev/null
+++ b/libexec/nuageinit/tests/adduser_passwd.lua
@@ -0,0 +1,20 @@
+#!/usr/libexec/flua
+
+local n = require("nuage")
+
+local pw = {}
+pw.name = "foo"
+pw.plain_text_passwd = "bar"
+local res = n.adduser(pw)
+if not res then
+	n.err("valid user should return a path")
+end
+
+local pw2 = {}
+pw2.name = "foocrypted"
+-- barcrypted
+pw2.passwd = "$6$ZY8faYcEfyoEZnNX$FuAZA2SKhIfYLebhEtbmjptQNrenr6mJhji35Ru.zqdaa6G/gkKiHoQuh0vYZTKrjaykyohR8W4Q5ZF56yt8u1"
+res = n.adduser(pw2)
+if not res then
+	n.err("valid user should return a path")
+end
diff --git a/libexec/nuageinit/tests/nuage.sh b/libexec/nuageinit/tests/nuage.sh
index a5451561202f..f2753d6d91e6 100644
--- a/libexec/nuageinit/tests/nuage.sh
+++ b/libexec/nuageinit/tests/nuage.sh
@@ -60,6 +60,9 @@ adduser_passwd_body()
 	passhash=`awk -F ':' '/^foo:/ {print $2}' etc/master.passwd`
 	atf_check -s exit:0 -o inline:$passhash \
 		$(atf_get_srcdir)/crypt $passhash "bar"
+	passhash=`awk -F ':' '/^foocrypted:/ {print $2}' etc/master.passwd`
+	atf_check -s exit:0 -o inline:$passhash \
+		$(atf_get_srcdir)/crypt $passhash "barcrypted"
 }
 
 addgroup_body()