[SCM] Samba Shared Repository - branch master updated - d36edccc00452ff059a2e0ab5b7c4b68cb84eeb1

Jelmer Vernooij jelmer at samba.org
Mon Oct 20 19:35:51 GMT 2008


The branch, master has been updated
       via  d36edccc00452ff059a2e0ab5b7c4b68cb84eeb1 (commit)
       via  2c1b1255c2dc095013863a1d99b750e8506237fa (commit)
       via  7498f9a9d809af1213699b9349546ba51fd0d2b5 (commit)
       via  6d2d09348f8354bc7d906fba6f5b31d9bca0d664 (commit)
       via  d59b2472f4dbca29d38232d38c9bb7fce9d80ecf (commit)
       via  41b02b7ac042fda700170c1e701de53d7e559e60 (commit)
       via  4b65445582c877aa90a51b97112d0047f51d37c7 (commit)
       via  dc3828f06c8c77ca9fb683528096f2d412028b12 (commit)
       via  87ec1d2532eb17dfd7f98431bdfa4071be57f683 (commit)
       via  01a902f59978cebdab22aaee7d9e0c9bb78bc649 (commit)
       via  66b1c8b61a8fea309bf96df4c07a6f2c1b95041b (commit)
       via  0dfd5601a05d9cfc594604ccf3aae17b0b2c96de (commit)
       via  4a8c05a91b34370654e28a3b83ab00903748c7d4 (commit)
       via  05a0ccadb0cb262dd8b1138c983050b9477ea951 (commit)
      from  bc9bbda8b390a221d7b88fd6eb1b54efc8c91c6b (commit)

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


- Log -----------------------------------------------------------------
commit d36edccc00452ff059a2e0ab5b7c4b68cb84eeb1
Merge: 2c1b1255c2dc095013863a1d99b750e8506237fa bc9bbda8b390a221d7b88fd6eb1b54efc8c91c6b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 21:35:10 2008 +0200

    Merge branch 'master' of git://git.samba.org/samba
    
    Conflicts:
    	source3/include/proto.h

commit 2c1b1255c2dc095013863a1d99b750e8506237fa
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 21:33:41 2008 +0200

    Add source4/ to include path because librpc/gen_ndr is still in source?/

commit 7498f9a9d809af1213699b9349546ba51fd0d2b5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 19:51:07 2008 +0200

    Add missing prototypes for samba3-specific libndr/util.c

commit 6d2d09348f8354bc7d906fba6f5b31d9bca0d664
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 19:50:49 2008 +0200

    Sync syntax of srvsvc.idl with samba3.

commit d59b2472f4dbca29d38232d38c9bb7fce9d80ecf
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 19:35:55 2008 +0200

    Include generated header files rather than using manually written
    prototypes.

commit 41b02b7ac042fda700170c1e701de53d7e559e60
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 19:20:12 2008 +0200

    Move orpc to top-level directory.

commit 4b65445582c877aa90a51b97112d0047f51d37c7
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 19:14:55 2008 +0200

    Remove unused function str_list_match.

commit dc3828f06c8c77ca9fb683528096f2d412028b12
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 19:14:47 2008 +0200

    Move WMI support code to top-level.

commit 87ec1d2532eb17dfd7f98431bdfa4071be57f683
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 18:59:51 2008 +0200

    Make sure prototypes are always included, make some functions static and
    remove some unused functions.

commit 01a902f59978cebdab22aaee7d9e0c9bb78bc649
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 18:59:45 2008 +0200

    Fix crypto test.

commit 66b1c8b61a8fea309bf96df4c07a6f2c1b95041b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 17:16:04 2008 +0200

    Import comments about opcodes from Samba 3.

commit 0dfd5601a05d9cfc594604ccf3aae17b0b2c96de
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 17:15:17 2008 +0200

    Move discard_const hack to memory.hso it can be used by Samba 3.

commit 4a8c05a91b34370654e28a3b83ab00903748c7d4
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 16:52:00 2008 +0200

    Remove unused macro CONST_ADD.

commit 05a0ccadb0cb262dd8b1138c983050b9477ea951
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Oct 20 16:46:19 2008 +0200

    Remove unused define for crypt (now in libreplace).

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

Summary of changes:
 lib/crypto/crc32.c                             |    1 +
 lib/crypto/md4.c                               |    1 +
 lib/replace/crypt.m4                           |    2 +-
 lib/util/debug.h                               |    4 +
 lib/util/memory.h                              |   25 +++
 lib/util/time.h                                |    7 +-
 lib/util/unix_privs.c                          |    1 +
 lib/util/util.c                                |    1 -
 lib/util/util.h                                |   38 +---
 lib/util/xfile.h                               |    2 +
 libcli/nbt/nbtsocket.c                         |    1 +
 librpc/ndr/ndr_misc.c                          |    9 -
 librpc/ndr/ndr_orpc.c                          |  173 ++++++++++++++++
 librpc/ndr/ndr_table.c                         |    2 -
 librpc/ndr/ndr_table.h                         |    1 +
 librpc/ndr/ndr_wmi.c                           |   60 ++++++
 librpc/ndr/ndr_wmi.h                           |    3 +
 librpc/tools/ndrdump.c                         |    5 +-
 source3/Makefile.in                            |    2 +-
 source3/include/includes.h                     |    5 -
 source3/include/proto.h                        |  250 ++++--------------------
 source4/auth/auth_sam_reply.c                  |    1 +
 source4/auth/credentials/credentials.c         |    1 +
 source4/auth/credentials/credentials_files.c   |    1 +
 source4/auth/gensec/cyrus_sasl.c               |    2 +-
 source4/auth/gensec/gensec_gssapi.c            |    2 +-
 source4/auth/gensec/schannel_state.c           |    1 +
 source4/auth/kerberos/gssapi_parse.c           |    2 +
 source4/auth/kerberos/kerberos.c               |    1 +
 source4/auth/kerberos/kerberos_heimdal.c       |    1 +
 source4/auth/ntlm/auth_util.c                  |    1 +
 source4/auth/ntlm/pam_errors.c                 |    1 +
 source4/auth/ntlm/pam_errors.h                 |   13 --
 source4/auth/ntlmssp/ntlmssp_parse.c           |    2 +-
 source4/auth/sam.c                             |    1 +
 source4/cluster/ctdb/ctdb_cluster.c            |    1 +
 source4/dsdb/common/flag_mapping.c             |    2 +
 source4/dsdb/samdb/ldb_modules/anr.c           |    4 +-
 source4/dsdb/samdb/ldb_modules/partition.c     |    2 +-
 source4/dsdb/samdb/ldb_modules/samldb.c        |    4 +-
 source4/dsdb/samdb/ldb_modules/update_keytab.c |    4 +-
 source4/heimdal/lib/hdb/keys.c                 |    6 +-
 source4/heimdal_build/gssapi-glue.c            |    3 +-
 source4/lib/charset/charset.h                  |    4 +
 source4/lib/cmdline/credentials.c              |    1 +
 source4/lib/cmdline/popt_common.h              |    2 +
 source4/lib/events/events_util.c               |    1 +
 source4/lib/ldb/include/ldb_private.h          |    7 +
 source4/lib/ldb/ldb_map/ldb_map_private.h      |    2 +
 source4/lib/ldb/ldb_tdb/ldb_search.c           |    2 +-
 source4/lib/ldb/ldb_tdb/ldb_tdb.c              |    4 +-
 source4/lib/ldb/modules/paged_results.c        |    2 +-
 source4/lib/registry/registry.h                |   12 ++
 source4/lib/smbreadline/smbreadline.c          |    2 +-
 source4/lib/tls/tls.c                          |    1 -
 source4/lib/tls/tlscert.c                      |    4 +
 source4/lib/torture/torture.c                  |   13 --
 source4/libcli/auth/smbdes.c                   |    1 +
 source4/libcli/ldap/ldap_controls.c            |    1 +
 source4/libcli/ldap/ldap_msg.c                 |    1 +
 source4/libcli/ldap/ldap_ndr.c                 |    1 +
 source4/libcli/raw/clierror.c                  |    1 +
 source4/libcli/raw/clisocket.c                 |    1 +
 source4/libcli/raw/rawdate.c                   |    1 +
 source4/libcli/raw/raweas.c                    |    1 +
 source4/libcli/raw/rawlpq.c                    |    1 +
 source4/libcli/resolve/nbtlist.c               |    1 +
 source4/libnet/groupinfo.c                     |    1 +
 source4/libnet/groupman.c                      |    1 +
 source4/libnet/py_net.c                        |    2 +-
 source4/libnet/userinfo.c                      |    1 +
 source4/libnet/userman.c                       |    1 +
 source4/librpc/config.mk                       |    6 +-
 source4/librpc/idl/dcerpc.idl                  |   40 ++--
 source4/librpc/idl/srvsvc.idl                  |   10 +-
 source4/librpc/ndr/ndr_orpc.c                  |  173 ----------------
 source4/librpc/ndr/ndr_wmi.c                   |   90 ---------
 source4/librpc/ndr/ndr_wmi.h                   |    3 -
 source4/nbt_server/dgram/browse.c              |    1 +
 source4/nbt_server/dgram/netlogon.c            |    1 +
 source4/ntvfs/cifs_posix_cli/svfs_util.c       |    1 +
 source4/ntvfs/ipc/rap_server.c                 |    2 +
 source4/ntvfs/simple/svfs_util.c               |    1 +
 source4/param/share_ldb.c                      |    6 +-
 source4/rpc_server/common/server_info.c        |    2 +
 source4/rpc_server/common/share_info.c         |    2 +
 source4/rpc_server/drsuapi/dcesrv_drsuapi.c    |    4 +-
 source4/scripting/python/modules.c             |    1 +
 source4/smbd/process_model.c                   |    1 +
 source4/torture/libnet/utils.c                 |    1 +
 source4/torture/smbtorture.c                   |    2 +-
 source4/torture/torture.c                      |    1 +
 92 files changed, 461 insertions(+), 609 deletions(-)
 create mode 100644 librpc/ndr/ndr_orpc.c
 create mode 100644 librpc/ndr/ndr_wmi.c
 create mode 100644 librpc/ndr/ndr_wmi.h
 delete mode 100644 source4/librpc/ndr/ndr_orpc.c
 delete mode 100644 source4/librpc/ndr/ndr_wmi.c
 delete mode 100644 source4/librpc/ndr/ndr_wmi.h


Changeset truncated at 500 lines:

diff --git a/lib/crypto/crc32.c b/lib/crypto/crc32.c
index 5b9d9b1..e6cc529 100644
--- a/lib/crypto/crc32.c
+++ b/lib/crypto/crc32.c
@@ -41,6 +41,7 @@
  */
 
 #include "includes.h"
+#include "../lib/crypto/crc32.h"
 
 static const uint32_t crc32_tab[] = {
 	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
diff --git a/lib/crypto/md4.c b/lib/crypto/md4.c
index 7ad93ce..aea2c82 100644
--- a/lib/crypto/md4.c
+++ b/lib/crypto/md4.c
@@ -18,6 +18,7 @@
 */
 
 #include "includes.h"
+#include "../lib/crypto/md4.h"
 
 /* NOTE: This code makes no attempt to be fast! 
 
diff --git a/lib/replace/crypt.m4 b/lib/replace/crypt.m4
index 047766d..4e90866 100644
--- a/lib/replace/crypt.m4
+++ b/lib/replace/crypt.m4
@@ -2,6 +2,6 @@
 # test for where we get crypt() from
 AC_CHECK_HEADERS(crypt.h)
 AC_SEARCH_LIBS_EXT(crypt, [crypt],
-  [test "$ac_cv_search_crypt" = "none required" || CRYPT_LIBS="-lcrypt"
+  [test "$ac_cv_search_ext_crypt" = "none required" || CRYPT_LIBS="-lcrypt"
   AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])],
   [ LIBREPLACEOBJ="${LIBREPLACEOBJ} crypt.o" ])
diff --git a/lib/util/debug.h b/lib/util/debug.h
index 8f4fa2a..8c634f9 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -80,6 +80,8 @@ enum debug_logtype {DEBUG_STDOUT = 0, DEBUG_FILE = 1, DEBUG_STDERR = 2};
 */
 _PUBLIC_ void dbghdr(int level, const char *location, const char *func);
 
+_PUBLIC_ void dbghdrclass(int level, int class, const char *location, const char *func);
+
 /**
   reopen the log file (usually called because the log file name might have changed)
 */
@@ -127,3 +129,5 @@ _PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops);
   macro instead.
 */
 _PUBLIC_ void dbgtext(const char *format, ...) PRINTF_ATTRIBUTE(1,2);
+
+extern XFILE *dbf;
diff --git a/lib/util/memory.h b/lib/util/memory.h
index de01492..cfc13ab 100644
--- a/lib/util/memory.h
+++ b/lib/util/memory.h
@@ -88,6 +88,31 @@
 #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
 #endif
 
+/**
+  this is a warning hack. The idea is to use this everywhere that we
+  get the "discarding const" warning from gcc. That doesn't actually
+  fix the problem of course, but it means that when we do get to
+  cleaning them up we can do it by searching the code for
+  discard_const.
+
+  It also means that other error types aren't as swamped by the noise
+  of hundreds of const warnings, so we are more likely to notice when
+  we get new errors.
 
+  Please only add more uses of this macro when you find it
+  _really_ hard to fix const warnings. Our aim is to eventually use
+  this function in only a very few places.
+
+  Also, please call this via the discard_const_p() macro interface, as that
+  makes the return type safe.
+*/
+#ifndef discard_const
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
+#endif
+
+/** Type-safe version of discard_const */
+#ifndef discard_const_p
+#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
+#endif
 
 #endif /* _SAMBA_MEMORY_H_ */
diff --git a/lib/util/time.h b/lib/util/time.h
index 1a1fcc9..42644a3 100644
--- a/lib/util/time.h
+++ b/lib/util/time.h
@@ -231,7 +231,12 @@ bool nt_time_equal(NTTIME *t1, NTTIME *t2);
 
 void interpret_dos_date(uint32_t date,int *year,int *month,int *day,int *hour,int *minute,int *second);
 
-
 struct timespec nt_time_to_unix_timespec(NTTIME *nt);
 
+time_t convert_timespec_to_time_t(struct timespec ts);
+
+struct timespec convert_time_t_to_timespec(time_t t);
+
+bool null_timespec(struct timespec ts);
+
 #endif /* _SAMBA_TIME_H_ */
diff --git a/lib/util/unix_privs.c b/lib/util/unix_privs.c
index 47c172d..f55e739 100644
--- a/lib/util/unix_privs.c
+++ b/lib/util/unix_privs.c
@@ -21,6 +21,7 @@
 
 #include "includes.h"
 #include "system/filesys.h"
+#include "../lib/util/unix_privs.h"
 
 /**
  * @file
diff --git a/lib/util/util.c b/lib/util/util.c
index 1e7991d..4e2a5aa 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -283,7 +283,6 @@ _PUBLIC_ bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type)
 	return true;
 }
 
-
 void print_asc(int level, const uint8_t *buf,int len)
 {
 	int i;
diff --git a/lib/util/util.h b/lib/util/util.h
index 4c9a223..fc651d5 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -46,33 +46,6 @@ extern const char *panic_action;
 #include "../lib/util/byteorder.h"
 
 /**
-  this is a warning hack. The idea is to use this everywhere that we
-  get the "discarding const" warning from gcc. That doesn't actually
-  fix the problem of course, but it means that when we do get to
-  cleaning them up we can do it by searching the code for
-  discard_const.
-
-  It also means that other error types aren't as swamped by the noise
-  of hundreds of const warnings, so we are more likely to notice when
-  we get new errors.
-
-  Please only add more uses of this macro when you find it
-  _really_ hard to fix const warnings. Our aim is to eventually use
-  this function in only a very few places.
-
-  Also, please call this via the discard_const_p() macro interface, as that
-  makes the return type safe.
-*/
-#ifndef discard_const
-#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
-#endif
-
-/** Type-safe version of discard_const */
-#ifndef discard_const_p
-#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
-#endif
-
-/**
  * assert macros 
  */
 #define SMB_ASSERT(b) do { if (!(b)) { \
@@ -458,6 +431,9 @@ load a file into memory from a fd.
 **/
 _PUBLIC_ char *fd_load(int fd, size_t *size, size_t maxsize, TALLOC_CTX *mem_ctx);
 
+
+char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx);
+
 /**
 load a file into memory
 **/
@@ -612,6 +588,8 @@ _PUBLIC_ void *smb_xmemdup(const void *p, size_t size);
 **/
 _PUBLIC_ char *smb_xstrdup(const char *s);
 
+char *smb_xstrndup(const char *s, size_t n);
+
 /**
  Like strdup but for memory.
 **/
@@ -636,6 +614,8 @@ _PUBLIC_ bool all_zero(const uint8_t *ptr, size_t size);
 */
 _PUBLIC_ void *realloc_array(void *ptr, size_t el_size, unsigned count, bool free_on_fail);
 
+void *malloc_array(size_t el_size, unsigned int count);
+
 /* The following definitions come from lib/util/fsusage.c  */
 
 
@@ -742,4 +722,8 @@ _PUBLIC_ void *talloc_check_name_abort(const void *ptr, const char *name);
 #define talloc_get_type_abort(ptr, type) \
 	(type *)talloc_check_name_abort(ptr, #type)
 
+bool unmap_file(void *start, size_t size);
+
+void print_asc(int level, const uint8_t *buf,int len);
+
 #endif /* _SAMBA_UTIL_H_ */
diff --git a/lib/util/xfile.h b/lib/util/xfile.h
index aa14b7c..af90f3f 100644
--- a/lib/util/xfile.h
+++ b/lib/util/xfile.h
@@ -96,4 +96,6 @@ char *x_fgets(char *s, int size, XFILE *stream) ;
  * set then an error is returned */
 off_t x_tseek(XFILE *f, off_t offset, int whence);
 
+XFILE *x_fdup(const XFILE *f);
+
 #endif /* _XFILE_H_ */
diff --git a/libcli/nbt/nbtsocket.c b/libcli/nbt/nbtsocket.c
index 520e9d9..dbbdc1b 100644
--- a/libcli/nbt/nbtsocket.c
+++ b/libcli/nbt/nbtsocket.c
@@ -23,6 +23,7 @@
 #include "lib/events/events.h"
 #include "../lib/util/dlinklist.h"
 #include "../libcli/nbt/libnbt.h"
+#include "../libcli/nbt/nbt_proto.h"
 #include "lib/socket/socket.h"
 #include "librpc/gen_ndr/ndr_nbt.h"
 #include "param/param.h"
diff --git a/librpc/ndr/ndr_misc.c b/librpc/ndr/ndr_misc.c
index 2e5ecba..c4a1adb 100644
--- a/librpc/ndr/ndr_misc.c
+++ b/librpc/ndr/ndr_misc.c
@@ -24,15 +24,6 @@
 #include "system/network.h"
 #include "librpc/ndr/libndr.h"
 
-_PUBLIC_ void ndr_print_in_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip)
-{
-	struct in_addr ip;
-
-	ip.s_addr = htonl(_ip->s_addr);
-
-	ndr->print(ndr, "%-25s: %s", name, inet_ntoa(ip));
-}
-
 _PUBLIC_ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid)
 {
 	ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid));
diff --git a/librpc/ndr/ndr_orpc.c b/librpc/ndr/ndr_orpc.c
new file mode 100644
index 0000000..6a55048
--- /dev/null
+++ b/librpc/ndr/ndr_orpc.c
@@ -0,0 +1,173 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   routines for marshalling/unmarshalling DCOM string arrays
+
+   Copyright (C) Jelmer Vernooij 2004
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_orpc.h"
+
+enum ndr_err_code ndr_pull_DUALSTRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct DUALSTRINGARRAY *ar)
+{
+	uint16_t num_entries, security_offset;
+	uint16_t towerid;
+	uint32_t towernum = 0, conformant_size;
+
+	if (!(ndr_flags & NDR_SCALARS)) {
+		return NDR_ERR_SUCCESS;
+	}
+
+	NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &conformant_size));
+	NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
+	NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &security_offset));
+
+	ar->stringbindings = talloc_array(ndr, struct STRINGBINDING *, num_entries);
+	ar->stringbindings[0] = NULL;
+
+	do {
+		/* 'Peek' */
+		NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
+
+		if (towerid > 0) {
+			ndr->offset -= 2; 
+			ar->stringbindings = talloc_realloc(ndr, ar->stringbindings, struct STRINGBINDING *, towernum+2);
+			ar->stringbindings[towernum] = talloc(ndr, struct STRINGBINDING);
+			NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
+			towernum++;
+		}
+	} while (towerid != 0);
+
+	ar->stringbindings[towernum] = NULL;
+	towernum = 0;
+
+	ar->securitybindings = talloc_array(ndr, struct SECURITYBINDING *, num_entries);
+	ar->securitybindings[0] = NULL;
+
+	do {
+		/* 'Peek' */
+		NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
+
+		if (towerid > 0) {
+			ndr->offset -= 2; 
+			ar->securitybindings = talloc_realloc(ndr, ar->securitybindings, struct SECURITYBINDING *, towernum+2);
+			ar->securitybindings[towernum] = talloc(ndr, struct SECURITYBINDING);
+			NDR_CHECK(ndr_pull_SECURITYBINDING(ndr, ndr_flags, ar->securitybindings[towernum]));
+			towernum++;
+		}
+	} while (towerid != 0);
+	
+	ar->securitybindings[towernum] = NULL;
+	
+	return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_DUALSTRINGARRAY(struct ndr_push *ndr, int ndr_flags, const struct DUALSTRINGARRAY *ar)
+{
+	return ndr_push_error(ndr, NDR_ERR_STRING, "ndr_push_DUALSTRINGARRAY not implemented");
+}
+
+/*
+  print a dom_sid
+*/
+void ndr_print_DUALSTRINGARRAY(struct ndr_print *ndr, const char *name, const struct DUALSTRINGARRAY *ar)
+{
+	int i;
+	ndr->print(ndr, "%-25s: DUALSTRINGARRAY", name);
+	ndr->depth++;
+	ndr->print(ndr, "STRING BINDINGS");
+	ndr->depth++;
+	for (i=0;ar->stringbindings[i];i++)	{
+		char *idx = NULL;
+		asprintf(&idx, "[%d]", i);
+		if (idx) {
+			ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
+			free(idx);
+		}
+	}
+	ndr->depth--;
+	ndr->print(ndr, "SECURITY BINDINGS");
+	ndr->depth++;
+	for (i=0;ar->securitybindings[i];i++)	{
+		char *idx = NULL;
+		asprintf(&idx, "[%d]", i);
+		if (idx) {
+			ndr_print_SECURITYBINDING(ndr, idx, ar->securitybindings[i]);
+			free(idx);
+		}
+	}
+	ndr->depth--;
+}
+
+enum ndr_err_code ndr_pull_STRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct STRINGARRAY *ar)
+{
+	uint16_t towerid;
+	uint32_t towernum = 0;
+	uint16_t num_entries;
+
+	if (!(ndr_flags & NDR_SCALARS)) {
+		return NDR_ERR_SUCCESS;
+	}
+
+	NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
+
+	ar->stringbindings = talloc_array(ndr, struct STRINGBINDING *, 1);
+	ar->stringbindings[0] = NULL;
+
+	do {
+		/* 'Peek' */
+		NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
+
+		if (towerid > 0) {
+			ndr->offset -= 2; 
+			ar->stringbindings = talloc_realloc(ndr, ar->stringbindings, struct STRINGBINDING *, towernum+2);
+			ar->stringbindings[towernum] = talloc(ndr, struct STRINGBINDING);
+			NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
+			towernum++;
+		}
+	} while (towerid != 0);
+
+	ar->stringbindings[towernum] = NULL;
+	towernum = 0;
+
+	return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_STRINGARRAY(struct ndr_push *ndr, int ndr_flags, const struct STRINGARRAY *ar)
+{
+	return ndr_push_error(ndr, NDR_ERR_STRING, "ndr_push_STRINGARRAY not implemented");
+}
+
+/*
+  print a dom_sid
+*/
+void ndr_print_STRINGARRAY(struct ndr_print *ndr, const char *name, const struct STRINGARRAY *ar)
+{
+	int i;
+	ndr->print(ndr, "%-25s: STRINGARRAY", name);
+	ndr->depth++;
+	for (i=0;ar->stringbindings[i];i++)	{
+		char *idx = NULL;
+		asprintf(&idx, "[%d]", i);
+		if (idx) {
+			ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
+			free(idx);
+		}
+	}
+	ndr->depth--;
+}
diff --git a/librpc/ndr/ndr_table.c b/librpc/ndr/ndr_table.c
index f7c381f..7ca0417 100644
--- a/librpc/ndr/ndr_table.c
+++ b/librpc/ndr/ndr_table.c
@@ -120,8 +120,6 @@ const struct ndr_interface_list *ndr_table_list(void)
 }
 
 
-NTSTATUS ndr_table_register_builtin_tables(void);
-
 NTSTATUS ndr_table_init(void)
 {
 	static bool initialized = false;
diff --git a/librpc/ndr/ndr_table.h b/librpc/ndr/ndr_table.h
index 905c2e5..9e8fea1 100644
--- a/librpc/ndr/ndr_table.h
+++ b/librpc/ndr/ndr_table.h
@@ -8,6 +8,7 @@ const struct ndr_interface_table *ndr_table_by_name(const char *name);
 const struct ndr_interface_table *ndr_table_by_uuid(const struct GUID *uuid);
 const struct ndr_interface_list *ndr_table_list(void);
 NTSTATUS ndr_table_init(void);
+NTSTATUS ndr_table_register_builtin_tables(void);
 
 #endif /* _NDR_TABLE_PROTO_H_ */
 
diff --git a/librpc/ndr/ndr_wmi.c b/librpc/ndr/ndr_wmi.c
new file mode 100644
index 0000000..2c122de
--- /dev/null
+++ b/librpc/ndr/ndr_wmi.c
@@ -0,0 +1,60 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   routines for marshalling/unmarshalling DCOM string arrays
+
+   Copyright (C) Jelmer Vernooij 2004
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+//#define NDR_CHECK_DEBUG
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_dcom.h"
+#include "librpc/gen_ndr/ndr_wmi.h"
+#include "librpc/ndr/ndr_wmi.h"
+
+// Just for debugging
+int NDR_CHECK_depth = 0;
+int NDR_CHECK_shift = 0x18;
+
+enum ndr_err_code ndr_push_BSTR(struct ndr_push *ndr, int ndr_flags, const struct BSTR *r)
+{
+	uint32_t len;
+	uint32_t flags;
+	enum ndr_err_code status;
+	len = strlen(r->data);
+        if (ndr_flags & NDR_SCALARS) {
+                NDR_CHECK(ndr_push_align(ndr, 4));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list