--longname=1 giving odd results

FYI we did make a change recently to separate the domain name style in mailbox usernames from the format of the admin username (and thus home directory).

hi Jamie - i am curious if you repeated my steps from earlier today if you would see the same results i did.

Do you mean specifically the home directory not including the full domain name, even though the admin username does?

@Jamie, it appears there is a bug in your latest changes.

longname option when set to 1 only works if a new unixname option is also set to 1.

jamie - i just installed a test version on a new virtualbox rocky-linux-10-1, and set ā€œDomain name style in usernameā€ to ā€œfull domain nameā€, then created a VM.

the username does not have to domain name suffix, and neither does the /home/ directory.

in every previous version, this was the only customization i needed to do in order to preserve the domain name suffix.

as noted earlier, there are easy workarounds, but i wanted to make everybody aware.

@Ilia on this test system, what is home_style in /etc/webmin/useradmin/config set to?

And what is home_format in /etc/webmin/virtual-server/config set to?

Sure, @Jamie, please have a look:

~# grep home_style /etc/webmin/useradmin/config
home_style=0

And:

~# grep home_format /etc/webmin/virtual-server/config
root@rocky9-pro:~#

Those are expected to stay at their defaults as they are now.

Ok, so what do you have longname and unixname set to when the home directory for new domains is set incorrectly?

The longname is set to 1 as expected:

# grep longname /etc/webmin/virtual-server/config
longname=1
# grep unixname /etc/webmin/virtual-server/config
unixname=0

There is a bug in the original patch, I think.

I think. Those are expected to stay at their defaults as they are now.

Can you explain more on what you mean?

from what i am seeing, longname= no longer is doing anything, and seems to be ignored.

first, new rocky-linux 10.1 on VirtualBox, then:

sh -c "$(curl -fsSL https://software.virtualmin.dev/virtualmin-install.sh)"  \
                                             --                              \
                                             --bundle LAMP                   \
                                             --branch   stable               \
                                             --hostname DOMAIN.COM           \
                                             --yes                           \
                                                                             ;
/usr/bin/sed  --in-place  --expression='s/^longname=0$/longname=1/;' \
                /etc/webmin/virtual-server/config    ;   ## 2025-02-17

then created a new VS with same results. the longname=1 appears to be ignored, since the /home/ directory no longer includes the path name.

this started happening about a week ago.

Yes, that’s the correct description of the bug. And, as a workaround until we fix it, you can set unixname=1 to make it work as expected.

1 Like

thank you. pls let me know if you want me to install a release-candidate to test.

Sorry, I’ve been extremely busy, basically day and night working on a new Virtualmin Podman plugin. I should have checked that earlier—I just did and fixed it in this patch.

Yes, apply this patch, give it another try, and let me know if it works for you:

webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/8f9a70a
webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/bcdd5f6

i have never done a ā€œpatchā€ before but when i ented your command i see the following:

webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/bcdd5f6 ;

Patch failed: Checking patch virtual-server-lib-funcs.pl...
error: while searching for:
	}
else {
	# Just use the Users and Groups module settings
	return &useradmin::auto_home_dir($home_base, $d->{'user'},
						     $d->{'ugroup'});
	}
}

error: patch failed: virtual-server-lib-funcs.pl:5502
error: while searching for:
my ($dname) = @_;
my $orig_dname = $dname;
my ($try1, $user);

if ($config{'unixname'} && $config{'unixname'} !~ /^[0-9]$/) {
	# Create random username based on the user pattern
	$user = &generate_random_available_user($config{'unixname'});
	}
elsif ($config{'unixname'} == 2) {
	# Username is same as the prefix
	$user = &compute_prefix($dname, undef, undef, 1);
	}
elsif ($config{'unixname'} == 3) {
	# Username is the admin's email address, like example@example.com
	$dname =~ s/^xn(-+)//;
        $dname = &remove_numeric_prefix($dname);

error: patch failed: virtual-server-lib-funcs.pl:7963
error: while searching for:
	$dname = &remove_numeric_prefix($dname);
	$dname =~ /^([^\.]+)/;
	($try1, $user) = ($1, $1);
	if (defined(getpwnam($try1)) || $config{'unixname'}) {
		# Short username is in use or the admin asked for a
		# full domain name
		$user = &remove_numeric_prefix($orig_dname);

error: patch failed: virtual-server-lib-funcs.pl:7986
error: while searching for:
my ($dname, $user) = @_;
my $orig_dname = $dname;
my ($try1, $group);

if ($user && $config{'groupsame'}) {
	# Same as username where possible

error: patch failed: virtual-server-lib-funcs.pl:8013
error: while searching for:
		}
	return (undef, $user, $user);
	}
if ($config{'unixname'} && $config{'unixname'} !~ /^[0-9]$/) {
	# Create random group based on the user pattern
	$group = &generate_random_available_user($config{'unixname'});
	}
elsif ($config{'unixname'} == 2) {
	# Group name is same as the prefix
	$group = &compute_prefix($dname, undef, undef, 1);
	}

error: patch failed: virtual-server-lib-funcs.pl:8021
error: while searching for:
	$dname = &remove_numeric_prefix($dname);
	$dname =~ /^([^\.]+)/;
	($try1, $group) = ($1, $1);
	if (defined(getgrnam($try1)) || $config{'unixname'}) {
		$group = &remove_numeric_prefix($orig_dname);
		$try2 = $group;
		if (defined(getpwnam($try))) {

error: patch failed: virtual-server-lib-funcs.pl:8036
Applying patch virtual-server-lib-funcs.pl with 6 rejects...
Rejected hunk #1.
Rejected hunk #2.
Rejected hunk #3.
Rejected hunk #4.
Rejected hunk #5.
Rejected hunk #6.

Ah, that’s right. You need to apply Jamie’s patch first.

Try the following:

webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/8f9a70a
webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/bcdd5f6

same error (or very similar)

i am doing the following:

 sh -c "$(curl -fsSL https://software.virtualmin.dev/virtualmin-install.sh)"  \
                                             --                                  \
                                             --bundle LAMP                       \
                                             --branch   stable                   \
                                             --hostname DOMAIN.COM               \
                                             --yes                               \
                                                                                 ;
webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/8f9a70a ;
## webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/bcdd5f6 ;

Wait, you should just run the following commands and nothing else:

webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/8f9a70a
webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/bcdd5f6

here is what i am doing:

  1. NEW rocky-linux 10.1

  2. install webmin

  3. patch(es)

pls let me know what you think i should be doing differently. sorry for all the confusion.