diff options
Diffstat (limited to 'librpc/ndr')
-rw-r--r-- | librpc/ndr/libndr.h | 4 | ||||
-rw-r--r-- | librpc/ndr/ndr_backupkey.h | 21 | ||||
-rw-r--r-- | librpc/ndr/ndr_compression.h | 22 | ||||
-rw-r--r-- | librpc/ndr/ndr_dns.h | 25 | ||||
-rw-r--r-- | librpc/ndr/ndr_spoolss_buf.h | 23 | ||||
-rw-r--r-- | librpc/ndr/ndr_string.c | 266 | ||||
-rw-r--r-- | librpc/ndr/ndr_table.h | 22 | ||||
-rw-r--r-- | librpc/ndr/ndr_wmi.c | 1 | ||||
-rw-r--r-- | librpc/ndr/ndr_wmi.h | 24 | ||||
-rw-r--r-- | librpc/ndr/util.c | 31 |
10 files changed, 260 insertions, 179 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index 8c59bb9bb0..ca3710bc98 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -122,6 +122,7 @@ struct ndr_print { #define LIBNDR_FLAG_STR_CONFORMANT (1<<10) #define LIBNDR_FLAG_STR_CHARLEN (1<<11) #define LIBNDR_FLAG_STR_UTF8 (1<<12) +#define LIBNDR_FLAG_STR_RAW8 (1<<13) #define LIBNDR_STRING_FLAGS (0x7FFC) /* set if relative pointers should *not* be marshalled in reverse order */ @@ -374,6 +375,8 @@ struct ndr_interface_list { const struct ndr_interface_table *table; }; +struct sockaddr_storage; + /********************************************************************* Map an NT error code from a NDR error code. *********************************************************************/ @@ -395,6 +398,7 @@ enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid); size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags); void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid); +void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss); bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2); enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn); enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn); diff --git a/librpc/ndr/ndr_backupkey.h b/librpc/ndr/ndr_backupkey.h index c5c7c39995..4e82f6296a 100644 --- a/librpc/ndr/ndr_backupkey.h +++ b/librpc/ndr/ndr_backupkey.h @@ -1,2 +1,23 @@ +/* + Unix SMB/CIFS implementation. + + routines for top backup key protocol marshalling/unmarshalling + + Copyright (C) Matthieu Patou 2010 + + 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/>. +*/ + _PUBLIC_ enum ndr_err_code ndr_push_bkrp_access_check_v2(struct ndr_push *ndr, int ndr_flags, const struct bkrp_access_check_v2 *r); _PUBLIC_ enum ndr_err_code ndr_pull_bkrp_access_check_v2(struct ndr_pull *ndr, int ndr_flags, struct bkrp_access_check_v2 *r); diff --git a/librpc/ndr/ndr_compression.h b/librpc/ndr/ndr_compression.h index b939f6a42b..1c22fbf759 100644 --- a/librpc/ndr/ndr_compression.h +++ b/librpc/ndr/ndr_compression.h @@ -1,3 +1,25 @@ +/* + Unix SMB/CIFS implementation. + + libndr compression support + + Copyright (C) Stefan Metzmacher 2005 + Copyright (C) Matthieu Suiche 2008 + + 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/>. +*/ + #ifndef __LIBRPC_NDR_NDR_COMPRESSION_H__ #define __LIBRPC_NDR_NDR_COMPRESSION_H__ diff --git a/librpc/ndr/ndr_dns.h b/librpc/ndr/ndr_dns.h index d97d57fdac..16bf11ba87 100644 --- a/librpc/ndr/ndr_dns.h +++ b/librpc/ndr/ndr_dns.h @@ -1,3 +1,28 @@ +/* + Unix SMB/CIFS implementation. + + manipulate dns name structures + + Copyright (C) 2010 Kai Blin <kai@samba.org> + + Heavily based on nbtname.c which is: + + Copyright (C) Andrew Tridgell 2005 + + 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/>. +*/ + void ndr_print_dns_string(struct ndr_print *ndr, const char *name, const char *s); diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h index c5938c00c8..77053cb13d 100644 --- a/librpc/ndr/ndr_spoolss_buf.h +++ b/librpc/ndr/ndr_spoolss_buf.h @@ -1,3 +1,26 @@ +/* + Unix SMB/CIFS implementation. + + routines for marshalling/unmarshalling spoolss subcontext buffer structures + + Copyright (C) Andrew Tridgell 2003 + Copyright (C) Tim Potter 2003 + Copyright (C) Guenther Deschner 2009 + + 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/>. +*/ + #ifndef ___SPACE_SRC_SAMBA_SOURCES_SAMBA_GIT_SOURCE3____SOURCE4_LIBRPC_NDR_NDR_SPOOLSS_BUF_H__ #define ___SPACE_SRC_SAMBA_SOURCES_SAMBA_GIT_SOURCE3____SOURCE4_LIBRPC_NDR_NDR_SPOOLSS_BUF_H__ diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 6e20333f04..840776fa3a 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -30,8 +30,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, char *as=NULL; uint32_t len1, ofs, len2; uint16_t len3; - size_t converted_size; - int chset = CH_UTF16; + size_t conv_src_len = 0, converted_size; + int do_convert = 1, chset = CH_UTF16; unsigned byte_mul = 2; unsigned flags = ndr->flags; unsigned c_len_term = 0; @@ -56,6 +56,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, flags &= ~LIBNDR_FLAG_STR_UTF8; } + if (flags & LIBNDR_FLAG_STR_RAW8) { + do_convert = 0; + byte_mul = 1; + flags &= ~LIBNDR_FLAG_STR_RAW8; + } + flags &= ~LIBNDR_FLAG_STR_CONFORMANT; if (flags & LIBNDR_FLAG_STR_CHARLEN) { c_len_term = 1; @@ -73,77 +79,19 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len2)); if (len2 > len1) { - return ndr_pull_error(ndr, NDR_ERR_STRING, - "Bad string lengths len1=%u ofs=%u len2=%u\n", + return ndr_pull_error(ndr, NDR_ERR_STRING, + "Bad string lengths len1=%u ofs=%u len2=%u\n", len1, ofs, len2); - } - NDR_PULL_NEED_BYTES(ndr, (len2 + c_len_term)*byte_mul); - if (len2 == 0) { - as = talloc_strdup(ndr->current_mem_ctx, ""); - } else { - if (!convert_string_talloc(ndr->current_mem_ctx, chset, - CH_UNIX, - ndr->data+ndr->offset, - (len2 + c_len_term)*byte_mul, - (void **)(void *)&as, - &converted_size)) - { - return ndr_pull_error(ndr, NDR_ERR_CHARCNV, - "Bad character conversion with flags 0x%x", flags); - } - } - NDR_CHECK(ndr_pull_advance(ndr, (len2 + c_len_term)*byte_mul)); - - if (len1 != len2) { + } else if (len1 != len2) { DEBUG(6,("len1[%u] != len2[%u] '%s'\n", len1, len2, as)); } - - /* this is a way of detecting if a string is sent with the wrong - termination */ - if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) { - if (strlen(as) < (len2 + c_len_term)) { - DEBUG(6,("short string '%s'\n", as)); - } - } else { - if (strlen(as) == (len2 + c_len_term)) { - DEBUG(6,("long string '%s'\n", as)); - } - } - *s = as; + conv_src_len = len2 + c_len_term; break; case LIBNDR_FLAG_STR_SIZE4: case LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM: NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1)); - NDR_PULL_NEED_BYTES(ndr, (len1 + c_len_term)*byte_mul); - if (len1 == 0) { - as = talloc_strdup(ndr->current_mem_ctx, ""); - } else { - if (!convert_string_talloc(ndr->current_mem_ctx, chset, - CH_UNIX, - ndr->data+ndr->offset, - (len1 + c_len_term)*byte_mul, - (void **)(void *)&as, - &converted_size)) - { - return ndr_pull_error(ndr, NDR_ERR_CHARCNV, - "Bad character conversion with flags 0x%x", flags); - } - } - NDR_CHECK(ndr_pull_advance(ndr, (len1 + c_len_term)*byte_mul)); - - /* this is a way of detecting if a string is sent with the wrong - termination */ - if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) { - if (strlen(as) < (len1 + c_len_term)) { - DEBUG(6,("short string '%s'\n", as)); - } - } else { - if (strlen(as) == (len1 + c_len_term)) { - DEBUG(6,("long string '%s'\n", as)); - } - } - *s = as; + conv_src_len = len1 + c_len_term; break; case LIBNDR_FLAG_STR_LEN4: @@ -154,108 +102,28 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, ndr->flags & LIBNDR_STRING_FLAGS); } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1)); - NDR_PULL_NEED_BYTES(ndr, (len1 + c_len_term)*byte_mul); - if (len1 == 0) { - as = talloc_strdup(ndr->current_mem_ctx, ""); - } else { - if (!convert_string_talloc(ndr->current_mem_ctx, chset, - CH_UNIX, - ndr->data+ndr->offset, - (len1 + c_len_term)*byte_mul, - (void **)(void *)&as, - &converted_size)) - { - return ndr_pull_error(ndr, NDR_ERR_CHARCNV, - "Bad character conversion with flags 0x%x", flags); - } - } - NDR_CHECK(ndr_pull_advance(ndr, (len1 + c_len_term)*byte_mul)); - - /* this is a way of detecting if a string is sent with the wrong - termination */ - if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) { - if (strlen(as) < (len1 + c_len_term)) { - DEBUG(6,("short string '%s'\n", as)); - } - } else { - if (strlen(as) == (len1 + c_len_term)) { - DEBUG(6,("long string '%s'\n", as)); - } - } - *s = as; + conv_src_len = len1 + c_len_term; break; - case LIBNDR_FLAG_STR_SIZE2: case LIBNDR_FLAG_STR_SIZE2|LIBNDR_FLAG_STR_NOTERM: NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &len3)); - NDR_PULL_NEED_BYTES(ndr, (len3 + c_len_term)*byte_mul); - if (len3 == 0) { - as = talloc_strdup(ndr->current_mem_ctx, ""); - } else { - if (!convert_string_talloc(ndr->current_mem_ctx, chset, - CH_UNIX, - ndr->data+ndr->offset, - (len3 + c_len_term)*byte_mul, - (void **)(void *)&as, - &converted_size)) - { - return ndr_pull_error(ndr, NDR_ERR_CHARCNV, - "Bad character conversion with flags 0x%x", flags); - } - } - NDR_CHECK(ndr_pull_advance(ndr, (len3 + c_len_term)*byte_mul)); - - /* this is a way of detecting if a string is sent with the wrong - termination */ - if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) { - if (strlen(as) < (len3 + c_len_term)) { - DEBUG(6,("short string '%s'\n", as)); - } - } else { - if (strlen(as) == (len3 + c_len_term)) { - DEBUG(6,("long string '%s'\n", as)); - } - } - *s = as; + conv_src_len = len3 + c_len_term; break; case LIBNDR_FLAG_STR_SIZE2|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_STR_BYTESIZE: NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &len3)); - NDR_PULL_NEED_BYTES(ndr, len3); - if (len3 == 0) { - as = talloc_strdup(ndr->current_mem_ctx, ""); - } else { - if (!convert_string_talloc(ndr->current_mem_ctx, chset, - CH_UNIX, - ndr->data+ndr->offset, len3, - (void **)(void *)&as, - &converted_size)) - { - return ndr_pull_error(ndr, NDR_ERR_CHARCNV, - "Bad character conversion with flags 0x%x", flags); - } - } - NDR_CHECK(ndr_pull_advance(ndr, len3)); - *s = as; + conv_src_len = len3; + byte_mul = 1; /* the length is now absolute */ break; case LIBNDR_FLAG_STR_NULLTERM: if (byte_mul == 1) { - len1 = ascii_len_n((const char *)(ndr->data+ndr->offset), ndr->data_size - ndr->offset); + conv_src_len = ascii_len_n((const char *)(ndr->data+ndr->offset), ndr->data_size - ndr->offset); } else { - len1 = utf16_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset); - } - if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, - ndr->data+ndr->offset, len1, - (void **)(void *)&as, - &converted_size)) - { - return ndr_pull_error(ndr, NDR_ERR_CHARCNV, - "Bad character conversion with flags 0x%x", flags); + conv_src_len = utf16_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset); } - NDR_CHECK(ndr_pull_advance(ndr, len1)); - *s = as; + byte_mul = 1; /* the length is now absolute */ break; case LIBNDR_FLAG_STR_NOTERM: @@ -263,26 +131,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x (missing NDR_REMAINING)\n", ndr->flags & LIBNDR_STRING_FLAGS); } - - len1 = ndr->data_size - ndr->offset; - - NDR_PULL_NEED_BYTES(ndr, len1); - if (len1 == 0) { - as = talloc_strdup(ndr->current_mem_ctx, ""); - } else { - if (!convert_string_talloc(ndr->current_mem_ctx, chset, - CH_UNIX, - ndr->data+ndr->offset, len1, - (void **)(void *)&as, - &converted_size)) - { - return ndr_pull_error(ndr, NDR_ERR_CHARCNV, - "Bad character conversion with flags 0x%x", flags); - } - } - NDR_CHECK(ndr_pull_advance(ndr, len1)); - - *s = as; + conv_src_len = ndr->data_size - ndr->offset; + byte_mul = 1; /* the length is now absolute */ break; default: @@ -290,6 +140,45 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, ndr->flags & LIBNDR_STRING_FLAGS); } + NDR_PULL_NEED_BYTES(ndr, conv_src_len * byte_mul); + if (conv_src_len == 0) { + as = talloc_strdup(ndr->current_mem_ctx, ""); + converted_size = 0; + } else { + if (!do_convert) { + as = talloc_strndup(ndr->current_mem_ctx, + (char *)ndr->data + ndr->offset, + conv_src_len); + if (!as) { + return ndr_pull_error(ndr, NDR_ERR_ALLOC, + "Failed to talloc_strndup() in RAW8 ndr_string_pull()"); + } + converted_size = MIN(strlen(as)+1, conv_src_len); + } else if (!convert_string_talloc(ndr->current_mem_ctx, chset, + CH_UNIX, ndr->data + ndr->offset, + conv_src_len * byte_mul, + (void **)(void *)&as, + &converted_size)) { + return ndr_pull_error(ndr, NDR_ERR_CHARCNV, + "Bad character conversion with flags 0x%x", flags); + } + } + + /* this is a way of detecting if a string is sent with the wrong + termination */ + if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) { + if (as && converted_size > 0 && as[converted_size-1] == '\0') { + DEBUG(6,("short string '%s', sent with NULL termination despite NOTERM flag in IDL\n", as)); + } + } else { + if (as && converted_size > 0 && as[converted_size-1] != '\0') { + DEBUG(6,("long string '%s', send without NULL termination (which was expected)\n", as)); + } + } + + NDR_CHECK(ndr_pull_advance(ndr, conv_src_len * byte_mul)); + *s = as; + return NDR_ERR_SUCCESS; } @@ -301,7 +190,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, { ssize_t s_len, c_len; size_t d_len; - int chset = CH_UTF16; + int do_convert = 1, chset = CH_UTF16; unsigned flags = ndr->flags; unsigned byte_mul = 2; uint8_t *dest = NULL; @@ -328,12 +217,22 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, flags &= ~LIBNDR_FLAG_STR_UTF8; } + if (flags & LIBNDR_FLAG_STR_RAW8) { + do_convert = 0; + byte_mul = 1; + flags &= ~LIBNDR_FLAG_STR_RAW8; + } + flags &= ~LIBNDR_FLAG_STR_CONFORMANT; if (!(flags & LIBNDR_FLAG_STR_NOTERM)) { s_len++; } - if (!convert_string_talloc(ndr, CH_UNIX, chset, s, s_len, + + if (!do_convert) { + d_len = s_len; + dest = (uint8_t *)talloc_strndup(ndr, s, s_len); + } else if (!convert_string_talloc(ndr, CH_UNIX, chset, s, s_len, (void **)(void *)&dest, &d_len)) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, @@ -403,9 +302,13 @@ _PUBLIC_ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s) unsigned byte_mul = 2; unsigned c_len_term = 1; - c_len = s?strlen_m(s):0; + if (flags & LIBNDR_FLAG_STR_RAW8) { + c_len = s?strlen(s):0; + } else { + c_len = s?strlen_m(s):0; + } - if (flags & (LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_UTF8)) { + if (flags & (LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_RAW8|LIBNDR_FLAG_STR_UTF8)) { byte_mul = 1; } @@ -611,16 +514,22 @@ _PUBLIC_ size_t ndr_size_string_array(const char **a, uint32_t count, int flags) { uint32_t i; size_t size = 0; + int rawbytes = 0; + + if (flags & LIBNDR_FLAG_STR_RAW8) { + rawbytes = 1; + flags &= ~LIBNDR_FLAG_STR_RAW8; + } switch (flags & LIBNDR_STRING_FLAGS) { case LIBNDR_FLAG_STR_NULLTERM: for (i = 0; i < count; i++) { - size += strlen_m_term(a[i]); + size += rawbytes?strlen(a[i]) + 1:strlen_m_term(a[i]); } break; case LIBNDR_FLAG_STR_NOTERM: for (i = 0; i < count; i++) { - size += strlen_m(a[i]); + size += rawbytes?strlen(a[i]):strlen_m(a[i]); } break; default: @@ -736,7 +645,6 @@ _PUBLIC_ uint32_t ndr_charset_length(const void *var, charset_t chset) case CH_UTF16MUNGED: case CH_UTF8: return strlen_m_ext_term((const char *)var, CH_UNIX, chset); - case CH_DISPLAY: case CH_DOS: case CH_UNIX: return strlen((const char *)var)+1; diff --git a/librpc/ndr/ndr_table.h b/librpc/ndr/ndr_table.h index 9e8fea1db6..207618f644 100644 --- a/librpc/ndr/ndr_table.h +++ b/librpc/ndr/ndr_table.h @@ -1,3 +1,25 @@ +/* + Unix SMB/CIFS implementation. + + dcerpc utility functions + + Copyright (C) Andrew Tridgell 2003 + 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/>. +*/ + #ifndef _NDR_TABLE_PROTO_H_ #define _NDR_TABLE_PROTO_H_ diff --git a/librpc/ndr/ndr_wmi.c b/librpc/ndr/ndr_wmi.c index 87f3e9690a..4748888389 100644 --- a/librpc/ndr/ndr_wmi.c +++ b/librpc/ndr/ndr_wmi.c @@ -23,6 +23,7 @@ #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; diff --git a/librpc/ndr/ndr_wmi.h b/librpc/ndr/ndr_wmi.h new file mode 100644 index 0000000000..62d2c535cd --- /dev/null +++ b/librpc/ndr/ndr_wmi.h @@ -0,0 +1,24 @@ +/* + 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. +*/ + +enum ndr_err_code ndr_push_BSTR(struct ndr_push *ndr, int ndr_flags, const struct BSTR *r); +enum ndr_err_code ndr_pull_BSTR(struct ndr_pull *ndr, int ndr_flags, struct BSTR *r); diff --git a/librpc/ndr/util.c b/librpc/ndr/util.c new file mode 100644 index 0000000000..b2df28dde0 --- /dev/null +++ b/librpc/ndr/util.c @@ -0,0 +1,31 @@ +/* + Unix SMB/CIFS implementation. + + libndr interface + + Copyright (C) Andrew Tridgell 2003 + + 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/ndr/libndr.h" +#include "system/network.h" +#include "lib/util/util_net.h" + +_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss) +{ + char addr[INET6_ADDRSTRLEN]; + ndr->print(ndr, "%-25s: %s", name, print_sockaddr(addr, sizeof(addr), ss)); +} |