After upgrading from 4.10.18-SerNet-Ubuntu-10.bionic to 4.12.9-SerNet-Ubuntu-9.bionic smbd segfaults when a shared printer is accessed and smb.conf contains invalid users configuration. _spoolss_OpenPrinterEx() from the printing code calls user_ok_token() with domain=NULL which finally leads to a NULL pointer dereference by strlen() in token_contains_name(). This is a regression introduced by commit 5de7c91e6d4e98f438157a7675c8582cabdd828d ("s3:smbd: Fix %U substitutions if it contains a domain name").
This bug was referenced in samba master: 8036bf9717f83e83c3e4a9cf00fded42e9a5de15
*** This bug has been marked as a duplicate of bug 14568 ***
Oh, looks like you fixed this in a different way by modifying the underlying called code. I'm pretty sure this is the same bug though as 14568 though. I don't think your fix is actually needed as we ensure the all the callers now pass info->domain_name here. Still, doesn't hurt to check ther.