public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jakub Haruda <jharuda@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/libuser] rawhide: Verify password hash format before creating an user
Date: Fri, 20 Nov 2026 11:04:28 GMT	[thread overview]
Message-ID: <179517266892.1.626424814286030583.rpms-libuser-069435048b64@fedoraproject.org> (raw)

            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
 

                 reply	other threads:[~2026-11-20 11:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179517266892.1.626424814286030583.rpms-libuser-069435048b64@fedoraproject.org \
    --to=jharuda@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox