In Server Templates if username format is set to "username@domain", changing domain name of virtual server results in error "Mail for domain failed!"

Hi,

When changing name of domain, the log shows this error among other things:

Updating users .. .. Mail for domain failed! : mysql::execute_sql_logged failed : SQL set password for 'k2ktbiv12u@testi'@'127.0.0.1' = password('y%czzfgp1w') failed : Can't find any matching row in the user table at /usr/libexec/webmin/web-lib-funcs.pl line 1478.

Modify domain command returns success even if there is this error but user's usermin cannot be accessed.

I did it using remote API using modify-domain command and later found that the same thing happens when I change domain from Virtualmin UI. Also I found out that this error only happens when in Server Templates username format is set to "username@domain". So when modifying the domain name if the username has an '@' in it, the above error is generated and that user's usermin cannot be accessed. If the username format to username-domain and a new user is generated without '@' in username, modify-domain works fine.

So it looks like there is a bug somewhere.

I had asked about this in the forum(https://www.virtualmin.com/node/64982) and asked which project should the issue be raised under but replies yet. So not sure if I have selected the right project for this issue.

Thanks, Vishnu N

Status: 
Active

Comments

Howdy -- thanks for your report!

Just to verify, is it correct that users on your system are being stored in MySQL, rather than using the /etc/passwd file?

Also, is k2ktbiv12u a mailbox user, or the domain owner?

Hi,

Sorry for the late reply. I thought as "Notify me..." checkbox is enabled, i would get email if someone replies to this issue but I didn't get any notification. I checked my spam folder as well but there is nothing there.

Please note that its a user created for FTP only(for file and db access) via Virtualmin API with following arguments: ftp=&noemail=&web=&mysql=&program=create-user

  • is it correct that users on your system are being stored in MySQL, rather than using the /etc/passwd file?

I opened /etc/passwd and i can see a list of all users but not sure if MySQL is also used in some way. I have not selected or modified any setting related to where users are stored and I don't remember seeing such a setting when going through setup wizard. If there is such a setting, its set to what ever Virtualmin default is.

  • Also, is k2ktbiv12u a mailbox user, or the domain owner?

The 'k2ktbiv12u@test.domain.com' is the email of the user(But login permission is "FTP Only"), FTP/IMAP/POP3 login is 'k2ktbiv12u@test.domain.com' and MySQL login is 'k2ktbiv12u@testi'.

Thanks

Hello,

I was trying to recreate this issue and i was not able to do it now - which is great.

But just wanted to know if someone fixed this issue or is it hidden somehow and will popup back up when we are not expecting.

Thank you so much.

We may have fixed this by improving the way MySQL escaping is done when updating users.