[Pkg-shadow-devel] [Git][debian/adduser][master] 4 commits: add test to chck for basic international chars in comment

Marc Haber (@zugschlus) gitlab at salsa.debian.org
Mon May 5 13:13:27 BST 2025



Marc Haber pushed to branch master at Debian / adduser


Commits:
bc8e1834 by Marc Haber at 2025-05-05T14:13:21+02:00
add test to chck for basic international chars in comment

Git-Dch: ignore

- - - - -
e2630577 by Marc Haber at 2025-05-05T14:13:21+02:00
add minimal test for weird chars in comment

Git-Dch: ignore

- - - - -
239e0a91 by Marc Haber at 2025-05-05T14:13:21+02:00
workaround for #1104726 in perl

- - - - -
d310aef9 by Marc Haber at 2025-05-05T14:13:21+02:00
rework commentre to allow more characters in comment

- - - - -


2 changed files:

- AdduserCommon.pm
- + testsuite/test10.pl


Changes:

=====================================
AdduserCommon.pm
=====================================
@@ -84,7 +84,7 @@ use constant {
     simplefilenamere => qr/[-_\.0-9a-zA-Z]+/,
     pathre => qr/[- \p{Graph}_\.+!\$%&()\]\[;0-9a-zA-Z\/{}>*'@]+/,
     simplepathre => qr/[-_\$\.0-9a-zA-Z\/]+/,
-    commentre => qr/[-"_\.+!\$%&()\]\[;0-9a-zA-Z\/ ]*/,
+    commentre => qr/[-"_\.+!\$%&()\]\[;\/'’ A-Za-z0-9ß\x{a1}-\x{ac}\x{ae}-\x{ff}\p{L}\p{Nd}\p{Zs}]*/,
     numberre => qr/[0-9]+/,
     namere => qr/^([^-+~:,\s\/][^:,\s\/]*)$/aa,
     anynamere => qr/^([^-+~:,\s\/][^:,\s\/]*)$/aa,
@@ -138,7 +138,9 @@ sub sanitize_string {
         log_trace("sanitize_string returning %s", "$1");
         return $1;  # $1 is the captured, untainted portion of the string.
     } else {
-        die "invalid characters in $input";
+        #die "invalid characters in $input";
+        # this sometimes hangs the perl interpreter, see #1104726
+        die "invalid characters in input string, see trace output for more details";
     }
 }
 


=====================================
testsuite/test10.pl
=====================================
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -w
+
+
+use strict;
+use lib_test;
+
+my $username = find_unused_name(); 
+# ths strange characters here are UTF-8, this will cause problems
+# on systems that don't have libperl5.40 installed.
+#my $cmd = 'adduser --comment="é ä O\'Leary œŒ àœæßéÀÔùñ"  --disabled-password '. "$username";
+my $cmd = 'adduser --comment="Tom O\'Malley"  --disabled-password '. "$username";
+
+my %config;
+
+my @adduserconf=("/etc/adduser.conf");
+preseed_config(\@adduserconf,\%config);
+
+if (!defined (getpwnam($username))) {
+	print "Testing $cmd... ";
+	`$cmd`;
+	my $error = ($?>>8);
+	if ($error) {
+	  print "failed\n  adduser returned an errorcode != 0 ($error)\n";
+	  exit $error;
+	}
+	assert(check_user_exist ($username));
+
+}
+
+$cmd = "deluser $username";
+if (defined (getpwnam($username))) {
+	print "Testing $cmd... ";
+	`$cmd`;
+	my $error = ($?>>8);
+	if ($error) {
+	  print "failed\n  adduser returned an errorcode != 0 ($error)\n";
+	  exit $error;
+	}
+	assert(check_user_not_exist ($username));
+	print "ok\n";
+	`rm -rf /home/$username`;
+}
+



View it on GitLab: https://salsa.debian.org/debian/adduser/-/compare/3a5dbe97e1f492ad9d45755f3470292a1b27be0a...d310aef944dd7faaf0a8b19b2ab5781a5043a32b

-- 
View it on GitLab: https://salsa.debian.org/debian/adduser/-/compare/3a5dbe97e1f492ad9d45755f3470292a1b27be0a...d310aef944dd7faaf0a8b19b2ab5781a5043a32b
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/20250505/241dc0e2/attachment-0001.htm>


More information about the Pkg-shadow-devel mailing list