[debian-edu-commits] [Git][debian-edu/upstream/libpam-mklocaluser][master] Determine minimum UID for regular users from login.defs
Mike Gabriel (@sunweaver)
gitlab at salsa.debian.org
Tue Sep 26 11:31:00 BST 2023
Mike Gabriel pushed to branch master at Debian Edu / upstream / libpam-mklocaluser
Commits:
6fb065f7 by Guido Berhoerster at 2023-09-26T08:14:01+02:00
Determine minimum UID for regular users from login.defs
- - - - -
1 changed file:
- debian/pam-python.py
Changes:
=====================================
debian/pam-python.py
=====================================
@@ -40,7 +40,21 @@ from pathlib import Path
HOOK_PATH = Path("/etc/mklocaluser.d")
-MINIMUM_UID = 1000 # FIXME read UID_MIN from login.defs?
+
+
+def get_minimum_uid():
+ min_uid = 1000
+ with open("/etc/login.defs") as f:
+ for line in f:
+ parts = line.strip().split(maxsplit=1)
+ if len(parts) == 2 and parts[0] == "UID_MIN":
+ try:
+ min_uid = int(parts[1])
+ except ValueError:
+ pass
+ break
+
+ return min_uid
def check_and_create_localuser(pamh, user):
@@ -52,7 +66,7 @@ def check_and_create_localuser(pamh, user):
return pamh.PAM_USER_UNKNOWN
# Ignore users belwo minimum UID
- if userinfo.pw_uid < MINIMUM_UID:
+ if userinfo.pw_uid < get_minimum_uid():
return pamh.PAM_SUCCESS
# Ignore users with existing entry in /etc/passwd
View it on GitLab: https://salsa.debian.org/debian-edu/upstream/libpam-mklocaluser/-/commit/6fb065f773f043ff528df5a5d02fb2cd965560c1
--
View it on GitLab: https://salsa.debian.org/debian-edu/upstream/libpam-mklocaluser/-/commit/6fb065f773f043ff528df5a5d02fb2cd965560c1
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20230926/a87b0428/attachment-0001.htm>
More information about the debian-edu-commits
mailing list