Cannot add printers from protected SMB share

I am trying to add a network printer shared through SMB and protected with username and password. I am trying to do so using the GNOME Control Center tab called “Printers”. After unlocking the panel and clicking on the “Add…” button, I am presented with the “Add Printer” window. However, when I write the network address corresponding to the printer, in the form smb://[hostname]/[printer-name], there is no prompt that allows me to insert my SMB credentials in order to view and then select the printer.

The additional information I can provide is that, using smbclient -L with the appropriate username, workgroup and password I am able to correctly list the printer.

Moreover, every time I press ENTER in the prompt where I can write the printer network address, the following message appears in the system log:

gnome-control-center-search-provider[7043]: smb1cli_req_writev_submit: called for dialect[SMB2_10] server[$hostname$]

where $hostname$ is the hostname I specified in the search field.

The last information I can provide is that, using Wireshark, I can see the SMB messages for the failed login attempt to the SMB share. They use my UNIX username and “SAMBA” as workgroup. As expected, the server replies with an authentication failed message. No prompt requiring my actual credentials pops up, however.

Unfortunately, I cannot provide much information about how the server is configured, apart from the fact that it is a Windows one. This is a university printer.

Can someone please help me debug this? It looks like there is a problem in how GNOME handles the authentication prompt on my particular configuration.

After some debugging, it turns out the problem is present only on SMB2-only servers (SMB1 disabled) that are password protected. The problem originates form the following two bugs I reported against libsmbclient: