Bug 9394 - NT_STATUS_UNEXPECTED_NETWORK_ERROR
Summary: NT_STATUS_UNEXPECTED_NETWORK_ERROR
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: Tools (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Andrew Bartlett
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-15 04:06 UTC by Brian May
Modified: 2022-08-18 05:08 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian May 2012-11-15 04:06:49 UTC
latest git version

root@sys11:/etc/ssl/local# /usr/local/samba/bin/samba-tool domain classicupgrade --dbdir=/tmp/samba --use-xattrs=yes  --realm=ad.vpac.org /tmp/smb.conf 
Reading smb.conf
WARNING: The "idmap backend" option is deprecated
WARNING: The "idmap uid" option is deprecated
WARNING: The "idmap gid" option is deprecated
Unknown parameter encountered: "share modes"
Ignoring unknown parameter "share modes"
Provisioning
Exporting account policy
Exporting groups
Exporting users
  Skipping wellknown rid=501 (for username=nobody)
Next rid = 101007
Failed to bind - LDAP client internal error: NT_STATUS_UNEXPECTED_NETWORK_ERROR
Failed to connect to 'ldapi:///' with backend 'ldapi': (null)
Could not open ldb connection to ldapi:///, the error message is: (1, None)
Exporting posix attributes
ERROR(<type 'exceptions.UnboundLocalError'>): uncaught exception - local variable 'ldb_object' referenced before assignment
  File "/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py", line 175, in _run
    return self.run(*args, **kwargs)
  File "/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain.py", line 1318, in run
    useeadb=eadb, dns_backend=dns_backend, use_ntvfs=use_ntvfs)
  File "/usr/local/samba/lib/python2.7/site-packages/samba/upgrade.py", line 800, in upgrade_from_samba3
    homes[username] = get_posix_attr_from_ldap_backend(logger, ldb_object, base_dn, username, "homeDirectory")


It doesn't connect to the passdb LDAP server, but it just connected to the same server fine to export the users/groups?

There is also the issue that it doesn't abort cleanly, and as a result gets confused because ldb_object is never defined.

I notice it says "backend 'ldapi'", wondering if that is normal? Or should it be ldapsam?
Comment 1 Brian May 2012-11-15 04:27:34 UTC
Seems to work better if I replace:

passdb backend = ldapsam:ldapi:///

with:

passdb backend = ldapsam:ldap://localhost/

In the source smb.conf
Comment 2 Douglas Bagnall 2022-08-18 05:08:41 UTC
This exact error was possible in (e.g.) 4.0.26, because we had around line 790:

        for url in urls.split():
            try:
                ldb_object = Ldb(url, credentials=creds)
            except ldb.LdbError, e:
                logger.warning("Could not open ldb connection to %s, the error message is: %s", url, e)
            else:
                break

which smothers the LdbError, but the function goes on to try to use ldb_object, which is not set because of the exception.

This was fixed by the combination of these commits in 2013 and 2014:

e7e37b3b90100f762a45f2f3c047e14e3619c216
c9b1f6b366e4f51c8fbf1051bcb44c7d91364b89

The underlying issue that caused the LdbError seems to have been addressed in comment 1, above.