[Pkg-shadow-devel] [Git][debian/adduser][wip/post-154-fixes] restore check_user_group to what it was previously

Marc Haber (@zugschlus) gitlab at salsa.debian.org
Thu Jan 1 09:52:14 GMT 2026



Marc Haber pushed to branch wip/post-154-fixes at Debian / adduser


Commits:
68cbd016 by Marc Haber at 2026-01-01T10:51:23+01:00
restore check_user_group to what it was previously

Some changes didn't survive a merge, old version was better

- - - - -


1 changed file:

- adduser


Changes:

=====================================
adduser
=====================================
@@ -1155,7 +1155,7 @@ sub mktree {
 #   requirement that are basically the same for normal users and
 #   system users. Factored out to avoid code duplication.
 # parameters:
-#   system: 0 if the user is not a system user, 1 otherwise
+#   system: 0 if the user will be a system user, 1 otherwise
 # return values:
 #   if the function returns, all requirements are met. otherwise
 #   it exits() from the program with an appropriate exit code
@@ -1169,19 +1169,21 @@ sub mktree {
 sub check_user_group {
     my ($system) = @_;
     log_debug( "check_user_group %s called, make_group_also %s", $system, $make_group_also );
-    if( !$system || !existing_user_status(\%config, $new_name, $new_uid) ) {
-        if( defined egetpwnam($new_name) ) {
-            if( $system ) {
-                log_fatal( mtx("The user `%s' already exists, and is not a system user."), $new_name);
-                exit( RET_WRONG_OBJECT_PROPERTIES );
-            } else {
-                log_fatal( mtx("The user `%s' already exists."), $new_name);
-                exit( RET_OBJECT_EXISTS );
-            }
+
+    my $ustat = existing_user_status(\%config, $new_name, $new_uid);
+    if ($system) {
+        if (($ustat & EXISTING_FOUND) && !($ustat & EXISTING_SYSTEM)) {
+            log_fatal( mtx("The user `%s' already exists, and is not a system user."), $new_name);
+            exit( RET_WRONG_OBJECT_PROPERTIES );
         }
-        if (defined($new_uid) && getpwuid($new_uid)) {
-            log_fatal( mtx("The UID %d is already in use."), $new_uid);
-            exit( RET_ID_IN_USE );
+        # if ($new_uid && !($ustat & EXISTING_SYSTEM)) {
+        #         log_fatal( mtx("The uid `%s' is invalid for system users."), $new_name);
+        #         exit( RET_OBJECT_EXISTS );
+        # }
+    } else {
+        if ($ustat & EXISTING_FOUND) {
+            log_fatal( mtx("The user `%s' already exists."), $new_name);
+            exit( RET_OBJECT_EXISTS );
         }
     }
 



View it on GitLab: https://salsa.debian.org/debian/adduser/-/commit/68cbd01651c3a050bc31a0d75d0d516aa646b3ce

-- 
View it on GitLab: https://salsa.debian.org/debian/adduser/-/commit/68cbd01651c3a050bc31a0d75d0d516aa646b3ce
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/pkg-shadow-devel/attachments/20260101/8968ef3b/attachment-0001.htm>


More information about the Pkg-shadow-devel mailing list