[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Sun Feb 14 00:45:07 MST 2010


The branch, master has been updated
       via  eb5fc89... s4-rpcserver: teach the rpc server to cope with bad sig_size estimates
       via  259129e... a4-dcerpc: another attempt at dcerpc auth padding
       via  ccfa40f... util: update three other copies of our dlinklist.h macros
       via  862a17e... s3: last part of TYPESAFE_QSORT() conversion
       via  3f0898a... s3-smbd: convert lanman and notify code to TYPESAFE_QSORT()
       via  bc5d203... s3-rpc: convert wkssvc to use TYPESAFE_QSORT()
       via  93a3359... s3-locking: convert brlock to TYPESAFE_QSORT()
       via  7cff685... s3: convert registry and printing code to TYPESAFE_QSORT()
       via  c804102... s3-nmbd: note TODO item for qsort
       via  95e2688... s3-vfs: use TYPESAFE_QSORT() in s3 VFS modules
       via  8120bc2... s3-lib: use TYPESAFE_QSORT() in remaining s3 library code
       via  7347ca3... s3-libsmb: use TYPESAFE_QSORT() in namequery code
       via  007f24f... s3-lib: use TYPESAFE_QSORT() in s3 interfaces code
       via  76a7382... lib: use TYPESAFE_QSORT() in lib/ and libcli/
       via  cebbc9a... s3-includes: enable TYPESAFE_QSORT() in s3
       via  282cc79... s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code
      from  0c39fbc... s4:loadparm.c - prevent memory leaks

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


- Log -----------------------------------------------------------------
commit eb5fc899b0a17d86eef4f40d71b023d8db1708b4
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 17:09:55 2010 +1100

    s4-rpcserver: teach the rpc server to cope with bad sig_size estimates

commit 259129e8f4bc8cacd1850eba3f6551134835d079
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 11:56:28 2010 +1100

    a4-dcerpc: another attempt at dcerpc auth padding
    
    The last change broke net vampire against w2k8r2

commit ccfa40fdc3eb785b71a4d2d59933a2fdc352fb24
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Feb 6 12:25:06 2010 +1100

    util: update three other copies of our dlinklist.h macros
    
    ldb and tevent have their own copies of these macros. This brings them
    in sync with the master copy of dlinklist.h

commit 862a17e9ba0aac382a4301d1d60c9d5ea4888959
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:03:55 2010 +1100

    s3: last part of TYPESAFE_QSORT() conversion
    
    convert smbcacls, sharesec and web/

commit 3f0898a9f50a35ae94fda9b89809edae0cd9bbb3
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:03:12 2010 +1100

    s3-smbd: convert lanman and notify code to TYPESAFE_QSORT()

commit bc5d203eeb49ad4c6ff85cff6b05577d81cf1816
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:02:54 2010 +1100

    s3-rpc: convert wkssvc to use TYPESAFE_QSORT()

commit 93a33597292eee51b1f8714526cd145d4abe56c1
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:02:35 2010 +1100

    s3-locking: convert brlock to TYPESAFE_QSORT()

commit 7cff685c7ecb7dbb126d3bd45217d13fa85ad751
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:02:19 2010 +1100

    s3: convert registry and printing code to TYPESAFE_QSORT()

commit c804102d0ff71f5c5664953020e46304d78de4bc
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:01:49 2010 +1100

    s3-nmbd: note TODO item for qsort
    
    This uses another char* cast hack. Left alone for now.

commit 95e26884a85118713faea943115dd003d2442dd5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:01:17 2010 +1100

    s3-vfs: use TYPESAFE_QSORT() in s3 VFS modules

commit 8120bc2ba957fa78e04f6f5fc257c91a7f735e82
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:00:49 2010 +1100

    s3-lib: use TYPESAFE_QSORT() in remaining s3 library code
    
    the sort_query_replies() in nmblib.c is a TODO. It uses a hack that
    treats a char* as a structure. I've left that one alone for now.

commit 7347ca359d6050575be70274a55b18628d0f3c5b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 09:59:26 2010 +1100

    s3-libsmb: use TYPESAFE_QSORT() in namequery code
    
    This one was a bit trickier. I'd appreciate it if someone else can
    look over this.

commit 007f24f29dd61d4585933362529f13c005cf1ed2
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 09:58:33 2010 +1100

    s3-lib: use TYPESAFE_QSORT() in s3 interfaces code

commit 76a7382346f0c9d945adf39da19d69616e2463b3
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 09:58:13 2010 +1100

    lib: use TYPESAFE_QSORT() in lib/ and libcli/

commit cebbc9a6f1a97aaee633b6eeb6d93faff6c0afb5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 09:57:36 2010 +1100

    s3-includes: enable TYPESAFE_QSORT() in s3

commit 282cc79454f7b708085a04d04e98d11ffec8b293
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 14 10:37:20 2010 +1100

    s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code

-----------------------------------------------------------------------

Summary of changes:
 lib/tevent/tevent_util.h             |  163 ++++++++++++++++++++++++----------
 lib/util/tsort.h                     |    4 +-
 lib/util/util_strlist.c              |    3 +-
 libcli/security/secace.c             |    9 +-
 librpc/gen_ndr/dcerpc.h              |    3 +
 librpc/gen_ndr/ndr_dcerpc.c          |    9 ++
 librpc/idl/dcerpc.idl                |    3 +
 source3/include/includes.h           |    1 +
 source3/lib/interfaces.c             |    2 +-
 source3/libads/dns.c                 |    2 +-
 source3/libsmb/libsmb_xattr.c        |    3 +-
 source3/libsmb/namequery.c           |   26 +++---
 source3/libsmb/nmblib.c              |    4 +
 source3/locking/brlock.c             |    5 +-
 source3/modules/vfs_dirsort.c        |    8 +-
 source3/modules/vfs_shadow_copy2.c   |    6 +-
 source3/nmbd/nmbd_incomingrequests.c |    2 +
 source3/printing/printing.c          |    5 +-
 source3/registry/reg_backend_db.c    |    6 +-
 source3/registry/regfio.c            |    3 +-
 source3/rpc_server/srv_wkssvc_nt.c   |   14 +--
 source3/smbd/lanman.c                |    8 +--
 source3/smbd/notify_internal.c       |    8 +--
 source3/utils/sharesec.c             |    2 +-
 source3/utils/smbcacls.c             |    2 +-
 source3/web/neg_lang.c               |    7 +-
 source4/lib/ldb/common/ldb_dn.c      |    4 +-
 source4/lib/ldb/common/ldb_msg.c     |    4 +-
 source4/lib/ldb/include/ldb.h        |   11 +++
 source4/lib/ldb/ldb_tdb/ldb_index.c  |    2 +-
 source4/lib/ldb/tools/ldbdel.c       |   10 +--
 source4/librpc/rpc/dcerpc.c          |   19 +++--
 source4/librpc/rpc/dcerpc_util.c     |    8 +-
 source4/rpc_server/dcesrv_auth.c     |   40 ++++-----
 34 files changed, 242 insertions(+), 164 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/tevent_util.h b/lib/tevent/tevent_util.h
index 829cbc2..46a4506 100644
--- a/lib/tevent/tevent_util.h
+++ b/lib/tevent/tevent_util.h
@@ -1,7 +1,7 @@
 /*
    Unix SMB/CIFS implementation.
 
-   Copyright (C) Andrew Tridgell 1998-2005
+   Copyright (C) Andrew Tridgell 1998-2010
    Copyright (C) Jelmer Vernooij 2005
 
    This program is free software; you can redistribute it and/or modify
@@ -24,55 +24,94 @@
 #ifndef _DLINKLIST_H
 #define _DLINKLIST_H
 
+/*
+  February 2010 - changed list format to have a prev pointer from the
+  list head. This makes DLIST_ADD_END() O(1) even though we only have
+  one list pointer.
+
+  The scheme is as follows:
+
+     1) with no entries in the list:
+          list_head == NULL
+
+     2) with 1 entry in the list:
+          list_head->next == NULL
+          list_head->prev == list_head
+
+     3) with 2 entries in the list:
+          list_head->next == element2
+          list_head->prev == element2
+	  element2->prev == list_head
+	  element2->next == NULL
+
+     4) with N entries in the list:
+          list_head->next == element2
+          list_head->prev == elementN
+	  elementN->prev == element{N-1}
+	  elementN->next == NULL
+
+  This allows us to find the tail of the list by using
+  list_head->prev, which means we can add to the end of the list in
+  O(1) time
 
-/* hook into the front of the list */
+
+  Note that the 'type' arguments below are no longer needed, but
+  are kept for now to prevent an incompatible argument change
+ */
+
+
+/*
+   add an element at the front of a list
+*/
 #define DLIST_ADD(list, p) \
 do { \
         if (!(list)) { \
-		(list) = (p); \
-		(p)->next = (p)->prev = NULL; \
+		(p)->prev = (list) = (p);  \
+		(p)->next = NULL; \
 	} else { \
+		(p)->prev = (list)->prev; \
 		(list)->prev = (p); \
 		(p)->next = (list); \
-		(p)->prev = NULL; \
 		(list) = (p); \
-	}\
+	} \
 } while (0)
 
-/* remove an element from a list - element doesn't have to be in list. */
+/*
+   remove an element from a list
+   Note that the element doesn't have to be in the list. If it
+   isn't then this is a no-op
+*/
 #define DLIST_REMOVE(list, p) \
 do { \
 	if ((p) == (list)) { \
+		if ((p)->next) (p)->next->prev = (p)->prev; \
 		(list) = (p)->next; \
-		if (list) (list)->prev = NULL; \
+	} else if ((list) && (p) == (list)->prev) {	\
+		(p)->prev->next = NULL; \
+		(list)->prev = (p)->prev; \
 	} else { \
 		if ((p)->prev) (p)->prev->next = (p)->next; \
 		if ((p)->next) (p)->next->prev = (p)->prev; \
 	} \
-	if ((p) != (list)) (p)->next = (p)->prev = NULL; \
+	if ((p) != (list)) (p)->next = (p)->prev = NULL;	\
 } while (0)
 
-/* promote an element to the top of the list */
-#define DLIST_PROMOTE(list, p) \
+/*
+   find the head of the list given any element in it.
+   Note that this costs O(N), so you should avoid this macro
+   if at all possible!
+*/
+#define DLIST_HEAD(p, result_head) \
 do { \
-          DLIST_REMOVE(list, p); \
-          DLIST_ADD(list, p); \
-} while (0)
+       (result_head) = (p); \
+       while (DLIST_PREV(result_head)) (result_head) = (result_head)->prev; \
+} while(0)
 
-/* hook into the end of the list - needs a tmp pointer */
-#define DLIST_ADD_END(list, p, type) \
-do { \
-		if (!(list)) { \
-			(list) = (p); \
-			(p)->next = (p)->prev = NULL; \
-		} else { \
-			type tmp; \
-			for (tmp = (list); tmp->next; tmp = tmp->next) ; \
-			tmp->next = (p); \
-			(p)->next = NULL; \
-			(p)->prev = tmp; \
-		} \
-} while (0)
+/* return the last element in the list */
+#define DLIST_TAIL(list) ((list)?(list)->prev:NULL)
+
+/* return the previous element in the list. */
+#define DLIST_PREV(p) (((p)->prev && (p)->prev->next != NULL)?(p)->prev:NULL)
 
 /* insert 'p' after the given element 'el' in a list. If el is NULL then
    this is the same as a DLIST_ADD() */
@@ -81,34 +120,62 @@ do { \
         if (!(list) || !(el)) { \
 		DLIST_ADD(list, p); \
 	} else { \
-		p->prev = el; \
-		p->next = el->next; \
-		el->next = p; \
-		if (p->next) p->next->prev = p; \
+		(p)->prev = (el);   \
+		(p)->next = (el)->next;		\
+		(el)->next = (p);		\
+		if ((p)->next) (p)->next->prev = (p);	\
+		if ((list)->prev == (el)) (list)->prev = (p); \
 	}\
 } while (0)
 
-/* demote an element to the end of the list, needs a tmp pointer */
-#define DLIST_DEMOTE(list, p, tmp) \
+
+/*
+   add to the end of a list.
+   Note that 'type' is ignored
+*/
+#define DLIST_ADD_END(list, p, type)			\
+do { \
+	if (!(list)) { \
+		DLIST_ADD(list, p); \
+	} else { \
+		DLIST_ADD_AFTER(list, p, (list)->prev); \
+	} \
+} while (0)
+
+/* promote an element to the from of a list */
+#define DLIST_PROMOTE(list, p) \
+do { \
+          DLIST_REMOVE(list, p); \
+          DLIST_ADD(list, p); \
+} while (0)
+
+/*
+   demote an element to the end of a list.
+   Note that 'type' is ignored
+*/
+#define DLIST_DEMOTE(list, p, type)			\
 do { \
-		DLIST_REMOVE(list, p); \
-		DLIST_ADD_END(list, p, tmp); \
+	DLIST_REMOVE(list, p); \
+	DLIST_ADD_END(list, p, NULL);		\
 } while (0)
 
-/* concatenate two lists - putting all elements of the 2nd list at the
-   end of the first list */
-#define DLIST_CONCATENATE(list1, list2, type) \
+/*
+   concatenate two lists - putting all elements of the 2nd list at the
+   end of the first list.
+   Note that 'type' is ignored
+*/
+#define DLIST_CONCATENATE(list1, list2, type)	\
 do { \
-		if (!(list1)) { \
-			(list1) = (list2); \
-		} else { \
-			type tmp; \
-			for (tmp = (list1); tmp->next; tmp = tmp->next) ; \
-			tmp->next = (list2); \
-			if (list2) { \
-				(list2)->prev = tmp;	\
-			} \
+	if (!(list1)) { \
+		(list1) = (list2); \
+	} else { \
+		(list1)->prev->next = (list2); \
+		if (list2) { \
+			void *_tmplist = (void *)(list1)->prev; \
+			(list1)->prev = (list2)->prev; \
+			(list2)->prev = _tmplist; \
 		} \
+	} \
 } while (0)
 
 #endif /* _DLINKLIST_H */
diff --git a/lib/util/tsort.h b/lib/util/tsort.h
index 236b369..811d6cd 100644
--- a/lib/util/tsort.h
+++ b/lib/util/tsort.h
@@ -27,12 +27,14 @@
   a wrapper around qsort() that ensures the comparison function is
   type safe.
  */
+#ifndef TYPESAFE_QSORT
 #define TYPESAFE_QSORT(base, numel, comparison) \
 do { \
 	if (numel > 1) { \
-		qsort(base, numel, sizeof((base)[0]), QSORT_CAST comparison); \
+		qsort(base, numel, sizeof((base)[0]), (int (*)(const void *, const void *))comparison); \
 		assert(comparison(&((base)[0]), &((base)[1])) <= 0); \
 	} \
 } while (0)
+#endif
 
 #endif
diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c
index 6d1a695..af733d1 100644
--- a/lib/util/util_strlist.c
+++ b/lib/util/util_strlist.c
@@ -20,6 +20,7 @@
 
 #include "includes.h"
 #include "system/locale.h"
+#include "lib/util/tsort.h"
 
 #undef strcasecmp
 
@@ -393,7 +394,7 @@ _PUBLIC_ const char **str_list_unique(const char **list)
 	}
 	list2 = (const char **)talloc_memdup(list, list,
 					     sizeof(list[0])*(len+1));
-	qsort(list2, len, sizeof(list2[0]), QSORT_CAST list_cmp);
+	TYPESAFE_QSORT(list2, len, list_cmp);
 	list[0] = list2[0];
 	for (i=j=1;i<len;i++) {
 		if (strcmp(list2[i], list[j-1]) != 0) {
diff --git a/libcli/security/secace.c b/libcli/security/secace.c
index 7d87b1c..8a73a6a 100644
--- a/libcli/security/secace.c
+++ b/libcli/security/secace.c
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "librpc/gen_ndr/ndr_security.h"
 #include "libcli/security/dom_sid.h"
+#include "lib/util/tsort.h"
 
 #define  SEC_ACE_HEADER_SIZE (2 * sizeof(uint8_t) + sizeof(uint16_t) + sizeof(uint32_t))
 
@@ -257,7 +258,7 @@ void dacl_sort_into_canonical_order(struct security_ace *srclist, unsigned int n
 		return;
 
 	/* Sort so that non-inherited ACE's come first. */
-	qsort( srclist, num_aces, sizeof(srclist[0]), QSORT_CAST nt_ace_inherit_comp);
+	TYPESAFE_QSORT(srclist, num_aces, nt_ace_inherit_comp);
 
 	/* Find the boundary between non-inherited ACEs. */
 	for (i = 0; i < num_aces; i++ ) {
@@ -270,12 +271,10 @@ void dacl_sort_into_canonical_order(struct security_ace *srclist, unsigned int n
 	/* i now points at entry number of the first inherited ACE. */
 
 	/* Sort the non-inherited ACEs. */
-	if (i)
-		qsort( srclist, i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp);
+	TYPESAFE_QSORT(srclist, i, nt_ace_canon_comp);
 
 	/* Now sort the inherited ACEs. */
-	if (num_aces - i)
-		qsort( &srclist[i], num_aces - i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp);
+	TYPESAFE_QSORT(&srclist[i], num_aces - i, nt_ace_canon_comp);
 }
 
 
diff --git a/librpc/gen_ndr/dcerpc.h b/librpc/gen_ndr/dcerpc.h
index 375a4e9..f05541c 100644
--- a/librpc/gen_ndr/dcerpc.h
+++ b/librpc/gen_ndr/dcerpc.h
@@ -180,14 +180,17 @@ struct dcerpc_auth {
 }/* [public] */;
 
 struct dcerpc_auth3 {
+	uint32_t _pad;/* [value(0)] */
 	DATA_BLOB auth_info;/* [flag(LIBNDR_FLAG_REMAINING)] */
 }/* [public] */;
 
 struct dcerpc_orphaned {
+	uint32_t _pad;/* [value(0)] */
 	DATA_BLOB auth_info;/* [flag(LIBNDR_FLAG_REMAINING)] */
 }/* [public] */;
 
 struct dcerpc_co_cancel {
+	uint32_t _pad;/* [value(0)] */
 	DATA_BLOB auth_info;/* [flag(LIBNDR_FLAG_REMAINING)] */
 }/* [public] */;
 
diff --git a/librpc/gen_ndr/ndr_dcerpc.c b/librpc/gen_ndr/ndr_dcerpc.c
index 0884d8e..dca445a 100644
--- a/librpc/gen_ndr/ndr_dcerpc.c
+++ b/librpc/gen_ndr/ndr_dcerpc.c
@@ -866,6 +866,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_dcerpc_auth3(struct ndr_push *ndr, int ndr_f
 {
 	if (ndr_flags & NDR_SCALARS) {
 		NDR_CHECK(ndr_push_align(ndr, 4));
+		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
 		{
 			uint32_t _flags_save_DATA_BLOB = ndr->flags;
 			ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
@@ -883,6 +884,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_auth3(struct ndr_pull *ndr, int ndr_f
 {
 	if (ndr_flags & NDR_SCALARS) {
 		NDR_CHECK(ndr_pull_align(ndr, 4));
+		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_pad));
 		{
 			uint32_t _flags_save_DATA_BLOB = ndr->flags;
 			ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
@@ -900,6 +902,7 @@ _PUBLIC_ void ndr_print_dcerpc_auth3(struct ndr_print *ndr, const char *name, co
 {
 	ndr_print_struct(ndr, name, "dcerpc_auth3");
 	ndr->depth++;
+	ndr_print_uint32(ndr, "_pad", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->_pad);
 	ndr_print_DATA_BLOB(ndr, "auth_info", r->auth_info);
 	ndr->depth--;
 }
@@ -908,6 +911,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_dcerpc_orphaned(struct ndr_push *ndr, int nd
 {
 	if (ndr_flags & NDR_SCALARS) {
 		NDR_CHECK(ndr_push_align(ndr, 4));
+		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
 		{
 			uint32_t _flags_save_DATA_BLOB = ndr->flags;
 			ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
@@ -925,6 +929,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_orphaned(struct ndr_pull *ndr, int nd
 {
 	if (ndr_flags & NDR_SCALARS) {
 		NDR_CHECK(ndr_pull_align(ndr, 4));
+		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_pad));
 		{
 			uint32_t _flags_save_DATA_BLOB = ndr->flags;
 			ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
@@ -942,6 +947,7 @@ _PUBLIC_ void ndr_print_dcerpc_orphaned(struct ndr_print *ndr, const char *name,
 {
 	ndr_print_struct(ndr, name, "dcerpc_orphaned");
 	ndr->depth++;
+	ndr_print_uint32(ndr, "_pad", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->_pad);
 	ndr_print_DATA_BLOB(ndr, "auth_info", r->auth_info);
 	ndr->depth--;
 }
@@ -950,6 +956,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_dcerpc_co_cancel(struct ndr_push *ndr, int n
 {
 	if (ndr_flags & NDR_SCALARS) {
 		NDR_CHECK(ndr_push_align(ndr, 4));
+		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
 		{
 			uint32_t _flags_save_DATA_BLOB = ndr->flags;
 			ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
@@ -967,6 +974,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_co_cancel(struct ndr_pull *ndr, int n
 {
 	if (ndr_flags & NDR_SCALARS) {
 		NDR_CHECK(ndr_pull_align(ndr, 4));
+		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_pad));
 		{
 			uint32_t _flags_save_DATA_BLOB = ndr->flags;
 			ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
@@ -984,6 +992,7 @@ _PUBLIC_ void ndr_print_dcerpc_co_cancel(struct ndr_print *ndr, const char *name
 {
 	ndr_print_struct(ndr, name, "dcerpc_co_cancel");
 	ndr->depth++;
+	ndr_print_uint32(ndr, "_pad", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->_pad);
 	ndr_print_DATA_BLOB(ndr, "auth_info", r->auth_info);
 	ndr->depth--;
 }
diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
index ccf5e5d..adc1f4e 100644
--- a/librpc/idl/dcerpc.idl
+++ b/librpc/idl/dcerpc.idl
@@ -155,14 +155,17 @@ interface dcerpc
 	const uint8 DCERPC_AUTH_TRAILER_LENGTH = 8;
 
 	typedef [public] struct {
+		[value(0)]	      uint32    _pad;
 		[flag(NDR_REMAINING)] DATA_BLOB auth_info;
 	} dcerpc_auth3;
 
 	typedef [public] struct {
+		[value(0)]	      uint32    _pad;
 		[flag(NDR_REMAINING)] DATA_BLOB auth_info;
 	} dcerpc_orphaned;
 
 	typedef [public] struct {
+		[value(0)]	      uint32    _pad;
 		[flag(NDR_REMAINING)] DATA_BLOB auth_info;
 	} dcerpc_co_cancel;
 
diff --git a/source3/include/includes.h b/source3/include/includes.h
index d9d51a8..4179d49 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -609,6 +609,7 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
 #include "../lib/util/xfile.h"
 #include "../lib/util/memory.h"
 #include "../lib/util/attr.h"
+#include "../lib/util/tsort.h"
 #include "intl.h"
 #include "../lib/util/dlinklist.h"
 #include "tdb.h"
diff --git a/source3/lib/interfaces.c b/source3/lib/interfaces.c
index b4b3800..5996fde 100644
--- a/source3/lib/interfaces.c
+++ b/source3/lib/interfaces.c
@@ -279,7 +279,7 @@ int get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces)
 	if (total <= 0) return total;
 
 	/* now we need to remove duplicates */
-	qsort(ifaces, total, sizeof(ifaces[0]), QSORT_CAST iface_comp);
+	TYPESAFE_QSORT(ifaces, total, iface_comp);
 
 	for (i=1;i<total;) {
 		if (iface_comp(&ifaces[i-1], &ifaces[i]) == 0) {
diff --git a/source3/libads/dns.c b/source3/libads/dns.c
index 1765f95..2fa6f18 100644
--- a/source3/libads/dns.c
+++ b/source3/libads/dns.c
@@ -563,7 +563,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx,
 		}
 	}
 
-	qsort( dcs, idx, sizeof(struct dns_rr_srv), QSORT_CAST dnssrvcmp );
+	TYPESAFE_QSORT(dcs, idx, dnssrvcmp );
 
 	*dclist = dcs;
 	*numdcs = idx;
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 27c3e12..cbdca4e 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -145,8 +145,7 @@ sort_acl(SEC_ACL *the_acl)
 	uint32 i;
 	if (!the_acl) return;
 
-	qsort(the_acl->aces, the_acl->num_aces, sizeof(the_acl->aces[0]),
-              QSORT_CAST ace_compare);
+	TYPESAFE_QSORT(the_acl->aces, the_acl->num_aces, ace_compare);
 
 	for (i=1;i<the_acl->num_aces;) {
 		if (sec_ace_equal(&the_acl->aces[i-1], &the_acl->aces[i])) {
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index be038ec..ed718ce 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -433,16 +433,16 @@ bool name_status_find(const char *q_name,
   comparison function used by sort_addr_list
 */
 
-static int addr_compare(const struct sockaddr *ss1,
-		const struct sockaddr *ss2)
+static int addr_compare(const struct sockaddr_storage *ss1,
+			const struct sockaddr_storage *ss2)
 {
 	int max_bits1=0, max_bits2=0;
 	int num_interfaces = iface_count();
 	int i;
 
 	/* Sort IPv4 addresses first. */
-	if (ss1->sa_family != ss2->sa_family) {
-		if (ss2->sa_family == AF_INET) {
+	if (ss1->ss_family != ss2->ss_family) {
+		if (ss2->ss_family == AF_INET) {
 			return 1;
 		} else {
 			return -1;
@@ -460,7 +460,7 @@ static int addr_compare(const struct sockaddr *ss1,
 		size_t len = 0;
 		int bits1, bits2;
 
-		if (pss->ss_family != ss1->sa_family) {
+		if (pss->ss_family != ss1->ss_family) {
 			/* Ignore interfaces of the wrong type. */
 			continue;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list