[Pkg-shadow-devel] [Git][debian/adduser][debian/latest] 8 commits: fix trailing whitespace

Marc Haber (@zugschlus) gitlab at salsa.debian.org
Fri Jan 2 19:55:49 GMT 2026



Marc Haber pushed to branch debian/latest at Debian / adduser


Commits:
3b908e86 by Marc Haber at 2026-01-01T09:49:53+01:00
fix trailing whitespace

Git-Dch: ignore

- - - - -
45130b7e by Marc Haber at 2026-01-01T09:50:08+01:00
improve trace message

Git-Dch: ignore

- - - - -
8f983f14 by Marc Haber at 2026-01-01T09:50:23+01:00
add new trace message

Git-Dch: ignore

- - - - -
e68be588 by Marc Haber at 2026-01-01T09:50:50+01:00
fix trailing whitespace

Git-Dch: ignore

- - - - -
c6e00abb by Marc Haber at 2026-01-01T09:51:08+01:00
make parenthesis symmetric to existing_user_status

Git-Dch: ignore

- - - - -
7473a302 by Marc Haber at 2026-01-01T09:51:36+01:00
have existing_group_status error out on EXISTING_ID_MISMATCH

Git-Dch: ignore

- - - - -
2d5414e8 by Marc Haber at 2026-01-01T09:52:21+01:00
move trace message to the correct place

Git-Dch: ignore

- - - - -
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

- - - - -


2 changed files:

- AdduserCommon.pm
- adduser


Changes:

=====================================
AdduserCommon.pm
=====================================
@@ -609,7 +609,7 @@ sub existing_user_status {
         log_trace( "egetpwnam(%s) returns %s, %s, %s", $new_name, $dummy1, $pw, $uid );
         $ret |= EXISTING_FOUND;
         $ret |= EXISTING_ID_MISMATCH if (defined($new_uid) && $uid != $new_uid);
-        $ret |= EXISTING_SYSTEM if 
+        $ret |= EXISTING_SYSTEM if
             (($uid >= $config->{"first_system_uid"}) && ($uid <= $config->{"last_system_uid"}));
         $ret |= EXISTING_HAS_PASSWORD if
             (defined $pw && $pw ne '' && $pw ne '!' && $pw !~ /^\*/);
@@ -617,8 +617,8 @@ sub existing_user_status {
     } elsif ($new_uid && getpwuid($new_uid)) {
         # user with the uid exists
         $ret |= EXISTING_ID_MISMATCH;
-    } 
-    log_trace( "existing_user_status returning %d", $ret );
+    }
+    log_trace( "existing_user_status( %s, %s ) returns %s", $new_name, $new_uid, $ret );
     return $ret;
 }
 
@@ -639,12 +639,15 @@ sub existing_group_status {
     log_trace( "existing_group_status called with new_name %s, new_gid %s", $new_name, $new_gid );
     if (($dummy1,$dummy2,$gid) = egetgrnam($new_name)) {
         # group with the name exists
+        log_trace("egetgrnam %s returned successfully, gid = %s", $new_name, $gid);
         $ret |= EXISTING_FOUND;
         $ret |= EXISTING_ID_MISMATCH if (defined($new_gid) && $gid != $new_gid);
-        $ret |= EXISTING_SYSTEM if 
-            (($gid >= $config->{"first_system_gid"} && $gid <= $config->{"last_system_gid"}));
-    } 
-    log_trace( "existing_group_status returning %d", $ret );
+        $ret |= EXISTING_SYSTEM if
+            (($gid >= $config->{"first_system_gid"}) && ($gid <= $config->{"last_system_gid"}));
+    } elsif ($new_gid && getgrgid($new_gid)) {
+        $ret |= EXISTING_ID_MISMATCH;
+    }
+    log_trace( "existing_group_status( %s, %s ) returns %s", $new_name, $new_gid, $ret );
     return $ret;
 }
 


=====================================
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/-/compare/a5954fb5791f360485b87d5f5afa486c4b53cea1...68cbd01651c3a050bc31a0d75d0d516aa646b3ce

-- 
View it on GitLab: https://salsa.debian.org/debian/adduser/-/compare/a5954fb5791f360485b87d5f5afa486c4b53cea1...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/20260102/d5df5b0c/attachment-0001.htm>


More information about the Pkg-shadow-devel mailing list