wmi-1.3.16 from opsview.com

This commit is contained in:
Are Casilla
2019-02-16 00:16:52 +01:00
parent 163fdd3d1b
commit 17b3af2911
2146 changed files with 678824 additions and 0 deletions
+723
View File
@@ -0,0 +1,723 @@
################################################
# Start SUBSYSTEM LIBNDR
[LIBRARY::LIBNDR]
VERSION = 0.0.1
SO_VERSION = 0
DESCRIPTION = Network Data Representation Core Library
PUBLIC_HEADERS = ndr/libndr.h
PUBLIC_PROTO_HEADER = ndr/libndr_proto.h
OBJ_FILES = \
ndr/ndr.o \
ndr/ndr_basic.o \
ndr/ndr_string.o \
ndr/uuid.o
PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC LIBSAMBA-UTIL CHARSET EXT_NSL \
LIBSAMBA-CONFIG
# End SUBSYSTEM LIBNDR
################################################
################################################
# Start SUBSYSTEM NDR_COMPRESSION
[LIBRARY::NDR_COMPRESSION]
VERSION = 0.0.1
SO_VERSION = 0
DESCRIPTION = NDR support for compressed subcontexts
PRIVATE_PROTO_HEADER = ndr/ndr_compression.h
OBJ_FILES = \
ndr/ndr_compression.o
PUBLIC_DEPENDENCIES = LIBCOMPRESSION LIBSAMBA-ERRORS LIBNDR
# End SUBSYSTEM NDR_COMPRESSION
################################################
[LIBRARY::NDR_SECURITY]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_security.o ndr/ndr_sec_helper.o
PUBLIC_HEADERS = gen_ndr/security.h
PUBLIC_DEPENDENCIES = NDR_MISC LIBSECURITY
[LIBRARY::NDR_AUDIOSRV]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_audiosrv.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_DNSSERVER]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dnsserver.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_WINSTATION]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winstation.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_ECHO]
OBJ_FILES = gen_ndr/ndr_echo.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_IRPC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_irpc.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY NDR_NBT
[LIBRARY::NDR_DSBACKUP]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dsbackup.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_EFS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_efs.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
[SUBSYSTEM::NDR_MISC]
OBJ_FILES = gen_ndr/ndr_misc.o ndr/ndr_misc.o
PUBLIC_HEADERS = gen_ndr/misc.h gen_ndr/ndr_misc.h
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_ROT]
OBJ_FILES = gen_ndr/ndr_rot.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC
[LIBRARY::NDR_LSA]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_lsa.o
PUBLIC_HEADERS = gen_ndr/lsa.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
[LIBRARY::NDR_DFS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dfs.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
[LIBRARY::NDR_FRSRPC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_frsrpc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_FRSAPI]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_frsapi.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_DRSUAPI]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_drsuapi.o ndr/ndr_drsuapi.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_COMPRESSION NDR_SECURITY NDR_SAMR
[LIBRARY::NDR_DRSBLOBS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_drsblobs.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_DRSUAPI
[SUBSYSTEM::NDR_SASL_HELPERS]
OBJ_FILES = gen_ndr/ndr_sasl_helpers.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_POLICYAGENT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_policyagent.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_UNIXINFO]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_unixinfo.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
[LIBRARY::NDR_SAMR]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_samr.o
PUBLIC_HEADERS = gen_ndr/samr.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_LSA NDR_SECURITY
[LIBRARY::NDR_NFS4ACL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_nfs4acl.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_SECURITY
[LIBRARY::NDR_SPOOLSS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_spoolss.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SPOOLSS_BUF NDR_SECURITY
[SUBSYSTEM::NDR_SPOOLSS_BUF]
PRIVATE_PROTO_HEADER = ndr/ndr_spoolss_buf.h
OBJ_FILES = ndr/ndr_spoolss_buf.o
[LIBRARY::NDR_WKSSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wkssvc.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SRVSVC NDR_MISC NDR_SECURITY
[LIBRARY::NDR_SRVSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_srvsvc.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SVCCTL NDR_SECURITY
[LIBRARY::NDR_SVCCTL]
VERSION = 0.0.1
PUBLIC_HEADERS = gen_ndr/svcctl.h
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_svcctl.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
[LIBRARY::NDR_ATSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_atsvc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_EVENTLOG]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_eventlog.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_LSA
[SUBSYSTEM::NDR_EPMAPPER]
OBJ_FILES = gen_ndr/ndr_epmapper.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
[LIBRARY::NDR_DBGIDL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dbgidl.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_DSSETUP]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dssetup.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
[LIBRARY::NDR_MSGSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_msgsvc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_WINS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wins.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_WINREG]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winreg.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_INITSHUTDOWN NDR_SECURITY NDR_MISC
[LIBRARY::NDR_INITSHUTDOWN]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_initshutdown.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_MGMT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_mgmt.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_DCERPC
[LIBRARY::NDR_PROTECTED_STORAGE]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_protected_storage.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_DCOM]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dcom.o ndr/ndr_dcom.o gen_ndr/dcom_p.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC
[SUBSYSTEM::NDR_ORPC]
OBJ_FILES = gen_ndr/ndr_orpc.o ndr/ndr_orpc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_OXIDRESOLVER]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_oxidresolver.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC NDR_MISC
[LIBRARY::NDR_REMACT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_remact.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC NDR_MISC
[LIBRARY::NDR_WZCSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wzcsvc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_BROWSER]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_browser.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_W32TIME]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_w32time.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_SCERPC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_scerpc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_NTSVCS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_ntsvcs.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_NETLOGON]
OBJ_FILES = gen_ndr/ndr_netlogon.o
PUBLIC_HEADERS = gen_ndr/netlogon.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_SAMR NDR_LSA NDR_SECURITY
[LIBRARY::NDR_TRKWKS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_trkwks.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_KEYSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_keysvc.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_KRB5PAC]
OBJ_FILES = gen_ndr/ndr_krb5pac.o ndr/ndr_krb5pac.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON NDR_SECURITY
[LIBRARY::NDR_XATTR]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_xattr.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
[SUBSYSTEM::NDR_OPENDB]
OBJ_FILES = gen_ndr/ndr_opendb.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_NOTIFY]
OBJ_FILES = gen_ndr/ndr_notify.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_SCHANNEL]
OBJ_FILES = gen_ndr/ndr_schannel.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT
[SUBSYSTEM::NDR_NBT]
OBJ_FILES = gen_ndr/ndr_nbt.o
PUBLIC_HEADERS = gen_ndr/nbt.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_NBT_BUF NDR_SVCCTL NDR_SECURITY
[LIBRARY::NDR_WINSREPL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winsrepl.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT
[LIBRARY::NDR_WINBIND]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winbind.o
PUBLIC_HEADERS = gen_ndr/winbind.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON
include ../heimdal_build/perl_path_wrapper.sh ../librpc/idl-deps.pl librpc/idl/*.idl|
librpc/gen_ndr/tables.c: $(IDL_NDR_PARSE_H_FILES)
@echo Generating librpc/gen_ndr/tables.c
@$(PERL) $(srcdir)/librpc/tables.pl --output=librpc/gen_ndr/tables.c $(IDL_NDR_PARSE_H_FILES) > librpc/gen_ndr/tables.x
mv librpc/gen_ndr/tables.x librpc/gen_ndr/tables.c
[LIBRARY::NDR_TABLE]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = rpc/table.o gen_ndr/tables.o
PRIVATE_PROTO_HEADER = rpc/dcerpc_table.h
PUBLIC_DEPENDENCIES = \
NDR_AUDIOSRV NDR_ECHO NDR_DCERPC \
NDR_DSBACKUP NDR_EFS NDR_MISC NDR_LSA NDR_DFS NDR_DRSUAPI \
NDR_POLICYAGENT NDR_UNIXINFO NDR_SAMR NDR_SPOOLSS NDR_WKSSVC NDR_SRVSVC NDR_ATSVC \
NDR_EVENTLOG NDR_EPMAPPER NDR_DBGIDL NDR_DSSETUP NDR_MSGSVC NDR_WINS \
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 NDR_SECURITY \
NDR_INITSHUTDOWN NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_DCOM NDR_OPENDB \
NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND NDR_FRSRPC NDR_FRSAPI NDR_NFS4ACL
[LIBRARY::RPC_NDR_ROT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_rot_c.o
PUBLIC_DEPENDENCIES = NDR_ROT dcerpc
[LIBRARY::RPC_NDR_AUDIOSRV]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_audiosrv_c.o
PUBLIC_DEPENDENCIES = NDR_AUDIOSRV dcerpc
[LIBRARY::RPC_NDR_ECHO]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_echo_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_ECHO
[LIBRARY::RPC_NDR_DSBACKUP]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dsbackup_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DSBACKUP
[LIBRARY::RPC_NDR_EFS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_efs_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_EFS
[LIBRARY::RPC_NDR_LSA]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_lsa_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_LSA
[LIBRARY::RPC_NDR_DFS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dfs_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DFS
[LIBRARY::RPC_NDR_DRSUAPI]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_drsuapi_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DRSUAPI
[LIBRARY::RPC_NDR_POLICYAGENT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_policyagent_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_POLICYAGENT
[LIBRARY::RPC_NDR_UNIXINFO]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_unixinfo_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_UNIXINFO
[LIBRARY::RPC_NDR_SAMR]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_samr_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR
[LIBRARY::RPC_NDR_SPOOLSS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_spoolss_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SPOOLSS
[LIBRARY::RPC_NDR_WKSSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wkssvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_WKSSVC
[LIBRARY::RPC_NDR_SRVSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_srvsvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SRVSVC
[LIBRARY::RPC_NDR_SVCCTL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_svcctl_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SVCCTL
[LIBRARY::RPC_NDR_ATSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_atsvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC
[LIBRARY::RPC_NDR_EVENTLOG]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_eventlog_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_EVENTLOG
[SUBSYSTEM::RPC_NDR_EPMAPPER]
OBJ_FILES = gen_ndr/ndr_epmapper_c.o
PUBLIC_DEPENDENCIES = NDR_EPMAPPER
[LIBRARY::RPC_NDR_DBGIDL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dbgidl_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DBGIDL
[LIBRARY::RPC_NDR_DSSETUP]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dssetup_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DSSETUP
[LIBRARY::RPC_NDR_MSGSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_msgsvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_MSGSVC
[LIBRARY::RPC_NDR_WINS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wins_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_WINS
[LIBRARY::RPC_NDR_WINREG]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winreg_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_WINREG
[LIBRARY::RPC_NDR_INITSHUTDOWN]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_initshutdown_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN
[LIBRARY::RPC_NDR_MGMT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_mgmt_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_MGMT
[LIBRARY::RPC_NDR_PROTECTED_STORAGE]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_protected_storage_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_PROTECTED_STORAGE
[SUBSYSTEM::DCOM_PROXY_DCOM]
OBJ_FILES = gen_ndr/ndr_dcom_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DCOM
[LIBRARY::RPC_NDR_OXIDRESOLVER]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_oxidresolver_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_OXIDRESOLVER
[LIBRARY::RPC_NDR_REMACT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_remact_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_REMACT
[LIBRARY::RPC_NDR_WZCSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wzcsvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_WZCSVC
[LIBRARY::RPC_NDR_W32TIME]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_w32time_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_W32TIME
[LIBRARY::RPC_NDR_SCERPC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_scerpc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SCERPC
[LIBRARY::RPC_NDR_NTSVCS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_ntsvcs_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_NTSVCS
[SUBSYSTEM::RPC_NDR_NETLOGON]
OBJ_FILES = gen_ndr/ndr_netlogon_c.o
PUBLIC_DEPENDENCIES = NDR_NETLOGON
[LIBRARY::RPC_NDR_TRKWKS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_trkwks_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_TRKWKS
[LIBRARY::RPC_NDR_KEYSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_keysvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_KEYSVC
[SUBSYSTEM::NDR_DCERPC]
OBJ_FILES = gen_ndr/ndr_dcerpc.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
PUBLIC_HEADERS = gen_ndr/dcerpc.h gen_ndr/ndr_dcerpc.h
[EXT_LIB::BREAKPAD_CLIENT]
LIBS = _sed_tag_libbreakpad_client_path_
LDFLAGS = -lstdc++
################################################
# Start SUBSYSTEM dcerpc
[LIBRARY::dcerpc]
VERSION = 0.0.1
SO_VERSION = 0
DESCRIPTION = DCE/RPC client library
PUBLIC_HEADERS = rpc/dcerpc.h
PUBLIC_PROTO_HEADER = rpc/dcerpc_proto.h
OBJ_FILES = \
rpc/dcerpc.o \
rpc/dcerpc_auth.o \
rpc/dcerpc_schannel.o \
rpc/dcerpc_util.o \
rpc/dcerpc_error.o \
rpc/dcerpc_smb.o \
rpc/dcerpc_smb2.o \
rpc/dcerpc_sock.o \
rpc/dcerpc_connect.o
PRIVATE_DEPENDENCIES = \
BREAKPAD_CLIENT \
samba-socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 \
LIBNDR NDR_DCERPC \
RPC_NDR_EPMAPPER \
NDR_SCHANNEL RPC_NDR_NETLOGON \
gensec LIBCLI_AUTH LIBCLI_RAW CREDENTIALS
# End SUBSYSTEM dcerpc
################################################
# [MODULE::RPC_EJS_ECHO]
# INIT_FUNCTION = ejs_init_rpcecho
# OBJ_FILES = gen_ndr/ndr_echo_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_ECHO EJSRPC
# [MODULE::RPC_EJS_MISC]
# INIT_FUNCTION = ejs_init_misc
# OBJ_FILES = gen_ndr/ndr_misc_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_MISC EJSRPC
# [MODULE::RPC_EJS_SAMR]
# INIT_FUNCTION = ejs_init_samr
# OBJ_FILES = gen_ndr/ndr_samr_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR EJSRPC RPC_EJS_LSA RPC_EJS_SECURITY RPC_EJS_MISC
# [MODULE::RPC_EJS_SECURITY]
# INIT_FUNCTION = ejs_init_security
# OBJ_FILES = gen_ndr/ndr_security_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_SECURITY EJSRPC
# [MODULE::RPC_EJS_LSA]
# INIT_FUNCTION = ejs_init_lsarpc
# OBJ_FILES = gen_ndr/ndr_lsa_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_LSA EJSRPC RPC_EJS_SECURITY RPC_EJS_MISC
# [MODULE::RPC_EJS_DFS]
# INIT_FUNCTION = ejs_init_netdfs
# OBJ_FILES = gen_ndr/ndr_dfs_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_DFS EJSRPC
# [MODULE::RPC_EJS_DRSUAPI]
# INIT_FUNCTION = ejs_init_drsuapi
# OBJ_FILES = gen_ndr/ndr_drsuapi_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_DRSUAPI EJSRPC RPC_EJS_MISC RPC_EJS_SAMR
# [MODULE::RPC_EJS_SPOOLSS]
# INIT_FUNCTION = ejs_init_spoolss
# OBJ_FILES = gen_ndr/ndr_spoolss_ejs.o
# SUBSYSTEM = smbcalls
# ENABLE = NO
# PUBLIC_DEPENDENCIES = dcerpc NDR_SPOOLSS EJSRPC
# [MODULE::RPC_EJS_WKSSVC]
# INIT_FUNCTION = ejs_init_wkssvc
# OBJ_FILES = gen_ndr/ndr_wkssvc_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_WKSSVC EJSRPC RPC_EJS_SRVSVC RPC_EJS_MISC
# [MODULE::RPC_EJS_SRVSVC]
# INIT_FUNCTION = ejs_init_srvsvc
# OBJ_FILES = gen_ndr/ndr_srvsvc_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_SRVSVC EJSRPC RPC_EJS_MISC RPC_EJS_SVCCTL RPC_EJS_SECURITY
# [MODULE::RPC_EJS_EVENTLOG]
# INIT_FUNCTION = ejs_init_eventlog
# OBJ_FILES = gen_ndr/ndr_eventlog_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_EVENTLOG EJSRPC RPC_EJS_MISC
# [MODULE::RPC_EJS_WINREG]
# INIT_FUNCTION = ejs_init_winreg
# OBJ_FILES = gen_ndr/ndr_winreg_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_WINREG EJSRPC RPC_EJS_INITSHUTDOWN \
# RPC_EJS_MISC RPC_EJS_SECURITY
# [MODULE::RPC_EJS_INITSHUTDOWN]
# INIT_FUNCTION = ejs_init_initshutdown
# OBJ_FILES = gen_ndr/ndr_initshutdown_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN EJSRPC
# [MODULE::RPC_EJS_NETLOGON]
# INIT_FUNCTION = ejs_init_netlogon
# OBJ_FILES = gen_ndr/ndr_netlogon_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_NETLOGON EJSRPC RPC_EJS_SAMR RPC_EJS_SECURITY RPC_EJS_MISC
# [MODULE::RPC_EJS_SVCCTL]
# INIT_FUNCTION = ejs_init_svcctl
# OBJ_FILES = gen_ndr/ndr_svcctl_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_SVCCTL EJSRPC RPC_EJS_MISC
# [MODULE::RPC_EJS_IRPC]
# INIT_FUNCTION = ejs_init_irpc
# OBJ_FILES = gen_ndr/ndr_irpc_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_IRPC EJSRPC
+718
View File
@@ -0,0 +1,718 @@
################################################
# Start SUBSYSTEM LIBNDR
[LIBRARY::LIBNDR]
VERSION = 0.0.1
SO_VERSION = 0
DESCRIPTION = Network Data Representation Core Library
PUBLIC_HEADERS = ndr/libndr.h
PUBLIC_PROTO_HEADER = ndr/libndr_proto.h
OBJ_FILES = \
ndr/ndr.o \
ndr/ndr_basic.o \
ndr/ndr_string.o \
ndr/uuid.o
PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC LIBSAMBA-UTIL CHARSET EXT_NSL \
LIBSAMBA-CONFIG
# End SUBSYSTEM LIBNDR
################################################
################################################
# Start SUBSYSTEM NDR_COMPRESSION
[LIBRARY::NDR_COMPRESSION]
VERSION = 0.0.1
SO_VERSION = 0
DESCRIPTION = NDR support for compressed subcontexts
PRIVATE_PROTO_HEADER = ndr/ndr_compression.h
OBJ_FILES = \
ndr/ndr_compression.o
PUBLIC_DEPENDENCIES = LIBCOMPRESSION LIBSAMBA-ERRORS LIBNDR
# End SUBSYSTEM NDR_COMPRESSION
################################################
[LIBRARY::NDR_SECURITY]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_security.o ndr/ndr_sec_helper.o
PUBLIC_HEADERS = gen_ndr/security.h
PUBLIC_DEPENDENCIES = NDR_MISC LIBSECURITY
[LIBRARY::NDR_AUDIOSRV]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_audiosrv.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_DNSSERVER]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dnsserver.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_WINSTATION]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winstation.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_ECHO]
OBJ_FILES = gen_ndr/ndr_echo.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_IRPC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_irpc.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY NDR_NBT
[LIBRARY::NDR_DSBACKUP]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dsbackup.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_EFS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_efs.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
[SUBSYSTEM::NDR_MISC]
OBJ_FILES = gen_ndr/ndr_misc.o ndr/ndr_misc.o
PUBLIC_HEADERS = gen_ndr/misc.h gen_ndr/ndr_misc.h
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_ROT]
OBJ_FILES = gen_ndr/ndr_rot.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC
[LIBRARY::NDR_LSA]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_lsa.o
PUBLIC_HEADERS = gen_ndr/lsa.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
[LIBRARY::NDR_DFS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dfs.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
[LIBRARY::NDR_FRSRPC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_frsrpc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_FRSAPI]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_frsapi.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_DRSUAPI]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_drsuapi.o ndr/ndr_drsuapi.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_COMPRESSION NDR_SECURITY NDR_SAMR
[LIBRARY::NDR_DRSBLOBS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_drsblobs.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_DRSUAPI
[SUBSYSTEM::NDR_SASL_HELPERS]
OBJ_FILES = gen_ndr/ndr_sasl_helpers.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_POLICYAGENT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_policyagent.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_UNIXINFO]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_unixinfo.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
[LIBRARY::NDR_SAMR]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_samr.o
PUBLIC_HEADERS = gen_ndr/samr.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_LSA NDR_SECURITY
[LIBRARY::NDR_NFS4ACL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_nfs4acl.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_SECURITY
[LIBRARY::NDR_SPOOLSS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_spoolss.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SPOOLSS_BUF NDR_SECURITY
[SUBSYSTEM::NDR_SPOOLSS_BUF]
PRIVATE_PROTO_HEADER = ndr/ndr_spoolss_buf.h
OBJ_FILES = ndr/ndr_spoolss_buf.o
[LIBRARY::NDR_WKSSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wkssvc.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SRVSVC NDR_MISC NDR_SECURITY
[LIBRARY::NDR_SRVSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_srvsvc.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SVCCTL NDR_SECURITY
[LIBRARY::NDR_SVCCTL]
VERSION = 0.0.1
PUBLIC_HEADERS = gen_ndr/svcctl.h
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_svcctl.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
[LIBRARY::NDR_ATSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_atsvc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_EVENTLOG]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_eventlog.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_LSA
[SUBSYSTEM::NDR_EPMAPPER]
OBJ_FILES = gen_ndr/ndr_epmapper.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
[LIBRARY::NDR_DBGIDL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dbgidl.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_DSSETUP]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dssetup.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
[LIBRARY::NDR_MSGSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_msgsvc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_WINS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wins.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_WINREG]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winreg.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_INITSHUTDOWN NDR_SECURITY NDR_MISC
[LIBRARY::NDR_INITSHUTDOWN]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_initshutdown.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_MGMT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_mgmt.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_DCERPC
[LIBRARY::NDR_PROTECTED_STORAGE]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_protected_storage.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_DCOM]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dcom.o ndr/ndr_dcom.o gen_ndr/dcom_p.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC
[SUBSYSTEM::NDR_ORPC]
OBJ_FILES = gen_ndr/ndr_orpc.o ndr/ndr_orpc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_OXIDRESOLVER]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_oxidresolver.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC NDR_MISC
[LIBRARY::NDR_REMACT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_remact.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC NDR_MISC
[LIBRARY::NDR_WZCSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wzcsvc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_BROWSER]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_browser.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_W32TIME]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_w32time.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_SCERPC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_scerpc.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_NTSVCS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_ntsvcs.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_NETLOGON]
OBJ_FILES = gen_ndr/ndr_netlogon.o
PUBLIC_HEADERS = gen_ndr/netlogon.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_SAMR NDR_LSA NDR_SECURITY
[LIBRARY::NDR_TRKWKS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_trkwks.o
PUBLIC_DEPENDENCIES = LIBNDR
[LIBRARY::NDR_KEYSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_keysvc.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_KRB5PAC]
OBJ_FILES = gen_ndr/ndr_krb5pac.o ndr/ndr_krb5pac.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON NDR_SECURITY
[LIBRARY::NDR_XATTR]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_xattr.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY
[SUBSYSTEM::NDR_OPENDB]
OBJ_FILES = gen_ndr/ndr_opendb.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_NOTIFY]
OBJ_FILES = gen_ndr/ndr_notify.o
PUBLIC_DEPENDENCIES = LIBNDR
[SUBSYSTEM::NDR_SCHANNEL]
OBJ_FILES = gen_ndr/ndr_schannel.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT
[SUBSYSTEM::NDR_NBT]
OBJ_FILES = gen_ndr/ndr_nbt.o
PUBLIC_HEADERS = gen_ndr/nbt.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_NBT_BUF NDR_SVCCTL NDR_SECURITY
[LIBRARY::NDR_WINSREPL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winsrepl.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT
[LIBRARY::NDR_WINBIND]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winbind.o
PUBLIC_HEADERS = gen_ndr/winbind.h
PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON
include ../heimdal_build/perl_path_wrapper.sh ../librpc/idl-deps.pl librpc/idl/*.idl|
librpc/gen_ndr/tables.c: $(IDL_NDR_PARSE_H_FILES)
@echo Generating librpc/gen_ndr/tables.c
@$(PERL) $(srcdir)/librpc/tables.pl --output=librpc/gen_ndr/tables.c $(IDL_NDR_PARSE_H_FILES) > librpc/gen_ndr/tables.x
mv librpc/gen_ndr/tables.x librpc/gen_ndr/tables.c
[LIBRARY::NDR_TABLE]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = rpc/table.o gen_ndr/tables.o
PRIVATE_PROTO_HEADER = rpc/dcerpc_table.h
PUBLIC_DEPENDENCIES = \
NDR_AUDIOSRV NDR_ECHO NDR_DCERPC \
NDR_DSBACKUP NDR_EFS NDR_MISC NDR_LSA NDR_DFS NDR_DRSUAPI \
NDR_POLICYAGENT NDR_UNIXINFO NDR_SAMR NDR_SPOOLSS NDR_WKSSVC NDR_SRVSVC NDR_ATSVC \
NDR_EVENTLOG NDR_EPMAPPER NDR_DBGIDL NDR_DSSETUP NDR_MSGSVC NDR_WINS \
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 NDR_SECURITY \
NDR_INITSHUTDOWN NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_DCOM NDR_OPENDB \
NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND NDR_FRSRPC NDR_FRSAPI NDR_NFS4ACL
[LIBRARY::RPC_NDR_ROT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_rot_c.o
PUBLIC_DEPENDENCIES = NDR_ROT dcerpc
[LIBRARY::RPC_NDR_AUDIOSRV]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_audiosrv_c.o
PUBLIC_DEPENDENCIES = NDR_AUDIOSRV dcerpc
[LIBRARY::RPC_NDR_ECHO]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_echo_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_ECHO
[LIBRARY::RPC_NDR_DSBACKUP]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dsbackup_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DSBACKUP
[LIBRARY::RPC_NDR_EFS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_efs_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_EFS
[LIBRARY::RPC_NDR_LSA]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_lsa_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_LSA
[LIBRARY::RPC_NDR_DFS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dfs_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DFS
[LIBRARY::RPC_NDR_DRSUAPI]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_drsuapi_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DRSUAPI
[LIBRARY::RPC_NDR_POLICYAGENT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_policyagent_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_POLICYAGENT
[LIBRARY::RPC_NDR_UNIXINFO]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_unixinfo_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_UNIXINFO
[LIBRARY::RPC_NDR_SAMR]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_samr_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR
[LIBRARY::RPC_NDR_SPOOLSS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_spoolss_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SPOOLSS
[LIBRARY::RPC_NDR_WKSSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wkssvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_WKSSVC
[LIBRARY::RPC_NDR_SRVSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_srvsvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SRVSVC
[LIBRARY::RPC_NDR_SVCCTL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_svcctl_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SVCCTL
[LIBRARY::RPC_NDR_ATSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_atsvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC
[LIBRARY::RPC_NDR_EVENTLOG]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_eventlog_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_EVENTLOG
[SUBSYSTEM::RPC_NDR_EPMAPPER]
OBJ_FILES = gen_ndr/ndr_epmapper_c.o
PUBLIC_DEPENDENCIES = NDR_EPMAPPER
[LIBRARY::RPC_NDR_DBGIDL]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dbgidl_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DBGIDL
[LIBRARY::RPC_NDR_DSSETUP]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_dssetup_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DSSETUP
[LIBRARY::RPC_NDR_MSGSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_msgsvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_MSGSVC
[LIBRARY::RPC_NDR_WINS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wins_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_WINS
[LIBRARY::RPC_NDR_WINREG]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_winreg_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_WINREG
[LIBRARY::RPC_NDR_INITSHUTDOWN]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_initshutdown_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN
[LIBRARY::RPC_NDR_MGMT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_mgmt_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_MGMT
[LIBRARY::RPC_NDR_PROTECTED_STORAGE]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_protected_storage_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_PROTECTED_STORAGE
[SUBSYSTEM::DCOM_PROXY_DCOM]
OBJ_FILES = gen_ndr/ndr_dcom_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_DCOM
[LIBRARY::RPC_NDR_OXIDRESOLVER]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_oxidresolver_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_OXIDRESOLVER
[LIBRARY::RPC_NDR_REMACT]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_remact_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_REMACT
[LIBRARY::RPC_NDR_WZCSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_wzcsvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_WZCSVC
[LIBRARY::RPC_NDR_W32TIME]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_w32time_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_W32TIME
[LIBRARY::RPC_NDR_SCERPC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_scerpc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_SCERPC
[LIBRARY::RPC_NDR_NTSVCS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_ntsvcs_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_NTSVCS
[SUBSYSTEM::RPC_NDR_NETLOGON]
OBJ_FILES = gen_ndr/ndr_netlogon_c.o
PUBLIC_DEPENDENCIES = NDR_NETLOGON
[LIBRARY::RPC_NDR_TRKWKS]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_trkwks_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_TRKWKS
[LIBRARY::RPC_NDR_KEYSVC]
VERSION = 0.0.1
SO_VERSION = 0
OBJ_FILES = gen_ndr/ndr_keysvc_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_KEYSVC
[SUBSYSTEM::NDR_DCERPC]
OBJ_FILES = gen_ndr/ndr_dcerpc.o
PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC
PUBLIC_HEADERS = gen_ndr/dcerpc.h gen_ndr/ndr_dcerpc.h
################################################
# Start SUBSYSTEM dcerpc
[LIBRARY::dcerpc]
VERSION = 0.0.1
SO_VERSION = 0
DESCRIPTION = DCE/RPC client library
PUBLIC_HEADERS = rpc/dcerpc.h
PUBLIC_PROTO_HEADER = rpc/dcerpc_proto.h
OBJ_FILES = \
rpc/dcerpc.o \
rpc/dcerpc_auth.o \
rpc/dcerpc_schannel.o \
rpc/dcerpc_util.o \
rpc/dcerpc_error.o \
rpc/dcerpc_smb.o \
rpc/dcerpc_smb2.o \
rpc/dcerpc_sock.o \
rpc/dcerpc_connect.o
PRIVATE_DEPENDENCIES = \
samba-socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 \
LIBNDR NDR_DCERPC \
RPC_NDR_EPMAPPER \
NDR_SCHANNEL RPC_NDR_NETLOGON \
gensec LIBCLI_AUTH LIBCLI_RAW CREDENTIALS
# End SUBSYSTEM dcerpc
################################################
# [MODULE::RPC_EJS_ECHO]
# INIT_FUNCTION = ejs_init_rpcecho
# OBJ_FILES = gen_ndr/ndr_echo_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_ECHO EJSRPC
# [MODULE::RPC_EJS_MISC]
# INIT_FUNCTION = ejs_init_misc
# OBJ_FILES = gen_ndr/ndr_misc_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_MISC EJSRPC
# [MODULE::RPC_EJS_SAMR]
# INIT_FUNCTION = ejs_init_samr
# OBJ_FILES = gen_ndr/ndr_samr_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR EJSRPC RPC_EJS_LSA RPC_EJS_SECURITY RPC_EJS_MISC
# [MODULE::RPC_EJS_SECURITY]
# INIT_FUNCTION = ejs_init_security
# OBJ_FILES = gen_ndr/ndr_security_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_SECURITY EJSRPC
# [MODULE::RPC_EJS_LSA]
# INIT_FUNCTION = ejs_init_lsarpc
# OBJ_FILES = gen_ndr/ndr_lsa_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_LSA EJSRPC RPC_EJS_SECURITY RPC_EJS_MISC
# [MODULE::RPC_EJS_DFS]
# INIT_FUNCTION = ejs_init_netdfs
# OBJ_FILES = gen_ndr/ndr_dfs_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_DFS EJSRPC
# [MODULE::RPC_EJS_DRSUAPI]
# INIT_FUNCTION = ejs_init_drsuapi
# OBJ_FILES = gen_ndr/ndr_drsuapi_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_DRSUAPI EJSRPC RPC_EJS_MISC RPC_EJS_SAMR
# [MODULE::RPC_EJS_SPOOLSS]
# INIT_FUNCTION = ejs_init_spoolss
# OBJ_FILES = gen_ndr/ndr_spoolss_ejs.o
# SUBSYSTEM = smbcalls
# ENABLE = NO
# PUBLIC_DEPENDENCIES = dcerpc NDR_SPOOLSS EJSRPC
# [MODULE::RPC_EJS_WKSSVC]
# INIT_FUNCTION = ejs_init_wkssvc
# OBJ_FILES = gen_ndr/ndr_wkssvc_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_WKSSVC EJSRPC RPC_EJS_SRVSVC RPC_EJS_MISC
# [MODULE::RPC_EJS_SRVSVC]
# INIT_FUNCTION = ejs_init_srvsvc
# OBJ_FILES = gen_ndr/ndr_srvsvc_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_SRVSVC EJSRPC RPC_EJS_MISC RPC_EJS_SVCCTL RPC_EJS_SECURITY
# [MODULE::RPC_EJS_EVENTLOG]
# INIT_FUNCTION = ejs_init_eventlog
# OBJ_FILES = gen_ndr/ndr_eventlog_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_EVENTLOG EJSRPC RPC_EJS_MISC
# [MODULE::RPC_EJS_WINREG]
# INIT_FUNCTION = ejs_init_winreg
# OBJ_FILES = gen_ndr/ndr_winreg_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_WINREG EJSRPC RPC_EJS_INITSHUTDOWN \
# RPC_EJS_MISC RPC_EJS_SECURITY
# [MODULE::RPC_EJS_INITSHUTDOWN]
# INIT_FUNCTION = ejs_init_initshutdown
# OBJ_FILES = gen_ndr/ndr_initshutdown_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN EJSRPC
# [MODULE::RPC_EJS_NETLOGON]
# INIT_FUNCTION = ejs_init_netlogon
# OBJ_FILES = gen_ndr/ndr_netlogon_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_NETLOGON EJSRPC RPC_EJS_SAMR RPC_EJS_SECURITY RPC_EJS_MISC
# [MODULE::RPC_EJS_SVCCTL]
# INIT_FUNCTION = ejs_init_svcctl
# OBJ_FILES = gen_ndr/ndr_svcctl_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_SVCCTL EJSRPC RPC_EJS_MISC
# [MODULE::RPC_EJS_IRPC]
# INIT_FUNCTION = ejs_init_irpc
# OBJ_FILES = gen_ndr/ndr_irpc_ejs.o
# SUBSYSTEM = smbcalls
# PUBLIC_DEPENDENCIES = dcerpc NDR_IRPC EJSRPC
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/perl
use strict;
my %vars = ();
foreach(@ARGV) {
push (@{$vars{IDL_FILES}}, $_);
my $b = $_; $b =~ s/.*\/(.*?).idl$/$1/;
push (@{$vars{IDL_HEADER_FILES}}, "librpc/gen_ndr/$b.h");
push (@{$vars{IDL_NDR_PARSE_H_FILES}}, "librpc/gen_ndr/ndr_$b.h");
push (@{$vars{IDL_NDR_PARSE_C_FILES}}, "librpc/gen_ndr/ndr_$b.c");
push (@{$vars{IDL_NDR_CLIENT_C_FILES}}, "librpc/gen_ndr/ndr_$b\_c.c");
push (@{$vars{IDL_NDR_CLIENT_H_FILES}}, "librpc/gen_ndr/ndr_$b\_c.h");
push (@{$vars{IDL_SWIG_FILES}}, "librpc/gen_ndr/$b.i");
push (@{$vars{IDL_NDR_SERVER_C_FILES}}, "librpc/gen_ndr/ndr_$b\_s.c");
push (@{$vars{IDL_NDR_EJS_C_FILES}}, "librpc/gen_ndr/ndr_$b\_ejs.c");
push (@{$vars{IDL_NDR_EJS_H_FILES}}, "librpc/gen_ndr/ndr_$b\_ejs.h");
}
foreach (keys %vars) {
print "$_ = " . join (' ', @{$vars{$_}}) . "\n";
}
+9
View File
@@ -0,0 +1,9 @@
The IDL files in this directory are made available by the Samba Team
under the following license:
Permission to use, copy, modify, and distribute these interface
definitions for any purpose is hereby granted without fee.
This work 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.
+119
View File
@@ -0,0 +1,119 @@
/*
atsvc interface definition
*/
[ uuid("1ff70682-0a51-30e8-076d-740be8cee98b"),
version(1.0),
pointer_default(unique),
helpstring("Microsoft AT-Scheduler Service"),
endpoint("ncacn_np:[\\pipe\\atsvc]", "ncalrpc:")
] interface atsvc
{
typedef [bitmap32bit] bitmap {
First = 0x00000001,
Second = 0x00000002,
Third = 0x00000004,
Fourth = 0x00000008,
Fifth = 0x00000010,
Sixth = 0x00000020,
Seventh = 0x00000040,
Eight = 0x00000080,
Ninth = 0x00000100,
Tenth = 0x00000200,
Eleventh = 0x00000400,
Twelfth = 0x00000800,
Thitteenth = 0x00001000,
Fourteenth = 0x00002000,
Fifteenth = 0x00004000,
Sixteenth = 0x00008000,
Seventeenth = 0x00010000,
Eighteenth = 0x00020000,
Ninteenth = 0x00040000,
Twentyth = 0x00080000,
Twentyfirst = 0x00100000,
Twentysecond = 0x00200000,
Twentythird = 0x00400000,
Twentyfourth = 0x00800000,
Twentyfifth = 0x01000000,
Twentysixth = 0x02000000,
Twentyseventh = 0x04000000,
Twentyeighth = 0x08000000,
Twentyninth = 0x10000000,
Thirtieth = 0x20000000,
Thirtyfirst = 0x40000000
} atsvc_DaysOfMonth;
typedef [bitmap8bit] bitmap {
JOB_RUN_PERIODICALLY = 0x01,
JOB_EXEC_ERROR = 0x02,
JOB_RUNS_TODAY = 0x04,
JOB_ADD_CURRENT_DATE = 0x08,
JOB_NONINTERACTIVE = 0x10
} atsvc_Flags;
typedef [bitmap8bit] bitmap {
DAYSOFWEEK_MONDAY = 0x01,
DAYSOFWEEK_TUESDAY = 0x02,
DAYSOFWEEK_WEDNESDAY = 0x04,
DAYSOFWEEK_THURSDAY = 0x08,
DAYSOFWEEK_FRIDAY = 0x10,
DAYSOFWEEK_SATURDAY = 0x20,
DAYSOFWEEK_SUNDAY = 0x40
} atsvc_DaysOfWeek;
typedef struct {
uint32 job_time;
atsvc_DaysOfMonth days_of_month;
atsvc_DaysOfWeek days_of_week;
atsvc_Flags flags;
[string,charset(UTF16)] uint16 *command;
} atsvc_JobInfo;
/******************/
/* Function: 0x00 */
NTSTATUS atsvc_JobAdd(
[in,unique,string,charset(UTF16)] uint16 *servername,
[in] atsvc_JobInfo *job_info,
[out,ref] uint32 *job_id
);
/******************/
/* Function: 0x01 */
NTSTATUS atsvc_JobDel(
[in,unique,string,charset(UTF16)] uint16 *servername,
[in] uint32 min_job_id,
[in] uint32 max_job_id
);
typedef struct {
uint32 job_id;
uint32 job_time;
atsvc_DaysOfMonth days_of_month;
atsvc_DaysOfWeek days_of_week;
atsvc_Flags flags;
[string,charset(UTF16)] uint16 *command;
} atsvc_JobEnumInfo;
typedef struct {
uint32 entries_read;
[size_is(entries_read)] atsvc_JobEnumInfo *first_entry;
} atsvc_enum_ctr;
/******************/
/* Function: 0x02 */
NTSTATUS atsvc_JobEnum(
[in,unique,string,charset(UTF16)] uint16 *servername,
[in,out] atsvc_enum_ctr *ctr,
[in] uint32 preferred_max_len,
[out,ref] uint32 *total_entries,
[in,out,unique] uint32 *resume_handle
);
/******************/
/* Function: 0x03 */
[public] NTSTATUS atsvc_JobGetInfo(
[in,unique,string,charset(UTF16)] uint16 *servername,
[in] uint32 job_id,
[out] atsvc_JobInfo **job_info
);
}
+23
View File
@@ -0,0 +1,23 @@
[
uuid("0a74ef1c-41a4-4e06-83ae-dc74fb1cdd53"),
version(1.0),
pointer_default(unique),
helpstring("Audio Server")
] interface audiosrv
{
void audiosrv_CreatezoneFactoriesList();
void audiosrv_CreateGfxFactoriesList();
void audiosrv_CreateGfxList();
void audiosrv_RemoveGfx();
void audiosrv_AddGfx();
void audiosrv_ModifyGfx();
void audiosrv_OpenGfx();
void audiosrv_Logon();
void audiosrv_Logoff();
void audiosrv_RegisterSessionNotificationEvent();
void audiosrv_UnregisterSessionNotificationEvent();
void audiosrv_SessionConnectState();
void audiosrv_DriverOpenDrvRegKey();
void audiosrv_AdvisePreferredDeviceChange();
void audiosrv_GetPnpInfo();
}
+58
View File
@@ -0,0 +1,58 @@
[
uuid("6bffd098-a112-3610-9833-012892020162"),
version(0.0),
helpstring("Browsing"),
pointer_default(unique),
endpoint("ncacn_np:[\\pipe\\browser]", "ncacn_ip_tcp:", "ncalrpc:")
]
interface browser
{
/******************/
/* Function 0x00 */
NTSTATUS BrowserrServerEnum();
/******************/
/* Function 0x01 */
NTSTATUS BrowserrDebugCall();
/******************/
/* Function 0x02 */
NTSTATUS BrowserrQueryOtherDomains();
/******************/
/* Function 0x03 */
NTSTATUS BrowserrResetNetlogonState();
/******************/
/* Function 0x04 */
NTSTATUS BrowserrDebugTrace();
/******************/
/* Function 0x05 */
NTSTATUS BrowserrQueryStatistics();
/******************/
/* Function 0x06 */
NTSTATUS BrowserResetStatistics();
/******************/
/* Function 0x07 */
NTSTATUS NetrBrowserStatisticsClear();
/******************/
/* Function 0x08 */
NTSTATUS NetrBrowserStatisticsGet();
/******************/
/* Function 0x09 */
NTSTATUS BrowserrSetNetlogonState();
/******************/
/* Function 0x0a */
NTSTATUS BrowserrQueryEmulatedDomains();
/******************/
/* Function 0x0b */
NTSTATUS BrowserrServerEnumEx();
}
+9
View File
@@ -0,0 +1,9 @@
[
uuid("1d55b526-c137-46c5-ab79-638f2a68e869"),
version(1.0),
pointer_default(unique),
helpstring("Remote IDL debugger")
] interface dbgidl
{
void dummy_dbgidl();
}
+302
View File
@@ -0,0 +1,302 @@
#include "idl_types.h"
/*
the base dcerpc packet definitions - not traditionally coded as IDL,
but given that pidl can handle it nicely it simplifies things a lot
to do it this way
see http://www.opengroup.org/onlinepubs/9629399/chap12.htm for packet
layouts
*/
import "misc.idl";
[
pointer_default(unique)
]
interface dcerpc
{
typedef [public] struct {
GUID uuid;
uint32 if_version;
} dcerpc_syntax_id;
typedef struct {
uint16 context_id;
uint8 num_transfer_syntaxes;
dcerpc_syntax_id abstract_syntax;
dcerpc_syntax_id transfer_syntaxes[num_transfer_syntaxes];
} dcerpc_ctx_list;
typedef struct {
uint16 max_xmit_frag;
uint16 max_recv_frag;
uint32 assoc_group_id;
uint8 num_contexts;
dcerpc_ctx_list ctx_list[num_contexts];
[flag(NDR_ALIGN4)] DATA_BLOB _pad;
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
} dcerpc_bind;
const uint8 DCERPC_REQUEST_LENGTH = 24;
const uint8 DCERPC_MAX_SIGN_SIZE = 32;
typedef struct {
} dcerpc_empty;
typedef [nodiscriminant] union {
[default] dcerpc_empty empty;
[case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
} dcerpc_object;
typedef struct {
uint32 alloc_hint;
uint16 context_id;
uint16 opnum;
[switch_is(ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT)] dcerpc_object object;
[flag(NDR_ALIGN8)] DATA_BLOB _pad;
[flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
} dcerpc_request;
const int DCERPC_BIND_REASON_ASYNTAX = 1;
const int DCERPC_BIND_PROVIDER_REJECT = 2;
const int DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED = 4;
const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE = 8;
typedef struct {
uint16 result;
uint16 reason;
dcerpc_syntax_id syntax;
} dcerpc_ack_ctx;
typedef struct {
uint16 max_xmit_frag;
uint16 max_recv_frag;
uint32 assoc_group_id;
ascstr3 secondary_address;
[flag(NDR_ALIGN4)] DATA_BLOB _pad1;
uint8 num_results;
dcerpc_ack_ctx ctx_list[num_results];
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
} dcerpc_bind_ack;
typedef struct {
uint32 num_versions;
uint32 versions[num_versions];
} dcerpc_bind_nak_versions;
typedef [nodiscriminant] union {
[case(DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED)] dcerpc_bind_nak_versions v;
[default] ;
} dcerpc_bind_nak_versions_ctr;
typedef struct {
uint16 reject_reason;
[switch_is(reject_reason)] dcerpc_bind_nak_versions_ctr versions;
} dcerpc_bind_nak;
const uint8 DCERPC_RESPONSE_LENGTH = 24;
typedef struct {
uint32 alloc_hint;
uint16 context_id;
uint8 cancel_count;
[flag(NDR_ALIGN8)] DATA_BLOB _pad;
[flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
} dcerpc_response;
const int DCERPC_FAULT_OP_RNG_ERROR = 0x1c010002;
const int DCERPC_FAULT_UNK_IF = 0x1c010003;
const int DCERPC_FAULT_NDR = 0x000006f7;
const int DCERPC_FAULT_INVALID_TAG = 0x1c000006;
const int DCERPC_FAULT_CONTEXT_MISMATCH = 0x1c00001a;
const int DCERPC_FAULT_OTHER = 0x00000001;
const int DCERPC_FAULT_ACCESS_DENIED = 0x00000005;
const int DCERPC_FAULT_CANT_PERFORM = 0x000006d8;
/* we return this fault when we haven't yet run the test
to see what fault w2k3 returns in this case */
const int DCERPC_FAULT_TODO = 0x00000042;
typedef struct {
uint32 alloc_hint;
uint16 context_id;
uint8 cancel_count;
uint32 status;
} dcerpc_fault;
/* the auth types we know about */
const uint8 DCERPC_AUTH_TYPE_NONE = 0;
/* this seems to be not krb5! */
const uint8 DCERPC_AUTH_TYPE_KRB5_1 = 1;
const uint8 DCERPC_AUTH_TYPE_SPNEGO = 9;
const uint8 DCERPC_AUTH_TYPE_NTLMSSP = 10;
/* I'm not 100% sure but type 16(0x10)
* seems to be raw krb5 --metze
*/
const uint8 DCERPC_AUTH_TYPE_KRB5 = 16;
const uint8 DCERPC_AUTH_TYPE_SCHANNEL = 68;
const uint8 DCERPC_AUTH_TYPE_MSMQ = 100;
const uint8 DCERPC_AUTH_LEVEL_DEFAULT = DCERPC_AUTH_LEVEL_CONNECT;
const uint8 DCERPC_AUTH_LEVEL_NONE = 1;
const uint8 DCERPC_AUTH_LEVEL_CONNECT = 2;
const uint8 DCERPC_AUTH_LEVEL_CALL = 3;
const uint8 DCERPC_AUTH_LEVEL_PACKET = 4;
const uint8 DCERPC_AUTH_LEVEL_INTEGRITY = 5;
const uint8 DCERPC_AUTH_LEVEL_PRIVACY = 6;
typedef [public] struct {
uint8 auth_type;
uint8 auth_level;
uint8 auth_pad_length;
uint8 auth_reserved;
uint32 auth_context_id;
[flag(NDR_REMAINING)] DATA_BLOB credentials;
} dcerpc_auth;
typedef [public] struct {
uint32 _pad;
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
} dcerpc_auth3;
typedef [public] struct {
uint32 _pad;
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
} dcerpc_orphaned;
typedef [public] struct {
uint32 _pad;
[flag(NDR_REMAINING)] DATA_BLOB auth_info;
} dcerpc_co_cancel;
typedef [public] struct {
uint32 version;
uint32 id;
} dcerpc_cl_cancel;
typedef [public] struct {
uint32 version;
uint32 id;
boolean32 server_is_accepting;
} dcerpc_cancel_ack;
typedef [public] struct {
uint32 version;
uint8 _pad1;
uint16 window_size;
uint32 max_tdsu;
uint32 max_frag_size;
uint16 serial_no;
uint16 selack_size;
uint32 selack[selack_size];
} dcerpc_fack;
typedef [public] struct {
} dcerpc_ack;
typedef [public] struct {
} dcerpc_ping;
typedef [public] struct {
} dcerpc_shutdown;
typedef [public] struct {
} dcerpc_working;
typedef [enum8bit] enum {
DCERPC_PKT_REQUEST = 0,
DCERPC_PKT_PING = 1,
DCERPC_PKT_RESPONSE = 2,
DCERPC_PKT_FAULT = 3,
DCERPC_PKT_WORKING = 4,
DCERPC_PKT_NOCALL = 5,
DCERPC_PKT_REJECT = 6,
DCERPC_PKT_ACK = 7,
DCERPC_PKT_CL_CANCEL = 8,
DCERPC_PKT_FACK = 9,
DCERPC_PKT_CANCEL_ACK = 10,
DCERPC_PKT_BIND = 11,
DCERPC_PKT_BIND_ACK = 12,
DCERPC_PKT_BIND_NAK = 13,
DCERPC_PKT_ALTER = 14,
DCERPC_PKT_ALTER_RESP = 15,
DCERPC_PKT_AUTH3 = 16,
DCERPC_PKT_SHUTDOWN = 17,
DCERPC_PKT_CO_CANCEL = 18,
DCERPC_PKT_ORPHANED = 19
} dcerpc_pkt_type;
typedef [nodiscriminant] union {
[case(DCERPC_PKT_REQUEST)] dcerpc_request request;
[case(DCERPC_PKT_PING)] dcerpc_ping ping;
[case(DCERPC_PKT_RESPONSE)] dcerpc_response response;
[case(DCERPC_PKT_FAULT)] dcerpc_fault fault;
[case(DCERPC_PKT_WORKING)] dcerpc_working working;
[case(DCERPC_PKT_NOCALL)] dcerpc_fack nocall;
[case(DCERPC_PKT_REJECT)] dcerpc_fault reject;
[case(DCERPC_PKT_ACK)] dcerpc_ack ack;
[case(DCERPC_PKT_CL_CANCEL)] dcerpc_cl_cancel cl_cancel;
[case(DCERPC_PKT_FACK)] dcerpc_fack fack;
[case(DCERPC_PKT_CANCEL_ACK)] dcerpc_cancel_ack cancel_ack;
[case(DCERPC_PKT_BIND)] dcerpc_bind bind;
[case(DCERPC_PKT_BIND_ACK)] dcerpc_bind_ack bind_ack;
[case(DCERPC_PKT_BIND_NAK)] dcerpc_bind_nak bind_nak;
[case(DCERPC_PKT_ALTER)] dcerpc_bind alter;
[case(DCERPC_PKT_ALTER_RESP)] dcerpc_bind_ack alter_resp;
[case(DCERPC_PKT_SHUTDOWN)] dcerpc_shutdown shutdown;
[case(DCERPC_PKT_CO_CANCEL)] dcerpc_co_cancel co_cancel;
[case(DCERPC_PKT_ORPHANED)] dcerpc_orphaned orphaned;
[case(DCERPC_PKT_AUTH3)] dcerpc_auth3 auth3;
} dcerpc_payload;
/* pfc_flags values */
const uint8 DCERPC_PFC_FLAG_FIRST = 0x01;
const uint8 DCERPC_PFC_FLAG_LAST = 0x02;
const uint8 DCERPC_PFC_FLAG_NOCALL = 0x20;
const uint8 DCERPC_PFC_FLAG_ORPC = 0x80;
/* these offsets are needed by the signing code */
const uint8 DCERPC_DREP_OFFSET = 4;
const uint8 DCERPC_FRAG_LEN_OFFSET = 8;
const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
/* little-endian flag */
const uint8 DCERPC_DREP_LE = 0x10;
typedef [public] struct {
uint8 rpc_vers; /* RPC version */
uint8 rpc_vers_minor; /* Minor version */
dcerpc_pkt_type ptype; /* Packet type */
uint8 pfc_flags; /* Fragmentation flags */
uint8 drep[4]; /* NDR data representation */
uint16 frag_length; /* Total length of fragment */
uint16 auth_length; /* authenticator length */
uint32 call_id; /* Call identifier */
[switch_is(ptype)] dcerpc_payload u;
} ncacn_packet;
typedef [public] struct {
uint8 rpc_vers; /* RPC version (4) */
uint8 ptype;
uint8 pfc_flags;
uint8 ncadg_flags;
uint8 drep[3];
uint8 serial_high;
GUID object;
GUID iface;
GUID activity;
uint32 server_boot; /* Server boot time */
uint32 iface_version;
uint32 seq_num;
uint16 opnum;
uint16 ihint;
uint16 ahint;
uint16 len;
uint16 fragnum;
uint8 auth_proto;
uint8 serial_low;
[switch_is(ptype)] dcerpc_payload u;
} ncadg_packet;
}
+301
View File
@@ -0,0 +1,301 @@
/**
DCOM interfaces
http://www.ietf.org/internet-drafts/draft-brown-dcom-v1-spec-04.txt
*/
[
uuid("18f70770-8e64-11cf-9af1-0020af6e72f4"),
pointer_default(unique),
version(0.0)
] interface dcom_Unknown
{
void UseProtSeq();
void GetCustomProtseqInfo();
void UpdateResolverBindings();
}
[
object,
uuid("00000000-0000-0000-C000-000000000046"),
pointer_default(unique),
helpstring("Base interface for all COM interfaces")
]
interface IUnknown
{
/*****************/
/* Function 0x00 */
/* Returns the interface with the specified IID
if implemented by this object */
[local] WERROR QueryInterface([in,unique] GUID *iid,
[out,iid_is(riid)] IUnknown **data);
/*****************/
/* Function 0x01 */
[local] uint32 AddRef();
/*****************/
/* Function 0x02 */
[local] uint32 Release();
}
[
object,
uuid("00000001-0000-0000-C000-000000000046"),
pointer_default(unique)
] interface IClassFactory : IUnknown
{
[local] WERROR CreateInstance([in,unique] MInterfacePointer *pUnknown,
[in,unique] GUID *iid,
[out, iid_is(riid)] MInterfacePointer **ppv);
[call_as(CreateInstance)] WERROR RemoteCreateInstance();
/* Set lock to TRUE when you want to do a lock
and set it to FALSE when you want to unlock */
[local] WERROR LockServer([in] uint8 lock);
[call_as(LockServer)] WERROR RemoteLockServer();
}
/* The remote version of IUnknown. This interface exists on every */
/* OXID (whether an OXID represents either a thread or a process is */
/* implementation specific). It is used by clients to query for new */
/* interfaces, get additional references (for marshaling), and release */
/* outstanding references. */
/* This interface is passed along during OXID resolution. */
/* */
[
uuid("00000131-0000-0000-C000-000000000046"),
object,
pointer_default(unique),
helpstring("Remote version of IUnknown")
]
interface IRemUnknown : IUnknown
{
typedef [public] struct
{
WERROR hResult; /* result of call */
STDOBJREF std; /* data for returned interface */
}
REMQIRESULT;
[call_as(QueryInterface)] WERROR RemQueryInterface (
[in] GUID *ripid, /* interface to QI on */
[in] uint32 cRefs, /* count of AddRefs requested */
[in] uint16 cIids, /* count of IIDs that follow */
[in, size_is(cIids)] GUID iids[], /* IIDs to QI for */
[out,ref,size_is(,cIids)] REMQIRESULT **rqir
);
typedef struct
{
GUID ipid; /* ipid to AddRef/Release */
uint32 cPublicRefs;
uint32 cPrivateRefs;
} REMINTERFACEREF;
[call_as(AddRef)] WERROR RemAddRef (
[in] uint16 cInterfaceRefs,
[in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[],
[out, size_is(cInterfaceRefs)] WERROR **pResults
);
[call_as(Release)] WERROR RemRelease (
[in] uint16 cInterfaceRefs,
[in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
);
}
[
uuid("00000140-0000-0000-c000-000000000046"),
pointer_default(unique),
object
] interface IClassActivator : IUnknown
{
void GetClassObject([in] GUID clsid,
[in] uint32 context,
[in] uint32 locale,
[in] GUID iid,
[out, iid_is(iid)] MInterfacePointer *data);
}
[
uuid("00000136-0000-0000-c000-000000000046"),
pointer_default(unique),
object
] interface ISCMLocalActivator : IClassActivator
{
WERROR ISCMLocalActivator_CreateInstance( );
}
[
pointer_default(unique),
uuid("c6f3ee72-ce7e-11d1-b71e-00c04fc3111a")
] interface IMachineLocalActivator
{
WERROR IMachineLocalActivator_foo();
}
[
pointer_default(unique),
uuid("e60c73e6-88f9-11cf-9af1-0020af6e72f4")
] interface ILocalObjectExporter
{
WERROR ILocalObjectExporter_Foo();
}
/* Looks like this is the equivalent of .NET's
System.Activator class */
[
uuid("000001a0-0000-0000-c000-000000000046"),
pointer_default(unique),
object
]
interface ISystemActivator : IClassActivator
{
WERROR ISystemActivatorRemoteCreateInstance([in] hyper unknown1, /* OXID ? */
[in] MInterfacePointer iface1,
[in] hyper unknown2,
[out,ref] uint32 *unknown3,
[out,ref] MInterfacePointer *iface2);
}
/* Derived from IRemUnknown, this interface supports Remote Query interface */
/* for objects that supply additional data beyond the STDOBJREF in their */
/* marshaled interface packets. */
[
object,
pointer_default(unique),
uuid("00000143-0000-0000-C000-000000000046")
]
interface IRemUnknown2 : IRemUnknown
{
[call_as(QueryInterface2)] WERROR RemQueryInterface2 (
[in, unique] GUID *ripid,
[in] uint16 cIids,
[in, size_is(cIids)] GUID **iids,
[out, size_is(cIids)] WERROR **phr,
[out, size_is(cIids)] MInterfacePointer **ppMIF
);
}
[
object,
pointer_default(unique),
uuid("00020400-0000-0000-C000-000000000046")
] interface IDispatch : IUnknown
{
/*****************/
/* Function 0x03 */
WERROR GetTypeInfoCount([out] uint16 *pctinfo);
typedef struct {
} REF_ITypeInfo;
/*****************/
/* Function 0x04 */
WERROR GetTypeInfo (
[in] uint16 iTInfo,
[in] uint32 lcid,
[out] REF_ITypeInfo **ppTInfo);
/*****************/
/* Function 0x05 */
WERROR GetIDsOfNames(
[in, unique] GUID *riid,
/*FIXME[in,size_is(cNames)] OLESTR *rgszNames[], */
[in] uint16 cNames,
[in] uint32 lcid,
[out,size_is(cNames)] uint32 **rgDispId);
typedef struct {
uint16 vartype;
uint16 unknown /* FIXME */;
} VARIANT;
typedef struct {
uint16 unknown /* FIXME */;
} DISPPARAMS;
/* Exception ? */
typedef struct {
uint16 unknown /* FIXME */;
} EXCEPINFO;
/*****************/
/* Function 0x06 */
WERROR Invoke(
[in] uint32 dispIdMember,
[in, unique] GUID *riid,
[in] uint32 lcid,
[in] uint16 wFlags,
[out,in, unique] DISPPARAMS *pDispParams,
[out] VARIANT **pVarResult,
[out] EXCEPINFO **pExcepInfo,
[out] uint16 **puArgErr);
}
[
object,
local,
uuid("00000003-0000-0000-C000-000000000046")
] interface IMarshal : IUnknown
{
WERROR MarshalInterface();
WERROR UnMarshalInterface();
}
[
uuid(DA23F6DB-6F45-466C-9EED-0B65286F2D78),
helpstring("ICoffeeMachine Interface"),
pointer_default(unique),
object
] interface ICoffeeMachine : IUnknown
{
WERROR MakeCoffee([in,string,charset(UTF16)] uint16 *flavor);
}
[
uuid("db7c21f8-fe33-4c11-aea5-ceb56f076fbb"),
helpstring("coffeemachine class")
] coclass coffeemachine
{
interface icoffeemachine;
}
[
object,
pointer_default(unique),
uuid("0000000C-0000-0000-C000-000000000046"),
helpstring("Stream")
]
interface IStream : IUnknown
{
WERROR Read(
[out, size_is(num_requested), length_is(*num_read)] uint8 pv[],
[in] uint32 num_requested,
[in, unique] uint32 *num_readx,
[out,ref] uint32 *num_read
);
WERROR Write(
[in,size_is(num_requested),unique] uint8 *data,
[in] uint32 num_requested,
[out,ref] uint32 *num_written);
}
[
uuid("5e9ddec7-5767-11cf-beab-00aa006c3606"),
progid("Samba.Simple"),
helpstring("simple class"),
internal
] coclass simple
{
interface IStream;
}
#include "dcom_wmi.inc"
+863
View File
@@ -0,0 +1,863 @@
#include "idl_types.h"
[
uuid("8BC3F05E-D86B-11d0-A075-00C04FB68820")
] coclass WbemLevel1Login
{
interface IWbemLevel1Login;
};
[local, object, uuid("dc12a681-737f-11cf-884d-00aa004b2e24")]
interface IWbemClassObject : IUnknown
{
WERROR Delete(
[in, string, charset(UTF16)] uint16 *wszName
);
};
[
uuid("9556dc99-828c-11cf-a37e-00aa003240c7"),
object,
pointer_default(unique)
] interface IWbemServices : IUnknown
{
typedef [v1_enum] enum
{
RPC_S_CALL_FAILED = 1726,
WBEM_NO_ERROR = 0,
WBEM_S_NO_ERROR = 0,
WBEM_S_SAME = 0,
WBEM_S_FALSE = 1,
WBEM_S_ALREADY_EXISTS = 0x40001,
WBEM_S_RESET_TO_DEFAULT = 0x40002,
WBEM_S_DIFFERENT = 0x40003,
WBEM_S_TIMEDOUT = 0x40004,
WBEM_S_NO_MORE_DATA = 0x40005,
WBEM_S_OPERATION_CANCELLED = 0x40006,
WBEM_S_PENDING = 0x40007,
WBEM_S_DUPLICATE_OBJECTS = 0x40008,
WBEM_S_ACCESS_DENIED = 0x40009,
WBEM_S_PARTIAL_RESULTS = 0x40010,
WBEM_S_NO_POSTHOOK = 0x40011,
WBEM_S_POSTHOOK_WITH_BOTH = 0x40012,
WBEM_S_POSTHOOK_WITH_NEW = 0x40013,
WBEM_S_POSTHOOK_WITH_STATUS = 0x40014,
WBEM_S_POSTHOOK_WITH_OLD = 0x40015,
WBEM_S_REDO_PREHOOK_WITH_ORIGINAL_OBJECT = 0x40016,
WBEM_S_SOURCE_NOT_AVAILABLE = 0x40017,
WBEM_E_FAILED = 0x80041001,
WBEM_E_NOT_FOUND = 0x80041002,
WBEM_E_ACCESS_DENIED = 0x80041003,
WBEM_E_PROVIDER_FAILURE = 0x80041004,
WBEM_E_TYPE_MISMATCH = 0x80041005,
WBEM_E_OUT_OF_MEMORY = 0x80041006,
WBEM_E_INVALID_CONTEXT = 0x80041007,
WBEM_E_INVALID_PARAMETER = 0x80041008,
WBEM_E_NOT_AVAILABLE = 0x80041009,
WBEM_E_CRITICAL_ERROR = 0x8004100A,
WBEM_E_INVALID_STREAM = 0x8004100B,
WBEM_E_NOT_SUPPORTED = 0x8004100C,
WBEM_E_INVALID_SUPERCLASS = 0x8004100D,
WBEM_E_INVALID_NAMESPACE = 0x8004100E,
WBEM_E_INVALID_OBJECT = 0x8004100F,
WBEM_E_INVALID_CLASS = 0x80041010,
WBEM_E_PROVIDER_NOT_FOUND = 0x80041011,
WBEM_E_INVALID_PROVIDER_REGISTRATION = 0x80041012,
WBEM_E_PROVIDER_LOAD_FAILURE = 0x80041013,
WBEM_E_INITIALIZATION_FAILURE = 0x80041014,
WBEM_E_TRANSPORT_FAILURE = 0x80041015,
WBEM_E_INVALID_OPERATION = 0x80041016,
WBEM_E_INVALID_QUERY = 0x80041017,
WBEM_E_INVALID_QUERY_TYPE = 0x80041018,
WBEM_E_ALREADY_EXISTS = 0x80041019,
WBEM_E_OVERRIDE_NOT_ALLOWED = 0x8004101A,
WBEM_E_PROPAGATED_QUALIFIER = 0x8004101B,
WBEM_E_PROPAGATED_PROPERTY = 0x8004101C,
WBEM_E_UNEXPECTED = 0x8004101D,
WBEM_E_ILLEGAL_OPERATION = 0x8004101E,
WBEM_E_CANNOT_BE_KEY = 0x8004101F,
WBEM_E_INCOMPLETE_CLASS = 0x80041020,
WBEM_E_INVALID_SYNTAX = 0x80041021,
WBEM_E_NONDECORATED_OBJECT = 0x80041022,
WBEM_E_READ_ONLY = 0x80041023,
WBEM_E_PROVIDER_NOT_CAPABLE = 0x80041024,
WBEM_E_CLASS_HAS_CHILDREN = 0x80041025,
WBEM_E_CLASS_HAS_INSTANCES = 0x80041026,
WBEM_E_QUERY_NOT_IMPLEMENTED = 0x80041027,
WBEM_E_ILLEGAL_NULL = 0x80041028,
WBEM_E_INVALID_QUALIFIER_TYPE = 0x80041029,
WBEM_E_INVALID_PROPERTY_TYPE = 0x8004102A,
WBEM_E_VALUE_OUT_OF_RANGE = 0x8004102B,
WBEM_E_CANNOT_BE_SINGLETON = 0x8004102C,
WBEM_E_INVALID_CIM_TYPE = 0x8004102D,
WBEM_E_INVALID_METHOD = 0x8004102E,
WBEM_E_INVALID_METHOD_PARAMETERS = 0x8004102F,
WBEM_E_SYSTEM_PROPERTY = 0x80041030,
WBEM_E_INVALID_PROPERTY = 0x80041031,
WBEM_E_CALL_CANCELLED = 0x80041032,
WBEM_E_SHUTTING_DOWN = 0x80041033,
WBEM_E_PROPAGATED_METHOD = 0x80041034,
WBEM_E_UNSUPPORTED_PARAMETER = 0x80041035,
WBEM_E_MISSING_PARAMETER_ID = 0x80041036,
WBEM_E_INVALID_PARAMETER_ID = 0x80041037,
WBEM_E_NONCONSECUTIVE_PARAMETER_IDS = 0x80041038,
WBEM_E_PARAMETER_ID_ON_RETVAL = 0x80041039,
WBEM_E_INVALID_OBJECT_PATH = 0x8004103A,
WBEM_E_OUT_OF_DISK_SPACE = 0x8004103B,
WBEM_E_BUFFER_TOO_SMALL = 0x8004103C,
WBEM_E_UNSUPPORTED_PUT_EXTENSION = 0x8004103D,
WBEM_E_UNKNOWN_OBJECT_TYPE = 0x8004103E,
WBEM_E_UNKNOWN_PACKET_TYPE = 0x8004103F,
WBEM_E_MARSHAL_VERSION_MISMATCH = 0x80041040,
WBEM_E_MARSHAL_INVALID_SIGNATURE = 0x80041041,
WBEM_E_INVALID_QUALIFIER = 0x80041042,
WBEM_E_INVALID_DUPLICATE_PARAMETER = 0x80041043,
WBEM_E_TOO_MUCH_DATA = 0x80041044,
WBEM_E_SERVER_TOO_BUSY = 0x80041045,
WBEM_E_INVALID_FLAVOR = 0x80041046,
WBEM_E_CIRCULAR_REFERENCE = 0x80041047,
WBEM_E_UNSUPPORTED_CLASS_UPDATE = 0x80041048,
WBEM_E_CANNOT_CHANGE_KEY_INHERITANCE = 0x80041049,
WBEM_E_CANNOT_CHANGE_INDEX_INHERITANCE = 0x80041050,
WBEM_E_TOO_MANY_PROPERTIES = 0x80041051,
WBEM_E_UPDATE_TYPE_MISMATCH = 0x80041052,
WBEM_E_UPDATE_OVERRIDE_NOT_ALLOWED = 0x80041053,
WBEM_E_UPDATE_PROPAGATED_METHOD = 0x80041054,
WBEM_E_METHOD_NOT_IMPLEMENTED = 0x80041055,
WBEM_E_METHOD_DISABLED = 0x80041056,
WBEM_E_REFRESHER_BUSY = 0x80041057,
WBEM_E_UNPARSABLE_QUERY = 0x80041058,
WBEM_E_NOT_EVENT_CLASS = 0x80041059,
WBEM_E_MISSING_GROUP_WITHIN = 0x8004105A,
WBEM_E_MISSING_AGGREGATION_LIST = 0x8004105B,
WBEM_E_PROPERTY_NOT_AN_OBJECT = 0x8004105C,
WBEM_E_AGGREGATING_BY_OBJECT = 0x8004105D,
WBEM_E_UNINTERPRETABLE_PROVIDER_QUERY = 0x8004105F,
WBEM_E_BACKUP_RESTORE_WINMGMT_RUNNING = 0x80041060,
WBEM_E_QUEUE_OVERFLOW = 0x80041061,
WBEM_E_PRIVILEGE_NOT_HELD = 0x80041062,
WBEM_E_INVALID_OPERATOR = 0x80041063,
WBEM_E_LOCAL_CREDENTIALS = 0x80041064,
WBEM_E_CANNOT_BE_ABSTRACT = 0x80041065,
WBEM_E_AMENDED_OBJECT = 0x80041066,
WBEM_E_CLIENT_TOO_SLOW = 0x80041067,
WBEM_E_NULL_SECURITY_DESCRIPTOR = 0x80041068,
WBEM_E_TIMED_OUT = 0x80041069,
WBEM_E_INVALID_ASSOCIATION = 0x8004106A,
WBEM_E_AMBIGUOUS_OPERATION = 0x8004106B,
WBEM_E_QUOTA_VIOLATION = 0x8004106C,
WBEM_E_RESERVED_001 = 0x8004106D,
WBEM_E_RESERVED_002 = 0x8004106E,
WBEM_E_UNSUPPORTED_LOCALE = 0x8004106F,
WBEM_E_HANDLE_OUT_OF_DATE = 0x80041070,
WBEM_E_CONNECTION_FAILED = 0x80041071,
WBEM_E_INVALID_HANDLE_REQUEST = 0x80041072,
WBEM_E_PROPERTY_NAME_TOO_WIDE = 0x80041073,
WBEM_E_CLASS_NAME_TOO_WIDE = 0x80041074,
WBEM_E_METHOD_NAME_TOO_WIDE = 0x80041075,
WBEM_E_QUALIFIER_NAME_TOO_WIDE = 0x80041076,
WBEM_E_RERUN_COMMAND = 0x80041077,
WBEM_E_DATABASE_VER_MISMATCH = 0x80041078,
WBEM_E_VETO_DELETE = 0x80041079,
WBEM_E_VETO_PUT = 0x8004107A,
WBEM_E_INVALID_LOCALE = 0x80041080,
WBEM_E_PROVIDER_SUSPENDED = 0x80041081,
WBEM_E_SYNCHRONIZATION_REQUIRED = 0x80041082,
WBEM_E_NO_SCHEMA = 0x80041083,
WBEM_E_PROVIDER_ALREADY_REGISTERED = 0x80041084,
WBEM_E_PROVIDER_NOT_REGISTERED = 0x80041085,
WBEM_E_FATAL_TRANSPORT_ERROR = 0x80041086,
WBEM_E_ENCRYPTED_CONNECTION_REQUIRED = 0x80041087,
WBEM_E_PROVIDER_TIMED_OUT = 0x80041088,
WBEM_E_NO_KEY = 0x80041089,
WBEM_E_PROVIDER_DISABLED = 0x8004108a
} WBEMSTATUS;
typedef [public,noprint] enum
{
WBEM_FLAG_RETURN_IMMEDIATELY = 0x10,
WBEM_FLAG_RETURN_WBEM_COMPLETE = 0,
WBEM_FLAG_BIDIRECTIONAL = 0,
WBEM_FLAG_FORWARD_ONLY = 0x20,
WBEM_FLAG_NO_ERROR_OBJECT = 0x40,
WBEM_FLAG_RETURN_ERROR_OBJECT = 0,
WBEM_FLAG_SEND_STATUS = 0x80,
WBEM_FLAG_DONT_SEND_STATUS = 0,
WBEM_FLAG_ENSURE_LOCATABLE = 0x100,
WBEM_FLAG_DIRECT_READ = 0x200,
WBEM_FLAG_SEND_ONLY_SELECTED = 0,
WBEM_RETURN_WHEN_COMPLETE = 0,
WBEM_RETURN_IMMEDIATELY = 0x10,
WBEM_MASK_RESERVED_FLAGS = 0x1F000,
WBEM_FLAG_USE_AMENDED_QUALIFIERS = 0x20000,
WBEM_FLAG_STRONG_VALIDATION = 0x100000
} WBEM_GENERIC_FLAG_TYPE;
typedef [public,noprint,v1_enum] enum tag_WBEM_TIMEOUT_TYPE
{
WBEM_NO_WAIT = 0,
WBEM_INFINITE = 0xFFFFFFFF
} WBEM_TIMEOUT_TYPE;
typedef [public,nopull,nopush,noprint,string,charset(UTF16)] uint16 *CIMSTRING;
typedef [public,v1_enum] enum
{
CIM_EMPTY = 0,
CIM_SINT8 = 16,
CIM_UINT8 = 17,
CIM_SINT16 = 2,
CIM_UINT16 = 18,
CIM_SINT32 = 3,
CIM_UINT32 = 19,
CIM_SINT64 = 20,
CIM_UINT64 = 21,
CIM_REAL32 = 4,
CIM_REAL64 = 5,
CIM_BOOLEAN = 11,
CIM_STRING = 8,
CIM_DATETIME = 101,
CIM_REFERENCE = 102,
CIM_CHAR16 = 103,
CIM_OBJECT = 13,
CIM_FLAG_ARRAY = 0x2000,
CIM_ARR_SINT8 = CIM_FLAG_ARRAY | CIM_SINT8,
CIM_ARR_UINT8 = CIM_FLAG_ARRAY | CIM_UINT8,
CIM_ARR_SINT16 = CIM_FLAG_ARRAY | CIM_SINT16,
CIM_ARR_UINT16 = CIM_FLAG_ARRAY | CIM_UINT16,
CIM_ARR_SINT32 = CIM_FLAG_ARRAY | CIM_SINT32,
CIM_ARR_UINT32 = CIM_FLAG_ARRAY | CIM_UINT32,
CIM_ARR_SINT64 = CIM_FLAG_ARRAY | CIM_SINT64,
CIM_ARR_UINT64 = CIM_FLAG_ARRAY | CIM_UINT64,
CIM_ARR_REAL32 = CIM_FLAG_ARRAY | CIM_REAL32,
CIM_ARR_REAL64 = CIM_FLAG_ARRAY | CIM_REAL64,
CIM_ARR_BOOLEAN = CIM_FLAG_ARRAY | CIM_BOOLEAN,
CIM_ARR_STRING = CIM_FLAG_ARRAY | CIM_STRING,
CIM_ARR_DATETIME = CIM_FLAG_ARRAY | CIM_DATETIME,
CIM_ARR_REFERENCE = CIM_FLAG_ARRAY | CIM_REFERENCE,
CIM_ARR_CHAR16 = CIM_FLAG_ARRAY | CIM_CHAR16,
CIM_ARR_OBJECT = CIM_FLAG_ARRAY | CIM_OBJECT,
CIM_ILLEGAL = 0xfff,
CIM_TYPEMASK = 0x2FFF
} CIMTYPE_ENUMERATION;
typedef [public] struct {
uint32 count;
int8 item[count];
} arr_int8;
typedef [public] struct {
uint32 count;
uint8 item[count];
} arr_uint8;
typedef [public] struct {
uint32 count;
int16 item[count];
} arr_int16;
typedef [public] struct {
uint32 count;
uint16 item[count];
} arr_uint16;
typedef [public] struct {
uint32 count;
int32 item[count];
} arr_int32;
typedef [public] struct {
uint32 count;
uint32 item[count];
} arr_uint32;
typedef [public] struct {
uint32 count;
dlong item[count];
} arr_dlong;
typedef [public] struct {
uint32 count;
udlong item[count];
} arr_udlong;
typedef [public] struct {
uint32 count;
[relative] CIMSTRING item[count];
} arr_CIMSTRING;
typedef [public] struct {
uint32 count;
[relative,subcontext(4)] WbemClassObject *item[count];
} arr_WbemClassObject;
// FIXME:avg implement rest of types
typedef [public,nodiscriminant] union
{
[case(CIM_SINT8)] int8 v_sint8;
[case(CIM_UINT8)] uint8 v_uint8;
[case(CIM_SINT16)] int16 v_sint16;
[case(CIM_UINT16)] uint16 v_uint16;
[case(CIM_SINT32)] int32 v_sint32;
[case(CIM_UINT32)] uint32 v_uint32;
[case(CIM_SINT64)] dlong v_sint64;
[case(CIM_UINT64)] udlong v_uint64;
[case(CIM_REAL32)] uint32 v_real32;
[case(CIM_REAL64)] udlong v_real64;
[case(CIM_BOOLEAN)] uint16 v_boolean;
[case(CIM_STRING),relative] CIMSTRING v_string;
[case(CIM_DATETIME),relative] CIMSTRING v_datetime;
[case(CIM_REFERENCE),relative] CIMSTRING v_reference;
[case(CIM_OBJECT),subcontext(4),relative] WbemClassObject *v_object;
[case(CIM_ARR_SINT8),relative] arr_int8 *a_sint8;
[case(CIM_ARR_UINT8),relative] arr_uint8 *a_uint8;
[case(CIM_ARR_SINT16),relative] arr_int16 *a_sint16;
[case(CIM_ARR_UINT16),relative] arr_uint16 *a_uint16;
[case(CIM_ARR_SINT32),relative] arr_int32 *a_sint32;
[case(CIM_ARR_UINT32),relative] arr_uint32 *a_uint32;
[case(CIM_ARR_SINT64),relative] arr_dlong *a_sint64;
[case(CIM_ARR_UINT64),relative] arr_udlong *a_uint64;
[case(CIM_ARR_REAL32),relative] arr_uint32 *a_real32;
[case(CIM_ARR_REAL64),relative] arr_udlong *a_real64;
[case(CIM_ARR_BOOLEAN),relative] arr_uint16 *a_boolean;
[case(CIM_ARR_STRING),relative] arr_CIMSTRING *a_string;
[case(CIM_ARR_DATETIME),relative] arr_CIMSTRING *a_datetime;
[case(CIM_ARR_REFERENCE),relative] arr_CIMSTRING *a_reference;
[case(CIM_ARR_OBJECT),relative] arr_WbemClassObject *a_object;
} CIMVAR;
typedef [public,bitmap8bit] bitmap
{
WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE = 0x1,
WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS = 0x2,
// WBEM_FLAVOR_MASK_PROPAGATION = 0x0F,
WBEM_FLAVOR_NOT_OVERRIDABLE = 0x10,
// WBEM_FLAVOR_MASK_PERMISSIONS = 0x10,
WBEM_FLAVOR_ORIGIN_PROPAGATED = 0x20,
WBEM_FLAVOR_ORIGIN_SYSTEM = 0x40,
// WBEM_FLAVOR_MASK_ORIGIN = 0x60,
WBEM_FLAVOR_AMENDED = 0x80
// WBEM_FLAVOR_MASK_AMENDED = 0x80
} WBEM_FLAVOR_TYPE;
typedef [public,bitmap8bit] bitmap
{
WCF_DECORATIONS = 1,
WCF_INSTANCE = 2,
WCF_CLASS = 4,
WCF_CLASS_PART_INTERNAL = 8
// WCF_CLASS_PART_SHARED = 0x104
} WCO_FLAGS;
typedef [public,nopush,nopull] struct
{
[relative] CIMSTRING name;
WBEM_FLAVOR_TYPE flavors;
CIMTYPE_ENUMERATION cimtype;
[switch_is(cimtype)] CIMVAR value;
} WbemQualifier;
typedef [public,nopush,nopull] struct
{
uint32 count;
[ref] WbemQualifier* item[count];
} WbemQualifiers;
typedef [public] struct
{
uint32 cimtype;
uint16 nr;
uint32 offset;
uint32 depth;
WbemQualifiers qualifiers;
} WbemPropertyDesc;
typedef [public] struct
{
[relative] CIMSTRING name;
[relative] WbemPropertyDesc *desc;
} WbemProperty;
typedef [public,nopull,nopush] struct
{
uint32 count;
[ref] CIMSTRING item[count];
} CIMSTRINGS;
typedef [public,bitmap8bit] bitmap {
DEFAULT_FLAG_EMPTY = 1,
DEFAULT_FLAG_INHERITED = 2
} DEFAULT_FLAGS;
typedef [public,nopush,nopull,noprint,flag(NDR_NOALIGN)] struct
{
uint8 u_0;
[relative, null_is_ffffffff] CIMSTRING __CLASS;
uint32 data_size;
CIMSTRINGS __DERIVATION;
WbemQualifiers qualifiers;
uint32 __PROPERTY_COUNT;
WbemProperty properties[__PROPERTY_COUNT];
uint8 default_flags[__PROPERTY_COUNT];
CIMVAR default_values[__PROPERTY_COUNT];
} WbemClass;
typedef [public] struct
{
[relative,null_is_ffffffff] CIMSTRING name;
uint32 u0;
uint32 u1;
[relative] WbemQualifiers *qualifiers;
[subcontext(4),relative] WbemClassObject *in;
[subcontext(4),relative] WbemClassObject *out;
} WbemMethod;
typedef [public,flag(NDR_NOALIGN)] struct
{
uint16 count;
uint16 u0; // It has value 5F5F if there are no methods
WbemMethod method[count];
} WbemMethods;
typedef [public,flag(NDR_NOALIGN),nopush,nopull,noprint] struct
{
uint8 u1_0;
[relative] CIMSTRING __CLASS;
uint8 *default_flags;
CIMVAR *data;
uint32 u2_4;
uint8 u3_1;
} WbemInstance;
typedef [public,nopush,nopull,noprint,flag(NDR_NOALIGN)] struct
{
WCO_FLAGS flags;
[ref] CIMSTRING __SERVER;
[ref] CIMSTRING __NAMESPACE;
WbemClass *sup_class;
WbemMethods *sup_methods;
WbemClass *obj_class;
WbemMethods *obj_methods;
WbemInstance *instance;
} WbemClassObject;
// typedef [public] struct {
// [value(0x72657355)] uint32 fFlags;
// uint32 clSize;
// [value(2*clSize)] uint32 _bsize;
// [value(clSize)] uint32 _wsize;
// [flag(NDR_NOALIGN)] uint16 asData[clSize];
// } BSTR1;
typedef [public,nopush,nopull,noprint,string,charset(UTF16)] uint16 *BSTR;
WERROR OpenNamespace(
// [in] BSTR *strNamespace,
// [in] int32 lFlags
// [in] IWbemContext* pCtx,
// [out] IWbemServices** ppWorkingNamespace,
// [out] IWbemCallResult** ppResult
);
WERROR CancelAsyncCall(
// [in] IWbemObjectSink* pSink
);
WERROR QueryObjectSink(
// [in] long lFlags
// [out] IWbemObjectSink** ppResponseHandler
);
// Classes and instances.
// ======================
WERROR GetObject(
[in] BSTR strObjectPath,
[in] long lFlags,
[in,unique] IWbemContext* pCtx,
// [in,out,unique] IUnknown** ppObject,
// [in,out,unique] IUnknown** ppCallResult
[in,out,unique] IWbemClassObject** ppObject,
[in,out,unique] IWbemCallResult** ppCallResult
);
WERROR GetObjectAsync(
// [in] BSTR strObjectPath,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
WERROR PutClass(
// [in] IWbemClassObject* pObject,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [out, OPTIONAL] IWbemCallResult** ppCallResult
);
WERROR PutClassAsync(
// [in] IWbemClassObject* pObject,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
WERROR DeleteClass(
// [in] BSTR strClass,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [out, OPTIONAL] IWbemCallResult** ppCallResult
);
WERROR DeleteClassAsync(
// [in] BSTR strClass,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
WERROR CreateClassEnum(
// [in] BSTR strSuperclass,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [out] IEnumWbemClassObject** ppEnum
);
WERROR CreateClassEnumAsync(
// [in] BSTR strSuperclass,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
WERROR PutInstance(
// [in] IWbemClassObject* pInst,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [out, OPTIONAL] IWbemCallResult** ppCallResult
);
WERROR PutInstanceAsync(
// [in] IWbemClassObject* pInst,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
WERROR DeleteInstance(
// [in] BSTR strObjectPath,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [out, OPTIONAL] IWbemCallResult** ppCallResult
);
WERROR DeleteInstanceAsync(
// [in] BSTR strObjectPath,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
WERROR CreateInstanceEnum(
[in] BSTR strFilter, // allow more things than a class name
[in] long lFlags,
[in,unique] IWbemContext* pCtx,
[out] IEnumWbemClassObject** ppEnum
);
WERROR CreateInstanceEnumAsync(
// [in] BSTR strFilter, // allow more things than a class name
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
WERROR ExecQuery(
[in] BSTR strQueryLanguage,
[in] BSTR strQuery,
[in] long lFlags,
[in,unique] IWbemContext* pCtx,
[out] IEnumWbemClassObject** ppEnum
);
WERROR ExecQueryAsync(
// [in] BSTR strQueryLanguage,
// [in] BSTR strQuery,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
WERROR ExecNotificationQuery(
[in] BSTR strQueryLanguage,
[in] BSTR strQuery,
[in] long lFlags,
[in,unique] IWbemContext* pCtx,
[out] IEnumWbemClassObject** ppEnum
);
WERROR ExecNotificationQueryAsync(
// [in] BSTR strQueryLanguage,
// [in] BSTR strQuery,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemObjectSink* pResponseHandler
);
// Methods
// =======
WERROR ExecMethod(
[in] BSTR strObjectPath,
[in] BSTR strMethodName,
[in] long lFlags,
[in,unique] IWbemContext* pCtx,
[in,unique] IWbemClassObject* pInParams,
[in,out,unique] IWbemClassObject** ppOutParams,
[in,out,unique] IWbemCallResult** ppCallResult
);
WERROR ExecMethodAsync(
// [in] BSTR strObjectPath,
// [in] BSTR strMethodName,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [in] IWbemClassObject* pInParams,
// [in] IWbemObjectSink* pResponseHandler
);
}
[
object,
uuid(027947e1-d731-11ce-a357-000000000001),
pointer_default(unique)
] interface IEnumWbemClassObject : IUnknown
{
WERROR Reset();
[call_as(Next)] WERROR IEnumWbemClassObject_Next(
[in] int32 lTimeout,
[in] uint32 uCount,
[out, size_is(uCount), length_is(*puReturned)]
IWbemClassObject** apObjects,
[out] uint32* puReturned
);
WERROR NextAsync(
// [in] ULONG uCount
// [in] IWbemObjectSink* pSink
);
WERROR IEnumWbemClassObject_Clone(
// [out] IEnumWbemClassObject** ppEnum
);
WERROR Skip(
// [in] long lTimeout,
// [in] ULONG nCount
);
};
[
object,
local,
uuid("44aca674-e8fc-11d0-a07c-00c04fb68820"),
pointer_default(unique)
] interface IWbemContext : IUnknown
{
WERROR Clone([out] IWbemContext** ppNewCopy);
WERROR GetNames(
// [in] long lFlags,
// [out] SAFEARRAY (BSTR)* pNames
);
WERROR BeginEnumeration([in] long lFlags);
WERROR Next(
// [in] long lFlags,
// [out] BSTR* pstrName,
// [out] VARIANT* pValue
);
WERROR EndEnumeration();
WERROR SetValue(
// [in, string] LPCWSTR wszName,
// [in] long lFlags
// [in] VARIANT* pValue
);
WERROR GetValue(
// [in, string] LPCWSTR wszName,
// [in] long lFlags,
// [out] VARIANT* pValue
);
WERROR DeleteValue(
// [in, string] LPCWSTR wszName,
// [in] long lFlags
);
WERROR DeleteAll();
}
[
object,
uuid("F309AD18-D86A-11d0-A075-00C04FB68820"),
pointer_default(unique)
] interface IWbemLevel1Login : IUnknown
{
WERROR EstablishPosition(
// [in, unique, string] LPWSTR wszClientMachineName,
// [in] uint32 dwProcessId,
// [out] uint32* phAuthEventHandle
);
WERROR RequestChallenge(
// [in, unique, string] LPWSTR wszNetworkResource,
// [in, unique, string] LPWSTR wszUser,
// [out] WBEM_128BITS Nonce
);
WERROR WBEMLogin(
// [in, unique, string] LPWSTR wszPreferredLocale,
// [in, unique] WBEM_128BITS AccessToken,
// [in] long lFlags
// [in] IWbemContext* pCtx,
// [out] IWbemServices** ppNamespace
);
WERROR NTLMLogin(
[in,unique,string,charset(UTF16)] uint16 *wszNetworkResource,
[in,unique,string,charset(UTF16)] uint16 *wszPreferredLocale,
[in] long lFlags,
[in,unique] IWbemContext* pCtx,
[out,ref] IWbemServices** ppNamespace
);
}
[
object,
uuid("423ec01e-2e35-11d2-b604-00104b703efd"),
pointer_default(unique)
] interface IWbemWCOSmartEnum : IUnknown
{
typedef struct {
uint32 size;
char data[size];
} WBEMDATA;
typedef enum {
WTYPE_SCHEMA = 1,
WTYPE_CLASS = 2,
WTYPE_OBJECT = 3
} WTYPES;
typedef [relative_base] struct {
// [relative] WBEMDATA4 *data; /* 0x9 */
uint32 data_size;
uint8 wtype;
} WBEMDATA4;
typedef [relative_base] struct {
[relative] WBEMDATA4 *data; /* 0x9 */
uint32 data_size;
uint8 wtype;
} WBEMDATA3;
typedef [relative_base] struct {
[relative,size_is(obj_num)] WBEMDATA3 *data; /* 0x8 */
uint32 data_size;
uint32 obj_num;
} WBEMDATA2;
typedef [relative_base] struct {
[relative] WBEMDATA2 *data; /* 0x8 */
uint32 data_size;
} WBEMDATA1;
typedef [relative_base] struct {
uint32 u1_0; /* 0 */
hyper signature; /* 'WBEMDATA' */
[relative] WBEMDATA1 *data; /* 0x1A */
uint32 data_size;
uint32 u2_0; /* 0 */
uint8 ver_major; /* 1 */
uint8 ver_minor; /* 0 - Win2000, 1 - WinXP/2003 */
} WBEMDATA0;
WERROR IWbemWCOSmartEnum_Next(
[in,ref] GUID *gEWCO,
[in] uint32 lTimeOut,
[in] uint32 uCount,
// [in] uint32 unknown,
// [in,ref] GUID *gWCO,
[out,ref] uint32 *puReturned,
[out,ref] uint32 *pSize,
// [out,ref] WBEMDATA0 **pData
[out,ref,noprint,size_is(,*pSize)] uint8 **pData
);
}
[
object,
uuid("1c1c45ee-4395-11d2-b60b-00104b703efd"),
pointer_default(unique)
] interface IWbemFetchSmartEnum : IUnknown
{
WERROR Fetch(
[out] IWbemWCOSmartEnum** ppEnum
);
WERROR Test(
[out] WbemClassObject** ppEnum
);
}
[
object,
// restricted,
uuid(44aca675-e8fc-11d0-a07c-00c04fb68820)
] interface IWbemCallResult : IUnknown
{
WERROR GetResultObject(
[in] long lTimeout,
[out] IUnknown** ppResultObject
// [out] IWbemClassObject** ppResultObject
);
WERROR GetResultString(
[in] long lTimeout
// [out] BSTR* pstrResultString
);
WERROR GetResultServices(
[in] long lTimeout,
[out] IWbemServices** ppServices
);
WERROR GetCallStatus(
[in] long lTimeout,
[out] long* plStatus
);
}
+394
View File
@@ -0,0 +1,394 @@
/*
dfs interface definition
*/
[ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"),
version(3.0),
pointer_default(unique),
helpstring("Settings for Microsoft Distributed File System")
] interface netdfs
{
/******************/
/* Function: 0x00 */
typedef [v1_enum] enum {
DFS_MANAGER_VERSION_NT4 = 1,
DFS_MANAGER_VERSION_W2K = 2,
DFS_MANAGER_VERSION_W2K3 = 4
} dfs_ManagerVersion;
void dfs_GetManagerVersion(
[out] dfs_ManagerVersion *version
);
/******************/
/* Function: 0x01 */
WERROR dfs_Add (
[in] [string,charset(UTF16)] uint16 *path,
[in] [string,charset(UTF16)] uint16 *server,
[in,unique] [string,charset(UTF16)] uint16 *share,
[in,unique] [string,charset(UTF16)] uint16 *comment,
[in] uint32 flags
);
/******************/
/* Function: 0x02 */
WERROR dfs_Remove (
[in] [string,charset(UTF16)] uint16 *dfs_entry_path,
[in,unique] [string,charset(UTF16)] uint16 *servername,
[in,unique] [string,charset(UTF16)] uint16 *sharename
);
/******************/
/* Function: 0x03 */
typedef struct {
} dfs_Info0;
typedef struct {
[string,charset(UTF16)] uint16 *path;
} dfs_Info1;
/* first 4 bits unverified yet */
typedef [public,bitmap32bit] bitmap {
DFS_VOLUME_STATE_OK = 0x1,
DFS_VOLUME_STATE_INCONSISTENT = 0x2,
DFS_VOLUME_STATE_OFFLINE = 0x4,
DFS_VOLUME_STATE_ONLINE = 0x8,
DFS_VOLUME_STATE_STANDALONE = DFS_VOLUME_FLAVOR_STANDALONE,
DFS_VOLUME_STATE_AD_BLOB = DFS_VOLUME_FLAVOR_AD_BLOB
} dfs_VolumeState;
typedef struct {
[string,charset(UTF16)] uint16 *path;
[string,charset(UTF16)] uint16 *comment;
dfs_VolumeState state;
uint32 num_stores;
} dfs_Info2;
const int DFS_STORAGE_STATES = 0xf;
/* yes, this is a bitmap */
typedef [public,bitmap32bit] bitmap {
DFS_STORAGE_STATE_OFFLINE = 1,
DFS_STORAGE_STATE_ONLINE = 2,
DFS_STORAGE_STATE_ACTIVE = 4
} dfs_StorageState;
typedef struct {
dfs_StorageState state;
[string,charset(UTF16)] uint16 *server;
[string,charset(UTF16)] uint16 *share;
} dfs_StorageInfo;
typedef struct {
[string,charset(UTF16)] uint16 *path;
[string,charset(UTF16)] uint16 *comment;
dfs_VolumeState state;
uint32 num_stores;
[size_is(num_stores)] dfs_StorageInfo *stores;
} dfs_Info3;
typedef struct {
[string,charset(UTF16)] uint16 *path;
[string,charset(UTF16)] uint16 *comment;
dfs_VolumeState state;
uint32 timeout;
GUID guid;
uint32 num_stores;
[size_is(num_stores)] dfs_StorageInfo *stores;
} dfs_Info4;
/* verified with dfsutil */
typedef [public,bitmap32bit] bitmap {
DFS_PROPERTY_FLAG_INSITE_REFERRALS = 0x01,
DFS_PROPERTY_FLAG_ROOT_SCALABILITY = 0x02,
DFS_PROPERTY_FLAG_SITE_COSTING = 0x04,
DFS_PROPERTY_FLAG_TARGET_FAILBACK = 0x08,
DFS_PROPERTY_FLAG_CLUSTER_ENABLED = 0x10 /* untested */
} dfs_PropertyFlags;
typedef struct {
[string,charset(UTF16)] uint16 *path;
[string,charset(UTF16)] uint16 *comment;
dfs_VolumeState state;
uint32 timeout;
GUID guid;
dfs_PropertyFlags flags;
uint32 pktsize;
uint32 num_stores;
} dfs_Info5;
typedef [v1_enum] enum {
DFS_INVALID_PRIORITY_CLASS = -1,
DFS_SITE_COST_NORMAL_PRIORITY_CLASS = 0,
DFS_GLOBAL_HIGH_PRIORITY_CLASS = 1,
DFS_SITE_COST_HIGH_PRIORITY_CLASS = 2,
DFS_SITE_COST_LOW_PRIORITY_CLASS = 3,
DFS_GLOBAL_LOW_PRIORITY_CLASS = 4
} dfs_Target_PriorityClass;
typedef struct {
dfs_Target_PriorityClass target_priority_class;
uint16 target_priority_rank;
uint16 reserved;
} dfs_Target_Priority;
typedef struct {
dfs_StorageInfo info;
dfs_Target_Priority target_priority;
} dfs_StorageInfo2;
typedef struct {
[string,charset(UTF16)] uint16 *entry_path;
[string,charset(UTF16)] uint16 *comment;
dfs_VolumeState state;
uint32 timeout;
GUID guid;
dfs_PropertyFlags flags;
uint32 pktsize;
uint16 num_stores;
[size_is(num_stores)] dfs_StorageInfo2 *stores;
} dfs_Info6;
typedef struct {
GUID generation_guid;
} dfs_Info7;
typedef struct {
[string,charset(UTF16)] uint16 *comment;
} dfs_Info100;
typedef struct {
dfs_StorageState state;
} dfs_Info101;
typedef struct {
uint32 timeout;
} dfs_Info102;
typedef struct {
dfs_PropertyFlags flags;
} dfs_Info103;
typedef struct {
dfs_Target_Priority priority;
} dfs_Info104;
typedef struct {
[string,charset(UTF16)] uint16 *comment;
dfs_VolumeState state;
uint32 timeout;
uint32 property_flag_mask;
uint32 property_flags;
} dfs_Info105;
typedef struct {
dfs_StorageState state;
dfs_Target_Priority priority;
} dfs_Info106;
typedef struct {
[string,charset(UTF16)] uint16 *dom_root;
} dfs_Info200;
typedef enum {
DFS_VOLUME_FLAVOR_STANDALONE = 0x100,
DFS_VOLUME_FLAVOR_AD_BLOB = 0x200
} dfs_VolumeFlavor;
typedef struct {
dfs_VolumeFlavor flavor;
[string,charset(UTF16)] uint16 *dom_root;
} dfs_Info300;
typedef union {
[case(0)] dfs_Info0 *info0;
[case(1)] dfs_Info1 *info1;
[case(2)] dfs_Info2 *info2;
[case(3)] dfs_Info3 *info3;
[case(4)] dfs_Info4 *info4;
[case(5)] dfs_Info5 *info5;
[case(6)] dfs_Info6 *info6;
[case(7)] dfs_Info7 *info7;
[case(100)] dfs_Info100 *info100;
[case(101)] dfs_Info101 *info101;
[case(102)] dfs_Info102 *info102;
[case(103)] dfs_Info103 *info103;
[case(104)] dfs_Info104 *info104;
[case(105)] dfs_Info105 *info105;
[case(106)] dfs_Info106 *info106;
} dfs_Info;
WERROR dfs_SetInfo (
[in] [string,charset(UTF16)] uint16 dfs_entry_path[],
[in,unique] [string,charset(UTF16)] uint16 *servername,
[in,unique] [string,charset(UTF16)] uint16 *sharename,
[in] uint32 level,
[in,ref,switch_is(level)] dfs_Info *info
);
/******************/
/* Function: 0x04 */
WERROR dfs_GetInfo (
[in] [string,charset(UTF16)] uint16 dfs_entry_path[],
[in,unique] [string,charset(UTF16)] uint16 *servername,
[in,unique] [string,charset(UTF16)] uint16 *sharename,
[in] uint32 level,
[out,switch_is(level)] dfs_Info *info
);
/******************/
/* Function: 0x05 */
typedef struct {
uint32 count;
[size_is(count)] dfs_Info1 *s;
} dfs_EnumArray1;
typedef struct {
uint32 count;
[size_is(count)] dfs_Info2 *s;
} dfs_EnumArray2;
typedef struct {
uint32 count;
[size_is(count)] dfs_Info3 *s;
} dfs_EnumArray3;
typedef struct {
uint32 count;
[size_is(count)] dfs_Info4 *s;
} dfs_EnumArray4;
typedef struct {
uint32 count;
[size_is(count)] dfs_Info200 *s;
} dfs_EnumArray200;
typedef struct {
uint32 count;
[size_is(count)] dfs_Info300 *s;
} dfs_EnumArray300;
typedef union {
[case(1)] dfs_EnumArray1 *info1;
[case(2)] dfs_EnumArray2 *info2;
[case(3)] dfs_EnumArray3 *info3;
[case(4)] dfs_EnumArray4 *info4;
[case(200)] dfs_EnumArray200 *info200;
[case(300)] dfs_EnumArray300 *info300;
} dfs_EnumInfo;
typedef struct {
uint32 level;
[switch_is(level)] dfs_EnumInfo e;
} dfs_EnumStruct;
WERROR dfs_Enum (
[in] uint32 level,
[in] uint32 bufsize,
[in,out,unique] dfs_EnumStruct *info,
[in,out,unique] uint32 *total
);
/* Function 0x06 */
WERROR dfs_Rename();
/* Function 0x07 */
WERROR dfs_Move();
/* Function 0x08 */
WERROR dfs_ManagerGetConfigInfo();
/* Function 0x09 */
WERROR dfs_ManagerSendSiteInfo();
/* Function 0x0a */
typedef struct {
uint32 unknown1;
[string,charset(UTF16)] uint16 *unknown2;
} dfs_UnknownStruct;
WERROR dfs_AddFtRoot(
[in] [string,charset(UTF16)] uint16 servername[],
[in] [string,charset(UTF16)] uint16 dns_servername[],
[in] [string,charset(UTF16)] uint16 dfsname[],
[in] [string,charset(UTF16)] uint16 rootshare[],
[in] [string,charset(UTF16)] uint16 comment[],
[in] [string,charset(UTF16)] uint16 dfs_config_dn[],
[in] uint8 unknown1,
[in] uint32 flags,
[in,out,unique] dfs_UnknownStruct **unknown2
);
/* Function 0x0b */
WERROR dfs_RemoveFtRoot(
[in] [string,charset(UTF16)] uint16 servername[],
[in] [string,charset(UTF16)] uint16 dns_servername[],
[in] [string,charset(UTF16)] uint16 dfsname[],
[in] [string,charset(UTF16)] uint16 rootshare[],
[in] uint32 flags,
[in,out,unique] dfs_UnknownStruct **unknown
);
/* Function 0x0c */
WERROR dfs_AddStdRoot(
[in] [string,charset(UTF16)] uint16 servername[],
[in] [string,charset(UTF16)] uint16 rootshare[],
[in] [string,charset(UTF16)] uint16 comment[],
[in] uint32 flags
);
/* Function 0x0d */
WERROR dfs_RemoveStdRoot(
[in] [string,charset(UTF16)] uint16 servername[],
[in] [string,charset(UTF16)] uint16 rootshare[],
[in] uint32 flags
);
/* Function 0x0e */
WERROR dfs_ManagerInitialize(
[in] [string,charset(UTF16)] uint16 *servername,
[in] uint32 flags
);
/* Function 0x0f */
WERROR dfs_AddStdRootForced(
[in] [string,charset(UTF16)] uint16 servername[],
[in] [string,charset(UTF16)] uint16 rootshare[],
[in] [string,charset(UTF16)] uint16 comment[],
[in] [string,charset(UTF16)] uint16 store[] /* C:\\whatever */
);
/* Function 0x10 */
WERROR dfs_GetDcAddress();
/* Function 0x11 */
WERROR dfs_SetDcAddress();
/* Function 0x12 */
WERROR dfs_FlushFtTable(
[in] [string,charset(UTF16)] uint16 servername[],
[in] [string,charset(UTF16)] uint16 rootshare[]
);
/* Function 0x13 */
WERROR dfs_Add2();
/* Function 0x14 */
WERROR dfs_Remove2();
/* Function 0x15 */
WERROR dfs_EnumEx(
[in] [string,charset(UTF16)] uint16 dfs_name[],
[in] uint32 level,
[in] uint32 bufsize,
[in,out,unique] dfs_EnumStruct *info,
[in,out,unique] uint32 *total
);
/* Function 0x16 */
WERROR dfs_SetInfo2();
}
+12
View File
@@ -0,0 +1,12 @@
/*
dnsserver interface definition
*/
[ uuid("50abc2a4-574d-40b3-9d66-ee4fd5fba076"),
version(5.0),
pointer_default(unique),
helpstring("DNS Server")
] interface dnsserver
{
void dnsserver_foo();
}
+166
View File
@@ -0,0 +1,166 @@
#include "idl_types.h"
import "drsuapi.idl";
[
uuid("12345778-1234-abcd-0001-00000001"),
version(0.0),
pointer_default(unique),
helpstring("Active Directory Replication LDAP Blobs")
]
interface drsblobs {
declare bitmap drsuapi_DsReplicaSyncOptions;
declare bitmap drsuapi_DsReplicaNeighbourFlags;
declare [v1_enum] enum drsuapi_DsAttributeId;
/*
* replPropertyMetaData
* w2k uses version 1
* w2k3 uses version 1
*/
typedef struct {
drsuapi_DsAttributeId attid;
uint32 version;
NTTIME_1sec orginating_time;
GUID orginating_invocation_id;
hyper orginating_usn;
hyper local_usn;
} replPropertyMetaData1;
typedef struct {
uint32 count;
uint32 reserved;
replPropertyMetaData1 array[count];
} replPropertyMetaDataCtr1;
typedef [nodiscriminant] union {
[case(1)] replPropertyMetaDataCtr1 ctr1;
} replPropertyMetaDataCtr;
typedef [public] struct {
uint32 version;
uint32 reserved;
[switch_is(version)] replPropertyMetaDataCtr ctr;
} replPropertyMetaDataBlob;
void decode_replPropertyMetaData(
[in] replPropertyMetaDataBlob blob
);
/*
* replUpToDateVector
* w2k uses version 1
* w2k3 uses version 2
*/
typedef struct {
uint32 count;
uint32 reserved;
drsuapi_DsReplicaCoursor coursors[count];
} replUpToDateVectorCtr1;
typedef struct {
uint32 count;
uint32 reserved;
drsuapi_DsReplicaCoursor2 coursors[count];
} replUpToDateVectorCtr2;
typedef [nodiscriminant] union {
[case(1)] replUpToDateVectorCtr1 ctr1;
[case(2)] replUpToDateVectorCtr2 ctr2;
} replUpToDateVectorCtr;
typedef [public] struct {
uint32 version;
uint32 reserved;
[switch_is(version)] replUpToDateVectorCtr ctr;
} replUpToDateVectorBlob;
void decode_replUpToDateVector(
[in] replUpToDateVectorBlob blob
);
/*
* repsFrom/repsTo
* w2k uses version 1
* w2k3 uses version 1
*/
typedef [public,gensize] struct {
asclstr dns_name;
} repsFromTo1OtherInfo;
typedef [public,gensize,flag(NDR_PAHEX)] struct {
/* this includes the 8 bytes of the repsFromToBlob header */
[value(ndr_size_repsFromTo1(r, ndr->flags)+8)] uint32 blobsize;
uint32 consecutive_sync_failures;
NTTIME_1sec last_success;
NTTIME_1sec last_attempt;
WERROR result_last_attempt;
[relative] repsFromTo1OtherInfo *other_info;
[value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
drsuapi_DsReplicaNeighbourFlags replica_flags;
uint8 schedule[84];
uint32 reserved;
drsuapi_DsReplicaHighWaterMark highwatermark;
GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */
GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
GUID transport_guid;
} repsFromTo1;
typedef [nodiscriminant] union {
[case(1)] repsFromTo1 ctr1;
} repsFromTo;
typedef [public] struct {
uint32 version;
uint32 reserved;
[switch_is(version)] repsFromTo ctr;
} repsFromToBlob;
void decode_repsFromTo(
[in] repsFromToBlob blob
);
typedef struct {
hyper h4;
replUpToDateVectorCtr1 uptodateness_vector;
} ldapControlDirSyncExtraData;
typedef [nodiscriminant,gensize] union {
[case(0)];
[default] ldapControlDirSyncExtraData data;
} ldapControlDirSyncExtra;
typedef struct {
[value(3)] uint32 u1;
NTTIME time;
uint32 u2;
uint32 u3;
[value(ndr_size_ldapControlDirSyncExtra(&r->extra, r->extra.data.uptodateness_vector.count, 0))]
uint32 extra_length;
drsuapi_DsReplicaHighWaterMark highwatermark;
GUID guid1;
[switch_is(extra_length)] ldapControlDirSyncExtra extra;
} ldapControlDirSyncBlob;
typedef [public,relative_base] struct {
[charset(DOS),value("MSDS")] uint8 msds[4];
[subcontext(0)] ldapControlDirSyncBlob blob;
} ldapControlDirSyncCookie;
void decode_ldapControlDirSync(
[in] ldapControlDirSyncCookie cookie
);
typedef [public] struct {
uint32 marker;
DATA_BLOB data;
} DsCompressedChunk;
typedef [public] struct {
DsCompressedChunk chunks[5];
} DsCompressedBlob;
void decode_DsCompressed(
[in] DsCompressedBlob blob
);
}
File diff suppressed because it is too large Load Diff
+34
View File
@@ -0,0 +1,34 @@
[
uuid("ecec0d70-a603-11d0-96b1-00a0c91ece30"),
version(1.0),
pointer_default(unique),
helpstring("Backup support for Active Directory")
] interface ad_backup
{
void HrRBackupPrepare();
void HrRBackupEnd();
void HrRBackupGetAttachmentInformation();
void HrRBackupOpenFile();
void HrRBackupRead();
void HrRBackupClose();
void HrRBackupGetBackupLogs();
void HrRBackupTruncateLogs();
void HrRBackupPing();
}
[
uuid("16e0cf3a-a604-11d0-96b1-00a0c91ece30"),
version(1.0),
pointer_default(unique),
helpstring("Restoring Active Directory backups")
] interface ad_restore
{
void HrRIsNTDSOnline();
void HrRRestorePrepare();
void HrRRestoreRegister();
void HrRRestoreRegisterComplete();
void HrRRestoreGetDatabaseLocations();
void HrRRestoreEnd();
void HrRRestoreSetCurrentLogNumber();
void HrRRestoreCheckLogsForBackup();
}
+99
View File
@@ -0,0 +1,99 @@
/*
dssetup interface definition
*/
[
uuid("3919286a-b10c-11d0-9ba8-00c04fd92ef5"),
version(0.0),
endpoint("ncacn_np:[\\pipe\\lsarpc]", "ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
helpstring("Active Directory Setup")
] interface dssetup
{
/**********************************************/
/* Function 0x00 */
typedef enum {
DS_ROLE_STANDALONE_WORKSTATION = 0,
DS_ROLE_MEMBER_WORKSTATION = 1,
DS_ROLE_STANDALONE_SERVER = 2,
DS_ROLE_MEMBER_SERVER = 3,
DS_ROLE_BACKUP_DC = 4,
DS_ROLE_PRIMARY_DC = 5
} dssetup_DsRole;
typedef [bitmap32bit] bitmap {
DS_ROLE_PRIMARY_DS_RUNNING = 0x00000001,
DS_ROLE_PRIMARY_DS_MIXED_MODE = 0x00000002,
DS_ROLE_UPGRADE_IN_PROGRESS = 0x00000004,
DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT = 0x01000000
} dssetup_DsRoleFlags;
typedef struct {
dssetup_DsRole role;
dssetup_DsRoleFlags flags;
[charset(UTF16),string] uint16 *domain;
[charset(UTF16),string] uint16 *dns_domain;
[charset(UTF16),string] uint16 *forest;
GUID domain_guid;
} dssetup_DsRolePrimaryDomInfoBasic;
typedef [v1_enum] enum {
DS_ROLE_NOT_UPGRADING = 0,
DS_ROLE_UPGRADING = 1
} dssetup_DsUpgrade;
typedef enum {
DS_ROLE_PREVIOUS_UNKNOWN = 0,
DS_ROLE_PREVIOUS_PRIMARY = 1,
DS_ROLE_PREVIOUS_BACKUP = 2
} dssetup_DsPrevious;
typedef struct {
dssetup_DsUpgrade upgrading;
dssetup_DsPrevious previous_role;
} dssetup_DsRoleUpgradeStatus;
typedef enum {
DS_ROLE_OP_IDLE = 0,
DS_ROLE_OP_ACTIVE = 1,
DS_ROLE_OP_NEEDS_REBOOT = 2
} dssetup_DsRoleOp;
typedef struct {
dssetup_DsRoleOp status;
} dssetup_DsRoleOpStatus;
typedef enum {
DS_ROLE_BASIC_INFORMATION = 1,
DS_ROLE_UPGRADE_STATUS = 2,
DS_ROLE_OP_STATUS = 3
} dssetup_DsRoleInfoLevel;
typedef [switch_type(dssetup_DsRoleInfoLevel)] union {
[case(DS_ROLE_BASIC_INFORMATION)] dssetup_DsRolePrimaryDomInfoBasic basic;
[case(DS_ROLE_UPGRADE_STATUS)] dssetup_DsRoleUpgradeStatus upgrade;
[case(DS_ROLE_OP_STATUS)] dssetup_DsRoleOpStatus opstatus;
} dssetup_DsRoleInfo;
WERROR dssetup_DsRoleGetPrimaryDomainInformation(
[in] dssetup_DsRoleInfoLevel level,
[out,switch_is(level),unique] dssetup_DsRoleInfo *info
);
/*
w2k3 has removed all the calls below from their implementation.
These stubs are left here only as a way of documenting the names
of the calls in case they ever turn up on the wire.
*/
WERROR dssetup_DsRoleDnsNameToFlatName();
WERROR dssetup_DsRoleDcAsDc();
WERROR dssetup_DsRoleDcAsReplica();
WERROR dssetup_DsRoleDemoteDc();
WERROR dssetup_DsRoleGetDcOperationProgress();
WERROR dssetup_DsRoleGetDcOperationResults();
WERROR dssetup_DsRoleCancel();
WERROR dssetup_DsRoleServerSaveStateForUpgrade();
WERROR dssetup_DsRoleUpgradeDownlevelServer();
WERROR dssetup_DsRoleAbortDownlevelServerUpgrade();
}
+127
View File
@@ -0,0 +1,127 @@
[
uuid("60a15ec5-4de8-11d7-a637-005056a20182"),
endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
version(1.0),
helpstring("Simple echo pipe")
]
interface rpcecho
{
/* Add one to an integer */
void echo_AddOne(
[in] uint32 in_data,
[out] uint32 *out_data
);
/* Echo an array of bytes back at the caller */
void echo_EchoData(
[in] uint32 len,
[in] [size_is(len)] uint8 in_data[],
[out] [size_is(len)] uint8 out_data[]
);
/* Sink data to the server */
void echo_SinkData(
[in] uint32 len,
[in,size_is(len)] uint8 data[]
);
/* Source data from server */
void echo_SourceData(
[in] uint32 len,
[out,size_is(len)] uint8 data[]
);
/* test strings */
void echo_TestCall (
[in,string,charset(UTF16)] uint16 *s1,
[out,string,charset(UTF16)] uint16 **s2
);
/* test some alignment issues */
typedef struct {
uint8 v;
} echo_info1;
typedef struct {
uint16 v;
} echo_info2;
typedef struct {
uint32 v;
} echo_info3;
typedef struct {
hyper v;
} echo_info4;
typedef struct {
uint8 v1;
hyper v2;
} echo_info5;
typedef struct {
uint8 v1;
echo_info1 info1;
} echo_info6;
typedef struct {
uint8 v1;
echo_info4 info4;
} echo_info7;
typedef [switch_type(uint16)] union {
[case(1)] echo_info1 info1;
[case(2)] echo_info2 info2;
[case(3)] echo_info3 info3;
[case(4)] echo_info4 info4;
[case(5)] echo_info5 info5;
[case(6)] echo_info6 info6;
[case(7)] echo_info7 info7;
} echo_Info;
NTSTATUS echo_TestCall2 (
[in] uint16 level,
[out,switch_is(level)] echo_Info *info
);
uint32 echo_TestSleep(
[in] uint32 seconds
);
typedef enum {
ECHO_ENUM1 = 1,
ECHO_ENUM2 = 2
} echo_Enum1;
typedef [v1_enum] enum {
ECHO_ENUM1_32 = 1,
ECHO_ENUM2_32 = 2
} echo_Enum1_32;
typedef struct {
echo_Enum1 e1;
echo_Enum1_32 e2;
} echo_Enum2;
typedef [switch_type(uint16)] union {
[case(ECHO_ENUM1)] echo_Enum1 e1;
[case(ECHO_ENUM2)] echo_Enum2 e2;
} echo_Enum3;
void echo_TestEnum(
[in,out,ref] echo_Enum1 *foo1,
[in,out,ref] echo_Enum2 *foo2,
[in,out,ref,switch_is(*foo1)] echo_Enum3 *foo3
);
typedef struct {
uint32 x;
[size_is(x)] uint16 surrounding[*];
} echo_Surrounding;
void echo_TestSurrounding(
[in,out,ref] echo_Surrounding *data
);
uint16 echo_TestDoublePointer([in] uint16 ***data);
}
+108
View File
@@ -0,0 +1,108 @@
/*
IDL definitions from original packet-dcerpc-efs.c
by Jean-Baptiste Marchand
*/
import "security.idl";
[
uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"),
version(1.0),
pointer_default(unique)
] interface efs
{
WERROR EfsRpcOpenFileRaw(
[out,ref] policy_handle *pvContext,
[in] [charset(UTF16),string] uint16 FileName[],
[in] uint32 Flags
);
WERROR EfsRpcReadFileRaw(
[in,ref] policy_handle *pvContext
/* incomplete */
);
WERROR EfsRpcWriteFileRaw(
[in,ref] policy_handle *pvContext
/* incomplete */
);
void EfsRpcCloseRaw(
[in,out,ref] policy_handle *pvContext
);
WERROR EfsRpcEncryptFileSrv(
[in] [charset(UTF16),string] uint16 Filename[]
);
WERROR EfsRpcDecryptFileSrv(
[in] [charset(UTF16),string] uint16 FileName[],
[in] uint32 Reserved
);
typedef struct {
uint32 cbData;
[size_is(cbData), unique] uint8 *pbData;
} EFS_HASH_BLOB;
typedef struct {
uint32 cbTotalLength;
[unique] dom_sid *pUserSid;
[unique] EFS_HASH_BLOB *pHash;
[unique] [charset(UTF16),string] uint16 *lpDisplayInformation;
} ENCRYPTION_CERTIFICATE_HASH;
typedef struct {
uint32 nCert_Hash;
/* this is a pointer to an array of pointers */
[size_is(nCert_Hash)] ENCRYPTION_CERTIFICATE_HASH *pUsers[*];
} ENCRYPTION_CERTIFICATE_HASH_LIST;
WERROR EfsRpcQueryUsersOnFile(
[in] [charset(UTF16),string] uint16 FileName[],
[out,ref,unique] ENCRYPTION_CERTIFICATE_HASH_LIST **pUsers
);
WERROR EfsRpcQueryRecoveryAgents(
[in] [charset(UTF16),string] uint16 FileName[],
[out,ref,unique] ENCRYPTION_CERTIFICATE_HASH_LIST **pRecoveryAgents
);
WERROR EfsRpcRemoveUsersFromFile(
[in] [charset(UTF16),string] uint16 FileName[]
/* [in] ENCRYPTION_CERTIFICATE_LIST Hashes*/
);
WERROR EfsRpcAddUsersToFile(
[in] [charset(UTF16),string] uint16 FileName[]
/* [in] ENCRYPTION_CERTIFICATE_LIST Hashes*/
);
typedef struct {
uint32 dwCertEncodingType;
uint32 cbData;
[size_is(cbData)] [unique] uint8 *pbData;
} EFS_CERTIFICATE_BLOB;
typedef struct {
uint32 TotalLength;
[unique] dom_sid *pUserSid;
[unique] EFS_CERTIFICATE_BLOB *pCertBlob;
} ENCRYPTION_CERTIFICATE;
WERROR EfsRpcSetFileEncryptionKey(
[in] [unique] ENCRYPTION_CERTIFICATE *pEncryptionCertificate
);
WERROR EfsRpcNotSupported(
);
WERROR EfsRpcFileKeyInfo(
);
WERROR EfsRpcDuplicateEncryptionInfoFile(
);
}
+302
View File
@@ -0,0 +1,302 @@
#include "idl_types.h"
/*
endpoint mapper interface
Related links:
http://www.opengroup.org/onlinepubs/9629399/apdxl.htm : Details on towers
http://www.opengroup.org/onlinepubs/9629399/chap6.htm#tagcjh_11_02_03_01: binding strings
*/
[
uuid("e1af8308-5d1f-11c9-91a4-08002b14a0fa"),
version(3.0),
endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]",
"ncalrpc:[EPMAPPER]"),
helpstring("EndPoint Mapper"),
pointer_default(ptr)
]
interface epmapper
{
/*
note that the following IDL won't work in MIDL, and in fact
that the full towers/floors representation of epm cannot be
represented in MIDL at all. I decided to represent it using
the extended IDL syntax in pidl to make it easier to work
with.
*/
const int EPMAPPER_STATUS_NO_MORE_ENTRIES = 0x16c9a0d6;
const int EPMAPPER_STATUS_NO_MEMORY = 0x16C9A012;
const int EPMAPPER_STATUS_OK = 0;
typedef [enum8bit] enum {
/* Level 4 and higher */
EPM_PROTOCOL_DNET_NSP = 0x04,
EPM_PROTOCOL_OSI_TP4 = 0x05,
EPM_PROTOCOL_OSI_CLNS = 0x06,
EPM_PROTOCOL_TCP = 0x07,
EPM_PROTOCOL_UDP = 0x08,
EPM_PROTOCOL_IP = 0x09,
/* These 4 are protocol identifiers, always at level 3 or lower */
EPM_PROTOCOL_NCADG = 0x0a, /* Connectionless RPC */
EPM_PROTOCOL_NCACN = 0x0b,
EPM_PROTOCOL_NCALRPC = 0x0c, /* Local RPC */
EPM_PROTOCOL_UUID = 0x0d,
EPM_PROTOCOL_IPX = 0x0e,
EPM_PROTOCOL_SMB = 0x0f,
EPM_PROTOCOL_PIPE = 0x10,
EPM_PROTOCOL_NETBIOS = 0x11,
EPM_PROTOCOL_NETBEUI = 0x12,
EPM_PROTOCOL_SPX = 0x13,
EPM_PROTOCOL_NB_IPX = 0x14, /* NetBIOS over IPX */
EPM_PROTOCOL_DSP = 0x16, /* AppleTalk Data Stream Protocol */
EPM_PROTOCOL_DDP = 0x17, /* AppleTalk Data Datagram Protocol */
EPM_PROTOCOL_APPLETALK = 0x18, /* AppleTalk */
EPM_PROTOCOL_VINES_SPP = 0x1a,
EPM_PROTOCOL_VINES_IPC = 0x1b, /* Inter Process Communication */
EPM_PROTOCOL_STREETTALK = 0x1c, /* Vines Streettalk */
EPM_PROTOCOL_HTTP = 0x1f,
EPM_PROTOCOL_UNIX_DS = 0x20, /* Unix domain socket */
EPM_PROTOCOL_NULL = 0x21
} epm_protocol;
typedef struct {
/*FIXME */
} epm_rhs_dnet_nsp;
typedef struct {
/*FIXME*/
} epm_rhs_osi_tp4;
typedef struct {
/*FIXME*/
} epm_rhs_osi_clns;
typedef struct {
uint16 port;
} epm_rhs_udp;
typedef struct {
uint16 port;
} epm_rhs_tcp;
typedef struct {
ipv4address ipaddr;
} epm_rhs_ip;
typedef struct {
uint16 minor_version;
} epm_rhs_ncadg;
typedef struct {
uint16 minor_version;
} epm_rhs_ncacn;
typedef struct {
[flag(NDR_REMAINING)] DATA_BLOB unknown;
} epm_rhs_uuid;
typedef struct {
/*FIXME */
} epm_rhs_ipx;
typedef struct {
astring unc;
} epm_rhs_smb;
typedef struct {
astring path;
} epm_rhs_pipe;
typedef struct {
astring name;
} epm_rhs_netbios;
typedef struct {
} epm_rhs_netbeui;
typedef struct {
} epm_rhs_spx;
typedef struct {
} epm_rhs_nb_ipx;
typedef struct {
uint16 port;
} epm_rhs_http;
typedef struct {
astring path;
} epm_rhs_unix_ds;
typedef struct {
} epm_rhs_null;
typedef struct {
uint16 minor_version;
} epm_rhs_ncalrpc;
typedef struct {
} epm_rhs_appletalk;
typedef struct {
} epm_rhs_atalk_stream;
typedef struct {
} epm_rhs_atalk_datagram;
typedef struct {
uint16 port;
} epm_rhs_vines_spp;
typedef struct {
uint16 port;
} epm_rhs_vines_ipc;
typedef struct {
astring streettalk;
} epm_rhs_streettalk;
typedef [flag(NDR_BIG_ENDIAN),nodiscriminant] union {
[case(EPM_PROTOCOL_DNET_NSP)] epm_rhs_dnet_nsp dnet_nsp;
[case(EPM_PROTOCOL_OSI_TP4)] epm_rhs_osi_tp4 osi_tp4;
[case(EPM_PROTOCOL_OSI_CLNS)] epm_rhs_osi_clns osi_clns;
[case(EPM_PROTOCOL_TCP)] epm_rhs_tcp tcp;
[case(EPM_PROTOCOL_UDP)] epm_rhs_udp udp;
[case(EPM_PROTOCOL_IP)] epm_rhs_ip ip;
[case(EPM_PROTOCOL_NCADG)] epm_rhs_ncadg ncadg;
[case(EPM_PROTOCOL_NCACN)] epm_rhs_ncacn ncacn;
[case(EPM_PROTOCOL_NCALRPC)] epm_rhs_ncalrpc ncalrpc;
[case(EPM_PROTOCOL_UUID)] epm_rhs_uuid uuid;
[case(EPM_PROTOCOL_IPX)] epm_rhs_ipx ipx;
[case(EPM_PROTOCOL_SMB)] epm_rhs_smb smb;
[case(EPM_PROTOCOL_PIPE)] epm_rhs_pipe pipe;
[case(EPM_PROTOCOL_NETBIOS)] epm_rhs_netbios netbios;
[case(EPM_PROTOCOL_NETBEUI)] epm_rhs_netbeui netbeui;
[case(EPM_PROTOCOL_SPX)] epm_rhs_spx spx;
[case(EPM_PROTOCOL_NB_IPX)] epm_rhs_nb_ipx nb_ipx;
[case(EPM_PROTOCOL_DSP)] epm_rhs_atalk_stream atalk_stream;
[case(EPM_PROTOCOL_DDP)] epm_rhs_atalk_datagram atalk_datagram;
[case(EPM_PROTOCOL_APPLETALK)] epm_rhs_appletalk appletalk;
[case(EPM_PROTOCOL_VINES_SPP)] epm_rhs_vines_spp vines_spp;
[case(EPM_PROTOCOL_VINES_IPC)] epm_rhs_vines_ipc vines_ipc;
[case(EPM_PROTOCOL_STREETTALK)] epm_rhs_streettalk streettalk;
[case(EPM_PROTOCOL_HTTP)] epm_rhs_http http;
[case(EPM_PROTOCOL_UNIX_DS)] epm_rhs_unix_ds unix_ds;
[case(EPM_PROTOCOL_NULL)] epm_rhs_null null;
[default] [flag(NDR_REMAINING)] DATA_BLOB unknown;
} epm_rhs;
typedef struct {
epm_protocol protocol;
[flag(NDR_REMAINING)] DATA_BLOB lhs_data;
} epm_lhs;
typedef struct {
[subcontext(2)] epm_lhs lhs;
[subcontext(2),switch_is(r->lhs.protocol)] epm_rhs rhs;
} epm_floor;
/* note that the NDR_NOALIGN flag is inherited by all nested
structures. All of the towers/floors stuff is
non-aligned. I wonder what sort of wicked substance these
guys were smoking?
*/
typedef [gensize,flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
uint16 num_floors;
epm_floor floors[num_floors];
} epm_tower;
typedef struct {
[value(ndr_size_epm_tower(&tower, ndr->flags))] uint32 tower_length;
[subcontext(4)] epm_tower tower;
} epm_twr_t;
typedef struct {
GUID object;
epm_twr_t *tower;
ascstr2 annotation;
} epm_entry_t;
typedef struct {
GUID uuid;
uint16 vers_major;
uint16 vers_minor;
} rpc_if_id_t;
/**********************/
/* Function 0x0 */
error_status_t epm_Insert(
[in] uint32 num_ents,
[in,size_is(num_ents)] epm_entry_t entries[],
[in] uint32 replace
);
/**********************/
/* Function 0x1 */
error_status_t epm_Delete(
[in] uint32 num_ents,
[in, size_is(num_ents)] epm_entry_t entries[]
);
/**********************/
/* Function 0x02 */
error_status_t epm_Lookup(
[in] uint32 inquiry_type,
[in,ptr] GUID *object,
[in,ptr] rpc_if_id_t *interface_id,
[in] uint32 vers_option,
[in,out] policy_handle *entry_handle,
[in] uint32 max_ents,
[out] uint32 *num_ents,
[out, length_is(*num_ents), size_is(max_ents)] epm_entry_t entries[]
);
/**********************/
/* Function 0x03 */
typedef struct {
epm_twr_t *twr;
} epm_twr_p_t;
error_status_t epm_Map(
[in,ptr] GUID *object,
[in,ptr] epm_twr_t *map_tower,
[in,out] policy_handle *entry_handle,
[in] uint32 max_towers,
[out] uint32 *num_towers,
[out, length_is(*num_towers), size_is(max_towers)] epm_twr_p_t towers[]
);
/**********************/
/* Function 0x04 */
error_status_t epm_LookupHandleFree(
[in,out] policy_handle *entry_handle
);
/**********************/
/* Function 0x05 */
error_status_t epm_InqObject(
[in] GUID *epm_object
);
/**********************/
/* Function 0x06 */
error_status_t epm_MgmtDelete(
[in] uint32 object_speced,
[in,ptr] GUID *object,
[in,ptr] epm_twr_t *tower
);
/**********************/
/* Function 0x07 */
error_status_t epm_MapAuth();
}
+179
View File
@@ -0,0 +1,179 @@
#include "idl_types.h"
/*
eventlog interface definition
*/
import "lsa.idl", "security.idl";
[ uuid("82273fdc-e32a-18c3-3f78-827929dc23ea"),
version(0.0),
pointer_default(unique),
helpstring("Event Logger")
] interface eventlog
{
typedef bitmap {
EVENTLOG_SEQUENTIAL_READ = 0x0001,
EVENTLOG_SEEK_READ = 0x0002,
EVENTLOG_FORWARDS_READ = 0x0004,
EVENTLOG_BACKWARDS_READ = 0x0008
} eventlogReadFlags;
typedef bitmap {
EVENTLOG_SUCCESS = 0x0000,
EVENTLOG_ERROR_TYPE = 0x0001,
EVENTLOG_WARNING_TYPE = 0x0002,
EVENTLOG_INFORMATION_TYPE = 0x0004,
EVENTLOG_AUDIT_SUCCESS = 0x0008,
EVENTLOG_AUDIT_FAILURE = 0x0010
} eventlogEventTypes;
typedef struct {
uint16 unknown0;
uint16 unknown1;
} eventlog_OpenUnknown0;
typedef [public] struct {
uint32 size;
uint32 reserved;
uint32 record_number;
uint32 time_generated;
uint32 time_written;
uint32 event_id;
uint16 event_type;
uint16 num_of_strings;
uint16 event_category;
uint16 reserved_flags;
uint32 closing_record_number;
uint32 stringoffset;
uint32 sid_length;
uint32 sid_offset;
uint32 data_length;
uint32 data_offset;
nstring source_name;
nstring computer_name;
/* FIXME:LOW pidl does not like it anymore nstring strings[num_of_strings]; */
astring raw_data;
} eventlog_Record;
/******************/
/* Function: 0x00 */
NTSTATUS eventlog_ClearEventLogW(
[in] policy_handle *handle,
[in,unique] lsa_String *unknown
);
/******************/
/* Function: 0x01 */
NTSTATUS eventlog_BackupEventLogW();
/******************/
/* Function: 0x02 */
NTSTATUS eventlog_CloseEventLog(
[in,out] policy_handle *handle
);
/******************/
/* Function: 0x03 */
NTSTATUS eventlog_DeregisterEventSource();
/******************/
/* Function: 0x04 */
NTSTATUS eventlog_GetNumRecords(
[in] policy_handle *handle,
[out] uint32 *number
);
/******************/
/* Function: 0x05 */
NTSTATUS eventlog_GetOldestRecord();
/******************/
/* Function: 0x06 */
NTSTATUS eventlog_ChangeNotify();
/******************/
/* Function: 0x07 */
NTSTATUS eventlog_OpenEventLogW(
[in,unique] eventlog_OpenUnknown0 *unknown0,
[in] lsa_String logname,
[in] lsa_String servername,
[in] uint32 unknown2,
[in] uint32 unknown3,
[out] policy_handle *handle
);
/******************/
/* Function: 0x08 */
NTSTATUS eventlog_RegisterEventSourceW();
/******************/
/* Function: 0x09 */
NTSTATUS eventlog_OpenBackupEventLogW();
/******************/
/* Function: 0x0a */
NTSTATUS eventlog_ReadEventLogW(
[in] policy_handle *handle,
[in] uint32 flags,
[in] uint32 offset,
[in] uint32 number_of_bytes,
[out,size_is(number_of_bytes)] uint8 *data,
[out] uint32 *sent_size,
[out] uint32 *real_size
);
/*****************/
/* Function 0x0b */
NTSTATUS eventlog_ReportEventW();
/*****************/
/* Function 0x0c */
NTSTATUS eventlog_ClearEventLogA();
/******************/
/* Function: 0x0d */
NTSTATUS eventlog_BackupEventLogA();
/*****************/
/* Function 0x0e */
NTSTATUS eventlog_OpenEventLogA();
/*****************/
/* Function 0x0f */
NTSTATUS eventlog_RegisterEventSourceA();
/*****************/
/* Function 0x10 */
NTSTATUS eventlog_OpenBackupEventLogA();
/*****************/
/* Function 0x11 */
NTSTATUS eventlog_ReadEventLogA();
/*****************/
/* Function 0x12 */
NTSTATUS eventlog_ReportEventA();
/*****************/
/* Function 0x13 */
NTSTATUS eventlog_RegisterClusterSvc();
/*****************/
/* Function 0x14 */
NTSTATUS eventlog_DeregisterClusterSvc();
/*****************/
/* Function 0x15 */
NTSTATUS eventlog_WriteClusterEvents();
/*****************/
/* Function 0x16 */
NTSTATUS eventlog_GetLogIntormation();
/*****************/
/* Function 0x17 */
NTSTATUS eventlog_FlushEventLog(
[in] policy_handle *handle
);
}
+49
View File
@@ -0,0 +1,49 @@
[
uuid("d049b186-814f-11d1-9a3c-00c04fc9b232"),
version(1.1),
endpoint("ncacn_ip_tcp:", "ncalrpc:"),
helpstring("File Replication API"),
pointer_default(unique)
]
interface frsapi
{
/****************/
/* Function 0x00 */
void FRSAPI_VERIFY_PROMOTION();
/****************/
/* Function 0x01 */
void FRSAPI_PROMOTION_STATUS();
/****************/
/* Function 0x02 */
void FRSAPI_START_DEMOTION();
/****************/
/* Function 0x03 */
void FRSAPI_COMMIT_DEMOTION();
/****************/
/* Function 0x04 */
void FRSAPI_SET_DS_POLLING_INTERVAL_W();
/****************/
/* Function 0x05 */
void FRSAPI_GET_DS_POLLING_INTERVAL_W();
/****************/
/* Function 0x06 */
void FRSAPI_VERIFY_PROMOTION_W();
/****************/
/* Function 0x07 */
void FRSAPI_INFO_W();
/****************/
/* Function 0x08 */
void FRSAPI_IS_PATH_REPLICATED();
/****************/
/* Function 0x09 */
void FRSAPI_WRITER_COMMAND();
}
+53
View File
@@ -0,0 +1,53 @@
[
uuid("f5cc59b4-4264-101a-8c59-08002b2f8426"),
version(1.1),
endpoint("ncacn_ip_tcp:", "ncalrpc:"),
helpstring("File Replication Service"),
pointer_default(unique)
]
interface frsrpc
{
/*****************/
/* Function 0x00 */
void FRSRPC_SEND_COMM_PKT();
/*****************/
/* Function 0x01 */
void FRSRPC_VERIFY_PROMOTION_PARENT();
/*****************/
/* Function 0x02 */
void FRSRPC_START_PROMOTION_PARENT();
/*****************/
/* Function 0x03 */
void FRSRPC_NOP();
/*****************/
/* Function 0x04 */
void FRSRPC_BACKUP_COMPLETE();
/*****************/
/* Function 0x05 */
void FRSRPC_BACKUP_COMPLETE_5();
/*****************/
/* Function 0x06 */
void FRSRPC_BACKUP_COMPLETE_6();
/*****************/
/* Function 0x07 */
void FRSRPC_BACKUP_COMPLETE_7();
/*****************/
/* Function 0x08 */
void FRSRPC_BACKUP_COMPLETE_8();
/*****************/
/* Function 0x09 */
void FRSRPC_BACKUP_COMPLETE_9();
/*****************/
/* Function 0x0a */
void FRSRPC_VERIFY_PROMOTION_PARENT_EX();
}
+86
View File
@@ -0,0 +1,86 @@
#define STR_ASCII LIBNDR_FLAG_STR_ASCII
#define STR_LEN4 LIBNDR_FLAG_STR_LEN4
#define STR_SIZE4 LIBNDR_FLAG_STR_SIZE4
#define STR_SIZE2 LIBNDR_FLAG_STR_SIZE2
#define STR_NOTERM LIBNDR_FLAG_STR_NOTERM
#define STR_NULLTERM LIBNDR_FLAG_STR_NULLTERM
#define STR_BYTESIZE LIBNDR_FLAG_STR_BYTESIZE
#define STR_FIXLEN32 LIBNDR_FLAG_STR_FIXLEN32
#define STR_FIXLEN15 LIBNDR_FLAG_STR_FIXLEN15
#define STR_CONFORMANT LIBNDR_FLAG_STR_CONFORMANT
#define STR_CHARLEN LIBNDR_FLAG_STR_CHARLEN
#define STR_UTF8 LIBNDR_FLAG_STR_UTF8
/*
a UCS2 string prefixed with [size], 32 bits
*/
#define lstring [flag(STR_SIZE4)] string
/*
a null terminated UCS2 string
*/
#define nstring [flag(STR_NULLTERM)] string
/*
fixed length 32 character UCS-2 string
*/
#define string32 [flag(STR_FIXLEN32)] string
/*
fixed length 16 character ascii string
*/
#define astring15 [flag(STR_ASCII|STR_FIXLEN15)] string
/*
an ascii string prefixed with [offset] [length], both 32 bits
null terminated
*/
#define ascstr2 [flag(STR_ASCII|STR_LEN4)] string
/*
an ascii string prefixed with [size], 32 bits
*/
#define asclstr [flag(STR_ASCII|STR_SIZE4)] string
/*
an ascii string prefixed with [size], 16 bits
null terminated
*/
#define ascstr3 [flag(STR_ASCII|STR_SIZE2)] string
/*
an ascii string prefixed with [size] [offset] [length], all 32 bits
not null terminated
*/
#define ascstr_noterm [flag(STR_NOTERM|STR_ASCII|STR_SIZE4|STR_LEN4)] string
/*
a null terminated ascii string
*/
#define astring [flag(STR_ASCII|STR_NULLTERM)] string
/*
a null terminated UTF8 string
*/
#define utf8string [flag(STR_UTF8|STR_NULLTERM)] string
/*
a null terminated UCS2 string
*/
#define nstring_array [flag(STR_NULLTERM)] string_array
#define NDR_NOALIGN LIBNDR_FLAG_NOALIGN
#define NDR_REMAINING LIBNDR_FLAG_REMAINING
#define NDR_ALIGN2 LIBNDR_FLAG_ALIGN2
#define NDR_ALIGN4 LIBNDR_FLAG_ALIGN4
#define NDR_ALIGN8 LIBNDR_FLAG_ALIGN8
/* this flag is used to force a section of IDL as little endian. It is
needed for the epmapper IDL, which is defined as always being LE */
#define NDR_LITTLE_ENDIAN LIBNDR_FLAG_LITTLE_ENDIAN
#define NDR_BIG_ENDIAN LIBNDR_FLAG_BIGENDIAN
/*
this is used to control formatting of uint8 arrays
*/
#define NDR_PAHEX LIBNDR_PRINT_ARRAY_HEX
+46
View File
@@ -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(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,unique] uint16 *hostname,
[in,unique] initshutdown_String *message,
[in] uint32 timeout,
[in] uint8 force_apps,
[in] uint8 reboot
);
WERROR initshutdown_Abort(
[in,unique] uint16 *server
);
WERROR initshutdown_InitEx(
[in,unique] uint16 *hostname,
[in,unique] initshutdown_String *message,
[in] uint32 timeout,
[in] uint8 force_apps,
[in] uint8 reboot,
[in] uint32 reason
);
}
+127
View File
@@ -0,0 +1,127 @@
#include "idl_types.h"
import "security.idl", "nbt.idl";
/*
definitions for irpc primitives
*/
[ uuid("e770c620-0b06-4b5e-8d87-a26e20f28340"),
version(1.0),
pointer_default(unique)
] interface irpc
{
typedef bitmap {
IRPC_FLAG_REPLY = 0x0001
} irpc_flags;
typedef [public,noejs] struct {
GUID uuid;
uint32 if_version;
uint32 callnum;
uint32 callid;
irpc_flags flags;
NTSTATUS status;
} irpc_header;
/******************************************************
uptime call - supported by all messaging servers
*******************************************************/
void irpc_uptime([out,ref] NTTIME *start_time);
/******************************************************
management calls for the nbt server
******************************************************/
typedef [v1_enum] enum {
NBTD_INFO_STATISTICS
} nbtd_info_level;
typedef struct {
hyper total_received;
hyper total_sent;
hyper query_count;
hyper register_count;
hyper release_count;
} nbtd_statistics;
typedef union {
[case(NBTD_INFO_STATISTICS)] nbtd_statistics *stats;
} nbtd_info;
void nbtd_information(
[in] nbtd_info_level level,
[out,switch_is(level)] nbtd_info info
);
void nbtd_getdcname(
[in] astring domainname,
[in] astring ip_address,
[in] astring my_computername,
[in] astring my_accountname,
[in] uint32 account_control,
[in] dom_sid *domain_sid,
[out,unique] astring *dcname
);
typedef [noejs] struct {
ipv4address addr;
} nbtd_proxy_wins_addr;
[noejs] void nbtd_proxy_wins_challenge(
[in] nbt_name name,
[in,out] uint32 num_addrs,
[in,out] nbtd_proxy_wins_addr addrs[num_addrs]
);
[noejs] void nbtd_proxy_wins_release_demand(
[in] nbt_name name,
[in] uint32 num_addrs,
[in] nbtd_proxy_wins_addr addrs[num_addrs]
);
/******************************************************
management calls for the smb server
******************************************************/
typedef [v1_enum] enum {
SMBSRV_INFO_SESSIONS,
SMBSRV_INFO_TCONS
} smbsrv_info_level;
typedef struct {
hyper vuid;
astring account_name;
astring domain_name;
astring client_ip;
NTTIME connect_time;
NTTIME auth_time;
NTTIME last_use_time;
} smbsrv_session_info;
typedef struct {
uint32 num_sessions;
[size_is(num_sessions)] smbsrv_session_info *sessions;
} smbsrv_sessions;
typedef struct {
uint32 tid;
astring share_name;
astring client_ip;
NTTIME connect_time;
NTTIME last_use_time;
} smbsrv_tcon_info;
typedef struct {
uint32 num_tcons;
[size_is(num_tcons)] smbsrv_tcon_info *tcons;
} smbsrv_tcons;
typedef union {
[case(SMBSRV_INFO_SESSIONS)] smbsrv_sessions sessions;
[case(SMBSRV_INFO_TCONS)] smbsrv_tcons tcons;
} smbsrv_info;
void smbsrv_information(
[in] smbsrv_info_level level,
[out,switch_is(level)] smbsrv_info info
);
}
+16
View File
@@ -0,0 +1,16 @@
/*
cryptographic key services interface
*/
/* Also seen as: 0d72a7d4-6148-11d1-b4aa-00c04fb66ea0 */
[
uuid("8d0ffe72-d252-11d0-bf8f-00c04fd9126b"),
pointer_default(unique),
version(1.0),
helpstring("Cryptographic Key Services")
]
interface keysvc
{
WERROR keysvc_Unknown0();
}
+96
View File
@@ -0,0 +1,96 @@
/*
krb5 PAC
*/
#include "idl_types.h"
import "security.idl", "netlogon.idl", "samr.idl";
[
uuid("12345778-1234-abcd-0000-00000000"),
version(0.0),
pointer_default(unique),
helpstring("Active Directory KRB5 PAC")
]
interface krb5pac
{
typedef struct {
NTTIME logon_time;
[flag(STR_SIZE2|STR_NOTERM|STR_BYTESIZE)] string account_name;
} PAC_LOGON_NAME;
typedef [public,flag(NDR_PAHEX)] struct {
uint32 type;
[flag(NDR_REMAINING)] DATA_BLOB signature;
} PAC_SIGNATURE_DATA;
typedef [gensize] struct {
netr_SamInfo3 info3;
dom_sid2 *res_group_dom_sid;
samr_RidWithAttributeArray res_groups;
} PAC_LOGON_INFO;
typedef struct {
[value(0x00081001)] uint32 unknown1;
[value(0xCCCCCCCC)] uint32 unknown2;
[value(NDR_ROUND(ndr_size_PAC_LOGON_INFO(info, ndr->flags)+4,8))] uint32 _ndr_size;
[value(0x00000000)] uint32 unknown3;
PAC_LOGON_INFO *info;
} PAC_LOGON_INFO_CTR;
typedef [public,v1_enum] enum {
PAC_TYPE_LOGON_INFO = 1,
PAC_TYPE_SRV_CHECKSUM = 6,
PAC_TYPE_KDC_CHECKSUM = 7,
PAC_TYPE_LOGON_NAME = 10
} PAC_TYPE;
typedef [public,nodiscriminant,gensize] union {
[case(PAC_TYPE_LOGON_INFO)] PAC_LOGON_INFO_CTR logon_info;
[case(PAC_TYPE_SRV_CHECKSUM)] PAC_SIGNATURE_DATA srv_cksum;
[case(PAC_TYPE_KDC_CHECKSUM)] PAC_SIGNATURE_DATA kdc_cksum;
[case(PAC_TYPE_LOGON_NAME)] PAC_LOGON_NAME logon_name;
} PAC_INFO;
typedef [public,nopush,nopull,noprint] struct {
PAC_TYPE type;
[value(_ndr_size_PAC_INFO(info, type, 0))] uint32 _ndr_size;
[relative,switch_is(type),subcontext(0),subcontext_size(_subcontext_size_PAC_INFO(r, ndr->flags)),flag(NDR_ALIGN8)] PAC_INFO *info;
[value(0)] uint32 _pad; /* Top half of a 64 bit pointer? */
} PAC_BUFFER;
typedef [public] struct {
uint32 num_buffers;
uint32 version;
PAC_BUFFER buffers[num_buffers];
} PAC_DATA;
typedef struct {
[flag(NDR_REMAINING)] DATA_BLOB remaining;
} DATA_BLOB_REM;
typedef [public] struct {
PAC_TYPE type;
uint32 ndr_size;
[relative,subcontext(0),subcontext_size(NDR_ROUND(r->ndr_size,8)),flag(NDR_ALIGN8)] DATA_BLOB_REM *info;
[value(0)] uint32 _pad; /* Top half of a 64 bit pointer? */
} PAC_BUFFER_RAW;
typedef [public] struct {
uint32 num_buffers;
uint32 version;
PAC_BUFFER_RAW buffers[num_buffers];
} PAC_DATA_RAW;
void decode_pac(
[in] PAC_DATA pac
);
void decode_pac_raw(
[in] PAC_DATA_RAW pac
);
void decode_login_info(
[in] PAC_LOGON_INFO logon_info
);
}
+976
View File
@@ -0,0 +1,976 @@
#include "idl_types.h"
/*
lsa interface definition
*/
import "security.idl";
[ uuid("12345778-1234-abcd-ef00-0123456789ab"),
version(0.0),
endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\netlogon]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
helpstring("Local Security Authority")
] interface lsarpc
{
declare bitmap security_secinfo;
typedef [public,noejs] struct {
[value(2*strlen_m(string))] uint16 length;
[value(2*strlen_m(string))] uint16 size;
[charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string;
} lsa_String;
typedef [public] struct {
[value(2*strlen_m(string))] uint16 length;
[value(2*(strlen_m(string)+1))] uint16 size;
[charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string;
} lsa_StringLarge;
typedef [public] struct {
uint32 count;
[size_is(count)] lsa_String *names;
} lsa_Strings;
typedef [public] struct {
[value(strlen_m(string))] uint16 length;
[value(strlen_m(string))] uint16 size;
ascstr_noterm *string;
} lsa_AsciiString;
/******************/
/* Function: 0x00 */
NTSTATUS lsa_Close (
[in,out] policy_handle *handle
);
/******************/
/* Function: 0x01 */
NTSTATUS lsa_Delete (
[in] policy_handle *handle
);
/******************/
/* Function: 0x02 */
typedef struct {
uint32 low;
uint32 high;
} lsa_LUID;
typedef struct {
lsa_StringLarge name;
lsa_LUID luid;
} lsa_PrivEntry;
typedef struct {
uint32 count;
[size_is(count)] lsa_PrivEntry *privs;
} lsa_PrivArray;
NTSTATUS lsa_EnumPrivs (
[in] policy_handle *handle,
[in,out] uint32 *resume_handle,
[in] uint32 max_count,
[out] lsa_PrivArray *privs
);
/******************/
/* Function: 0x03 */
NTSTATUS lsa_QuerySecurity (
[in] policy_handle *handle,
[in] security_secinfo sec_info,
[out,unique] sec_desc_buf *sdbuf
);
/******************/
/* Function: 0x04 */
NTSTATUS lsa_SetSecObj ();
/******************/
/* Function: 0x05 */
NTSTATUS lsa_ChangePassword ();
/******************/
/* Function: 0x06 */
typedef struct {
uint32 len; /* ignored */
uint16 impersonation_level;
uint8 context_mode;
uint8 effective_only;
} lsa_QosInfo;
typedef struct {
uint32 len; /* ignored */
uint8 *root_dir;
[string,charset(UTF16)] uint16 *object_name;
uint32 attributes;
security_descriptor *sec_desc;
lsa_QosInfo *sec_qos;
} lsa_ObjectAttribute;
/* notice the screwup with the system_name - thats why MS created
OpenPolicy2 */
NTSTATUS lsa_OpenPolicy (
[in,unique] uint16 *system_name,
[in] lsa_ObjectAttribute *attr,
[in] uint32 access_mask,
[out] policy_handle *handle
);
/******************/
/* Function: 0x07 */
typedef struct {
uint32 percent_full;
uint32 log_size;
NTTIME retention_time;
uint8 shutdown_in_progress;
NTTIME time_to_shutdown;
uint32 next_audit_record;
uint32 unknown;
} lsa_AuditLogInfo;
typedef struct {
uint32 auditing_mode;
[size_is(count)] uint32 *settings;
uint32 count;
} lsa_AuditEventsInfo;
typedef struct {
lsa_StringLarge name;
dom_sid2 *sid;
} lsa_DomainInfo;
typedef struct {
lsa_String name;
} lsa_PDAccountInfo;
typedef struct {
uint16 unknown; /* an midl padding bug? */
uint16 role;
} lsa_ServerRole;
typedef struct {
lsa_String source;
lsa_String account;
} lsa_ReplicaSourceInfo;
typedef struct {
uint32 paged_pool;
uint32 non_paged_pool;
uint32 min_wss;
uint32 max_wss;
uint32 pagefile;
hyper unknown;
} lsa_DefaultQuotaInfo;
typedef struct {
hyper modified_id;
NTTIME db_create_time;
} lsa_ModificationInfo;
typedef struct {
uint8 shutdown_on_full;
} lsa_AuditFullSetInfo;
typedef struct {
uint16 unknown; /* an midl padding bug? */
uint8 shutdown_on_full;
uint8 log_is_full;
} lsa_AuditFullQueryInfo;
typedef struct {
/* it's important that we use the lsa_StringLarge here,
* because otherwise windows clients result with such dns hostnames
* e.g. w2k3-client.samba4.samba.orgsamba4.samba.org
* where it should be
* w2k3-client.samba4.samba.org
*/
lsa_StringLarge name;
lsa_StringLarge dns_domain;
lsa_StringLarge dns_forest;
GUID domain_guid;
dom_sid2 *sid;
} lsa_DnsDomainInfo;
typedef enum {
LSA_POLICY_INFO_AUDIT_LOG=1,
LSA_POLICY_INFO_AUDIT_EVENTS=2,
LSA_POLICY_INFO_DOMAIN=3,
LSA_POLICY_INFO_PD=4,
LSA_POLICY_INFO_ACCOUNT_DOMAIN=5,
LSA_POLICY_INFO_ROLE=6,
LSA_POLICY_INFO_REPLICA=7,
LSA_POLICY_INFO_QUOTA=8,
LSA_POLICY_INFO_DB=9,
LSA_POLICY_INFO_AUDIT_FULL_SET=10,
LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
LSA_POLICY_INFO_DNS=12
} lsaPolicyInfo;
typedef [switch_type(uint16)] union {
[case(LSA_POLICY_INFO_AUDIT_LOG)] lsa_AuditLogInfo audit_log;
[case(LSA_POLICY_INFO_AUDIT_EVENTS)] lsa_AuditEventsInfo audit_events;
[case(LSA_POLICY_INFO_DOMAIN)] lsa_DomainInfo domain;
[case(LSA_POLICY_INFO_PD)] lsa_PDAccountInfo pd;
[case(LSA_POLICY_INFO_ACCOUNT_DOMAIN)] lsa_DomainInfo account_domain;
[case(LSA_POLICY_INFO_ROLE)] lsa_ServerRole role;
[case(LSA_POLICY_INFO_REPLICA)] lsa_ReplicaSourceInfo replica;
[case(LSA_POLICY_INFO_QUOTA)] lsa_DefaultQuotaInfo quota;
[case(LSA_POLICY_INFO_DB)] lsa_ModificationInfo db;
[case(LSA_POLICY_INFO_AUDIT_FULL_SET)] lsa_AuditFullSetInfo auditfullset;
[case(LSA_POLICY_INFO_AUDIT_FULL_QUERY)] lsa_AuditFullQueryInfo auditfullquery;
[case(LSA_POLICY_INFO_DNS)] lsa_DnsDomainInfo dns;
} lsa_PolicyInformation;
NTSTATUS lsa_QueryInfoPolicy (
[in] policy_handle *handle,
[in] uint16 level,
[out,unique,switch_is(level)] lsa_PolicyInformation *info
);
/******************/
/* Function: 0x08 */
NTSTATUS lsa_SetInfoPolicy ();
/******************/
/* Function: 0x09 */
NTSTATUS lsa_ClearAuditLog ();
/******************/
/* Function: 0x0a */
NTSTATUS lsa_CreateAccount (
[in] policy_handle *handle,
[in] dom_sid2 *sid,
[in] uint32 access_mask,
[out] policy_handle *acct_handle
);
/******************/
/* NOTE: This only returns accounts that have at least
one privilege set
*/
/* Function: 0x0b */
typedef struct {
dom_sid2 *sid;
} lsa_SidPtr;
typedef [public] struct {
[range(0,1000)] uint32 num_sids;
[size_is(num_sids)] lsa_SidPtr *sids;
} lsa_SidArray;
NTSTATUS lsa_EnumAccounts (
[in] policy_handle *handle,
[in,out] uint32 *resume_handle,
[in,range(0,8192)] uint32 num_entries,
[out] lsa_SidArray *sids
);
/*************************************************/
/* Function: 0x0c */
NTSTATUS lsa_CreateTrustedDomain(
[in] policy_handle *handle,
[in] lsa_DomainInfo *info,
[in] uint32 access_mask,
[out] policy_handle *trustdom_handle
);
/******************/
/* Function: 0x0d */
/* w2k3 treats max_size as max_domains*60 */
const int LSA_ENUM_TRUST_DOMAIN_MULTIPLIER = 60;
typedef struct {
uint32 count;
[size_is(count)] lsa_DomainInfo *domains;
} lsa_DomainList;
NTSTATUS lsa_EnumTrustDom (
[in] policy_handle *handle,
[in,out] uint32 *resume_handle,
[in,range(0,1000)] uint32 max_size,
[out] lsa_DomainList *domains
);
/******************/
/* Function: 0x0e */
typedef enum {
SID_NAME_USE_NONE = 0,/* NOTUSED */
SID_NAME_USER = 1, /* user */
SID_NAME_DOM_GRP = 2, /* domain group */
SID_NAME_DOMAIN = 3, /* domain: don't know what this is */
SID_NAME_ALIAS = 4, /* local group */
SID_NAME_WKN_GRP = 5, /* well-known group */
SID_NAME_DELETED = 6, /* deleted account: needed for c2 rating */
SID_NAME_INVALID = 7, /* invalid account */
SID_NAME_UNKNOWN = 8, /* oops. */
SID_NAME_COMPUTER = 9 /* machine */
} lsa_SidType;
typedef struct {
lsa_SidType sid_type;
uint32 rid;
uint32 sid_index;
} lsa_TranslatedSid;
typedef struct {
[range(0,1000)] uint32 count;
[size_is(count)] lsa_TranslatedSid *sids;
} lsa_TransSidArray;
const int LSA_REF_DOMAIN_LIST_MULTIPLIER = 32;
typedef struct {
[range(0,1000)] uint32 count;
[size_is(count)] lsa_DomainInfo *domains;
uint32 max_size;
} lsa_RefDomainList;
NTSTATUS lsa_LookupNames (
[in] policy_handle *handle,
[in,range(0,1000)] uint32 num_names,
[in,size_is(num_names)] lsa_String names[],
[out,unique] lsa_RefDomainList *domains,
[in,out] lsa_TransSidArray *sids,
[in] uint16 level,
[in,out] uint32 *count
);
/******************/
/* Function: 0x0f */
typedef struct {
lsa_SidType sid_type;
lsa_String name;
uint32 sid_index;
} lsa_TranslatedName;
typedef struct {
[range(0,1000)] uint32 count;
[size_is(count)] lsa_TranslatedName *names;
} lsa_TransNameArray;
NTSTATUS lsa_LookupSids (
[in] policy_handle *handle,
[in] lsa_SidArray *sids,
[out,unique] lsa_RefDomainList *domains,
[in,out] lsa_TransNameArray *names,
[in] uint16 level,
[in,out] uint32 *count
);
/* Function: 0x10 */
NTSTATUS lsa_CreateSecret(
[in] policy_handle *handle,
[in] lsa_String name,
[in] uint32 access_mask,
[out] policy_handle *sec_handle
);
/*****************************************/
/* Function: 0x11 */
NTSTATUS lsa_OpenAccount (
[in] policy_handle *handle,
[in] dom_sid2 *sid,
[in] uint32 access_mask,
[out] policy_handle *acct_handle
);
/****************************************/
/* Function: 0x12 */
typedef struct {
lsa_LUID luid;
uint32 attribute;
} lsa_LUIDAttribute;
typedef struct {
[range(0,1000)] uint32 count;
uint32 unknown;
[size_is(count)] lsa_LUIDAttribute set[*];
} lsa_PrivilegeSet;
NTSTATUS lsa_EnumPrivsAccount (
[in] policy_handle *handle,
[out,unique] lsa_PrivilegeSet *privs
);
/****************************************/
/* Function: 0x13 */
NTSTATUS lsa_AddPrivilegesToAccount(
[in] policy_handle *handle,
[in] lsa_PrivilegeSet *privs
);
/****************************************/
/* Function: 0x14 */
NTSTATUS lsa_RemovePrivilegesFromAccount(
[in] policy_handle *handle,
[in] uint8 remove_all,
[in,unique] lsa_PrivilegeSet *privs
);
/* Function: 0x15 */
NTSTATUS lsa_GetQuotasForAccount();
/* Function: 0x16 */
NTSTATUS lsa_SetQuotasForAccount();
/* Function: 0x17 */
NTSTATUS lsa_GetSystemAccessAccount();
/* Function: 0x18 */
NTSTATUS lsa_SetSystemAccessAccount();
/* Function: 0x19 */
NTSTATUS lsa_OpenTrustedDomain(
[in] policy_handle *handle,
[in] dom_sid2 *sid,
[in] uint32 access_mask,
[out] policy_handle *trustdom_handle
);
typedef [flag(NDR_PAHEX)] struct {
uint32 length;
uint32 size;
[size_is(size),length_is(length)] uint8 *data;
} lsa_DATA_BUF;
typedef [flag(NDR_PAHEX)] struct {
[range(0,65536)] uint32 size;
[size_is(size)] uint8 *data;
} lsa_DATA_BUF2;
typedef enum {
LSA_TRUSTED_DOMAIN_INFO_NAME = 1,
LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO = 2,
LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET = 3,
LSA_TRUSTED_DOMAIN_INFO_PASSWORD = 4,
LSA_TRUSTED_DOMAIN_INFO_BASIC = 5,
LSA_TRUSTED_DOMAIN_INFO_INFO_EX = 6,
LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO = 7,
LSA_TRUSTED_DOMAIN_INFO_FULL_INFO = 8,
LSA_TRUSTED_DOMAIN_INFO_11 = 11,
LSA_TRUSTED_DOMAIN_INFO_INFO_ALL = 12
} lsa_TrustDomInfoEnum;
typedef struct {
lsa_StringLarge netbios_name;
} lsa_TrustDomainInfoName;
typedef struct {
uint32 posix_offset;
} lsa_TrustDomainInfoPosixOffset;
typedef struct {
lsa_DATA_BUF *password;
lsa_DATA_BUF *old_password;
} lsa_TrustDomainInfoPassword;
typedef struct {
lsa_String netbios_name;
dom_sid2 *sid;
} lsa_TrustDomainInfoBasic;
typedef struct {
lsa_StringLarge domain_name;
lsa_StringLarge netbios_name;
dom_sid2 *sid;
uint32 trust_direction;
uint32 trust_type;
uint32 trust_attributes;
} lsa_TrustDomainInfoInfoEx;
typedef struct {
NTTIME_hyper last_update_time;
uint32 secret_type;
lsa_DATA_BUF2 data;
} lsa_TrustDomainInfoBuffer;
typedef struct {
uint32 incoming_count;
lsa_TrustDomainInfoBuffer *incoming_current_auth_info;
lsa_TrustDomainInfoBuffer *incoming_previous_auth_info;
uint32 outgoing_count;
lsa_TrustDomainInfoBuffer *outgoing_current_auth_info;
lsa_TrustDomainInfoBuffer *outgoing_previous_auth_info;
} lsa_TrustDomainInfoAuthInfo;
typedef struct {
lsa_TrustDomainInfoInfoEx info_ex;
lsa_TrustDomainInfoPosixOffset posix_offset;
lsa_TrustDomainInfoAuthInfo auth_info;
} lsa_TrustDomainInfoFullInfo;
typedef struct {
lsa_TrustDomainInfoInfoEx info_ex;
lsa_DATA_BUF2 data1;
} lsa_TrustDomainInfo11;
typedef struct {
lsa_TrustDomainInfoInfoEx info_ex;
lsa_DATA_BUF2 data1;
lsa_TrustDomainInfoPosixOffset posix_offset;
lsa_TrustDomainInfoAuthInfo auth_info;
} lsa_TrustDomainInfoInfoAll;
typedef [switch_type(lsa_TrustDomInfoEnum)] union {
[case(LSA_TRUSTED_DOMAIN_INFO_NAME)] lsa_TrustDomainInfoName name;
[case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)] lsa_TrustDomainInfoPosixOffset posix_offset;
[case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)] lsa_TrustDomainInfoPassword password;
[case(LSA_TRUSTED_DOMAIN_INFO_BASIC)] lsa_TrustDomainInfoBasic info_basic;
[case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)] lsa_TrustDomainInfoInfoEx info_ex;
[case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)] lsa_TrustDomainInfoAuthInfo auth_info;
[case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)] lsa_TrustDomainInfoFullInfo full_info;
[case(LSA_TRUSTED_DOMAIN_INFO_11)] lsa_TrustDomainInfo11 info11;
[case(LSA_TRUSTED_DOMAIN_INFO_INFO_ALL)] lsa_TrustDomainInfoInfoAll info_all;
} lsa_TrustedDomainInfo;
/* Function: 0x1a */
NTSTATUS lsa_QueryTrustedDomainInfo(
[in] policy_handle *trustdom_handle,
[in] lsa_TrustDomInfoEnum level,
[out,switch_is(level),unique] lsa_TrustedDomainInfo *info
);
/* Function: 0x1b */
NTSTATUS lsa_SetInformationTrustedDomain();
/* Function: 0x1c */
NTSTATUS lsa_OpenSecret(
[in] policy_handle *handle,
[in] lsa_String name,
[in] uint32 access_mask,
[out] policy_handle *sec_handle
);
/* Function: 0x1d */
NTSTATUS lsa_SetSecret(
[in] policy_handle *sec_handle,
[in,unique] lsa_DATA_BUF *new_val,
[in,unique] lsa_DATA_BUF *old_val
);
typedef struct {
lsa_DATA_BUF *buf;
} lsa_DATA_BUF_PTR;
/* Function: 0x1e */
NTSTATUS lsa_QuerySecret (
[in] policy_handle *sec_handle,
[in,out,unique] lsa_DATA_BUF_PTR *new_val,
[in,out,unique] NTTIME_hyper *new_mtime,
[in,out,unique] lsa_DATA_BUF_PTR *old_val,
[in,out,unique] NTTIME_hyper *old_mtime
);
/* Function: 0x1f */
NTSTATUS lsa_LookupPrivValue(
[in] policy_handle *handle,
[in] lsa_String *name,
[out] lsa_LUID *luid
);
/* Function: 0x20 */
NTSTATUS lsa_LookupPrivName (
[in] policy_handle *handle,
[in] lsa_LUID *luid,
[out,unique] lsa_StringLarge *name
);
/*******************/
/* Function: 0x21 */
NTSTATUS lsa_LookupPrivDisplayName (
[in] policy_handle *handle,
[in] lsa_String *name,
[out,unique] lsa_StringLarge *disp_name,
/* see http://www.microsoft.com/globaldev/nlsweb/ for
language definitions */
[in,out] uint16 *language_id,
[in] uint16 unknown
);
/* Function: 0x22 */
NTSTATUS lsa_DeleteObject();
/*******************/
/* Function: 0x23 */
NTSTATUS lsa_EnumAccountsWithUserRight (
[in] policy_handle *handle,
[in,unique] lsa_String *name,
[out] lsa_SidArray *sids
);
/* Function: 0x24 */
typedef struct {
[string,charset(UTF16)] uint16 *name;
} lsa_RightAttribute;
typedef struct {
uint32 count;
[size_is(count)] lsa_StringLarge *names;
} lsa_RightSet;
NTSTATUS lsa_EnumAccountRights (
[in] policy_handle *handle,
[in] dom_sid2 *sid,
[out] lsa_RightSet *rights
);
/**********************/
/* Function: 0x25 */
NTSTATUS lsa_AddAccountRights (
[in] policy_handle *handle,
[in] dom_sid2 *sid,
[in] lsa_RightSet *rights
);
/**********************/
/* Function: 0x26 */
NTSTATUS lsa_RemoveAccountRights (
[in] policy_handle *handle,
[in] dom_sid2 *sid,
[in] uint32 unknown,
[in] lsa_RightSet *rights
);
/* Function: 0x27 */
NTSTATUS lsa_QueryTrustedDomainInfoBySid(
[in] policy_handle *handle,
[in] dom_sid2 *dom_sid,
[in] lsa_TrustDomInfoEnum level,
[out,switch_is(level),unique] lsa_TrustedDomainInfo *info
);
/* Function: 0x28 */
NTSTATUS lsa_SetTrustedDomainInfo();
/* Function: 0x29 */
NTSTATUS lsa_DeleteTrustedDomain(
[in] policy_handle *handle,
[in] dom_sid2 *dom_sid
);
/* Function: 0x2a */
NTSTATUS lsa_StorePrivateData();
/* Function: 0x2b */
NTSTATUS lsa_RetrievePrivateData();
/**********************/
/* Function: 0x2c */
NTSTATUS lsa_OpenPolicy2 (
[in,unique] [string,charset(UTF16)] uint16 *system_name,
[in] lsa_ObjectAttribute *attr,
[in] uint32 access_mask,
[out] policy_handle *handle
);
/**********************/
/* Function: 0x2d */
typedef struct {
lsa_String *string;
} lsa_StringPointer;
NTSTATUS lsa_GetUserName(
[in,unique] [string,charset(UTF16)] uint16 *system_name,
[in,out,unique] lsa_String *account_name,
[in,out,unique] lsa_StringPointer *authority_name
);
/**********************/
/* Function: 0x2e */
NTSTATUS lsa_QueryInfoPolicy2(
[in] policy_handle *handle,
[in] uint16 level,
[out,unique,switch_is(level)] lsa_PolicyInformation *info
);
/* Function 0x2f */
NTSTATUS lsa_SetInfoPolicy2();
/**********************/
/* Function 0x30 */
NTSTATUS lsa_QueryTrustedDomainInfoByName(
[in] policy_handle *handle,
[in] lsa_String trusted_domain,
[in] lsa_TrustDomInfoEnum level,
[out,unique,switch_is(level)] lsa_TrustedDomainInfo *info
);
/**********************/
/* Function 0x31 */
NTSTATUS lsa_SetTrustedDomainInfoByName(
[in] policy_handle *handle,
[in] lsa_String trusted_domain,
[in] lsa_TrustDomInfoEnum level,
[in,unique,switch_is(level)] lsa_TrustedDomainInfo *info
);
/* Function 0x32 */
/* w2k3 treats max_size as max_domains*82 */
const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82;
typedef struct {
uint32 count;
[size_is(count)] lsa_TrustDomainInfoInfoEx *domains;
} lsa_DomainListEx;
NTSTATUS lsa_EnumTrustedDomainsEx (
[in] policy_handle *handle,
[in,out] uint32 *resume_handle,
[out] lsa_DomainListEx *domains,
[in] uint32 max_size
);
/* Function 0x33 */
NTSTATUS lsa_CreateTrustedDomainEx();
/* Function 0x34 */
NTSTATUS lsa_CloseTrustedDomainEx(
[in,out] policy_handle *handle
);
/* Function 0x35 */
/* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000
for unknown6 - gd */
typedef struct {
uint32 enforce_restrictions;
hyper service_tkt_lifetime;
hyper user_tkt_lifetime;
hyper user_tkt_renewaltime;
hyper clock_skew;
hyper unknown6;
} lsa_DomainInfoKerberos;
typedef struct {
uint32 blob_size;
[size_is(blob_size)] uint8 *efs_blob;
} lsa_DomainInfoEfs;
typedef enum {
LSA_DOMAIN_INFO_POLICY_EFS=2,
LSA_DOMAIN_INFO_POLICY_KERBEROS=3
} lsa_DomainInfoEnum;
typedef [switch_type(uint16)] union {
[case(LSA_DOMAIN_INFO_POLICY_EFS)] lsa_DomainInfoEfs efs_info;
[case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos kerberos_info;
} lsa_DomainInformationPolicy;
NTSTATUS lsa_QueryDomainInformationPolicy(
[in] policy_handle *handle,
[in] uint16 level,
[out,unique,switch_is(level)] lsa_DomainInformationPolicy *info
);
/* Function 0x36 */
NTSTATUS lsa_SetDomainInformationPolicy(
[in] policy_handle *handle,
[in] uint16 level,
[in,unique,switch_is(level)] lsa_DomainInformationPolicy *info
);
/**********************/
/* Function 0x37 */
NTSTATUS lsa_OpenTrustedDomainByName(
[in] policy_handle *handle,
[in] lsa_String name,
[in] uint32 access_mask,
[out] policy_handle *trustdom_handle
);
/* Function 0x38 */
NTSTATUS lsa_TestCall();
/**********************/
/* Function 0x39 */
typedef struct {
lsa_SidType sid_type;
lsa_String name;
uint32 sid_index;
uint32 unknown;
} lsa_TranslatedName2;
typedef struct {
[range(0,1000)] uint32 count;
[size_is(count)] lsa_TranslatedName2 *names;
} lsa_TransNameArray2;
NTSTATUS lsa_LookupSids2(
[in] policy_handle *handle,
[in] lsa_SidArray *sids,
[out,unique] lsa_RefDomainList *domains,
[in,out] lsa_TransNameArray2 *names,
[in] uint16 level,
[in,out] uint32 *count,
[in] uint32 unknown1,
[in] uint32 unknown2
);
/**********************/
/* Function 0x3a */
typedef struct {
lsa_SidType sid_type;
uint32 rid;
uint32 sid_index;
uint32 unknown;
} lsa_TranslatedSid2;
typedef struct {
[range(0,1000)] uint32 count;
[size_is(count)] lsa_TranslatedSid2 *sids;
} lsa_TransSidArray2;
NTSTATUS lsa_LookupNames2 (
[in] policy_handle *handle,
[in,range(0,1000)] uint32 num_names,
[in,size_is(num_names)] lsa_String names[],
[out,unique] lsa_RefDomainList *domains,
[in,out] lsa_TransSidArray2 *sids,
[in] uint16 level,
[in,out] uint32 *count,
[in] uint32 unknown1,
[in] uint32 unknown2
);
/* Function 0x3b */
NTSTATUS lsa_CreateTrustedDomainEx2();
/* Function 0x3c */
NTSTATUS lsa_CREDRWRITE();
/* Function 0x3d */
NTSTATUS lsa_CREDRREAD();
/* Function 0x3e */
NTSTATUS lsa_CREDRENUMERATE();
/* Function 0x3f */
NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
/* Function 0x40 */
NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
/* Function 0x41 */
NTSTATUS lsa_CREDRDELETE();
/* Function 0x42 */
NTSTATUS lsa_CREDRGETTARGETINFO();
/* Function 0x43 */
NTSTATUS lsa_CREDRPROFILELOADED();
/**********************/
/* Function 0x44 */
typedef struct {
lsa_SidType sid_type;
dom_sid2 *sid;
uint32 sid_index;
uint32 unknown;
} lsa_TranslatedSid3;
typedef struct {
[range(0,1000)] uint32 count;
[size_is(count)] lsa_TranslatedSid3 *sids;
} lsa_TransSidArray3;
NTSTATUS lsa_LookupNames3 (
[in] policy_handle *handle,
[in,range(0,1000)] uint32 num_names,
[in,size_is(num_names)] lsa_String names[],
[out,unique] lsa_RefDomainList *domains,
[in,out] lsa_TransSidArray3 *sids,
[in] uint16 level,
[in,out] uint32 *count,
[in] uint32 unknown1,
[in] uint32 unknown2
);
/* Function 0x45 */
NTSTATUS lsa_CREDRGETSESSIONTYPES();
/* Function 0x46 */
NTSTATUS lsa_LSARREGISTERAUDITEVENT();
/* Function 0x47 */
NTSTATUS lsa_LSARGENAUDITEVENT();
/* Function 0x48 */
NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
/* Function 0x49 */
NTSTATUS lsa_LSARQUERYFORESTTRUSTINFORMATION();
/* Function 0x4a */
NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
/* Function 0x4b */
NTSTATUS lsa_CREDRRENAME();
/*****************/
/* Function 0x4c */
NTSTATUS lsa_LookupSids3(
[in] lsa_SidArray *sids,
[out,unique] lsa_RefDomainList *domains,
[in,out] lsa_TransNameArray2 *names,
[in] uint16 level,
[in,out] uint32 *count,
[in] uint32 unknown1,
[in] uint32 unknown2
);
/* Function 0x4d */
NTSTATUS lsa_LookupNames4(
[in,range(0,1000)] uint32 num_names,
[in,size_is(num_names)] lsa_String names[],
[out,unique] lsa_RefDomainList *domains,
[in,out] lsa_TransSidArray3 *sids,
[in] uint16 level,
[in,out] uint32 *count,
[in] uint32 unknown1,
[in] uint32 unknown2
);
/* Function 0x4e */
NTSTATUS lsa_LSAROPENPOLICYSCE();
/* Function 0x4f */
NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
/* Function 0x50 */
NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
/* Function 0x51 */
NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
}
+74
View File
@@ -0,0 +1,74 @@
/*
dcerpc remote management interface
*/
[
uuid("afa8bd80-7d8a-11c9-bef4-08002b102989"),
version(1.0),
pointer_default(unique),
endpoint("ncalrpc:[EPMAPPER]", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]"),
helpstring("DCE/RPC Remote Management")
]
interface mgmt
{
typedef struct {
dcerpc_syntax_id *id;
} dcerpc_syntax_id_p;
typedef struct {
uint32 count;
[size_is(count)] dcerpc_syntax_id_p if_id[*];
} rpc_if_id_vector_t;
/***********************/
/* Function 0x00 */
WERROR mgmt_inq_if_ids (
[out,unique] rpc_if_id_vector_t *if_id_vector
);
/***********************/
/* Function 0x01 */
/* these are the array indexes in the statistics array */
const int MGMT_STATS_CALLS_IN = 0;
const int MGMT_STATS_CALLS_OUT = 1;
const int MGMT_STATS_PKTS_IN = 2;
const int MGMT_STATS_PKTS_OUT = 3;
const int MGMT_STATS_ARRAY_MAX_SIZE = 4;
typedef struct {
uint32 count;
[size_is(count)] uint32 statistics[*];
} mgmt_statistics;
WERROR mgmt_inq_stats (
[in] uint32 max_count,
[in] uint32 unknown,
[out] mgmt_statistics statistics
);
/***********************/
/* Function 0x02 */
boolean32 mgmt_is_server_listening (
[out] error_status_t status
);
/***********************/
/* Function 0x03 */
WERROR mgmt_stop_server_listening ();
/***********************/
/* Function 0x04 */
WERROR mgmt_inq_princ_name (
[in] uint32 authn_proto,
[in] uint32 princ_name_size,
[out] [string,charset(DOS)] uint8 princ_name[]
);
}
+48
View File
@@ -0,0 +1,48 @@
/*
miscellaneous IDL structures
*/
[
pointer_default(unique)
]
interface misc
{
typedef [public,noprint,gensize,noejs] struct {
uint32 time_low;
uint16 time_mid;
uint16 time_hi_and_version;
uint8 clock_seq[2];
uint8 node[6];
} GUID;
typedef [public] struct {
uint32 handle_type;
GUID uuid;
} policy_handle;
/* secure channel types */
/* Only SEC_CHAN_WKSTA can forward requests to other domains. */
typedef [public] enum {
SEC_CHAN_WKSTA = 2,
SEC_CHAN_DOMAIN = 4,
SEC_CHAN_BDC = 6
} netr_SchannelType;
/* SAM database types */
typedef [public,v1_enum] enum {
SAM_DATABASE_DOMAIN = 0, /* Domain users and groups */
SAM_DATABASE_BUILTIN = 1, /* BUILTIN users and groups */
SAM_DATABASE_PRIVS = 2 /* Privileges */
} netr_SamDatabaseID;
typedef [public,v1_enum] enum {
SAMR_REJECT_OTHER = 0,
SAMR_REJECT_TOO_SHORT = 1,
SAMR_REJECT_IN_HISTORY = 2,
SAMR_REJECT_COMPLEXITY = 5
} samr_RejectReason;
}
+22
View File
@@ -0,0 +1,22 @@
/* Works over UDP */
[
uuid("17fdd703-1827-4e34-79d4-24a55c53bb37"),
version(1.0),
pointer_default(unique),
helpstring("Messaging Service")
] interface msgsvc
{
void NetrMessageNameAdd();
void NetrMessageNameEnum();
void NetrMessageNameGetInfo();
void NetrMessageNameDel();
}
[
uuid("5a7b91f8-ff00-11d0-a9b2-00c04fb6e6fc"),
version(1.0)
] interface msgsvcsend
{
void NetrSendMessage();
}
+701
View File
@@ -0,0 +1,701 @@
#include "idl_types.h"
/*
IDL structures for NBT operations
NBT is not traditionally encoded using IDL/NDR. This is a bit of an
experiment, and I may well switch us back to a more traditional
encoding if it doesn't work out
*/
import "security.idl", "svcctl.idl";
[
helper("libcli/nbt/nbtname.h")
]
interface nbt
{
const int NBT_NAME_SERVICE_PORT = 137;
const int NBT_DGRAM_SERVICE_PORT = 138;
typedef [bitmap16bit] bitmap {
NBT_RCODE = 0x000F,
NBT_FLAG_BROADCAST = 0x0010,
NBT_FLAG_RECURSION_AVAIL = 0x0080,
NBT_FLAG_RECURSION_DESIRED = 0x0100,
NBT_FLAG_TRUNCATION = 0x0200,
NBT_FLAG_AUTHORITIVE = 0x0400,
NBT_OPCODE = 0x7800,
NBT_FLAG_REPLY = 0x8000
} nbt_operation;
/* the opcodes are in the operation field, masked with
NBT_OPCODE */
typedef enum {
NBT_OPCODE_QUERY = (0x0<<11),
NBT_OPCODE_REGISTER = (0x5<<11),
NBT_OPCODE_RELEASE = (0x6<<11),
NBT_OPCODE_WACK = (0x7<<11),
NBT_OPCODE_REFRESH = (0x8<<11),
NBT_OPCODE_REFRESH2 = (0x9<<11),
NBT_OPCODE_MULTI_HOME_REG = (0xf<<11)
} nbt_opcode;
/* rcode values */
typedef enum {
NBT_RCODE_OK = 0x0,
NBT_RCODE_FMT = 0x1,
NBT_RCODE_SVR = 0x2,
NBT_RCODE_NAM = 0x3,
NBT_RCODE_IMP = 0x4,
NBT_RCODE_RFS = 0x5,
NBT_RCODE_ACT = 0x6,
NBT_RCODE_CFT = 0x7
} nbt_rcode;
/* we support any 8bit name type, but by defining the common
ones here we get better debug displays */
typedef [enum8bit] enum {
NBT_NAME_CLIENT = 0x00,
NBT_NAME_MS = 0x01,
NBT_NAME_USER = 0x03,
NBT_NAME_SERVER = 0x20,
NBT_NAME_PDC = 0x1B,
NBT_NAME_LOGON = 0x1C,
NBT_NAME_MASTER = 0x1D,
NBT_NAME_BROWSER = 0x1E
} nbt_name_type;
/* the ndr parser for nbt_name is separately defined in
nbtname.c (along with the parsers for nbt_string) */
typedef [public,nopull,nopush] struct {
string name;
string scope;
nbt_name_type type;
} nbt_name;
typedef [enum16bit] enum {
NBT_QCLASS_IP = 0x01
} nbt_qclass;
typedef [enum16bit] enum {
NBT_QTYPE_ADDRESS = 0x0001,
NBT_QTYPE_NAMESERVICE = 0x0002,
NBT_QTYPE_NULL = 0x000A,
NBT_QTYPE_NETBIOS = 0x0020,
NBT_QTYPE_STATUS = 0x0021
} nbt_qtype;
typedef struct {
nbt_name name;
nbt_qtype question_type;
nbt_qclass question_class;
} nbt_name_question;
/* these are the possible values of the NBT_NM_OWNER_TYPE
field */
typedef enum {
NBT_NODE_B = 0x0000,
NBT_NODE_P = 0x2000,
NBT_NODE_M = 0x4000,
NBT_NODE_H = 0x6000
} nbt_node_type;
typedef [bitmap16bit] bitmap {
NBT_NM_PERMANENT = 0x0200,
NBT_NM_ACTIVE = 0x0400,
NBT_NM_CONFLICT = 0x0800,
NBT_NM_DEREGISTER = 0x1000,
NBT_NM_OWNER_TYPE = 0x6000,
NBT_NM_GROUP = 0x8000
} nb_flags;
typedef struct {
nb_flags nb_flags;
ipv4address ipaddr;
} nbt_rdata_address;
typedef struct {
uint16 length;
nbt_rdata_address addresses[length/6];
} nbt_rdata_netbios;
typedef struct {
uint8 unit_id[6];
uint8 jumpers;
uint8 test_result;
uint16 version_number;
uint16 period_of_statistics;
uint16 number_of_crcs;
uint16 number_alignment_errors;
uint16 number_of_collisions;
uint16 number_send_aborts;
uint32 number_good_sends;
uint32 number_good_receives;
uint16 number_retransmits;
uint16 number_no_resource_conditions;
uint16 number_free_command_blocks;
uint16 total_number_command_blocks;
uint16 max_total_number_command_blocks;
uint16 number_pending_sessions;
uint16 max_number_pending_sessions;
uint16 max_total_sessions_possible;
uint16 session_data_packet_size;
} nbt_statistics;
typedef struct {
astring15 name;
nbt_name_type type;
nb_flags nb_flags;
} nbt_status_name;
typedef struct {
[value(num_names * 18 + 47)] uint16 length;
uint8 num_names;
nbt_status_name names[num_names];
nbt_statistics statistics;
} nbt_rdata_status;
typedef struct {
uint16 length;
uint8 data[length];
} nbt_rdata_data;
typedef [nodiscriminant] union {
[case(NBT_QTYPE_NETBIOS)] nbt_rdata_netbios netbios;
[case(NBT_QTYPE_STATUS)] nbt_rdata_status status;
[default] nbt_rdata_data data;
} nbt_rdata;
/*
* this macro works arround the problem
* that we need to use nbt_rdata_data
* together with NBT_QTYPE_NETBIOS
* for WACK replies
*/
#define NBT_RES_REC_LEVEL(rr_type, rdata) (\
(((rr_type) == NBT_QTYPE_NETBIOS) && \
talloc_check_name(ndr, "struct ndr_push") && \
((rdata).data.length == 2)) \
? 0 : rr_type)
typedef [flag(LIBNDR_PRINT_ARRAY_HEX)] struct {
nbt_name name;
nbt_qtype rr_type;
nbt_qclass rr_class;
uint32 ttl;
[switch_is(NBT_RES_REC_LEVEL(rr_type, rdata))] nbt_rdata rdata;
} nbt_res_rec;
typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
uint16 name_trn_id;
nbt_operation operation;
uint16 qdcount;
uint16 ancount;
uint16 nscount;
uint16 arcount;
nbt_name_question questions[qdcount];
nbt_res_rec answers[ancount];
nbt_res_rec nsrecs[nscount];
nbt_res_rec additional[arcount];
[flag(NDR_REMAINING)] DATA_BLOB padding;
} nbt_name_packet;
/*
NBT DGRAM packets (UDP/138)
*/
typedef [enum8bit] enum {
DGRAM_DIRECT_UNIQUE = 0x10,
DGRAM_DIRECT_GROUP = 0x11,
DGRAM_BCAST = 0x12,
DGRAM_ERROR = 0x13,
DGRAM_QUERY = 0x14,
DGRAM_QUERY_POSITIVE = 0x15,
DGRAM_QUERY_NEGATIVE = 0x16
} dgram_msg_type;
typedef [bitmap8bit] bitmap {
DGRAM_FLAG_MORE = 0x01,
DGRAM_FLAG_FIRST = 0x02,
DGRAM_FLAG_NODE_TYPE = 0x0C
} dgram_flags;
typedef [enum8bit] enum {
DGRAM_NODE_B = 0x00,
DGRAM_NODE_P = 0x04,
DGRAM_NODE_M = 0x08,
DGRAM_NODE_NBDD = 0x0C
} dgram_node_type;
/* a dgram_message is the main dgram body in general use */
/* the most common datagram type is a SMB_TRANSACTION
operation, where a SMB packet is used in the data section
of a dgram_message to hold a trans request, which in turn
holds a small command structure. It's a very strange beast
indeed. To make the code cleaner we define a basic SMB
packet in IDL here. This is not a general purpose SMB
packet, and won't be used in the core SMB client/server
code, but it does make working with these types of dgrams
easier */
const string NBT_MAILSLOT_NETLOGON = "\\MAILSLOT\\NET\\NETLOGON";
const string NBT_MAILSLOT_NTLOGON = "\\MAILSLOT\\NET\\NTLOGON";
const string NBT_MAILSLOT_GETDC = "\\MAILSLOT\\NET\\GETDC";
const string NBT_MAILSLOT_BROWSE = "\\MAILSLOT\\BROWSE";
typedef [enum8bit] enum {
SMB_TRANSACTION = 0x25
} smb_command;
typedef struct {
[range(17,17),value(17)] uint8 wct;
uint16 total_param_count;
uint16 total_data_count;
uint16 max_param_count;
uint16 max_data_count;
uint8 max_setup_count;
uint8 pad;
uint16 trans_flags;
uint32 timeout;
uint16 reserved;
uint16 param_count;
uint16 param_offset;
uint16 data_count;
uint16 data_offset;
[range(3,3),value(3)] uint8 setup_count;
uint8 pad2;
uint16 opcode;
uint16 priority;
uint16 class;
[value(strlen(mailslot_name)+1+r->data.length)]
uint16 byte_count;
astring mailslot_name;
[flag(NDR_REMAINING)] DATA_BLOB data;
} smb_trans_body;
typedef [nodiscriminant] union {
[case(SMB_TRANSACTION)] smb_trans_body trans;
} smb_body;
typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN|NDR_PAHEX),public] struct {
smb_command smb_command;
uint8 err_class;
uint8 pad;
uint16 err_code;
uint8 flags;
uint16 flags2;
uint16 pid_high;
uint8 signature[8];
uint16 reserved;
uint16 tid;
uint16 pid;
uint16 vuid;
uint16 mid;
[switch_is(smb_command)] smb_body body;
} dgram_smb_packet;
const uint32 DGRAM_SMB = 0xff534d42; /* 0xffSMB */
typedef [nodiscriminant] union {
[case(DGRAM_SMB)] dgram_smb_packet smb;
} dgram_message_body;
typedef struct {
uint16 length;
uint16 offset;
nbt_name source_name;
nbt_name dest_name;
uint32 dgram_body_type;
[switch_is(dgram_body_type)] dgram_message_body body;
} dgram_message;
typedef [enum8bit] enum {
DGRAM_ERROR_NAME_NOT_PRESENT = 0x82,
DGRAM_ERROR_INVALID_SOURCE = 0x83,
DGRAM_ERROR_INVALID_DEST = 0x84
} dgram_err_code;
typedef [nodiscriminant] union {
[case(DGRAM_DIRECT_UNIQUE)] dgram_message msg;
[case(DGRAM_DIRECT_GROUP)] dgram_message msg;
[case(DGRAM_BCAST)] dgram_message msg;
[case(DGRAM_ERROR)] dgram_err_code error;
[case(DGRAM_QUERY)] nbt_name dest_name;
[case(DGRAM_QUERY_POSITIVE)] nbt_name dest_name;
[case(DGRAM_QUERY_NEGATIVE)] nbt_name dest_name;
} dgram_data;
typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
dgram_msg_type msg_type;
dgram_flags flags;
uint16 dgram_id;
ipv4address src_addr;
uint16 src_port;
[switch_is(msg_type)] dgram_data data;
} nbt_dgram_packet;
/*******************************************/
/* \MAILSLOT\NET\NETLOGON mailslot requests */
typedef enum {
NETLOGON_QUERY_FOR_PDC = 0x7,
NETLOGON_ANNOUNCE_UAS = 0xa,
NETLOGON_RESPONSE_FROM_PDC = 0xc,
NETLOGON_QUERY_FOR_PDC2 = 0x12,
NETLOGON_RESPONSE_FROM_PDC2 = 0x17,
NETLOGON_RESPONSE_FROM_PDC_USER = 0x19
} nbt_netlogon_command;
/* query for pdc request */
typedef struct {
astring computer_name;
astring mailslot_name;
[flag(NDR_ALIGN2)] DATA_BLOB _pad;
nstring unicode_name;
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_netlogon_query_for_pdc;
/* query for pdc request - new style */
typedef struct {
uint16 request_count;
nstring computer_name;
nstring user_name;
astring mailslot_name;
uint32 unknown[2];
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_netlogon_query_for_pdc2;
/* response from pdc */
typedef struct {
astring pdc_name;
[flag(NDR_ALIGN2)] DATA_BLOB _pad;
nstring unicode_pdc_name;
nstring domain_name;
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_netlogon_response_from_pdc;
typedef [bitmap32bit] bitmap {
NBT_SERVER_PDC = 0x00000001,
NBT_SERVER_GC = 0x00000004,
NBT_SERVER_LDAP = 0x00000008,
NBT_SERVER_DS = 0x00000010,
NBT_SERVER_KDC = 0x00000020,
NBT_SERVER_TIMESERV = 0x00000040,
NBT_SERVER_CLOSEST = 0x00000080,
NBT_SERVER_WRITABLE = 0x00000100,
NBT_SERVER_GOOD_TIMESERV = 0x00000200
} nbt_server_type;
/* response from pdc - type2 */
typedef struct {
[flag(NDR_ALIGN4)] DATA_BLOB _pad;
nbt_server_type server_type;
GUID domain_uuid;
nbt_string forest;
nbt_string dns_domain;
nbt_string pdc_dns_name;
nbt_string domain;
nbt_string pdc_name;
nbt_string user_name;
nbt_string server_site;
nbt_string client_site;
uint8 unknown;
uint32 unknown2;
[flag(NDR_BIG_ENDIAN)]
ipv4address pdc_ip;
uint32 unknown3[2];
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_netlogon_response_from_pdc2;
declare enum netr_SamDatabaseID;
/* announce change to UAS or SAM */
typedef struct {
netr_SamDatabaseID db_index;
hyper serial;
NTTIME timestamp;
} nbt_db_change;
/* used to announce SAM changes */
typedef struct {
uint32 serial_lo;
time_t timestamp;
uint32 pulse;
uint32 random;
astring pdc_name;
astring domain;
[flag(NDR_ALIGN2)] DATA_BLOB _pad;
nstring unicode_pdc_name;
nstring unicode_domain;
uint32 db_count;
nbt_db_change dbchange[db_count];
[value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size;
[flag(NDR_ALIGN4)] DATA_BLOB _pad2;
dom_sid sid;
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_netlogon_announce_uas;
typedef [nodiscriminant] union {
[case(NETLOGON_QUERY_FOR_PDC)] nbt_netlogon_query_for_pdc pdc;
[case(NETLOGON_QUERY_FOR_PDC2)] nbt_netlogon_query_for_pdc2 pdc2;
[case(NETLOGON_ANNOUNCE_UAS)] nbt_netlogon_announce_uas uas;
[case(NETLOGON_RESPONSE_FROM_PDC)] nbt_netlogon_response_from_pdc response;
[case(NETLOGON_RESPONSE_FROM_PDC2)] nbt_netlogon_response_from_pdc2 response2;
[case(NETLOGON_RESPONSE_FROM_PDC_USER)] nbt_netlogon_response_from_pdc2 response2;
} nbt_netlogon_request;
typedef [flag(NDR_NOALIGN),public] struct {
nbt_netlogon_command command;
[switch_is(command)] nbt_netlogon_request req;
} nbt_netlogon_packet;
/*******************************************/
/* CLDAP netlogon response */
/* note that these structures are very similar to, but not
quite identical to, the netlogon structures above */
typedef struct {
uint16 type;
nstring pdc_name;
nstring user_name;
nstring domain_name;
[value(1)] uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_cldap_netlogon_1;
typedef struct {
uint16 type;
nstring pdc_name;
nstring user_name;
nstring domain_name;
GUID domain_uuid;
GUID unknown_uuid;
nbt_string forest;
nbt_string dns_domain;
nbt_string pdc_dns_name;
ipv4address pdc_ip;
nbt_server_type server_type;
[value(3)] uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_cldap_netlogon_3;
typedef struct {
uint32 type;
nbt_server_type server_type;
GUID domain_uuid;
nbt_string forest;
nbt_string dns_domain;
nbt_string pdc_dns_name;
nbt_string domain;
nbt_string pdc_name;
nbt_string user_name;
nbt_string server_site;
nbt_string client_site;
[value(5)] uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_cldap_netlogon_5;
typedef struct {
uint32 type;
nbt_server_type server_type;
GUID domain_uuid;
nbt_string forest;
nbt_string dns_domain;
nbt_string pdc_dns_name;
nbt_string domain;
nbt_string pdc_name;
nbt_string user_name;
nbt_string server_site;
nbt_string client_site;
uint8 unknown;
uint32 unknown2;
[flag(NDR_BIG_ENDIAN)]
ipv4address pdc_ip;
uint32 unknown3[2];
[value(13)] uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_cldap_netlogon_13;
typedef [flag(NDR_NOALIGN),public,nodiscriminant] union {
[case(0)] nbt_cldap_netlogon_1 logon1;
[case(1)] nbt_cldap_netlogon_1 logon1;
[case(2)] nbt_cldap_netlogon_3 logon3;
[case(3)] nbt_cldap_netlogon_3 logon3;
[case(4)] nbt_cldap_netlogon_5 logon5;
[case(5)] nbt_cldap_netlogon_5 logon5;
[case(6)] nbt_cldap_netlogon_5 logon5;
[case(7)] nbt_cldap_netlogon_5 logon5;
[default] nbt_cldap_netlogon_13 logon13;
} nbt_cldap_netlogon;
/*******************************************/
/* \MAILSLOT\NET\NTLOGON mailslot requests */
typedef enum {
NTLOGON_SAM_LOGON = 0x12,
NTLOGON_SAM_LOGON_REPLY = 0x13,
NTLOGON_SAM_LOGON_REPLY15 = 0x15
} nbt_ntlogon_command;
typedef struct {
uint16 request_count;
nstring computer_name;
nstring user_name;
astring mailslot_name;
uint32 acct_control;
[value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size;
[flag(NDR_ALIGN4)] DATA_BLOB _pad;
dom_sid sid;
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_ntlogon_sam_logon;
typedef struct {
nstring server;
nstring user_name;
nstring domain;
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
} nbt_ntlogon_sam_logon_reply;
typedef [nodiscriminant] union {
[case(NTLOGON_SAM_LOGON)] nbt_ntlogon_sam_logon logon;
[case(NTLOGON_SAM_LOGON_REPLY)] nbt_ntlogon_sam_logon_reply reply;
[case(NTLOGON_SAM_LOGON_REPLY15)] nbt_ntlogon_sam_logon_reply reply;
} nbt_ntlogon_request;
typedef [flag(NDR_NOALIGN),public] struct {
nbt_ntlogon_command command;
[switch_is(command)] nbt_ntlogon_request req;
} nbt_ntlogon_packet;
/********************************************************/
/* \MAILSLOT\BROWSE mailslot requests */
/* for details see http://ubiqx.org/cifs/Browsing.html */
/********************************************************/
declare bitmap svcctl_ServerType;
typedef [enum8bit] enum {
HostAnnouncement = 1,
AnnouncementRequest = 2,
Election = 8,
GetBackupListReq = 9,
GetBackupListResp = 10,
BecomeBackup = 11,
DomainAnnouncement = 12,
MasterAnnouncement = 13,
ResetBrowserState = 14,
LocalMasterAnnouncement = 15
} nbt_browse_opcode;
typedef struct {
uint8 UpdateCount;
uint32 Periodicity;
[charset(DOS)] uint8 ServerName[16];
uint8 OSMajor;
uint8 OSMinor;
svcctl_ServerType ServerType;
uint8 BroMajorVer;
uint8 BroMinorVer;
uint16 Signature;
astring Comment;
} nbt_browse_host_announcement;
typedef struct {
uint8 Unused;
astring ResponseName;
} nbt_browse_announcement_request;
typedef struct {
uint8 Version;
uint32 Criteria;
uint32 UpTime; /* In milliseconds */
uint32 Reserved; /* Must be zero */
astring ServerName;
} nbt_browse_election_request;
typedef struct {
uint8 ReqCount;
uint32 Token;
} nbt_browse_backup_list_request;
typedef struct {
uint8 BackupCount;
uint32 Token;
nbt_name BackupServerList[BackupCount];/* TODO: this is wrong */
} nbt_browse_backup_list_response;
typedef struct {
astring BrowserName;
} nbt_browse_become_backup;
typedef struct {
uint8 UpdateCount;
uint32 Periodicity;
[charset(DOS)] uint8 ServerName[16];
uint8 OSMajor;
uint8 OSMinor;
svcctl_ServerType ServerType;
uint32 MysteriousField;
astring Comment;
} nbt_browse_domain_announcement;
typedef struct {
astring ServerName;
} nbt_browse_master_announcement;
typedef struct {
uint8 Command;
} nbt_browse_reset_state;
typedef struct {
uint8 UpdateCount;
uint32 Periodicity;
[charset(DOS)] uint8 ServerName[16];
uint8 OSMajor;
uint8 OSMinor;
svcctl_ServerType ServerType;
uint8 BroMajorVer;
uint8 BroMinorVer;
uint16 Signature;
astring Comment;
} nbt_browse_local_master_announcement;
typedef [nodiscriminant] union {
[case(HostAnnouncement)] nbt_browse_host_announcement host_annoucement;
[case(AnnouncementRequest)] nbt_browse_announcement_request announcement_request;
[case(Election)] nbt_browse_election_request election_request;
[case(GetBackupListReq)] nbt_browse_backup_list_request backup_list_request;
[case(GetBackupListResp)] nbt_browse_backup_list_response backup_list_response;
[case(BecomeBackup)] nbt_browse_become_backup become_backup;
[case(DomainAnnouncement)] nbt_browse_domain_announcement domain_announcement;
[case(MasterAnnouncement)] nbt_browse_master_announcement master_announcement;
[case(ResetBrowserState)] nbt_browse_reset_state reset_browser_state;
[case(LocalMasterAnnouncement)] nbt_browse_local_master_announcement local_master_announcement;
} nbt_browse_payload;
typedef [public,flag(NDR_NOALIGN)] struct {
nbt_browse_opcode opcode;
[switch_is(opcode)] nbt_browse_payload payload;
} nbt_browse_packet;
}
File diff suppressed because it is too large Load Diff
+42
View File
@@ -0,0 +1,42 @@
#include "idl_types.h"
/*
NFS4 ACL format on disk
see http://www.suse.de/~agruen/nfs4acl/
*/
import "misc.idl", "security.idl";
[ uuid("18763978-8625-abc3-54ca-9892bacdf321"),
version(1.0),
pointer_default(unique)
]
interface nfs4acl
{
const char *NFS4ACL_XATTR_NAME = "system.nfs4acl";
/* these structures use the same bit values and other constants as
in security.idl */
typedef [flag(NDR_BIG_ENDIAN)] struct {
uint16 e_type;
uint16 e_flags;
uint32 e_mask;
uint32 e_id;
utf8string e_who;
[flag(NDR_ALIGN4)] DATA_BLOB _pad;
} nfs4ace;
typedef [public,flag(NDR_BIG_ENDIAN)] struct {
uint8 a_version;
uint8 a_flags;
uint16 a_count;
uint32 a_owner_mask;
uint32 a_group_mask;
uint32 a_other_mask;
nfs4ace ace[a_count];
} nfs4acl;
NTSTATUS nfs4acl_test(
[in] nfs4acl acl
);
}
+56
View File
@@ -0,0 +1,56 @@
#include "idl_types.h"
/*
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 {
uint32 server;
uint32 filter; /* filter to apply in this directory */
uint32 subdir_filter; /* filter to apply in child directories */
utf8string path;
uint32 path_len; /* saves some computation on search */
pointer private;
} notify_entry;
/*
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;
} notify_event;
}
+77
View File
@@ -0,0 +1,77 @@
/*
plug and play services
*/
[
uuid("8d9f4e40-a03d-11ce-8f69-08003e30051b"),
version(1.0),
helpstring("Plug and Play services")
]
interface ntsvcs
{
void PNP_Disconnect();
void PNP_Connect();
void PNP_GetVersion();
void PNP_GetGlobalState();
void PNP_InitDetection();
void PNP_ReportLogOn();
void PNP_ValidateDeviceInstance();
void PNP_GetRootDeviceInstance();
void PNP_GetRelatedDeviceInstance();
void PNP_EnumerateSubKeys();
void PNP_GetDeviceList();
void PNP_GetDeviceListSize();
void PNP_GetDepth();
void PNP_GetDeviceRegProp();
void PNP_SetDeviceRegProp();
void PNP_GetClassInstance();
void PNP_CreateKey();
void PNP_DeleteRegistryKey();
void PNP_GetClassCount();
void PNP_GetClassName();
void PNP_DeleteClassKey();
void PNP_GetInterfaceDeviceAlias();
void PNP_GetInterfaceDeviceList();
void PNP_GetInterfaceDeviceListSize();
void PNP_RegisterDeviceClassAssociation();
void PNP_UnregisterDeviceClassAssociation();
void PNP_GetClassRegProp();
void PNP_SetClassRegProp();
void PNP_CreateDevInst();
void PNP_DeviceInstanceAction();
void PNP_GetDeviceStatus();
void PNP_SetDeviceProblem();
void PNP_DisableDevInst();
void PNP_UninstallDevInst();
void PNP_AddID();
void PNP_RegisterDriver();
void PNP_QueryRemove();
void PNP_RequestDeviceEject();
void PNP_IsDockStationPresent();
void PNP_RequestEjectPC();
void PNP_HwProfFlags();
void PNP_GetHwProfInfo();
void PNP_AddEmptyLogConf();
void PNP_FreeLogConf();
void PNP_GetFirstLogConf();
void PNP_GetNextLogConf();
void PNP_GetLogConfPriority();
void PNP_AddResDes();
void PNP_FreeResDes();
void PNP_GetNextResDes();
void PNP_GetResDesData();
void PNP_GetResDesDataSize();
void PNP_ModifyResDes();
void PNP_DetectResourceLimit();
void PNP_QueryResConfList();
void PNP_SetHwProf();
void PNP_QueryArbitratorFreeData();
void PNP_QueryArbitratorFreeSize();
void PNP_RunDetection();
void PNP_RegisterNotification();
void PNP_UnregisterNotification();
void PNP_GetCustomDevProp();
void PNP_GetVersionInternal();
void PNP_GetBlockedDriverInfo();
void PNP_GetServerSideDeviceInstallFlags();
}
+40
View File
@@ -0,0 +1,40 @@
#include "idl_types.h"
/*
IDL structures for opendb code
this defines the structures used in the opendb database code, in
ntvfs/common/opendb.c
*/
[
pointer_default(unique)
]
interface opendb
{
typedef struct {
uint32 server;
uint32 stream_id;
uint32 share_access;
uint32 access_mask;
pointer file_handle;
/* we need a per-entry delete on close, as well as a per-file
one, to cope with strange semantics on open */
boolean8 delete_on_close;
uint32 oplock_level;
} opendb_entry;
typedef struct {
uint32 server;
pointer notify_ptr;
} opendb_pending;
typedef [public] struct {
boolean8 delete_on_close;
utf8string path;
uint32 num_entries;
opendb_entry entries[num_entries];
uint32 num_pending;
opendb_pending pending[num_pending];
} opendb_file;
}
+228
View File
@@ -0,0 +1,228 @@
#include "idl_types.h"
/**
DCOM interfaces
http://www.ietf.org/internet-drafts/draft-brown-dcom-v1-spec-04.txt
*/
[
pointer_default(unique)
]
interface ObjectRpcBaseTypes
{
/* COM_MINOR_VERSION = 1 (NT4.0, SP1, SP2, DCOM95). */
/* - Initial Release */
/* - Must be used when talking to downlevel machines, including */
/* on Remote Activation calls. */
/* COM_MINOR_VERSION = 2 (NT4.0 SP3 and beyond). */
/* - Added ResolveOxid2 to IObjectExporter to retrieve the */
/* COM version number of the server. Passed to the NDR engine */
/* to fix fatal endian-ness flaw in the way OLEAUTOMATION marshals */
/* BSTRS. Previous way used trailing padding, which is not NDR */
/* compatible. See Bug# 69189. */
/* COM_MINOR_VERSION = 3 (NT4.0 SP4 and DCOM95 builds 1018 and beyond) */
/* - OLEAUT32 added two new types to the SAFEARRAY, but SAFEARRAY */
/* previously included the "default" keyword, which prevented */
/* downlevel NDR engines from correctly handling any extensions. */
/* Machines with version >=5.3 don't use "default" and will */
/* gracefully handle future extensions to SAFEARRAY. */
/* old constants (for convenience) */
/* current version */
const uint16 COM_MAJOR_VERSION = 5;
const uint16 COM_MINOR_VERSION = 1;
/* Body Extensions */
const string dcom_ext_debugging = "f1f19680-4d2a-11ce-a66a-0020af6e72f4";
const string dcom_ext_extended_error = "f1f19681-4d2a-11ce-a66a-0020af6e72f4";
/* Component Object Model version number */
typedef [public] struct
{
uint16 MajorVersion; /* Major version number */
uint16 MinorVersion; /* Minor version number */
} COMVERSION;
/* enumeration of additional information present in the call packet. */
typedef bitmap {
ORPCF_NULL = 0x00, /* no additional info in packet */
ORPCF_LOCAL = 0x01, /* call is local to this machine */
ORPCF_RESERVED1 = 0x02, /* reserved for local use */
ORPCF_RESERVED2 = 0x04, /* reserved for local use */
ORPCF_RESERVED3 = 0x08, /* reserved for local use */
ORPCF_RESERVED4 = 0x10 /* reserved for local use */
} ORPC_FLAGS;
/* Extension to implicit parameters. */
typedef [public] struct
{
GUID id; /* Extension identifier. */
uint32 size; /* Extension size. */
[noprint,size_is(((size+7)&~7))] uint8 data[]; /* Extension data. */
} ORPC_EXTENT;
/* Array of extensions. */
typedef struct
{
uint32 size; /* Num extents. */
uint32 reserved; /* Must be zero. */
[size_is(((size+1)&~1))] ORPC_EXTENT **extent; /* extents */
} ORPC_EXTENT_ARRAY;
/* implicit 'this' pointer which is the first [in] parameter on */
/* every ORPC call. */
typedef [public] struct
{
COMVERSION version; /* COM version number */
uint32 flags; /* ORPCF flags for presence of other data */
uint32 reserved1; /* set to zero */
GUID cid; /* causality id of caller */
/* Extensions. */
[unique] ORPC_EXTENT_ARRAY *extensions;
} ORPCTHIS;
/* implicit 'that' pointer which is the first [out] parameter on */
/* every ORPC call. */
typedef [public] struct
{
uint32 flags; /* ORPCF flags for presence of other data */
/* Extensions. */
[unique] ORPC_EXTENT_ARRAY *extensions;
} ORPCTHAT;
/* DUALSTRINGARRAYS are the return type for arrays of network addresses, */
/* arrays of endpoints and arrays of both used in many ORPC interfaces */
typedef [public,flag(NDR_NOALIGN)] struct
{
uint16 wTowerId; /* Cannot be zero. */
nstring NetworkAddr;
} STRINGBINDING;
typedef [public,nopush,nopull,noprint] struct
{
STRINGBINDING **stringbindings;
} STRINGARRAY;
typedef [public,nopush,nopull,noprint] struct
{
STRINGBINDING **stringbindings;
SECURITYBINDING **securitybindings;
} DUALSTRINGARRAY;
const uint16 COM_C_AUTHZ_NONE = 0xffff;
typedef [public,flag(NDR_NOALIGN)] struct
{
uint16 wAuthnSvc; /* Cannot be zero. */
uint16 wAuthzSvc;
nstring PrincName;
} SECURITYBINDING;
/* signature value for OBJREF (object reference, actually the */
/* marshaled form of a COM interface).
* MEOW apparently stands for "Microsoft Extended Object Wireformat"
*/
const uint32 OBJREF_SIGNATURE = 0x574f454d; /* 'MEOW' */
/* flag values for OBJREF */
typedef enum {
OBJREF_NULL = 0x0, /* NULL pointer */
OBJREF_STANDARD = 0x1, /* standard marshaled objref */
OBJREF_HANDLER = 0x2, /* handler marshaled objref */
OBJREF_CUSTOM = 0x4 /* custom marshaled objref */
} OBJREF_FLAGS;
/* Flag values for a STDOBJREF (standard part of an OBJREF). */
/* SORF_OXRES1 - SORF_OXRES8 are reserved for the object exporters */
/* use only, object importers must ignore them and must not enforce MBZ. */
typedef bitmap {
SORF_NULL = 0x0000, /* convenient for initializing SORF */
SORF_OXRES1 = 0x0001, /* reserved for exporter */
SORF_OXRES2 = 0x0020, /* reserved for exporter */
SORF_OXRES3 = 0x0040, /* reserved for exporter */
SORF_OXRES4 = 0x0080, /* reserved for exporter */
SORF_OXRES5 = 0x0100, /* reserved for exporter */
SORF_OXRES6 = 0x0200, /* reserved for exporter */
SORF_OXRES7 = 0x0400, /* reserved for exporter */
SORF_OXRES8 = 0x0800, /* reserved for exporter */
SORF_NOPING = 0x1000 /* Pinging is not required */
} STDOBJREF_FLAGS;
/* standard object reference */
typedef [public] struct
{
uint32 flags; /* STDOBJREF flags (see above) */
uint32 cPublicRefs; /* count of references passed */
hyper oxid; /* oxid of server with this oid */
hyper oid; /* oid of object with this ipid */
GUID ipid; /* ipid of interface pointer to this object */
} STDOBJREF;
typedef struct
{
STDOBJREF std; /* standard objref */
STRINGARRAY saResAddr; /* resolver address */
} u_standard;
typedef struct
{
STDOBJREF std; /* standard objref */
GUID clsid; /* Clsid of handler code */
STRINGARRAY saResAddr; /* resolver address */
} u_handler;
typedef struct
{
GUID clsid; /* Clsid of unmarshaling code */
uint32 cbExtension; /* size of extension data */
uint32 size; /* size of data that follows */
[noprint] uint8 pData[size]; /* extension + class specific data */
} u_custom;
typedef struct
{
} u_null;
typedef [nodiscriminant] union
{
[case(OBJREF_NULL)] u_null u_null;
[case(OBJREF_STANDARD)] u_standard u_standard;
[case(OBJREF_HANDLER)] u_handler u_handler;
[case(OBJREF_CUSTOM)] u_custom u_custom;
} OBJREF_Types;
/* OBJREF is the format of a marshaled interface pointer. */
typedef [public,flag(NDR_LITTLE_ENDIAN)] struct
{
uint32 signature;
uint32 flags; /* OBJREF flags (see above) */
GUID iid; /* interface identifier */
[switch_is(flags), switch_type(uint32)] OBJREF_Types u_objref;
} OBJREF;
/* wire representation of a marshalled interface pointer */
typedef [public] struct
{
uint32 size;
[subcontext(4)] OBJREF obj;
} MInterfacePointer;
typedef [v1_enum,public] enum
{
COM_OK = 0x00000000,
COM_OUTOFMEMORY = 0x80000002,
COM_INVALIDARG = 0x80000003,
COM_NOINTERFACE = 0x80000004,
COM_ACCESSDENIED = 0x80070005,
COM_INVALID_OXID = 0x80070776,
COM_INVALID_OID = 0x80070777,
COM_INVALID_SET = 0x80070778,
COM_UNEXPECTED = 0x8000FFFF,
COM_CLSNOTFOUND = 0x80040154
} COMRESULT;
}
+94
View File
@@ -0,0 +1,94 @@
/**
DCOM interfaces
http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm
*/
/*
The OXID Resolver can turn a OXID (Object Exporter ID) into a
RPC binding string that can be used to contact an object
(used by DCOM)
*/
import "dcom.idl", "orpc.idl";
[
uuid("99fcfec4-5260-101b-bbcb-00aa0021347a"),
helpstring("Object Exporter ID Resolver"),
endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", "ncalrpc:"),
pointer_default(unique)
]
interface IOXIDResolver
{
#define OXID hyper
#define SETID hyper
#define IPID GUID
#define OID GUID
/* Method to get the protocol sequences, string bindings */
/* and machine id for an object server given its OXID. */
[idempotent] WERROR ResolveOxid (
[in] OXID pOxid,
[in] uint16 cRequestedProtseqs,
[in, size_is(cRequestedProtseqs)] uint16 arRequestedProtseqs[],
[out] DUALSTRINGARRAY **ppdsaOxidBindings,
[out,ref] IPID *pipidRemUnknown,
[out,ref] uint32 *pAuthnHint
);
/* Simple ping is used to ping a Set. Client machines use this */
/* to inform the object exporter that it is still using the */
/* members of the set. */
/* Returns S_TRUE if the SetId is known by the object exporter, */
/* S_FALSE if not. */
[idempotent] WERROR SimplePing (
[in] SETID *SetId /* Must not be zero */
);
/* Complex ping is used to create sets of OIDs to ping. The */
/* whole set can subsequently be pinged using SimplePing, */
/* thus reducing network traffic. */
[idempotent] WERROR ComplexPing (
[in,out,ref] SETID *SetId, /* In of 0 on first call for new set. */
[in] uint16 SequenceNum,
[in] uint16 cAddToSet,
[in] uint16 cDelFromSet,
/* add these OIDs to the set */
[in, size_is(cAddToSet)] OID AddToSet[],
/*remove these OIDs from the set */
[in, size_is(cDelFromSet)] OID DelFromSet[],
[out,ref] uint16 *PingBackoffFactor/* 2^factor = multipler */
);
/* In some cases the client maybe unsure that a particular */
/* binding will reach the server. (For example, when the oxid */
/* bindings have more than one TCP/IP binding) This call */
/* can be used to validate the binding */
/* from the client. */
[idempotent] WERROR ServerAlive ();
/* Method to get the protocol sequences, string bindings, */
/* RemoteUnknown IPID and COM version for an object server */
/* given its OXID. Supported by DCOM */
/* version 5.2 and above. Looks like that means
* Windows 2003/XP and above */
[idempotent] WERROR ResolveOxid2 (
[in] OXID pOxid,
[in] uint16 cRequestedProtseqs,
[in, size_is(cRequestedProtseqs)] uint16 arRequestedProtseqs[],
[out] DUALSTRINGARRAY **pdsaOxidBindings,
[out,ref] IPID *ipidRemUnknown,
[out,ref] uint32 *AuthnHint,
[out,ref] COMVERSION *ComVersion
);
typedef struct {
COMVERSION version;
uint32 unknown1;
} COMINFO;
[idempotent] WERROR ServerAlive2 (
[out,ref] COMINFO *info,
[out,ref] DUALSTRINGARRAY *dualstring,
[out] uint8 unknown2[3]);
}
+13
View File
@@ -0,0 +1,13 @@
/* IPSec policy agent (Win2k) */
[
uuid("d335b8f6-cb31-11d0-b0f9-006097ba4e54"),
version(1.5),
pointer_default(unique),
helpstring("IPSec Policy Agent")
] interface policyagent
{
/*****************/
/* Function 0x00 */
WERROR policyagent_Dummy();
}
@@ -0,0 +1,14 @@
/*
protected_storage interface definitions
Also seen with UUID:
*/
[ uuid("c9378ff1-16f7-11d0-a0b2-00aa0061426a"),
version(1.0),
pointer_default(unique)
] interface protected_storage
{
/*****************************/
/* Function 0x00 */
WERROR ps_XXX ();
}
+46
View File
@@ -0,0 +1,46 @@
/**
DCOM interfaces
http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm
*/
import "dcom.idl", "orpc.idl";
[
uuid("4d9f4ab8-7d1c-11cf-861e-0020af6e7c57"),
pointer_default(unique),
endpoint("ncalrpc:", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]")
]
interface IRemoteActivation
{
typedef enum
{
RPC_C_IMP_LEVEL_DEFAULT = 0,
RPC_C_IMP_LEVEL_ANONYMOUS = 1,
RPC_C_IMP_LEVEL_IDENTIFY = 2,
RPC_C_IMP_LEVEL_IMPERSONATE = 3,
RPC_C_IMP_LEVEL_DELEGATE = 4
} imp_levels;
const uint32 MODE_GET_CLASS_OBJECT = 0xffffffff;
WERROR RemoteActivation (
[in] ORPCTHIS this,
[out,ref] ORPCTHAT *that,
[in] GUID Clsid,
[in] [string,charset(UTF16),unique] uint16 *pwszObjectName,
[in,unique] MInterfacePointer *pObjectStorage,
[in] uint32 ClientImpLevel,
[in] uint32 Mode,
[in,range(1,32768)] uint32 Interfaces,
[in,size_is(Interfaces),unique] GUID *pIIDs,
[in] uint16 num_protseqs,
[in, size_is(num_protseqs)] uint16 protseq[*],
[out,ref] hyper *pOxid,
[out,ref] DUALSTRINGARRAY **pdsaOxidBindings,
[out,ref] GUID *ipidRemUnknown,
[out,ref] uint32 *AuthnHint,
[out,ref] COMVERSION *ServerVersion,
[out,ref] WERROR *hr,
[out,size_is(Interfaces),ref] MInterfacePointer **ifaces,
[out,size_is(Interfaces),ref] WERROR *results
);
}
+44
View File
@@ -0,0 +1,44 @@
import "orpc.idl";
[
uuid("b9e79e60-3d52-11ce-aaa1-00006901293f"),
version(0.2),
pointer_default(unique),
endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]",
"ncalrpc:[EPMAPPER]")
] interface rot
{
WERROR rot_add (
[in] uint32 flags,
[in] MInterfacePointer *unk,
[in] MInterfacePointer *moniker,
[out] uint32 *rotid
);
WERROR rot_remove (
[in] uint32 rotid
);
WERROR rot_is_listed (
[in] MInterfacePointer *moniker
);
WERROR rot_get_interface_pointer (
[in] MInterfacePointer *moniker,
[out] MInterfacePointer *ip
);
WERROR rot_set_modification_time (
[in] uint32 rotid,
[in] NTTIME *t
);
WERROR rot_get_modification_time (
[in] MInterfacePointer *moniker,
[out] NTTIME *t
);
WERROR rot_enum (
[out] MInterfacePointer *EnumMoniker
);
}
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
#include "idl_types.h"
[
pointer_default(unique),
helpstring("SASL helpers")
]
interface sasl_helpers {
typedef [public,flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX)] struct {
[value(strlen_m(authid))] uint16 authid_length;
[charset(UTF8)] uint8 authid[authid_length];
uint16 passwd_length;
uint8 passwd[passwd_length];
[value(strlen_m(service))] uint16 service_length;
[charset(UTF8)] uint8 service[service_length];
[value(strlen_m(realm))] uint16 realm_length;
[charset(UTF8)] uint8 realm[realm_length];
} saslauthdRequest;
void decode_saslauthd(
[in] saslauthdRequest req
);
}
+18
View File
@@ -0,0 +1,18 @@
/*
security configuration editor interface definitions
*/
[
uuid("93149ca2-973b-11d1-8c39-00c04fb984f9"),
version(0.0),
pointer_default(unique),
helpstring("Security Configuration Editor")
]
interface scerpc
{
/*****************/
/* Function 0x00 */
WERROR scerpc_Unknown0();
}
+44
View File
@@ -0,0 +1,44 @@
#include "idl_types.h"
/*
schannel structures
*/
import "netlogon.idl", "nbt.idl";
interface schannel
{
/*
a schannel bind blob - used in dcerpc auth_info
on a schannel
*/
typedef struct {
astring domain;
astring workstation;
} schannel_bind_3;
typedef struct {
astring domain;
astring workstation;
nbt_string dnsdomain;
nbt_string dnsworkstation;
} schannel_bind_23;
typedef [nodiscriminant] union {
[case (3)] schannel_bind_3 info3;
[case (23)] schannel_bind_23 info23;
} schannel_bind_info;
typedef [public] struct {
uint32 unknown1; /* seems to need to be 0 */
uint32 bind_type;
[switch_is(bind_type)] schannel_bind_info u;
} schannel_bind;
/* a bind_ack blob */
typedef [public] struct {
uint32 unknown1; /* 1 */
uint32 unknown2; /* 0 */
uint32 unknown3; /* 0x006c0000 */
} schannel_bind_ack;
}
+1
View File
@@ -0,0 +1 @@
NOEMIT
+356
View File
@@ -0,0 +1,356 @@
#include "idl_types.h"
/*
security IDL structures
*/
import "misc.idl";
[
pointer_default(unique)
]
interface security
{
/*
access masks are divided up like this:
0xabccdddd
where
a = generic rights bits SEC_GENERIC_
b = flags SEC_FLAG_
c = standard rights bits SEC_STD_
d = object type specific bits SEC_{FILE,DIR,REG,xxx}_
common combinations of bits are prefixed with SEC_RIGHTS_
*/
const int SEC_MASK_GENERIC = 0xF0000000;
const int SEC_MASK_FLAGS = 0x0F000000;
const int SEC_MASK_STANDARD = 0x00FF0000;
const int SEC_MASK_SPECIFIC = 0x0000FFFF;
/* generic bits */
const int SEC_GENERIC_ALL = 0x10000000;
const int SEC_GENERIC_EXECUTE = 0x20000000;
const int SEC_GENERIC_WRITE = 0x40000000;
const int SEC_GENERIC_READ = 0x80000000;
/* flag bits */
const int SEC_FLAG_SYSTEM_SECURITY = 0x01000000;
const int SEC_FLAG_MAXIMUM_ALLOWED = 0x02000000;
/* standard bits */
const int SEC_STD_DELETE = 0x00010000;
const int SEC_STD_READ_CONTROL = 0x00020000;
const int SEC_STD_WRITE_DAC = 0x00040000;
const int SEC_STD_WRITE_OWNER = 0x00080000;
const int SEC_STD_SYNCHRONIZE = 0x00100000;
const int SEC_STD_REQUIRED = 0x000F0000;
const int SEC_STD_ALL = 0x001F0000;
/* file specific bits */
const int SEC_FILE_READ_DATA = 0x00000001;
const int SEC_FILE_WRITE_DATA = 0x00000002;
const int SEC_FILE_APPEND_DATA = 0x00000004;
const int SEC_FILE_READ_EA = 0x00000008;
const int SEC_FILE_WRITE_EA = 0x00000010;
const int SEC_FILE_EXECUTE = 0x00000020;
const int SEC_FILE_READ_ATTRIBUTE = 0x00000080;
const int SEC_FILE_WRITE_ATTRIBUTE = 0x00000100;
const int SEC_FILE_ALL = 0x000001ff;
/* directory specific bits */
const int SEC_DIR_LIST = 0x00000001;
const int SEC_DIR_ADD_FILE = 0x00000002;
const int SEC_DIR_ADD_SUBDIR = 0x00000004;
const int SEC_DIR_READ_EA = 0x00000008;
const int SEC_DIR_WRITE_EA = 0x00000010;
const int SEC_DIR_TRAVERSE = 0x00000020;
const int SEC_DIR_DELETE_CHILD = 0x00000040;
const int SEC_DIR_READ_ATTRIBUTE = 0x00000080;
const int SEC_DIR_WRITE_ATTRIBUTE = 0x00000100;
/* registry entry specific bits */
const int SEC_REG_QUERY_VALUE = 0x00000001;
const int SEC_REG_SET_VALUE = 0x00000002;
const int SEC_REG_CREATE_SUBKEY = 0x00000004;
const int SEC_REG_ENUM_SUBKEYS = 0x00000008;
const int SEC_REG_NOTIFY = 0x00000010;
const int SEC_REG_CREATE_LINK = 0x00000020;
/* ldap specific access bits */
const int SEC_ADS_CREATE_CHILD = 0x00000001;
const int SEC_ADS_DELETE_CHILD = 0x00000002;
const int SEC_ADS_LIST = 0x00000004;
const int SEC_ADS_SELF_WRITE = 0x00000008;
const int SEC_ADS_READ_PROP = 0x00000010;
const int SEC_ADS_WRITE_PROP = 0x00000020;
const int SEC_ADS_DELETE_TREE = 0x00000040;
const int SEC_ADS_LIST_OBJECT = 0x00000080;
const int SEC_ADS_CONTROL_ACCESS = 0x00000100;
/* generic->specific mappings for files */
const int SEC_RIGHTS_FILE_READ = SEC_STD_READ_CONTROL |
SEC_STD_SYNCHRONIZE |
SEC_FILE_READ_DATA |
SEC_FILE_READ_ATTRIBUTE |
SEC_FILE_READ_EA;
const int SEC_RIGHTS_FILE_WRITE = SEC_STD_READ_CONTROL |
SEC_STD_SYNCHRONIZE |
SEC_FILE_WRITE_DATA |
SEC_FILE_WRITE_ATTRIBUTE |
SEC_FILE_WRITE_EA |
SEC_FILE_APPEND_DATA;
const int SEC_RIGHTS_FILE_EXECUTE = SEC_STD_SYNCHRONIZE |
SEC_STD_READ_CONTROL |
SEC_FILE_READ_ATTRIBUTE |
SEC_FILE_EXECUTE;
const int SEC_RIGHTS_FILE_ALL = SEC_STD_ALL | SEC_FILE_ALL;
/* generic->specific mappings for directories (same as files) */
const int SEC_RIGHTS_DIR_READ = SEC_RIGHTS_FILE_READ;
const int SEC_RIGHTS_DIR_WRITE = SEC_RIGHTS_FILE_WRITE;
const int SEC_RIGHTS_DIR_EXECUTE = SEC_RIGHTS_FILE_EXECUTE;
const int SEC_RIGHTS_DIR_ALL = SEC_RIGHTS_FILE_ALL;
/***************************************************************/
/* WELL KNOWN SIDS */
/* a NULL sid */
const string SID_NULL = "S-1-0-0";
/* the world domain */
const string SID_WORLD_DOMAIN = "S-1-1";
const string SID_WORLD = "S-1-1-0";
/* SECURITY_CREATOR_SID_AUTHORITY */
const string SID_CREATOR_OWNER_DOMAIN = "S-1-3";
const string SID_CREATOR_OWNER = "S-1-3-0";
const string SID_CREATOR_GROUP = "S-1-3-1";
/* SECURITY_NT_AUTHORITY */
const string SID_NT_AUTHORITY = "S-1-5";
const string SID_NT_DIALUP = "S-1-5-1";
const string SID_NT_NETWORK = "S-1-5-2";
const string SID_NT_BATCH = "S-1-5-3";
const string SID_NT_INTERACTIVE = "S-1-5-4";
const string SID_NT_SERVICE = "S-1-5-6";
const string SID_NT_ANONYMOUS = "S-1-5-7";
const string SID_NT_PROXY = "S-1-5-8";
const string SID_NT_ENTERPRISE_DCS = "S-1-5-9";
const string SID_NT_SELF = "S-1-5-10";
const string SID_NT_AUTHENTICATED_USERS = "S-1-5-11";
const string SID_NT_RESTRICTED = "S-1-5-12";
const string SID_NT_TERMINAL_SERVER_USERS = "S-1-5-13";
const string SID_NT_REMOTE_INTERACTIVE = "S-1-5-14";
const string SID_NT_THIS_ORGANISATION = "S-1-5-15";
const string SID_NT_SYSTEM = "S-1-5-18";
const string SID_NT_LOCAL_SERVICE = "S-1-5-19";
const string SID_NT_NETWORK_SERVICE = "S-1-5-20";
/* SECURITY_BUILTIN_DOMAIN_RID */
const string SID_BUILTIN = "S-1-5-32";
const string SID_BUILTIN_ADMINISTRATORS = "S-1-5-32-544";
const string SID_BUILTIN_USERS = "S-1-5-32-545";
const string SID_BUILTIN_GUESTS = "S-1-5-32-546";
const string SID_BUILTIN_POWER_USERS = "S-1-5-32-547";
const string SID_BUILTIN_ACCOUNT_OPERATORS = "S-1-5-32-548";
const string SID_BUILTIN_SERVER_OPERATORS = "S-1-5-32-549";
const string SID_BUILTIN_PRINT_OPERATORS = "S-1-5-32-550";
const string SID_BUILTIN_BACKUP_OPERATORS = "S-1-5-32-551";
const string SID_BUILTIN_REPLICATOR = "S-1-5-32-552";
const string SID_BUILTIN_RAS_SERVERS = "S-1-5-32-553";
const string SID_BUILTIN_PREW2K = "S-1-5-32-554";
/* well-known domain RIDs */
const int DOMAIN_RID_LOGON = 9;
const int DOMAIN_RID_ADMINISTRATOR = 500;
const int DOMAIN_RID_GUEST = 501;
const int DOMAIN_RID_ADMINS = 512;
const int DOMAIN_RID_USERS = 513;
const int DOMAIN_RID_DCS = 516;
const int DOMAIN_RID_CERT_ADMINS = 517;
const int DOMAIN_RID_SCHEMA_ADMINS = 518;
const int DOMAIN_RID_ENTERPRISE_ADMINS = 519;
/*
privilege IDs. Please keep the IDs below 64. If we get more
than 64 then we need to change security_token
*/
typedef enum {
SEC_PRIV_SECURITY = 1,
SEC_PRIV_BACKUP = 2,
SEC_PRIV_RESTORE = 3,
SEC_PRIV_SYSTEMTIME = 4,
SEC_PRIV_SHUTDOWN = 5,
SEC_PRIV_REMOTE_SHUTDOWN = 6,
SEC_PRIV_TAKE_OWNERSHIP = 7,
SEC_PRIV_DEBUG = 8,
SEC_PRIV_SYSTEM_ENVIRONMENT = 9,
SEC_PRIV_SYSTEM_PROFILE = 10,
SEC_PRIV_PROFILE_SINGLE_PROCESS = 11,
SEC_PRIV_INCREASE_BASE_PRIORITY = 12,
SEC_PRIV_LOAD_DRIVER = 13,
SEC_PRIV_CREATE_PAGEFILE = 14,
SEC_PRIV_INCREASE_QUOTA = 15,
SEC_PRIV_CHANGE_NOTIFY = 16,
SEC_PRIV_UNDOCK = 17,
SEC_PRIV_MANAGE_VOLUME = 18,
SEC_PRIV_IMPERSONATE = 19,
SEC_PRIV_CREATE_GLOBAL = 20,
SEC_PRIV_ENABLE_DELEGATION = 21,
SEC_PRIV_INTERACTIVE_LOGON = 22,
SEC_PRIV_NETWORK_LOGON = 23,
SEC_PRIV_REMOTE_INTERACTIVE_LOGON = 24
} sec_privilege;
/* a domain SID. Note that unlike Samba3 this contains a pointer,
so you can't copy them using assignment */
typedef [public,gensize,noprint,noejs,nosize] struct {
uint8 sid_rev_num; /**< SID revision number */
[range(0,15)] int8 num_auths; /**< Number of sub-authorities */
uint8 id_auth[6]; /**< Identifier Authority */
uint32 sub_auths[num_auths];
} dom_sid;
typedef [bitmap8bit] bitmap {
SEC_ACE_FLAG_OBJECT_INHERIT = 0x01,
SEC_ACE_FLAG_CONTAINER_INHERIT = 0x02,
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT = 0x04,
SEC_ACE_FLAG_INHERIT_ONLY = 0x08,
SEC_ACE_FLAG_INHERITED_ACE = 0x10,
SEC_ACE_FLAG_VALID_INHERIT = 0x0f,
SEC_ACE_FLAG_SUCCESSFUL_ACCESS = 0x40,
SEC_ACE_FLAG_FAILED_ACCESS = 0x80
} security_ace_flags;
typedef [enum8bit] enum {
SEC_ACE_TYPE_ACCESS_ALLOWED = 0,
SEC_ACE_TYPE_ACCESS_DENIED = 1,
SEC_ACE_TYPE_SYSTEM_AUDIT = 2,
SEC_ACE_TYPE_SYSTEM_ALARM = 3,
SEC_ACE_TYPE_ALLOWED_COMPOUND = 4,
SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT = 5,
SEC_ACE_TYPE_ACCESS_DENIED_OBJECT = 6,
SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT = 7,
SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT = 8
} security_ace_type;
typedef bitmap {
SEC_ACE_OBJECT_TYPE_PRESENT = 0x00000001,
SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT = 0x00000002
} security_ace_object_flags;
typedef [nodiscriminant] union {
/* this is the 'schemaIDGUID' attribute of the attribute object in the schema naming context */
[case(SEC_ACE_OBJECT_TYPE_PRESENT)] GUID type;
[default];
} security_ace_object_type;
typedef [nodiscriminant] union {
/* this is the 'schemaIDGUID' attribute of the objectclass object in the schema naming context
* (of the parent container)
*/
[case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] GUID inherited_type;
[default];
} security_ace_object_inherited_type;
typedef struct {
security_ace_object_flags flags;
[switch_is(flags & SEC_ACE_OBJECT_TYPE_PRESENT)] security_ace_object_type type;
[switch_is(flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] security_ace_object_inherited_type inherited_type;
} security_ace_object;
typedef [nodiscriminant] union {
[case(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT)] security_ace_object object;
[case(SEC_ACE_TYPE_ACCESS_DENIED_OBJECT)] security_ace_object object;
[case(SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT)] security_ace_object object;
[case(SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT)] security_ace_object object;
[default];
} security_ace_object_ctr;
typedef [public,gensize,nosize] struct {
security_ace_type type; /* SEC_ACE_TYPE_* */
security_ace_flags flags; /* SEC_ACE_FLAG_* */
[value(ndr_size_security_ace(r,ndr->flags))] uint16 size;
uint32 access_mask;
[switch_is(type)] security_ace_object_ctr object;
dom_sid trustee;
} security_ace;
typedef enum {
SECURITY_ACL_REVISION_NT4 = 2,
SECURITY_ACL_REVISION_ADS = 4
} security_acl_revision;
const uint NT4_ACL_REVISION = SECURITY_ACL_REVISION_NT4;
typedef [public,gensize,nosize] struct {
security_acl_revision revision;
[value(ndr_size_security_acl(r,ndr->flags))] uint16 size;
[range(0,1000)] uint32 num_aces;
security_ace aces[num_aces];
} security_acl;
/* default revision for new ACLs */
typedef [enum8bit] enum {
SECURITY_DESCRIPTOR_REVISION_1 = 1
} security_descriptor_revision;
const int SD_REVISION = SECURITY_DESCRIPTOR_REVISION_1;
/* security_descriptor->type bits */
typedef [bitmap16bit] bitmap {
SEC_DESC_OWNER_DEFAULTED = 0x0001,
SEC_DESC_GROUP_DEFAULTED = 0x0002,
SEC_DESC_DACL_PRESENT = 0x0004,
SEC_DESC_DACL_DEFAULTED = 0x0008,
SEC_DESC_SACL_PRESENT = 0x0010,
SEC_DESC_SACL_DEFAULTED = 0x0020,
SEC_DESC_DACL_TRUSTED = 0x0040,
SEC_DESC_SERVER_SECURITY = 0x0080,
SEC_DESC_DACL_AUTO_INHERIT_REQ = 0x0100,
SEC_DESC_SACL_AUTO_INHERIT_REQ = 0x0200,
SEC_DESC_DACL_AUTO_INHERITED = 0x0400,
SEC_DESC_SACL_AUTO_INHERITED = 0x0800,
SEC_DESC_DACL_PROTECTED = 0x1000,
SEC_DESC_SACL_PROTECTED = 0x2000,
SEC_DESC_RM_CONTROL_VALID = 0x4000,
SEC_DESC_SELF_RELATIVE = 0x8000
} security_descriptor_type;
typedef [gensize,nosize,public,flag(NDR_LITTLE_ENDIAN)] struct {
security_descriptor_revision revision;
security_descriptor_type type; /* SEC_DESC_xxxx flags */
[relative] dom_sid *owner_sid;
[relative] dom_sid *group_sid;
[relative] security_acl *sacl; /* system ACL */
[relative] security_acl *dacl; /* user (discretionary) ACL */
} security_descriptor;
typedef [public] struct {
[range(0,0x40000),value(ndr_size_security_descriptor(sd,ndr->flags))] uint32 sd_size;
[subcontext(4)] security_descriptor *sd;
} sec_desc_buf;
typedef [public] struct {
dom_sid *user_sid;
dom_sid *group_sid;
uint32 num_sids;
[size_is(num_sids)] dom_sid *sids[*];
udlong privilege_mask;
} security_token;
/* bits that determine which parts of a security descriptor
are being queried/set */
typedef [public,bitmap32bit] bitmap {
SECINFO_OWNER = 0x00000001,
SECINFO_GROUP = 0x00000002,
SECINFO_DACL = 0x00000004,
SECINFO_SACL = 0x00000008
} security_secinfo;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+459
View File
@@ -0,0 +1,459 @@
#include "idl_types.h"
/*
svcctl interface definitions
*/
[ uuid("367abb81-9844-35f1-ad32-98f038001003"),
version(2.0),
pointer_default(unique),
pointer_default_top(unique),
endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"),
helpstring("Service Control")
] interface svcctl
{
typedef struct {
uint32 is_locked;
[string,charset(UTF16)] uint16 *lock_owner;
uint32 lock_duration;
} SERVICE_LOCK_STATUS;
typedef [v1_enum] enum {
SERVICE_STOPPED = 1,
SERVICE_START_PENDING = 2,
SERVICE_STOP_PENDING = 3,
SERVICE_RUNNING = 4,
SERVICE_CONTINUE_PENDING = 5,
SERVICE_PAUSE_PENDING = 6,
SERVICE_PAUSED = 7
} SERVICE_STATE;
typedef struct {
uint32 type;
uint32 state;
uint32 controls_accepted;
uint32 win32_exit_code;
uint32 service_exit_code;
uint32 check_point;
uint32 wait_hint;
} SERVICE_STATUS;
typedef struct {
[relative] astring *service_name;
[relative] astring *display_name;
SERVICE_STATUS status;
} ENUM_SERVICE_STATUS;
const int SERVICE_NO_CHANGE = 0xffffffff;
const int SERVICE_TYPE_KERNEL_DRIVER = 0x01;
const int SERVICE_TYPE_FS_DRIVER = 0x02;
const int SERVICE_TYPE_ADAPTER = 0x04;
const int SERVICE_TYPE_RECOGNIZER_DRIVER = 0x08;
const int SERVICE_TYPE_DRIVER=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER;
const int SERVICE_TYPE_WIN32_OWN_PROCESS = 0x10;
const int SERVICE_TYPE_WIN32_SHARE_PROCESS = 0x20;
const int SERVICE_TYPE_WIN32=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS;
const int SERVICE_INTERACTIVE_PROCESS = 0x00000100;
const int SERVICE_STATE_ACTIVE = 0x01;
const int SERVICE_STATE_INACTIVE = 0x02;
const int SERVICE_STATE_ALL = 0x03;
typedef [public,bitmap32bit] bitmap {
SV_TYPE_WORKSTATION = 0x00000001,
SV_TYPE_SERVER = 0x00000002,
SV_TYPE_SQLSERVER = 0x00000004,
SV_TYPE_DOMAIN_CTRL = 0x00000008,
SV_TYPE_DOMAIN_BAKCTRL = 0x00000010,
SV_TYPE_TIME_SOURCE = 0x00000020,
SV_TYPE_AFP = 0x00000040,
SV_TYPE_NOVELL = 0x00000080,
SV_TYPE_DOMAIN_MEMBER = 0x00000100,
SV_TYPE_PRINTQ_SERVER = 0x00000200,
SV_TYPE_DIALIN_SERVER = 0x00000400,
SV_TYPE_SERVER_UNIX = 0x00000800,
SV_TYPE_NT = 0x00001000,
SV_TYPE_WFW = 0x00002000,
SV_TYPE_SERVER_MFPN = 0x00004000,
SV_TYPE_SERVER_NT = 0x00008000,
SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
SV_TYPE_BACKUP_BROWSER = 0x00020000,
SV_TYPE_MASTER_BROWSER = 0x00040000,
SV_TYPE_DOMAIN_MASTER = 0x00080000,
SV_TYPE_SERVER_OSF = 0x00100000,
SV_TYPE_SERVER_VMS = 0x00200000,
SV_TYPE_WIN95_PLUS = 0x00400000,
SV_TYPE_DFS_SERVER = 0x00800000,
SV_TYPE_ALTERNATE_XPORT = 0x20000000,
SV_TYPE_LOCAL_LIST_ONLY = 0x40000000,
SV_TYPE_DOMAIN_ENUM = 0x80000000
} svcctl_ServerType;
const uint32 SV_TYPE_ALL = 0xFFFFFFFF;
/*****************/
/* Function 0x00 */
WERROR svcctl_CloseServiceHandle(
[in,out,ref] policy_handle *handle
);
/*****************/
/* Function 0x01 */
typedef enum {
FIXME=1
} SERVICE_CONTROL;
WERROR svcctl_ControlService(
[in,ref] policy_handle *handle,
[in] uint32 control,
[out,ref] SERVICE_STATUS *status
);
/*****************/
/* Function 0x02 */
WERROR svcctl_DeleteService([in,ref] policy_handle *handle);
/*****************/
/* Function 0x03 */
WERROR svcctl_LockServiceDatabase(
[in,ref] policy_handle *handle,
[out] policy_handle lock
);
/*****************/
/* Function 0x04 */
WERROR svcctl_QueryServiceObjectSecurity();
/*****************/
/* Function 0x05 */
WERROR svcctl_SetServiceObjectSecurity();
/*****************/
/* Function 0x06 */
WERROR svcctl_QueryServiceStatus(
[in,ref] policy_handle *handle,
[out,ref] SERVICE_STATUS *status);
/*****************/
/* Function 0x07 */
WERROR svcctl_SetServiceStatus();
/*****************/
/* Function 0x08 */
WERROR svcctl_UnlockServiceDatabase(
[in,out,ref] policy_handle *lock
);
/*****************/
/* Function 0x09 */
WERROR svcctl_NotifyBootConfigStatus();
/*****************/
/* Function 0x0a */
WERROR svcctl_SCSetServiceBitsW(
[in,ref] policy_handle *handle,
[in] uint32 bits,
[in] boolean32 bitson,
[in] boolean32 immediate);
/*****************/
/* Function 0x0b */
WERROR svcctl_ChangeServiceConfigW([in,ref] policy_handle *handle,
[in] uint32 type,
[in] uint32 start_type,
[in] uint32 error_control,
[in] [string,charset(UTF16)] uint16 *binary_path,
[in] [string,charset(UTF16)] uint16 *load_order_group,
[in,out] uint32 *tag_id,
[in,size_is(dependencies_size)] uint8 *dependencies,
[in] uint32 dependencies_size,
[in] [string,charset(UTF16)] uint16 *service_start_name,
[in,size_is(password_size)] uint8 *password,
[in] uint32 password_size,
[in] [string,charset(UTF16)] uint16 *display_name);
/*****************/
/* Function 0x0c */
WERROR svcctl_CreateServiceW([in,ref] policy_handle *scmanager_handle,
[in] [string,charset(UTF16)] uint16 service_name[],
[in] [string,charset(UTF16)] uint16 *display_name,
[in] uint32 desired_access,
[in] uint32 type,
[in] uint32 start_type,
[in] uint32 error_control,
[in] [string,charset(UTF16)] uint16 binary_path[],
[in] [string,charset(UTF16)] uint16 *load_order_group,
[in,out] uint32 *tag_id,
[in,size_is(dependencies_size)] uint8 *dependencies,
[in] uint32 dependencies_size,
[in] [string,charset(UTF16)] uint16 *service_start_name,
[in,size_is(password_size)] uint8 *password,
[in] uint32 password_size,
[out,ref] policy_handle *handle);
/*****************/
/* Function 0x0d */
WERROR svcctl_EnumDependentServicesW([in,ref] policy_handle *service,
[in] uint32 state,
[out] ENUM_SERVICE_STATUS *status,
[in] uint32 buf_size,
[out] uint32 bytes_needed,
[out] uint32 services_returned);
/*****************/
/* Function 0x0e */
WERROR svcctl_EnumServicesStatusW(
[in,ref] policy_handle *handle,
[in] uint32 type,
[in] uint32 state,
[in] uint32 buf_size,
[out,size_is(buf_size)] uint8 service[*],
[out] uint32 bytes_needed,
[out] uint32 services_returned,
[in,out] uint32 *resume_handle
);
/*****************/
/* Function 0x0f */
WERROR svcctl_OpenSCManagerW(
[in] [string,charset(UTF16)] uint16 *MachineName,
[in] [string,charset(UTF16)] uint16 *DatabaseName,
[in] uint32 access_mask,
[out,ref] policy_handle *handle);
/*****************/
/* Function 0x10 */
WERROR svcctl_OpenServiceW([in,ref] policy_handle *scmanager_handle,
[in] [string,charset(UTF16)] uint16 ServiceName[],
[in] uint32 access_mask,
[out,ref] policy_handle *handle);
/*****************/
/* Function 0x11 */
WERROR svcctl_QueryServiceConfigW([in,ref] policy_handle *handle,
[out] uint8 query[buf_size], /*QUERY_SERVICE_CONFIG */
[in] uint32 buf_size,
[out] uint32 bytes_needed
);
/*****************/
/* Function 0x12 */
WERROR svcctl_QueryServiceLockStatusW(
[in,ref] policy_handle *handle,
[in] uint32 buf_size,
[out,ref] SERVICE_LOCK_STATUS *status,
[out,ref] uint32 *required_buf_size
);
/*****************/
/* Function 0x13 */
WERROR svcctl_StartServiceW(
[in,ref] policy_handle *handle,
[in] uint32 NumArgs,
[in,length_is(NumArgs)] [string,charset(UTF16)] uint16 *Arguments);
/*****************/
/* Function 0x14 */
WERROR svcctl_GetServiceDisplayNameW([in,ref] policy_handle *handle,
[in] [string,charset(UTF16)] uint16 *service_name,
[out] [string,charset(UTF16)] uint16 *display_name,
[in,out] uint32 *display_name_length);
/*****************/
/* Function 0x15 */
WERROR svcctl_GetServiceKeyNameW([in,ref] policy_handle *handle,
[in] [string,charset(UTF16)] uint16 *service_name,
[out] [string,charset(UTF16)] uint16 *key_name,
[in,out] uint32 *display_name_length);
/*****************/
/* Function 0x16 */
WERROR svcctl_SCSetServiceBitsA(
[in,ref] policy_handle *handle,
[in] uint32 bits,
[in] boolean32 bitson,
[in] boolean32 immediate);
/*****************/
/* Function 0x17 */
WERROR svcctl_ChangeServiceConfigA([in,ref] policy_handle *handle,
[in] uint32 type,
[in] uint32 start,
[in] uint32 error,
[in] [string,charset(UTF16)] uint16 *binary_path,
[in] [string,charset(UTF16)] uint16 *load_order_group,
[out] uint32 tag_id,
[in] [string,charset(UTF16)] uint16 *dependencies,
[in] [string,charset(UTF16)] uint16 *service_start_name,
[in] [string,charset(UTF16)] uint16 *password,
[in] [string,charset(UTF16)] uint16 *display_name);
/*****************/
/* Function 0x18 */
WERROR svcctl_CreateServiceA([in,ref] policy_handle *handle,
[in] [string,charset(UTF16)] uint16 *ServiceName,
[in] [string,charset(UTF16)] uint16 *DisplayName,
[in] uint32 desired_access,
[in] uint32 type,
[in] uint32 start_type,
[in] uint32 error_control,
[in] [string,charset(UTF16)] uint16 *binary_path,
[in] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
[out] uint32 *TagId,
[in] [string,charset(UTF16)] uint16 *dependencies,
[in] [string,charset(UTF16)] uint16 *service_start_name,
[in] [string,charset(UTF16)] uint16 *password);
/*****************/
/* Function 0x19 */
WERROR svcctl_EnumDependentServicesA([in,ref] policy_handle *service,
[in] uint32 state,
[out] ENUM_SERVICE_STATUS *status,
[in] uint32 buf_size,
[out] uint32 bytes_needed,
[out] uint32 services_returned);
/*****************/
/* Function 0x1a */
WERROR svcctl_EnumServicesStatusA(
[in,ref] policy_handle *handle,
[in] uint32 type,
[in] uint32 state,
[in] uint32 buf_size,
[out,size_is(buf_size)] uint8 service[*],
[out] uint32 bytes_needed,
[out] uint32 services_returned,
[in,out] uint32 *resume_handle
);
/*****************/
/* Function 0x1b */
WERROR svcctl_OpenSCManagerA(
[in] [string,charset(UTF16)] uint16 *MachineName,
[in] [string,charset(UTF16)] uint16 *DatabaseName,
[in] uint32 access_mask,
[out,ref] policy_handle *handle);
/*****************/
/* Function 0x1c */
WERROR svcctl_OpenServiceA([in,ref] policy_handle *scmanager_handle,
[in] [string,charset(UTF16)] uint16 *ServiceName,
[in] uint32 access_mask);
/*****************/
/* Function 0x1d */
WERROR svcctl_QueryServiceConfigA([in,ref] policy_handle *handle,
[out] uint8 query[buf_size], /*QUERYU_SERVICE_CONFIG */
[in] uint32 buf_size,
[out] uint32 bytes_needed
);
/*****************/
/* Function 0x1e */
WERROR svcctl_QueryServiceLockStatusA(
[in,ref] policy_handle *handle,
[in] uint32 buf_size,
[out,ref] SERVICE_LOCK_STATUS *status,
[out,ref] uint32 *required_buf_size
);
/*****************/
/* Function 0x1f */
WERROR svcctl_StartServiceA(
[in,ref] policy_handle *handle,
[in] uint32 NumArgs,
[in,length_is(NumArgs)] [string,charset(UTF16)] uint16 *Arguments);
/*****************/
/* Function 0x20 */
WERROR svcctl_GetServiceDisplayNameA([in,ref] policy_handle *handle,
[in] [string,charset(UTF16)] uint16 *service_name,
[out] [string,charset(UTF16)] uint16 *display_name,
[in,out] uint32 *display_name_length);
/*****************/
/* Function 0x21 */
WERROR svcctl_GetServiceKeyNameA([in,ref] policy_handle *handle,
[in] [string,charset(UTF16)] uint16 *service_name,
[out] [string,charset(UTF16)] uint16 *key_name,
[in,out] uint32 *display_name_length);
/*****************/
/* Function 0x22 */
WERROR svcctl_GetCurrentGroupeStateW();
/*****************/
/* Function 0x23 */
WERROR svcctl_EnumServiceGroupW();
/*****************/
/* Function 0x24 */
WERROR svcctl_ChangeServiceConfig2A([in,ref] policy_handle *handle,
[in] uint32 info_level,
[in] uint8 *info
);
/*****************/
/* Function 0x25 */
WERROR svcctl_ChangeServiceConfig2W([in,ref] policy_handle *handle,
[in] uint32 info_level,
[in] uint8 *info);
/*****************/
/* Function 0x26 */
WERROR svcctl_QueryServiceConfig2A(
[in,ref] policy_handle *handle,
[in] uint32 info_level,
[out] uint8 buffer[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed);
/*****************/
/* Function 0x27 */
WERROR svcctl_QueryServiceConfig2W(
[in,ref] policy_handle *handle,
[in] uint32 info_level,
[out] uint8 buffer[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed);
/*****************/
/* Function 0x28 */
WERROR svcctl_QueryServiceStatusEx(
[in,ref] policy_handle *handle,
[in] uint32 info_level,
[out] uint8 buffer[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed);
/*****************/
/* Function 0x29 */
WERROR EnumServicesStatusExA(
[in,ref] policy_handle *scmanager,
[in] uint32 info_level,
[in] uint32 type,
[in] uint32 state,
[out] uint8 services[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed,
[out] uint32 service_returned,
[in,out] uint32 *resume_handle,
[out] [string,charset(UTF16)] uint16 *group_name);
/*****************/
/* Function 0x2a */
WERROR EnumServicesStatusExW(
[in,ref] policy_handle *scmanager,
[in] uint32 info_level,
[in] uint32 type,
[in] uint32 state,
[out] uint8 services[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed,
[out] uint32 service_returned,
[in,out] uint32 *resume_handle,
[out] [string,charset(UTF16)] uint16 *group_name);
/*****************/
/* Function 0x2b */
WERROR svcctl_SCSendTSMessage();
}
+17
View File
@@ -0,0 +1,17 @@
/*
distributed key tracking services
*/
[
uuid("300f3532-38cc-11d0-a3f0-0020af6b0add"),
version(1.2),
pointer_default(unique),
helpstring("Distributed Key Tracking Service")
]
interface trkwks
{
/*****************/
/* Function 0x00 */
WERROR trkwks_Unknown0();
}
+56
View File
@@ -0,0 +1,56 @@
#include "idl_types.h"
/*
Unixinfo interface definition
*/
import "security.idl";
[ uuid("9c54e310-a955-4885-bd31-78787147dfa6"),
version(0.0),
endpoint("ncacn_np:[\\pipe\\unixinfo]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
helpstring("Unixinfo specific stuff")
] interface unixinfo
{
/******************/
/* Function: 0x00 */
NTSTATUS unixinfo_SidToUid (
[in] dom_sid sid,
[out] hyper *uid
);
/******************/
/* Function: 0x01 */
NTSTATUS unixinfo_UidToSid (
[in] hyper uid,
[out] dom_sid *sid
);
/******************/
/* Function: 0x02 */
NTSTATUS unixinfo_SidToGid (
[in] dom_sid sid,
[out] hyper *gid
);
/******************/
/* Function: 0x03 */
NTSTATUS unixinfo_GidToSid (
[in] hyper gid,
[out] dom_sid *sid
);
typedef struct {
NTSTATUS status;
utf8string homedir;
utf8string shell;
} unixinfo_GetPWUidInfo;
/******************/
/* Function: 0x04 */
NTSTATUS unixinfo_GetPWUid (
[in,out,ref,range(0,1023)] uint32 *count,
[in,size_is(*count)] hyper uids[],
[out,size_is(*count)] unixinfo_GetPWUidInfo infos[*]
);
}
+21
View File
@@ -0,0 +1,21 @@
/*
w32time interface definitions
*/
[
uuid("8fb6d884-2388-11d0-8c35-00c04fda2795"),
endpoint("ncacn_np:[\\pipe\\srvsvc]","ncacn_np:[\\pipe\\atsvc]","ncacn_np:[\\pipe\\browser]","ncacn_np:[\\pipe\\keysvc]","ncacn_np:[\\pipe\\wkssvc]"),
version(4.1),
pointer_default(unique),
helpstring("Win32 Time Server")
]
interface w32time
{
/*****************/
/* Function 0x00 */
WERROR w32time_SyncTime();
WERROR w32time_GetNetLogonServiceBits();
WERROR w32time_QueryProviderStatus();
}
+39
View File
@@ -0,0 +1,39 @@
/*
winbind IRPC interface
*/
#include "idl_types.h"
import "netlogon.idl";
[
uuid("245f3e6b-3c5d-6e21-3a2d-2a3d645b7221"),
version(1.0),
pointer_default(unique)
]
interface winbind
{
declare [switch_type(uint16)] union netr_LogonLevel;
declare [switch_type(uint16)] union netr_Validation;
/* a call to get runtime informations */
void winbind_information(/* TODO */);
/*
* a call to trigger some internal events,
* for use in torture tests...
*/
NTSTATUS winbind_remote_control(/* TODO */);
/*
* do a netr_LogonSamLogon() against the right DC
*/
NTSTATUS winbind_SamLogon(
[in] uint16 logon_level,
[in] [switch_is(logon_level)] netr_LogonLevel logon,
[in] uint16 validation_level,
[out] [switch_is(validation_level)] netr_Validation validation,
[out] uint8 authoritative,
[in,out] uint32 flags
);
}
+52
View File
@@ -0,0 +1,52 @@
IMPORT security_secinfo offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_winreg_winreg_GetKeySecurity_sec_info, NULL);
HF_FIELD hf_winreg_access_required "Access Required" "winreg.access_required" FT_UINT32 BASE_HEX NULL 0 "" "" ""
HF_RENAME hf_winreg_winreg_OpenHKCR_access_required hf_winreg_access_required
HF_RENAME hf_winreg_winreg_OpenHKLM_access_required hf_winreg_access_required
HF_RENAME hf_winreg_winreg_OpenHKU_access_required hf_winreg_access_required
HF_RENAME hf_winreg_winreg_CreateKey_access_required hf_winreg_access_required
HF_RENAME hf_winreg_winreg_OpenHKCC_access_required hf_winreg_access_required
HF_RENAME hf_winreg_winreg_OpenHKDD_access_required hf_winreg_access_required
HF_RENAME hf_winreg_winreg_OpenHKPT_access_required hf_winreg_access_required
HF_RENAME hf_winreg_winreg_OpenHKPN_access_required hf_winreg_access_required
HF_FIELD hf_winreg_system_name "System Name" "winreg.system_name" FT_UINT16 BASE_DEC NULL 0 "" "" ""
HF_RENAME hf_winreg_winreg_OpenHKCR_system_name hf_winreg_system_name
HF_RENAME hf_winreg_winreg_OpenHKCU_system_name hf_winreg_system_name
HF_RENAME hf_winreg_winreg_OpenHKLM_system_name hf_winreg_system_name
HF_RENAME hf_winreg_winreg_OpenHKPD_system_name hf_winreg_system_name
HF_RENAME hf_winreg_winreg_OpenHKU_system_name hf_winreg_system_name
HF_RENAME hf_winreg_winreg_OpenHKCC_system_name hf_winreg_system_name
HF_RENAME hf_winreg_winreg_OpenHKDD_system_name hf_winreg_system_name
HF_RENAME hf_winreg_winreg_OpenHKPT_system_name hf_winreg_system_name
HF_RENAME hf_winreg_winreg_OpenHKPN_system_name hf_winreg_system_name
HF_FIELD hf_winreg_handle "Handle" "winreg.handle" FT_BYTES BASE_NONE NULL 0 "" "" ""
HF_RENAME hf_winreg_winreg_OpenHKCR_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenHKCU_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenHKLM_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenHKPD_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenHKU_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_CloseKey_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_CreateKey_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_DeleteKey_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_DeleteValue_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_EnumKey_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_EnumValue_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_FlushKey_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_GetKeySecurity_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_LoadKey_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_NotifyChangeKeyValue_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenKey_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_QueryInfoKey_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_QueryValue_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_SetKeySecurity_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_SetValue_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_GetVersion_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenHKCC_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenHKDD_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenHKPT_handle hf_winreg_handle
HF_RENAME hf_winreg_winreg_OpenHKPN_handle hf_winreg_handle
+365
View File
@@ -0,0 +1,365 @@
/*
winreg interface definition
*/
import "lsa.idl", "initshutdown.idl", "security.idl";
[
uuid("338cd001-2244-31f1-aaaa-900038001003"),
version(1.0),
endpoint("ncacn_np:[\\pipe\\winreg]","ncacn_ip_tcp:","ncalrpc:"),
pointer_default(unique),
pointer_default_top(unique),
helpstring("Remote Registry Service")
] interface winreg
{
declare bitmap security_secinfo;
typedef [bitmap32bit] bitmap {
} winreg_AccessMask;
typedef [v1_enum] enum {
REG_NONE = 0,
REG_SZ = 1,
REG_EXPAND_SZ = 2,
REG_BINARY = 3,
REG_DWORD = 4,
REG_DWORD_BIG_ENDIAN = 5,
REG_LINK = 6,
REG_MULTI_SZ = 7,
REG_RESOURCE_LIST = 8,
REG_FULL_RESOURCE_DESCRIPTOR = 9,
REG_RESOURCE_REQUIREMENTS_LIST = 10,
REG_QWORD = 11
} winreg_Type;
typedef [public,noejs] struct {
[value(strlen_m_term(name)*2)] uint16 name_len;
[value(strlen_m_term(name)*2)] uint16 name_size;
[string,charset(UTF16)] uint16 *name;
} winreg_String;
/******************/
/* Function: 0x00 */
WERROR winreg_OpenHKCR(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x01 */
WERROR winreg_OpenHKCU(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x02 */
WERROR winreg_OpenHKLM(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x03 */
WERROR winreg_OpenHKPD(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x04 */
WERROR winreg_OpenHKU(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x05 */
WERROR winreg_CloseKey(
[in,out,ref] policy_handle *handle
);
/******************/
/* Function: 0x06 */
typedef struct {
[size_is(size),length_is(len)] uint8 *data;
uint32 size;
uint32 len;
} KeySecurityData;
typedef struct {
uint32 length;
KeySecurityData sd;
boolean8 inherit;
} winreg_SecBuf;
typedef [v1_enum] enum {
REG_ACTION_NONE = 0, /* used by caller */
REG_CREATED_NEW_KEY = 1,
REG_OPENED_EXISTING_KEY = 2
} winreg_CreateAction;
WERROR winreg_CreateKey(
[in,ref] policy_handle *handle,
[in] winreg_String name,
[in] winreg_String keyclass,
[in] uint32 options,
[in] winreg_AccessMask access_mask,
[in,unique] winreg_SecBuf *secdesc,
[out,ref] policy_handle *new_handle,
[in,out,unique] winreg_CreateAction *action_taken
);
/******************/
/* Function: 0x07 */
WERROR winreg_DeleteKey(
[in,ref] policy_handle *handle,
[in] winreg_String key
);
/******************/
/* Function: 0x08 */
WERROR winreg_DeleteValue(
[in,ref] policy_handle *handle,
[in] winreg_String value
);
typedef struct {
[value(strlen_m_term(name)*2)] uint16 length;
/* size cannot be auto-set by value() as it is the
amount of space the server is allowed to use for this
string in the reply, not its current size */
uint16 size;
[size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name;
} winreg_StringBuf;
WERROR winreg_EnumKey(
[in,ref] policy_handle *handle,
[in] uint32 enum_index,
[in,out,ref] winreg_StringBuf *name,
[in,out,unique] winreg_StringBuf *keyclass,
[in,out,unique] NTTIME *last_changed_time
);
/******************/
/* Function: 0x0a */
WERROR winreg_EnumValue(
[in,ref] policy_handle *handle,
[in] uint32 enum_index,
[in,out,ref] winreg_StringBuf *name,
[in,out,unique] winreg_Type *type,
[in,out,unique,size_is(*size),length_is(*length)] uint8 *value,
[in,out,unique] uint32 *size,
[in,out,unique] uint32 *length
);
/******************/
/* Function: 0x0b */
WERROR winreg_FlushKey(
[in,ref] policy_handle *handle
);
/******************/
/* Function: 0x0c */
WERROR winreg_GetKeySecurity(
[in,ref] policy_handle *handle,
[in] security_secinfo sec_info,
[in,out,ref] KeySecurityData *sd
);
/******************/
/* Function: 0x0d */
WERROR winreg_LoadKey(
[in,ref] policy_handle *handle,
[in] winreg_String *keyname,
[in] winreg_String *filename
);
/******************/
/* Function: 0x0e */
WERROR winreg_NotifyChangeKeyValue(
[in,ref] policy_handle *handle,
[in] uint8 watch_subtree,
[in] uint32 notify_filter,
[in] uint32 unknown,
[in] winreg_String string1,
[in] winreg_String string2,
[in] uint32 unknown2
);
/******************/
/* Function: 0x0f */
WERROR winreg_OpenKey(
[in,ref] policy_handle *parent_handle,
[in] winreg_String keyname,
[in] uint32 unknown,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x10 */
WERROR winreg_QueryInfoKey(
[in,ref] policy_handle *handle,
[in] winreg_String class_in,
[out,unique] winreg_String *class_out,
[out,ref] uint32 *num_subkeys,
[out,ref] uint32 *max_subkeylen,
[out,ref] uint32 *max_subkeysize,
[out,ref] uint32 *num_values,
[out,ref] uint32 *max_valnamelen,
[out,ref] uint32 *max_valbufsize,
[out,ref] uint32 *secdescsize,
[out,ref] NTTIME *last_changed_time
);
/******************/
/* Function: 0x11 */
WERROR winreg_QueryValue(
[in,ref] policy_handle *handle,
[in] winreg_String value_name,
[in,out] winreg_Type *type,
[in,out,size_is(*size),length_is(*length)] uint8 *data,
[in,out] uint32 *size,
[in,out] uint32 *length
);
/******************/
/* Function: 0x12 */
WERROR winreg_ReplaceKey(
);
/******************/
/* Function: 0x13 */
WERROR winreg_RestoreKey(
);
/******************/
/* Function: 0x14 */
WERROR winreg_SaveKey(
);
/******************/
/* Function: 0x15 */
WERROR winreg_SetKeySecurity(
[in,ref] policy_handle *handle,
[in] winreg_AccessMask access_mask,
[in,out,ref] KeySecurityData *sd
);
/******************/
/* Function: 0x16 */
WERROR winreg_SetValue(
[in,ref] policy_handle *handle,
[in] winreg_String name,
[in] winreg_Type type,
[in,size_is(size),ref] uint8 *data,
[in] uint32 size
);
/******************/
/* Function: 0x17 */
WERROR winreg_UnLoadKey(
);
/******************/
/* Function: 0x18 */
WERROR winreg_InitiateSystemShutdown(
[in] uint16 *hostname,
[in] initshutdown_String *message,
[in] uint32 timeout,
[in] uint8 force_apps,
[in] uint8 reboot
);
/******************/
/* Function: 0x19 */
WERROR winreg_AbortSystemShutdown(
[in] uint16 *server
);
/******************/
/* Function: 0x1a */
WERROR winreg_GetVersion(
[in,ref] policy_handle *handle,
[out,ref] uint32 *version
);
/******************/
/* Function: 0x1b */
WERROR winreg_OpenHKCC(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x1c */
WERROR winreg_OpenHKDD(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
typedef struct {
winreg_String *name;
winreg_Type type;
uint32 offset;
uint32 length;
} QueryMultipleValue;
/******************/
/* Function: 0x1d */
WERROR winreg_QueryMultipleValues(
[in,ref] policy_handle *key_handle,
[in,out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values,
[in] uint32 num_values,
[in,out,size_is(*buffer_size),length_is(*buffer_size)] uint8 *buffer,
[in,out,ref] uint32 *buffer_size
);
/******************/
/* Function: 0x1e */
WERROR winreg_InitiateSystemShutdownEx(
[in] uint16 *hostname,
[in] initshutdown_String *message,
[in] uint32 timeout,
[in] uint8 force_apps,
[in] uint8 reboot,
[in] uint32 reason
);
/******************/
/* Function: 0x1f */
WERROR winreg_SaveKeyEx(
);
/******************/
/* Function: 0x20 */
WERROR winreg_OpenHKPT(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x21 */
WERROR winreg_OpenHKPN(
[in] uint16 *system_name,
[in] winreg_AccessMask access_mask,
[out,ref] policy_handle *handle
);
/******************/
/* Function: 0x22 */
WERROR winreg_QueryMultipleValues2(
);
}
+27
View File
@@ -0,0 +1,27 @@
[
uuid("45f52c28-7f9f-101a-b52b-08002b2efabe"),
version(1.0),
helpstring("Server-to-Server WINS")
] interface WinsPipe
{
void WinsRecordAction();
void WinsStatus();
void WinsTrigger();
void WinsDoStaticInit();
void WinsDoScavenging();
void WinsGetDbRecs();
void WinsTerm();
void WinsBackup();
void WinsDelDbRecs();
void WinsPullRange();
void WinsSetPriorityClass();
void WinsResetCounters();
void WinsWorkerThreadUpdate();
void WinsGetNameAndAdd();
void WinsGetBrowserNames_Old();
void WinsDeleteWins();
void WinsSetFlags();
void WinsGetDbRecsByName();
void WinsStatusWHdl();
void WinsDoScanvenging2();
}
+175
View File
@@ -0,0 +1,175 @@
#include "idl_types.h"
/*
IDL structures for WINS replication protocol (port 42)
Note that WINS replication is not traditionally encoded using
IDL/NDR
Written by Andrew Tridgell <tridge@osdl.org>
*/
import "nbt.idl";
interface wrepl
{
const int WINS_REPLICATION_PORT = 42;
typedef [flag(NDR_BIG_ENDIAN)] struct {
ipv4address owner;
ipv4address ip;
} wrepl_ip;
typedef [flag(NDR_LITTLE_ENDIAN)] struct {
uint32 num_ips;
wrepl_ip ips[num_ips];
} wrepl_address_list;
typedef [nodiscriminant] union {
[case(0)] ipv4address ip;
[case(2)] wrepl_address_list addresses;
} wrepl_addresses;
typedef [enum8bit] enum {
WREPL_TYPE_UNIQUE = 0x0,
WREPL_TYPE_GROUP = 0x1,
WREPL_TYPE_SGROUP = 0x2,
WREPL_TYPE_MHOMED = 0x3
} wrepl_name_type;
typedef [enum8bit] enum {
WREPL_STATE_ACTIVE = 0x0,
WREPL_STATE_RELEASED = 0x1,
WREPL_STATE_TOMBSTONE = 0x2,
WREPL_STATE_RESERVED = 0x3
} wrepl_name_state;
typedef [enum8bit] enum {
WREPL_NODE_B = 0x0,
WREPL_NODE_P = 0x1,
WREPL_NODE_M = 0x2,
WREPL_NODE_H = 0x3
} wrepl_name_node;
typedef [bitmap32bit] bitmap {
WREPL_FLAGS_RECORD_TYPE = 0x00000003,
WREPL_FLAGS_RECORD_STATE = 0x0000000C,
WREPL_FLAGS_REGISTERED_LOCAL = 0x00000010,
WREPL_FLAGS_NODE_TYPE = 0x00000060,
WREPL_FLAGS_IS_STATIC = 0x00000080
} wrepl_flags;
typedef [v1_enum] enum {
WREPL_GROUP_FLAG_NO_GROUP = 0x00000000,
WREPL_GROUP_FLAG_IS_GROUP = 0x00000001
} wrepl_group_flag;
#define WREPL_IS_GROUP(flags) (\
((((flags) & WREPL_FLAGS_RECORD_TYPE) == WREPL_TYPE_GROUP)|| \
(((flags) & WREPL_FLAGS_RECORD_TYPE) == WREPL_TYPE_SGROUP))\
? WREPL_GROUP_FLAG_IS_GROUP : WREPL_GROUP_FLAG_NO_GROUP)
typedef struct {
wrepl_nbt_name name;
wrepl_flags flags;
[flag(NDR_LITTLE_ENDIAN),value(WREPL_IS_GROUP(flags))] wrepl_group_flag is_group;
udlongr id;
[switch_is(flags & 2)] wrepl_addresses addresses;
ipv4address unknown;
} wrepl_wins_name;
typedef struct {
uint32 num_names;
wrepl_wins_name names[num_names];
} wrepl_send_reply;
typedef struct {
ipv4address address;
udlongr max_version;
udlongr min_version;
uint32 type;
} wrepl_wins_owner;
typedef struct {
uint32 partner_count;
wrepl_wins_owner partners[partner_count];
ipv4address initiator;
} wrepl_table;
typedef [v1_enum] enum {
WREPL_REPL_TABLE_QUERY = 0,
WREPL_REPL_TABLE_REPLY = 1,
WREPL_REPL_SEND_REQUEST = 2,
WREPL_REPL_SEND_REPLY = 3,
WREPL_REPL_UPDATE = 4,
WREPL_REPL_UPDATE2 = 5,
WREPL_REPL_INFORM = 8,
WREPL_REPL_INFORM2 = 9
} wrepl_replication_cmd;
typedef [nodiscriminant] union {
[case(WREPL_REPL_TABLE_QUERY)] ;
[case(WREPL_REPL_TABLE_REPLY)] wrepl_table table;
[case(WREPL_REPL_SEND_REQUEST)] wrepl_wins_owner owner;
[case(WREPL_REPL_SEND_REPLY)] wrepl_send_reply reply;
[case(WREPL_REPL_UPDATE)] wrepl_table table;
[case(WREPL_REPL_UPDATE2)] wrepl_table table;
[case(WREPL_REPL_INFORM)] wrepl_table table;
[case(WREPL_REPL_INFORM2)] wrepl_table table;
} wrepl_replication_info;
typedef struct {
wrepl_replication_cmd command;
[switch_is(command)] wrepl_replication_info info;
} wrepl_replication;
typedef struct {
uint32 assoc_ctx;
uint16 minor_version;
uint16 major_version;
} wrepl_start;
typedef struct {
uint32 reason;
} wrepl_stop;
typedef [v1_enum] enum {
WREPL_START_ASSOCIATION = 0,
WREPL_START_ASSOCIATION_REPLY = 1,
WREPL_STOP_ASSOCIATION = 2,
WREPL_REPLICATION = 3
} wrepl_mess_type;
typedef [nodiscriminant] union {
[case(WREPL_START_ASSOCIATION)] wrepl_start start;
[case(WREPL_START_ASSOCIATION_REPLY)] wrepl_start start_reply;
[case(WREPL_STOP_ASSOCIATION)] wrepl_stop stop;
[case(WREPL_REPLICATION)] wrepl_replication replication;
} wrepl_message;
/*
the opcode appears to be a bitfield, but as far as I can tell
you must always set the following bits. Additional bits don't
seem to matter. Very strange.
*/
const int WREPL_OPCODE_BITS = 0x7800;
typedef [gensize,flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
uint32 opcode;
uint32 assoc_ctx;
wrepl_mess_type mess_type;
[switch_is(mess_type)] wrepl_message message;
[flag(NDR_REMAINING)] DATA_BLOB padding;
} wrepl_packet;
typedef [flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
[value(ndr_size_wrepl_packet(&packet, ndr->flags))] uint32 size;
wrepl_packet packet;
} wrepl_wrap;
void decode_winsrepl(
[in] wrepl_wrap p
);
}
+13
View File
@@ -0,0 +1,13 @@
/*
winstation interface definition
*/
#include "idl_types.h"
[ uuid("5ca4a760-ebb1-11cf-8611-00a0245420ed"),
version(1.0),
helpstring("Terminal Services remote management")
] interface winstation
{
void winstation_foo();
}
+394
View File
@@ -0,0 +1,394 @@
/*
wkssvc interface definitions
*/
import "srvsvc.idl";
[ uuid("6bffd098-a112-3610-9833-46c3f87e345a"),
version(1.0),
pointer_default(unique),
pointer_default_top(unique),
helpstring("Workstation Service")
] interface wkssvc
{
declare [v1_enum] enum srvsvc_PlatformId;
#define BOOL uint32
/******************/
/* Function: 0x00 */
typedef struct {
srvsvc_PlatformId platform_id;
[string,charset(UTF16)] uint16 *server_name;
[string,charset(UTF16)] uint16 *domain_name;
uint32 version_major;
uint32 version_minor;
} wkssvc_NetWkstaInfo100;
typedef struct {
srvsvc_PlatformId platform_id;
[string,charset(UTF16)] uint16 *server_name;
[string,charset(UTF16)] uint16 *domain_name;
uint32 version_major;
uint32 version_minor;
[string,charset(UTF16)] uint16 *lan_root;
} wkssvc_NetWkstaInfo101;
typedef struct {
srvsvc_PlatformId platform_id;
[string,charset(UTF16)] uint16 *server_name;
[string,charset(UTF16)] uint16 *domain_name;
uint32 version_major;
uint32 version_minor;
[string,charset(UTF16)] uint16 *lan_root;
uint32 logged_on_users;
} wkssvc_NetWkstaInfo102;
typedef struct {
uint32 char_wait;
uint32 collection_time;
uint32 maximum_collection_count;
uint32 keep_connection;
uint32 max_commands;
uint32 session_timeout;
uint32 size_char_buf;
uint32 max_threads;
uint32 lock_quota;
uint32 lock_increment;
uint32 lock_maximum;
uint32 pipe_increment;
uint32 pipe_maximum;
uint32 cache_file_timeout;
uint32 dormant_file_limit;
uint32 read_ahead_throughput;
uint32 num_mailslot_buffers;
uint32 num_srv_announce_buffers;
uint32 max_illegal_dgram_events;
uint32 dgram_event_reset_freq;
BOOL log_election_packets;
BOOL use_opportunistic_locking;
BOOL use_unlock_behind;
BOOL use_close_behind;
BOOL buf_named_pipes;
BOOL use_lock_read_unlock;
BOOL utilize_nt_caching;
BOOL use_raw_read;
BOOL use_raw_write;
BOOL use_write_raw_data;
BOOL use_encryption;
BOOL buf_files_deny_write;
BOOL buf_read_only_files;
BOOL force_core_create_mode;
BOOL use_512_byte_max_transfer;
} wkssvc_NetWkstaInfo502;
typedef struct {
uint32 char_wait;
} wkssvc_NetWkstaInfo1010;
typedef struct {
uint32 collection_time;
} wkssvc_NetWkstaInfo1011;
typedef struct {
uint32 maximum_collection_count;
} wkssvc_NetWkstaInfo1012;
typedef struct {
uint32 keep_connection;
} wkssvc_NetWkstaInfo1013;
typedef struct {
uint32 session_timeout;
} wkssvc_NetWkstaInfo1018;
typedef struct {
uint32 size_char_buf;
} wkssvc_NetWkstaInfo1023;
typedef struct {
uint32 errorlog_sz;
} wkssvc_NetWkstaInfo1027;
typedef struct {
uint32 max_threads;
} wkssvc_NetWkstaInfo1033;
typedef union {
[case(100)] wkssvc_NetWkstaInfo100 *info100;
[case(101)] wkssvc_NetWkstaInfo101 *info101;
[case(102)] wkssvc_NetWkstaInfo102 *info102;
[case(502)] wkssvc_NetWkstaInfo502 *info502;
[case(1010)] wkssvc_NetWkstaInfo1010 *info1010;
[case(1011)] wkssvc_NetWkstaInfo1011 *info1011;
[case(1012)] wkssvc_NetWkstaInfo1012 *info1012;
[case(1013)] wkssvc_NetWkstaInfo1013 *info1013;
[case(1018)] wkssvc_NetWkstaInfo1018 *info1018;
[case(1023)] wkssvc_NetWkstaInfo1023 *info1023;
[case(1027)] wkssvc_NetWkstaInfo1027 *info1027;
[case(1033)] wkssvc_NetWkstaInfo1033 *info1033;
[default] ;
} wkssvc_NetWkstaInfo;
WERROR wkssvc_NetWkstaGetInfo(
[in] [string,charset(UTF16)] uint16 *server_name,
[in] uint32 level,
[out,switch_is(level),ref] wkssvc_NetWkstaInfo *info
);
/******************/
/* Function: 0x01 */
WERROR wkssvc_NetWkstaSetInfo(
[in] [string,charset(UTF16)] uint16 *server_name,
[in] uint32 level,
[in,switch_is(level),ref] wkssvc_NetWkstaInfo *info,
[in,out,ref] uint32 *parm_error
);
/*****************************/
/* Function 0x02 */
typedef struct {
[string,charset(UTF16)] uint16 *user;
} USER_INFO_0;
typedef struct {
uint32 entries_read;
[size_is(entries_read)] USER_INFO_0 *user0;
} USER_INFO_0_CONTAINER;
typedef struct {
[string,charset(UTF16)] uint16 *user_name;
[string,charset(UTF16)] uint16 *logon_domain;
[string,charset(UTF16)] uint16 *other_domains;
[string,charset(UTF16)] uint16 *logon_server;
} USER_INFO_1;
typedef struct {
uint32 entries_read;
[size_is(entries_read)] USER_INFO_1 *user1;
} USER_INFO_1_CONTAINER;
typedef [switch_type(uint32)] union {
[case(0)] USER_INFO_0_CONTAINER *user0;
[case(1)] USER_INFO_1_CONTAINER *user1;
} WKS_USER_ENUM_UNION;
WERROR wkssvc_NetWkstaEnumUsers(
[in] [string,charset(UTF16)] uint16 *server_name,
[in] uint32 level,
[in] [out] [ref] WKS_USER_ENUM_UNION *users,
[in] uint32 prefmaxlen,
[out] uint32 *entriesread,
[out] uint32 *totalentries,
[in] [out] [ref] uint32 *resumehandle
);
/*****************************/
/* Function 0x03 */
WERROR WKSSVC_NETRWKSTAUSERGETINFO ();
/*****************************/
/* Function 0x04 */
WERROR WKSSVC_NETRWKSTAUSERSETINFO ();
/*****************************/
/* Function 0x05 */
typedef struct {
uint32 quality_of_service;
uint32 vc_count;
[string,charset(UTF16)] uint16 *name;
[string,charset(UTF16)] uint16 *address;
uint32 wan_link;
} wkssvc_NetWkstaTransportInfo0;
typedef struct {
uint32 count;
[size_is(count)] wkssvc_NetWkstaTransportInfo0 *array;
} wkssvc_NetWkstaTransportCtr0;
typedef union {
[case(0)] wkssvc_NetWkstaTransportCtr0 *ctr0;
[default] ;
} wkssvc_NetWkstaTransportCtr;
WERROR wkssvc_NetWkstaTransportEnum (
[in] [string,charset(UTF16)] uint16 *server_name,
[in,out] uint32 level,
[in,out,switch_is(level),ref] wkssvc_NetWkstaTransportCtr *ctr,
[in] uint32 max_buffer,
[out] uint32 totalentries,
[in,out] uint32 *resume_handle
);
/*****************************/
/* Function 0x06 */
WERROR WKSSVC_NETRWKSTATRANSPORTADD ();
/*****************************/
/* Function 0x07 */
WERROR WKSSVC_NETRWKSTATRANSPORTDEL ();
/*****************************/
/* Function 0x08 */
WERROR WKSSVC_NETRUSEADD ();
/*****************************/
/* Function 0x09 */
WERROR WKSSVC_NETRUSEGETINFO ();
/*****************************/
/* Function 0x0a */
WERROR WKSSVC_NETRUSEDEL ();
/*****************************/
/* Function 0x0b */
WERROR WKSSVC_NETRUSEENUM ();
/*****************************/
/* Function 0x0c */
WERROR WKSSVC_NETRMESSAGEBUFFERSEND ();
/*****************************/
/* Function 0x0d */
WERROR WKSSVC_NETRWORKSTATIONSTATISTICSGET ();
/*****************************/
/* Function 0x0e */
WERROR WKSSVC_NETRLOGONDOMAINNAMEADD ();
/*****************************/
/* Function 0x0f */
WERROR WKSSVC_NETRLOGONDOMAINNAMEDEL ();
/*****************************/
/* Function 0x10 */
WERROR WKSSVC_NETRJOINDOMAIN ();
/*****************************/
/* Function 0x11 */
WERROR WKSSVC_NETRUNJOINDOMAIN ();
/*****************************/
/* Function 0x12 */
WERROR WKSSVC_NETRRENAMEMACHINEINDOMAIN ();
/*****************************/
/* Function 0x13 */
WERROR WKSSVC_NETRVALIDATENAME ();
/*****************************/
/* Function 0x14 */
WERROR WKSSVC_NETRGETJOININFORMATION ();
/*****************************/
/* Function 0x15 */
WERROR WKSSVC_NETRGETJOINABLEOUS ();
typedef struct {
uint8 data[524];
} wkssvc_PasswordBuffer;
typedef [bitmap32bit] bitmap {
/* TRUE: defer setting the SPN and dNSHostName until a rename operation */
WKSSVC_JOIN_FLAGS_DEFER_SPN = 0x00000100,
/* TRUE: set the machine password to the provided one after the join completes */
WKSSVC_JOIN_FLAGS_MACHINE_PWD_PASSED = 0x00000080,
/* TRUE: perform an unsecured join */
WKSSVC_JOIN_FLAGS_JOIN_UNSECURE = 0x00000040,
/* TRUE: allow the join to complete even if the account already exists */
WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED = 0x00000020,
/* TRUE: this join is part of a w9x upgrade */
WKSSVC_JOIN_FLAGS_WIN9X_UPGRADE = 0x00000010,
/* TRUE: delete the account when the domain is left */
WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE = 0x00000004,
/* TRUE: create the account in the domain */
WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE = 0x00000002,
/* TRUE: join domain FALSE: join workgroup */
WKSSVC_JOIN_FLAGS_JOIN_TYPE = 0x00000001
} wkssvc_joinflags;
/*****************************/
/* Function 0x16 */
WERROR wkssvc_NetrJoinDomain2 (
[in] [string,charset(UTF16)] uint16 *server_name,
[in] [string,charset(UTF16),ref] uint16 *domain_name,
[in] [string,charset(UTF16)] uint16 *account_name,
[in] [string,charset(UTF16)] uint16 *admin_account,
[in] wkssvc_PasswordBuffer *encrypted_password,
[in] wkssvc_joinflags join_flags
);
/*****************************/
/* Function 0x17 */
WERROR wkssvc_NetrUnjoinDomain2 (
[in] [unique] [string,charset(UTF16)] uint16 *server_name,
[in] [unique] [string,charset(UTF16)] uint16 *account,
[in] [unique] wkssvc_PasswordBuffer *encrypted_password,
[in] wkssvc_joinflags unjoin_flags
);
typedef [bitmap32bit] bitmap {
/* TRUE: create the account in the domain */
WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE = 0x00000002
} wkssvc_renameflags;
/*****************************/
/* Function 0x18 */
WERROR wkssvc_NetrRenameMachineInDomain2(
[in] [unique] [string,charset(UTF16)] uint16 *server_name,
[in] [unique] [string,charset(UTF16)] uint16 *NewMachineName,
[in] [unique] [string,charset(UTF16)] uint16 *Account,
[in] [unique] wkssvc_PasswordBuffer *EncryptedPassword,
[in] wkssvc_renameflags RenameOptions
);
/*****************************/
/* Function 0x19 */
WERROR WKSSVC_NETRVALIDATENAME2 ();
/*****************************/
/* Function 0x1a */
WERROR WKSSVC_NETRGETJOINABLEOUS2 ();
/*****************************/
/* Function 0x1b */
WERROR wkssvc_NetrAddAlternateComputerName(
[in] [unique] [string,charset(UTF16)] uint16 *server_name,
[in] [unique] [string,charset(UTF16)] uint16 *NewAlternateMachineName,
[in] [unique] [string,charset(UTF16)] uint16 *Account,
[in] [unique] wkssvc_PasswordBuffer *EncryptedPassword,
[in] uint32 Reserved
);
/*****************************/
/* Function 0x1c */
WERROR wkssvc_NetrRemoveAlternateComputerName(
[in] [unique] [string,charset(UTF16)] uint16 *server_name,
[in] [unique] [string,charset(UTF16)] uint16 *AlternateMachineNameToRemove,
[in] [unique] [string,charset(UTF16)] uint16 *Account,
[in] [unique] wkssvc_PasswordBuffer *EncryptedPassword,
[in] uint32 Reserved
);
/*****************************/
/* Function 0x1d */
WERROR WKSSVC_NETRSETPRIMARYCOMPUTERNAME ();
/*****************************/
/* Function 0x1e */
WERROR WKSSVC_NETRENUMERATECOMPUTERNAMES ();
}
+31
View File
@@ -0,0 +1,31 @@
/*
wireless configuration service
*/
[
uuid("378e52b0-c0a9-11cf-822d-00aa0051e40f"),
version(1.0),
helpstring("Wireless Configuration Service")
]
interface wzcsvc
{
void wzcsvc_EnumInterfaces();
void wzcsvc_QueryInterface();
void wzcsvc_SetInterface();
void wzcsvc_RefreshInterface();
void wzcsvc_QueryContext();
void wzcsvc_SetContext();
void wzcsvc_EapolUIResponse();
void wzcsvc_EapolGetCustomAuthData();
void wzcsvc_EapolSetCustomAuthData();
void wzcsvc_EapolGetInterfaceParams();
void wzcsvc_EapolSetInterfaceParams();
void wzcsvc_EapolReAuthenticateInterface();
void wzcsvc_EapolQueryInterfaceState();
void wzcsvc_OpenWZCDbLogSession();
void wzcsvc_CloseWZCDbLogSession();
void wzcsvc_EnumWZCDbLogRecords();
void wzcsvc_FlushWZCdbLog();
void wzcsvc_GetWZCDbLogRecord();
}
+115
View File
@@ -0,0 +1,115 @@
#include "idl_types.h"
/*
IDL structures for xattr file attributes
this has nothing to do with RPC, we are just using our NDR/IDL
infrastructure as a convenient way to store linearised information
about a file in a architecture independent manner
*/
import "security.idl";
[
pointer_default(unique)
]
interface xattr
{
const char *XATTR_DOSATTRIB_NAME = "user.DosAttrib";
const int XATTR_DOSATTRIB_ESTIMATED_SIZE = 64;
/* we store basic dos attributes in a DosAttrib xattr. By
using a union we can cope with new version of this
structure more easily */
typedef struct {
uint32 attrib;
uint32 ea_size;
udlong size;
udlong alloc_size;
NTTIME create_time;
NTTIME change_time;
} xattr_DosInfo1;
const int XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME = 0x1;
typedef struct {
uint32 flags;
uint32 attrib;
uint32 ea_size;
udlong size;
udlong alloc_size;
NTTIME create_time;
NTTIME change_time;
NTTIME write_time; /* only used when sticky write time is set */
utf8string name;
} xattr_DosInfo2;
typedef [switch_type(uint16)] union {
[case(1)] xattr_DosInfo1 info1;
[case(2)] xattr_DosInfo2 info2;
} xattr_DosInfo;
typedef [public] struct {
uint16 version;
[switch_is(version)] xattr_DosInfo info;
} xattr_DosAttrib;
/* we store DOS style extended attributes in a DosEAs xattr */
const char *XATTR_DOSEAS_NAME = "user.DosEAs";
typedef struct {
utf8string name;
DATA_BLOB value;
} xattr_EA;
typedef [public] struct {
uint16 num_eas;
[size_is(num_eas)] xattr_EA *eas;
} xattr_DosEAs;
/* we store stream information in this xattr structure. Then
the streams themselves are stored in
user.DosStream.STREAMNAME or in external files, according
to the flags */
const char *XATTR_DOSSTREAMS_NAME = "user.DosStreams";
const int XATTR_STREAM_FLAG_INTERNAL = 0x00000001;
/* stream data is stored in attributes with the given prefix */
const char *XATTR_DOSSTREAM_PREFIX = "user.DosStream.";
const int XATTR_MAX_STREAM_SIZE = 0x4000;
typedef struct {
uint32 flags;
udlong size;
udlong alloc_size;
utf8string name;
} xattr_DosStream;
typedef [public] struct {
uint32 num_streams;
[size_is(num_streams)] xattr_DosStream *streams;
} xattr_DosStreams;
/* we store the NT ACL a NTACL xattr. It is versioned so we
can later add other acl attribs (such as posix acl mapping)
we put this xattr in the security namespace to ensure that
only trusted users can write to the ACL
*/
const char *XATTR_NTACL_NAME = "security.NTACL";
typedef [switch_type(uint16)] union {
[case(1)] security_descriptor *sd;
} xattr_NTACL_Info;
typedef [public] struct {
uint16 version;
[switch_is(version)] xattr_NTACL_Info info;
} xattr_NTACL;
}
+326
View File
@@ -0,0 +1,326 @@
/*
Unix SMB/CIFS implementation.
rpc interface definitions
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 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.
*/
#ifndef __LIBNDR_H__
#define __LIBNDR_H__
#include "core.h"
#include "lib/talloc/talloc.h"
#include "lib/util/util.h" /* for discard_const */
#include "lib/charset/charset.h"
/*
this provides definitions for the libcli/rpc/ MSRPC library
*/
/*
this is used by the token store/retrieve code
*/
struct ndr_token_list {
struct ndr_token_list *next, *prev;
const void *key;
uint32_t value;
};
/* this is the base structure passed to routines that
parse MSRPC formatted data
note that in Samba4 we use separate routines and structures for
MSRPC marshalling and unmarshalling. Also note that these routines
are being kept deliberately very simple, and are not tied to a
particular transport
*/
struct ndr_pull {
uint32_t flags; /* LIBNDR_FLAG_* */
uint8_t *data;
uint32_t data_size;
uint32_t offset;
uint32_t relative_base_offset;
struct ndr_token_list *relative_base_list;
struct ndr_token_list *relative_list;
struct ndr_token_list *array_size_list;
struct ndr_token_list *array_length_list;
struct ndr_token_list *switch_list;
TALLOC_CTX *current_mem_ctx;
/* this is used to ensure we generate unique reference IDs
between request and reply */
uint32_t ptr_count;
};
struct ndr_pull_save {
uint32_t data_size;
uint32_t offset;
struct ndr_pull_save *next;
};
/* structure passed to functions that generate NDR formatted data */
struct ndr_push {
uint32_t flags; /* LIBNDR_FLAG_* */
uint8_t *data;
uint32_t alloc_size;
uint32_t offset;
uint32_t relative_base_offset;
struct ndr_token_list *relative_base_list;
struct ndr_token_list *switch_list;
struct ndr_token_list *relative_list;
struct ndr_token_list *nbt_string_list;
struct ndr_token_list *full_ptr_list;
/* this is used to ensure we generate unique reference IDs */
uint32_t ptr_count;
};
struct ndr_push_save {
uint32_t offset;
struct ndr_push_save *next;
};
/* structure passed to functions that print IDL structures */
struct ndr_print {
uint32_t flags; /* LIBNDR_FLAG_* */
uint32_t depth;
struct ndr_token_list *switch_list;
void (*print)(struct ndr_print *, const char *, ...) PRINTF_ATTRIBUTE(2,3);
void *private_data;
};
#define LIBNDR_FLAG_BIGENDIAN (1<<0)
#define LIBNDR_FLAG_NOALIGN (1<<1)
#define LIBNDR_FLAG_STR_ASCII (1<<2)
#define LIBNDR_FLAG_STR_LEN4 (1<<3)
#define LIBNDR_FLAG_STR_SIZE4 (1<<4)
#define LIBNDR_FLAG_STR_NOTERM (1<<5)
#define LIBNDR_FLAG_STR_NULLTERM (1<<6)
#define LIBNDR_FLAG_STR_SIZE2 (1<<7)
#define LIBNDR_FLAG_STR_BYTESIZE (1<<8)
#define LIBNDR_FLAG_STR_FIXLEN32 (1<<9)
#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_FIXLEN15 (1<<13)
#define LIBNDR_STRING_FLAGS (0x7FFC)
#define LIBNDR_FLAG_REF_ALLOC (1<<20)
#define LIBNDR_FLAG_REMAINING (1<<21)
#define LIBNDR_FLAG_ALIGN2 (1<<22)
#define LIBNDR_FLAG_ALIGN4 (1<<23)
#define LIBNDR_FLAG_ALIGN8 (1<<24)
#define LIBNDR_ALIGN_FLAGS (LIBNDR_FLAG_ALIGN2|LIBNDR_FLAG_ALIGN4|LIBNDR_FLAG_ALIGN8)
#define LIBNDR_PRINT_ARRAY_HEX (1<<25)
#define LIBNDR_PRINT_SET_VALUES (1<<26)
/* used to force a section of IDL to be little-endian */
#define LIBNDR_FLAG_LITTLE_ENDIAN (1<<27)
/* used to check if alignment padding is zero */
#define LIBNDR_FLAG_PAD_CHECK (1<<28)
/* set if an object uuid will be present */
#define LIBNDR_FLAG_OBJECT_PRESENT (1<<30)
/* set to avoid recursion in ndr_size_*() calculation */
#define LIBNDR_FLAG_NO_NDR_SIZE (1<<31)
/* useful macro for debugging */
#define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
#define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
#define NDR_PRINT_FUNCTION_DEBUG(type, flags, p) ndr_print_function_debug((ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
#define NDR_PRINT_BOTH_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_BOTH, p)
#define NDR_PRINT_OUT_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_OUT, p)
#define NDR_PRINT_IN_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_IN | NDR_SET_VALUES, p)
#define NDR_BE(ndr) (((ndr)->flags & (LIBNDR_FLAG_BIGENDIAN|LIBNDR_FLAG_LITTLE_ENDIAN)) == LIBNDR_FLAG_BIGENDIAN)
enum ndr_err_code {
NDR_ERR_ARRAY_SIZE,
NDR_ERR_BAD_SWITCH,
NDR_ERR_OFFSET,
NDR_ERR_RELATIVE,
NDR_ERR_CHARCNV,
NDR_ERR_LENGTH,
NDR_ERR_SUBCONTEXT,
NDR_ERR_COMPRESSION,
NDR_ERR_STRING,
NDR_ERR_VALIDATE,
NDR_ERR_BUFSIZE,
NDR_ERR_ALLOC,
NDR_ERR_RANGE,
NDR_ERR_TOKEN,
NDR_ERR_IPV4ADDRESS
};
enum ndr_compression_alg {
NDR_COMPRESSION_MSZIP = 2,
NDR_COMPRESSION_XPRESS = 3
};
/*
flags passed to control parse flow
*/
#define NDR_SCALARS 1
#define NDR_BUFFERS 2
/*
flags passed to ndr_print_*()
*/
#define NDR_IN 1
#define NDR_OUT 2
#define NDR_BOTH 3
#define NDR_SET_VALUES 4
#define NDR_PULL_NEED_BYTES(ndr, n) do { \
if ((n) > ndr->data_size || ndr->offset + (n) > ndr->data_size) { \
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull bytes %u", (unsigned)n); \
} \
} while(0)
#define NDR_ALIGN(ndr, n) ndr_align_size(ndr->offset, n)
#define NDR_ROUND(size, n) (((size)+((n)-1)) & ~((n)-1))
#define NDR_PULL_ALIGN(ndr, n) do { \
if (!(ndr->flags & LIBNDR_FLAG_NOALIGN)) { \
if (ndr->flags & LIBNDR_FLAG_PAD_CHECK) { \
ndr_check_padding(ndr, n); \
} \
ndr->offset = (ndr->offset + (n-1)) & ~(n-1); \
} \
if (ndr->offset > ndr->data_size) { \
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull align %u", (unsigned)n); \
} \
} while(0)
#define NDR_PUSH_NEED_BYTES(ndr, n) NDR_CHECK(ndr_push_expand(ndr, ndr->offset+(n)))
#define NDR_PUSH_ALIGN(ndr, n) do { \
if (!(ndr->flags & LIBNDR_FLAG_NOALIGN)) { \
uint32_t _pad = ((ndr->offset + (n-1)) & ~(n-1)) - ndr->offset; \
while (_pad--) NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 0)); \
} \
} while(0)
/*#define NDR_CHECK_DEBUG*/
#ifndef NDR_CHECK_DEBUG
#define NDR_CHECK_set_shift(n)
/* these are used to make the error checking on each element in libndr
less tedious, hopefully making the code more readable */
#define NDR_CHECK(call) do { NTSTATUS _status; \
_status = call; \
if (!NT_STATUS_IS_OK(_status)) \
return _status; \
} while (0)
#else
#define NDR_CHECK_set_shift(n) NDR_CHECK_shift = (n)
extern int NDR_CHECK_depth;
extern int NDR_CHECK_shift;
/* these are used to make the error checking on each element in libndr
less tedious, hopefully making the code more readable */
#define NDR_CHECK(call) do { NTSTATUS _status; \
DEBUG(9, ("%*s%10.10s: BEG(%08X) %s\n", 2*NDR_CHECK_depth++, "", __location__, ndr->offset+NDR_CHECK_shift, #call)); \
_status = call; \
if (!NT_STATUS_IS_OK(_status)) \
return _status; \
DEBUG(9, ("%*s%10.10s: END(%08X) %s\n", --NDR_CHECK_depth*2, "", __location__, ndr->offset+NDR_CHECK_shift, #call)); \
} while (0)
#endif
#define NDR_PULL_GET_MEM_CTX(ndr) (ndr->current_mem_ctx)
#define NDR_PULL_SET_MEM_CTX(ndr, mem_ctx, flgs) do {\
if ( !(flgs) || (ndr->flags & flgs) ) {\
if (!(mem_ctx)) {\
return ndr_pull_error(ndr, NDR_ERR_ALLOC, "NDR_PULL_SET_MEM_CTX(NULL): %s\n", __location__); \
}\
ndr->current_mem_ctx = discard_const(mem_ctx);\
}\
} while(0)
#define _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr) do {\
if (!ndr->current_mem_ctx) {\
ndr->current_mem_ctx = talloc_new(ndr);\
if (!ndr->current_mem_ctx) {\
return ndr_pull_error(ndr, NDR_ERR_ALLOC, "_NDR_PULL_FIX_CURRENT_MEM_CTX() failed: %s\n", __location__); \
}\
}\
} while(0)
#define NDR_PULL_ALLOC(ndr, s) do { \
_NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
(s) = talloc_ptrtype(ndr->current_mem_ctx, (s)); \
if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %s failed: %s\n", # s, __location__); \
} while (0)
#define NDR_PULL_ALLOC_N(ndr, s, n) do { \
_NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
(s) = talloc_array_ptrtype(ndr->current_mem_ctx, (s), n); \
if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %u * %s failed: %s\n", (unsigned)n, # s, __location__); \
} while (0)
#define NDR_PUSH_ALLOC_SIZE(ndr, s, size) do { \
(s) = talloc_size(ndr, size); \
if (!(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %u failed: %s\n", (unsigned)size, __location__); \
} while (0)
#define NDR_PUSH_ALLOC(ndr, s) do { \
(s) = talloc_ptrtype(ndr, (s)); \
if (!(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %s failed: %s\n", # s, __location__); \
} while (0)
/* these are used when generic fn pointers are needed for ndr push/pull fns */
typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *);
typedef NTSTATUS (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, const void *);
typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, const void *);
extern const struct dcerpc_syntax_id ndr_transfer_syntax;
extern const struct dcerpc_syntax_id ndr64_transfer_syntax;
#include "librpc/gen_ndr/misc.h"
#include "librpc/ndr/libndr_proto.h"
/* FIXME: Use represent_as instead */
struct dom_sid;
NTSTATUS ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
NTSTATUS ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
NTSTATUS ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
NTSTATUS ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags);
struct IWbemClassObject;
NTSTATUS ndr_push_IWbemClassObject(struct ndr_push *ndr, int ndr_flags, const struct IWbemClassObject *r);
NTSTATUS ndr_pull_IWbemClassObject(struct ndr_pull *ndr, int ndr_flags, struct IWbemClassObject *r);
#endif /* __LIBNDR_H__ */
File diff suppressed because it is too large Load Diff
+850
View File
@@ -0,0 +1,850 @@
/*
Unix SMB/CIFS implementation.
routines for marshalling/unmarshalling basic types
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 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.
*/
#include "includes.h"
#include "system/network.h"
#include "librpc/ndr/libndr.h"
#define NDR_SVAL(ndr, ofs) (NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs))
#define NDR_IVAL(ndr, ofs) (NDR_BE(ndr)?RIVAL(ndr->data,ofs):IVAL(ndr->data,ofs))
#define NDR_IVALS(ndr, ofs) (NDR_BE(ndr)?RIVALS(ndr->data,ofs):IVALS(ndr->data,ofs))
#define NDR_SSVAL(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSSVAL(ndr->data,ofs,v); } else SSVAL(ndr->data,ofs,v); } while (0)
#define NDR_SIVAL(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVAL(ndr->data,ofs,v); } else SIVAL(ndr->data,ofs,v); } while (0)
#define NDR_SIVALS(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVALS(ndr->data,ofs,v); } else SIVALS(ndr->data,ofs,v); } while (0)
/*
check for data leaks from the server by looking for non-zero pad bytes
these could also indicate that real structure elements have been
mistaken for padding in the IDL
*/
_PUBLIC_ void ndr_check_padding(struct ndr_pull *ndr, size_t n)
{
size_t ofs2 = (ndr->offset + (n-1)) & ~(n-1);
int i;
for (i=ndr->offset;i<ofs2;i++) {
if (ndr->data[i] != 0) {
break;
}
}
if (i<ofs2) {
DEBUG(0,("WARNING: Non-zero padding to %d: ", (int)n));
for (i=ndr->offset;i<ofs2;i++) {
DEBUG(0,("%02x ", ndr->data[i]));
}
DEBUG(0,("\n"));
}
}
/*
parse a int8_t
*/
_PUBLIC_ NTSTATUS ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v)
{
NDR_PULL_NEED_BYTES(ndr, 1);
*v = (int8_t)CVAL(ndr->data, ndr->offset);
ndr->offset += 1;
return NT_STATUS_OK;
}
/*
parse a uint8_t
*/
_PUBLIC_ NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v)
{
NDR_PULL_NEED_BYTES(ndr, 1);
*v = CVAL(ndr->data, ndr->offset);
ndr->offset += 1;
return NT_STATUS_OK;
}
/*
parse a int16_t
*/
_PUBLIC_ NTSTATUS ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v)
{
NDR_PULL_ALIGN(ndr, 2);
NDR_PULL_NEED_BYTES(ndr, 2);
*v = (uint16_t)NDR_SVAL(ndr, ndr->offset);
ndr->offset += 2;
return NT_STATUS_OK;
}
/*
parse a uint16_t
*/
_PUBLIC_ NTSTATUS ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
{
NDR_PULL_ALIGN(ndr, 2);
NDR_PULL_NEED_BYTES(ndr, 2);
*v = NDR_SVAL(ndr, ndr->offset);
ndr->offset += 2;
return NT_STATUS_OK;
}
/*
parse a int32_t
*/
_PUBLIC_ NTSTATUS ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v)
{
NDR_PULL_ALIGN(ndr, 4);
NDR_PULL_NEED_BYTES(ndr, 4);
*v = NDR_IVALS(ndr, ndr->offset);
ndr->offset += 4;
return NT_STATUS_OK;
}
/*
parse a uint32_t
*/
_PUBLIC_ NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
{
NDR_PULL_ALIGN(ndr, 4);
NDR_PULL_NEED_BYTES(ndr, 4);
*v = NDR_IVAL(ndr, ndr->offset);
ndr->offset += 4;
return NT_STATUS_OK;
}
/*
parse a pointer referent identifier
*/
_PUBLIC_ NTSTATUS ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v)
{
NTSTATUS status;
status = ndr_pull_uint32(ndr, NDR_SCALARS, v);
if (NT_STATUS_IS_OK(status) && *v != 0) {
ndr->ptr_count++;
}
return status;
}
/*
parse a ref pointer referent identifier
*/
_PUBLIC_ NTSTATUS ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v)
{
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, v));
/* ref pointers always point to data */
*v = 1;
return NT_STATUS_OK;
}
/*
parse a udlong
*/
_PUBLIC_ NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
{
NDR_PULL_ALIGN(ndr, 4);
NDR_PULL_NEED_BYTES(ndr, 8);
*v = NDR_IVAL(ndr, ndr->offset);
*v |= (uint64_t)(NDR_IVAL(ndr, ndr->offset+4)) << 32;
ndr->offset += 8;
return NT_STATUS_OK;
}
/*
parse a udlongr
*/
_PUBLIC_ NTSTATUS ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
{
NDR_PULL_ALIGN(ndr, 4);
NDR_PULL_NEED_BYTES(ndr, 8);
*v = ((uint64_t)NDR_IVAL(ndr, ndr->offset)) << 32;
*v |= NDR_IVAL(ndr, ndr->offset+4);
ndr->offset += 8;
return NT_STATUS_OK;
}
/*
parse a dlong
*/
_PUBLIC_ NTSTATUS ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v)
{
return ndr_pull_udlong(ndr, ndr_flags, (uint64_t *)v);
}
/*
parse a hyper
*/
_PUBLIC_ NTSTATUS ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
{
NDR_PULL_ALIGN(ndr, 8);
return ndr_pull_udlong(ndr, ndr_flags, v);
}
/*
parse a pointer
*/
_PUBLIC_ NTSTATUS ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v)
{
intptr_t h;
NDR_PULL_ALIGN(ndr, sizeof(h));
NDR_PULL_NEED_BYTES(ndr, sizeof(h));
memcpy(&h, ndr->data+ndr->offset, sizeof(h));
ndr->offset += sizeof(h);
*v = (void *)h;
return NT_STATUS_OK;
}
/*
pull a NTSTATUS
*/
_PUBLIC_ NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status)
{
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*status = NT_STATUS(v);
return NT_STATUS_OK;
}
/*
push a NTSTATUS
*/
_PUBLIC_ NTSTATUS ndr_push_NTSTATUS(struct ndr_push *ndr, int ndr_flags, NTSTATUS status)
{
return ndr_push_uint32(ndr, ndr_flags, NT_STATUS_V(status));
}
_PUBLIC_ void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS r)
{
ndr->print(ndr, "%-25s: %s", name, nt_errstr(r));
}
/*
pull a WERROR
*/
_PUBLIC_ NTSTATUS ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status)
{
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*status = W_ERROR(v);
return NT_STATUS_OK;
}
/*
push a WERROR
*/
_PUBLIC_ NTSTATUS ndr_push_WERROR(struct ndr_push *ndr, int ndr_flags, WERROR status)
{
return ndr_push_uint32(ndr, NDR_SCALARS, W_ERROR_V(status));
}
_PUBLIC_ void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR r)
{
ndr->print(ndr, "%-25s: %s", name, win_errstr(r));
}
/*
parse a set of bytes
*/
_PUBLIC_ NTSTATUS ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n)
{
NDR_PULL_NEED_BYTES(ndr, n);
memcpy(data, ndr->data + ndr->offset, n);
ndr->offset += n;
return NT_STATUS_OK;
}
/*
pull an array of uint8
*/
_PUBLIC_ NTSTATUS ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n)
{
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
return ndr_pull_bytes(ndr, data, n);
}
/*
push a int8_t
*/
_PUBLIC_ NTSTATUS ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v)
{
NDR_PUSH_NEED_BYTES(ndr, 1);
SCVAL(ndr->data, ndr->offset, (uint8_t)v);
ndr->offset += 1;
return NT_STATUS_OK;
}
/*
push a uint8_t
*/
_PUBLIC_ NTSTATUS ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v)
{
NDR_PUSH_NEED_BYTES(ndr, 1);
SCVAL(ndr->data, ndr->offset, v);
ndr->offset += 1;
return NT_STATUS_OK;
}
/*
push a int16_t
*/
_PUBLIC_ NTSTATUS ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v)
{
NDR_PUSH_ALIGN(ndr, 2);
NDR_PUSH_NEED_BYTES(ndr, 2);
NDR_SSVAL(ndr, ndr->offset, (uint16_t)v);
ndr->offset += 2;
return NT_STATUS_OK;
}
/*
push a uint16_t
*/
_PUBLIC_ NTSTATUS ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v)
{
NDR_PUSH_ALIGN(ndr, 2);
NDR_PUSH_NEED_BYTES(ndr, 2);
NDR_SSVAL(ndr, ndr->offset, v);
ndr->offset += 2;
return NT_STATUS_OK;
}
/*
push a int32_t
*/
_PUBLIC_ NTSTATUS ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v)
{
NDR_PUSH_ALIGN(ndr, 4);
NDR_PUSH_NEED_BYTES(ndr, 4);
NDR_SIVALS(ndr, ndr->offset, v);
ndr->offset += 4;
return NT_STATUS_OK;
}
/*
push a uint32_t
*/
_PUBLIC_ NTSTATUS ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v)
{
NDR_PUSH_ALIGN(ndr, 4);
NDR_PUSH_NEED_BYTES(ndr, 4);
NDR_SIVAL(ndr, ndr->offset, v);
ndr->offset += 4;
return NT_STATUS_OK;
}
/*
push a udlong
*/
_PUBLIC_ NTSTATUS ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v)
{
NDR_PUSH_ALIGN(ndr, 4);
NDR_PUSH_NEED_BYTES(ndr, 8);
NDR_SIVAL(ndr, ndr->offset, (v & 0xFFFFFFFF));
NDR_SIVAL(ndr, ndr->offset+4, (v>>32));
ndr->offset += 8;
return NT_STATUS_OK;
}
/*
push a udlongr
*/
_PUBLIC_ NTSTATUS ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v)
{
NDR_PUSH_ALIGN(ndr, 4);
NDR_PUSH_NEED_BYTES(ndr, 8);
NDR_SIVAL(ndr, ndr->offset, (v>>32));
NDR_SIVAL(ndr, ndr->offset+4, (v & 0xFFFFFFFF));
ndr->offset += 8;
return NT_STATUS_OK;
}
/*
push a dlong
*/
_PUBLIC_ NTSTATUS ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v)
{
return ndr_push_udlong(ndr, NDR_SCALARS, (uint64_t)v);
}
/*
push a hyper
*/
_PUBLIC_ NTSTATUS ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v)
{
NDR_PUSH_ALIGN(ndr, 8);
return ndr_push_udlong(ndr, NDR_SCALARS, v);
}
/*
push a pointer
*/
_PUBLIC_ NTSTATUS ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
{
intptr_t h = (intptr_t)v;
NDR_PUSH_ALIGN(ndr, sizeof(h));
NDR_PUSH_NEED_BYTES(ndr, sizeof(h));
memcpy(ndr->data+ndr->offset, &h, sizeof(h));
ndr->offset += sizeof(h);
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS ndr_push_align(struct ndr_push *ndr, size_t size)
{
NDR_PUSH_ALIGN(ndr, size);
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS ndr_pull_align(struct ndr_pull *ndr, size_t size)
{
NDR_PULL_ALIGN(ndr, size);
return NT_STATUS_OK;
}
/*
push some bytes
*/
_PUBLIC_ NTSTATUS ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n)
{
NDR_PUSH_NEED_BYTES(ndr, n);
memcpy(ndr->data + ndr->offset, data, n);
ndr->offset += n;
return NT_STATUS_OK;
}
/*
push some zero bytes
*/
_PUBLIC_ NTSTATUS ndr_push_zero(struct ndr_push *ndr, uint32_t n)
{
NDR_PUSH_NEED_BYTES(ndr, n);
memset(ndr->data + ndr->offset, 0, n);
ndr->offset += n;
return NT_STATUS_OK;
}
/*
push an array of uint8
*/
_PUBLIC_ NTSTATUS ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n)
{
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
return ndr_push_bytes(ndr, data, n);
}
/*
save the current position
*/
_PUBLIC_ void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save)
{
save->offset = ndr->offset;
}
/*
restore the position
*/
_PUBLIC_ void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save *save)
{
ndr->offset = save->offset;
}
/*
push a unique non-zero value if a pointer is non-NULL, otherwise 0
*/
_PUBLIC_ NTSTATUS ndr_push_unique_ptr(struct ndr_push *ndr, const void *p)
{
uint32_t ptr = 0;
if (p) {
ptr = ndr->ptr_count * 4;
ptr |= 0x00020000;
ndr->ptr_count++;
}
return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
}
/*
push a 'simple' full non-zero value if a pointer is non-NULL, otherwise 0
*/
_PUBLIC_ NTSTATUS ndr_push_full_ptr(struct ndr_push *ndr, const void *p)
{
uint32_t ptr = 0;
if (p) {
/* Check if the pointer already exists and has an id */
ptr = ndr_token_peek(&ndr->full_ptr_list, p);
if (ptr == 0) {
ndr->ptr_count++;
ptr = ndr->ptr_count;
ndr_token_store(ndr, &ndr->full_ptr_list, p, ptr);
}
}
return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
}
/*
push always a 0, if a pointer is NULL it's a fatal error
*/
_PUBLIC_ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr)
{
return ndr_push_uint32(ndr, NDR_SCALARS, 0xAEF1AEF1);
}
/*
push a NTTIME
*/
_PUBLIC_ NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
pull a NTTIME
*/
_PUBLIC_ NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
push a NTTIME
*/
_PUBLIC_ NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
t /= 10000000;
NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
pull a NTTIME_1sec
*/
_PUBLIC_ NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
(*t) *= 10000000;
return NT_STATUS_OK;
}
/*
pull a NTTIME_hyper
*/
_PUBLIC_ NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
push a NTTIME_hyper
*/
_PUBLIC_ NTSTATUS ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
push a time_t
*/
_PUBLIC_ NTSTATUS ndr_push_time_t(struct ndr_push *ndr, int ndr_flags, time_t t)
{
return ndr_push_uint32(ndr, ndr_flags, t);
}
/*
pull a time_t
*/
_PUBLIC_ NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t)
{
uint32_t tt;
NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &tt));
*t = tt;
return NT_STATUS_OK;
}
/*
pull a ipv4address
*/
_PUBLIC_ NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address)
{
struct ipv4_addr in;
NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.addr));
in.addr = htonl(in.addr);
*address = talloc_strdup(ndr->current_mem_ctx, sys_inet_ntoa(in));
NT_STATUS_HAVE_NO_MEMORY(*address);
return NT_STATUS_OK;
}
/*
push a ipv4address
*/
_PUBLIC_ NTSTATUS ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *address)
{
uint32_t addr;
if (!is_ipaddress(address)) {
return ndr_push_error(ndr, NDR_ERR_IPV4ADDRESS,
"Invalid IPv4 address: '%s'",
address);
}
addr = inet_addr(address);
NDR_CHECK(ndr_push_uint32(ndr, ndr_flags, htonl(addr)));
return NT_STATUS_OK;
}
/*
print a ipv4address
*/
_PUBLIC_ void ndr_print_ipv4address(struct ndr_print *ndr, const char *name,
const char *address)
{
ndr->print(ndr, "%-25s: %s", name, address);
}
_PUBLIC_ void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type)
{
ndr->print(ndr, "%s: struct %s", name, type);
}
_PUBLIC_ void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type,
const char *val, uint32_t value)
{
if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) {
ndr->print(ndr, "%-25s: %s (0x%X)", name, val?val:"UNKNOWN_ENUM_VALUE", value);
} else {
ndr->print(ndr, "%-25s: %s (%d)", name, val?val:"UNKNOWN_ENUM_VALUE", value);
}
}
_PUBLIC_ void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value)
{
/* this is an attempt to support multi-bit bitmap masks */
value &= flag;
while (!(flag & 1)) {
flag >>= 1;
value >>= 1;
}
if (flag == 1) {
ndr->print(ndr, " %d: %-25s", value, flag_name);
} else {
ndr->print(ndr, "0x%02x: %-25s (%d)", value, flag_name, value);
}
}
_PUBLIC_ void ndr_print_int8(struct ndr_print *ndr, const char *name, int8_t v)
{
ndr->print(ndr, "%-25s: %d", name, v);
}
_PUBLIC_ void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v)
{
ndr->print(ndr, "%-25s: 0x%02x (%u)", name, v, v);
}
_PUBLIC_ void ndr_print_int16(struct ndr_print *ndr, const char *name, int16_t v)
{
ndr->print(ndr, "%-25s: %d", name, v);
}
_PUBLIC_ void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t v)
{
ndr->print(ndr, "%-25s: 0x%04x (%u)", name, v, v);
}
_PUBLIC_ void ndr_print_int32(struct ndr_print *ndr, const char *name, int32_t v)
{
ndr->print(ndr, "%-25s: %d", name, v);
}
_PUBLIC_ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t v)
{
ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
}
_PUBLIC_ void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v)
{
ndr->print(ndr, "%-25s: 0x%016llx (%llu)", name, (unsigned long long)v, (unsigned long long)v);
}
_PUBLIC_ void ndr_print_udlongr(struct ndr_print *ndr, const char *name, uint64_t v)
{
ndr_print_udlong(ndr, name, v);
}
_PUBLIC_ void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v)
{
ndr->print(ndr, "%-25s: 0x%016llx (%lld)", name, (unsigned long long)v, (long long)v);
}
_PUBLIC_ void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v)
{
ndr_print_dlong(ndr, name, v);
}
_PUBLIC_ void ndr_print_pointer(struct ndr_print *ndr, const char *name, void *v)
{
ndr->print(ndr, "%-25s: %p", name, v);
}
_PUBLIC_ void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p)
{
if (p) {
ndr->print(ndr, "%-25s: *", name);
} else {
ndr->print(ndr, "%-25s: NULL", name);
}
}
_PUBLIC_ void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t)
{
ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr, t));
}
_PUBLIC_ void ndr_print_NTTIME_1sec(struct ndr_print *ndr, const char *name, NTTIME t)
{
/* this is a standard NTTIME here
* as it's already converted in the pull/push code
*/
ndr_print_NTTIME(ndr, name, t);
}
_PUBLIC_ void ndr_print_NTTIME_hyper(struct ndr_print *ndr, const char *name, NTTIME t)
{
ndr_print_NTTIME(ndr, name, t);
}
_PUBLIC_ void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t)
{
if (t == (time_t)-1 || t == 0) {
ndr->print(ndr, "%-25s: (time_t)%d", name, (int)t);
} else {
ndr->print(ndr, "%-25s: %s", name, timestring(ndr, t));
}
}
_PUBLIC_ void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type)
{
if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) {
ndr->print(ndr, "%-25s: union %s(case 0x%X)", name, type, level);
} else {
ndr->print(ndr, "%-25s: union %s(case %d)", name, type, level);
}
}
_PUBLIC_ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level)
{
ndr->print(ndr, "UNKNOWN LEVEL %u", level);
}
_PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
const uint8_t *data, uint32_t count)
{
int i;
if (count <= 600 && (ndr->flags & LIBNDR_PRINT_ARRAY_HEX)) {
char s[1202];
for (i=0;i<count;i++) {
snprintf(&s[i*2], 3, "%02x", data[i]);
}
s[i*2] = 0;
ndr->print(ndr, "%-25s: %s", name, s);
return;
}
ndr->print(ndr, "%s: ARRAY(%d)", name, count);
ndr->depth++;
for (i=0;i<count;i++) {
char *idx=NULL;
asprintf(&idx, "[%d]", i);
if (idx) {
ndr_print_uint8(ndr, idx, data[i]);
free(idx);
}
}
ndr->depth--;
}
_PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r)
{
ndr->print(ndr, "%-25s: DATA_BLOB length=%u", name, (unsigned)r.length);
if (r.length) {
dump_data(10, r.data, r.length);
}
}
/*
push a DATA_BLOB onto the wire.
*/
_PUBLIC_ NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob)
{
if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
blob.length = NDR_ALIGN(ndr, 2);
} else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
blob.length = NDR_ALIGN(ndr, 4);
} else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
blob.length = NDR_ALIGN(ndr, 8);
}
NDR_PUSH_ALLOC_SIZE(ndr, blob.data, blob.length);
data_blob_clear(&blob);
} else if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length));
}
NDR_CHECK(ndr_push_bytes(ndr, blob.data, blob.length));
return NT_STATUS_OK;
}
/*
pull a DATA_BLOB from the wire.
*/
_PUBLIC_ NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob)
{
uint32_t length = 0;
if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
length = NDR_ALIGN(ndr, 2);
} else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
length = NDR_ALIGN(ndr, 4);
} else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
length = NDR_ALIGN(ndr, 8);
}
if (ndr->data_size - ndr->offset < length) {
length = ndr->data_size - ndr->offset;
}
} else if (ndr->flags & LIBNDR_FLAG_REMAINING) {
length = ndr->data_size - ndr->offset;
} else {
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
}
NDR_PULL_NEED_BYTES(ndr, length);
*blob = data_blob_talloc(ndr->current_mem_ctx, ndr->data+ndr->offset, length);
ndr->offset += length;
return NT_STATUS_OK;
}
_PUBLIC_ uint32_t ndr_size_DATA_BLOB(int ret, const DATA_BLOB *data, int flags)
{
return ret + data->length;
}
+293
View File
@@ -0,0 +1,293 @@
/*
Unix SMB/CIFS implementation.
libndr compression support
Copyright (C) Stefan Metzmacher 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 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.
*/
#include "includes.h"
#include "lib/compression/mszip.h"
#include "librpc/ndr/libndr.h"
static NTSTATUS ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpull,
struct ndr_push *ndrpush,
struct decomp_state *decomp_state)
{
DATA_BLOB comp_chunk;
uint32_t comp_chunk_offset;
uint32_t comp_chunk_size;
DATA_BLOB plain_chunk;
uint32_t plain_chunk_offset;
uint32_t plain_chunk_size;
int ret;
NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &plain_chunk_size));
if (plain_chunk_size > 0x00008000) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad MSZIP plain chunk size %08X > 0x00008000 (PULL)",
plain_chunk_size);
}
NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &comp_chunk_size));
DEBUG(10,("MSZIP plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
comp_chunk_offset = ndrpull->offset;
NDR_CHECK(ndr_pull_advance(ndrpull, comp_chunk_size));
comp_chunk.length = comp_chunk_size;
comp_chunk.data = ndrpull->data + comp_chunk_offset;
plain_chunk_offset = ndrpush->offset;
NDR_CHECK(ndr_push_zero(ndrpush, plain_chunk_size));
plain_chunk.length = plain_chunk_size;
plain_chunk.data = ndrpush->data + plain_chunk_offset;
ret = ZIPdecompress(decomp_state, &comp_chunk, &plain_chunk);
if (ret != DECR_OK) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad ZIPdecompress() error %d (PULL)",
ret);
}
if ((plain_chunk_size < 0x00008000) || (ndrpull->offset+4 >= ndrpull->data_size)) {
/* this is the last chunk */
return NT_STATUS_OK;
}
return NT_STATUS_MORE_PROCESSING_REQUIRED;
}
static NTSTATUS ndr_pull_compression_mszip(struct ndr_pull *subndr,
struct ndr_pull **_comndr,
ssize_t decompressed_len)
{
NTSTATUS status = NT_STATUS_MORE_PROCESSING_REQUIRED;
struct ndr_push *ndrpush;
struct ndr_pull *comndr;
DATA_BLOB uncompressed;
uint32_t payload_header[4];
uint32_t payload_size;
uint32_t payload_offset;
uint8_t *payload;
struct decomp_state *decomp_state;
ndrpush = ndr_push_init_ctx(subndr);
NT_STATUS_HAVE_NO_MEMORY(ndrpush);
decomp_state = ZIPdecomp_state(subndr);
NT_STATUS_HAVE_NO_MEMORY(decomp_state);
while (NT_STATUS_EQUAL(NT_STATUS_MORE_PROCESSING_REQUIRED, status)) {
status = ndr_pull_compression_mszip_chunk(subndr, ndrpush, decomp_state);
}
NT_STATUS_NOT_OK_RETURN(status);
uncompressed = ndr_push_blob(ndrpush);
if (uncompressed.length != decompressed_len) {
return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad MSZIP uncompressed_len [%u] != [%d] (PULL)",
(int)uncompressed.length, (int)decompressed_len);
}
comndr = talloc_zero(subndr, struct ndr_pull);
NT_STATUS_HAVE_NO_MEMORY(comndr);
comndr->flags = subndr->flags;
comndr->current_mem_ctx = subndr->current_mem_ctx;
comndr->data = uncompressed.data;
comndr->data_size = uncompressed.length;
comndr->offset = 0;
NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[0]));
NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[1]));
NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[2]));
NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[3]));
if (payload_header[0] != 0x00081001) {
return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad MSZIP payload_header[0] [0x%08X] != [0x00081001] (PULL)",
payload_header[0]);
}
if (payload_header[1] != 0xCCCCCCCC) {
return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad MSZIP payload_header[1] [0x%08X] != [0xCCCCCCCC] (PULL)",
payload_header[1]);
}
payload_size = payload_header[2];
if (payload_header[3] != 0x00000000) {
return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad MSZIP payload_header[3] [0x%08X] != [0x00000000] (PULL)",
payload_header[3]);
}
payload_offset = comndr->offset;
NDR_CHECK(ndr_pull_advance(comndr, payload_size));
payload = comndr->data + payload_offset;
comndr->data = payload;
comndr->data_size = payload_size;
comndr->offset = 0;
*_comndr = comndr;
return NT_STATUS_OK;
}
static NTSTATUS ndr_push_compression_mszip(struct ndr_push *subndr,
struct ndr_push *comndr)
{
return ndr_push_error(subndr, NDR_ERR_COMPRESSION, "Sorry MSZIP compression is not supported yet (PUSH)");
}
static NTSTATUS ndr_pull_compression_xpress_chunk(struct ndr_pull *ndrpull,
struct ndr_push *ndrpush)
{
DATA_BLOB comp_chunk;
uint32_t comp_chunk_offset;
uint32_t comp_chunk_size;
uint32_t plain_chunk_size;
comp_chunk_offset = ndrpull->offset;
NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &plain_chunk_size));
if (plain_chunk_size > 0x00010000) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad XPRESS plain chunk size %08X > 0x00010000 (PULL)",
plain_chunk_size);
}
NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &comp_chunk_size));
NDR_CHECK(ndr_pull_advance(ndrpull, comp_chunk_size));
comp_chunk.length = comp_chunk_size + 8;
comp_chunk.data = ndrpull->data + comp_chunk_offset;
DEBUG(10,("XPRESS plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
/* For now, we just copy over the compressed blob */
NDR_CHECK(ndr_push_bytes(ndrpush, comp_chunk.data, comp_chunk.length));
if ((plain_chunk_size < 0x00010000) || (ndrpull->offset+4 >= ndrpull->data_size)) {
/* this is the last chunk */
return NT_STATUS_OK;
}
return NT_STATUS_MORE_PROCESSING_REQUIRED;
}
static NTSTATUS ndr_pull_compression_xpress(struct ndr_pull *subndr,
struct ndr_pull **_comndr,
ssize_t decompressed_len)
{
NTSTATUS status = NT_STATUS_MORE_PROCESSING_REQUIRED;
struct ndr_push *ndrpush;
struct ndr_pull *comndr;
DATA_BLOB uncompressed;
ndrpush = ndr_push_init_ctx(subndr);
NT_STATUS_HAVE_NO_MEMORY(ndrpush);
while (NT_STATUS_EQUAL(NT_STATUS_MORE_PROCESSING_REQUIRED, status)) {
status = ndr_pull_compression_xpress_chunk(subndr, ndrpush);
}
NT_STATUS_NOT_OK_RETURN(status);
uncompressed = ndr_push_blob(ndrpush);
comndr = talloc_zero(subndr, struct ndr_pull);
NT_STATUS_HAVE_NO_MEMORY(comndr);
comndr->flags = subndr->flags;
comndr->current_mem_ctx = subndr->current_mem_ctx;
comndr->data = uncompressed.data;
comndr->data_size = uncompressed.length;
comndr->offset = 0;
*_comndr = comndr;
return NT_STATUS_OK;
}
static NTSTATUS ndr_push_compression_xpress(struct ndr_push *subndr,
struct ndr_push *comndr)
{
return ndr_push_error(subndr, NDR_ERR_COMPRESSION, "XPRESS compression is not supported yet (PUSH)");
}
/*
handle compressed subcontext buffers, which in midl land are user-marshalled, but
we use magic in pidl to make them easier to cope with
*/
NTSTATUS ndr_pull_compression_start(struct ndr_pull *subndr,
struct ndr_pull **_comndr,
enum ndr_compression_alg compression_alg,
ssize_t decompressed_len)
{
switch (compression_alg) {
case NDR_COMPRESSION_MSZIP:
return ndr_pull_compression_mszip(subndr, _comndr, decompressed_len);
case NDR_COMPRESSION_XPRESS:
return ndr_pull_compression_xpress(subndr, _comndr, decompressed_len);
default:
return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad compression algorithm %d (PULL)",
compression_alg);
}
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_compression_end(struct ndr_pull *subndr,
struct ndr_pull *comndr,
enum ndr_compression_alg compression_alg,
ssize_t decompressed_len)
{
return NT_STATUS_OK;
}
/*
push a compressed subcontext
*/
NTSTATUS ndr_push_compression_start(struct ndr_push *subndr,
struct ndr_push **_comndr,
enum ndr_compression_alg compression_alg,
ssize_t decompressed_len)
{
struct ndr_push *comndr;
comndr = ndr_push_init_ctx(subndr);
NT_STATUS_HAVE_NO_MEMORY(comndr);
comndr->flags = subndr->flags;
*_comndr = comndr;
return NT_STATUS_OK;
}
/*
push a compressed subcontext
*/
NTSTATUS ndr_push_compression_end(struct ndr_push *subndr,
struct ndr_push *comndr,
enum ndr_compression_alg compression_alg,
ssize_t decompressed_len)
{
switch (compression_alg) {
case NDR_COMPRESSION_MSZIP:
return ndr_push_compression_mszip(subndr, comndr);
case NDR_COMPRESSION_XPRESS:
return ndr_push_compression_xpress(subndr, comndr);
default:
return ndr_push_error(subndr, NDR_ERR_COMPRESSION, "Bad compression algorithm %d (PUSH)",
compression_alg);
}
return NT_STATUS_OK;
}
+902
View File
@@ -0,0 +1,902 @@
/*
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.
*/
#include "includes.h"
#include "librpc/gen_ndr/ndr_dcom.h"
// Just for debugging
#ifdef NDR_CHECK_DEBUG
int NDR_CHECK_depth = 0;
int NDR_CHECK_shift = 0x48;
#endif
int get_CIMTYPE_size(int t)
{
if (t & CIM_FLAG_ARRAY) return 4;
t &= 0x1FF;
switch (t) {
case CIM_SINT8:
case CIM_UINT8:
return 1;
case CIM_SINT16:
case CIM_UINT16:
case CIM_BOOLEAN:
return 2;
case CIM_SINT32:
case CIM_UINT32:
case CIM_REAL32:
case CIM_STRING:
case CIM_DATETIME:
case CIM_REFERENCE:
case CIM_OBJECT:
return 4;
case CIM_SINT64:
case CIM_UINT64:
case CIM_REAL64:
return 8;
default:
DEBUG(0, ("Unknown CIMTYPE size for %04X", t));
return 4;
}
}
NTSTATUS ndr_push_BSTR(struct ndr_push *ndr, int ndr_flags, const BSTR *r)
{
uint32_t len;
uint32_t flags;
NTSTATUS status;
len = strlen(*r);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x72657355));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, len));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2*len));
flags = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NOTERM | LIBNDR_FLAG_STR_SIZE4);
status = ndr_push_string(ndr, NDR_SCALARS, *r);
ndr->flags = flags;
return status;
}
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_BSTR(struct ndr_pull *ndr, int ndr_flags, BSTR *r)
{
return NT_STATUS_NOT_SUPPORTED;
}
void ndr_print_BSTR(struct ndr_print *ndr, const char *name, const BSTR *r)
{
ndr->print(ndr, "%-25s: BSTR(\"%s\")", name, *r);
}
NTSTATUS ndr_push_CIMSTRING(struct ndr_push *ndr, int ndr_flags, const CIMSTRING *r)
{
uint8_t u;
NTSTATUS status;
if (!(ndr_flags & NDR_SCALARS)) return NT_STATUS_OK;
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 0));
u = ndr->flags;
ndr->flags |= LIBNDR_FLAG_STR_ASCII | LIBNDR_FLAG_STR_NULLTERM;
status = ndr_push_string(ndr, NDR_SCALARS, *r);
DEBUG(9, ("%08X: Push string: %s\n", ndr->offset, *r));
ndr->flags = u;
return status;
}
NTSTATUS ndr_pull_CIMSTRING(struct ndr_pull *ndr, int ndr_flags, CIMSTRING *r)
{
uint8_t u;
NTSTATUS status;
if (!(ndr_flags & NDR_SCALARS)) return NT_STATUS_OK;
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &u));
switch (u) {
case 0:
u = ndr->flags;
ndr->flags |= LIBNDR_FLAG_STR_ASCII | LIBNDR_FLAG_STR_NULLTERM;
status = ndr_pull_string(ndr, NDR_SCALARS, r);
DEBUG(9, ("%08X: Pull string: %s\n", ndr->offset, *r));
ndr->flags = u;
return status;
case 1:
u = ndr->flags;
ndr->flags |= LIBNDR_FLAG_STR_NULLTERM;
status = ndr_pull_string(ndr, NDR_SCALARS, r);
DEBUG(9, ("%08X: Pull string: %s\n", ndr->offset, *r));
ndr->flags = u;
return status;
default: return NT_STATUS_NOT_SUPPORTED;
}
}
void ndr_print_CIMSTRING(struct ndr_print *ndr, const char *name, const CIMSTRING *r)
{
ndr->print(ndr, "%-25s: \"%s\"", name, *r);
}
NTSTATUS ndr_push_CIMSTRINGS(struct ndr_push *ndr, int ndr_flags, const struct CIMSTRINGS *r)
{
uint32_t ofs_size, ofs, i;
if (!(ndr_flags & NDR_SCALARS)) return NT_STATUS_OK;
ofs_size = ndr->offset;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
for (i = 0; i < r->count; ++i) {
ofs = ndr->offset;
NDR_CHECK(ndr_push_CIMSTRING(ndr, ndr_flags, &r->item[i]));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr->offset - ofs));
}
ofs = ndr->offset;
ndr->offset = ofs_size;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ofs - ofs_size));
ndr->offset = ofs;
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS ndr_pull_CIMSTRINGS(struct ndr_pull *ndr, int ndr_flags, struct CIMSTRINGS *r)
{
uint32_t endofs;
uint32_t len;
TALLOC_CTX *mem_ctx;
uint32_t u;
if (!(ndr_flags & NDR_SCALARS)) return NT_STATUS_OK;
mem_ctx = ndr->current_mem_ctx;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &endofs));
endofs += ndr->offset - sizeof(endofs);
r->count = 0;
len = 5;
r->item = talloc_array(mem_ctx, CIMSTRING, len);
ndr->current_mem_ctx = r->item;
while (ndr->offset < endofs) {
if (r->count >= len) {
len += 3;
r->item = talloc_realloc(mem_ctx, r->item, CIMSTRING, len);
/* update the memory context with the realloc'ed ptr */
ndr->current_mem_ctx = r->item;
}
NDR_CHECK(ndr_pull_CIMSTRING(ndr, ndr_flags, &r->item[r->count]));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &u));
++r->count;
}
r->item = talloc_realloc(mem_ctx, r->item, CIMSTRING, r->count);
ndr->current_mem_ctx = mem_ctx;
return NT_STATUS_OK;
}
static const char *qualifier_keys[] = {[1] = "key", [3] = "read", [6] = "provider", [7] = "dynamic", [10] = "CIMTYPE" };
#define arr_sizeof(a) (sizeof(a)/sizeof(a[0]))
static const char *qn_unknown = "Unknown_qualifier_name";
_PUBLIC_ NTSTATUS ndr_push_WbemQualifier(struct ndr_push *ndr, int ndr_flags, const struct WbemQualifier *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_relative_ptr1(ndr, r->name));
NDR_CHECK(ndr_push_WBEM_FLAVOR_TYPE(ndr, NDR_SCALARS, r->flavors));
NDR_CHECK(ndr_push_CIMTYPE_ENUMERATION(ndr, NDR_SCALARS, r->cimtype));
NDR_CHECK(ndr_push_set_switch_value(ndr, &r->value, r->cimtype & CIM_TYPEMASK));
NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_SCALARS, &r->value));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->name) {
uint32_t ofs;
int32_t i;
for (i = 0; i < arr_sizeof(qualifier_keys); ++i)
if (qualifier_keys[i] && !strcmp(r->name, qualifier_keys[i])) break;
if (i == arr_sizeof(qualifier_keys)) {
if (!strncmp(qn_unknown, r->name, sizeof(qn_unknown) - 1))
i = atoi(r->name + sizeof(qn_unknown) - 1);
else
i = -1;
}
if (i >= 0) {
ofs = ndr->offset;
NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, r->name, &ndr->offset));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x80000000 | i));
ndr->offset = ofs;
} else {
NDR_CHECK(ndr_push_relative_ptr2(ndr, r->name));
NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->name));
}
}
NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_BUFFERS, &r->value));
}
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS ndr_pull_WbemQualifier(struct ndr_pull *ndr, int ndr_flags, struct WbemQualifier *r)
{
uint32_t _ptr_name;
TALLOC_CTX *_mem_save_name_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
if (_ptr_name != 0xFFFFFFFF) {
NDR_PULL_ALLOC(ndr, r->name);
NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->name, _ptr_name));
} else {
r->name = NULL;
}
NDR_CHECK(ndr_pull_WBEM_FLAVOR_TYPE(ndr, NDR_SCALARS, &r->flavors));
NDR_CHECK(ndr_pull_CIMTYPE_ENUMERATION(ndr, NDR_SCALARS, &r->cimtype));
NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->value, r->cimtype & CIM_TYPEMASK));
NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_SCALARS, &r->value));
}
if (ndr_flags & NDR_BUFFERS) {
uint32_t relofs;
relofs = ndr_token_peek(&ndr->relative_list, r->name);
if (relofs & 0x80000000) {
relofs &= 0xFF;
if ((relofs < sizeof(qualifier_keys)/sizeof(qualifier_keys[0])) && qualifier_keys[relofs]) {
r->name = talloc_strdup(ndr->current_mem_ctx, qualifier_keys[relofs]);
} else {
r->name = talloc_asprintf(ndr->current_mem_ctx, "%s%d", qn_unknown, relofs);
}
} else if (r->name) {
struct ndr_pull_save _relative_save;
ndr_pull_save(ndr, &_relative_save);
NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->name));
_mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->name));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
ndr_pull_restore(ndr, &_relative_save);
}
NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_BUFFERS, &r->value));
}
return NT_STATUS_OK;
}
NTSTATUS ndr_push_WbemQualifiers(struct ndr_push *ndr, int ndr_flags, const struct WbemQualifiers *r)
{
uint32_t i, ofs, ofs_size;
if (ndr_flags & NDR_SCALARS) {
ofs_size = ndr->offset;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
for (i = 0; i < r->count; ++i)
NDR_CHECK(ndr_push_WbemQualifier(ndr, NDR_SCALARS, r->item[i]));
ofs = ndr->offset;
ndr->offset = ofs_size;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ofs - ofs_size));
ndr->offset = ofs;
}
if (ndr_flags & NDR_BUFFERS) {
for (i = 0; i < r->count; ++i)
NDR_CHECK(ndr_push_WbemQualifier(ndr, NDR_BUFFERS, r->item[i]));
}
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_WbemQualifiers(struct ndr_pull *ndr, int ndr_flags, struct WbemQualifiers *r)
{
uint32_t endofs;
uint32_t len;
TALLOC_CTX *mem_ctx;
mem_ctx = ndr->current_mem_ctx;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &endofs));
endofs += ndr->offset - 4;
r->count = 0;
len = 10;
r->item = talloc_array(mem_ctx, struct WbemQualifier*, len);
ndr->current_mem_ctx = r->item;
while (ndr->offset < endofs) {
if (r->count >= len) {
len += 3;
r->item = talloc_realloc(mem_ctx, r->item, struct WbemQualifier*, len);
/* update the memory context with the realloc'ed ptr */
ndr->current_mem_ctx = r->item;
}
NDR_PULL_ALLOC(ndr, r->item[r->count]);
NDR_CHECK(ndr_pull_WbemQualifier(ndr, NDR_SCALARS, r->item[r->count]));
++r->count;
}
r->item = talloc_realloc(mem_ctx, r->item, struct WbemQualifier*, r->count);
}
if (ndr_flags & NDR_BUFFERS) {
uint32_t i;
ndr->current_mem_ctx = r->item;
for (i = 0; i < r->count; ++i) {
NDR_CHECK(ndr_pull_WbemQualifier(ndr, NDR_BUFFERS, r->item[i]));
}
}
ndr->current_mem_ctx = mem_ctx;
return NT_STATUS_OK;
}
NTSTATUS ndr_push_DataWithStack(struct ndr_push *ndr, ndr_push_flags_fn_t fn, const void *r)
{
uint32_t ofs, ofs_size, ofs_ssize;
ofs_size = ndr->offset;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
NDR_CHECK(fn(ndr, NDR_SCALARS, r));
ofs_ssize = ndr->offset;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
ndr->relative_base_offset = ndr->offset;
NDR_CHECK(fn(ndr, NDR_BUFFERS, r));
ofs = ndr->offset;
ndr->offset = ofs_size;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ofs-ofs_size));
ndr->offset = ofs_ssize;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (ofs-ofs_ssize-4) | 0x80000000));
ndr->offset = ofs;
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_DataWithStack(struct ndr_pull *ndr, ndr_pull_flags_fn_t fn, void *r)
{
uint32_t end, size, ssize, ndrend;
end = ndr->offset;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &size));
NDR_PULL_NEED_BYTES(ndr, size - 4);
end += size;
ndrend = ndr->data_size;
ndr->data_size = end;
NDR_CHECK(fn(ndr, NDR_SCALARS, r));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ssize));
if (!(ssize & 0x80000000))
return ndr_pull_error(ndr, NDR_ERR_VALIDATE, "ndr_pull_DataWithStack(%08X): Stack size without 31th bit set: 0x%08X", ndr->offset - 4, ssize);
ssize &= 0x7FFFFFFF;
NDR_PULL_NEED_BYTES(ndr, ssize);
ndr->data_size = ndr->offset + ssize;
ndr->relative_base_offset = ndr->offset;
NDR_CHECK(fn(ndr, NDR_BUFFERS, r));
ndr->data_size = ndrend;
ndr->offset = end;
return NT_STATUS_OK;
}
NTSTATUS ndr_push_uint32_flags(struct ndr_push *ndr, int ndr_flags, uint32_t v)
{
if (ndr_flags & NDR_SCALARS)
return ndr_push_uint32(ndr, NDR_SCALARS, v);
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_uint32_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
{
if (ndr_flags & NDR_SCALARS)
return ndr_pull_uint32(ndr, NDR_SCALARS, v);
return NT_STATUS_OK;
}
void copy_bits(const uint8_t *src, uint32_t bsrc, uint8_t *dst, uint32_t bdst, uint32_t count)
{
uint8_t mask;
src += bsrc >> 3;
bsrc &= 7;
dst += bdst >> 3;
bdst &= 7;
mask = ((1 << count) - 1);
*dst &= ~(mask << bdst);
*dst |= ((*src >> bsrc) & mask) << bdst;
}
#define IS_CIMTYPE_PTR(t) (((t) & CIM_FLAG_ARRAY) || ((t) == CIM_STRING) || ((t) == CIM_DATETIME) || ((t) == CIM_REFERENCE))
NTSTATUS ndr_push_WbemInstance_priv(struct ndr_push *ndr, int ndr_flags, const struct WbemClassObject *r)
{
int i;
if (ndr_flags & NDR_SCALARS) {
uint32_t ofs, vofs;
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->instance->u1_0));
if (r->instance->__CLASS) {
NDR_CHECK(ndr_push_relative_ptr1(ndr, r->instance->__CLASS));
} else {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF));
}
ofs = ndr->offset;
NDR_PUSH_NEED_BYTES(ndr, r->obj_class->data_size);
for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
copy_bits(&r->instance->default_flags[i], 0, ndr->data + ndr->offset, 2*r->obj_class->properties[i].desc->nr, 2);
}
i = 0xFF;
copy_bits((uint8_t *)&i, 0, ndr->data + ndr->offset, 2*r->obj_class->__PROPERTY_COUNT, (8 - 2*r->obj_class->__PROPERTY_COUNT) % 7);
vofs = ofs + ((r->obj_class->__PROPERTY_COUNT + 3) >> 2);
for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
NDR_CHECK(ndr_push_set_switch_value(ndr, &r->instance->data[i], r->obj_class->properties[i].desc->cimtype & CIM_TYPEMASK));
ndr->offset = vofs + r->obj_class->properties[i].desc->offset;
NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_SCALARS, &r->instance->data[i]));
}
ndr->offset = ofs + r->obj_class->data_size;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->instance->u2_4));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->instance->u3_1));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->instance->__CLASS) {
NDR_CHECK(ndr_push_relative_ptr2(ndr, r->instance->__CLASS));
NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->instance->__CLASS));
}
for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_BUFFERS, &r->instance->data[i]));
}
}
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_WbemInstance_priv(struct ndr_pull *ndr, int ndr_flags, const struct WbemClassObject *r)
{
int i;
if (!r->obj_class) {
DEBUG(1,("ndr_pull_WbemInstance_priv: There is no class for given instance\n"));
return NT_STATUS_NO_SUCH_FILE;
}
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
uint32_t ofs, vofs;
uint32_t _ptr___CLASS;
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->instance->u1_0));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr___CLASS));
if (_ptr___CLASS != 0xFFFFFFFF) {
NDR_PULL_ALLOC(ndr, r->instance->__CLASS);
NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->instance->__CLASS, _ptr___CLASS));
} else {
r->instance->__CLASS = NULL;
}
ofs = ndr->offset;
NDR_PULL_NEED_BYTES(ndr, r->obj_class->data_size);
NDR_PULL_ALLOC_N(ndr, r->instance->default_flags, r->obj_class->__PROPERTY_COUNT);
for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
r->instance->default_flags[i] = 0;
copy_bits(ndr->data + ndr->offset, 2*r->obj_class->properties[i].desc->nr, &r->instance->default_flags[i], 0, 2);
}
vofs = ofs + ((r->obj_class->__PROPERTY_COUNT + 3) >> 2);
NDR_PULL_ALLOC_N(ndr, r->instance->data, r->obj_class->__PROPERTY_COUNT);
memset(r->instance->data, 0, sizeof(*r->instance->data) * r->obj_class->__PROPERTY_COUNT);
for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->instance->data[i], r->obj_class->properties[i].desc->cimtype & CIM_TYPEMASK));
ndr->offset = vofs + r->obj_class->properties[i].desc->offset;
NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_SCALARS, &r->instance->data[i]));
}
ndr->offset = ofs + r->obj_class->data_size;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->instance->u2_4));
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->instance->u3_1));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->instance->__CLASS) {
struct ndr_pull_save _relative_save;
ndr_pull_save(ndr, &_relative_save);
NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->instance->__CLASS));
NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->instance->__CLASS));
ndr_pull_restore(ndr, &_relative_save);
}
for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_BUFFERS, &r->instance->data[i]));
}
}
return NT_STATUS_OK;
}
void ndr_print_WbemInstance_priv(struct ndr_print *ndr, const char *name, const struct WbemClassObject *r)
{
int i;
ndr_print_array_uint8(ndr, "default_flags", r->instance->default_flags, r->obj_class->__PROPERTY_COUNT);
ndr->print(ndr, "%s: ARRAY(%d)", "data", r->obj_class->__PROPERTY_COUNT);
ndr->depth++;
for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
ndr->print(ndr, "%s[%d]", "data", i);
ndr->depth++;
ndr_print_set_switch_value(ndr, &r->instance->data[i], r->obj_class->properties[i].desc->cimtype & CIM_TYPEMASK);
ndr_print_CIMVAR(ndr, r->obj_class->properties[i].name, &r->instance->data[i]);
ndr->depth--;
}
ndr->depth--;
}
NTSTATUS ndr_push_WbemClassObject(struct ndr_push *ndr, int ndr_flags, const struct WbemClassObject *r)
{
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->flags));
if (r->flags & WCF_CLASS) {
NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->__SERVER));
NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->__NAMESPACE));
}
if (r->flags & WCF_DECORATIONS) {
NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemClass, r->sup_class));
NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemMethods, r->sup_methods));
}
if (r->flags & (WCF_CLASS | WCF_INSTANCE)) {
NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemClass, r->obj_class));
}
if (r->flags & WCF_DECORATIONS) {
NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemMethods, r->obj_methods));
}
if (r->flags & WCF_INSTANCE) {
NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemInstance_priv, r));
}
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_WbemClassObject(struct ndr_pull *ndr, int ndr_flags, struct WbemClassObject *r)
{
TALLOC_CTX *tc;
tc = NDR_PULL_GET_MEM_CTX(ndr);
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->flags));
if (r->flags & WCF_CLASS) {
NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__SERVER));
NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__NAMESPACE));
}
if (r->flags & WCF_DECORATIONS) {
r->sup_class = talloc_zero(r, struct WbemClass);
NDR_PULL_SET_MEM_CTX(ndr, r->sup_class, 0);
NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemClass, r->sup_class));
r->sup_methods = talloc_zero(r, struct WbemMethods);
NDR_PULL_SET_MEM_CTX(ndr, r->sup_methods, 0);
NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemMethods, r->sup_methods));
NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
} else
r->sup_class = NULL;
if (r->flags & (WCF_CLASS | WCF_INSTANCE)) {
r->obj_class = talloc_zero(r, struct WbemClass);
NDR_PULL_SET_MEM_CTX(ndr, r->obj_class, 0);
NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemClass, r->obj_class));
NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
}
if (r->flags & WCF_DECORATIONS) {
r->obj_methods = talloc_zero(r, struct WbemMethods);
NDR_PULL_SET_MEM_CTX(ndr, r->obj_methods, 0);
NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemMethods, r->obj_methods));
NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
}
if (r->flags & WCF_INSTANCE) {
r->instance = talloc_zero(r, struct WbemInstance);
NDR_PULL_SET_MEM_CTX(ndr, r->instance, 0);
NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemInstance_priv, r));
NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
} else
r->instance = NULL;
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_WbemClassObject_Object(struct ndr_pull *ndr, int ndr_flags, struct WbemClassObject *r)
{
TALLOC_CTX *tc;
tc = NDR_PULL_GET_MEM_CTX(ndr);
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->flags));
if (r->flags & WCF_CLASS) {
NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__SERVER));
NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__NAMESPACE));
}
if (r->flags & WCF_INSTANCE) {
r->instance = talloc_zero(r, struct WbemInstance);
NDR_PULL_SET_MEM_CTX(ndr, r->instance, 0);
NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemInstance_priv, r));
NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
} else
r->instance = NULL;
return NT_STATUS_OK;
}
_PUBLIC_ void ndr_print_WbemClassObject(struct ndr_print *ndr, const char *name, const struct WbemClassObject *r)
{
ndr_print_struct(ndr, name, "WbemClassObject");
{
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
ndr_print_WCO_FLAGS(ndr, "flags", r->flags);
if (r->flags & WCF_CLASS) {
ndr_print_ptr(ndr, "__SERVER", r->__SERVER);
ndr->depth++;
ndr_print_CIMSTRING(ndr, "__SERVER", &r->__SERVER);
ndr->depth--;
ndr_print_ptr(ndr, "__NAMESPACE", r->__NAMESPACE);
ndr->depth++;
ndr_print_CIMSTRING(ndr, "__NAMESPACE", &r->__NAMESPACE);
ndr->depth--;
}
if (r->flags & WCF_DECORATIONS) {
ndr_print_ptr(ndr, "sup_class", r->sup_class);
ndr->depth++;
if (r->sup_class) {
ndr_print_WbemClass(ndr, "sup_class", r->sup_class);
}
ndr->depth--;
ndr_print_ptr(ndr, "sup_methods", r->sup_methods);
ndr->depth++;
if (r->sup_methods) {
ndr_print_WbemMethods(ndr, "sup_methods", r->sup_methods);
}
ndr->depth--;
}
if (r->flags & (WCF_CLASS | WCF_INSTANCE)) {
ndr_print_ptr(ndr, "obj_class", r->obj_class);
ndr->depth++;
if (r->obj_class) {
ndr_print_WbemClass(ndr, "obj_class", r->obj_class);
}
ndr->depth--;
}
if (r->flags & WCF_DECORATIONS) {
ndr_print_ptr(ndr, "obj_methods", r->obj_methods);
ndr->depth++;
if (r->obj_methods) {
ndr_print_WbemMethods(ndr, "obj_methods", r->obj_methods);
}
ndr->depth--;
}
if (r->flags & WCF_INSTANCE) {
ndr_print_ptr(ndr, "instance", r->instance);
ndr->depth++;
if (r->instance) {
ndr_print_WbemInstance_priv(ndr, "instance", r);
}
ndr->depth--;
}
ndr->depth--;
ndr->flags = _flags_save_STRUCT;
}
}
_PUBLIC_ NTSTATUS ndr_push_WbemClass(struct ndr_push *ndr, int ndr_flags, const struct WbemClass *r)
{
uint32_t cntr_properties_0;
uint32_t i, ofs, vofs;
{
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->u_0));
if (r->__CLASS) {
NDR_CHECK(ndr_push_relative_ptr1(ndr, r->__CLASS));
} else {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF));
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->data_size));
NDR_CHECK(ndr_push_CIMSTRINGS(ndr, NDR_SCALARS, &r->__DERIVATION));
NDR_CHECK(ndr_push_WbemQualifiers(ndr, NDR_SCALARS, &r->qualifiers));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->__PROPERTY_COUNT));
for (cntr_properties_0 = 0; cntr_properties_0 < r->__PROPERTY_COUNT; cntr_properties_0++) {
NDR_CHECK(ndr_push_WbemProperty(ndr, NDR_SCALARS, &r->properties[cntr_properties_0]));
}
ofs = ndr->offset;
NDR_PUSH_NEED_BYTES(ndr, r->data_size);
for (i = 0; i < r->__PROPERTY_COUNT; ++i) {
copy_bits(&r->default_flags[i], 0, ndr->data + ndr->offset, 2*r->properties[i].desc->nr, 2);
}
i = 0xFF;
copy_bits((uint8_t *)&i, 0, ndr->data + ndr->offset, 2*r->__PROPERTY_COUNT, (8 - 2*r->__PROPERTY_COUNT) % 7);
vofs = ofs + ((r->__PROPERTY_COUNT + 3) >> 2);
for (i = 0; i < r->__PROPERTY_COUNT; ++i) {
NDR_CHECK(ndr_push_set_switch_value(ndr, &r->default_values[i], r->properties[i].desc->cimtype & CIM_TYPEMASK));
ndr->offset = vofs + r->properties[i].desc->offset;
if ((r->default_flags[i] & DEFAULT_FLAG_EMPTY) && IS_CIMTYPE_PTR(r->properties[i].desc->cimtype & CIM_TYPEMASK)) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF));
} else {
NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_SCALARS, &r->default_values[i]));
}
}
ndr->offset = ofs + r->data_size;
}
if (ndr_flags & NDR_BUFFERS) {
if (r->__CLASS) {
NDR_CHECK(ndr_push_relative_ptr2(ndr, r->__CLASS));
NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->__CLASS));
}
NDR_CHECK(ndr_push_CIMSTRINGS(ndr, NDR_BUFFERS, &r->__DERIVATION));
NDR_CHECK(ndr_push_WbemQualifiers(ndr, NDR_BUFFERS, &r->qualifiers));
for (cntr_properties_0 = 0; cntr_properties_0 < r->__PROPERTY_COUNT; cntr_properties_0++) {
NDR_CHECK(ndr_push_WbemProperty(ndr, NDR_BUFFERS, &r->properties[cntr_properties_0]));
}
for (i = 0; i < r->__PROPERTY_COUNT; ++i) {
if (r->default_flags[i] & DEFAULT_FLAG_EMPTY) continue;
NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_BUFFERS, &r->default_values[i]));
}
}
ndr->flags = _flags_save_STRUCT;
}
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS ndr_pull_WbemClass(struct ndr_pull *ndr, int ndr_flags, struct WbemClass *r)
{
uint32_t _ptr___CLASS;
uint32_t cntr_properties_0;
TALLOC_CTX *_mem_save_properties_0;
uint32_t i;
{
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->u_0));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr___CLASS));
if (_ptr___CLASS != 0xFFFFFFFF) {
NDR_PULL_ALLOC(ndr, r->__CLASS);
NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->__CLASS, _ptr___CLASS));
} else {
r->__CLASS = NULL;
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_size));
NDR_CHECK(ndr_pull_CIMSTRINGS(ndr, NDR_SCALARS, &r->__DERIVATION));
NDR_CHECK(ndr_pull_WbemQualifiers(ndr, NDR_SCALARS, &r->qualifiers));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__PROPERTY_COUNT));
NDR_PULL_ALLOC_N(ndr, r->properties, r->__PROPERTY_COUNT);
_mem_save_properties_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->properties, 0);
for (cntr_properties_0 = 0; cntr_properties_0 < r->__PROPERTY_COUNT; cntr_properties_0++) {
NDR_CHECK(ndr_pull_WbemProperty(ndr, NDR_SCALARS, &(r->properties)[cntr_properties_0]));
}
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_properties_0, 0);
NDR_PULL_NEED_BYTES(ndr, r->data_size);
NDR_PULL_ALLOC_N(ndr, r->default_flags, r->__PROPERTY_COUNT);
NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_flags, ndr->offset));
NDR_PULL_ALLOC_N(ndr, r->default_values, r->__PROPERTY_COUNT);
memset(r->default_values, 0, sizeof(*r->default_values) * r->__PROPERTY_COUNT);
NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_values, ndr->offset + ((r->__PROPERTY_COUNT + 3) >> 2)));
ndr->offset += r->data_size;
}
if (ndr_flags & NDR_BUFFERS) {
if (r->__CLASS) {
TALLOC_CTX *_mem_save___CLASS_0;
struct ndr_pull_save _relative_save;
ndr_pull_save(ndr, &_relative_save);
NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->__CLASS));
_mem_save___CLASS_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->__CLASS, 0);
NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__CLASS));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save___CLASS_0, 0);
ndr_pull_restore(ndr, &_relative_save);
}
NDR_CHECK(ndr_pull_CIMSTRINGS(ndr, NDR_BUFFERS, &r->__DERIVATION));
NDR_CHECK(ndr_pull_WbemQualifiers(ndr, NDR_BUFFERS, &r->qualifiers));
_mem_save_properties_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->properties, 0);
for (cntr_properties_0 = 0; cntr_properties_0 < r->__PROPERTY_COUNT; cntr_properties_0++) {
NDR_CHECK(ndr_pull_WbemProperty(ndr, NDR_BUFFERS, &(r->properties)[cntr_properties_0]));
}
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_properties_0, 0);
{
uint32_t ofs;
NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, r->default_flags, &ofs));
for (i = 0; i < r->__PROPERTY_COUNT; ++i) {
r->default_flags[i] = 0;
copy_bits(ndr->data + ofs, 2*r->properties[i].desc->nr, &r->default_flags[i], 0, 2);
}
}
{
struct ndr_pull_save _relative_save;
uint32_t ofs;
ndr_pull_save(ndr, &_relative_save);
NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, r->default_values, &ofs));
for (i=0; i < r->__PROPERTY_COUNT; ++i) {
if (r->default_flags[i] & DEFAULT_FLAG_EMPTY) continue;
NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->default_values[i], r->properties[i].desc->cimtype & CIM_TYPEMASK));
ndr->offset = ofs + r->properties[i].desc->offset;
NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_SCALARS|NDR_BUFFERS, &r->default_values[i]));
}
ndr_pull_restore(ndr, &_relative_save);
}
}
ndr->flags = _flags_save_STRUCT;
}
return NT_STATUS_OK;
}
_PUBLIC_ void ndr_print_WbemClass(struct ndr_print *ndr, const char *name, const struct WbemClass *r)
{
uint32_t cntr_properties_0;
uint32_t cntr_default_values_0;
ndr_print_struct(ndr, name, "WbemClass");
{
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
ndr_print_uint8(ndr, "u_0", r->u_0);
ndr_print_ptr(ndr, "__CLASS", r->__CLASS);
ndr->depth++;
if (r->__CLASS) {
ndr_print_CIMSTRING(ndr, "__CLASS", &r->__CLASS);
}
ndr->depth--;
ndr_print_uint32(ndr, "data_size", r->data_size);
ndr_print_CIMSTRINGS(ndr, "__DERIVATION", &r->__DERIVATION);
ndr_print_WbemQualifiers(ndr, "qualifiers", &r->qualifiers);
ndr_print_uint32(ndr, "__PROPERTY_COUNT", r->__PROPERTY_COUNT);
ndr->print(ndr, "%s: ARRAY(%d)", "properties", r->__PROPERTY_COUNT);
ndr->depth++;
for (cntr_properties_0=0;cntr_properties_0<r->__PROPERTY_COUNT;cntr_properties_0++) {
char *idx_0=NULL;
asprintf(&idx_0, "[%d]", cntr_properties_0);
if (idx_0) {
ndr_print_WbemProperty(ndr, "properties", &r->properties[cntr_properties_0]);
free(idx_0);
}
}
ndr->depth--;
ndr_print_array_uint8(ndr, "default_flags", r->default_flags, r->__PROPERTY_COUNT);
ndr->print(ndr, "%s: ARRAY(%d)", "default_values", r->__PROPERTY_COUNT);
ndr->depth++;
for (cntr_default_values_0=0;cntr_default_values_0<r->__PROPERTY_COUNT;cntr_default_values_0++) {
char *idx_0=NULL;
asprintf(&idx_0, "[%d]", cntr_default_values_0);
if (idx_0) {
ndr_print_set_switch_value(ndr, &r->default_values[cntr_default_values_0], r->properties[cntr_default_values_0].desc->cimtype & CIM_TYPEMASK);
ndr_print_CIMVAR(ndr, "default_values", &r->default_values[cntr_default_values_0]);
free(idx_0);
}
}
ndr->depth--;
ndr->depth--;
ndr->flags = _flags_save_STRUCT;
}
}
+64
View File
@@ -0,0 +1,64 @@
/*
Unix SMB/CIFS implementation.
routines for printing some linked list structs in DRSUAPI
Copyright (C) Stefan (metze) Metzmacher 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 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.
*/
#include "includes.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_misc.h"
void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
const struct drsuapi_DsReplicaObjectListItem *r)
{
ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItem");
ndr->depth++;
ndr_print_ptr(ndr, "next_object", r->next_object);
ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object);
ndr->depth--;
if (r->next_object) {
ndr_print_drsuapi_DsReplicaObjectListItem(ndr, "next_object", r->next_object);
}
}
void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaObjectListItemEx *r)
{
ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItemEx");
ndr->depth++;
ndr_print_ptr(ndr, "next_object", r->next_object);
ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object);
ndr_print_uint32(ndr, "unknown1", r->unknown1);
ndr_print_ptr(ndr, "parent_object_guid", r->parent_object_guid);
ndr->depth++;
if (r->parent_object_guid) {
ndr_print_GUID(ndr, "parent_object_guid", r->parent_object_guid);
}
ndr->depth--;
ndr_print_ptr(ndr, "meta_data_ctr", r->meta_data_ctr);
ndr->depth++;
if (r->meta_data_ctr) {
ndr_print_drsuapi_DsReplicaMetaDataCtr(ndr, "meta_data_ctr", r->meta_data_ctr);
}
ndr->depth--;
ndr->depth--;
if (r->next_object) {
ndr_print_drsuapi_DsReplicaObjectListItemEx(ndr, "next_object", r->next_object);
}
}
+141
View File
@@ -0,0 +1,141 @@
/*
Unix SMB/CIFS implementation.
routines for marshalling/unmarshalling spoolss subcontext buffer structures
Copyright (C) Stefan Metzmacher 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 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.
*/
#include "includes.h"
#include "librpc/gen_ndr/ndr_krb5pac.h"
static size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
{
size_t s = ndr_size_PAC_INFO(r, level, flags);
switch (level) {
case PAC_TYPE_LOGON_INFO:
return NDR_ROUND(s,8);
default:
return s;
}
}
static size_t _subcontext_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
{
size_t s = ndr_size_PAC_INFO(r, level, flags);
return NDR_ROUND(s,8);
}
NTSTATUS ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const struct PAC_BUFFER *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_PAC_TYPE(ndr, NDR_SCALARS, r->type));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size_PAC_INFO(r->info,r->type,0)));
{
uint32_t _flags_save_PAC_INFO = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
NDR_CHECK(ndr_push_relative_ptr1(ndr, r->info));
ndr->flags = _flags_save_PAC_INFO;
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
}
if (ndr_flags & NDR_BUFFERS) {
{
uint32_t _flags_save_PAC_INFO = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
if (r->info) {
NDR_CHECK(ndr_push_relative_ptr2(ndr, r->info));
{
struct ndr_push *_ndr_info;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
NDR_CHECK(ndr_push_set_switch_value(_ndr_info, r->info, r->type));
NDR_CHECK(ndr_push_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info));
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
}
}
ndr->flags = _flags_save_PAC_INFO;
}
}
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUFFER *r)
{
uint32_t _ptr_info;
TALLOC_CTX *_mem_save_info_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_PAC_TYPE(ndr, NDR_SCALARS, &r->type));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_ndr_size));
{
uint32_t _flags_save_PAC_INFO = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
if (_ptr_info) {
NDR_PULL_ALLOC(ndr, r->info);
NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->info, _ptr_info));
} else {
r->info = NULL;
}
ndr->flags = _flags_save_PAC_INFO;
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_pad));
}
if (ndr_flags & NDR_BUFFERS) {
{
uint32_t _flags_save_PAC_INFO = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
if (r->info) {
struct ndr_pull_save _relative_save;
ndr_pull_save(ndr, &_relative_save);
NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->info));
_mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->info, 0);
{
struct ndr_pull *_ndr_info;
NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info, 0, r->_ndr_size));
NDR_CHECK(ndr_pull_set_switch_value(_ndr_info, r->info, r->type));
NDR_CHECK(ndr_pull_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info));
NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info, 0, r->_ndr_size));
}
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
ndr_pull_restore(ndr, &_relative_save);
}
ndr->flags = _flags_save_PAC_INFO;
}
}
return NT_STATUS_OK;
}
void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER *r)
{
ndr_print_struct(ndr, name, "PAC_BUFFER");
ndr->depth++;
ndr_print_PAC_TYPE(ndr, "type", r->type);
ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,0):r->_ndr_size);
ndr_print_ptr(ndr, "info", r->info);
ndr->depth++;
if (r->info) {
ndr_print_set_switch_value(ndr, r->info, r->type);
ndr_print_PAC_INFO(ndr, "info", r->info);
}
ndr->depth--;
ndr_print_uint32(ndr, "_pad", r->_pad);
ndr->depth--;
}
+41
View File
@@ -0,0 +1,41 @@
/*
Unix SMB/CIFS implementation.
UUID/GUID/policy_handle functions
Copyright (C) Andrew Tridgell 2003.
Copyright (C) Stefan (metze) Metzmacher 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.
*/
#include "includes.h"
#include "system/network.h"
#include "librpc/ndr/libndr.h"
_PUBLIC_ void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip)
{
struct ipv4_addr ip;
ip.addr = htonl(_ip->addr);
ndr->print(ndr, "%-25s: %s", name, sys_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));
}
+181
View File
@@ -0,0 +1,181 @@
/*
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.
*/
#include "includes.h"
#include "librpc/gen_ndr/ndr_orpc.h"
NTSTATUS 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;
TALLOC_CTX *mem_ctx = ndr->current_mem_ctx;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
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(mem_ctx, struct STRINGBINDING *, num_entries + 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(mem_ctx, ar->stringbindings, struct STRINGBINDING *, towernum+2);
ar->stringbindings[towernum] = talloc(ar->stringbindings, struct STRINGBINDING);
ndr->current_mem_ctx = ar->stringbindings[towernum];
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(mem_ctx, 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(mem_ctx, ar->securitybindings, struct SECURITYBINDING *, towernum+2);
ar->securitybindings[towernum] = talloc(ar->securitybindings, struct SECURITYBINDING);
ndr->current_mem_ctx = ar->securitybindings[towernum];
NDR_CHECK(ndr_pull_SECURITYBINDING(ndr, ndr_flags, ar->securitybindings[towernum]));
towernum++;
}
} while (towerid != 0);
ar->securitybindings[towernum] = NULL;
ndr->current_mem_ctx = mem_ctx;
return NT_STATUS_OK;
}
NTSTATUS ndr_push_DUALSTRINGARRAY(struct ndr_push *ndr, int ndr_flags, const struct DUALSTRINGARRAY *ar)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
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--;
}
NTSTATUS ndr_pull_STRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct STRINGARRAY *ar)
{
uint16_t towerid;
uint32_t towernum = 0;
uint16_t num_entries;
TALLOC_CTX *mem_ctx = ndr->current_mem_ctx;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
ar->stringbindings = talloc_array(mem_ctx, 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(mem_ctx, ar->stringbindings, struct STRINGBINDING *, towernum+2);
ar->stringbindings[towernum] = talloc(ar->stringbindings, struct STRINGBINDING);
ndr->current_mem_ctx = ar->stringbindings[towernum];
NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
towernum++;
}
} while (towerid != 0);
ar->stringbindings[towernum] = NULL;
towernum = 0;
ndr->current_mem_ctx = mem_ctx;
return NT_STATUS_OK;
}
NTSTATUS ndr_push_STRINGARRAY(struct ndr_push *ndr, int ndr_flags, const struct STRINGARRAY *ar)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
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--;
}
+204
View File
@@ -0,0 +1,204 @@
/*
Unix SMB/CIFS implementation.
fast routines for getting the wire size of security objects
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 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.
*/
#include "includes.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "libcli/security/security.h"
/*
return the wire size of a dom_sid
*/
size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
{
if (!sid) return 0;
return 8 + 4*sid->num_auths;
}
size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
{
struct dom_sid zero_sid;
if (!sid) return 0;
ZERO_STRUCT(zero_sid);
if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
return 0;
}
return 8 + 4*sid->num_auths;
}
/*
return the wire size of a security_ace
*/
size_t ndr_size_security_ace(const struct security_ace *ace, int flags)
{
if (!ace) return 0;
return 8 + ndr_size_dom_sid(&ace->trustee, flags);
}
/*
return the wire size of a security_acl
*/
size_t ndr_size_security_acl(const struct security_acl *acl, int flags)
{
size_t ret;
int i;
if (!acl) return 0;
ret = 8;
for (i=0;i<acl->num_aces;i++) {
ret += ndr_size_security_ace(&acl->aces[i], flags);
}
return ret;
}
/*
return the wire size of a security descriptor
*/
size_t ndr_size_security_descriptor(const struct security_descriptor *sd, int flags)
{
size_t ret;
if (!sd) return 0;
ret = 20;
ret += ndr_size_dom_sid(sd->owner_sid, flags);
ret += ndr_size_dom_sid(sd->group_sid, flags);
ret += ndr_size_security_acl(sd->dacl, flags);
ret += ndr_size_security_acl(sd->sacl, flags);
return ret;
}
/*
print a dom_sid
*/
void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
{
ndr->print(ndr, "%-25s: %s", name, dom_sid_string(ndr, sid));
}
void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
{
ndr_print_dom_sid(ndr, name, sid);
}
void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
{
ndr_print_dom_sid(ndr, name, sid);
}
/*
parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field
*/
NTSTATUS ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
{
uint32_t num_auths;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &num_auths));
NDR_CHECK(ndr_pull_dom_sid(ndr, ndr_flags, sid));
if (sid->num_auths != num_auths) {
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
"Bad array size %u should exceed %u",
num_auths, sid->num_auths);
}
return NT_STATUS_OK;
}
/*
parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field
*/
NTSTATUS ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
{
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, sid->num_auths));
return ndr_push_dom_sid(ndr, ndr_flags, sid);
}
/*
parse a dom_sid28 - this is a dom_sid in a fixed 28 byte buffer, so we need to ensure there are only upto 5 sub_auth
*/
NTSTATUS ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
{
NTSTATUS status;
struct ndr_pull *subndr;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
subndr = talloc_zero(ndr, struct ndr_pull);
NT_STATUS_HAVE_NO_MEMORY(subndr);
subndr->flags = ndr->flags;
subndr->current_mem_ctx = ndr->current_mem_ctx;
subndr->data = ndr->data + ndr->offset;
subndr->data_size = 28;
subndr->offset = 0;
NDR_CHECK(ndr_pull_advance(ndr, 28));
status = ndr_pull_dom_sid(subndr, ndr_flags, sid);
if (!NT_STATUS_IS_OK(status)) {
/* handle a w2k bug which send random data in the buffer */
ZERO_STRUCTP(sid);
}
return NT_STATUS_OK;
}
/*
push a dom_sid28 - this is a dom_sid in a 28 byte fixed buffer
*/
NTSTATUS ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
{
uint32_t old_offset;
uint32_t padding;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
if (sid->num_auths > 5) {
return ndr_push_error(ndr, NDR_ERR_RANGE,
"dom_sid28 allows only upto 5 sub auth [%u]",
sid->num_auths);
}
old_offset = ndr->offset;
NDR_CHECK(ndr_push_dom_sid(ndr, ndr_flags, sid));
padding = 28 - (ndr->offset - old_offset);
if (padding > 0) {
NDR_CHECK(ndr_push_zero(ndr, padding));
}
return NT_STATUS_OK;
}
+531
View File
@@ -0,0 +1,531 @@
/*
Unix SMB/CIFS implementation.
routines for marshalling/unmarshalling spoolss subcontext buffer structures
Copyright (C) Andrew Tridgell 2003
Copyright (C) Tim Potter 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 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.
*/
#include "includes.h"
#include "librpc/gen_ndr/ndr_spoolss.h"
#define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
if (!r->in.buffer && r->in.offered != 0) {\
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
"SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
(unsigned)r->in.offered);\
} else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
"SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
(unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
}\
_r.in.level = r->in.level;\
_r.in.buffer = r->in.buffer;\
_r.in.offered = r->in.offered;\
NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
} while(0)
#define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
struct ndr_push *_ndr_info;\
_r.in.level = r->in.level;\
_r.in.buffer = r->in.buffer;\
_r.in.offered = r->in.offered;\
_r.out.info = NULL;\
_r.out.needed = r->out.needed;\
_r.out.count = r->out.count;\
_r.out.result = r->out.result;\
if (r->out.info && !r->in.buffer) {\
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
"SPOOLSS Buffer: r->out.info but there's no r->in.buffer");\
}\
if (r->in.buffer) {\
DATA_BLOB _data_blob_info;\
_ndr_info = ndr_push_init_ctx(ndr);\
if (!_ndr_info) return NT_STATUS_NO_MEMORY;\
_ndr_info->flags= ndr->flags;\
if (r->out.info) {\
struct __##fn __r;\
__r.in.level = r->in.level;\
__r.in.count = r->out.count;\
__r.out.info = r->out.info;\
NDR_CHECK(ndr_push___##fn(_ndr_info, flags, &__r)); \
}\
if (r->in.offered > _ndr_info->offset) {\
uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
} else if (r->in.offered < _ndr_info->offset) {\
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
"SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
(unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
}\
_data_blob_info = ndr_push_blob(_ndr_info);\
_r.out.info = &_data_blob_info;\
}\
NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
} while(0)
#define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
struct _##fn _r;\
if (flags & NDR_IN) {\
in;\
NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
}\
if (flags & NDR_OUT) {\
out;\
NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
}\
} while(0)
#define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
ZERO_STRUCT(r->out);\
NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
r->in.level = _r.in.level;\
r->in.buffer = _r.in.buffer;\
r->in.offered = _r.in.offered;\
r->out.needed = _r.out.needed;\
if (!r->in.buffer && r->in.offered != 0) {\
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
"SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
(unsigned)r->in.offered);\
} else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
"SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
(unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
}\
} while(0)
#define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
_r.in.level = r->in.level;\
_r.in.buffer = r->in.buffer;\
_r.in.offered = r->in.offered;\
_r.out.needed = r->out.needed;\
NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
r->out.info = NULL;\
r->out.needed = _r.out.needed;\
r->out.count = _r.out.count;\
r->out.result = _r.out.result;\
if (_r.out.info) {\
struct ndr_pull *_ndr_info = ndr_pull_init_blob(_r.out.info, ndr);\
if (!_ndr_info) return NT_STATUS_NO_MEMORY;\
_ndr_info->flags= ndr->flags;\
if (r->in.offered != _ndr_info->data_size) {\
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
"SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
(unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
}\
if (r->out.needed <= _ndr_info->data_size) {\
struct __##fn __r;\
__r.in.level = r->in.level;\
__r.in.count = r->out.count;\
__r.out.info = NULL;\
NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
r->out.info = __r.out.info;\
}\
}\
} while(0)
#define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
struct _##fn _r;\
if (flags & NDR_IN) {\
out;\
NDR_SPOOLSS_PULL_ENUM_IN(fn);\
in;\
}\
if (flags & NDR_OUT) {\
out;\
NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
}\
} while(0)
#define _NDR_CHECK_UINT32(call) do {\
NTSTATUS _status; \
_status = call; \
if (!NT_STATUS_IS_OK(_status)) {\
return 0; \
}\
} while (0)
/* TODO: set _ndr_info->flags correct */
#define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
struct __##fn __r;\
DATA_BLOB _data_blob_info;\
struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\
if (!_ndr_info) return 0;\
_ndr_info->flags|=0;\
__r.in.level = level;\
__r.in.count = count;\
__r.out.info = info;\
_NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
_data_blob_info = ndr_push_blob(_ndr_info);\
return _data_blob_info.length;\
} while(0)
/*
spoolss_EnumPrinters
*/
NTSTATUS ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
{
NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
_r.in.flags = r->in.flags;
_r.in.server = r->in.server;
},{
_r.in.flags = r->in.flags;
_r.in.server = r->in.server;
});
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
{
NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
r->in.flags = _r.in.flags;
r->in.server = _r.in.server;
},{
_r.in.flags = r->in.flags;
_r.in.server = r->in.server;
});
return NT_STATUS_OK;
}
uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info)
{
NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinters);
}
/*
spoolss_EnumJobs
*/
NTSTATUS ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
{
NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{
_r.in.handle = r->in.handle;
_r.in.firstjob = r->in.firstjob;
_r.in.numjobs = r->in.numjobs;
},{
_r.in.handle = r->in.handle;
_r.in.firstjob = r->in.firstjob;
_r.in.numjobs = r->in.numjobs;
});
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
{
NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{
r->in.handle = _r.in.handle;
r->in.firstjob = _r.in.firstjob;
r->in.numjobs = _r.in.numjobs;
},{
_r.in.handle = r->in.handle;
_r.in.firstjob = r->in.firstjob;
_r.in.numjobs = r->in.numjobs;
});
return NT_STATUS_OK;
}
uint32_t ndr_size_spoolss_EnumJobss_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
{
NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumJobs);
}
/*
spoolss_EnumPrinterDrivers
*/
NTSTATUS ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
{
NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
_r.in.server = r->in.server;
_r.in.environment = r->in.environment;
},{
_r.in.server = r->in.server;
_r.in.environment = r->in.environment;
});
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
{
NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
r->in.server = _r.in.server;
r->in.environment = _r.in.environment;
},{
_r.in.server = r->in.server;
_r.in.environment = r->in.environment;
});
return NT_STATUS_OK;
}
uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_DriverInfo *info)
{
NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDrivers);
}
/*
spoolss_EnumForms
*/
NTSTATUS ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
{
NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
_r.in.handle = r->in.handle;
},{
_r.in.handle = r->in.handle;
});
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
{
NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
r->in.handle = _r.in.handle;
},{
_r.in.handle = r->in.handle;
});
return NT_STATUS_OK;
}
uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_FormInfo *info)
{
NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumForms);
}
/*
spoolss_EnumPorts
*/
NTSTATUS ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
{
NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
_r.in.servername= r->in.servername;
},{
_r.in.servername= r->in.servername;
});
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
{
NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
r->in.servername= _r.in.servername;
},{
_r.in.servername= r->in.servername;
});
return NT_STATUS_OK;
}
uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PortInfo *info)
{
NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPorts);
}
/*
spoolss_EnumMonitors
*/
NTSTATUS ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
{
NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
_r.in.servername= r->in.servername;
},{
_r.in.servername= r->in.servername;
});
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
{
NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
r->in.servername= _r.in.servername;
},{
_r.in.servername= r->in.servername;
});
return NT_STATUS_OK;
}
uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info)
{
NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumMonitors);
}
/*
spoolss_EnumPrintProcessors
*/
NTSTATUS ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
{
NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
_r.in.servername = r->in.servername;
_r.in.environment = r->in.environment;
},{
_r.in.servername = r->in.servername;
_r.in.environment = r->in.environment;
});
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
{
NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
r->in.servername = _r.in.servername;
r->in.environment = _r.in.environment;
},{
_r.in.servername = r->in.servername;
_r.in.environment = r->in.environment;
});
return NT_STATUS_OK;
}
uint32_t ndr_size_spoolss_EnumPrinterProcessors_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
{
NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrintProcessors);
}
/*
spoolss_GetPrinterData
*/
NTSTATUS ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r)
{
struct _spoolss_GetPrinterData _r;
if (flags & NDR_IN) {
_r.in.handle = r->in.handle;
_r.in.value_name= r->in.value_name;
_r.in.offered = r->in.offered;
NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
}
if (flags & NDR_OUT) {
struct ndr_push *_ndr_info;\
_r.in.handle = r->in.handle;
_r.in.value_name= r->in.value_name;
_r.in.offered = r->in.offered;
_r.out.type = r->out.type;
_r.out.data = data_blob(NULL, 0);
_r.out.needed = r->out.needed;
_r.out.result = r->out.result;
{
struct __spoolss_GetPrinterData __r;
_ndr_info = ndr_push_init_ctx(ndr);
if (!_ndr_info) return NT_STATUS_NO_MEMORY;
_ndr_info->flags= ndr->flags;
__r.in.type = r->out.type;
__r.out.data = r->out.data;
NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info, flags, &__r));
if (r->in.offered > _ndr_info->offset) {
uint32_t _padding_len = r->in.offered - _ndr_info->offset;
NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
}
_r.out.data = ndr_push_blob(_ndr_info);
}
NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
}
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r)
{
struct _spoolss_GetPrinterData _r;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
_r.in.handle = r->in.handle;
_r.in.value_name= r->in.value_name;
_r.in.offered = r->in.offered;
_r.out.type = r->out.type;
_r.out.data = data_blob(NULL,0),
_r.out.needed = r->out.needed;
NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
r->in.handle = _r.in.handle;
r->in.value_name= _r.in.value_name;
r->in.offered = _r.in.offered;
r->out.needed = _r.out.needed;
}
if (flags & NDR_OUT) {
_r.in.handle = r->in.handle;
_r.in.value_name= r->in.value_name;
_r.in.offered = r->in.offered;
_r.out.type = r->out.type;
_r.out.data = data_blob(NULL,0),
_r.out.needed = r->out.needed;
_r.out.result = r->out.result;
NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
r->out.type = _r.out.type;
ZERO_STRUCT(r->out.data);
r->out.needed = _r.out.needed;
r->out.result = _r.out.result;
if (_r.out.data.length != r->in.offered) {
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
"SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]",\
(unsigned)r->in.offered, (unsigned)_r.out.data.length);\
}
if (_r.out.data.length > 0 && r->out.needed <= _r.out.data.length) {
struct __spoolss_GetPrinterData __r;
struct ndr_pull *_ndr_data = ndr_pull_init_blob(&_r.out.data, ndr);
if (!_ndr_data) return NT_STATUS_NO_MEMORY;
_ndr_data->flags= ndr->flags;
__r.in.type = r->out.type;
__r.out.data = r->out.data;
NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, flags, &__r));
r->out.data = __r.out.data;
} else {
r->out.type = SPOOLSS_PRINTER_DATA_TYPE_NULL;
}
}
return NT_STATUS_OK;
}
/*
spoolss_SetPrinterData
*/
NTSTATUS ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r)
{
struct _spoolss_SetPrinterData _r;
if (flags & NDR_IN) {
struct ndr_push *_ndr_data;
struct __spoolss_SetPrinterData __r;
DATA_BLOB _data_blob_data;
_ndr_data = ndr_push_init_ctx(ndr);\
if (!_ndr_data) return NT_STATUS_NO_MEMORY;\
_ndr_data->flags= ndr->flags;\
__r.in.type = r->in.type;
__r.out.data = r->in.data;
NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r));
_data_blob_data = ndr_push_blob(_ndr_data);
_r.in.handle = r->in.handle;
_r.in.value_name= r->in.value_name;
_r.in.type = r->in.type;
_r.in.data = _data_blob_data;
_r.in._offered = _data_blob_data.length;
_r.out.result = r->out.result;
NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
}
if (flags & NDR_OUT) {
_r.in.handle = r->in.handle;
_r.in.value_name= r->in.value_name;
_r.in.type = r->in.type;
_r.in.data = data_blob(NULL,0),
_r.in._offered = r->in._offered;
_r.out.result = r->out.result;
NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
}
return NT_STATUS_OK;
}
uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, uint32_t flags)
{
if (!devmode) return 0;
return ndr_size_spoolss_DeviceMode(devmode,flags);
}
+622
View File
@@ -0,0 +1,622 @@
/*
Unix SMB/CIFS implementation.
routines for marshalling/unmarshalling string types
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 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.
*/
#include "includes.h"
#include "librpc/ndr/libndr.h"
/**
pull a general string from the wire
*/
_PUBLIC_ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
{
char *as=NULL;
uint32_t len1, ofs, len2;
uint16_t len3;
int ret;
int chset = CH_UTF16;
unsigned byte_mul = 2;
unsigned flags = ndr->flags;
unsigned c_len_term = 0;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
if (NDR_BE(ndr)) {
chset = CH_UTF16BE;
}
if (flags & LIBNDR_FLAG_STR_ASCII) {
chset = CH_DOS;
byte_mul = 1;
flags &= ~LIBNDR_FLAG_STR_ASCII;
}
if (flags & LIBNDR_FLAG_STR_UTF8) {
chset = CH_UTF8;
byte_mul = 1;
flags &= ~LIBNDR_FLAG_STR_UTF8;
}
flags &= ~LIBNDR_FLAG_STR_CONFORMANT;
if (flags & LIBNDR_FLAG_STR_CHARLEN) {
c_len_term = 1;
flags &= ~LIBNDR_FLAG_STR_CHARLEN;
}
switch (flags & LIBNDR_STRING_FLAGS) {
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ofs));
if (ofs != 0) {
return ndr_pull_error(ndr, NDR_ERR_STRING, "non-zero array offset with string flags 0x%x\n",
ndr->flags & LIBNDR_STRING_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",
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 {
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,
(len2 + c_len_term)*byte_mul,
(void **)&as);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
}
NDR_CHECK(ndr_pull_advance(ndr, (len2 + c_len_term)*byte_mul));
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;
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 {
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,
(len1 + c_len_term)*byte_mul,
(void **)&as);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
}
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;
break;
case LIBNDR_FLAG_STR_LEN4:
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM:
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ofs));
if (ofs != 0) {
return ndr_pull_error(ndr, NDR_ERR_STRING, "non-zero array offset with string flags 0x%x\n",
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 {
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,
(len1 + c_len_term)*byte_mul,
(void **)&as);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
}
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;
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 {
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,
(len3 + c_len_term)*byte_mul,
(void **)&as);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
}
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;
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 {
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,
len3,
(void **)&as);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
}
NDR_CHECK(ndr_pull_advance(ndr, len3));
*s = as;
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);
} else {
len1 = utf16_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset);
}
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,
len1,
(void **)&as);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
NDR_CHECK(ndr_pull_advance(ndr, len1));
*s = as;
break;
case LIBNDR_FLAG_STR_FIXLEN15:
case LIBNDR_FLAG_STR_FIXLEN32:
len1 = (flags & LIBNDR_FLAG_STR_FIXLEN32)?32:15;
NDR_PULL_NEED_BYTES(ndr, len1*byte_mul);
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,
len1*byte_mul,
(void **)&as);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
NDR_CHECK(ndr_pull_advance(ndr, len1*byte_mul));
*s = as;
break;
default:
return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
return NT_STATUS_OK;
}
/**
push a general string onto the wire
*/
_PUBLIC_ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
{
ssize_t s_len, c_len, d_len;
int chset = CH_UTF16;
unsigned flags = ndr->flags;
unsigned byte_mul = 2;
uint8_t *dest = NULL;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
if (NDR_BE(ndr)) {
chset = CH_UTF16BE;
}
s_len = s?strlen(s):0;
if (flags & LIBNDR_FLAG_STR_ASCII) {
chset = CH_DOS;
byte_mul = 1;
flags &= ~LIBNDR_FLAG_STR_ASCII;
}
if (flags & LIBNDR_FLAG_STR_UTF8) {
chset = CH_UTF8;
byte_mul = 1;
flags &= ~LIBNDR_FLAG_STR_UTF8;
}
flags &= ~LIBNDR_FLAG_STR_CONFORMANT;
if (!(flags &
(LIBNDR_FLAG_STR_NOTERM |
LIBNDR_FLAG_STR_FIXLEN15 |
LIBNDR_FLAG_STR_FIXLEN32))) {
s_len++;
}
d_len = convert_string_talloc(ndr, CH_UNIX, chset, s, s_len, (void **)&dest);
if (d_len == -1) {
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
if (flags & LIBNDR_FLAG_STR_BYTESIZE) {
c_len = d_len;
flags &= ~LIBNDR_FLAG_STR_BYTESIZE;
} else if (flags & LIBNDR_FLAG_STR_CHARLEN) {
c_len = (d_len / byte_mul)-1;
flags &= ~LIBNDR_FLAG_STR_CHARLEN;
} else {
c_len = d_len / byte_mul;
}
switch ((flags & LIBNDR_STRING_FLAGS) & ~LIBNDR_FLAG_STR_NOTERM) {
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
break;
case LIBNDR_FLAG_STR_LEN4:
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
break;
case LIBNDR_FLAG_STR_SIZE4:
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
break;
case LIBNDR_FLAG_STR_SIZE2:
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, c_len));
NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
break;
case LIBNDR_FLAG_STR_NULLTERM:
NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
break;
case LIBNDR_FLAG_STR_FIXLEN15:
case LIBNDR_FLAG_STR_FIXLEN32: {
ssize_t fix_len = (flags & LIBNDR_FLAG_STR_FIXLEN32)?32:15;
uint32_t pad_len = fix_len - d_len;
if (d_len > fix_len) {
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
if (pad_len != 0) {
NDR_CHECK(ndr_push_zero(ndr, pad_len));
}
break;
}
default:
return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
talloc_free(dest);
return NT_STATUS_OK;
}
/**
push a general string onto the wire
*/
_PUBLIC_ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s)
{
size_t c_len;
unsigned flags = ndr->flags;
unsigned byte_mul = 2;
unsigned c_len_term = 1;
if (flags & LIBNDR_FLAG_STR_FIXLEN32) {
return 32;
}
if (flags & LIBNDR_FLAG_STR_FIXLEN15) {
return 15;
}
c_len = s?strlen_m(s):0;
if (flags & (LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_UTF8)) {
byte_mul = 1;
}
if (flags & LIBNDR_FLAG_STR_NOTERM) {
c_len_term = 0;
}
c_len = c_len + c_len_term;
if (flags & LIBNDR_FLAG_STR_BYTESIZE) {
c_len = c_len * byte_mul;
}
return c_len;
}
_PUBLIC_ void ndr_print_string(struct ndr_print *ndr, const char *name, const char *s)
{
if (s) {
ndr->print(ndr, "%-25s: '%s'", name, s);
} else {
ndr->print(ndr, "%-25s: NULL", name);
}
}
_PUBLIC_ uint32_t ndr_size_string(int ret, const char * const* string, int flags)
{
/* FIXME: Is this correct for all strings ? */
if(!(*string)) return ret;
return ret+strlen(*string)+1;
}
/**
pull a general string array from the wire
*/
_PUBLIC_ NTSTATUS ndr_pull_string_array(struct ndr_pull *ndr, int ndr_flags, const char ***_a)
{
const char **a = *_a;
uint32_t count;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
for (count = 0;; count++) {
TALLOC_CTX *tmp_ctx;
const char *s = NULL;
a = talloc_realloc(ndr->current_mem_ctx, a, const char *, count + 2);
NT_STATUS_HAVE_NO_MEMORY(a);
a[count] = NULL;
a[count+1] = NULL;
tmp_ctx = ndr->current_mem_ctx;
ndr->current_mem_ctx = a;
NDR_CHECK(ndr_pull_string(ndr, ndr_flags, &s));
ndr->current_mem_ctx = tmp_ctx;
if (strcmp("", s)==0) {
a[count] = NULL;
break;
} else {
a[count] = s;
}
}
*_a =a;
return NT_STATUS_OK;
}
/**
push a general string array onto the wire
*/
_PUBLIC_ NTSTATUS ndr_push_string_array(struct ndr_push *ndr, int ndr_flags, const char **a)
{
uint32_t count;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
for (count = 0; a && a[count]; count++) {
NDR_CHECK(ndr_push_string(ndr, ndr_flags, a[count]));
}
NDR_CHECK(ndr_push_string(ndr, ndr_flags, ""));
return NT_STATUS_OK;
}
_PUBLIC_ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a)
{
uint32_t count;
uint32_t i;
for (count = 0; a && a[count]; count++) {}
ndr->print(ndr, "%s: ARRAY(%d)", name, count);
ndr->depth++;
for (i=0;i<count;i++) {
char *idx=NULL;
asprintf(&idx, "[%d]", i);
if (idx) {
ndr_print_string(ndr, idx, a[i]);
free(idx);
}
}
ndr->depth--;
}
/**
* Return number of elements in a string including the last (zeroed) element
*/
_PUBLIC_ uint32_t ndr_string_length(const void *_var, uint32_t element_size)
{
uint32_t i;
uint8_t zero[4] = {0,0,0,0};
const char *var = _var;
for (i = 0; memcmp(var+i*element_size,zero,element_size) != 0; i++);
return i+1;
}
_PUBLIC_ NTSTATUS ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size)
{
uint32_t i;
struct ndr_pull_save save_offset;
ndr_pull_save(ndr, &save_offset);
ndr_pull_advance(ndr, (count - 1) * element_size);
NDR_PULL_NEED_BYTES(ndr, element_size);
for (i = 0; i < element_size; i++) {
if (ndr->data[ndr->offset+i] != 0) {
ndr_pull_restore(ndr, &save_offset);
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "String terminator not present or outside string boundaries");
}
}
ndr_pull_restore(ndr, &save_offset);
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset)
{
int ret;
if (length == 0) {
*var = talloc_strdup(ndr->current_mem_ctx, "");
return NT_STATUS_OK;
}
if (NDR_BE(ndr) && chset == CH_UTF16) {
chset = CH_UTF16BE;
}
NDR_PULL_NEED_BYTES(ndr, length*byte_mul);
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,
length*byte_mul,
discard_const_p(void *, var));
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
NDR_CHECK(ndr_pull_advance(ndr, length*byte_mul));
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset)
{
ssize_t ret, required;
if (NDR_BE(ndr) && chset == CH_UTF16) {
chset = CH_UTF16BE;
}
required = byte_mul * length;
NDR_PUSH_NEED_BYTES(ndr, required);
ret = convert_string(CH_UNIX, chset,
var, strlen(var),
ndr->data+ndr->offset, required);
if (ret == -1) {
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
/* Make sure the remaining part of the string is filled with zeroes */
if (ret < required) {
memset(ndr->data+ndr->offset+ret, 0, required-ret);
}
ndr->offset += required;
return NT_STATUS_OK;
}
/* Return number of elements in a string in the specified charset */
_PUBLIC_ uint32_t ndr_charset_length(const void *var, charset_t chset)
{
/* FIXME: Treat special chars special here, taking chset into account */
/* Also include 0 byte */
return strlen(var)+1;
}
+150
View File
@@ -0,0 +1,150 @@
/*
Unix SMB/CIFS implementation.
UUID/GUID functions
Copyright (C) Theodore Ts'o 1996, 1997,
Copyright (C) Jim McDonough 2002.
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 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.
*/
#include "includes.h"
/**
build a GUID from a string
*/
_PUBLIC_ NTSTATUS GUID_from_string(const char *s, struct GUID *guid)
{
NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
uint32_t time_low;
uint32_t time_mid, time_hi_and_version;
uint32_t clock_seq[2];
uint32_t node[6];
int i;
if (s == NULL) {
return NT_STATUS_INVALID_PARAMETER;
}
if (11 == sscanf(s, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
&time_low, &time_mid, &time_hi_and_version,
&clock_seq[0], &clock_seq[1],
&node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) {
status = NT_STATUS_OK;
} else if (11 == sscanf(s, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
&time_low, &time_mid, &time_hi_and_version,
&clock_seq[0], &clock_seq[1],
&node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) {
status = NT_STATUS_OK;
}
if (!NT_STATUS_IS_OK(status)) {
return status;
}
guid->time_low = time_low;
guid->time_mid = time_mid;
guid->time_hi_and_version = time_hi_and_version;
guid->clock_seq[0] = clock_seq[0];
guid->clock_seq[1] = clock_seq[1];
for (i=0;i<6;i++) {
guid->node[i] = node[i];
}
return NT_STATUS_OK;
}
/**
* generate a random GUID
*/
struct GUID GUID_random(void)
{
struct GUID guid;
generate_random_buffer((uint8_t *)&guid, sizeof(guid));
guid.clock_seq[0] = (guid.clock_seq[0] & 0x3F) | 0x80;
guid.time_hi_and_version = (guid.time_hi_and_version & 0x0FFF) | 0x4000;
return guid;
}
/**
* generate an empty GUID
*/
_PUBLIC_ struct GUID GUID_zero(void)
{
struct GUID guid;
ZERO_STRUCT(guid);
return guid;
}
_PUBLIC_ BOOL GUID_all_zero(const struct GUID *u)
{
if (u->time_low != 0 ||
u->time_mid != 0 ||
u->time_hi_and_version != 0 ||
u->clock_seq[0] != 0 ||
u->clock_seq[1] != 0 ||
!all_zero(u->node, 6)) {
return False;
}
return True;
}
_PUBLIC_ BOOL GUID_equal(const struct GUID *u1, const struct GUID *u2)
{
if (u1->time_low != u2->time_low ||
u1->time_mid != u2->time_mid ||
u1->time_hi_and_version != u2->time_hi_and_version ||
u1->clock_seq[0] != u2->clock_seq[0] ||
u1->clock_seq[1] != u2->clock_seq[1] ||
memcmp(u1->node, u2->node, 6) != 0) {
return False;
}
return True;
}
/**
its useful to be able to display these in debugging messages
*/
_PUBLIC_ char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid)
{
return talloc_asprintf(mem_ctx,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
guid->time_low, guid->time_mid,
guid->time_hi_and_version,
guid->clock_seq[0],
guid->clock_seq[1],
guid->node[0], guid->node[1],
guid->node[2], guid->node[3],
guid->node[4], guid->node[5]);
}
_PUBLIC_ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid)
{
char *ret, *s = GUID_string(mem_ctx, guid);
ret = talloc_asprintf(mem_ctx, "{%s}", s);
talloc_free(s);
return ret;
}
_PUBLIC_ BOOL policy_handle_empty(struct policy_handle *h)
{
return (h->handle_type == 0 && GUID_all_zero(&h->uuid));
}
File diff suppressed because it is too large Load Diff
+263
View File
@@ -0,0 +1,263 @@
/*
Unix SMB/CIFS implementation.
DCERPC client side interface structures
Copyright (C) Tim Potter 2003
Copyright (C) Andrew Tridgell 2003-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 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.
*/
#ifndef __DCERPC_H__
#define __DCERPC_H__
#include "core.h"
#include "librpc/gen_ndr/dcerpc.h"
#include "librpc/ndr/libndr.h"
enum dcerpc_transport_t {
NCACN_NP, NCACN_IP_TCP, NCACN_IP_UDP, NCACN_VNS_IPC, NCACN_VNS_SPP,
NCACN_AT_DSP, NCADG_AT_DDP, NCALRPC, NCACN_UNIX_STREAM, NCADG_UNIX_DGRAM,
NCACN_HTTP, NCADG_IPX, NCACN_SPX };
/*
this defines a generic security context for signed/sealed dcerpc pipes.
*/
struct dcerpc_connection;
struct dcerpc_security {
struct dcerpc_auth *auth_info;
struct gensec_security *generic_state;
/* get the session key */
NTSTATUS (*session_key)(struct dcerpc_connection *, DATA_BLOB *);
};
/*
this holds the information that is not specific to a particular rpc context_id
*/
struct dcerpc_connection {
uint32_t call_id;
uint32_t srv_max_xmit_frag;
uint32_t srv_max_recv_frag;
uint32_t flags;
struct dcerpc_security security_state;
const char *binding_string;
struct event_context *event_ctx;
struct dcerpc_transport {
enum dcerpc_transport_t transport;
void *private;
NTSTATUS (*shutdown_pipe)(struct dcerpc_connection *);
const char *(*peer_name)(struct dcerpc_connection *);
const char *(*target_hostname)(struct dcerpc_connection *);
/* send a request to the server */
NTSTATUS (*send_request)(struct dcerpc_connection *, DATA_BLOB *, BOOL trigger_read);
/* send a read request to the server */
NTSTATUS (*send_read)(struct dcerpc_connection *);
/* a callback to the dcerpc code when a full fragment
has been received */
void (*recv_data)(struct dcerpc_connection *, DATA_BLOB *, NTSTATUS status);
} transport;
/* Requests that have been sent, waiting for a reply */
struct rpc_request *pending;
/* Sync requests waiting to be shipped */
struct rpc_request *request_queue;
/* the next context_id to be assigned */
uint32_t next_context_id;
};
/*
this encapsulates a full dcerpc client side pipe
*/
struct dcerpc_pipe {
uint32_t context_id;
struct dcerpc_syntax_id syntax;
struct dcerpc_syntax_id transfer_syntax;
struct dcerpc_connection *conn;
struct dcerpc_binding *binding;
/* the last fault code from a DCERPC fault */
uint32_t last_fault_code;
/* timeout for individual rpc requests, in seconds */
uint32_t request_timeout;
};
/* default timeout for all rpc requests, in seconds */
#define DCERPC_REQUEST_TIMEOUT 60
/* dcerpc pipe flags */
#define DCERPC_DEBUG_PRINT_IN (1<<0)
#define DCERPC_DEBUG_PRINT_OUT (1<<1)
#define DCERPC_DEBUG_PRINT_BOTH (DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT)
#define DCERPC_DEBUG_VALIDATE_IN (1<<2)
#define DCERPC_DEBUG_VALIDATE_OUT (1<<3)
#define DCERPC_DEBUG_VALIDATE_BOTH (DCERPC_DEBUG_VALIDATE_IN | DCERPC_DEBUG_VALIDATE_OUT)
#define DCERPC_CONNECT (1<<4)
#define DCERPC_SIGN (1<<5)
#define DCERPC_SEAL (1<<6)
#define DCERPC_PUSH_BIGENDIAN (1<<7)
#define DCERPC_PULL_BIGENDIAN (1<<8)
#define DCERPC_SCHANNEL (1<<9)
/* use a 128 bit session key */
#define DCERPC_SCHANNEL_128 (1<<12)
/* check incoming pad bytes */
#define DCERPC_DEBUG_PAD_CHECK (1<<13)
/* set LIBNDR_FLAG_REF_ALLOC flag when decoding NDR */
#define DCERPC_NDR_REF_ALLOC (1<<14)
#define DCERPC_AUTH_OPTIONS (DCERPC_SEAL|DCERPC_SIGN|DCERPC_SCHANNEL|DCERPC_AUTH_SPNEGO|DCERPC_AUTH_KRB5|DCERPC_AUTH_NTLM)
/* select spnego auth */
#define DCERPC_AUTH_SPNEGO (1<<15)
/* select krb5 auth */
#define DCERPC_AUTH_KRB5 (1<<16)
#define DCERPC_SMB2 (1<<17)
/* select NTLM auth */
#define DCERPC_AUTH_NTLM (1<<18)
/*
this is used to find pointers to calls
*/
struct dcerpc_interface_call {
const char *name;
size_t struct_size;
ndr_push_flags_fn_t ndr_push;
ndr_pull_flags_fn_t ndr_pull;
ndr_print_function_t ndr_print;
BOOL async;
};
struct dcerpc_endpoint_list {
uint32_t count;
const char * const *names;
};
struct dcerpc_authservice_list {
uint32_t count;
const char * const *names;
};
struct dcerpc_interface_table {
const char *name;
struct dcerpc_syntax_id syntax_id;
const char *helpstring;
uint32_t num_calls;
const struct dcerpc_interface_call *calls;
const struct dcerpc_endpoint_list *endpoints;
const struct dcerpc_authservice_list *authservices;
};
struct dcerpc_interface_list {
struct dcerpc_interface_list *prev, *next;
const struct dcerpc_interface_table *table;
};
/* this describes a binding to a particular transport/pipe */
struct dcerpc_binding {
enum dcerpc_transport_t transport;
struct dcerpc_syntax_id object;
const char *host;
const char *target_hostname;
const char *endpoint;
const char **options;
uint32_t flags;
};
struct dcerpc_pipe_connect {
struct dcerpc_pipe *pipe;
struct dcerpc_binding *binding;
const char *pipe_name;
const struct dcerpc_interface_table *interface;
struct cli_credentials *creds;
};
enum rpc_request_state {
RPC_REQUEST_PENDING,
RPC_REQUEST_DONE
};
/*
handle for an async dcerpc request
*/
struct rpc_request {
struct rpc_request *next, *prev;
struct dcerpc_pipe *p;
NTSTATUS status;
uint32_t call_id;
enum rpc_request_state state;
DATA_BLOB payload;
uint32_t flags;
uint32_t fault_code;
/* this is used to distinguish bind and alter_context requests
from normal requests */
void (*recv_handler)(struct rpc_request *conn,
DATA_BLOB *blob, struct ncacn_packet *pkt);
const struct GUID *object;
uint16_t opnum;
DATA_BLOB request_data;
BOOL async_call;
/* use by the ndr level async recv call */
struct {
const struct dcerpc_interface_table *table;
uint32_t opnum;
void *struct_ptr;
TALLOC_CTX *mem_ctx;
} ndr;
struct {
void (*callback)(struct rpc_request *);
void *private;
} async;
};
struct epm_tower;
struct epm_floor;
struct smbcli_tree;
struct smb2_tree;
struct socket_address;
#include "librpc/rpc/dcerpc_proto.h"
#endif /* __DCERPC_H__ */
+383
View File
@@ -0,0 +1,383 @@
/*
Unix SMB/CIFS implementation.
Generic Authentication Interface
Copyright (C) Andrew Tridgell 2003
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2005
Copyright (C) Stefan Metzmacher 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.
*/
#include "includes.h"
#include "libcli/composite/composite.h"
#include "auth/gensec/gensec.h"
#include "librpc/rpc/dcerpc.h"
/*
return the rpc syntax and transfer syntax given the pipe uuid and version
*/
static NTSTATUS dcerpc_init_syntaxes(const struct dcerpc_interface_table *table,
struct dcerpc_syntax_id *syntax,
struct dcerpc_syntax_id *transfer_syntax)
{
syntax->uuid = table->syntax_id.uuid;
syntax->if_version = table->syntax_id.if_version;
*transfer_syntax = ndr_transfer_syntax;
return NT_STATUS_OK;
}
/*
Send request to do a non-authenticated dcerpc bind
*/
struct composite_context *dcerpc_bind_auth_none_send(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p,
const struct dcerpc_interface_table *table)
{
struct dcerpc_syntax_id syntax;
struct dcerpc_syntax_id transfer_syntax;
struct composite_context *c;
c = composite_create(mem_ctx, p->conn->event_ctx);
if (c == NULL) return NULL;
c->status = dcerpc_init_syntaxes(table,
&syntax, &transfer_syntax);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(2,("Invalid uuid string in "
"dcerpc_bind_auth_none_send\n"));
composite_error(c, c->status);
return c;
}
/* c was only allocated as a container for a possible error */
talloc_free(c);
return dcerpc_bind_send(p, mem_ctx, &syntax, &transfer_syntax);
}
/*
Receive result of a non-authenticated dcerpc bind
*/
NTSTATUS dcerpc_bind_auth_none_recv(struct composite_context *ctx)
{
return dcerpc_bind_recv(ctx);
}
/*
Perform sync non-authenticated dcerpc bind
*/
NTSTATUS dcerpc_bind_auth_none(struct dcerpc_pipe *p,
const struct dcerpc_interface_table *table)
{
struct composite_context *ctx;
ctx = dcerpc_bind_auth_none_send(p, p, table);
return dcerpc_bind_auth_none_recv(ctx);
}
struct bind_auth_state {
struct dcerpc_pipe *pipe;
DATA_BLOB credentials;
BOOL more_processing; /* Is there anything more to do after the
* first bind itself received? */
};
static void bind_auth_recv_alter(struct composite_context *creq);
static void bind_auth_next_step(struct composite_context *c)
{
struct bind_auth_state *state;
struct dcerpc_security *sec;
struct composite_context *creq;
BOOL more_processing = False;
state = talloc_get_type(c->private_data, struct bind_auth_state);
sec = &state->pipe->conn->security_state;
/* The status value here, from GENSEC is vital to the security
* of the system. Even if the other end accepts, if GENSEC
* claims 'MORE_PROCESSING_REQUIRED' then you must keep
* feeding it blobs, or else the remote host/attacker might
* avoid mutal authentication requirements.
*
* Likewise, you must not feed GENSEC too much (after the OK),
* it doesn't like that either
*/
c->status = gensec_update(sec->generic_state, state,
sec->auth_info->credentials,
&state->credentials);
if (NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
more_processing = True;
c->status = NT_STATUS_OK;
}
if (!composite_is_ok(c)) return;
if (state->credentials.length == 0) {
composite_done(c);
return;
}
sec->auth_info->credentials = state->credentials;
if (!more_processing) {
/* NO reply expected, so just send it */
c->status = dcerpc_auth3(state->pipe->conn, state);
if (!composite_is_ok(c)) return;
composite_done(c);
return;
}
/* We are demanding a reply, so use a request that will get us one */
creq = dcerpc_alter_context_send(state->pipe, state,
&state->pipe->syntax,
&state->pipe->transfer_syntax);
if (composite_nomem(creq, c)) return;
composite_continue(c, creq, bind_auth_recv_alter, c);
}
static void bind_auth_recv_alter(struct composite_context *creq)
{
struct composite_context *c = talloc_get_type(creq->async.private_data,
struct composite_context);
c->status = dcerpc_alter_context_recv(creq);
if (!composite_is_ok(c)) return;
bind_auth_next_step(c);
}
static void bind_auth_recv_bindreply(struct composite_context *creq)
{
struct composite_context *c = talloc_get_type(creq->async.private_data,
struct composite_context);
struct bind_auth_state *state = talloc_get_type(c->private_data,
struct bind_auth_state);
c->status = dcerpc_bind_recv(creq);
if (!composite_is_ok(c)) return;
if (!state->more_processing) {
/* The first gensec_update has not requested a second run, so
* we're done here. */
composite_done(c);
return;
}
bind_auth_next_step(c);
}
/**
Bind to a DCE/RPC pipe, send async request
@param mem_ctx TALLOC_CTX for the allocation of the composite_context
@param p The dcerpc_pipe to bind (must already be connected)
@param table The interface table to use (the DCE/RPC bind both selects and interface and authenticates)
@param credentials The credentials of the account to connect with
@param auth_type Select the authentication scheme to use
@param auth_level Chooses between unprotected (connect), signed or sealed
@param service The service (used by Kerberos to select the service principal to contact)
@retval A composite context describing the partial state of the bind
*/
struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p,
const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
uint8_t auth_type, uint8_t auth_level,
const char *service)
{
struct composite_context *c, *creq;
struct bind_auth_state *state;
struct dcerpc_security *sec;
struct dcerpc_syntax_id syntax, transfer_syntax;
/* composite context allocation and setup */
c = composite_create(mem_ctx, p->conn->event_ctx);
if (c == NULL) return NULL;
state = talloc(c, struct bind_auth_state);
if (composite_nomem(state, c)) return c;
c->private_data = state;
state->pipe = p;
c->status = dcerpc_init_syntaxes(table,
&syntax,
&transfer_syntax);
if (!composite_is_ok(c)) return c;
sec = &p->conn->security_state;
c->status = gensec_client_start(p, &sec->generic_state,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(1, ("Failed to start GENSEC client mode: %s\n",
nt_errstr(c->status)));
composite_error(c, c->status);
return c;
}
c->status = gensec_set_credentials(sec->generic_state, credentials);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(1, ("Failed to set GENSEC client credentails: %s\n",
nt_errstr(c->status)));
composite_error(c, c->status);
return c;
}
c->status = gensec_set_target_hostname(sec->generic_state,
p->conn->transport.target_hostname(p->conn));
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(1, ("Failed to set GENSEC target hostname: %s\n",
nt_errstr(c->status)));
composite_error(c, c->status);
return c;
}
if (service != NULL) {
c->status = gensec_set_target_service(sec->generic_state,
service);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(1, ("Failed to set GENSEC target service: %s\n",
nt_errstr(c->status)));
composite_error(c, c->status);
return c;
}
}
c->status = gensec_start_mech_by_authtype(sec->generic_state,
auth_type, auth_level);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(1, ("Failed to start GENSEC client mechanism %s: %s\n",
gensec_get_name_by_authtype(auth_type),
nt_errstr(c->status)));
composite_error(c, c->status);
return c;
}
sec->auth_info = talloc(p, struct dcerpc_auth);
if (composite_nomem(sec->auth_info, c)) return c;
sec->auth_info->auth_type = auth_type;
sec->auth_info->auth_level = auth_level,
sec->auth_info->auth_pad_length = 0;
sec->auth_info->auth_reserved = 0;
sec->auth_info->auth_context_id = random();
sec->auth_info->credentials = data_blob(NULL, 0);
/* The status value here, from GENSEC is vital to the security
* of the system. Even if the other end accepts, if GENSEC
* claims 'MORE_PROCESSING_REQUIRED' then you must keep
* feeding it blobs, or else the remote host/attacker might
* avoid mutal authentication requirements.
*
* Likewise, you must not feed GENSEC too much (after the OK),
* it doesn't like that either
*/
c->status = gensec_update(sec->generic_state, state,
sec->auth_info->credentials,
&state->credentials);
if (!NT_STATUS_IS_OK(c->status) &&
!NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
composite_error(c, c->status);
return c;
}
state->more_processing = NT_STATUS_EQUAL(c->status,
NT_STATUS_MORE_PROCESSING_REQUIRED);
if (state->credentials.length == 0) {
composite_done(c);
return c;
}
sec->auth_info->credentials = state->credentials;
/* The first request always is a dcerpc_bind. The subsequent ones
* depend on gensec results */
creq = dcerpc_bind_send(p, state, &syntax, &transfer_syntax);
if (composite_nomem(creq, c)) return c;
composite_continue(c, creq, bind_auth_recv_bindreply, c);
return c;
}
/**
Bind to a DCE/RPC pipe, receive result
@param creq A composite context describing state of async call
@retval NTSTATUS code
*/
NTSTATUS dcerpc_bind_auth_recv(struct composite_context *creq)
{
NTSTATUS result = composite_wait(creq);
struct bind_auth_state *state = talloc_get_type(creq->private_data,
struct bind_auth_state);
if (NT_STATUS_IS_OK(result)) {
/*
after a successful authenticated bind the session
key reverts to the generic session key
*/
state->pipe->conn->security_state.session_key = dcerpc_generic_session_key;
}
talloc_free(creq);
return result;
}
/**
Perform a GENSEC authenticated bind to a DCE/RPC pipe, sync
@param p The dcerpc_pipe to bind (must already be connected)
@param table The interface table to use (the DCE/RPC bind both selects and interface and authenticates)
@param credentials The credentials of the account to connect with
@param auth_type Select the authentication scheme to use
@param auth_level Chooses between unprotected (connect), signed or sealed
@param service The service (used by Kerberos to select the service principal to contact)
@retval NTSTATUS status code
*/
NTSTATUS dcerpc_bind_auth(struct dcerpc_pipe *p,
const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
uint8_t auth_type, uint8_t auth_level,
const char *service)
{
struct composite_context *creq;
creq = dcerpc_bind_auth_send(p, p, table, credentials,
auth_type, auth_level, service);
return dcerpc_bind_auth_recv(creq);
}
File diff suppressed because it is too large Load Diff
+56
View File
@@ -0,0 +1,56 @@
/*
Unix SMB/CIFS implementation.
dcerpc fault functions
Copyright (C) Stefan Metzmacher 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.
*/
#include "includes.h"
#include "librpc/rpc/dcerpc.h"
struct dcerpc_fault_table {
const char *errstr;
uint32_t faultcode;
};
static const struct dcerpc_fault_table dcerpc_faults[] =
{
{ "DCERPC_FAULT_OP_RNG_ERROR", DCERPC_FAULT_OP_RNG_ERROR },
{ "DCERPC_FAULT_UNK_IF", DCERPC_FAULT_UNK_IF },
{ "DCERPC_FAULT_NDR", DCERPC_FAULT_NDR },
{ "DCERPC_FAULT_INVALID_TAG", DCERPC_FAULT_INVALID_TAG },
{ "DCERPC_FAULT_CONTEXT_MISMATCH", DCERPC_FAULT_CONTEXT_MISMATCH },
{ "DCERPC_FAULT_OTHER", DCERPC_FAULT_OTHER },
{ "DCERPC_FAULT_ACCESS_DENIED", DCERPC_FAULT_ACCESS_DENIED },
{ NULL, 0}
};
const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code)
{
int idx = 0;
while (dcerpc_faults[idx].errstr != NULL) {
if (dcerpc_faults[idx].faultcode == fault_code) {
return dcerpc_faults[idx].errstr;
}
idx++;
}
return talloc_asprintf(mem_ctx, "DCERPC fault 0x%08x", fault_code);
}
+405
View File
@@ -0,0 +1,405 @@
/*
Unix SMB/CIFS implementation.
dcerpc schannel operations
Copyright (C) Andrew Tridgell 2004
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2005
Copyright (C) Rafal Szczesniak 2006
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.
*/
#include "includes.h"
#include "auth/auth.h"
#include "libcli/composite/composite.h"
#include "libcli/auth/libcli_auth.h"
#include "librpc/gen_ndr/ndr_netlogon.h"
#include "librpc/gen_ndr/ndr_netlogon_c.h"
#include "auth/credentials/credentials.h"
struct schannel_key_state {
struct dcerpc_pipe *pipe;
struct dcerpc_pipe *pipe2;
struct dcerpc_binding *binding;
struct cli_credentials *credentials;
struct creds_CredentialState *creds;
uint32_t negotiate_flags;
struct netr_Credential credentials1;
struct netr_Credential credentials2;
struct netr_Credential credentials3;
struct netr_ServerReqChallenge r;
struct netr_ServerAuthenticate2 a;
const struct samr_Password *mach_pwd;
};
static void continue_secondary_connection(struct composite_context *ctx);
static void continue_bind_auth_none(struct composite_context *ctx);
static void continue_srv_challenge(struct rpc_request *req);
static void continue_srv_auth2(struct rpc_request *req);
/*
Stage 2 of schannel_key: Receive endpoint mapping and request secondary
rpc connection
*/
static void continue_epm_map_binding(struct composite_context *ctx)
{
struct composite_context *c;
struct schannel_key_state *s;
struct composite_context *sec_conn_req;
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct schannel_key_state);
/* receive endpoint mapping */
c->status = dcerpc_epm_map_binding_recv(ctx);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n",
DCERPC_NETLOGON_UUID, nt_errstr(c->status)));
composite_error(c, c->status);
return;
}
/* send a request for secondary rpc connection */
sec_conn_req = dcerpc_secondary_connection_send(s->pipe,
s->binding);
if (composite_nomem(sec_conn_req, c)) return;
composite_continue(c, sec_conn_req, continue_secondary_connection, c);
}
/*
Stage 3 of schannel_key: Receive secondary rpc connection and perform
non-authenticated bind request
*/
static void continue_secondary_connection(struct composite_context *ctx)
{
struct composite_context *c;
struct schannel_key_state *s;
struct composite_context *auth_none_req;
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct schannel_key_state);
/* receive secondary rpc connection */
c->status = dcerpc_secondary_connection_recv(ctx, &s->pipe2);
if (!composite_is_ok(c)) return;
talloc_steal(s, s->pipe2);
/* initiate a non-authenticated bind */
auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe2, &dcerpc_table_netlogon);
if (composite_nomem(auth_none_req, c)) return;
composite_continue(c, auth_none_req, continue_bind_auth_none, c);
}
/*
Stage 4 of schannel_key: Receive non-authenticated bind and get
a netlogon challenge
*/
static void continue_bind_auth_none(struct composite_context *ctx)
{
struct composite_context *c;
struct schannel_key_state *s;
struct rpc_request *srv_challenge_req;
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct schannel_key_state);
/* receive result of non-authenticated bind request */
c->status = dcerpc_bind_auth_none_recv(ctx);
if (!composite_is_ok(c)) return;
/* prepare a challenge request */
s->r.in.server_name = talloc_asprintf(c, "\\\\%s", dcerpc_server_name(s->pipe));
if (composite_nomem(s->r.in.server_name, c)) return;
s->r.in.computer_name = cli_credentials_get_workstation(s->credentials);
s->r.in.credentials = &s->credentials1;
s->r.out.credentials = &s->credentials2;
generate_random_buffer(s->credentials1.data, sizeof(s->credentials1.data));
/*
request a netlogon challenge - a rpc request over opened secondary pipe
*/
srv_challenge_req = dcerpc_netr_ServerReqChallenge_send(s->pipe2, c, &s->r);
if (composite_nomem(srv_challenge_req, c)) return;
composite_continue_rpc(c, srv_challenge_req, continue_srv_challenge, c);
}
/*
Stage 5 of schannel_key: Receive a challenge and perform authentication
on the netlogon pipe
*/
static void continue_srv_challenge(struct rpc_request *req)
{
struct composite_context *c;
struct schannel_key_state *s;
struct rpc_request *srv_auth2_req;
c = talloc_get_type(req->async.private, struct composite_context);
s = talloc_get_type(c->private_data, struct schannel_key_state);
/* receive rpc request result - netlogon challenge */
c->status = dcerpc_ndr_request_recv(req);
if (!composite_is_ok(c)) return;
/* prepare credentials for auth2 request */
s->mach_pwd = cli_credentials_get_nt_hash(s->credentials, c);
creds_client_init(s->creds, &s->credentials1, &s->credentials2,
s->mach_pwd, &s->credentials3, s->negotiate_flags);
/* auth2 request arguments */
s->a.in.server_name = s->r.in.server_name;
s->a.in.account_name = cli_credentials_get_username(s->credentials);
s->a.in.secure_channel_type =
cli_credentials_get_secure_channel_type(s->credentials);
s->a.in.computer_name = cli_credentials_get_workstation(s->credentials);
s->a.in.negotiate_flags = &s->negotiate_flags;
s->a.in.credentials = &s->credentials3;
s->a.out.negotiate_flags = &s->negotiate_flags;
s->a.out.credentials = &s->credentials3;
/*
authenticate on the netlogon pipe - a rpc request over secondary pipe
*/
srv_auth2_req = dcerpc_netr_ServerAuthenticate2_send(s->pipe2, c, &s->a);
if (composite_nomem(srv_auth2_req, c)) return;
composite_continue_rpc(c, srv_auth2_req, continue_srv_auth2, c);
}
/*
Stage 6 of schannel_key: Receive authentication request result and verify
received credentials
*/
static void continue_srv_auth2(struct rpc_request *req)
{
struct composite_context *c;
struct schannel_key_state *s;
c = talloc_get_type(req->async.private, struct composite_context);
s = talloc_get_type(c->private_data, struct schannel_key_state);
/* receive rpc request result - auth2 credentials */
c->status = dcerpc_ndr_request_recv(req);
if (!composite_is_ok(c)) return;
/* verify credentials */
if (!creds_client_check(s->creds, s->a.out.credentials)) {
composite_error(c, NT_STATUS_UNSUCCESSFUL);
return;
}
/* setup current netlogon credentials */
cli_credentials_set_netlogon_creds(s->credentials, s->creds);
composite_done(c);
}
/*
Initiate establishing a schannel key using netlogon challenge
on a secondary pipe
*/
struct composite_context *dcerpc_schannel_key_send(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p,
struct cli_credentials *credentials)
{
struct composite_context *c;
struct schannel_key_state *s;
struct composite_context *epm_map_req;
/* composite context allocation and setup */
c = composite_create(mem_ctx, p->conn->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct schannel_key_state);
if (composite_nomem(s, c)) return c;
c->private_data = s;
/* store parameters in the state structure */
s->pipe = p;
s->credentials = credentials;
/* allocate credentials */
s->creds = talloc(c, struct creds_CredentialState);
if (composite_nomem(s->creds, c)) return c;
/* type of authentication depends on schannel type */
if (s->pipe->conn->flags & DCERPC_SCHANNEL_128) {
s->negotiate_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
} else {
s->negotiate_flags = NETLOGON_NEG_AUTH2_FLAGS;
}
/* allocate binding structure */
s->binding = talloc(c, struct dcerpc_binding);
if (composite_nomem(s->binding, c)) return c;
*s->binding = *s->pipe->binding;
/* request the netlogon endpoint mapping */
epm_map_req = dcerpc_epm_map_binding_send(c, s->binding,
&dcerpc_table_netlogon,
s->pipe->conn->event_ctx);
if (composite_nomem(epm_map_req, c)) return c;
composite_continue(c, epm_map_req, continue_epm_map_binding, c);
return c;
}
/*
Receive result of schannel key request
*/
NTSTATUS dcerpc_schannel_key_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
talloc_free(c);
return status;
}
struct auth_schannel_state {
struct dcerpc_pipe *pipe;
struct cli_credentials *credentials;
const struct dcerpc_interface_table *table;
uint8_t auth_level;
};
static void continue_bind_auth(struct composite_context *ctx);
/*
Stage 2 of auth_schannel: Receive schannel key and intitiate an
authenticated bind using received credentials
*/
static void continue_schannel_key(struct composite_context *ctx)
{
struct composite_context *auth_req;
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
struct auth_schannel_state *s = talloc_get_type(c->private_data,
struct auth_schannel_state);
/* receive schannel key */
c->status = dcerpc_schannel_key_recv(ctx);
if (!composite_is_ok(c)) {
DEBUG(1, ("Failed to setup credentials for account %s: %s\n",
cli_credentials_get_username(s->credentials), nt_errstr(c->status)));
return;
}
/* send bind auth request with received creds */
auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table, s->credentials,
DCERPC_AUTH_TYPE_SCHANNEL, s->auth_level,
NULL);
if (composite_nomem(auth_req, c)) return;
composite_continue(c, auth_req, continue_bind_auth, c);
}
/*
Stage 3 of auth_schannel: Receivce result of authenticated bind
and say if we're done ok.
*/
static void continue_bind_auth(struct composite_context *ctx)
{
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
c->status = dcerpc_bind_auth_recv(ctx);
if (!composite_is_ok(c)) return;
composite_done(c);
}
/*
Initiate schannel authentication request
*/
struct composite_context *dcerpc_bind_auth_schannel_send(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
uint8_t auth_level)
{
struct composite_context *c;
struct auth_schannel_state *s;
struct composite_context *schan_key_req;
/* composite context allocation and setup */
c = composite_create(tmp_ctx, p->conn->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct auth_schannel_state);
if (composite_nomem(s, c)) return c;
c->private_data = s;
/* store parameters in the state structure */
s->pipe = p;
s->credentials = credentials;
s->table = table;
s->auth_level = auth_level;
/* start getting schannel key first */
schan_key_req = dcerpc_schannel_key_send(c, p, credentials);
if (composite_nomem(schan_key_req, c)) return c;
composite_continue(c, schan_key_req, continue_schannel_key, c);
return c;
}
/*
Receive result of schannel authentication request
*/
NTSTATUS dcerpc_bind_auth_schannel_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
talloc_free(c);
return status;
}
/*
Perform schannel authenticated bind - sync version
*/
NTSTATUS dcerpc_bind_auth_schannel(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
uint8_t auth_level)
{
struct composite_context *c;
c = dcerpc_bind_auth_schannel_send(tmp_ctx, p, table, credentials,
auth_level);
return dcerpc_bind_auth_schannel_recv(c);
}
+582
View File
@@ -0,0 +1,582 @@
/*
Unix SMB/CIFS implementation.
dcerpc over SMB transport
Copyright (C) Tim Potter 2003
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 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.
*/
#include "includes.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/composite/composite.h"
#include "librpc/rpc/dcerpc.h"
/* transport private information used by SMB pipe transport */
struct smb_private {
uint16_t fnum;
struct smbcli_tree *tree;
const char *server_name;
};
/*
tell the dcerpc layer that the transport is dead
*/
static void pipe_dead(struct dcerpc_connection *c, NTSTATUS status)
{
DEBUG_FN_ENTER;
c->transport.recv_data(c, NULL, status);
DEBUG_FN_EXIT;
}
/*
this holds the state of an in-flight call
*/
struct smb_read_state {
struct dcerpc_connection *c;
struct smbcli_request *req;
size_t received;
DATA_BLOB data;
union smb_read *io;
};
/*
called when a read request has completed
*/
static void smb_read_callback(struct smbcli_request *req)
{
DEBUG_FN_ENTER;
struct smb_private *smb;
struct smb_read_state *state;
union smb_read *io;
uint16_t frag_length;
NTSTATUS status;
state = talloc_get_type(req->async.private, struct smb_read_state);
smb = talloc_get_type(state->c->transport.private, struct smb_private);
io = state->io;
status = smb_raw_read_recv(state->req, io);
if (NT_STATUS_IS_ERR(status)) {
talloc_steal(NULL, state);
pipe_dead(state->c, status);
talloc_free(state);
return;
}
state->received += io->readx.out.nread;
if (state->received < 16) {
DEBUG(0,("dcerpc_smb: short packet (length %d) in read callback!\n",
(int)state->received));
talloc_steal(NULL, state);
pipe_dead(state->c, NT_STATUS_INFO_LENGTH_MISMATCH);
talloc_free(state);
return;
}
frag_length = dcerpc_get_frag_length(&state->data);
if (frag_length <= state->received) {
DATA_BLOB data = state->data;
struct dcerpc_connection *c = state->c;
data.length = state->received;
talloc_steal(state->c, data.data);
talloc_free(state);
c->transport.recv_data(c, &data, NT_STATUS_OK);
return;
}
/* initiate another read request, as we only got part of a fragment */
state->data.data = talloc_realloc(state, state->data.data, uint8_t, frag_length);
io->readx.in.mincnt = MIN(state->c->srv_max_xmit_frag,
frag_length - state->received);
io->readx.in.maxcnt = io->readx.in.mincnt;
io->readx.out.data = state->data.data + state->received;
state->req = smb_raw_read_send(smb->tree, io);
if (state->req == NULL) {
talloc_steal(NULL, state);
pipe_dead(state->c, NT_STATUS_NO_MEMORY);
talloc_free(state);
return;
}
state->req->async.fn = smb_read_callback;
state->req->async.private = state;
DEBUG_FN_EXIT;
}
/*
trigger a read request from the server, possibly with some initial
data in the read buffer
*/
static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLOB *blob)
{
DEBUG_FN_ENTER;
struct smb_private *smb = c->transport.private;
union smb_read *io;
struct smb_read_state *state;
struct smbcli_request *req;
state = talloc(smb, struct smb_read_state);
if (state == NULL) {
return NT_STATUS_NO_MEMORY;
}
state->c = c;
if (blob == NULL) {
state->received = 0;
state->data = data_blob_talloc(state, NULL, 0x2000);
} else {
uint32_t frag_length = blob->length>=16?
dcerpc_get_frag_length(blob):0x2000;
state->received = blob->length;
state->data = data_blob_talloc(state, NULL, frag_length);
if (!state->data.data) {
talloc_free(state);
return NT_STATUS_NO_MEMORY;
}
/* Added by cgibbons@zenoss on 03/10/2010 - prevent a buffer
overrun. This may happen if the data blob has specified
an invalid fragment size out. Safety first! */
if (blob->length > talloc_get_size(state->data.data)) {
talloc_free(state);
return NT_STATUS_NO_MEMORY;
}
memcpy(state->data.data, blob->data, blob->length);
}
state->io = talloc(state, union smb_read);
io = state->io;
io->generic.level = RAW_READ_READX;
io->readx.in.file.fnum = smb->fnum;
io->readx.in.mincnt = state->data.length - state->received;
io->readx.in.maxcnt = io->readx.in.mincnt;
io->readx.in.offset = 0;
io->readx.in.remaining = 0;
io->readx.in.read_for_execute = False;
io->readx.out.data = state->data.data + state->received;
req = smb_raw_read_send(smb->tree, io);
if (req == NULL) {
return NT_STATUS_NO_MEMORY;
}
req->async.fn = smb_read_callback;
req->async.private = state;
state->req = req;
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
trigger a read request from the server
*/
static NTSTATUS send_read_request(struct dcerpc_connection *c)
{
DEBUG_FN_ENTER;
DEBUG_FN_EXIT;
return send_read_request_continue(c, NULL);
}
/*
this holds the state of an in-flight trans call
*/
struct smb_trans_state {
struct dcerpc_connection *c;
struct smbcli_request *req;
struct smb_trans2 *trans;
};
/*
called when a trans request has completed
*/
static void smb_trans_callback(struct smbcli_request *req)
{
DEBUG_FN_ENTER;
struct smb_trans_state *state = req->async.private;
struct dcerpc_connection *c = state->c;
NTSTATUS status;
status = smb_raw_trans_recv(req, state, state->trans);
if (NT_STATUS_IS_ERR(status)) {
DEBUG_FN_FAIL("smb_raw_trans_recv return error NTSTATUS");
pipe_dead(c, status);
return;
}
if (!NT_STATUS_EQUAL(status, STATUS_BUFFER_OVERFLOW)) {
DATA_BLOB data = state->trans->out.data;
talloc_steal(c, data.data);
talloc_free(state);
c->transport.recv_data(c, &data, NT_STATUS_OK);
DEBUG_FN_EXIT_MSG("BUFFER_OVERFLOW");
return;
}
/* there is more to receive - setup a readx */
send_read_request_continue(c, &state->trans->out.data);
talloc_free(state);
DEBUG_FN_EXIT;
}
/*
send a SMBtrans style request
*/
static NTSTATUS smb_send_trans_request(struct dcerpc_connection *c, DATA_BLOB *blob)
{
DEBUG_FN_ENTER;
struct smb_private *smb = c->transport.private;
struct smb_trans2 *trans;
uint16_t setup[2];
struct smb_trans_state *state;
state = talloc(smb, struct smb_trans_state);
if (state == NULL) {
return NT_STATUS_NO_MEMORY;
}
state->c = c;
state->trans = talloc(state, struct smb_trans2);
trans = state->trans;
trans->in.data = *blob;
trans->in.params = data_blob(NULL, 0);
setup[0] = TRANSACT_DCERPCCMD;
setup[1] = smb->fnum;
trans->in.max_param = 0;
trans->in.max_data = smb_raw_max_trans_data(smb->tree, 0);
trans->in.max_setup = 0;
trans->in.setup_count = 2;
trans->in.flags = 0;
trans->in.timeout = 0;
trans->in.setup = setup;
trans->in.trans_name = "\\PIPE\\";
state->req = smb_raw_trans_send(smb->tree, trans);
if (state->req == NULL) {
talloc_free(state);
return NT_STATUS_NO_MEMORY;
}
state->req->async.fn = smb_trans_callback;
state->req->async.private = state;
talloc_steal(state, state->req);
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
called when a write request has completed
*/
static void smb_write_callback(struct smbcli_request *req)
{
DEBUG_FN_ENTER;
struct dcerpc_connection *c = req->async.private;
if (!NT_STATUS_IS_OK(req->status)) {
DEBUG(0,("dcerpc_smb: write callback error\n"));
talloc_steal(NULL, req);
pipe_dead(c, req->status);
}
smbcli_request_destroy(req);
DEBUG_FN_EXIT;
}
/*
send a packet to the server
*/
static NTSTATUS smb_send_request(struct dcerpc_connection *c, DATA_BLOB *blob, BOOL trigger_read)
{
DEBUG_FN_ENTER;
struct smb_private *smb = c->transport.private;
union smb_write io;
struct smbcli_request *req;
if (trigger_read) {
return smb_send_trans_request(c, blob);
}
io.generic.level = RAW_WRITE_WRITEX;
io.writex.in.file.fnum = smb->fnum;
io.writex.in.offset = 0;
io.writex.in.wmode = PIPE_START_MESSAGE;
io.writex.in.remaining = blob->length;
io.writex.in.count = blob->length;
io.writex.in.data = blob->data;
/* we must not timeout at the smb level for rpc requests, as otherwise
signing/sealing can be messed up */
smb->tree->session->transport->options.request_timeout = 0;
req = smb_raw_write_send(smb->tree, &io);
if (req == NULL) {
return NT_STATUS_NO_MEMORY;
}
req->async.fn = smb_write_callback;
req->async.private = c;
if (trigger_read) {
send_read_request(c);
}
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
shutdown SMB pipe connection
*/
static NTSTATUS smb_shutdown_pipe(struct dcerpc_connection *c)
{
DEBUG_FN_ENTER;
struct smb_private *smb = c->transport.private;
union smb_close io;
struct smbcli_request *req;
/* maybe we're still starting up */
if (!smb) return NT_STATUS_OK;
io.close.level = RAW_CLOSE_CLOSE;
io.close.in.file.fnum = smb->fnum;
io.close.in.write_time = 0;
req = smb_raw_close_send(smb->tree, &io);
if (req != NULL) {
/* we don't care if this fails, so just free it if it succeeds */
req->async.fn = (void (*)(struct smbcli_request *))talloc_free;
}
talloc_free(smb);
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
return SMB server name (called name)
*/
static const char *smb_peer_name(struct dcerpc_connection *c)
{
struct smb_private *smb = c->transport.private;
return smb->server_name;
}
/*
return remote name we make the actual connection (good for kerberos)
*/
static const char *smb_target_hostname(struct dcerpc_connection *c)
{
struct smb_private *smb = talloc_get_type(c->transport.private, struct smb_private);
return smb->tree->session->transport->socket->hostname;
}
/*
fetch the user session key
*/
static NTSTATUS smb_session_key(struct dcerpc_connection *c, DATA_BLOB *session_key)
{
struct smb_private *smb = c->transport.private;
if (smb->tree->session->user_session_key.data) {
*session_key = smb->tree->session->user_session_key;
return NT_STATUS_OK;
}
return NT_STATUS_NO_USER_SESSION_KEY;
}
struct pipe_open_smb_state {
union smb_open *open;
struct dcerpc_connection *c;
struct smbcli_tree *tree;
struct composite_context *ctx;
};
static void pipe_open_recv(struct smbcli_request *req);
struct composite_context *dcerpc_pipe_open_smb_send(struct dcerpc_connection *c,
struct smbcli_tree *tree,
const char *pipe_name)
{
DEBUG_FN_ENTER;
struct composite_context *ctx;
struct pipe_open_smb_state *state;
struct smbcli_request *req;
ctx = composite_create(c, c->event_ctx);
if (ctx == NULL) return NULL;
state = talloc(ctx, struct pipe_open_smb_state);
if (composite_nomem(state, ctx)) return ctx;
ctx->private_data = state;
state->c = c;
state->tree = tree;
state->ctx = ctx;
state->open = talloc(state, union smb_open);
if (composite_nomem(state->open, ctx)) return ctx;
state->open->ntcreatex.level = RAW_OPEN_NTCREATEX;
state->open->ntcreatex.in.flags = 0;
state->open->ntcreatex.in.root_fid = 0;
state->open->ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
SEC_FILE_WRITE_ATTRIBUTE |
SEC_FILE_WRITE_EA |
SEC_FILE_READ_DATA |
SEC_FILE_WRITE_DATA;
state->open->ntcreatex.in.file_attr = 0;
state->open->ntcreatex.in.alloc_size = 0;
state->open->ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
state->open->ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
state->open->ntcreatex.in.create_options = 0;
state->open->ntcreatex.in.impersonation =
NTCREATEX_IMPERSONATION_IMPERSONATION;
state->open->ntcreatex.in.security_flags = 0;
if ((strncasecmp(pipe_name, "/pipe/", 6) == 0) ||
(strncasecmp(pipe_name, "\\pipe\\", 6) == 0)) {
pipe_name += 6;
}
state->open->ntcreatex.in.fname =
(pipe_name[0] == '\\') ?
talloc_strdup(state->open, pipe_name) :
talloc_asprintf(state->open, "\\%s", pipe_name);
if (composite_nomem(state->open->ntcreatex.in.fname, ctx)) return ctx;
req = smb_raw_open_send(tree, state->open);
composite_continue_smb(ctx, req, pipe_open_recv, state);
DEBUG_FN_EXIT;
return ctx;
}
static void pipe_open_recv(struct smbcli_request *req)
{
DEBUG_FN_ENTER;
struct pipe_open_smb_state *state = talloc_get_type(req->async.private,
struct pipe_open_smb_state);
struct composite_context *ctx = state->ctx;
struct dcerpc_connection *c = state->c;
struct smb_private *smb;
ctx->status = smb_raw_open_recv(req, state, state->open);
if (!composite_is_ok(ctx)) return;
/*
fill in the transport methods
*/
c->transport.transport = NCACN_NP;
c->transport.private = NULL;
c->transport.shutdown_pipe = smb_shutdown_pipe;
c->transport.peer_name = smb_peer_name;
c->transport.target_hostname = smb_target_hostname;
c->transport.send_request = smb_send_request;
c->transport.send_read = send_read_request;
c->transport.recv_data = NULL;
/* Over-ride the default session key with the SMB session key */
c->security_state.session_key = smb_session_key;
smb = talloc(c, struct smb_private);
if (composite_nomem(smb, ctx)) return;
smb->fnum = state->open->ntcreatex.out.file.fnum;
smb->tree = talloc_reference(smb, state->tree);
smb->server_name= strupper_talloc(smb,
state->tree->session->transport->called.name);
if (composite_nomem(smb->server_name, ctx)) return;
c->transport.private = smb;
composite_done(ctx);
DEBUG_FN_EXIT;
}
NTSTATUS dcerpc_pipe_open_smb_recv(struct composite_context *c)
{
DEBUG_FN_ENTER;
NTSTATUS status = composite_wait(c);
talloc_free(c);
DEBUG_FN_EXIT;
return status;
}
NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_connection *c,
struct smbcli_tree *tree,
const char *pipe_name)
{
DEBUG_FN_ENTER;
struct composite_context *ctx = dcerpc_pipe_open_smb_send(c, tree,
pipe_name);
return dcerpc_pipe_open_smb_recv(ctx);
}
/*
return the SMB tree used for a dcerpc over SMB pipe
*/
struct smbcli_tree *dcerpc_smb_tree(struct dcerpc_connection *c)
{
struct smb_private *smb;
if (c->transport.transport != NCACN_NP) return NULL;
smb = talloc_get_type(c->transport.private, struct smb_private);
if (!smb) return NULL;
return smb->tree;
}
+482
View File
@@ -0,0 +1,482 @@
/*
Unix SMB/CIFS implementation.
dcerpc over SMB2 transport
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 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.
*/
#include "includes.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/composite/composite.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
#include "libcli/raw/ioctl.h"
#include "librpc/rpc/dcerpc.h"
/* transport private information used by SMB2 pipe transport */
struct smb2_private {
struct smb2_handle handle;
struct smb2_tree *tree;
const char *server_name;
};
/*
tell the dcerpc layer that the transport is dead
*/
static void pipe_dead(struct dcerpc_connection *c, NTSTATUS status)
{
c->transport.recv_data(c, NULL, status);
}
/*
this holds the state of an in-flight call
*/
struct smb2_read_state {
struct dcerpc_connection *c;
DATA_BLOB data;
};
/*
called when a read request has completed
*/
static void smb2_read_callback(struct smb2_request *req)
{
struct smb2_private *smb;
struct smb2_read_state *state;
struct smb2_read io;
uint16_t frag_length;
NTSTATUS status;
state = talloc_get_type(req->async.private, struct smb2_read_state);
smb = talloc_get_type(state->c->transport.private, struct smb2_private);
status = smb2_read_recv(req, state, &io);
if (NT_STATUS_IS_ERR(status)) {
pipe_dead(state->c, status);
talloc_free(state);
return;
}
status = data_blob_append(state, &state->data,
io.out.data.data, io.out.data.length);
if (NT_STATUS_IS_ERR(status)) {
pipe_dead(state->c, status);
talloc_free(state);
return;
}
if (state->data.length < 16) {
DEBUG(0,("dcerpc_smb2: short packet (length %d) in read callback!\n",
(int)state->data.length));
pipe_dead(state->c, NT_STATUS_INFO_LENGTH_MISMATCH);
talloc_free(state);
return;
}
frag_length = dcerpc_get_frag_length(&state->data);
if (frag_length <= state->data.length) {
DATA_BLOB data = state->data;
struct dcerpc_connection *c = state->c;
talloc_steal(c, data.data);
talloc_free(state);
c->transport.recv_data(c, &data, NT_STATUS_OK);
return;
}
/* initiate another read request, as we only got part of a fragment */
ZERO_STRUCT(io);
io.in.file.handle = smb->handle;
io.in.length = MIN(state->c->srv_max_xmit_frag,
frag_length - state->data.length);
if (io.in.length < 16) {
io.in.length = 16;
}
req = smb2_read_send(smb->tree, &io);
if (req == NULL) {
pipe_dead(state->c, NT_STATUS_NO_MEMORY);
talloc_free(state);
return;
}
req->async.fn = smb2_read_callback;
req->async.private = state;
}
/*
trigger a read request from the server, possibly with some initial
data in the read buffer
*/
static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLOB *blob)
{
struct smb2_private *smb = c->transport.private;
struct smb2_read io;
struct smb2_read_state *state;
struct smb2_request *req;
state = talloc(smb, struct smb2_read_state);
if (state == NULL) {
return NT_STATUS_NO_MEMORY;
}
state->c = c;
if (blob == NULL) {
state->data = data_blob(NULL, 0);
} else {
state->data = *blob;
talloc_steal(state, state->data.data);
}
ZERO_STRUCT(io);
io.in.file.handle = smb->handle;
if (state->data.length >= 16) {
uint16_t frag_length = dcerpc_get_frag_length(&state->data);
io.in.length = frag_length - state->data.length;
} else {
io.in.length = 0x2000;
}
req = smb2_read_send(smb->tree, &io);
if (req == NULL) {
return NT_STATUS_NO_MEMORY;
}
req->async.fn = smb2_read_callback;
req->async.private = state;
return NT_STATUS_OK;
}
/*
trigger a read request from the server
*/
static NTSTATUS send_read_request(struct dcerpc_connection *c)
{
return send_read_request_continue(c, NULL);
}
/*
this holds the state of an in-flight trans call
*/
struct smb2_trans_state {
struct dcerpc_connection *c;
};
/*
called when a trans request has completed
*/
static void smb2_trans_callback(struct smb2_request *req)
{
struct smb2_trans_state *state = talloc_get_type(req->async.private,
struct smb2_trans_state);
struct dcerpc_connection *c = state->c;
NTSTATUS status;
struct smb2_ioctl io;
status = smb2_ioctl_recv(req, state, &io);
if (NT_STATUS_IS_ERR(status)) {
pipe_dead(c, status);
return;
}
if (!NT_STATUS_EQUAL(status, STATUS_BUFFER_OVERFLOW)) {
DATA_BLOB data = io.out.out;
talloc_steal(c, data.data);
talloc_free(state);
c->transport.recv_data(c, &data, NT_STATUS_OK);
return;
}
/* there is more to receive - setup a read */
send_read_request_continue(c, &io.out.out);
talloc_free(state);
}
/*
send a SMBtrans style request, using a named pipe read_write fsctl
*/
static NTSTATUS smb2_send_trans_request(struct dcerpc_connection *c, DATA_BLOB *blob)
{
struct smb2_private *smb = talloc_get_type(c->transport.private,
struct smb2_private);
struct smb2_ioctl io;
struct smb2_trans_state *state;
struct smb2_request *req;
state = talloc(smb, struct smb2_trans_state);
if (state == NULL) {
return NT_STATUS_NO_MEMORY;
}
state->c = c;
ZERO_STRUCT(io);
io.in.file.handle = smb->handle;
io.in.function = FSCTL_NAMED_PIPE_READ_WRITE;
io.in.max_response_size = 0x1000;
io.in.flags = 1;
io.in.out = *blob;
req = smb2_ioctl_send(smb->tree, &io);
if (req == NULL) {
talloc_free(state);
return NT_STATUS_NO_MEMORY;
}
req->async.fn = smb2_trans_callback;
req->async.private = state;
talloc_steal(state, req);
return NT_STATUS_OK;
}
/*
called when a write request has completed
*/
static void smb2_write_callback(struct smb2_request *req)
{
struct dcerpc_connection *c = req->async.private;
if (!NT_STATUS_IS_OK(req->status)) {
DEBUG(0,("dcerpc_smb2: write callback error\n"));
pipe_dead(c, req->status);
}
smb2_request_destroy(req);
}
/*
send a packet to the server
*/
static NTSTATUS smb2_send_request(struct dcerpc_connection *c, DATA_BLOB *blob,
BOOL trigger_read)
{
struct smb2_private *smb = c->transport.private;
struct smb2_write io;
struct smb2_request *req;
if (trigger_read) {
return smb2_send_trans_request(c, blob);
}
ZERO_STRUCT(io);
io.in.file.handle = smb->handle;
io.in.data = *blob;
req = smb2_write_send(smb->tree, &io);
if (req == NULL) {
return NT_STATUS_NO_MEMORY;
}
req->async.fn = smb2_write_callback;
req->async.private = c;
return NT_STATUS_OK;
}
/*
shutdown SMB pipe connection
*/
static NTSTATUS smb2_shutdown_pipe(struct dcerpc_connection *c)
{
struct smb2_private *smb = c->transport.private;
struct smb2_close io;
struct smb2_request *req;
/* maybe we're still starting up */
if (!smb) return NT_STATUS_OK;
ZERO_STRUCT(io);
io.in.file.handle = smb->handle;
req = smb2_close_send(smb->tree, &io);
if (req != NULL) {
/* we don't care if this fails, so just free it if it succeeds */
req->async.fn = (void (*)(struct smb2_request *))talloc_free;
}
talloc_free(smb);
return NT_STATUS_OK;
}
/*
return SMB server name
*/
static const char *smb2_peer_name(struct dcerpc_connection *c)
{
struct smb2_private *smb = talloc_get_type(c->transport.private,
struct smb2_private);
return smb->server_name;
}
/*
return remote name we make the actual connection (good for kerberos)
*/
static const char *smb2_target_hostname(struct dcerpc_connection *c)
{
struct smb2_private *smb = talloc_get_type(c->transport.private,
struct smb2_private);
return smb->tree->session->transport->socket->hostname;
}
/*
fetch the user session key
*/
static NTSTATUS smb2_session_key(struct dcerpc_connection *c, DATA_BLOB *session_key)
{
struct smb2_private *smb = talloc_get_type(c->transport.private,
struct smb2_private);
*session_key = smb->tree->session->session_key;
if (session_key->data == NULL) {
return NT_STATUS_NO_USER_SESSION_KEY;
}
return NT_STATUS_OK;
}
struct pipe_open_smb2_state {
struct dcerpc_connection *c;
struct composite_context *ctx;
};
static void pipe_open_recv(struct smb2_request *req);
struct composite_context *dcerpc_pipe_open_smb2_send(struct dcerpc_connection *c,
struct smb2_tree *tree,
const char *pipe_name)
{
struct composite_context *ctx;
struct pipe_open_smb2_state *state;
struct smb2_create io;
struct smb2_request *req;
ctx = composite_create(c, c->event_ctx);
if (ctx == NULL) return NULL;
state = talloc(ctx, struct pipe_open_smb2_state);
if (composite_nomem(state, ctx)) return ctx;
ctx->private_data = state;
state->c = c;
state->ctx = ctx;
ZERO_STRUCT(io);
io.in.access_mask =
SEC_STD_READ_CONTROL |
SEC_FILE_READ_ATTRIBUTE |
SEC_FILE_WRITE_ATTRIBUTE |
SEC_STD_SYNCHRONIZE |
SEC_FILE_READ_EA |
SEC_FILE_WRITE_EA |
SEC_FILE_READ_DATA |
SEC_FILE_WRITE_DATA |
SEC_FILE_APPEND_DATA;
io.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
io.in.open_disposition = NTCREATEX_DISP_OPEN;
io.in.create_options =
NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
NTCREATEX_OPTIONS_UNKNOWN_400000;
io.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION;
if ((strncasecmp(pipe_name, "/pipe/", 6) == 0) ||
(strncasecmp(pipe_name, "\\pipe\\", 6) == 0)) {
pipe_name += 6;
}
io.in.fname = pipe_name;
req = smb2_create_send(tree, &io);
composite_continue_smb2(ctx, req, pipe_open_recv, state);
return ctx;
}
static void pipe_open_recv(struct smb2_request *req)
{
struct pipe_open_smb2_state *state =
talloc_get_type(req->async.private,
struct pipe_open_smb2_state);
struct composite_context *ctx = state->ctx;
struct dcerpc_connection *c = state->c;
struct smb2_tree *tree = req->tree;
struct smb2_private *smb;
struct smb2_create io;
ctx->status = smb2_create_recv(req, state, &io);
if (!composite_is_ok(ctx)) return;
/*
fill in the transport methods
*/
c->transport.transport = NCACN_NP;
c->transport.private = NULL;
c->transport.shutdown_pipe = smb2_shutdown_pipe;
c->transport.peer_name = smb2_peer_name;
c->transport.target_hostname = smb2_target_hostname;
c->transport.send_request = smb2_send_request;
c->transport.send_read = send_read_request;
c->transport.recv_data = NULL;
/* Over-ride the default session key with the SMB session key */
c->security_state.session_key = smb2_session_key;
smb = talloc(c, struct smb2_private);
if (composite_nomem(smb, ctx)) return;
smb->handle = io.out.file.handle;
smb->tree = talloc_reference(smb, tree);
smb->server_name= strupper_talloc(smb,
tree->session->transport->socket->hostname);
if (composite_nomem(smb->server_name, ctx)) return;
c->transport.private = smb;
composite_done(ctx);
}
NTSTATUS dcerpc_pipe_open_smb2_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
talloc_free(c);
return status;
}
NTSTATUS dcerpc_pipe_open_smb2(struct dcerpc_connection *c,
struct smb2_tree *tree,
const char *pipe_name)
{
struct composite_context *ctx = dcerpc_pipe_open_smb2_send(c, tree, pipe_name);
return dcerpc_pipe_open_smb2_recv(ctx);
}
/*
return the SMB2 tree used for a dcerpc over SMB2 pipe
*/
struct smb2_tree *dcerpc_smb2_tree(struct dcerpc_connection *c)
{
struct smb2_private *smb = talloc_get_type(c->transport.private,
struct smb2_private);
return smb->tree;
}
+751
View File
@@ -0,0 +1,751 @@
/*
Unix SMB/CIFS implementation.
dcerpc over standard sockets transport
Copyright (C) Andrew Tridgell 2003
Copyright (C) Jelmer Vernooij 2004
Copyright (C) Rafal Szczesniak 2006
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.
*/
#include "includes.h"
#include "lib/events/events.h"
#include "lib/socket/socket.h"
#include "lib/stream/packet.h"
#include "libcli/composite/composite.h"
#include "librpc/rpc/dcerpc.h"
#include "libcli/resolve/resolve.h"
/* transport private information used by general socket pipe transports */
struct sock_private {
struct fd_event *fde;
struct socket_context *sock;
char *server_name;
struct packet_context *packet;
uint32_t pending_reads;
};
/*
mark the socket dead
*/
static void sock_dead(struct dcerpc_connection *p, NTSTATUS status)
{
DEBUG_FN_ENTER;
struct sock_private *sock = p->transport.private;
if (sock && sock->sock != NULL) {
talloc_free(sock->fde);
talloc_free(sock->sock);
sock->sock = NULL;
}
if (!NT_STATUS_IS_OK(status)) {
p->transport.recv_data(p, NULL, status);
}
DEBUG_FN_EXIT;
}
/*
handle socket recv errors
*/
static void sock_error_handler(void *private, NTSTATUS status)
{
DEBUG_FN_ENTER;
struct dcerpc_connection *p = talloc_get_type(private,
struct dcerpc_connection);
sock_dead(p, status);
DEBUG_FN_EXIT;
}
/*
check if a blob is a complete packet
*/
static NTSTATUS sock_complete_packet(void *private, DATA_BLOB blob, size_t *size)
{
DEBUG_FN_ENTER;
if (blob.length < DCERPC_FRAG_LEN_OFFSET+2) {
return STATUS_MORE_ENTRIES;
}
*size = dcerpc_get_frag_length(&blob);
if (*size > blob.length) {
return STATUS_MORE_ENTRIES;
}
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
process recv requests
*/
static NTSTATUS sock_process_recv(void *private, DATA_BLOB blob)
{
DEBUG_FN_ENTER;
struct dcerpc_connection *p = talloc_get_type(private,
struct dcerpc_connection);
struct sock_private *sock = p->transport.private;
sock->pending_reads--;
if (sock->pending_reads == 0) {
packet_recv_disable(sock->packet);
}
p->transport.recv_data(p, &blob, NT_STATUS_OK);
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
called when a IO is triggered by the events system
*/
static void sock_io_handler(struct event_context *ev, struct fd_event *fde,
uint16_t flags, void *private)
{
struct dcerpc_connection *p = talloc_get_type(private,
struct dcerpc_connection);
struct sock_private *sock = p->transport.private;
if (flags & EVENT_FD_WRITE) {
packet_queue_run(sock->packet);
return;
}
if (sock->sock == NULL) {
return;
}
if (flags & EVENT_FD_READ) {
packet_recv(sock->packet);
}
}
/*
initiate a read request - not needed for dcerpc sockets
*/
static NTSTATUS sock_send_read(struct dcerpc_connection *p)
{
DEBUG_FN_ENTER;
struct sock_private *sock = p->transport.private;
sock->pending_reads++;
if (sock->pending_reads == 1) {
packet_recv_enable(sock->packet);
}
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
send an initial pdu in a multi-pdu sequence
*/
static NTSTATUS sock_send_request(struct dcerpc_connection *p, DATA_BLOB *data,
BOOL trigger_read)
{
DEBUG_FN_ENTER;
struct sock_private *sock = p->transport.private;
DATA_BLOB blob;
NTSTATUS status;
if (sock->sock == NULL) {
DEBUG_FN_FAIL("sock->sock is NULL");
return NT_STATUS_CONNECTION_DISCONNECTED;
}
blob = data_blob_talloc(sock->packet, data->data, data->length);
if (blob.data == NULL) {
DEBUG_FN_FAIL("failed allocating blob");
return NT_STATUS_NO_MEMORY;
}
status = packet_send(sock->packet, blob);
if (!NT_STATUS_IS_OK(status)) {
DEBUG_FN_FAIL("packet_send failed, !NT_STATUS_IS_OK");
return status;
}
if (trigger_read) {
sock_send_read(p);
}
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
shutdown sock pipe connection
*/
static NTSTATUS sock_shutdown_pipe(struct dcerpc_connection *p)
{
DEBUG_FN_ENTER;
struct sock_private *sock = p->transport.private;
if (sock && sock->sock) {
sock_dead(p, NT_STATUS_OK);
}
DEBUG_FN_EXIT;
return NT_STATUS_OK;
}
/*
return sock server name
*/
static const char *sock_peer_name(struct dcerpc_connection *p)
{
struct sock_private *sock = talloc_get_type(p->transport.private, struct sock_private);
return sock->server_name;
}
/*
return remote name we make the actual connection (good for kerberos)
*/
static const char *sock_target_hostname(struct dcerpc_connection *p)
{
struct sock_private *sock = talloc_get_type(p->transport.private, struct sock_private);
return sock->server_name;
}
struct pipe_open_socket_state {
struct dcerpc_connection *conn;
struct socket_context *socket_ctx;
struct sock_private *sock;
struct socket_address *server;
const char *target_hostname;
enum dcerpc_transport_t transport;
};
static void continue_socket_connect(struct composite_context *ctx)
{
DEBUG_FN_ENTER;
struct dcerpc_connection *conn;
struct sock_private *sock;
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
struct pipe_open_socket_state *s = talloc_get_type(c->private_data,
struct pipe_open_socket_state);
/* make it easier to write a function calls */
conn = s->conn;
sock = s->sock;
c->status = socket_connect_recv(ctx);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(1, ("Failed to connect host %s on port %d - %s\n",
s->server->addr, s->server->port,
nt_errstr(c->status)));
composite_error(c, c->status);
return;
}
/*
fill in the transport methods
*/
conn->transport.transport = s->transport;
conn->transport.private = NULL;
conn->transport.send_request = sock_send_request;
conn->transport.send_read = sock_send_read;
conn->transport.recv_data = NULL;
conn->transport.shutdown_pipe = sock_shutdown_pipe;
conn->transport.peer_name = sock_peer_name;
conn->transport.target_hostname = sock_target_hostname;
sock->sock = s->socket_ctx;
sock->pending_reads = 0;
sock->server_name = strupper_talloc(sock, s->target_hostname);
sock->fde = event_add_fd(conn->event_ctx, sock->sock, socket_get_fd(sock->sock),
0, sock_io_handler, conn);
conn->transport.private = sock;
sock->packet = packet_init(sock);
if (sock->packet == NULL) {
composite_error(c, NT_STATUS_NO_MEMORY);
talloc_free(sock);
return;
}
packet_set_private(sock->packet, conn);
packet_set_socket(sock->packet, sock->sock);
packet_set_callback(sock->packet, sock_process_recv);
packet_set_full_request(sock->packet, sock_complete_packet);
packet_set_error_handler(sock->packet, sock_error_handler);
packet_set_event_context(sock->packet, conn->event_ctx);
packet_set_fde(sock->packet, sock->fde);
packet_set_serialise(sock->packet);
packet_recv_disable(sock->packet);
packet_set_initial_read(sock->packet, 16);
/* ensure we don't get SIGPIPE */
BlockSignals(True,SIGPIPE);
composite_done(c);
DEBUG_FN_EXIT;
}
struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ctx,
struct dcerpc_connection *cn,
struct socket_address *server,
const char *target_hostname,
enum dcerpc_transport_t transport)
{
DEBUG_FN_ENTER;
struct composite_context *c;
struct pipe_open_socket_state *s;
struct composite_context *conn_req;
c = composite_create(mem_ctx, cn->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct pipe_open_socket_state);
if (composite_nomem(s, c)) return c;
c->private_data = s;
s->conn = cn;
s->transport = transport;
s->server = talloc_reference(c, server);
if (composite_nomem(s->server, c)) return c;
s->target_hostname = talloc_reference(s, target_hostname);
s->sock = talloc(cn, struct sock_private);
if (composite_nomem(s->sock, c)) return c;
c->status = socket_create(server->family, SOCKET_TYPE_STREAM, &s->socket_ctx, 0);
if (!composite_is_ok(c)) return c;
talloc_steal(s->sock, s->socket_ctx);
conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0, c->event_ctx);
composite_continue(c, conn_req, continue_socket_connect, c);
DEBUG_FN_EXIT;
return c;
}
NTSTATUS dcerpc_pipe_open_socket_recv(struct composite_context *c)
{
DEBUG_FN_ENTER;
NTSTATUS status = composite_wait(c);
talloc_free(c);
DEBUG_FN_EXIT;
return status;
}
/*
open a rpc connection using the generic socket library
*/
NTSTATUS dcerpc_pipe_open_socket(struct dcerpc_connection *conn,
struct socket_address *server,
const char *target_hostname,
enum dcerpc_transport_t transport)
{
DEBUG_FN_ENTER;
struct composite_context *c;
c = dcerpc_pipe_open_socket_send(conn, conn, server, target_hostname, transport);
DEBUG_FN_EXIT;
return dcerpc_pipe_open_socket_recv(c);
}
struct pipe_tcp_state {
const char *server;
const char *target_hostname;
const char *address;
uint32_t port;
struct socket_address *srvaddr;
struct dcerpc_connection *conn;
};
#if 0 /* disabled till we can resolve names to ipv6 addresses */
static void continue_ipv6_open_socket(struct composite_context *ctx);
#endif
static void continue_ipv4_open_socket(struct composite_context *ctx);
static void continue_ip_resolve_name(struct composite_context *ctx);
static void continue_ip_resolve_name(struct composite_context *ctx)
{
DEBUG_FN_ENTER;
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
struct pipe_tcp_state *s = talloc_get_type(c->private_data,
struct pipe_tcp_state);
struct composite_context *sock_ipv4_req;
c->status = resolve_name_recv(ctx, s, &s->address);
if (!composite_is_ok(c)) return;
/* prepare server address using host ip:port and transport name */
s->srvaddr = socket_address_from_strings(s->conn, "ipv4", s->address, s->port);
if (composite_nomem(s->srvaddr, c)) return;
/* resolve_nbt_name gives only ipv4 ... - send socket open request */
sock_ipv4_req = dcerpc_pipe_open_socket_send(c, s->conn,
s->srvaddr, s->target_hostname,
NCACN_IP_TCP);
composite_continue(c, sock_ipv4_req, continue_ipv4_open_socket, c);
DEBUG_FN_EXIT;
}
/*
Stage 2 of dcerpc_pipe_open_tcp_send: receive result of pipe open request
on IPv6 and send the request on IPv4 unless IPv6 transport succeeded.
*/
#if 0 /* disabled till we can resolve names to ipv6 addresses */
static void continue_ipv6_open_socket(struct composite_context *ctx)
{
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
struct pipe_tcp_state *s = talloc_get_type(c->private_data,
struct pipe_tcp_state);
struct composite_context *sock_ipv4_req;
/* receive result of socket open request */
c->status = dcerpc_pipe_open_socket_recv(ctx);
if (NT_STATUS_IS_OK(c->status)) {
composite_done(c);
return;
}
talloc_free(s->srvaddr);
/* prepare server address using host:ip and transport name */
s->srvaddr = socket_address_from_strings(s->conn, "ipv4", s->address, s->port);
if (composite_nomem(s->srvaddr, c)) return;
/* try IPv4 if IPv6 fails */
sock_ipv4_req = dcerpc_pipe_open_socket_send(c, s->conn,
s->srvaddr, s->target_hostname,
NCACN_IP_TCP);
composite_continue(c, sock_ipv4_req, continue_ipv4_open_socket, c);
}
#endif
/*
Stage 2 of dcerpc_pipe_open_tcp_send: receive result of pipe open request
on IPv4 transport.
*/
static void continue_ipv4_open_socket(struct composite_context *ctx)
{
DEBUG_FN_ENTER;
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
struct pipe_tcp_state *s = talloc_get_type(c->private_data,
struct pipe_tcp_state);
/* receive result socket open request */
c->status = dcerpc_pipe_open_socket_recv(ctx);
if (!NT_STATUS_IS_OK(c->status)) {
/* something went wrong... */
DEBUG(1, ("Failed to connect host %s (%s) on port %d - %s.\n",
s->address, s->target_hostname,
s->port, nt_errstr(c->status)));
composite_error(c, c->status);
return;
}
composite_done(c);
DEBUG_FN_EXIT;
}
/*
Send rpc pipe open request to given host:port using
tcp/ip transport
*/
struct composite_context* dcerpc_pipe_open_tcp_send(struct dcerpc_connection *conn,
const char *server,
const char *target_hostname,
uint32_t port)
{
DEBUG_FN_ENTER;
struct composite_context *c;
struct pipe_tcp_state *s;
struct composite_context *resolve_req;
struct nbt_name name;
/* composite context allocation and setup */
c = composite_create(conn, conn->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct pipe_tcp_state);
if (composite_nomem(s, c)) return c;
c->private_data = s;
/* store input parameters in state structure */
s->server = talloc_strdup(c, server);
if (composite_nomem(s->server, c)) return c;
if (target_hostname) {
s->target_hostname = talloc_strdup(c, target_hostname);
if (composite_nomem(s->target_hostname, c)) return c;
}
s->port = port;
s->conn = conn;
make_nbt_name_server(&name, server);
resolve_req = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order());
composite_continue(c, resolve_req, continue_ip_resolve_name, c);
DEBUG_FN_EXIT;
return c;
}
/*
Receive result of pipe open request on tcp/ip
*/
NTSTATUS dcerpc_pipe_open_tcp_recv(struct composite_context *c)
{
DEBUG_FN_ENTER;
NTSTATUS status;
status = composite_wait(c);
talloc_free(c);
DEBUG_FN_EXIT;
return status;
}
/*
Open rpc pipe on tcp/ip transport - sync version
*/
NTSTATUS dcerpc_pipe_open_tcp(struct dcerpc_connection *conn, const char *server,
const char *target_hostname,
uint32_t port)
{
DEBUG_FN_ENTER;
struct composite_context *c;
c = dcerpc_pipe_open_tcp_send(conn, server, target_hostname, port);
return dcerpc_pipe_open_tcp_recv(c);
}
struct pipe_unix_state {
const char *path;
struct socket_address *srvaddr;
struct dcerpc_connection *conn;
};
/*
Stage 2 of dcerpc_pipe_open_unix_stream_send: receive result of pipe open
request on unix socket.
*/
void continue_unix_open_socket(struct composite_context *ctx)
{
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
c->status = dcerpc_pipe_open_socket_recv(ctx);
if (NT_STATUS_IS_OK(c->status)) {
composite_done(c);
return;
}
composite_error(c, c->status);
}
/*
Send pipe open request on unix socket
*/
struct composite_context *dcerpc_pipe_open_unix_stream_send(struct dcerpc_connection *conn,
const char *path)
{
struct composite_context *c;
struct composite_context *sock_unix_req;
struct pipe_unix_state *s;
/* composite context allocation and setup */
c = composite_create(conn, conn->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct pipe_unix_state);
if (composite_nomem(s, c)) return c;
c->private_data = s;
/* store parameters in state structure */
s->path = talloc_strdup(c, path);
if (composite_nomem(s->path, c)) return c;
s->conn = conn;
/* prepare server address using socket path and transport name */
s->srvaddr = socket_address_from_strings(conn, "unix", s->path, 0);
if (composite_nomem(s->srvaddr, c)) return c;
/* send socket open request */
sock_unix_req = dcerpc_pipe_open_socket_send(c, s->conn,
s->srvaddr, NULL,
NCALRPC);
composite_continue(c, sock_unix_req, continue_unix_open_socket, c);
return c;
}
/*
Receive result of pipe open request on unix socket
*/
NTSTATUS dcerpc_pipe_open_unix_stream_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
talloc_free(c);
return status;
}
/*
Open a rpc pipe on a unix socket - sync version
*/
NTSTATUS dcerpc_pipe_open_unix_stream(struct dcerpc_connection *conn, const char *path)
{
struct composite_context *c = dcerpc_pipe_open_unix_stream_send(conn, path);
return dcerpc_pipe_open_unix_stream_recv(c);
}
struct pipe_np_state {
char *full_path;
struct socket_address *srvaddr;
struct dcerpc_connection *conn;
};
/*
Stage 2 of dcerpc_pipe_open_pipe_send: receive socket open request
*/
void continue_np_open_socket(struct composite_context *ctx)
{
DEBUG_FN_ENTER;
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
c->status = dcerpc_pipe_open_socket_recv(ctx);
if (!composite_is_ok(c)) return;
composite_done(c);
DEBUG_FN_EXIT;
}
/*
Send pipe open request on ncalrpc
*/
struct composite_context* dcerpc_pipe_open_pipe_send(struct dcerpc_connection *conn,
const char *identifier)
{
DEBUG_FN_ENTER;
char *canon = NULL;
struct composite_context *c;
struct composite_context *sock_np_req;
struct pipe_np_state *s;
/* composite context allocation and setup */
c = composite_create(conn, conn->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct pipe_np_state);
if (composite_nomem(s, c)) return c;
c->private_data = s;
/* store parameters in state structure */
canon = talloc_strdup(s, identifier);
if (composite_nomem(canon, c)) return c;
s->conn = conn;
string_replace(canon, '/', '\\');
s->full_path = talloc_asprintf(canon, "%s/%s", lp_ncalrpc_dir(), canon);
if (composite_nomem(s->full_path, c)) return c;
/* prepare server address using path and transport name */
s->srvaddr = socket_address_from_strings(conn, "unix", s->full_path, 0);
if (composite_nomem(s->srvaddr, c)) return c;
/* send socket open request */
sock_np_req = dcerpc_pipe_open_socket_send(c, s->conn, s->srvaddr, NULL, NCALRPC);
composite_continue(c, sock_np_req, continue_np_open_socket, c);
DEBUG_FN_EXIT;
return c;
}
/*
Receive result of pipe open request on ncalrpc
*/
NTSTATUS dcerpc_pipe_open_pipe_recv(struct composite_context *c)
{
DEBUG_FN_ENTER;
NTSTATUS status = composite_wait(c);
talloc_free(c);
DEBUG_FN_EXIT;
return status;
}
/*
Open a rpc pipe on a named pipe - sync version
*/
NTSTATUS dcerpc_pipe_open_pipe(struct dcerpc_connection *conn, const char *identifier)
{
struct composite_context *c = dcerpc_pipe_open_pipe_send(conn, identifier);
return dcerpc_pipe_open_pipe_recv(c);
}
File diff suppressed because it is too large Load Diff
+135
View File
@@ -0,0 +1,135 @@
/*
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 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.
*/
#include "includes.h"
#include "lib/util/dlinklist.h"
#include "librpc/rpc/dcerpc.h"
#include "librpc/rpc/dcerpc_table.h"
struct dcerpc_interface_list *dcerpc_pipes = NULL;
/*
register a dcerpc client interface
*/
NTSTATUS librpc_register_interface(const struct dcerpc_interface_table *interface)
{
struct dcerpc_interface_list *l;
for (l = dcerpc_pipes; l; l = l->next) {
if (GUID_equal(&interface->syntax_id.uuid, &l->table->syntax_id.uuid)) {
DEBUG(0, ("Attempt to register interface %s which has the "
"same UUID as already registered interface %s\n",
interface->name, l->table->name));
return NT_STATUS_OBJECT_NAME_COLLISION;
}
}
l = talloc(talloc_autofree_context(), struct dcerpc_interface_list);
l->table = interface;
DLIST_ADD(dcerpc_pipes, l);
return NT_STATUS_OK;
}
/*
find the pipe name for a local IDL interface
*/
const char *idl_pipe_name(const struct GUID *uuid, uint32_t if_version)
{
const struct dcerpc_interface_list *l;
for (l=librpc_dcerpc_pipes();l;l=l->next) {
if (GUID_equal(&l->table->syntax_id.uuid, uuid) &&
l->table->syntax_id.if_version == if_version) {
return l->table->name;
}
}
return "UNKNOWN";
}
/*
find the number of calls defined by local IDL
*/
int idl_num_calls(const struct GUID *uuid, uint32_t if_version)
{
const struct dcerpc_interface_list *l;
for (l=librpc_dcerpc_pipes();l;l=l->next){
if (GUID_equal(&l->table->syntax_id.uuid, uuid) &&
l->table->syntax_id.if_version == if_version) {
return l->table->num_calls;
}
}
return -1;
}
/*
find a dcerpc interface by name
*/
const struct dcerpc_interface_table *idl_iface_by_name(const char *name)
{
const struct dcerpc_interface_list *l;
for (l=librpc_dcerpc_pipes();l;l=l->next) {
if (strcasecmp(l->table->name, name) == 0) {
return l->table;
}
}
return NULL;
}
/*
find a dcerpc interface by uuid
*/
const struct dcerpc_interface_table *idl_iface_by_uuid(const struct GUID *uuid)
{
const struct dcerpc_interface_list *l;
for (l=librpc_dcerpc_pipes();l;l=l->next) {
if (GUID_equal(&l->table->syntax_id.uuid, uuid)) {
return l->table;
}
}
return NULL;
}
/*
return the list of registered dcerpc_pipes
*/
const struct dcerpc_interface_list *librpc_dcerpc_pipes(void)
{
return dcerpc_pipes;
}
NTSTATUS dcerpc_register_builtin_interfaces(void);
NTSTATUS dcerpc_table_init(void)
{
static BOOL initialized = False;
if (initialized) return NT_STATUS_OK;
initialized = True;
dcerpc_register_builtin_interfaces();
return NT_STATUS_OK;
}
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/perl -w
###################################################
# package to produce a table of all idl parsers
# Copyright tridge@samba.org 2003
# Copyright jelmer@samba.org 2005
# released under the GNU GPL
use strict;
use Getopt::Long;
use File::Basename;
my $opt_output = 'librpc/gen_ndr/tables.c';
my $opt_help = 0;
#########################################
# display help text
sub ShowHelp()
{
print "
perl DCE/RPC interface table generator
Copyright (C) tridge\@samba.org
Usage: tables.pl [options] <idlfile>
\n";
exit(0);
}
# main program
GetOptions (
'help|h|?' => \$opt_help,
'output=s' => \$opt_output,
);
if ($opt_help) {
ShowHelp();
exit(0);
}
my $init_fns = "";
###################################
# extract table entries from 1 file
sub process_file($)
{
my $filename = shift;
open(FILE, $filename) || die "unable to open $filename\n";
my $found = 0;
while (my $line = <FILE>) {
if ($line =~ /extern const struct dcerpc_interface_table (\w+);/) {
$found = 1;
$init_fns.="\tstatus = librpc_register_interface(&$1);\n";
$init_fns.="\tif (NT_STATUS_IS_ERR(status)) return status;\n\n";
}
}
if ($found) {
print "#include \"$filename\"\n";
}
close(FILE);
}
print <<EOF;
/* Automatically generated by tables.pl. DO NOT EDIT */
#include "includes.h"
#include "librpc/rpc/dcerpc.h"
#include "librpc/rpc/dcerpc_table.h"
EOF
process_file($_) foreach (@ARGV);
print <<EOF;
NTSTATUS dcerpc_register_builtin_interfaces(void)
{
NTSTATUS status;
$init_fns
return NT_STATUS_OK;
}
EOF