autobuild: intermittent test failure detected

2015-10-26 Thread autobuild
The autobuild test system has detected an intermittent failing test in 
the current master tree.

The autobuild log of the failure is available here:

   http://git.samba.org/autobuild.flakey/2015-10-26-1010/flakey.log

The samba build logs are available here:

   http://git.samba.org/autobuild.flakey/2015-10-26-1010/samba.stderr
   http://git.samba.org/autobuild.flakey/2015-10-26-1010/samba.stdout
  
The top commit at the time of the failure was:

commit 0a924d13cf4bb570cce3955cf0de9d8678b37dbe
Author: Volker Lendecke 
Date:   Tue Oct 6 16:10:43 2015 +0200

smbd: Send SMB2 oplock breaks unencrypted

This is not what Windows server does, but it seems that Windows
clients expect.  Windows->Windows never runs into this issue, because
an encryption-enabled SMB3 connection will always use leases, and lease
breaks *are* unencrypted...

You can reproduce the issue Windows->Windows by disabling leases on the
Windows server. Disable leases using the registry key:

HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\DisableLeasing

Dochelp confirmed that this is a valid workaround for Windows clients
dropping encrypted oplock breaks.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11570

Signed-off-by: Volker Lendecke 
Reviewed-by: Stefan Metzmacher 

Autobuild-User(master): Jeremy Allison 
Autobuild-Date(master): Sat Oct 24 05:01:32 CEST 2015 on sn-devel-104



[SCM] Samba Shared Repository - branch master updated

2015-10-26 Thread Andrew Bartlett
The branch, master has been updated
   via  0d962e0 selftest: Confirm a demote of a real network works
   via  be2e0e6 selftest: Add sample provision of master-c596ac6 with 
multiple DCs
   via  97577fd Add samba4.smb2.create.mkdir-dup(ad_dc_ntvfs) as flapping
   via  55a13e1 samba-tool domain demote: Add support for removing by NTDS 
GUID
   via  e57dcdd samba-tool domain demote: Add --verbose and --quiet options
   via  642de91 samba-tool domain demote: Remove dns-SERVER object as well
   via  145bb6f samba-tool domain demote: Remove all references to the 
demoted host, even in DNS
   via  3226077 pydns: Add replace_by_dn()
   via  a3b92a5 samba-tool domain demote: Use dn.add_base/dn.add_child
   via  00ffb67 samba-tool domain demote: Remove correct DNs and from the 
correct locations
   via  fff09da dns_server: Give WERR_DNS_ERROR_NAME_DOES_NOT_EXIST on 
empty records
   via  27039a7 selftest: Add tests confirming the demote actually removes 
objects
   via  e432c1b samba-tool domain demote: Refuse to remove ourself
   via  097435c selftest: Run samba-tool domain demote while we have a 
clone of the DB handy
   via  1f88353 samba-tool domain demote: Rework to allow cleanup of 
partial demotion, catch more errors
   via  8086900 selftest: Make it clear that the first argument to 
KCC.run() is unused
   via  6965c98 selftest: Run demote test against the RODC environment also
   via  cf075f2 selftest: Reorder tests.py to ensure that demote, then 
dbcheck run last.
   via  f121173cb samba-tool domain demote: Allow to operate on an RODC and 
a subdomain
   via  1874f59 samba-tool domain demote: Add --remove-other-dead-server
   via  2191fca dns_server: Add python method to extract a DNS entry from a 
ldb.MessageElement
   via  b48776d pydsdb: Also accept ldb.MessageElement values to dsdb 
routines
   via  87cd68c dns_server: Add a python module directly accessing DNS 
records in sam.ldb
   via  0504065 dns_server: Put more code in common
   via  2715805 selftest: Add tests for samdb_to_ldif_file
   via  dadfffb python/kcc: Write correct module list into the file during 
ldif_to_samdb
   via  1c02f28 ldb: Fix python bindings to accept a string as a DN
   via  ffe8090 samba-tool drs clone-dc-database: Require --targetdir
   via  04512d1 repl: Use DSDB_REPL_FLAG_PRIORITISE_INCOMING in samba-tool 
drs replicate --local
   via  d1d5ec3 samba-tool drs clone-dc: Add --include-secrets option
   via  4b25650 repl: Give an error if we get a secret when not expecting 
one
   via  6d301ad samba-tool: Add new command 'samba-tool drs 
clone-dc-database'
   via  80171dd samba-tool: Remove vampire subcommand and now unused 
libnet_Vampire()
   via  6cd8e79 repl_meta_data: Print more detail into the LDB error 
string, not just DEBUG()
  from  0a924d1 smbd: Send SMB2 oplock breaks unencrypted

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 0d962e010ea834c0479f403a4c8b38b05b7a0409
Author: Andrew Bartlett 
Date:   Fri Oct 23 15:38:23 2015 +1300

selftest: Confirm a demote of a real network works

Signed-off-by: Andrew Bartlett 
Reviewed-by: Garming Sam 

Autobuild-User(master): Andrew Bartlett 
Autobuild-Date(master): Mon Oct 26 08:17:47 CET 2015 on sn-devel-104

commit be2e0e6ff7e7388711c1d1570057ec0dfd36c39d
Author: Andrew Bartlett 
Date:   Fri Oct 23 15:05:25 2015 +1300

selftest: Add sample provision of master-c596ac6 with multiple DCs

This will let us test demoting a DC from a multi-DC network

Reviewed-by: Garming Sam 
Signed-off-by: Andrew Bartlett 

commit 97577fd0888feefc72365c534c8adbff69467404
Author: Andrew Bartlett 
Date:   Thu Oct 22 12:01:48 2015 +1300

Add samba4.smb2.create.mkdir-dup(ad_dc_ntvfs) as flapping

This test sometimes succeeds, depending on the build environment.

(Corrects earlier patch to also remove from knownfail)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11486
Signed-off-by: Andrew Bartlett 
Reviewed-by: Garming Sam 

commit 55a13e17b36adc69eb4ec7d706cb9a55906f8275
Author: Andrew Bartlett 
Date:   Tue Oct 20 13:48:07 2015 +1300

samba-tool domain demote: Add support for removing by NTDS GUID

This would help remove a DC that is a conflict record, for example

Signed-off-by: Andrew Bartlett 
Reviewed-by: Garming Sam 

commit e57dcddfe8ca4c2b5591cf3e1687d1ef89112c1a
Author: Andrew Bartlett 
Date:   Fri Oct 16 13:47:29 2015 +1300

samba-tool domain demote: 

[SCM] Samba Shared Repository - branch master updated

2015-10-26 Thread Volker Lendecke
The branch, master has been updated
   via  5350945 WHATSNEW: Describe nss_wins changes
   via  5ab1452 nss_wins: Use libwbclient to query wins server
   via  0abbfb2 nss_wins: Use lp_global_no_reinit()
  from  0d962e0 selftest: Confirm a demote of a real network works

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 53509452db3c61db78eeafb8201ab5fdd7e4b5e0
Author: Andreas Schneider 
Date:   Mon Oct 26 19:53:58 2015 +0100

WHATSNEW: Describe nss_wins changes

Signed-off-by: Andreas Schneider 
Reviewed-by: Volker Lendecke 

Autobuild-User(master): Volker Lendecke 
Autobuild-Date(master): Tue Oct 27 00:27:22 CET 2015 on sn-devel-104

commit 5ab1452436a5be5fbdf892343a4fc710f387eabf
Author: Andreas Schneider 
Date:   Fri Oct 23 12:31:43 2015 +0200

nss_wins: Use libwbclient to query wins server

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11563

Signed-off-by: Andreas Schneider 
Reviewed-by: Volker Lendecke 

commit 0abbfb2e4d5bcd847983ef7981840f1eab7b917c
Author: Andreas Schneider 
Date:   Fri Oct 23 15:28:23 2015 +0200

nss_wins: Use lp_global_no_reinit()

This avoids that we run into use after free issues when we access memory
allocated on the globals and the global being reinitialized.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11563

Signed-off-by: Andreas Schneider 
Reviewed-by: Volker Lendecke 

---

Summary of changes:
 WHATSNEW.txt   |   8 +-
 nsswitch/wins.c| 242 +
 nsswitch/wscript_build |   4 +-
 3 files changed, 93 insertions(+), 161 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 13d7ccb..d76d8fc 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -17,7 +17,13 @@ Nothing special.
 NEW FEATURES
 
 
-TODO...
+WINS nsswitch module
+
+
+The WINS nsswitch module has been rewritten to address memory issues and to
+simplify the code. The module now uses libwbclient to do WINS queries. This
+means that winbind needs to be running in order to resolve WINS names using
+the nss_wins module. This does not affect smbd.
 
 ##
 Changes
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index 735a9a2..3243ffb 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -20,6 +20,7 @@
 
 #include "includes.h"
 #include "nsswitch/winbind_nss.h"
+#include "nsswitch/libwbclient/wbclient.h"
 
 #ifdef HAVE_NS_API_H
 
@@ -38,39 +39,17 @@ static pthread_mutex_t wins_nss_mutex = 
PTHREAD_MUTEX_INITIALIZER;
 #define INADDRSZ 4
 #endif
 
-static int initialised;
-
 NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
  char *buffer, size_t buflen, int *h_errnop);
 NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent 
*he,
   char *buffer, size_t buflen, int *h_errnop);
 
-static void nss_wins_init(void)
-{
-   initialised = 1;
-   lp_set_cmdline("log level", "0");
-
-   TimeInit();
-   setup_logging("nss_wins",False);
-   lp_load_global(get_dyn_CONFIGFILE());
-   load_interfaces();
-}
-
-static struct in_addr *lookup_byname_backend(const char *name, int *count)
+static char *lookup_byname_backend(const char *name)
 {
-   TALLOC_CTX *frame;
-   struct sockaddr_storage *address = NULL;
-   struct in_addr *ret = NULL;
-   NTSTATUS status;
const char *p;
+   char *ip;
size_t nbt_len;
-   int j;
-
-   if (!initialised) {
-   nss_wins_init();
-   }
-
-   *count = 0;
+   wbcErr result;
 
nbt_len = strlen(name);
if (nbt_len > MAX_NETBIOSNAME_LEN - 1) {
@@ -81,82 +60,42 @@ static struct in_addr *lookup_byname_backend(const char 
*name, int *count)
return NULL;
}
 
-   frame = talloc_stackframe();
-   /* always try with wins first */
-   status = resolve_wins(name, 0x00, talloc_tos(),
- , count);
-   if (NT_STATUS_IS_OK(status)) {
-   if ( (ret = SMB_MALLOC_P(struct in_addr)) == NULL ) {
-   TALLOC_FREE(frame);
-   return NULL;
-   }
-   if (address[0].ss_family != AF_INET) {
-   free(ret);
-   TALLOC_FREE(frame);
-   return NULL;
-   }
-   *ret = ((struct sockaddr_in *)(void *)address)
-   ->sin_addr;
-   TALLOC_FREE(frame);
-   return ret;
+   

[SCM] Samba Shared Repository - branch master updated

2015-10-26 Thread Andrew Bartlett
The branch, master has been updated
   via  84b7a9f build:wafsamba: dead code removal in gettext detection
   via  f9d6be3 selftest: Avoid system krb5.conf in "none" test env
   via  8d3106b selftest: Avoid system krb5.conf in some test envs that 
don't use kerberos
   via  63c8919 selftest: Avoid system krb5.conf in testenv provisioning
   via  843cb8e Documentation : Add GitHub notes to README.
  from  5350945 WHATSNEW: Describe nss_wins changes

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 84b7a9f939f43baf33de4384a8c06687dd4e9c2b
Author: Thomas Nagy 
Date:   Sun Oct 25 13:30:59 2015 +0100

build:wafsamba: dead code removal in gettext detection

Since the --gettext-location command-line option has no effect, the 
misleading
code is removed. The samba functions ADD_CFLAGS must also be used in the 
future

Signed-off-by: Thomas Nagy 
Reviewed-by: Uri Simchoni 
Reviewed-by: Andrew Bartlett 

Autobuild-User(master): Andrew Bartlett 
Autobuild-Date(master): Tue Oct 27 03:34:28 CET 2015 on sn-devel-104

commit f9d6be3b749313a03e9097d848ce078f19197a0a
Author: Uri Simchoni 
Date:   Mon Oct 26 07:38:08 2015 +0200

selftest: Avoid system krb5.conf in "none" test env

Some torture tests do not perform Kerberos activity and do not
run against a server (hence the "none" test env), but do create
a krb5 context, and that causes the Kerberos libs to read
krb5.conf and choke if they don't understand it.

Signed-off-by: Uri Simchoni 
Reviewed-by: Andrew Bartlett 

commit 8d3106b1a4d9da5bf8b127fa70a77076d3dfeca8
Author: Uri Simchoni 
Date:   Sun Oct 25 15:02:17 2015 +0200

selftest: Avoid system krb5.conf in some test envs that don't use kerberos

Some test envs don't use kerberos (e.g. nt4_dc). However, the client
tools are built with Kerberos support and may get upset if hitting
a krb5.conf file they don't understand.

Signed-off-by: Uri Simchoni 
Reviewed-by: Andrew Bartlett 

commit 63c891938a2d3e1c222898d6dea5c640822b0191
Author: Uri Simchoni 
Date:   Sat Oct 24 00:41:23 2015 +0300

selftest: Avoid system krb5.conf in testenv provisioning

Some provisioning commands don't necessarily need a krb5.conf,
but they still must cause samba's Kerberos libraries to avoid
looking at the system krb5.conf, as this file may not be understood
by samba's Kerberos libs and fail the env provisioning.

Signed-off-by: Uri Simchoni 
Reviewed-by: Andrew Bartlett 

commit 843cb8ec5b92ef72421952d5503c1deec1559fe8
Author: Scott Lovenberg 
Date:   Tue Oct 20 12:20:10 2015 -0700

Documentation : Add GitHub notes to README.

Signed-off-by: Scott Lovenberg 
Reviewed-by: Jeremy Allison 
Reviewed-by: Andrew Bartlett 

---

Summary of changes:
 README  | 18 +-
 buildtools/wafsamba/wscript |  3 ---
 lib/replace/wscript | 11 ---
 selftest/selftest.pl|  5 +
 selftest/target/Samba3.pm   | 14 ++
 selftest/target/Samba4.pm   | 34 +-
 6 files changed, 61 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/README b/README
index 6fc98e6..e3982d9 100644
--- a/README
+++ b/README
@@ -100,7 +100,23 @@ Related packages include:
 CONTRIBUTIONS
 =
 
-If you want to contribute to the development of the software then
+1. To contribute via GitHub
+  - fork the official Samba team repository on GitHub
+  * see https://github.com/samba-team/samba
+  - become familiar with the coding standards as described in README.Coding
+  - make sure you read the Samba copyright policy
+  * see https://www.samba.org/samba/devel/copyright-policy.html
+  - create a feature branch
+  - make changes
+  - when committing, be sure to add signed-off-by tags
+  * see https://wiki.samba.org/index.php/CodeReview#commit_message_tags
+  - send a pull request for your branch through GitHub
+  - this will trigger an email to the samba-technical mailing list
+  - discussion happens on the samba-technical mailing list as described below
+  - more info on using Git for Samba development can be found on the Samba Wiki
+  * see https://wiki.samba.org/index.php/Using_Git_for_Samba_Development
+
+2. If you want to contribute to the development of the software then
 please join the mailing list. The Samba team accepts patches
 (preferably in "diff -u" format, see 

[SCM] Samba Shared Repository - branch v4-2-test updated

2015-10-26 Thread Karolin Seeger
The branch, v4-2-test has been updated
   via  bf344f7 dcerpc.idl: accept invalid dcerpc_bind_nak pdus
  from  4cb9657 s3:smbstatus: add stream name to share_entry_forall()

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -
commit bf344f71ec731401a7e31a6cb3691fb1fff2baaf
Author: Stefan Metzmacher 
Date:   Wed Oct 21 12:01:26 2015 +0200

dcerpc.idl: accept invalid dcerpc_bind_nak pdus

Older Samba versions (<= 4.1) had a bug in the dcerpc_bind_nak
idl, see commit f73ef3028c4f4583c81b611a9714608eae79360c.

Note: ndr_pull_dcerpc_bind_nak() was generated by pidl and
has been extended by the (_available == 0) check.
That's why we ignore the 80 char per line limit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11327

Signed-off-by: Stefan Metzmacher 
Reviewed-by: Volker Lendecke 

Autobuild-User(master): Stefan Metzmacher 
Autobuild-Date(master): Wed Oct 21 20:34:28 CEST 2015 on sn-devel-104

(cherry picked from commit 38d547bc0d39b56a7491a5f220905f1756c1530a)

Autobuild-User(v4-2-test): Karolin Seeger 
Autobuild-Date(v4-2-test): Mon Oct 26 13:40:47 CET 2015 on sn-devel-104

---

Summary of changes:
 librpc/idl/dcerpc.idl   |  6 +++---
 librpc/ndr/ndr_dcerpc.c | 49 +
 2 files changed, 52 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
index 67f4b9d..cb7f5b8 100644
--- a/librpc/idl/dcerpc.idl
+++ b/librpc/idl/dcerpc.idl
@@ -114,7 +114,7 @@ interface dcerpc
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
} dcerpc_bind_ack;
 
-   typedef [enum16bit] enum {
+   typedef [public,enum16bit] enum {
DCERPC_BIND_NAK_REASON_NOT_SPECIFIED  = 0,
DCERPC_BIND_NAK_REASON_TEMPORARY_CONGESTION   = 1,
DCERPC_BIND_NAK_REASON_LOCAL_LIMIT_EXCEEDED   = 2,
@@ -128,12 +128,12 @@ interface dcerpc
const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE =
DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE;
 
-   typedef struct {
+   typedef [public] struct {
uint8 rpc_vers; /* RPC version */
uint8 rpc_vers_minor;   /* Minor version */
} dcerpc_bind_nak_version;
 
-   typedef struct {
+   typedef [public,nopull] struct {
dcerpc_bind_nak_reason reject_reason;
uint8 num_versions;
dcerpc_bind_nak_version versions[num_versions];
diff --git a/librpc/ndr/ndr_dcerpc.c b/librpc/ndr/ndr_dcerpc.c
index ca09fb6..0224b2c 100644
--- a/librpc/ndr/ndr_dcerpc.c
+++ b/librpc/ndr/ndr_dcerpc.c
@@ -24,6 +24,55 @@
 #include "librpc/gen_ndr/ndr_dcerpc.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 
+/*
+ * This function was generated by pidl and
+ * has been extended by the (_available == 0) check.
+ *
+ * That's why we ignore the 80 char per line limit.
+ */
+enum ndr_err_code ndr_pull_dcerpc_bind_nak(struct ndr_pull *ndr, int 
ndr_flags, struct dcerpc_bind_nak *r)
+{
+   uint32_t size_versions_0 = 0;
+   uint32_t cntr_versions_0;
+   TALLOC_CTX *_mem_save_versions_0 = NULL;
+   NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+   if (ndr_flags & NDR_SCALARS) {
+   uint32_t _available;
+   NDR_CHECK(ndr_pull_align(ndr, 4));
+   NDR_CHECK(ndr_pull_dcerpc_bind_nak_reason(ndr, NDR_SCALARS, 
>reject_reason));
+   _available = ndr->data_size - ndr->offset;
+   if (_available == 0) {
+   /*
+* This works around a bug in older
+* Samba (<= 4.1) releases.
+*
+* See bug #11327.
+*/
+   r->num_versions = 0;
+   } else {
+   NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, 
>num_versions));
+   }
+   size_versions_0 = r->num_versions;
+   NDR_PULL_ALLOC_N(ndr, r->versions, size_versions_0);
+   _mem_save_versions_0 = NDR_PULL_GET_MEM_CTX(ndr);
+   NDR_PULL_SET_MEM_CTX(ndr, r->versions, 0);
+   for (cntr_versions_0 = 0; cntr_versions_0 < (size_versions_0); 
cntr_versions_0++) {
+   NDR_CHECK(ndr_pull_dcerpc_bind_nak_version(ndr, 
NDR_SCALARS, >versions[cntr_versions_0]));
+   }
+   NDR_PULL_SET_MEM_CTX(ndr, _mem_save_versions_0, 0);
+   {
+   uint32_t _flags_save_DATA_BLOB = ndr->flags;
+   ndr_set_flags(>flags, LIBNDR_FLAG_REMAINING);
+   NDR_CHECK(ndr_pull_DATA_BLOB(ndr, 

[SCM] Samba Shared Repository - branch v4-3-test updated

2015-10-26 Thread Karolin Seeger
The branch, v4-3-test has been updated
   via  05e381f dcerpc.idl: accept invalid dcerpc_bind_nak pdus
  from  331cf24 VERSION: Bump version up to 4.3.2...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-3-test


- Log -
commit 05e381f4225e18b82f7dc5985b13b8850ddbfded
Author: Stefan Metzmacher 
Date:   Wed Oct 21 12:01:26 2015 +0200

dcerpc.idl: accept invalid dcerpc_bind_nak pdus

Older Samba versions (<= 4.1) had a bug in the dcerpc_bind_nak
idl, see commit f73ef3028c4f4583c81b611a9714608eae79360c.

Note: ndr_pull_dcerpc_bind_nak() was generated by pidl and
has been extended by the (_available == 0) check.
That's why we ignore the 80 char per line limit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11327

Signed-off-by: Stefan Metzmacher 
Reviewed-by: Volker Lendecke 

Autobuild-User(master): Stefan Metzmacher 
Autobuild-Date(master): Wed Oct 21 20:34:28 CEST 2015 on sn-devel-104

(cherry picked from commit 38d547bc0d39b56a7491a5f220905f1756c1530a)

Autobuild-User(v4-3-test): Karolin Seeger 
Autobuild-Date(v4-3-test): Mon Oct 26 14:19:06 CET 2015 on sn-devel-104

---

Summary of changes:
 librpc/idl/dcerpc.idl   |  6 +++---
 librpc/ndr/ndr_dcerpc.c | 49 +
 2 files changed, 52 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
index 63be48e..1036693 100644
--- a/librpc/idl/dcerpc.idl
+++ b/librpc/idl/dcerpc.idl
@@ -114,7 +114,7 @@ interface dcerpc
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
} dcerpc_bind_ack;
 
-   typedef [enum16bit] enum {
+   typedef [public,enum16bit] enum {
DCERPC_BIND_NAK_REASON_NOT_SPECIFIED  = 0,
DCERPC_BIND_NAK_REASON_TEMPORARY_CONGESTION   = 1,
DCERPC_BIND_NAK_REASON_LOCAL_LIMIT_EXCEEDED   = 2,
@@ -128,12 +128,12 @@ interface dcerpc
const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE =
DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE;
 
-   typedef struct {
+   typedef [public] struct {
uint8 rpc_vers; /* RPC version */
uint8 rpc_vers_minor;   /* Minor version */
} dcerpc_bind_nak_version;
 
-   typedef struct {
+   typedef [public,nopull] struct {
dcerpc_bind_nak_reason reject_reason;
uint8 num_versions;
dcerpc_bind_nak_version versions[num_versions];
diff --git a/librpc/ndr/ndr_dcerpc.c b/librpc/ndr/ndr_dcerpc.c
index ca09fb6..0224b2c 100644
--- a/librpc/ndr/ndr_dcerpc.c
+++ b/librpc/ndr/ndr_dcerpc.c
@@ -24,6 +24,55 @@
 #include "librpc/gen_ndr/ndr_dcerpc.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 
+/*
+ * This function was generated by pidl and
+ * has been extended by the (_available == 0) check.
+ *
+ * That's why we ignore the 80 char per line limit.
+ */
+enum ndr_err_code ndr_pull_dcerpc_bind_nak(struct ndr_pull *ndr, int 
ndr_flags, struct dcerpc_bind_nak *r)
+{
+   uint32_t size_versions_0 = 0;
+   uint32_t cntr_versions_0;
+   TALLOC_CTX *_mem_save_versions_0 = NULL;
+   NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+   if (ndr_flags & NDR_SCALARS) {
+   uint32_t _available;
+   NDR_CHECK(ndr_pull_align(ndr, 4));
+   NDR_CHECK(ndr_pull_dcerpc_bind_nak_reason(ndr, NDR_SCALARS, 
>reject_reason));
+   _available = ndr->data_size - ndr->offset;
+   if (_available == 0) {
+   /*
+* This works around a bug in older
+* Samba (<= 4.1) releases.
+*
+* See bug #11327.
+*/
+   r->num_versions = 0;
+   } else {
+   NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, 
>num_versions));
+   }
+   size_versions_0 = r->num_versions;
+   NDR_PULL_ALLOC_N(ndr, r->versions, size_versions_0);
+   _mem_save_versions_0 = NDR_PULL_GET_MEM_CTX(ndr);
+   NDR_PULL_SET_MEM_CTX(ndr, r->versions, 0);
+   for (cntr_versions_0 = 0; cntr_versions_0 < (size_versions_0); 
cntr_versions_0++) {
+   NDR_CHECK(ndr_pull_dcerpc_bind_nak_version(ndr, 
NDR_SCALARS, >versions[cntr_versions_0]));
+   }
+   NDR_PULL_SET_MEM_CTX(ndr, _mem_save_versions_0, 0);
+   {
+   uint32_t _flags_save_DATA_BLOB = ndr->flags;
+   ndr_set_flags(>flags, LIBNDR_FLAG_REMAINING);
+   NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS,