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:

The two bugs mentioned above were fixed in Samba 4.11.4, which is now available in Fedora 31. The fix will also be applied to the 4.10 branch in the next bug fix release. This, however, does not solve the issue in GNOME 3, which is still unable to list printers in protected SMB2 shares. The fix in libsmbclient exposes another bug in GNOME Settings itself which I reported, but was not yet acknowledged:

I submitted a merge request to GNOME with a fix that is supposed to solve the bug, it is currently under review: printers: Do not authenticate SMB servers when search field is edited (!721) · Merge requests · GNOME / Settings · GitLab