public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/libuser] rawhide: Verify password hash format before creating an user
@ 2026-11-20 11:04 Jakub Haruda
  0 siblings, 0 replies; only message in thread
From: Jakub Haruda @ 2026-11-20 11:04 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/libuser
            Branch : rawhide
            Commit : 069435048b6412435cc84df2c44ae57ff8471257
            Author : Jakub Haruda <jharuda@redhat.com>
            Date   : 2026-11-20T12:01:56+01:00
            Stats  : +25/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/libuser/c/069435048b6412435cc84df2c44ae57ff8471257?branch=rawhide

            Log:
            Verify password hash format before creating an user

In the case of the incorrect format luseradd did print error message but
continued and created the user anyway.

---
diff --git a/libuser-0.64-precheckhash.patch b/libuser-0.64-precheckhash.patch
new file mode 100644
index 0000000..2ba26a3
--- /dev/null
+++ b/libuser-0.64-precheckhash.patch
@@ -0,0 +1,20 @@
+diff --git a/apps/luseradd.c b/apps/luseradd.c
+index 96a5ade..bccc1c4 100644
+--- a/apps/luseradd.c
++++ b/apps/luseradd.c
+@@ -138,6 +138,15 @@ main(int argc, const char **argv)
+ 		uidNumber = imax;
+ 	}
+ 
++	/* Validate the pre-hashed password early, before creating the user. */
++	if (cryptedUserPassword != NULL
++		&& strpbrk(cryptedUserPassword, ":\n") != NULL) {
++		fprintf(stderr, _("Invalid pre-hashed password, "
++		"`:' and `\\n' are not allowed.\n"));
++		result = 1;
++		goto done;
++	}
++
+ 	/* Initialize the library. */
+ 	ctx = lu_start(NULL, 0, NULL, NULL,
+ 		       interactive ? lu_prompt_console :

diff --git a/libuser.spec b/libuser.spec
index 3f3e3d7..04fc8d9 100644
--- a/libuser.spec
+++ b/libuser.spec
@@ -2,13 +2,14 @@
 
 Name: libuser
 Version: 0.64
-Release: 21%{?dist}
+Release: 22%{?dist}
 License: LGPL-2.0-or-later
 URL: https://codeberg.org/libuser/libuser
 Source: libuser-%{version}.tar.gz
 # https://pagure.io/libuser/pull-request/71
 Patch: 0001-tests-use-crypt_r-with-Python-3.13.patch
 Patch1:  libuser-0.64-editlocation.patch
+Patch2:  libuser-0.64-precheckhash.patch
 
 BuildRequires: glib2-devel
 BuildRequires: linuxdoc-tools
@@ -131,6 +132,9 @@ export PYTHONPATH
 %{_datadir}/gtk-doc/html/*
 
 %changelog
+* Fri Nov 20 2026 Jakub Haruda <jharuda@redhat.com> - 0.64-22
+- Verify password hash format before creating an user
+
 * Wed Jul 22 2026 Python Maint <python-maint@redhat.com> - 0.64-21
 - Rebuilt for Python 3.15.0b4 ABI change
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-20 11:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 11:04 [rpms/libuser] rawhide: Verify password hash format before creating an user Jakub Haruda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox