From 153529636f42212f618e970a922d2595fabb13d2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 13 May 2011 11:48:14 +0200 Subject: build: Move NDR_DSSETUP and NDR_SPOOLSS into ndr-standard This is to address multiple defintion of symbol issues in msrpc3 linked libraries. Andrew Bartlett --- librpc/wscript_build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'librpc') diff --git a/librpc/wscript_build b/librpc/wscript_build index d6f0f6dd41c..a180c38af80 100644 --- a/librpc/wscript_build +++ b/librpc/wscript_build @@ -305,7 +305,7 @@ bld.SAMBA_LIBRARY('ndr-standard', pc_files='ndr_standard.pc', deps='''NDR_SECURITY NDR_LSA NDR_SAMR NDR_NETLOGON NDR_EVENTLOG NDR_DFS NDR_NTSVCS NDR_SVCCTL NDR_INITSHUTDOWN NDR_WKSSVC NDR_SRVSVC NDR_WINREG - NDR_ECHO security NDR_DNS NDR_ATSVC''', + NDR_ECHO security NDR_DNS NDR_ATSVC NDR_SPOOLSS NDR_DSSETUP''', public_deps='ndr', public_headers='gen_ndr/samr.h gen_ndr/ndr_samr.h gen_ndr/lsa.h gen_ndr/netlogon.h gen_ndr/atsvc.h gen_ndr/ndr_atsvc.h gen_ndr/ndr_svcctl.h gen_ndr/svcctl.h', header_path='gen_ndr' -- cgit From b82caab5c9d8821cd125654e3233da40eb4c61d1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 11 May 2011 23:35:21 +0200 Subject: s3-rap: add rap_NetRemoteTOD to IDL. Guenther --- librpc/idl/rap.idl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'librpc') diff --git a/librpc/idl/rap.idl b/librpc/idl/rap.idl index 8087e22c5b2..780951c7503 100644 --- a/librpc/idl/rap.idl +++ b/librpc/idl/rap.idl @@ -966,6 +966,28 @@ interface rap [out] uint16 convert ); + typedef [public] struct { + uint32 TimeSinceJan11970; + uint32 TimeSinceBoot; + uint8 Hours; + uint8 Minutes; + uint8 Seconds; + uint8 Hundreds; + uint16 TimeZone; + uint16 ClockFrequency; + uint8 Day; + uint8 Month; + uint16 Year; + uint8 Weekday; + } rap_TimeOfDayInfo; + + [public] void rap_NetRemoteTOD( + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] rap_TimeOfDayInfo tod + ); + /* Parameter description strings for RAP calls */ /* Names are defined name for RAP call with _REQ */ /* appended to end. */ -- cgit From 854467851da48e02dcd8f869cb031c8943707017 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 13 May 2011 10:02:42 +0200 Subject: s3-printing: Get the location info from cups. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- librpc/idl/printcap.idl | 1 + 1 file changed, 1 insertion(+) (limited to 'librpc') diff --git a/librpc/idl/printcap.idl b/librpc/idl/printcap.idl index 5ab380ce6cb..d9c34f3fab7 100644 --- a/librpc/idl/printcap.idl +++ b/librpc/idl/printcap.idl @@ -7,6 +7,7 @@ interface printcap typedef struct { [charset(UTF8),string] uint8 *name; [charset(UTF8),string] uint8 *info; + [charset(UTF8),string] uint8 *location; } pcap_printer; typedef [public] struct { -- cgit From 3478e3add376a291e4b4e3acfe92b2df22287142 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sun, 15 May 2011 19:56:25 +0400 Subject: s4-dfs: fix bugs in idl and adapt code accordingly --- librpc/idl/dfsblobs.idl | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'librpc') diff --git a/librpc/idl/dfsblobs.idl b/librpc/idl/dfsblobs.idl index 6151c3f77b2..7b8795d29cd 100644 --- a/librpc/idl/dfsblobs.idl +++ b/librpc/idl/dfsblobs.idl @@ -53,7 +53,6 @@ interface dfsblobs [relative_short] nstring *DFS_path; [relative_short] nstring *DFS_alt_path; [relative_short] nstring *netw_address; - /* As stated in MS DFSC 2.2.4.3.1 this array was guid but now MUST be 16 null bytes*/ } dfs_normal_referral; typedef struct { @@ -74,32 +73,20 @@ interface dfsblobs } dfs_padding; typedef [flag(NDR_NOALIGN)] struct { + uint16 size; DFS_SERVER_TYPE server_type; DFS_FLAGS_REFERRAL entry_flags; uint32 ttl; [switch_is(entry_flags & DFS_FLAG_REFERRAL_DOMAIN_RESP)] dfs_referral referrals; - } dfs_referral_v3_remaining; - - typedef [flag(NDR_NOALIGN)] struct { - uint16 size; - dfs_referral_v3_remaining data; /* this is either 0 or 16 bytes */ [switch_is(size - 18)] dfs_padding service_site_guid; } dfs_referral_v3; - typedef struct { - uint16 size; - DFS_SERVER_TYPE server_type; - DFS_FLAGS_REFERRAL entry_flags; - uint32 ttl; - dfs_normal_referral r1; - } dfs_referral_v4; - typedef [nodiscriminant] union { [case(1)] dfs_referral_v1 v1; [case(2)] dfs_referral_v2 v2; [case(3)] dfs_referral_v3 v3; - [case(4)] dfs_referral_v4 v4; + [case(4)] dfs_referral_v3 v4; [default]; } dfs_referral_version; -- cgit From 30979f3ea1df7f81c44fb1d8b6a1a61777c8c72d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 14 May 2011 19:55:57 +0200 Subject: build: Expand dcerpc-samba grouping library This is possible in common now because the generated RPC code does not rely on a particular dcerpc layer. Andrew Bartlett --- librpc/wscript_build | 87 +++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 42 deletions(-) (limited to 'librpc') diff --git a/librpc/wscript_build b/librpc/wscript_build index a180c38af80..02600084bac 100644 --- a/librpc/wscript_build +++ b/librpc/wscript_build @@ -345,114 +345,114 @@ bld.SAMBA_SUBSYSTEM('NDR_FILE_ID', bld.SAMBA_SUBSYSTEM('RPC_NDR_XATTR', source='gen_ndr/ndr_xattr_c.c', - public_deps='NDR_XATTR dcerpc' + public_deps='NDR_XATTR rpccommon' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_ROT', source='gen_ndr/ndr_rot_c.c', - public_deps='NDR_ROT dcerpc' + public_deps='NDR_ROT rpccommon' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_ATSVC', source='gen_ndr/ndr_atsvc_c.c', - public_deps='dcerpc NDR_ATSVC' + public_deps='rpccommon NDR_ATSVC' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_AUDIOSRV', source='gen_ndr/ndr_audiosrv_c.c', - public_deps='NDR_AUDIOSRV dcerpc' + public_deps='NDR_AUDIOSRV rpccommon' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_ECHO', source='gen_ndr/ndr_echo_c.c', - public_deps='dcerpc NDR_ECHO' + public_deps='rpccommon NDR_ECHO' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_DSBACKUP', source='gen_ndr/ndr_dsbackup_c.c', - public_deps='dcerpc NDR_DSBACKUP' + public_deps='rpccommon NDR_DSBACKUP' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_EFS', source='gen_ndr/ndr_efs_c.c', - public_deps='dcerpc NDR_EFS' + public_deps='rpccommon NDR_EFS' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_LSA', source='gen_ndr/ndr_lsa_c.c', - public_deps='dcerpc ndr-standard' + public_deps='rpccommon ndr-standard' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_SAMR', source='gen_ndr/ndr_samr_c.c', - public_deps='dcerpc NDR_SAMR' + public_deps='rpccommon NDR_SAMR' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_DFS', source='gen_ndr/ndr_dfs_c.c', - public_deps='dcerpc ndr-standard' + public_deps='rpccommon ndr-standard' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_FRSAPI', source='gen_ndr/ndr_frsapi_c.c', - public_deps='dcerpc NDR_FRSAPI' + public_deps='rpccommon NDR_FRSAPI' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_DRSUAPI', source='gen_ndr/ndr_drsuapi_c.c', - public_deps='dcerpc NDR_DRSUAPI' + public_deps='rpccommon NDR_DRSUAPI' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_DRSBLOBS', source='gen_ndr/ndr_drsblobs_c.c', - public_deps='dcerpc NDR_DRSBLOBS' + public_deps='rpccommon NDR_DRSBLOBS' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_POLICYAGENT', source='gen_ndr/ndr_policyagent_c.c', - public_deps='dcerpc NDR_POLICYAGENT' + public_deps='rpccommon NDR_POLICYAGENT' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_UNIXINFO', source='gen_ndr/ndr_unixinfo_c.c', - public_deps='dcerpc NDR_UNIXINFO' + public_deps='rpccommon NDR_UNIXINFO' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_BROWSER', source='gen_ndr/ndr_browser_c.c', - public_deps='dcerpc NDR_BROWSER' + public_deps='rpccommon NDR_BROWSER' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_SPOOLSS', source='gen_ndr/ndr_spoolss_c.c', - public_deps='dcerpc NDR_SPOOLSS' + public_deps='rpccommon NDR_SPOOLSS' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_NBT', source='gen_ndr/ndr_nbt_c.c', - public_deps='dcerpc NDR_NBT' + public_deps='rpccommon NDR_NBT' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_WKSSVC', source='gen_ndr/ndr_wkssvc_c.c', - public_deps='dcerpc ndr-standard' + public_deps='rpccommon ndr-standard' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_SRVSVC', source='gen_ndr/ndr_srvsvc_c.c', - public_deps='dcerpc NDR_SRVSVC' + public_deps='rpccommon NDR_SRVSVC' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_SVCCTL', source='gen_ndr/ndr_svcctl_c.c', - public_deps='dcerpc ndr-standard', + public_deps='rpccommon ndr-standard', public_headers='gen_ndr/ndr_svcctl_c.h ndr/ndr_svcctl.h', header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')] ) bld.SAMBA_SUBSYSTEM('RPC_NDR_EVENTLOG', source='gen_ndr/ndr_eventlog_c.c', - public_deps='dcerpc ndr-standard' + public_deps='rpccommon ndr-standard' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_EPMAPPER', @@ -462,27 +462,27 @@ bld.SAMBA_SUBSYSTEM('RPC_NDR_EPMAPPER', bld.SAMBA_SUBSYSTEM('RPC_NDR_DBGIDL', source='gen_ndr/ndr_dbgidl_c.c', - public_deps='dcerpc NDR_DBGIDL' + public_deps='rpccommon NDR_DBGIDL' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_DSSETUP', source='gen_ndr/ndr_dssetup_c.c', - public_deps='dcerpc NDR_DSSETUP' + public_deps='rpccommon NDR_DSSETUP' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_MSGSVC', source='gen_ndr/ndr_msgsvc_c.c', - public_deps='dcerpc NDR_MSGSVC' + public_deps='rpccommon NDR_MSGSVC' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_WINREG', source='gen_ndr/ndr_winreg_c.c', - public_deps='dcerpc ndr-standard' + public_deps='rpccommon ndr-standard' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_INITSHUTDOWN', source='gen_ndr/ndr_initshutdown_c.c', - public_deps='dcerpc ndr-standard' + public_deps='rpccommon ndr-standard' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_MGMT', @@ -492,32 +492,32 @@ bld.SAMBA_SUBSYSTEM('RPC_NDR_MGMT', bld.SAMBA_SUBSYSTEM('RPC_NDR_OXIDRESOLVER', source='gen_ndr/ndr_oxidresolver_c.c', - public_deps='dcerpc NDR_OXIDRESOLVER' + public_deps='rpccommon NDR_OXIDRESOLVER' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_REMACT', source='gen_ndr/ndr_remact_c.c', - public_deps='dcerpc NDR_REMACT' + public_deps='rpccommon NDR_REMACT' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_WZCSVC', source='gen_ndr/ndr_wzcsvc_c.c', - public_deps='dcerpc NDR_WZCSVC' + public_deps='rpccommon NDR_WZCSVC' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_W32TIME', source='gen_ndr/ndr_w32time_c.c', - public_deps='dcerpc NDR_W32TIME' + public_deps='rpccommon NDR_W32TIME' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_SCERPC', source='gen_ndr/ndr_scerpc_c.c', - public_deps='dcerpc NDR_SCERPC' + public_deps='rpccommon NDR_SCERPC' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_NTSVCS', source='gen_ndr/ndr_ntsvcs_c.c', - public_deps='dcerpc ndr-standard' + public_deps='rpccommon ndr-standard' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_NETLOGON', @@ -527,22 +527,22 @@ bld.SAMBA_SUBSYSTEM('RPC_NDR_NETLOGON', bld.SAMBA_SUBSYSTEM('RPC_NDR_TRKWKS', source='gen_ndr/ndr_trkwks_c.c', - public_deps='dcerpc NDR_TRKWKS' + public_deps='rpccommon NDR_TRKWKS' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_KEYSVC', source='gen_ndr/ndr_keysvc_c.c', - public_deps='dcerpc NDR_KEYSVC' + public_deps='rpccommon NDR_KEYSVC' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_BACKUPKEY', source='gen_ndr/ndr_backupkey_c.c', - public_deps='dcerpc NDR_BACKUPKEY' + public_deps='rpccommon NDR_BACKUPKEY' ) bld.SAMBA_SUBSYSTEM('RPC_NDR_DNSP', source='gen_ndr/ndr_dnsp_c.c', - public_deps='dcerpc NDR_DNSP' + public_deps='rpccommon NDR_DNSP' ) # a grouping library for NDR subsystems that may be used by more than one target @@ -555,11 +555,14 @@ bld.SAMBA_LIBRARY('ndr-samba', # a grouping library for RPC_NDR subsystems that may be used by more than one target bld.SAMBA_LIBRARY('dcerpc-samba', - source=[], - deps='RPC_NDR_DRSUAPI RPC_NDR_LSA RPC_NDR_WINREG', - private_library=True, - grouping_library=True - ) + source='', + deps='''RPC_NDR_LSA RPC_NDR_SAMR RPC_NDR_NETLOGON RPC_NDR_EVENTLOG RPC_NDR_DFS + RPC_NDR_NTSVCS RPC_NDR_SVCCTL RPC_NDR_INITSHUTDOWN RPC_NDR_WKSSVC RPC_NDR_SRVSVC RPC_NDR_WINREG + RPC_NDR_ECHO RPC_NDR_EPMAPPER RPC_NDR_ATSVC RPC_NDR_SPOOLSS''', + public_deps='ndr-standard', + private_library=True, + grouping_library=True + ) bld.SAMBA_LIBRARY('ndr', source='ndr/ndr_string.c ndr/ndr_basic.c ndr/uuid.c ndr/ndr.c ndr/ndr_misc.c gen_ndr/ndr_misc.c', -- cgit From 41b3c38587f1153d49c1805869aa186b66501f7a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 16 May 2011 21:18:25 +1000 Subject: librpc/ndr Merge ndr_print_sockaddr_storage() into common code There is no longer a reason to leave this source3 specific, and this brings it into a library (avoiding duplicate symbols). Andrew Bartlett --- librpc/ndr/libndr.h | 3 +++ librpc/ndr/util.c | 31 +++++++++++++++++++++++++++++++ librpc/wscript_build | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 librpc/ndr/util.c (limited to 'librpc') diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index 8c59bb9bb06..cbe9b40440e 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -374,6 +374,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 +397,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/util.c b/librpc/ndr/util.c new file mode 100644 index 00000000000..b2df28dde09 --- /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 . +*/ + +#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)); +} diff --git a/librpc/wscript_build b/librpc/wscript_build index 02600084bac..d8b3fe78ff5 100644 --- a/librpc/wscript_build +++ b/librpc/wscript_build @@ -565,7 +565,7 @@ bld.SAMBA_LIBRARY('dcerpc-samba', ) bld.SAMBA_LIBRARY('ndr', - source='ndr/ndr_string.c ndr/ndr_basic.c ndr/uuid.c ndr/ndr.c ndr/ndr_misc.c gen_ndr/ndr_misc.c', + source='ndr/ndr_string.c ndr/ndr_basic.c ndr/uuid.c ndr/ndr.c ndr/ndr_misc.c gen_ndr/ndr_misc.c ndr/util.c', pc_files='ndr.pc', public_deps='errors talloc samba-util', public_headers='gen_ndr/misc.h gen_ndr/ndr_misc.h ndr/libndr.h:ndr.h', -- cgit From c51795c747198f9e002505ffa39ad710beff0358 Mon Sep 17 00:00:00 2001 From: Sean Finney Date: Tue, 31 May 2011 09:49:18 +0200 Subject: librpc/ndr: consolidate string conversion logic in ndr_pull_string Reduce the amount of duplicate code in ndr_pull_string by moving the almost duplicate conversion calls and their corresponding NDR pulls and checks to a single location. In the place of the removed calls is logic allowing the conversion to be generalized, and and any specific pulls/checks that do not apply to the general case. This is similar to what has already been done in the switch statement for ndr_push_string. Signed-off-by: Sean Finney --- librpc/ndr/ndr_string.c | 215 ++++++++++-------------------------------------- 1 file changed, 44 insertions(+), 171 deletions(-) (limited to 'librpc') diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 6e20333f043..d0d83032409 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -30,7 +30,7 @@ _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; + size_t conv_src_len = 0, converted_size; int chset = CH_UTF16; unsigned byte_mul = 2; unsigned flags = ndr->flags; @@ -73,77 +73,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 +96,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 +125,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 +134,35 @@ _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, ""); + } 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 (strlen(as) < conv_src_len) { + DEBUG(6,("short string '%s'\n", as)); + } + } else { + if (strlen(as) == conv_src_len) { + DEBUG(6,("long string '%s'\n", as)); + } + } + + NDR_CHECK(ndr_pull_advance(ndr, conv_src_len * byte_mul)); + *s = as; + return NDR_ERR_SUCCESS; } -- cgit From 08abd1f5e851c4f40a863f5c3ff6acc93d691efb Mon Sep 17 00:00:00 2001 From: Sean Finney Date: Tue, 31 May 2011 09:49:19 +0200 Subject: librpc/ndr: add new LIBNDR_FLAG_STR_RAW8 for ndr_pull_string Introduce a new flag, LIBNDR_FLAG_STR_RAW8, which indicates that libndr should not attempt to convert the corresponding byte sequence, and place the responsibility on the caller to do so later. This is needed in cases where the string is known to be 8-bit and either NULL terminated or of known length, but in an unspecified character set. For example, when pulling PT_STRING8 properties from an exchange server via libmapi + libndr, the codepage is neither known nor in the control of the caller, and is determined by subsequent properties requested from the server. Therefore the client would like to fetch all properties in one large batch, and convert the resulting strings locally. This commit also includes some (basic) tests of each of the flags' respective behaviors with the ndr push/pull string functions, in a new source4 torture test suite ndr.ndr_string. Signed-off-by: Sean Finney --- librpc/idl/idl_types.h | 6 ++++++ librpc/ndr/libndr.h | 1 + librpc/ndr/ndr_string.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 45 insertions(+), 8 deletions(-) (limited to 'librpc') diff --git a/librpc/idl/idl_types.h b/librpc/idl/idl_types.h index 023c04020ea..c50eface0d1 100644 --- a/librpc/idl/idl_types.h +++ b/librpc/idl/idl_types.h @@ -8,6 +8,7 @@ #define STR_CONFORMANT LIBNDR_FLAG_STR_CONFORMANT #define STR_CHARLEN LIBNDR_FLAG_STR_CHARLEN #define STR_UTF8 LIBNDR_FLAG_STR_UTF8 +#define STR_RAW8 LIBNDR_FLAG_STR_RAW8 /* a null terminated UCS2 string @@ -24,6 +25,11 @@ */ #define utf8string [flag(STR_UTF8|STR_NULLTERM)] string +/* + a null terminated "raw" string (null terminated byte sequence) +*/ +#define raw8string [flag(STR_RAW8|STR_NULLTERM)] string + /* a null terminated UCS2 string */ diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index cbe9b40440e..ca3710bc986 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 */ diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index d0d83032409..207d55bb1b1 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -31,7 +31,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, uint32_t len1, ofs, len2; uint16_t len3; size_t conv_src_len = 0, converted_size; - int chset = CH_UTF16; + 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; @@ -138,7 +144,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (conv_src_len == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - if (!convert_string_talloc(ndr->current_mem_ctx, chset, + if (!do_convert) { + as = talloc_strndup(ndr->current_mem_ctx, + ndr->data + ndr->offset, + 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, @@ -174,7 +184,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; @@ -201,12 +211,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 = 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, @@ -276,9 +296,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; } @@ -484,16 +508,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: -- cgit From 00577e9a3ad7d126b6f58b54d1888d696b8cc9b4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 31 May 2011 20:21:37 +1000 Subject: librpc/ndr: Use converted_size to determine if NULL termination was sent This is better than doing a strlen() on the string, as that huristic only worked for ASCII strings. Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Wed Jun 1 01:42:22 CEST 2011 on sn-devel-104 --- librpc/ndr/ndr_string.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'librpc') diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 207d55bb1b1..cf4d972072a 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -143,11 +143,17 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_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, 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, @@ -161,12 +167,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, /* 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) < conv_src_len) { - DEBUG(6,("short string '%s'\n", as)); + 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 (strlen(as) == conv_src_len) { - DEBUG(6,("long string '%s'\n", as)); + if (as && converted_size > 0 && as[converted_size-1] != '\0') { + DEBUG(6,("long string '%s', send without NULL termination (which was expected)\n", as)); } } -- cgit From db46a9d6348869794c0c0cf5d6c7079cdc334426 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 1 Jun 2011 14:49:03 -0700 Subject: Fix type mixing warnings. --- librpc/ndr/ndr_string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'librpc') diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index cf4d972072a..4510a71082f 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -147,7 +147,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, } else { if (!do_convert) { as = talloc_strndup(ndr->current_mem_ctx, - ndr->data + ndr->offset, + (char *)ndr->data + ndr->offset, conv_src_len); if (!as) { return ndr_pull_error(ndr, NDR_ERR_ALLOC, @@ -231,7 +231,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, if (!do_convert) { d_len = s_len; - dest = talloc_strndup(ndr, s, 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)) { -- cgit From d057116cc2e454ba097d0dcb22e16108a05a4a1b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 2 May 2011 10:55:20 +1000 Subject: server_id.idl: Bring server_id.idl in common Andrew Bartlett Signed-off-by: Andrew Tridgell --- librpc/idl/server_id.idl | 26 ++++++++++++++++++++++++++ librpc/idl/wscript_build | 2 +- librpc/wscript_build | 7 +++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 librpc/idl/server_id.idl (limited to 'librpc') diff --git a/librpc/idl/server_id.idl b/librpc/idl/server_id.idl new file mode 100644 index 00000000000..51900000edb --- /dev/null +++ b/librpc/idl/server_id.idl @@ -0,0 +1,26 @@ +[ + pointer_default(unique) +] +interface server_id +{ + + /* used to look like the following, note that unique_id was not + * marshalled at all... + + struct server_id { + pid_t pid; + #ifdef CLUSTER_SUPPORT + uint32 vnn; + #endif + uint64_t unique_id; + }; + + */ + + typedef [public] struct { + hyper pid; + uint32 task_id; + uint32 vnn; + udlong unique_id; + } server_id; +} diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build index 7e1340e6f77..1c5d6ec7460 100644 --- a/librpc/idl/wscript_build +++ b/librpc/idl/wscript_build @@ -8,7 +8,7 @@ bld.SAMBA_PIDL_LIST('PIDL', browser.idl dfs.idl dssetup.idl frsapi.idl krb5pac.idl named_pipe_auth.idl orpc.idl rot.idl spoolss.idl w32time.idl xattr.idl dbgidl.idl dnsserver.idl echo.idl frsrpc.idl lsa.idl nbt.idl dns.idl - oxidresolver.idl samr.idl srvsvc.idl winreg.idl dcerpc.idl + oxidresolver.idl samr.idl server_id.idl srvsvc.idl winreg.idl dcerpc.idl drsblobs.idl efs.idl frstrans.idl mgmt.idl netlogon.idl policyagent.idl scerpc.idl svcctl.idl wkssvc.idl eventlog6.idl backupkey.idl printcap.idl''', diff --git a/librpc/wscript_build b/librpc/wscript_build index d8b3fe78ff5..56959062f21 100644 --- a/librpc/wscript_build +++ b/librpc/wscript_build @@ -175,6 +175,13 @@ bld.SAMBA_SUBSYSTEM('NDR_SCERPC', public_deps='ndr' ) +bld.SAMBA_SUBSYSTEM('NDR_SERVER_ID', + source='gen_ndr/ndr_server_id.c', + deps='ndr', + public_headers='gen_ndr/server_id.h', + header_path='gen_ndr' + ) + bld.SAMBA_SUBSYSTEM('NDR_TRKWKS', source='gen_ndr/ndr_trkwks.c', public_deps='ndr' -- cgit From a772797a384a1142c5af95bd06c14a141dea38d7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 2 May 2011 11:10:12 +1000 Subject: librpc/idr Use the Samba3 notify.idl in common. The extra fields in the structure that Samba4 does not use should not bother it. Andrew Bartlett Signed-off-by: Andrew Tridgell --- librpc/idl/notify.idl | 84 ++++++++++++++++++++++++++++++++++++++++++++++++ librpc/idl/wscript_build | 1 + librpc/wscript_build | 8 ++++- 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 librpc/idl/notify.idl (limited to 'librpc') diff --git a/librpc/idl/notify.idl b/librpc/idl/notify.idl new file mode 100644 index 00000000000..845010601ea --- /dev/null +++ b/librpc/idl/notify.idl @@ -0,0 +1,84 @@ +#include "idl_types.h" + +import "file_id.idl", "server_id.idl"; + +/* + IDL structures for notify change code + + this defines the structures used in the notify database code, and + the change notify buffers +*/ + +[ + pointer_default(unique) +] +interface notify +{ + + /* structure used in the notify database */ + typedef [public] struct { + server_id server; + uint32 filter; /* filter to apply in this directory */ + uint32 subdir_filter; /* filter to apply in child directories */ + uint32 dir_fd; /* fd of open directory */ + file_id dir_id; /* file_id of open directory */ + utf8string path; + uint32 path_len; /* saves some computation on search */ + pointer private_data; + } notify_entry; + + typedef [public] struct { + uint32 num_entries; + notify_entry entries[num_entries]; + } notify_entry_array; + + /* + to allow for efficient search for matching entries, we + divide them by the directory depth, with a separate array + per depth. The entries within each depth are sorted by path, + allowing for a bisection search. + + The max_mask and max_mask_subdir at each depth is the + bitwise or of the filters and subdir filters for all entries + at that depth. This allows a depth to be quickly skipped if + no entries will match the target filter + */ + typedef struct { + uint32 max_mask; + uint32 max_mask_subdir; + uint32 num_entries; + notify_entry entries[num_entries]; + } notify_depth; + + typedef [public] struct { + uint32 num_depths; + notify_depth depth[num_depths]; + } notify_array; + + /* structure sent between servers in notify messages */ + typedef [public] struct { + uint32 action; + utf8string path; + pointer private_data; + } notify_event; + + typedef [v1_enum] enum { + FILE_ACTION_ADDED = 0x00000001, + FILE_ACTION_REMOVED = 0x00000002, + FILE_ACTION_MODIFIED = 0x00000003, + FILE_ACTION_RENAMED_OLD_NAME = 0x00000004, + FILE_ACTION_RENAMED_NEW_NAME = 0x00000005, + FILE_ACTION_ADDED_STREAM = 0x00000006, + FILE_ACTION_REMOVED_STREAM = 0x00000007, + FILE_ACTION_MODIFIED_STREAM = 0x00000008 + } FILE_NOTIFY_ACTION; + + /* structure sent at the CIFS layer */ + /* Align on 4-byte boundary according to MS-CIFS 2.2.7.4.2 */ + typedef [public,gensize,flag(NDR_ALIGN4)] struct { + uint32 NextEntryOffset; + FILE_NOTIFY_ACTION Action; + [value(strlen_m(FileName1)*2)] uint32 FileNameLength; + [charset(UTF16),flag(STR_NOTERM)] uint16 FileName1[FileNameLength]; + } FILE_NOTIFY_INFORMATION; +} diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build index 1c5d6ec7460..ffb7a9c8088 100644 --- a/librpc/idl/wscript_build +++ b/librpc/idl/wscript_build @@ -10,6 +10,7 @@ bld.SAMBA_PIDL_LIST('PIDL', dbgidl.idl dnsserver.idl echo.idl frsrpc.idl lsa.idl nbt.idl dns.idl oxidresolver.idl samr.idl server_id.idl srvsvc.idl winreg.idl dcerpc.idl drsblobs.idl efs.idl frstrans.idl mgmt.idl netlogon.idl + notify.idl policyagent.idl scerpc.idl svcctl.idl wkssvc.idl eventlog6.idl backupkey.idl printcap.idl''', options='--header --ndr-parser --samba3-ndr-server --server --client --python', diff --git a/librpc/wscript_build b/librpc/wscript_build index 56959062f21..a68ce477dd2 100644 --- a/librpc/wscript_build +++ b/librpc/wscript_build @@ -202,6 +202,11 @@ bld.SAMBA_SUBSYSTEM('NDR_IDMAP', public_deps='ndr ndr-standard' ) +bld.SAMBA_SUBSYSTEM('NDR_NOTIFY', + source='gen_ndr/ndr_notify.c', + public_deps='ndr ndr-standard NDR_SERVER_ID NDR_FILE_ID' + ) + bld.SAMBA_SUBSYSTEM('NDR_NTLMSSP', source='ndr/ndr_ntlmssp.c gen_ndr/ndr_ntlmssp.c', public_deps='ndr ndr-standard' @@ -312,7 +317,8 @@ bld.SAMBA_LIBRARY('ndr-standard', pc_files='ndr_standard.pc', deps='''NDR_SECURITY NDR_LSA NDR_SAMR NDR_NETLOGON NDR_EVENTLOG NDR_DFS NDR_NTSVCS NDR_SVCCTL NDR_INITSHUTDOWN NDR_WKSSVC NDR_SRVSVC NDR_WINREG - NDR_ECHO security NDR_DNS NDR_ATSVC NDR_SPOOLSS NDR_DSSETUP''', + NDR_ECHO security NDR_DNS NDR_ATSVC NDR_SPOOLSS NDR_DSSETUP + NDR_SERVER_ID NDR_NOTIFY''', public_deps='ndr', public_headers='gen_ndr/samr.h gen_ndr/ndr_samr.h gen_ndr/lsa.h gen_ndr/netlogon.h gen_ndr/atsvc.h gen_ndr/ndr_atsvc.h gen_ndr/ndr_svcctl.h gen_ndr/svcctl.h', header_path='gen_ndr' -- cgit From 16b1c77644217796f70a3a0bf1d95c245f9ee2d9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 8 Jun 2011 14:05:55 +1000 Subject: lib/util Bring procid_str() into lib/util as server_id_string() This is needed for OpenChange, which prints Samba struct server_id values in debug messages. Andrew Bartlett --- librpc/idl/server_id.idl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'librpc') diff --git a/librpc/idl/server_id.idl b/librpc/idl/server_id.idl index 51900000edb..414e05a190f 100644 --- a/librpc/idl/server_id.idl +++ b/librpc/idl/server_id.idl @@ -4,6 +4,13 @@ interface server_id { + /* + * Virtual Node Numbers are identifying a node within a cluster. + * Ctdbd sets this, we retrieve our vnn from it. + */ + + const int NONCLUSTER_VNN = 0xFFFFFFFF; + /* used to look like the following, note that unique_id was not * marshalled at all... -- cgit From b36e5ae8381d20997227b988556ac9f3a14fef4c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 9 Jun 2011 14:22:57 +0200 Subject: server_id.idl: change unique_id to hyper This makes it consistent to pid. metze --- librpc/idl/server_id.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'librpc') diff --git a/librpc/idl/server_id.idl b/librpc/idl/server_id.idl index 414e05a190f..ac2e9ab3182 100644 --- a/librpc/idl/server_id.idl +++ b/librpc/idl/server_id.idl @@ -28,6 +28,6 @@ interface server_id hyper pid; uint32 task_id; uint32 vnn; - udlong unique_id; + hyper unique_id; } server_id; } -- cgit From cfa1507610992b4a3caeb6d35b16ccecf7b86939 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Jun 2011 15:01:56 +0200 Subject: librpc/ndr/ndr_backupkey.h: fix licence/copyright Guenther --- librpc/ndr/ndr_backupkey.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'librpc') diff --git a/librpc/ndr/ndr_backupkey.h b/librpc/ndr/ndr_backupkey.h index c5c7c39995a..4e82f6296ad 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 . +*/ + _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); -- cgit From e9e2f3034e8771b36cfbd19a661724a6039eaca4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Jun 2011 15:02:06 +0200 Subject: librpc/ndr/ndr_compression.h: fix licence/copyright Guenther --- librpc/ndr/ndr_compression.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'librpc') diff --git a/librpc/ndr/ndr_compression.h b/librpc/ndr/ndr_compression.h index b939f6a42ba..1c22fbf7595 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 . +*/ + #ifndef __LIBRPC_NDR_NDR_COMPRESSION_H__ #define __LIBRPC_NDR_NDR_COMPRESSION_H__ -- cgit From 4dadee3adf4deb212f14c0a574dc0e91baa6589a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Jun 2011 15:02:16 +0200 Subject: librpc/ndr/ndr_dns.h: fix licence/copyright Guenther --- librpc/ndr/ndr_dns.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'librpc') diff --git a/librpc/ndr/ndr_dns.h b/librpc/ndr/ndr_dns.h index d97d57fdacd..16bf11ba87f 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 + + 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 . +*/ + void ndr_print_dns_string(struct ndr_print *ndr, const char *name, const char *s); -- cgit From 8b75b65b36f79a4d94b11d3fc599d3c884a335e0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Jun 2011 15:02:26 +0200 Subject: librpc/ndr/ndr_spoolss_buf.h: fix licence/copyright Guenther --- librpc/ndr/ndr_spoolss_buf.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'librpc') diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h index c5938c00c86..77053cb13d7 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 . +*/ + #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__ -- cgit From 768ed8b98517d0146317fd409ccaede3e53942ef Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Jun 2011 15:02:38 +0200 Subject: librpc/ndr/ndr_table.h: fix licence/copyright Guenther --- librpc/ndr/ndr_table.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'librpc') diff --git a/librpc/ndr/ndr_table.h b/librpc/ndr/ndr_table.h index 9e8fea1db6a..207618f644e 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 . +*/ + #ifndef _NDR_TABLE_PROTO_H_ #define _NDR_TABLE_PROTO_H_ -- cgit From 1dbe9706bc34c960fd2664508736b5a71d80433d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 14 Jun 2011 11:31:43 +0200 Subject: librpc: fix buildwarning in NDR_WMI. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Wed Jun 15 17:23:49 CEST 2011 on sn-devel-104 --- librpc/ndr/ndr_wmi.c | 1 + librpc/ndr/ndr_wmi.h | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 librpc/ndr/ndr_wmi.h (limited to 'librpc') diff --git a/librpc/ndr/ndr_wmi.c b/librpc/ndr/ndr_wmi.c index 87f3e9690ad..47488883890 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 00000000000..62d2c535cd8 --- /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); -- cgit From a1f04e8abc761ef1ba211420ff1dbda50fcf527d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 20 Jun 2011 14:55:32 +1000 Subject: libcli/util Rename common map_nt_error_from_unix to avoid duplicate symbol The two error tables need to be combined, but for now seperate the names. (As the common parts of the tree now use the _common function, errmap_unix.c must be included in the s3 autoconf build). Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Mon Jun 20 08:12:03 CEST 2011 on sn-devel-104 --- librpc/rpc/binding_handle.c | 4 ++-- librpc/rpc/dcerpc_util.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'librpc') diff --git a/librpc/rpc/binding_handle.c b/librpc/rpc/binding_handle.c index 6c2d8a8b12b..1e90827dbe1 100644 --- a/librpc/rpc/binding_handle.c +++ b/librpc/rpc/binding_handle.c @@ -227,7 +227,7 @@ NTSTATUS dcerpc_binding_handle_raw_call(struct dcerpc_binding_handle *h, } if (!tevent_req_poll(subreq, ev)) { - status = map_nt_error_from_unix(errno); + status = map_nt_error_from_unix_common(errno); talloc_free(frame); return status; } @@ -540,7 +540,7 @@ NTSTATUS dcerpc_binding_handle_call(struct dcerpc_binding_handle *h, } if (!tevent_req_poll(subreq, ev)) { - status = map_nt_error_from_unix(errno); + status = map_nt_error_from_unix_common(errno); talloc_free(frame); return status; } diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c index a405ca8966a..de292c83669 100644 --- a/librpc/rpc/dcerpc_util.c +++ b/librpc/rpc/dcerpc_util.c @@ -266,7 +266,7 @@ static void dcerpc_read_ncacn_packet_done(struct tevent_req *subreq) ret = tstream_readv_pdu_recv(subreq, &sys_errno); TALLOC_FREE(subreq); if (ret == -1) { - status = map_nt_error_from_unix(sys_errno); + status = map_nt_error_from_unix_common(sys_errno); tevent_req_nterror(req, status); return; } -- cgit From 125a2ff262aa312df20eec68802fd5f8a47f492f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 22 Jun 2011 09:52:31 +1000 Subject: lib/util/charset: Remove 'display charset' As discussed in 'CH_DISPLAY and gettext' on the samba-technical list: http://lists.samba.org/archive/samba-technical/2011-June/078190.html Setting this to a value other than 'unix charset' does not make sense, as any system where the filesytem charset does not equal the terminal charset will already have problems with programs as simple as 'ls'. It also means that our output could not be pasted as our input in interactive programs or onto our command line, as we never did translate in the DISPLAY -> UNIX direction. The d_printf() calls are retained in case we need to revisit this, and to support display_set_stderr(). Andrew Bartlett --- librpc/ndr/ndr_string.c | 1 - 1 file changed, 1 deletion(-) (limited to 'librpc') diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 4510a71082f..840776fa3a9 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -645,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; -- cgit