Skip to content

smb: reshuffle discovery systems

Harald Sitter requested to merge work/bug421624 into release/20.04

the modern discoveries were conditional on smbc_opendir succeeding but that is rather silly since smbc can fail on ENOENT if (for example) netbios is disabled. since top level server discovery may happen through all or none of NB/DNSSD/WSD that made no sense as even when NB fails we may be able to produce service listing through one of the other two discovery services.

this piece of code would actually benefit from major refactoring because all three discovery systems should actually run at the same time while currently NB holds up the entire show. alas, too invasive for 20.04... so, reshuffling it is:

smbc_opendir still runs initially. after that, if the url is browsing smb:// we'll jump into modern discovery. any errors produced by opendir will be ignored! authentication errors and the like cannot happen for smb:// because we aren't yet talking to any one server, which leaves actual browsing errors which are not fatal considering we have other options. for non-top-level urls we'll otherwise jump into error handling (e.g. server requires auth or something) at the end if we haven't returned early with an error we'll inject our . entries as per usual

test plan:

  • add disable netbios = yes to smb.conf
  • browse network
  • discovers dnssd/wsd servers
  • also works with the option removed again

BUG: 421624

FIXED-IN: 20.04.2

Edited by Harald Sitter

Merge request reports