From ef213b02482194a8fed7f37123e08624072694b2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Mar 2005 20:28:01 +0000 Subject: r5866: Add InitShutdown IDL and torture test. Implement push side of NDR_LEN4|NDR_NOTERM strings (pull side was already present) (This used to be commit ea61ec1122841716ed5d90085ba79e7bf691bd6a) --- source4/librpc/config.mk | 14 ++++++++++- source4/librpc/idl/initshutdown.idl | 46 +++++++++++++++++++++++++++++++++++++ source4/librpc/idl/winreg.idl | 6 ++--- source4/librpc/ndr/ndr_basic.c | 14 +++++++++++ 4 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 source4/librpc/idl/initshutdown.idl (limited to 'source4/librpc') diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index bf34207872..37a1614345 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -191,6 +191,12 @@ INIT_OBJ_FILES = librpc/gen_ndr/ndr_winreg.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR +[SUBSYSTEM::NDR_INITSHUTDOWN] +INIT_FUNCTION = dcerpc_initshutdown_init +INIT_OBJ_FILES = librpc/gen_ndr/ndr_initshutdown.o +NOPROTO = YES +REQUIRED_SUBSYSTEMS = LIBNDR + [SUBSYSTEM::NDR_MGMT] INIT_FUNCTION = dcerpc_mgmt_init INIT_OBJ_FILES = librpc/gen_ndr/ndr_mgmt.o @@ -317,7 +323,8 @@ REQUIRED_SUBSYSTEMS = NDR_AUDIOSRV NDR_ECHO NDR_DCERPC NDR_EXCHANGE \ NDR_WINREG NDR_MGMT NDR_PROTECTED_STORAGE NDR_OXIDRESOLVER \ NDR_REMACT NDR_WZCSVC NDR_BROWSER NDR_W32TIME NDR_SCERPC NDR_NTSVCS \ NDR_NETLOGON NDR_TRKWKS NDR_KEYSVC NDR_KRB5PAC NDR_XATTR NDR_SCHANNEL \ - NDR_ROT NDR_DRSBLOBS NDR_SVCCTL NDR_NBT NDR_WINSREPL LIB_SECURITY_NDR + NDR_ROT NDR_DRSBLOBS NDR_SVCCTL NDR_NBT NDR_WINSREPL LIB_SECURITY_NDR \ + NDR_INITSHUTDOWN [SUBSYSTEM::RPC_NDR_ROT] ADD_OBJ_FILES = librpc/gen_ndr/ndr_rot_c.o @@ -439,6 +446,11 @@ ADD_OBJ_FILES = librpc/gen_ndr/ndr_winreg_c.o REQUIRED_SUBSYSTEMS = LIBRPC NDR_WINREG NOPROTO = YES +[SUBSYSTEM::RPC_NDR_INITSHUTDOWN] +ADD_OBJ_FILES = librpc/gen_ndr/ndr_initshutdown_c.o +REQUIRED_SUBSYSTEMS = LIBRPC NDR_INITSHUTDOWN +NOPROTO = YES + [SUBSYSTEM::RPC_NDR_MGMT] ADD_OBJ_FILES = librpc/gen_ndr/ndr_mgmt_c.o REQUIRED_SUBSYSTEMS = LIBRPC NDR_MGMT diff --git a/source4/librpc/idl/initshutdown.idl b/source4/librpc/idl/initshutdown.idl new file mode 100644 index 0000000000..e84edb47b8 --- /dev/null +++ b/source4/librpc/idl/initshutdown.idl @@ -0,0 +1,46 @@ +#include "idl_types.h" + +/* + initshutdown interface definition +*/ + +[ + uuid("894de0c0-0d55-11d3-a322-00c04fa321a1"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\InitShutdown]"), + pointer_default(unique), + helpstring("Init shutdown service") +] interface initshutdown +{ + typedef struct { + [value(strlen_m_term(r->name))] uint32 name_size; + [flag(STR_LEN4|STR_NOTERM)] string name; + } initshutdown_String_sub; + + typedef [public] struct { + [value(strlen_m(r->name->name)*2)] uint16 name_len; + [value(strlen_m_term(r->name->name)*2)] uint16 name_size; + initshutdown_String_sub *name; + } initshutdown_String; + + WERROR initshutdown_Init( + [in] uint16 *hostname, + [in] initshutdown_String *message, + [in] uint32 timeout, + [in] uint8 force_apps, + [in] uint8 reboot + ); + + WERROR initshutdown_Abort( + [in] uint16 *server + ); + + WERROR initshutdown_InitEx( + [in] uint16 *hostname, + [in] initshutdown_String *message, + [in] uint32 timeout, + [in] uint8 force_apps, + [in] uint8 reboot, + [in] uint32 reason + ); +} diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl index 3d11af790b..47531d4710 100644 --- a/source4/librpc/idl/winreg.idl +++ b/source4/librpc/idl/winreg.idl @@ -10,7 +10,7 @@ endpoint("ncacn_np:[\\pipe\\winreg]","ncacn_ip_tcp:","ncalrpc:"), pointer_default(unique), helpstring("Remote Registry Service"), - depends(lsa) + depends(lsa,initshutdown) ] interface winreg { typedef struct { @@ -270,7 +270,7 @@ /* Function: 0x18 */ WERROR winreg_InitiateSystemShutdown( [in] uint16 *hostname, - [in] winreg_String *message, + [in] initshutdown_String *message, [in] uint32 timeout, [in] uint8 force_apps, [in] uint8 reboot @@ -326,7 +326,7 @@ /* Function: 0x1e */ WERROR winreg_InitiateSystemShutdownEx( [in] uint16 *hostname, - [in] winreg_String *message, + [in] initshutdown_String *message, [in] uint32 timeout, [in] uint8 force_apps, [in] uint8 reboot, diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 3e192d03a2..8284375be5 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -918,6 +918,20 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s) ndr->offset += byte_mul*(c_len+1); break; + case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM: + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len)); + NDR_PUSH_NEED_BYTES(ndr, byte_mul*c_len); + ret = convert_string(CH_UNIX, chset, + s, s_len, + ndr->data+ndr->offset, byte_mul*c_len); + if (ret == -1) { + return ndr_push_error(ndr, NDR_ERR_CHARCNV, + "Bad character conversion"); + } + ndr->offset += byte_mul*c_len; + break; + case LIBNDR_FLAG_STR_SIZE4: NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len + c_len_term)); NDR_PUSH_NEED_BYTES(ndr, byte_mul*(c_len+1)); -- cgit