Bug 10539 - samba-tool fails with NT_STATUS_LOGON_FAILURE when output is piped
samba-tool fails with NT_STATUS_LOGON_FAILURE when output is piped
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools
4.1.6
All Linux
: P5 normal
: ---
Assigned To: Andrew Bartlett
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-04 20:27 UTC by Carl Soderstrom
Modified: 2014-04-04 20:27 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 Carl Soderstrom 2014-04-04 20:27:25 UTC
The samba-tool normally succeeds and produces good output, but when the output is piped into another tool it generates an error. I have tested this with a couple of samba-tool commands, and with both 'grep' and 'less' as the target of the output.

 
# samba-tool dns query ad.example.com ad.example.com @ ALL -U Administrator |grep -i samba
SPNEGO(gssapi_krb5) creating NEG_TOKEN_INIT failed: NT_STATUS_INVALID_PARAMETER
Failed to bind to uuid 50abc2a4-574d-40b3-9d66-ee4fd5fba076 for 50abc2a4-574d-40b3-9d66-ee4fd5fba076@ncacn_ip_tcp:ad.example.com[49171,sign] NT_STATUS_LOGON_FAILURE
ERROR(runtime): uncaught exception - (-1073741715, 'Logon failure')
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line 175, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/dns.py", line 984, in run
    dns_conn = dns_connect(server, self.lp, self.creds)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/dns.py", line 37, in dns_connect
    dns_conn = dnsserver.dnsserver(binding_str, lp, creds)

# samba-tool dns serverinfo ad.example.com -U Administrator|less
SPNEGO(gssapi_krb5) creating NEG_TOKEN_INIT failed: NT_STATUS_INVALID_PARAMETER
Failed to bind to uuid 50abc2a4-574d-40b3-9d66-ee4fd5fba076 for 50abc2a4-574d-40b3-9d66-ee4fd5fba076@ncacn_ip_tcp:ad.example.com[49171,sign] NT_STATUS_LOGON_FAILURE
ERROR(runtime): uncaught exception - (-1073741715, 'Logon failure')
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line 175, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/dns.py", line 703, in run
    dns_conn = dns_connect(server, self.lp, self.creds)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/dns.py", line 37, in dns_connect
    dns_conn = dnsserver.dnsserver(binding_str, lp, creds)


Note that if the output is not piped, there is good output and no exit error status.

# samba-tool dns serverinfo ad.example.com -U Administrator
Password for [IGIAD\Administrator]:
SPNEGO(gssapi_krb5) creating NEG_TOKEN_INIT failed: NT_STATUS_INVALID_PARAMETER
  dwVersion                   : 0x1db10106
  fBootMethod                 : DNS_BOOT_METHOD_DIRECTORY
  fAdminConfigured            : TRUE
  fAllowUpdate                : TRUE
  fDsAvailable                : TRUE
  pszServerName               : AD.ad.example.com
  pszDsContainer              : cn=MicrosoftDNS,cn=System,DC=ad,DC=example,DC=com
  aipServerAddrs              : ['00:00:fe80:00:00:00:787f:3aab (53)', '192.XX.XXX.77 (53)']
  aipListenAddrs              : []
  aipForwarders               : ['192.XX.XXX.41 (53)']
  dwLogLevel                  : 0
  dwDebugLevel                : 0
  dwForwardTimeout            : 3
  dwRpcPrototol               : 0x5
  dwNameCheckFlag             : DNS_ALLOW_MULTIBYTE_NAMES
  cAddressAnswerLimit         : 0
  dwRecursionRetry            : 3
  dwRecursionTimeout          : 8
  dwMaxCacheTtl               : 86400
  dwDsPollingInterval         : 180
  dwScavengingInterval        : 168
  dwDefaultRefreshInterval    : 168
  dwDefaultNoRefreshInterval  : 168
  fAutoReverseZones           : TRUE
  fAutoCacheUpdate            : FALSE
  fRecurseAfterForwarding     : FALSE
  fForwardDelegations         : FALSE
  fNoRecursion                : FALSE
  fSecureResponses            : TRUE
  fRoundRobin                 : TRUE
  fLocalNetPriority           : TRUE
  fBindSecondaries            : FALSE
  fWriteAuthorityNs           : FALSE
  fStrictFileParsing          : FALSE
  fLooseWildcarding           : FALSE
  fDefaultAgingState          : FALSE
  dwRpcStructureVersion       : 0x2
  aipLogFilter                : []
  pwszLogFilePath             : 
  pszDomainName               : ad.example.com
  pszForestName               : ad.example.com
  pszDomainDirectoryPartition : DomainDnsZones.ad.example.com
  pszForestDirectoryPartition : ForestDnsZones.ad.example.com
  dwLocalNetPriorityNetMask   : 0x0
  dwLastScavengeTime          : 0
  dwEventLogLevel             : 4
  dwLogFileMaxSize            : 500000000
  dwDsForestVersion           : 0
  dwDsDomainVersion           : 4
  dwDsDsaVersion              : 0
  fReadOnlyDC                 : FALSE
# echo $?
0


This is on Ubuntu 14.04 prerelease.

# dpkg -l|grep samba
ii  python-samba                                          2:4.1.6+dfsg-1ubuntu1                               amd64        
ii  samba                                                 2:4.1.6+dfsg-1ubuntu1                               amd64        
ii  samba-common                                          2:4.1.6+dfsg-1ubuntu1                               all          
ii  samba-common-bin                                      2:4.1.6+dfsg-1ubuntu1                               amd64        
ii  samba-dsdb-modules                                    2:4.1.6+dfsg-1ubuntu1                               amd64        
ii  samba-libs:amd64                                      2:4.1.6+dfsg-1ubuntu1                               amd64        
ii  samba-vfs-modules                                     2:4.1.6+dfsg-1ubuntu1                               amd64