summaryrefslogtreecommitdiffstats
path: root/librpc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--librpc/ABI/ndr-0.0.1.sigs245
-rw-r--r--librpc/ABI/ndr-0.0.2.sigs247
-rw-r--r--librpc/ABI/ndr-0.0.3.sigs251
-rw-r--r--librpc/ABI/ndr-0.0.4.sigs252
-rw-r--r--librpc/ABI/ndr-0.0.5.sigs255
-rw-r--r--librpc/ABI/ndr-0.0.6.sigs256
-rw-r--r--librpc/ABI/ndr-0.0.7.sigs257
-rw-r--r--librpc/ABI/ndr-0.0.8.sigs258
-rw-r--r--librpc/ABI/ndr-0.0.9.sigs259
-rw-r--r--librpc/ABI/ndr-0.1.0.sigs259
-rw-r--r--librpc/ABI/ndr-0.1.1.sigs262
-rw-r--r--librpc/ABI/ndr-0.1.2.sigs263
-rw-r--r--librpc/ABI/ndr-0.2.0.sigs264
-rw-r--r--librpc/ABI/ndr-0.2.1.sigs265
-rw-r--r--librpc/ABI/ndr-1.0.0.sigs263
-rw-r--r--librpc/ABI/ndr-1.0.1.sigs264
-rw-r--r--librpc/ABI/ndr-1.0.2.sigs265
-rw-r--r--librpc/ABI/ndr-2.0.0.sigs269
-rw-r--r--librpc/ABI/ndr-3.0.0.sigs269
-rw-r--r--librpc/binding-strings.txt4
-rw-r--r--librpc/gen_ndr/README4
-rw-r--r--librpc/idl/IDL_LICENSE.txt9
-rw-r--r--librpc/idl/ODJ.idl268
-rw-r--r--librpc/idl/atsvc.idl119
-rw-r--r--librpc/idl/audiosrv.idl23
-rw-r--r--librpc/idl/auth.idl144
-rw-r--r--librpc/idl/backupkey.idl153
-rw-r--r--librpc/idl/bkupblobs.idl54
-rw-r--r--librpc/idl/browser.idl86
-rw-r--r--librpc/idl/cab.idl130
-rw-r--r--librpc/idl/clusapi.idl2962
-rw-r--r--librpc/idl/dbgidl.idl9
-rw-r--r--librpc/idl/dcerpc.idl662
-rw-r--r--librpc/idl/dcom.idl314
-rw-r--r--librpc/idl/dfs.idl419
-rw-r--r--librpc/idl/dfsblobs.idl115
-rw-r--r--librpc/idl/dns.idl282
-rw-r--r--librpc/idl/dnsp.idl293
-rw-r--r--librpc/idl/dnsserver.idl1529
-rw-r--r--librpc/idl/drsblobs.idl680
-rw-r--r--librpc/idl/drsuapi.idl1915
-rw-r--r--librpc/idl/dsbackup.idl34
-rw-r--r--librpc/idl/dssetup.idl101
-rw-r--r--librpc/idl/echo.idl127
-rw-r--r--librpc/idl/efs.idl108
-rw-r--r--librpc/idl/epmapper.idl328
-rw-r--r--librpc/idl/eventlog.idl324
-rw-r--r--librpc/idl/eventlog6.idl343
-rw-r--r--librpc/idl/file_id.idl14
-rw-r--r--librpc/idl/frsapi.idl128
-rw-r--r--librpc/idl/frsrpc.idl458
-rw-r--r--librpc/idl/frstrans.idl295
-rw-r--r--librpc/idl/fscc.idl47
-rw-r--r--librpc/idl/fsrvp.idl107
-rw-r--r--librpc/idl/fsrvp_state.idl36
-rw-r--r--librpc/idl/idl_types.h64
-rw-r--r--librpc/idl/idmap.idl53
-rw-r--r--librpc/idl/initshutdown.idl91
-rw-r--r--librpc/idl/ioctl.idl230
-rw-r--r--librpc/idl/keysvc.idl16
-rw-r--r--librpc/idl/krb5ccache.idl115
-rw-r--r--librpc/idl/krb5pac.idl225
-rw-r--r--librpc/idl/lsa.idl1407
-rw-r--r--librpc/idl/mdssvc.idl68
-rw-r--r--librpc/idl/messaging.idl202
-rw-r--r--librpc/idl/mgmt.idl75
-rw-r--r--librpc/idl/misc.idl149
-rw-r--r--librpc/idl/msgsvc.idl22
-rw-r--r--librpc/idl/named_pipe_auth.idl58
-rw-r--r--librpc/idl/nbt.idl687
-rw-r--r--librpc/idl/negoex.idl152
-rw-r--r--librpc/idl/netlogon.idl1825
-rw-r--r--librpc/idl/nfs4acl.idl51
-rw-r--r--librpc/idl/notify.idl94
-rw-r--r--librpc/idl/ntlmssp.idl307
-rw-r--r--librpc/idl/ntprinting.idl156
-rw-r--r--librpc/idl/ntsvcs.idl399
-rw-r--r--librpc/idl/orpc.idl230
-rw-r--r--librpc/idl/oxidresolver.idl96
-rw-r--r--librpc/idl/policyagent.idl13
-rw-r--r--librpc/idl/preg.idl44
-rw-r--r--librpc/idl/printcap.idl18
-rw-r--r--librpc/idl/quota.idl54
-rw-r--r--librpc/idl/rap.idl1076
-rw-r--r--librpc/idl/remact.idl46
-rw-r--r--librpc/idl/rot.idl44
-rw-r--r--librpc/idl/samr.idl1665
-rw-r--r--librpc/idl/scerpc.idl18
-rw-r--r--librpc/idl/schannel.idl113
-rw-r--r--librpc/idl/security.cnf1
-rw-r--r--librpc/idl/security.idl794
-rw-r--r--librpc/idl/server_id.idl36
-rw-r--r--librpc/idl/smb2_lease_struct.idl34
-rw-r--r--librpc/idl/smb_acl.idl96
-rw-r--r--librpc/idl/spoolss.idl3566
-rw-r--r--librpc/idl/srvsvc.idl1569
-rw-r--r--librpc/idl/svcctl.idl673
-rw-r--r--librpc/idl/trkwks.idl17
-rw-r--r--librpc/idl/unixinfo.idl56
-rw-r--r--librpc/idl/w32time.idl21
-rw-r--r--librpc/idl/winbind.idl316
-rw-r--r--librpc/idl/windows_event_ids.idl42
-rw-r--r--librpc/idl/winreg.cnf52
-rw-r--r--librpc/idl/winreg.idl459
-rw-r--r--librpc/idl/winspool.idl878
-rw-r--r--librpc/idl/winstation.idl13
-rw-r--r--librpc/idl/witness.idl152
-rw-r--r--librpc/idl/wkssvc.idl796
-rw-r--r--librpc/idl/wmi.idl715
-rw-r--r--librpc/idl/wscript_build177
-rw-r--r--librpc/idl/wzcsvc.idl31
-rw-r--r--librpc/idl/xattr.idl234
-rw-r--r--librpc/ndr.pc.in11
-rw-r--r--librpc/ndr/libndr.h857
-rw-r--r--librpc/ndr/ndr.c2005
-rw-r--r--librpc/ndr/ndr_ODJ.c65
-rw-r--r--librpc/ndr/ndr_ODJ.h22
-rw-r--r--librpc/ndr/ndr_auth.c44
-rw-r--r--librpc/ndr/ndr_auth.h32
-rw-r--r--librpc/ndr/ndr_backupkey.c222
-rw-r--r--librpc/ndr/ndr_backupkey.h23
-rw-r--r--librpc/ndr/ndr_basic.c1538
-rw-r--r--librpc/ndr/ndr_bkupblobs.c82
-rw-r--r--librpc/ndr/ndr_cab.c437
-rw-r--r--librpc/ndr/ndr_cab.h22
-rw-r--r--librpc/ndr/ndr_compression.c941
-rw-r--r--librpc/ndr/ndr_compression.h68
-rw-r--r--librpc/ndr/ndr_dcerpc.c316
-rw-r--r--librpc/ndr/ndr_dcerpc.h29
-rw-r--r--librpc/ndr/ndr_dns.c327
-rw-r--r--librpc/ndr/ndr_dns.h40
-rw-r--r--librpc/ndr/ndr_dns_utils.c134
-rw-r--r--librpc/ndr/ndr_dns_utils.h6
-rw-r--r--librpc/ndr/ndr_dnsp.c263
-rw-r--r--librpc/ndr/ndr_dnsp.h33
-rw-r--r--librpc/ndr/ndr_dnsserver.c100
-rw-r--r--librpc/ndr/ndr_dnsserver.h25
-rw-r--r--librpc/ndr/ndr_drsblobs.c220
-rw-r--r--librpc/ndr/ndr_drsblobs.h23
-rw-r--r--librpc/ndr/ndr_drsuapi.c569
-rw-r--r--librpc/ndr/ndr_drsuapi.h34
-rw-r--r--librpc/ndr/ndr_frsrpc.c92
-rw-r--r--librpc/ndr/ndr_frsrpc.h34
-rw-r--r--librpc/ndr/ndr_ioctl.c40
-rw-r--r--librpc/ndr/ndr_krb5pac.c130
-rw-r--r--librpc/ndr/ndr_krb5pac.h26
-rw-r--r--librpc/ndr/ndr_misc.c77
-rw-r--r--librpc/ndr/ndr_nbt.c406
-rw-r--r--librpc/ndr/ndr_nbt.h42
-rw-r--r--librpc/ndr/ndr_negoex.c521
-rw-r--r--librpc/ndr/ndr_negoex.h37
-rw-r--r--librpc/ndr/ndr_netlogon.c65
-rw-r--r--librpc/ndr/ndr_netlogon.h28
-rw-r--r--librpc/ndr/ndr_ntlmssp.c195
-rw-r--r--librpc/ndr/ndr_ntlmssp.h35
-rw-r--r--librpc/ndr/ndr_ntprinting.c87
-rw-r--r--librpc/ndr/ndr_ntprinting.h27
-rw-r--r--librpc/ndr/ndr_orpc.c163
-rw-r--r--librpc/ndr/ndr_preg.c69
-rw-r--r--librpc/ndr/ndr_preg.h23
-rw-r--r--librpc/ndr/ndr_private.h32
-rw-r--r--librpc/ndr/ndr_rap.c28
-rw-r--r--librpc/ndr/ndr_rap.h22
-rw-r--r--librpc/ndr/ndr_schannel.c107
-rw-r--r--librpc/ndr/ndr_schannel.h25
-rw-r--r--librpc/ndr/ndr_sec_helper.c338
-rw-r--r--librpc/ndr/ndr_spoolss_buf.c1615
-rw-r--r--librpc/ndr/ndr_spoolss_buf.h85
-rw-r--r--librpc/ndr/ndr_string.c815
-rw-r--r--librpc/ndr/ndr_svcctl.c52
-rw-r--r--librpc/ndr/ndr_svcctl.h24
-rw-r--r--librpc/ndr/ndr_table.c182
-rw-r--r--librpc/ndr/ndr_table.h37
-rw-r--r--librpc/ndr/ndr_witness.c110
-rw-r--r--librpc/ndr/ndr_witness.h23
-rw-r--r--librpc/ndr/ndr_wmi.c60
-rw-r--r--librpc/ndr/ndr_wmi.h24
-rw-r--r--librpc/ndr/ndr_xattr.c148
-rw-r--r--librpc/ndr/ndr_xattr.h37
-rw-r--r--librpc/ndr/util.c36
-rw-r--r--librpc/ndr/uuid.c258
-rw-r--r--librpc/ndr_krb5pac.pc.in11
-rw-r--r--librpc/ndr_nbt.pc.in11
-rw-r--r--librpc/ndr_standard.pc.in11
-rw-r--r--librpc/rpc/binding.c1459
-rw-r--r--librpc/rpc/binding_handle.c568
-rw-r--r--librpc/rpc/dcerpc_error.c153
-rw-r--r--librpc/rpc/dcerpc_helper.c132
-rw-r--r--librpc/rpc/dcerpc_helper.h26
-rw-r--r--librpc/rpc/dcerpc_pkt_auth.c500
-rw-r--r--librpc/rpc/dcerpc_pkt_auth.h59
-rw-r--r--librpc/rpc/dcerpc_samr.h42
-rw-r--r--librpc/rpc/dcerpc_util.c1140
-rw-r--r--librpc/rpc/dcerpc_util.h85
-rw-r--r--librpc/rpc/dcesrv_auth.c703
-rw-r--r--librpc/rpc/dcesrv_core.c3160
-rw-r--r--librpc/rpc/dcesrv_core.h669
-rw-r--r--librpc/rpc/dcesrv_handles.c372
-rw-r--r--librpc/rpc/dcesrv_mgmt.c125
-rw-r--r--librpc/rpc/dcesrv_reply.c265
-rw-r--r--librpc/rpc/rpc_common.h410
-rw-r--r--librpc/rpc/server/netlogon/schannel_util.c570
-rw-r--r--librpc/rpc/server/netlogon/schannel_util.h54
-rwxr-xr-xlibrpc/tables.pl87
-rw-r--r--librpc/tests/test_ndr.c142
-rw-r--r--librpc/tests/test_ndr_dns_nbt.c236
-rw-r--r--librpc/tests/test_ndr_macros.c136
-rw-r--r--librpc/tests/test_ndr_string.c207
-rw-r--r--librpc/tools/ndrdump.1.xml89
-rw-r--r--librpc/tools/ndrdump.c793
-rw-r--r--librpc/tools/wscript_build7
-rw-r--r--librpc/wscript_build773
212 files changed, 65776 insertions, 0 deletions
diff --git a/librpc/ABI/ndr-0.0.1.sigs b/librpc/ABI/ndr-0.0.1.sigs
new file mode 100644
index 0000000..904be70
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.1.sigs
@@ -0,0 +1,245 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.0.2.sigs b/librpc/ABI/ndr-0.0.2.sigs
new file mode 100644
index 0000000..66be5ba
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.2.sigs
@@ -0,0 +1,247 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.0.3.sigs b/librpc/ABI/ndr-0.0.3.sigs
new file mode 100644
index 0000000..d9c76f0
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.3.sigs
@@ -0,0 +1,251 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.0.4.sigs b/librpc/ABI/ndr-0.0.4.sigs
new file mode 100644
index 0000000..c1b880f
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.4.sigs
@@ -0,0 +1,252 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.0.5.sigs b/librpc/ABI/ndr-0.0.5.sigs
new file mode 100644
index 0000000..36a4e30
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.5.sigs
@@ -0,0 +1,255 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.0.6.sigs b/librpc/ABI/ndr-0.0.6.sigs
new file mode 100644
index 0000000..a9b27a3
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.6.sigs
@@ -0,0 +1,256 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.0.7.sigs b/librpc/ABI/ndr-0.0.7.sigs
new file mode 100644
index 0000000..c88a56e
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.7.sigs
@@ -0,0 +1,257 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.0.8.sigs b/librpc/ABI/ndr-0.0.8.sigs
new file mode 100644
index 0000000..6bf637c
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.8.sigs
@@ -0,0 +1,258 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.0.9.sigs b/librpc/ABI/ndr-0.0.9.sigs
new file mode 100644
index 0000000..b363b96
--- /dev/null
+++ b/librpc/ABI/ndr-0.0.9.sigs
@@ -0,0 +1,259 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list **, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list **, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.1.0.sigs b/librpc/ABI/ndr-0.1.0.sigs
new file mode 100644
index 0000000..80a3faf
--- /dev/null
+++ b/librpc/ABI/ndr-0.1.0.sigs
@@ -0,0 +1,259 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list *, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.1.1.sigs b/librpc/ABI/ndr-0.1.1.sigs
new file mode 100644
index 0000000..434e110
--- /dev/null
+++ b/librpc/ABI/ndr-0.1.1.sigs
@@ -0,0 +1,262 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list *, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.1.2.sigs b/librpc/ABI/ndr-0.1.2.sigs
new file mode 100644
index 0000000..bf9fdfc
--- /dev/null
+++ b/librpc/ABI/ndr-0.1.2.sigs
@@ -0,0 +1,263 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, int)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list *, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
diff --git a/librpc/ABI/ndr-0.2.0.sigs b/librpc/ABI/ndr-0.2.0.sigs
new file mode 100644
index 0000000..6346f2f
--- /dev/null
+++ b/librpc/ABI/ndr-0.2.0.sigs
@@ -0,0 +1,264 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, int)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list *, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
+ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/ABI/ndr-0.2.1.sigs b/librpc/ABI/ndr-0.2.1.sigs
new file mode 100644
index 0000000..b73a463
--- /dev/null
+++ b/librpc/ABI/ndr-0.2.1.sigs
@@ -0,0 +1,265 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_get_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, ...)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_get_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: uint32_t (struct ndr_pull *, const void *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, ...)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_get_switch_value: uint32_t (struct ndr_push *, const void *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, int)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_table_misc: name = 0xXXXX "misc", syntax_id = {uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0}, helpstring = 0xXXXX, num_calls = 0, calls = 0xXXXX <misc_calls>, num_public_structs = 10, public_structs = 0xXXXX <misc_public_structs>, endpoints = 0xXXXX <misc_endpoints>, authservices = 0xXXXX <misc_authservices>
+ndr_token_peek: uint32_t (struct ndr_token_list *, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
+ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/ABI/ndr-1.0.0.sigs b/librpc/ABI/ndr-1.0.0.sigs
new file mode 100644
index 0000000..bc7c3e8
--- /dev/null
+++ b/librpc/ABI/ndr-1.0.0.sigs
@@ -0,0 +1,263 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_zero: struct GUID (void)
+_ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, const char *, const char *, ...)
+_ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, const char *, const char *, ...)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_steal_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_steal_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, int)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list *, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
+ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/ABI/ndr-1.0.1.sigs b/librpc/ABI/ndr-1.0.1.sigs
new file mode 100644
index 0000000..8415085
--- /dev/null
+++ b/librpc/ABI/ndr-1.0.1.sigs
@@ -0,0 +1,264 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_to_ndr_buf: NTSTATUS (const struct GUID *, struct GUID_ndr_buf *)
+GUID_zero: struct GUID (void)
+_ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, const char *, const char *, ...)
+_ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, const char *, const char *, ...)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_steal_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_steal_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, int)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list *, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
+ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/ABI/ndr-1.0.2.sigs b/librpc/ABI/ndr-1.0.2.sigs
new file mode 100644
index 0000000..0ec8575
--- /dev/null
+++ b/librpc/ABI/ndr-1.0.2.sigs
@@ -0,0 +1,265 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_to_ndr_buf: NTSTATUS (const struct GUID *, struct GUID_ndr_buf *)
+GUID_zero: struct GUID (void)
+_ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, const char *, const char *, ...)
+_ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, const char *, const char *, ...)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_length: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: uint32_t (struct ndr_pull *, const void *)
+ndr_get_array_size: uint32_t (struct ndr_pull *, const void *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_steal_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_steal_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, int)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_buf_string: char *(const struct ndr_syntax_id *, struct ndr_syntax_id_buf *)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_peek: uint32_t (struct ndr_token_list *, const void *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
+ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/ABI/ndr-2.0.0.sigs b/librpc/ABI/ndr-2.0.0.sigs
new file mode 100644
index 0000000..aefe5aa
--- /dev/null
+++ b/librpc/ABI/ndr-2.0.0.sigs
@@ -0,0 +1,269 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_to_ndr_buf: NTSTATUS (const struct GUID *, struct GUID_ndr_buf *)
+GUID_zero: struct GUID (void)
+_ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, const char *, const char *, ...)
+_ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, const char *, const char *, ...)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_steal_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_check_steal_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_get_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: void (ndr_print_fn_t, const char *, void *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_steal_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_steal_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, int)
+ndr_steal_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_steal_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_buf_string: char *(const struct ndr_syntax_id *, struct ndr_syntax_id_buf *)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_max_list_size: size_t (void)
+ndr_token_peek: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
+ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/ABI/ndr-3.0.0.sigs b/librpc/ABI/ndr-3.0.0.sigs
new file mode 100644
index 0000000..d3f3eca
--- /dev/null
+++ b/librpc/ABI/ndr-3.0.0.sigs
@@ -0,0 +1,269 @@
+GUID_all_zero: bool (const struct GUID *)
+GUID_buf_string: char *(const struct GUID *, struct GUID_txt_buf *)
+GUID_compare: int (const struct GUID *, const struct GUID *)
+GUID_equal: bool (const struct GUID *, const struct GUID *)
+GUID_from_data_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_ndr_blob: NTSTATUS (const DATA_BLOB *, struct GUID *)
+GUID_from_string: NTSTATUS (const char *, struct GUID *)
+GUID_hexstring: char *(TALLOC_CTX *, const struct GUID *)
+GUID_random: struct GUID (void)
+GUID_string: char *(TALLOC_CTX *, const struct GUID *)
+GUID_string2: char *(TALLOC_CTX *, const struct GUID *)
+GUID_to_ndr_blob: NTSTATUS (const struct GUID *, TALLOC_CTX *, DATA_BLOB *)
+GUID_to_ndr_buf: NTSTATUS (const struct GUID *, struct GUID_ndr_buf *)
+GUID_zero: struct GUID (void)
+_ndr_pull_error: enum ndr_err_code (struct ndr_pull *, enum ndr_err_code, const char *, const char *, const char *, ...)
+_ndr_push_error: enum ndr_err_code (struct ndr_push *, enum ndr_err_code, const char *, const char *, const char *, ...)
+ndr_align_size: size_t (uint32_t, size_t)
+ndr_charset_length: uint32_t (const void *, charset_t)
+ndr_check_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_check_padding: void (struct ndr_pull *, size_t)
+ndr_check_pipe_chunk_trailer: enum ndr_err_code (struct ndr_pull *, int, uint32_t)
+ndr_check_steal_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_check_steal_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_check_string_terminator: enum ndr_err_code (struct ndr_pull *, uint32_t, uint32_t)
+ndr_get_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_get_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_map_error2errno: int (enum ndr_err_code)
+ndr_map_error2ntstatus: NTSTATUS (enum ndr_err_code)
+ndr_map_error2string: const char *(enum ndr_err_code)
+ndr_policy_handle_empty: bool (const struct policy_handle *)
+ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy_handle *)
+ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
+ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
+ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
+ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
+ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
+ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_NTTIME_hyper: void (struct ndr_print *, const char *, NTTIME)
+ndr_print_WERROR: void (struct ndr_print *, const char *, WERROR)
+ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, uint32_t)
+ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t)
+ndr_print_bool: void (struct ndr_print *, const char *, const bool)
+ndr_print_debug: bool (int, ndr_print_fn_t, const char *, void *, const char *, const char *)
+ndr_print_debug_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *)
+ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_dlong: void (struct ndr_print *, const char *, int64_t)
+ndr_print_double: void (struct ndr_print *, const char *, double)
+ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t)
+ndr_print_function_debug: void (ndr_print_function_t, const char *, int, void *)
+ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, int, void *)
+ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t)
+ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_int16: void (struct ndr_print *, const char *, int16_t)
+ndr_print_int32: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int3264: void (struct ndr_print *, const char *, int32_t)
+ndr_print_int8: void (struct ndr_print *, const char *, int8_t)
+ndr_print_ipv4address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ipv6address: void (struct ndr_print *, const char *, const char *)
+ndr_print_ndr_syntax_id: void (struct ndr_print *, const char *, const struct ndr_syntax_id *)
+ndr_print_netr_SamDatabaseID: void (struct ndr_print *, const char *, enum netr_SamDatabaseID)
+ndr_print_netr_SchannelType: void (struct ndr_print *, const char *, enum netr_SchannelType)
+ndr_print_null: void (struct ndr_print *)
+ndr_print_pointer: void (struct ndr_print *, const char *, void *)
+ndr_print_policy_handle: void (struct ndr_print *, const char *, const struct policy_handle *)
+ndr_print_printf_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_ptr: void (struct ndr_print *, const char *, const void *)
+ndr_print_set_switch_value: enum ndr_err_code (struct ndr_print *, const void *, uint32_t)
+ndr_print_sockaddr_storage: void (struct ndr_print *, const char *, const struct sockaddr_storage *)
+ndr_print_steal_switch_value: uint32_t (struct ndr_print *, const void *)
+ndr_print_string: void (struct ndr_print *, const char *, const char *)
+ndr_print_string_array: void (struct ndr_print *, const char *, const char **)
+ndr_print_string_helper: void (struct ndr_print *, const char *, ...)
+ndr_print_struct: void (struct ndr_print *, const char *, const char *)
+ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *)
+ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_time_t: void (struct ndr_print *, const char *, time_t)
+ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *)
+ndr_print_timeval: void (struct ndr_print *, const char *, const struct timeval *)
+ndr_print_udlong: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_udlongr: void (struct ndr_print *, const char *, uint64_t)
+ndr_print_uid_t: void (struct ndr_print *, const char *, uid_t)
+ndr_print_uint16: void (struct ndr_print *, const char *, uint16_t)
+ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t)
+ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t)
+ndr_print_union: void (struct ndr_print *, const char *, int, const char *)
+ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *)
+ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *)
+ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *)
+ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
+ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, int, DATA_BLOB *)
+ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, int, struct GUID *)
+ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, int, HRESULT *)
+ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, struct KRB5_EDATA_NTSTATUS *)
+ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, int, NTSTATUS *)
+ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *)
+ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *)
+ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t)
+ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *)
+ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t)
+ndr_pull_bytes: enum ndr_err_code (struct ndr_pull *, uint8_t *, uint32_t)
+ndr_pull_charset: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_charset_to_null: enum ndr_err_code (struct ndr_pull *, int, const char **, uint32_t, uint8_t, charset_t)
+ndr_pull_dlong: enum ndr_err_code (struct ndr_pull *, int, int64_t *)
+ndr_pull_double: enum ndr_err_code (struct ndr_pull *, int, double *)
+ndr_pull_enum_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_enum_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_enum_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_generic_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_get_relative_base_offset: uint32_t (struct ndr_pull *)
+ndr_pull_gid_t: enum ndr_err_code (struct ndr_pull *, int, gid_t *)
+ndr_pull_hyper: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_init_blob: struct ndr_pull *(const DATA_BLOB *, TALLOC_CTX *)
+ndr_pull_int16: enum ndr_err_code (struct ndr_pull *, int, int16_t *)
+ndr_pull_int32: enum ndr_err_code (struct ndr_pull *, int, int32_t *)
+ndr_pull_int8: enum ndr_err_code (struct ndr_pull *, int, int8_t *)
+ndr_pull_ipv4address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ipv6address: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_ndr_syntax_id: enum ndr_err_code (struct ndr_pull *, int, struct ndr_syntax_id *)
+ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum netr_SamDatabaseID *)
+ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *)
+ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **)
+ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *)
+ndr_pull_pop: enum ndr_err_code (struct ndr_pull *)
+ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *)
+ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_relative_ptr_short: enum ndr_err_code (struct ndr_pull *, uint16_t *)
+ndr_pull_restore_relative_base_offset: void (struct ndr_pull *, uint32_t)
+ndr_pull_set_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t)
+ndr_pull_setup_relative_base_offset2: enum ndr_err_code (struct ndr_pull *, const void *)
+ndr_pull_steal_switch_value: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_pull_string: enum ndr_err_code (struct ndr_pull *, int, const char **)
+ndr_pull_string_array: enum ndr_err_code (struct ndr_pull *, int, const char ***)
+ndr_pull_struct_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, ndr_pull_flags_fn_t)
+ndr_pull_struct_blob_all_noalloc: enum ndr_err_code (const DATA_BLOB *, void *, ndr_pull_flags_fn_t)
+ndr_pull_subcontext_end: enum ndr_err_code (struct ndr_pull *, struct ndr_pull *, size_t, ssize_t)
+ndr_pull_subcontext_start: enum ndr_err_code (struct ndr_pull *, struct ndr_pull **, size_t, ssize_t)
+ndr_pull_svcctl_ServerType: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_time_t: enum ndr_err_code (struct ndr_pull *, int, time_t *)
+ndr_pull_timespec: enum ndr_err_code (struct ndr_pull *, int, struct timespec *)
+ndr_pull_timeval: enum ndr_err_code (struct ndr_pull *, int, struct timeval *)
+ndr_pull_trailer_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_udlong: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_udlongr: enum ndr_err_code (struct ndr_pull *, int, uint64_t *)
+ndr_pull_uid_t: enum ndr_err_code (struct ndr_pull *, int, uid_t *)
+ndr_pull_uint16: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint1632: enum ndr_err_code (struct ndr_pull *, int, uint16_t *)
+ndr_pull_uint32: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint3264: enum ndr_err_code (struct ndr_pull *, int, uint32_t *)
+ndr_pull_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *)
+ndr_pull_union_align: enum ndr_err_code (struct ndr_pull *, size_t)
+ndr_pull_union_blob: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_union_blob_all: enum ndr_err_code (const DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_pull_flags_fn_t)
+ndr_pull_winreg_Data: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data *)
+ndr_pull_winreg_Data_GPO: enum ndr_err_code (struct ndr_pull *, int, union winreg_Data_GPO *)
+ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, int, enum winreg_Type *)
+ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, int, DATA_BLOB)
+ndr_push_GUID: enum ndr_err_code (struct ndr_push *, int, const struct GUID *)
+ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, int, HRESULT)
+ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, const struct KRB5_EDATA_NTSTATUS *)
+ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, int, NTSTATUS)
+ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_NTTIME_hyper: enum ndr_err_code (struct ndr_push *, int, NTTIME)
+ndr_push_WERROR: enum ndr_err_code (struct ndr_push *, int, WERROR)
+ndr_push_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_array_uint8: enum ndr_err_code (struct ndr_push *, int, const uint8_t *, uint32_t)
+ndr_push_blob: DATA_BLOB (struct ndr_push *)
+ndr_push_bytes: enum ndr_err_code (struct ndr_push *, const uint8_t *, uint32_t)
+ndr_push_charset: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_charset_to_null: enum ndr_err_code (struct ndr_push *, int, const char *, uint32_t, uint8_t, charset_t)
+ndr_push_dlong: enum ndr_err_code (struct ndr_push *, int, int64_t)
+ndr_push_double: enum ndr_err_code (struct ndr_push *, int, double)
+ndr_push_enum_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_enum_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_enum_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_expand: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_push_full_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_get_relative_base_offset: uint32_t (struct ndr_push *)
+ndr_push_gid_t: enum ndr_err_code (struct ndr_push *, int, gid_t)
+ndr_push_hyper: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_init_ctx: struct ndr_push *(TALLOC_CTX *)
+ndr_push_int16: enum ndr_err_code (struct ndr_push *, int, int16_t)
+ndr_push_int32: enum ndr_err_code (struct ndr_push *, int, int32_t)
+ndr_push_int8: enum ndr_err_code (struct ndr_push *, int, int8_t)
+ndr_push_ipv4address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ipv6address: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_ndr_syntax_id: enum ndr_err_code (struct ndr_push *, int, const struct ndr_syntax_id *)
+ndr_push_netr_SamDatabaseID: enum ndr_err_code (struct ndr_push *, int, enum netr_SamDatabaseID)
+ndr_push_netr_SchannelType: enum ndr_err_code (struct ndr_push *, int, enum netr_SchannelType)
+ndr_push_pipe_chunk_trailer: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_pointer: enum ndr_err_code (struct ndr_push *, int, void *)
+ndr_push_policy_handle: enum ndr_err_code (struct ndr_push *, int, const struct policy_handle *)
+ndr_push_ref_ptr: enum ndr_err_code (struct ndr_push *)
+ndr_push_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_end: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_relative_ptr2_start: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_restore_relative_base_offset: void (struct ndr_push *, uint32_t)
+ndr_push_set_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, const void *, uint32_t)
+ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_steal_switch_value: enum ndr_err_code (struct ndr_push *, const void *, uint32_t *)
+ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
+ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
+ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
+ndr_push_struct_into_fixed_blob: enum ndr_err_code (DATA_BLOB *, const void *, ndr_push_flags_fn_t)
+ndr_push_subcontext_end: enum ndr_err_code (struct ndr_push *, struct ndr_push *, size_t, ssize_t)
+ndr_push_subcontext_start: enum ndr_err_code (struct ndr_push *, struct ndr_push **, size_t, ssize_t)
+ndr_push_svcctl_ServerType: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_time_t: enum ndr_err_code (struct ndr_push *, int, time_t)
+ndr_push_timespec: enum ndr_err_code (struct ndr_push *, int, const struct timespec *)
+ndr_push_timeval: enum ndr_err_code (struct ndr_push *, int, const struct timeval *)
+ndr_push_trailer_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_udlong: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_udlongr: enum ndr_err_code (struct ndr_push *, int, uint64_t)
+ndr_push_uid_t: enum ndr_err_code (struct ndr_push *, int, uid_t)
+ndr_push_uint16: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint1632: enum ndr_err_code (struct ndr_push *, int, uint16_t)
+ndr_push_uint32: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint3264: enum ndr_err_code (struct ndr_push *, int, uint32_t)
+ndr_push_uint8: enum ndr_err_code (struct ndr_push *, int, uint8_t)
+ndr_push_union_align: enum ndr_err_code (struct ndr_push *, size_t)
+ndr_push_union_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, void *, uint32_t, ndr_push_flags_fn_t)
+ndr_push_unique_ptr: enum ndr_err_code (struct ndr_push *, const void *)
+ndr_push_winreg_Data: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)
+ndr_push_winreg_Data_GPO: enum ndr_err_code (struct ndr_push *, int, const union winreg_Data_GPO *)
+ndr_push_winreg_Type: enum ndr_err_code (struct ndr_push *, int, enum winreg_Type)
+ndr_push_zero: enum ndr_err_code (struct ndr_push *, uint32_t)
+ndr_set_flags: void (uint32_t *, uint32_t)
+ndr_size_DATA_BLOB: uint32_t (int, const DATA_BLOB *, int)
+ndr_size_GUID: size_t (const struct GUID *, int)
+ndr_size_string: uint32_t (int, const char * const *, int)
+ndr_size_string_array: size_t (const char **, uint32_t, int)
+ndr_size_struct: size_t (const void *, int, ndr_push_flags_fn_t)
+ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t)
+ndr_size_winreg_Data_GPO: size_t (const union winreg_Data_GPO *, uint32_t, int)
+ndr_steal_array_length: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_steal_array_size: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t *)
+ndr_string_array_size: size_t (struct ndr_push *, const char *)
+ndr_string_length: uint32_t (const void *, uint32_t)
+ndr_syntax_id_buf_string: char *(const struct ndr_syntax_id *, struct ndr_syntax_id_buf *)
+ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *)
+ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *)
+ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0
+ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *)
+ndr_token_max_list_size: size_t (void)
+ndr_token_peek: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *)
+ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
+ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
+ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
+ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
+ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/binding-strings.txt b/librpc/binding-strings.txt
new file mode 100644
index 0000000..ca3d1b6
--- /dev/null
+++ b/librpc/binding-strings.txt
@@ -0,0 +1,4 @@
+DCERPC binding strings
+----------------------
+
+Please consult the rpcclient(1) manpage for binding string details.
diff --git a/librpc/gen_ndr/README b/librpc/gen_ndr/README
new file mode 100644
index 0000000..5ccb89d
--- /dev/null
+++ b/librpc/gen_ndr/README
@@ -0,0 +1,4 @@
+This contains the generated files from PIDL for the IDL files in ../idl/*.idl
+
+DO NOT REMOVE THIS FILE. The waf 1.5 build relies on this directory
+existing in the source tree.
diff --git a/librpc/idl/IDL_LICENSE.txt b/librpc/idl/IDL_LICENSE.txt
new file mode 100644
index 0000000..01ae670
--- /dev/null
+++ b/librpc/idl/IDL_LICENSE.txt
@@ -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.
diff --git a/librpc/idl/ODJ.idl b/librpc/idl/ODJ.idl
new file mode 100644
index 0000000..00c731b
--- /dev/null
+++ b/librpc/idl/ODJ.idl
@@ -0,0 +1,268 @@
+/*
+ The MIT License (MIT)
+ Copyright (c) Microsoft Corporation
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
+ associated documentation files (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or substantial
+ portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ The Offline Domain Join IDL has been derived from :
+
+ https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/NetMgmt/odj-idl.md
+*/
+
+import "misc.idl", "lsa.idl", "netlogon.idl", "security.idl";
+
+#include "idl_types.h"
+
+cpp_quote("#define OP_JP2_FLAG_PERSISTENTSITE 0x00000001")
+
+[
+ uuid("11111111-3333-5555-7777-99999999"),
+ version(0.0),
+ pointer_default(unique),
+ helpstring("Offline Domain Join IDL"),
+ helper("../librpc/ndr/ndr_ODJ.h")
+]
+interface ODJ
+{
+ typedef struct {
+ uint32 cbBlob;
+ [size_is(cbBlob),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pBlob;
+ } OP_BLOB;
+
+ /* Contains a serialized ODJ_WIN7_BLOB structure. */
+ const string ODJ_GUID_JOIN_PROVIDER = "{631c7621-5289-4321-bc9e-80f843f868c3}";
+
+ /* Contains a serialized OP_JOIN_PROV2_PART structure. */
+ const string ODJ_GUID_JOIN_PROVIDER2 = "{57BFC56B-52F9-480C-ADCB-91B3F8A82317}";
+
+ /* Contains a serialized OP_JOIN_PROV3_PART structure. */
+ const string ODJ_GUID_JOIN_PROVIDER3 = "{FC0CCF25-7FFA-474A-8611-69FFE269645F}";
+
+ /* Contains a serialized OP_CERT_PART structure. */
+ const string ODJ_GUID_CERT_PROVIDER = "{9c0971e9-832f-4873-8e87-ef1419d4781e}";
+
+ /* Contains a serialized OP_POLICY_PART structure. */
+ const string ODJ_GUID_POLICY_PROVIDER = "{68fb602a-0c09-48ce-b75f-07b7bd58f7ec}";
+
+#if 0
+ typedef struct {
+ char Value[6];
+ } SID_IDENTIFIER_AUTHORITY;
+
+ typedef struct {
+ char Revision;
+ char SubAuthorityCount;
+ SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
+ [size_is(SubAuthorityCount)] uint32 SubAuthority[*];
+ } ODJ_SID;
+
+ typedef struct {
+ USHORT Length;
+ USHORT MaximumLength;
+ [size_is(MaximumLength/2), length_is(Length/2)] PWSTR Buffer;
+ } ODJ_UNICODE_STRING;
+#endif
+#define ODJ_SID dom_sid2
+#define ODJ_UNICODE_STRING lsa_StringLarge
+
+#define ODJ_DECLARE_SERIALIZED_PTR(el_name) \
+ typedef [public] struct { \
+ el_name *p; \
+ } el_name ##_ctr; \
+ \
+ typedef [public,gensize] struct { \
+ [subcontext(0xFFFFFC01)] el_name ## _ctr s; \
+ } el_name ## _serialized_ptr;
+
+ typedef struct {
+ ODJ_UNICODE_STRING Name;
+ ODJ_UNICODE_STRING DnsDomainName;
+ ODJ_UNICODE_STRING DnsForestName;
+ GUID DomainGuid;
+ ODJ_SID *Sid;
+ } ODJ_POLICY_DNS_DOMAIN_INFO;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *lpDomain;
+ [string,charset(UTF16)] uint16 *lpMachineName;
+ [string,charset(UTF16)] [flag(NDR_SECRET)] uint16 *lpMachinePassword;
+ /*
+ * Not sure whether the following 4 bytes are padding or a
+ * pointer, at least it's value may not be 0 for Windows to accept our
+ * generated win7blobs - gd
+ */
+#if 0
+ [flag(NDR_ALIGN8)] DATA_BLOB _pad;
+#else
+ [value(0xffffffff)] uint32 _pad;
+#endif
+ ODJ_POLICY_DNS_DOMAIN_INFO DnsDomainInfo;
+ netr_DsRGetDCNameInfo DcInfo;
+ DWORD Options;
+ } ODJ_WIN7BLOB;
+
+ typedef ODJ_WIN7BLOB *PODJ_WIN7BLOB;
+
+ typedef struct {
+ DWORD dwFlags;
+ [string,charset(UTF16)] uint16 *lpNetbiosName;
+ [string,charset(UTF16)] uint16 *lpSiteName;
+ [string,charset(UTF16)] uint16 *lpPrimaryDNSDomain;
+ DWORD dwReserved;
+ [string,charset(UTF16)] uint16 *lpReserved;
+ } OP_JOINPROV2_PART;
+
+ typedef struct {
+ DWORD Rid;
+ [string,charset(UTF16)] uint16 *lpSid;
+ } OP_JOINPROV3_PART;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *pKeyPath;
+ [string,charset(UTF16)] uint16 *pValueName;
+ winreg_Type ulValueType;
+ uint32 cbValueData;
+ [size_is(cbValueData),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pValueData;
+ } OP_POLICY_ELEMENT;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *pSource;
+ uint32 ulRootKeyId;
+ uint32 cElements;
+ [size_is(cElements)] OP_POLICY_ELEMENT *pElements;
+ } OP_POLICY_ELEMENT_LIST;
+
+ typedef struct {
+ uint32 cElementLists;
+ [size_is(cElementLists)]
+ OP_POLICY_ELEMENT_LIST *pElementLists;
+ OP_BLOB Extension;
+ } OP_POLICY_PART;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *pTemplateName;
+ uint32 ulPrivateKeyExportPolicy;
+ [string,charset(UTF16)] uint16 *pPolicyServerUrl;
+ uint32 ulPolicyServerUrlFlags;
+ [string,charset(UTF16)] uint16 *pPolicyServerId;
+ uint32 cbPfx;
+ [size_is(cbPfx)] uint8 *pPfx;
+ } OP_CERT_PFX_STORE;
+
+ typedef struct {
+ uint32 StoreLocation;
+ [string,charset(UTF16)] uint16 *pStoreName;
+ uint32 cbSst;
+ [size_is(cbSst)] uint8 *pSst;
+ } OP_CERT_SST_STORE;
+
+ typedef struct {
+ uint32 cPfxStores;
+ [size_is(cPfxStores)] OP_CERT_PFX_STORE *pPfxStores;
+ uint32 cSstStores;
+ [size_is(cSstStores)] OP_CERT_SST_STORE *pSstStores;
+ OP_BLOB Extension;
+ } OP_CERT_PART;
+
+ ODJ_DECLARE_SERIALIZED_PTR(ODJ_WIN7BLOB)
+ ODJ_DECLARE_SERIALIZED_PTR(OP_JOINPROV2_PART)
+ ODJ_DECLARE_SERIALIZED_PTR(OP_JOINPROV3_PART)
+ ODJ_DECLARE_SERIALIZED_PTR(OP_POLICY_PART)
+ ODJ_DECLARE_SERIALIZED_PTR(OP_CERT_PART)
+
+ typedef [public,nodiscriminant,gensize] union {
+ [case(1)] [subcontext(0xFFFFFC01)] ODJ_WIN7BLOB win7blob;
+ [case(2)] [subcontext(0xFFFFFC01)] OP_JOINPROV2_PART_ctr join_prov2;
+ [case(3)] [subcontext(0xFFFFFC01)] OP_JOINPROV3_PART_ctr join_prov3;
+ [case(4)] [subcontext(0xFFFFFC01)] OP_CERT_PART_ctr cert_part;
+ [case(5)] [subcontext(0xFFFFFC01)] OP_POLICY_PART_ctr policy_part;
+ [default];
+ } OP_PACKAGE_PART_u;
+
+ typedef [public,bitmap32bit] bitmap {
+ OPSPI_PACKAGE_PART_ESSENTIAL = 0x00000001
+ } ODJ_PackageFlags;
+
+ typedef struct {
+ GUID PartType;
+ uint32 ulFlags;
+#if 1
+ [value(ndr_size_OP_PACKAGE_PART_u(Part, odj_switch_level_from_guid(&PartType), 0))] uint32 part_len;
+ [subcontext(4),subcontext_size(part_len),switch_is(odj_switch_level_from_guid(&PartType))] OP_PACKAGE_PART_u *Part;
+#else
+ OP_BLOB Part;
+#endif
+ OP_BLOB Extension;
+ } OP_PACKAGE_PART;
+
+ ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE_PART)
+
+ typedef struct {
+ uint32 cParts;
+ [size_is(cParts)] OP_PACKAGE_PART *pParts;
+ OP_BLOB Extension;
+ } OP_PACKAGE_PART_COLLECTION;
+
+ ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE_PART_COLLECTION)
+
+ typedef struct {
+ [value(ndr_size_OP_PACKAGE_PART_COLLECTION_serialized_ptr(w, 0))] uint32 cbBlob;
+ [subcontext(4), subcontext_size(cbBlob)] OP_PACKAGE_PART_COLLECTION_serialized_ptr *w;
+ } OP_PACKAGE_PART_COLLECTION_blob;
+
+ typedef struct {
+ GUID EncryptionType;
+ OP_BLOB EncryptionContext;
+#if 1
+ OP_PACKAGE_PART_COLLECTION_blob WrappedPartCollection;
+#else
+ OP_BLOB WrappedPartCollection;
+#endif
+ uint32 cbDecryptedPartCollection;
+ OP_BLOB Extension;
+ } OP_PACKAGE;
+
+ ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE)
+
+ typedef [v1_enum,public] enum {
+ ODJ_WIN7_FORMAT = 0x00000001, /* blob is ODJ_WIN7BLOB */
+ ODJ_WIN8_FORMAT = 0x00000002 /* blob is OP_PACKAGE */
+ } ODJFormat;
+
+ typedef [public,nodiscriminant,gensize] union {
+ [case(ODJ_WIN7_FORMAT)] [subcontext(0xFFFFFC01)] ODJ_WIN7BLOB odj_win7blob;
+ [case(ODJ_WIN8_FORMAT)] [subcontext(0xFFFFFC01)] OP_PACKAGE_ctr op_package;
+ [default] [subcontext(0xFFFFFC01)] [flag(LIBNDR_FLAG_REMAINING)] DATA_BLOB blob;
+ } ODJ_BLOB_u;
+
+ typedef struct {
+ ODJFormat ulODJFormat;
+ [value(ndr_size_ODJ_BLOB_u(pBlob, ulODJFormat, 0))] uint32 cbBlob;
+#if 1
+ [switch_is(ulODJFormat), subcontext(4), subcontext_size(cbBlob)] ODJ_BLOB_u *pBlob;
+#else
+ [size_is(cbBlob),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pBlob;
+#endif
+ } ODJ_BLOB;
+
+ typedef [public] struct {
+ [value(1)] uint32 ulVersion;
+ uint32 ulcBlobs;
+ [size_is(ulcBlobs)] ODJ_BLOB *pBlobs;
+ } ODJ_PROVISION_DATA;
+
+ ODJ_DECLARE_SERIALIZED_PTR(ODJ_PROVISION_DATA)
+}
diff --git a/librpc/idl/atsvc.idl b/librpc/idl/atsvc.idl
new file mode 100644
index 0000000..75e1daa
--- /dev/null
+++ b/librpc/idl/atsvc.idl
@@ -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 */
+ [public] NTSTATUS atsvc_JobAdd(
+ [in,unique,string,charset(UTF16)] uint16 *servername,
+ [in] atsvc_JobInfo *job_info,
+ [out,ref] uint32 *job_id
+ );
+
+ /******************/
+ /* Function: 0x01 */
+ [public] 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 */
+ [public] 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
+ );
+}
diff --git a/librpc/idl/audiosrv.idl b/librpc/idl/audiosrv.idl
new file mode 100644
index 0000000..1b05986
--- /dev/null
+++ b/librpc/idl/audiosrv.idl
@@ -0,0 +1,23 @@
+[
+ uuid("0a74ef1c-41a4-4e06-83ae-dc74fb1cdd53"),
+ version(1.0),
+ pointer_default(unique),
+ helpstring("Audio Server")
+] interface audiosrv
+{
+ [todo] void audiosrv_CreatezoneFactoriesList();
+ [todo] void audiosrv_CreateGfxFactoriesList();
+ [todo] void audiosrv_CreateGfxList();
+ [todo] void audiosrv_RemoveGfx();
+ [todo] void audiosrv_AddGfx();
+ [todo] void audiosrv_ModifyGfx();
+ [todo] void audiosrv_OpenGfx();
+ [todo] void audiosrv_Logon();
+ [todo] void audiosrv_Logoff();
+ [todo] void audiosrv_RegisterSessionNotificationEvent();
+ [todo] void audiosrv_UnregisterSessionNotificationEvent();
+ [todo] void audiosrv_SessionConnectState();
+ [todo] void audiosrv_DriverOpenDrvRegKey();
+ [todo] void audiosrv_AdvisePreferredDeviceChange();
+ [todo] void audiosrv_GetPnpInfo();
+}
diff --git a/librpc/idl/auth.idl b/librpc/idl/auth.idl
new file mode 100644
index 0000000..59ed2c3
--- /dev/null
+++ b/librpc/idl/auth.idl
@@ -0,0 +1,144 @@
+#include "idl_types.h"
+
+/*
+ Authentication IDL structures
+
+ These are NOT public network structures, but it is helpful to define
+ these things in IDL. They may change without ABI breakage or
+ warning.
+
+*/
+
+import "misc.idl", "security.idl", "lsa.idl", "krb5pac.idl";
+[
+ pyhelper("librpc/ndr/py_auth.c"),
+ helper("../librpc/ndr/ndr_auth.h"),
+ helpstring("internal Samba authentication structures")
+]
+
+interface auth
+{
+ typedef [public] enum {
+ SEC_AUTH_METHOD_UNAUTHENTICATED = 0,
+ SEC_AUTH_METHOD_NTLM = 1,
+ SEC_AUTH_METHOD_KERBEROS = 2
+ } auth_method;
+
+ /* This is the parts of the session_info that don't change
+ * during local privilege and group manipulations */
+ typedef [public] struct {
+ [unique,charset(UTF8),string] char *account_name;
+ [unique,charset(UTF8),string] char *user_principal_name;
+ boolean8 user_principal_constructed;
+ [unique,charset(UTF8),string] char *domain_name;
+ [unique,charset(UTF8),string] char *dns_domain_name;
+
+ [unique,charset(UTF8),string] char *full_name;
+ [unique,charset(UTF8),string] char *logon_script;
+ [unique,charset(UTF8),string] char *profile_path;
+ [unique,charset(UTF8),string] char *home_directory;
+ [unique,charset(UTF8),string] char *home_drive;
+ [unique,charset(UTF8),string] char *logon_server;
+
+ NTTIME last_logon;
+ NTTIME last_logoff;
+ NTTIME acct_expiry;
+ NTTIME last_password_change;
+ NTTIME allow_password_change;
+ NTTIME force_password_change;
+
+ uint16 logon_count;
+ uint16 bad_password_count;
+
+ uint32 acct_flags;
+
+ uint8 authenticated;
+ } auth_user_info;
+
+ /* This information is preserved only to assist torture tests */
+ typedef [public] struct {
+ /* Number SIDs from the DC netlogon validation info */
+ uint32 num_dc_sids;
+ [size_is(num_dc_sids)] dom_sid dc_sids[*];
+ } auth_user_info_torture;
+
+ typedef [public] struct {
+ [unique,charset(UTF8),string] char *unix_name;
+
+ /*
+ * For performance reasons we keep an alpha_strcpy-sanitized version
+ * of the username around as long as the global variable current_user
+ * still exists. If we did not do keep this, we'd have to call
+ * alpha_strcpy whenever we do a become_user(), potentially on every
+ * smb request. See set_current_user_info in source3.
+ */
+ [unique,charset(UTF8),string] char *sanitized_username;
+ } auth_user_info_unix;
+
+ /*
+ * If the user was authenticated with a Kerberos ticket, this indicates
+ * the type of the ticket; TGT, or non-TGT (i.e. service ticket). If
+ * unset, the type is unknown. This indicator is useful for the KDC and
+ * the kpasswd service, which share the same account and keys. By
+ * ensuring it is provided with the appopriate ticket type, each service
+ * avoids accepting a ticket meant for the other.
+ *
+ * The heuristic used to determine the type is the presence or absence
+ * of a REQUESTER_SID buffer in the PAC; we use its presence to assume
+ * we have a TGT. This heuristic will fail for older Samba versions and
+ * Windows prior to Nov. 2021 updates, which lack support for this
+ * buffer.
+ */
+ typedef enum {
+ TICKET_TYPE_UNKNOWN = 0,
+ TICKET_TYPE_TGT = 1,
+ TICKET_TYPE_NON_TGT = 2
+ } ticket_type;
+
+ /* This is the interim product of the auth subsystem, before
+ * privileges and local groups are handled */
+ typedef [public] struct {
+ uint32 num_sids;
+ [size_is(num_sids)] dom_sid sids[*];
+ auth_user_info *info;
+ [noprint] DATA_BLOB user_session_key;
+ [noprint] DATA_BLOB lm_session_key;
+ ticket_type ticket_type;
+ } auth_user_info_dc;
+
+ typedef [public] struct {
+ security_token *security_token;
+ security_unix_token *unix_token;
+ auth_user_info *info;
+ auth_user_info_unix *unix_info;
+ [value(NULL), ignore] auth_user_info_torture *torture;
+
+ /* This is the final session key, as used by SMB signing, and
+ * (truncated to 16 bytes) encryption on the SAMR and LSA pipes
+ * when over ncacn_np.
+ * It is calculated by NTLMSSP from the session key in the info3,
+ * and is set from the Kerberos session key using
+ * krb5_auth_con_getremotesubkey().
+ *
+ * Bottom line, it is not the same as the session keys in info3.
+ */
+
+ [noprint] DATA_BLOB session_key;
+
+ [value(NULL), ignore] cli_credentials *credentials;
+
+ /*
+ * It is really handy to have our authorization code log a
+ * token that can be used to tie later requests together.
+ * We generate this in auth_generate_session_info()
+ */
+ GUID unique_session_token;
+
+ ticket_type ticket_type;
+ } auth_session_info;
+
+ typedef [public] struct {
+ auth_session_info *session_info;
+ [noprint] DATA_BLOB exported_gssapi_credentials;
+ } auth_session_info_transport;
+}
diff --git a/librpc/idl/backupkey.idl b/librpc/idl/backupkey.idl
new file mode 100644
index 0000000..3a43f47
--- /dev/null
+++ b/librpc/idl/backupkey.idl
@@ -0,0 +1,153 @@
+#include "idl_types.h"
+
+import "misc.idl", "security.idl";
+[
+ uuid("3dde7c30-165d-11d1-ab8f-00805f14db40"),
+ version(1.0),
+ endpoint("ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:"),
+ helpstring("Remote Backup Key Storage"),
+ helper("../librpc/ndr/ndr_backupkey.h"),
+ pointer_default(unique)
+]
+interface backupkey
+{
+ const string BACKUPKEY_RESTORE_GUID = "47270C64-2FC7-499B-AC5B-0E37CDCE899A";
+ const string BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID = "018FF48A-EABA-40C6-8F6D-72370240E967";
+
+ const string BACKUPKEY_RESTORE_GUID_WIN2K = "7FE94D50-178E-11D1-AB8F-00805F14DB40";
+ const string BACKUPKEY_BACKUP_GUID = "7F752B10-178E-11D1-AB8F-00805F14DB40";
+
+ /*
+ * The magic values are really what they are there is no name it's just remarkable values
+ * that are here to check that what is transmited or decoded is really what the client or
+ * the server expect.
+ */
+ [public] typedef struct {
+ [value(0x00000002)] uint32 header1;
+ [value(0x00000494)] uint32 header2;
+ uint32 certificate_len;
+ [value(0x00000207)] uint32 magic1;
+ [value(0x0000A400)] uint32 magic2;
+ [value(0x32415352)] uint32 magic3;
+ [value(0x00000800)] uint32 magic4;
+ [subcontext(0),subcontext_size(4),flag(NDR_REMAINING)] DATA_BLOB public_exponent;
+
+ [subcontext(0),subcontext_size(256),flag(NDR_REMAINING)] DATA_BLOB modulus;
+ [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB prime1;
+ [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB prime2;
+ [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB exponent1;
+ [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB exponent2;
+ [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB coefficient;
+ [subcontext(0),subcontext_size(256),flag(NDR_REMAINING)] DATA_BLOB private_exponent;
+ [subcontext(0),subcontext_size(certificate_len),flag(NDR_REMAINING)] DATA_BLOB cert;
+ } bkrp_exported_RSA_key_pair;
+
+ [public] typedef struct {
+ [value(0x00000001)] uint32 magic;
+ uint8 key[256];
+ } bkrp_dc_serverwrap_key;
+
+ [public] typedef struct {
+ } bkrp_empty;
+
+ [public,gensize] typedef struct {
+ uint32 version;
+ uint32 encrypted_secret_len;
+ uint32 access_check_len;
+ GUID guid;
+ uint8 encrypted_secret[encrypted_secret_len];
+ uint8 access_check[access_check_len];
+ } bkrp_client_side_wrapped;
+
+ [public] typedef struct {
+ [value(0x00000000)] uint32 magic;
+ [subcontext(0),flag(NDR_REMAINING)] DATA_BLOB secret;
+ } bkrp_client_side_unwrapped;
+
+ [public] typedef struct {
+ uint32 secret_len;
+ [value(0x00000020)] uint32 magic;
+ uint8 secret[secret_len];
+ uint8 payload_key[32];
+ } bkrp_encrypted_secret_v2;
+
+ [public] typedef struct {
+ uint32 secret_len;
+ [value(0x00000030)] uint32 magic1;
+ [value(0x00006610)] uint32 magic2;
+ [value(0x0000800e)] uint32 magic3;
+ uint8 secret[secret_len];
+ uint8 payload_key[48];
+ } bkrp_encrypted_secret_v3;
+
+ /* Due to alignement constraint we can generate the structure only via pidl*/
+ [public, nopush, nopull] typedef struct {
+ [value(0x00000001)] uint32 magic;
+ uint32 nonce_len;
+ uint8 nonce[nonce_len];
+ dom_sid sid;
+ uint8 hash[20];
+ } bkrp_access_check_v2;
+
+ /* Due to alignement constraint we can generate the structure only via pidl*/
+ [public,nopush,nopull] typedef struct {
+ [value(0x00000001)] uint32 magic;
+ uint32 nonce_len;
+ uint8 nonce[nonce_len];
+ dom_sid sid;
+ uint8 hash[64];
+ } bkrp_access_check_v3;
+
+ [public] typedef struct {
+ uint8 r3[32];
+ uint8 mac[20];
+ dom_sid sid;
+ [subcontext(0),flag(NDR_REMAINING)] DATA_BLOB secret_data;
+ } bkrp_rc4encryptedpayload;
+
+ [public] typedef struct {
+ [value(0x00000001)] uint32 magic;
+ uint32 payload_length;
+ uint32 ciphertext_length;
+ GUID guid;
+ uint8 r2[68];
+ uint8 rc4encryptedpayload[ciphertext_length];
+ } bkrp_server_side_wrapped;
+
+ [public] typedef struct {
+ [flag(NDR_REMAINING)] DATA_BLOB opaque;
+ } bkrp_opaque_blob;
+
+ typedef enum {
+ BACKUPKEY_SERVER_WRAP_VERSION = 1,
+ BACKUPKEY_CLIENT_WRAP_VERSION2 = 2,
+ BACKUPKEY_CLIENT_WRAP_VERSION3 = 3
+ } bkrp_versions;
+
+ typedef enum {
+ BACKUPKEY_INVALID_GUID_INTEGER = 0xFFFF,
+ BACKUPKEY_RESTORE_GUID_INTEGER = 0x0000,
+ BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER = 0x0001,
+ BACKUPKEY_RESTORE_GUID_WIN2K_INTEGER = 0x0002,
+ BACKUPKEY_BACKUP_GUID_INTEGER = 0x0003
+ } bkrp_guid_to_integer;
+
+ [public] typedef [nodiscriminant] union {
+ [case(BACKUPKEY_RESTORE_GUID_INTEGER)] bkrp_client_side_wrapped restore_req;
+ [case(BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER)] bkrp_empty empty;
+ [case(BACKUPKEY_RESTORE_GUID_WIN2K_INTEGER)] bkrp_server_side_wrapped unsign_req;
+ [case(BACKUPKEY_BACKUP_GUID_INTEGER)] bkrp_opaque_blob sign_req;
+ } bkrp_data_in_blob;
+
+ /******************/
+ /* Function: 0x00 */
+
+ [public, noprint] WERROR bkrp_BackupKey (
+ [in,ref] GUID *guidActionAgent,
+ [in,ref] [size_is(data_in_len)] uint8 *data_in,
+ [in] uint32 data_in_len,
+ [out,ref] [size_is(,*data_out_len)] uint8 **data_out,
+ [out,ref] uint32 *data_out_len,
+ [in] uint32 param
+ );
+}
diff --git a/librpc/idl/bkupblobs.idl b/librpc/idl/bkupblobs.idl
new file mode 100644
index 0000000..6e4dd98
--- /dev/null
+++ b/librpc/idl/bkupblobs.idl
@@ -0,0 +1,54 @@
+#include "idl_types.h"
+
+import "misc.idl";
+import "security.idl";
+import "fscc.idl";
+/* bkup blobs interface definition */
+
+
+[
+ pointer_default(unique),
+ helpstring("bkup blobs")
+]
+
+
+interface bkupblobs
+{
+ typedef [v1_enum] enum {
+ STREAM_ID_DATA = 1,
+ STREAM_ID_EX_DATA = 2,
+ STREAM_ID_SECURITY_DATA = 3,
+ STREAM_ID_ALTERNATE_DATA = 4,
+ STREAM_ID_LINK = 5,
+ STREAM_ID_OBJECTID = 7,
+ STREAM_ID_REPARSE_DATA = 8,
+ STREAM_ID_SPARSE_BLOCK = 9,
+ STREAM_ID_TXFS_DATA = 10
+ } bkup_StreamId;
+
+ typedef [v1_enum] enum {
+ STREAM_ATTRIBUTE_NORMAL = 0,
+ STREAM_ATTRIBUTE_SECURITY = 2,
+ STREAM_ATTRIBUTE_SPARSE = 8
+ } bkup_StreamAttribute;
+
+ typedef [nodiscriminant] union {
+ [default] DATA_BLOB blob;
+ [flag(NDR_ALIGN2),case(STREAM_ID_SECURITY_DATA)] security_descriptor sd;
+ [case(STREAM_ID_OBJECTID)] fscc_FileObjectIdBuffer_2 object;
+ } bkup_StreamData;
+
+ typedef [public] struct {
+ bkup_StreamId id;
+ bkup_StreamAttribute attribute;
+ hyper size;
+ uint32 stream_name_size;
+ [charset(UTF16),flag(STR_NOTERM)] uint16 stream_name[stream_name_size];
+ [subcontext(0), subcontext_size(size), switch_is(id)] [flag(NDR_REMAINING)] bkup_StreamData data;
+ } bkup_Win32StreamId;
+
+ typedef [nopush, nopull, flag(NDR_NOALIGN), public] struct {
+ uint32 num_stream;
+ bkup_Win32StreamId streams[num_stream];
+ } bkup_NTBackupFile;
+}
diff --git a/librpc/idl/browser.idl b/librpc/idl/browser.idl
new file mode 100644
index 0000000..94d4ce6
--- /dev/null
+++ b/librpc/idl/browser.idl
@@ -0,0 +1,86 @@
+import "srvsvc.idl";
+
+[
+ 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 */
+ [todo] void BrowserrServerEnum();
+
+ /******************/
+ /* Function 0x01 */
+ [todo] void BrowserrDebugCall();
+
+ /******************/
+ /* Function 0x02 */
+
+ typedef struct {
+ uint32 entries_read;
+ [size_is(entries_read)] srvsvc_NetSrvInfo100 *entries;
+ } BrowserrSrvInfo100Ctr;
+
+ typedef struct {
+ uint32 entries_read;
+ [size_is(entries_read)] srvsvc_NetSrvInfo101 *entries;
+ } BrowserrSrvInfo101Ctr;
+
+ typedef [switch_type(uint32)] union {
+ [case(100)] BrowserrSrvInfo100Ctr *info100;
+ [case(101)] BrowserrSrvInfo101Ctr *info101;
+ [default] ;
+ } BrowserrSrvInfoUnion;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] BrowserrSrvInfoUnion info;
+ } BrowserrSrvInfo;
+
+ WERROR BrowserrQueryOtherDomains(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,out,ref] BrowserrSrvInfo *info,
+ [out,ref] uint32 *total_entries
+ );
+
+ /******************/
+ /* Function 0x03 */
+ [todo] void BrowserrResetNetlogonState();
+
+ /******************/
+ /* Function 0x04 */
+ [todo] void BrowserrDebugTrace();
+
+ /******************/
+ /* Function 0x05 */
+ [todo] void BrowserrQueryStatistics();
+
+ /******************/
+ /* Function 0x06 */
+ [todo] void BrowserResetStatistics();
+
+ /******************/
+ /* Function 0x07 */
+ [todo] void NetrBrowserStatisticsClear();
+
+ /******************/
+ /* Function 0x08 */
+ [todo] void NetrBrowserStatisticsGet();
+
+ /******************/
+ /* Function 0x09 */
+ [todo] void BrowserrSetNetlogonState();
+
+ /******************/
+ /* Function 0x0a */
+ [todo] void BrowserrQueryEmulatedDomains();
+
+ /******************/
+ /* Function 0x0b */
+ [todo] void BrowserrServerEnumEx();
+
+}
diff --git a/librpc/idl/cab.idl b/librpc/idl/cab.idl
new file mode 100644
index 0000000..d08b535
--- /dev/null
+++ b/librpc/idl/cab.idl
@@ -0,0 +1,130 @@
+#include "idl_types.h"
+
+import "misc.idl";
+
+/*
+ IDL structures defining Cabinet files
+
+ more info can be found at:
+ https://msdn.microsoft.com/en-us/library/bb267310.aspx#cabinet_format
+*/
+
+[
+ pointer_default(unique),
+ helper("../librpc/ndr/ndr_cab.h"),
+ helpstring("Cabinet structure"),
+ uuid("12345678-0000-0000-0000-00000000")
+]
+ interface cab
+{
+
+ /*
+ * flags.cfhdrPREV_CABINET is set if this cabinet file is not the first in
+ * a set of cabinet files. When this bit is set, the szCabinetPrev and
+ * szDiskPrev fields are present in this CFHEADER.
+ *
+ * flags.cfhdrNEXT_CABINET is set if this cabinet file is not the last in a
+ * set of cabinet files. When this bit is set, the szCabinetNext and
+ * szDiskNext fields are present in this CFHEADER.
+ *
+ * flags.cfhdrRESERVE_PRESENT is set if this cabinet file contains any
+ * reserved fields. When this bit is set, the cbCFHeader, cbCFFolder, and
+ * cbCFData fields are present in this CFHEADER.
+ */
+
+ typedef [bitmap16bit] bitmap {
+ cfhdrPREV_CABINET = 0x0001,
+ cfhdrNEXT_CABINET = 0x0002,
+ cfhdrRESERVE_PRESENT = 0x0004
+ } cf_flags;
+
+ typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct {
+ [charset(DOS),value("MSCF")] uint8 signature[4];
+ [value(0)] uint32 reserved1; /* reserved */
+ uint32 cbCabinet; /* size of this cabinet file in bytes */
+ [value(0)] uint32 reserved2; /* reserved */
+ [value(cFolders*8+36)] uint32 coffFiles; /* offset of the first CFFILE entry */
+ [value(0)] uint32 reserved3; /* reserved */
+ [value(3)] uint8 versionMinor; /* cabinet file format version, minor */
+ [value(1)] uint8 versionMajor; /* cabinet file format version, major */
+ uint16 cFolders; /* number of CFFOLDER entries in this cabinet */
+ uint16 cFiles; /* number of CFFILE entries in this cabinet */
+ cf_flags flags; /* cabinet file option indicators */
+ uint16 setID; /* must be the same for all cabinets in a set */
+ uint16 iCabinet; /* number of this cabinet file in a set */
+#if 0
+ [range(0,60000)] uint16 cbCFHeader; /* (optional) size of per-cabinet reserved area */
+ [range(0,255)] uint8 cbCFFolder; /* (optional) size of per-folder reserved area */
+ [range(0,255)] uint8 cbCFData; /* (optional) size of per-datablock reserved area */
+ uint8 abReserve[]; /* (optional) per-cabinet reserved area */
+ uint8 szCabinetPrev[]; /* (optional) name of previous cabinet file */
+ uint8 szDiskPrev[]; /* (optional) name of previous disk */
+ uint8 szCabinetNext[]; /* (optional) name of next cabinet file */
+ uint8 szDiskNext[]; /* (optional) name of next disk */
+#endif
+ } CFHEADER;
+
+ typedef enum {
+ CF_COMPRESS_NONE = 0,
+ CF_COMPRESS_MSZIP = 1,
+ CF_COMPRESS_LZX = 4611
+ } cf_compress_type;
+
+ typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct {
+ uint32 coffCabStart; /* offset of the first CFDATA block in this folder */
+ uint16 cCFData; /* number of CFDATA blocks in this folder */
+ cf_compress_type typeCompress; /* compression type indicator */
+#if 0
+ uint8 abReserve[]; /* (optional) per-folder reserved area */
+#endif
+ } CFFOLDER;
+
+ const int ifoldCONTINUED_FROM_PREV = 0xFFFD;
+ const int ifoldCONTINUED_TO_NEXT = 0xFFFE;
+ const int ifoldCONTINUED_PREV_AND_NEXT = 0xFFFF;
+
+ typedef [bitmap16bit] bitmap {
+ _A_RDONLY = 0x01, /* file is read-only */
+ _A_HIDDEN = 0x02, /* file is hidden */
+ _A_SYSTEM = 0x04, /* file is a system file */
+ _A_ARCH = 0x20, /* file modified since last backup */
+ _A_EXEC = 0x40, /* run after extraction */
+ _A_NAME_IS_UTF = 0x80 /* szName[] contains UTF */
+ } cf_attributes;
+
+ typedef [noprint,flag(NDR_NOALIGN)] struct {
+ uint16 date;
+ } cf_date;
+
+ typedef [noprint,flag(NDR_NOALIGN)] struct {
+ uint16 time;
+ } cf_time;
+
+ typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN),gensize] struct {
+ uint32 cbFile; /* uncompressed size of this file in bytes */
+ uint32 uoffFolderStart; /* uncompressed offset of this file in the folder */
+ uint16 iFolder; /* index into the CFFOLDER area */
+ cf_date date; /* date stamp for this file */
+ cf_time time; /* time stamp for this file */
+ cf_attributes attribs; /* attribute flags for this file */
+ [flag(r->attribs & _A_NAME_IS_UTF ? STR_UTF8|STR_NULLTERM : STR_ASCII|STR_NULLTERM)] string szName;
+ } CFFILE;
+
+ typedef [flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN),nopull,nopush] struct {
+ uint32 csum; /* checksum of this CFDATA entry */
+ uint16 cbData; /* number of compressed bytes in this block */
+ uint16 cbUncomp; /* number of uncompressed bytes in this block */
+#if 0
+ uint8 abReserve[]; /* (optional) per-datablock reserved area */
+#endif
+ DATA_BLOB ab; /* compressed data bytes */
+ } CFDATA;
+
+ typedef [nopush,nopull,public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct {
+ CFHEADER cfheader;
+ CFFOLDER cffolders[cfheader.cFolders];
+ CFFILE cffiles[cfheader.cFiles];
+ [noprint,value(ndr_count_cfdata(r))] uint32 cfdata_count;
+ CFDATA cfdata[cfdata_count];
+ } cab_file;
+}
diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
new file mode 100644
index 0000000..7cc3f5f
--- /dev/null
+++ b/librpc/idl/clusapi.idl
@@ -0,0 +1,2962 @@
+import "winreg.idl", "misc.idl";
+
+#include "idl_types.h"
+
+[
+ uuid("b97db8b2-4c63-11cf-bff6-08002be23f2f"),
+ version(3.0),
+ pointer_default(unique),
+ endpoint("ncacn_ip_tcp:"),
+ authservice("MSServerClusterMgmtAPI"),
+ helpstring("Failover Cluster Management API (clusapi)")
+]
+#define MAX_CLUSTER_CONTROL_CODE_BUFFER_SIZE 0x7FFFFFFF
+ interface clusapi
+{
+#if 0
+ /*
+ * pidl does not yet have a real [context_handle] implementation, so we
+ * just use some defines here.
+ */
+
+ typedef [context_handle] void *HCLUSTER_RPC;
+ typedef [context_handle] void *HNODE_RPC;
+ typedef [context_handle] void *HGROUP_RPC;
+ typedef [context_handle] void *HRES_RPC;
+ typedef [context_handle] void *HKEY_RPC;
+ typedef [context_handle] void *HNOTIFY_RPC;
+ typedef [context_handle] void *HNETWORK_RPC;
+ typedef [context_handle] void *HNETINTERFACE_RPC;
+ typedef [context_handle] void *HBATCH_PORT_RPC;
+#else
+#define HCLUSTER_RPC policy_handle
+#define HNODE_RPC policy_handle
+#define HGROUP_RPC policy_handle
+#define HRES_RPC policy_handle
+#define HKEY_RPC policy_handle
+#define HNOTIFY_RPC policy_handle
+#define HNETWORK_RPC policy_handle
+#define HNETINTERFACE_RPC policy_handle
+#define HBATCH_PORT_RPC policy_handle
+#endif
+
+ typedef struct {
+ [ size_is( cbInSecurityDescriptor ), length_is( cbOutSecurityDescriptor ) ] uint8 *lpSecurityDescriptor;
+ uint32 cbInSecurityDescriptor;
+ uint32 cbOutSecurityDescriptor;
+ } RPC_SECURITY_DESCRIPTOR;
+
+ typedef struct {
+ uint32 nLength;
+ RPC_SECURITY_DESCRIPTOR RpcSecurityDescriptor;
+ long bInheritHandle;
+ } RPC_SECURITY_ATTRIBUTES;
+
+ typedef struct {
+ [value(20)] uint32 dwSize;
+ uint32 dwClusterHighestVersion;
+ uint32 dwClusterLowestVersion;
+ uint32 dwFlags;
+ uint32 dwReserved;
+ } CLUSTER_OPERATIONAL_VERSION_INFO;
+
+ typedef struct {
+ uint32 NodeId;
+ boolean8 SetAttempted;
+ uint32 ReturnStatus;
+ } IDL_CLUSTER_SET_PASSWORD_STATUS;
+
+ typedef enum {
+ IDL_CLUSTER_SET_PASSWORD_IGNORE_DOWN_NODES = 1
+ } IDL_CLUSTER_SET_PASSWORD_FLAGS;
+
+ typedef struct {
+ uint32 dwVersion;
+ uint32 dwGroupType;
+ } CLUSTER_CREATE_GROUP_INFO_RPC;
+
+ /*****************/
+ /* Function 0x00 */
+
+#if 0
+ /*
+ * pidl cannot generate code for functions that return structures in
+ * IDL, therefore pretend the function is void and add the returned
+ * structure as an out parameter. This is what we do with pretty much
+ * all the Open calls right now in this interface - gd
+ */
+
+ HCLUSTER_RPC
+ clusapi_OpenCluster(
+ [ out ] WERROR *Status
+ );
+#else
+ void
+ clusapi_OpenCluster(
+ [ out ] WERROR *Status,
+ [ out ] HCLUSTER_RPC *Cluster
+ );
+#endif
+
+ /*****************/
+ /* Function 0x01 */
+
+ WERROR
+ clusapi_CloseCluster(
+ [ in, out ] HCLUSTER_RPC *Cluster
+ );
+
+ /*****************/
+ /* Function 0x02 */
+
+ WERROR
+ clusapi_SetClusterName(
+ [ in, string ] [charset(UTF16)] uint16 *NewClusterName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x03 */
+
+ WERROR
+ clusapi_GetClusterName(
+ [ out, string ] [charset(UTF16)] uint16 **ClusterName,
+ [ out, string ] [charset(UTF16)] uint16 **NodeName
+ );
+
+ /*****************/
+ /* Function 0x04 */
+
+ WERROR
+ clusapi_GetClusterVersion(
+ [ out ] uint16 *lpwMajorVersion,
+ [ out ] uint16 *lpwMinorVersion,
+ [ out ] uint16 *lpwBuildNumber,
+ [ out, string ] [charset(UTF16)] uint16 **lpszVendorId,
+ [ out, string ] [charset(UTF16)] uint16 **lpszCSDVersion
+ );
+
+ /*****************/
+ /* Function 0x05 */
+
+ WERROR
+ clusapi_GetQuorumResource(
+ [ out, string ] [charset(UTF16)] uint16 **lpszResourceName,
+ [ out, string ] [charset(UTF16)] uint16 **lpszDeviceName,
+ [ out ] uint32 *pdwMaxQuorumLogSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x06 */
+
+ WERROR
+ clusapi_SetQuorumResource(
+ [ in ] HRES_RPC hResource,
+ [ in, string ] [charset(UTF16)] uint16 *lpszDeviceName,
+ [ in ] uint32 dwMaxQuorumLogSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ typedef [bitmap32bit] bitmap {
+ CLUSTER_ENUM_NODE = 0x00000001,
+ CLUSTER_ENUM_RESTYPE = 0x00000002,
+ CLUSTER_ENUM_RESOURCE = 0x00000004,
+ CLUSTER_ENUM_GROUP = 0x00000008,
+ CLUSTER_ENUM_NETWORK = 0x00000010,
+ CLUSTER_ENUM_NETINTERFACE = 0x00000020,
+ CLUSTER_ENUM_INTERNAL_NETWORK = 0x80000000,
+ CLUSTER_ENUM_SHARED_VOLUME_RESOURCE = 0x40000000
+ } ClusterEnumType;
+
+ typedef struct {
+ ClusterEnumType Type;
+ [string] [charset(UTF16)] uint16 *Name;
+ } ENUM_ENTRY;
+
+ typedef struct {
+ uint32 EntryCount;
+ [size_is(EntryCount)] ENUM_ENTRY Entry[*];
+ } ENUM_LIST;
+
+ typedef struct {
+ [string] [charset(UTF16)] uint16 *Name;
+ [string] [charset(UTF16)] uint16 *Id;
+ uint32 dwState;
+ [string] [charset(UTF16)] uint16 *Owner;
+ uint32 dwFlags;
+ uint32 cbProperties;
+ [size_is(cbProperties)] uint8* Properties;
+ uint32 cbRoProperties;
+ [size_is(cbRoProperties)] uint8* RoProperties;
+ } GROUP_ENUM_ENTRY;
+
+ typedef struct {
+ [string] [charset(UTF16)] uint16 *Name;
+ [string] [charset(UTF16)] uint16 *Id;
+ [string] [charset(UTF16)] uint16 *OwnerName;
+ [string] [charset(UTF16)] uint16 *OwnerId;
+ uint32 cbProperties;
+ [size_is(cbProperties)] uint8* Properties;
+ uint32 cbRoProperties;
+ [size_is(cbRoProperties)] uint8* RoProperties;
+ } RESOURCE_ENUM_ENTRY;
+
+ typedef struct {
+ uint32 EntryCount;
+ [size_is(EntryCount)] GROUP_ENUM_ENTRY Entry[*];
+ } GROUP_ENUM_LIST;
+
+ typedef struct {
+ uint32 EntryCount;
+ [size_is(EntryCount)] RESOURCE_ENUM_ENTRY Entry[*];
+ } RESOURCE_ENUM_LIST;
+
+ /*****************/
+ /* Function 0x07 */
+
+ WERROR
+ clusapi_CreateEnum(
+ [ in ] ClusterEnumType dwType,
+ [ out ] ENUM_LIST **ReturnEnum,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x08 */
+
+#if 0
+ HRES_RPC
+ clusapi_OpenResource(
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenResource(
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HRES_RPC *hResource
+ );
+#endif
+ /*****************/
+ /* Function 0x09 */
+
+ typedef [v1_enum] enum {
+ CLUSTER_RESOURCE_DEFAULT_MONITOR = 0x00000000,
+ CLUSTER_RESOURCE_SEPARATE_MONITOR = 0x00000001
+ } clusapi_CreateResourceFlags;
+
+#if 0
+ HRES_RPC
+ clusapi_CreateResource(
+ [ in ] HGROUP_RPC hGroup,
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceName,
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceType,
+ [ in ] clusapi_CreateResourceFlags dwFlags,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_CreateResource(
+ [ in ] HGROUP_RPC hGroup,
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceName,
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceType,
+ [ in ] clusapi_CreateResourceFlags dwFlags,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HRES_RPC *hResource
+ );
+#endif
+ /*****************/
+ /* Function 0x0A */
+
+ WERROR
+ clusapi_DeleteResource(
+ [ in ] HRES_RPC hResource,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x0B */
+
+ WERROR
+ clusapi_CloseResource(
+ [ in, out ] HRES_RPC *Resource
+ );
+
+ /*****************/
+ /* Function 0x0C */
+
+ typedef [v1_enum] enum {
+ ClusterResourceInitializing = 0x00000001,
+ ClusterResourceOnline = 0x00000002,
+ ClusterResourceOffline = 0x00000003,
+ ClusterResourceFailed = 0x00000004,
+ ClusterResourceOnlinePending = 0x00000081,
+ ClusterResourceOfflinePending = 0x00000082,
+ ClusterResourceStateUnknown = 0xFFFFFFFF
+ } clusapi_ClusterResourceState;
+
+ WERROR
+ clusapi_GetResourceState(
+ [ in ] HRES_RPC hResource,
+ [ out ] clusapi_ClusterResourceState *State,
+ [ out, string ] [charset(UTF16)] uint16 **NodeName,
+ [ out, string ] [charset(UTF16)] uint16 **GroupName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x0D */
+
+ WERROR
+ clusapi_SetResourceName(
+ [ in ] HRES_RPC hResource,
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x0E */
+
+ WERROR
+ clusapi_GetResourceId(
+ [ in ] HRES_RPC hResource,
+ [ out, string ] [charset(UTF16)] uint16 **pGuid,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x0F */
+
+ WERROR
+ clusapi_GetResourceType(
+ [ in ] HRES_RPC hResource,
+ [ out, string ] [charset(UTF16)] uint16 **lpszResourceType,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x10 */
+
+ WERROR
+ clusapi_FailResource(
+ [ in ] HRES_RPC hResource,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x11 */
+
+ WERROR
+ clusapi_OnlineResource(
+ [ in ] HRES_RPC hResource,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x12 */
+
+ WERROR
+ clusapi_OfflineResource(
+ [ in ] HRES_RPC hResource,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x13 */
+
+ WERROR
+ clusapi_AddResourceDependency(
+ [ in ] HRES_RPC hResource,
+ [ in ] HRES_RPC hDependsOn,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x14 */
+
+ WERROR
+ clusapi_RemoveResourceDependency(
+ [ in ] HRES_RPC hResource,
+ [ in ] HRES_RPC hDependsOn,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x15 */
+
+ WERROR
+ clusapi_CanResourceBeDependent(
+ [ in ] HRES_RPC hResource,
+ [ in ] HRES_RPC hResourceDependent,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x16 */
+
+ WERROR
+ clusapi_CreateResEnum(
+ [ in ] HRES_RPC hResource,
+ [ in ] uint32 dwType,
+ [ out ] ENUM_LIST **ReturnEnum,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x17 */
+
+ WERROR
+ clusapi_AddResourceNode(
+ [ in ] HRES_RPC hResource,
+ [ in ] HNODE_RPC hNode,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x18 */
+
+ WERROR
+ clusapi_RemoveResourceNode(
+ [ in ] HRES_RPC hResource,
+ [ in ] HNODE_RPC hNode,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x19 */
+
+ WERROR
+ clusapi_ChangeResourceGroup(
+ [ in ] HRES_RPC hResource,
+ [ in ] HGROUP_RPC hGroup,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x1A */
+
+ WERROR
+ clusapi_CreateResourceType(
+ [ in, string ] [charset(UTF16)] uint16 *lpszTypeName,
+ [ in, string ] [charset(UTF16)] uint16 *lpszDisplayName,
+ [ in, string ] [charset(UTF16)] uint16 *lpszDllName,
+ [ in ] uint32 dwLooksAlive,
+ [ in ] uint32 dwIsAlive,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x1B */
+
+ WERROR
+ clusapi_DeleteResourceType(
+ [ in, string ] [charset(UTF16)] uint16 *lpszTypeName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x1C */
+#if 0
+ HKEY_RPC
+ clusapi_GetRootKey(
+ [ in ] winreg_AccessMask samDesired,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_GetRootKey(
+ [ in ] winreg_AccessMask samDesired,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HKEY_RPC *phKey
+ );
+#endif
+ /*****************/
+ /* Function 0x1D */
+#if 0
+ HKEY_RPC
+ clusapi_CreateKey(
+ [ in ] HKEY_RPC hKey,
+ [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
+ [ in ] uint32 dwOptions,
+ [ in ] winreg_AccessMask samDesired,
+ [ in, unique ] RPC_SECURITY_ATTRIBUTES *lpSecurityAttributes,
+ [ out ] uint32 *lpdwDisposition,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_CreateKey(
+ [ in ] HKEY_RPC hKey,
+ [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
+ [ in ] uint32 dwOptions,
+ [ in ] winreg_AccessMask samDesired,
+ [ in, unique ] RPC_SECURITY_ATTRIBUTES *lpSecurityAttributes,
+ [ out ] uint32 *lpdwDisposition,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HKEY_RPC *phKey
+ );
+#endif
+ /*****************/
+ /* Function 0x1E */
+#if 0
+ HKEY_RPC
+ clusapi_OpenKey(
+ [ in ] HKEY_RPC hKey,
+ [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
+ [ in ] winreg_AccessMask samDesired,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenKey(
+ [ in ] HKEY_RPC hKey,
+ [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
+ [ in ] winreg_AccessMask samDesired,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HKEY_RPC *phKey
+ );
+#endif
+ /*****************/
+ /* Function 0x1F */
+
+ WERROR
+ clusapi_EnumKey(
+ [ in ] HKEY_RPC hKey,
+ [ in ] uint32 dwIndex,
+ [ out, string ] [charset(UTF16)] uint16 **KeyName,
+ [ out ] NTTIME *lpftLastWriteTime,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x20 */
+
+ WERROR
+ clusapi_SetValue(
+ [ in ] HKEY_RPC hKey,
+ [ in, string ] [charset(UTF16)] uint16 *lpValueName,
+ [ in ] winreg_Type dwType,
+ [ in, size_is(cbData) ] uint8 *lpData,
+ [ in ] uint32 cbData,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x21 */
+
+ WERROR
+ clusapi_DeleteValue(
+ [ in ] HKEY_RPC hKey,
+ [ in, string ] [charset(UTF16)] uint16 *lpValueName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x22 */
+
+ WERROR
+ clusapi_QueryValue(
+ [ in ] HKEY_RPC hKey,
+ [ in, string ] [charset(UTF16)] uint16 *lpValueName,
+ [ out ] winreg_Type *lpValueType,
+ [ out, size_is(cbData) ] uint8 *lpData,
+ [ in ] uint32 cbData,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x23 */
+
+ WERROR
+ clusapi_DeleteKey(
+ [ in ] HKEY_RPC hKey,
+ [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x24 */
+
+ WERROR
+ clusapi_EnumValue(
+ [ in ] HKEY_RPC hKey,
+ [ in ] uint32 dwIndex,
+ [ out, string ] [charset(UTF16)] uint16 **lpValueName,
+ [ out ] winreg_Type *lpType,
+ [ out, size_is(*lpcbData) ] uint8 *lpData,
+ [ in, out ] uint32 *lpcbData,
+ [ out ] uint32 *TotalSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x25 */
+
+ WERROR
+ clusapi_CloseKey(
+ [ in, out ] HKEY_RPC *pKey
+ );
+
+ /*****************/
+ /* Function 0x26 */
+
+ WERROR
+ clusapi_QueryInfoKey(
+ [ in ] HKEY_RPC hKey,
+ [ out ] uint32 *lpcSubKeys,
+ [ out ] uint32 *lpcbMaxSubKeyLen,
+ [ out ] uint32 *lpcValues,
+ [ out ] uint32 *lpcbMaxValueNameLen,
+ [ out ] uint32 *lpcbMaxValueLen,
+ [ out ] uint32 *lpcbSecurityDescriptor,
+ [ out ] NTTIME *lpftLastWriteTime,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x27 */
+
+ WERROR
+ clusapi_SetKeySecurity(
+ [ in ] HKEY_RPC hKey,
+ [ in ] uint32 SecurityInformation,
+ [ in ] RPC_SECURITY_DESCRIPTOR *pRpcSecurityDescriptor,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x28 */
+
+ WERROR
+ clusapi_GetKeySecurity(
+ [ in ] HKEY_RPC hKey,
+ [ in ] uint32 SecurityInformation,
+ [ in, out ] RPC_SECURITY_DESCRIPTOR *pRpcSecurityDescriptor,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x29 */
+#if 0
+ HGROUP_RPC
+ clusapi_OpenGroup(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenGroup(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HGROUP_RPC *hGroup
+ );
+#endif
+ /*****************/
+ /* Function 0x2A */
+#if 0
+ HGROUP_RPC
+ clusapi_CreateGroup(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_CreateGroup(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HGROUP_RPC *hGroup
+ );
+#endif
+ /*****************/
+ /* Function 0x2B */
+
+ WERROR
+ clusapi_DeleteGroup(
+ [ in ] HGROUP_RPC Group,
+ [ in ] boolean8 force,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x2C */
+
+ WERROR
+ clusapi_CloseGroup(
+ [ in, out ] HGROUP_RPC *Group
+ );
+
+ /*****************/
+ /* Function 0x2D */
+
+ typedef [v1_enum] enum {
+ ClusterGroupOnline = 0x00000000,
+ ClusterGroupOffline = 0x00000001,
+ ClusterGroupFailed = 0x00000002,
+ ClusterGroupPartialOnline = 0x00000003,
+ ClusterGroupPending = 0x00000004,
+ ClusterGroupStateUnknown = 0xFFFFFFFF
+ } clusapi_ClusterGroupState;
+
+ WERROR
+ clusapi_GetGroupState(
+ [ in ] HGROUP_RPC hGroup,
+ [ out ] clusapi_ClusterGroupState *State,
+ [ out, string ] [charset(UTF16)] uint16 **NodeName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x2E */
+
+ WERROR
+ clusapi_SetGroupName(
+ [ in ] HGROUP_RPC hGroup,
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x2F */
+
+ WERROR
+ clusapi_GetGroupId(
+ [ in ] HGROUP_RPC hGroup,
+ [ out, string ] [charset(UTF16)] uint16 **pGuid,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x30 */
+
+ WERROR
+ clusapi_GetNodeId(
+ [ in ] HNODE_RPC hNode,
+ [ out, string ] [charset(UTF16)] uint16 **pGuid,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x31 */
+
+ WERROR
+ clusapi_OnlineGroup(
+ [ in ] HGROUP_RPC hGroup,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x32 */
+
+ WERROR
+ clusapi_OfflineGroup(
+ [ in ] HGROUP_RPC hGroup,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x33 */
+
+ WERROR
+ clusapi_MoveGroup(
+ [ in ] HGROUP_RPC hGroup,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x34 */
+
+ WERROR
+ clusapi_MoveGroupToNode(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] HNODE_RPC hNode,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x35 */
+
+ typedef [bitmap32bit] bitmap {
+ CLUSTER_GROUP_ENUM_CONTAINS = 0x00000001,
+ CLUSTER_GROUP_ENUM_NODES = 0x00000002
+ } ClusterGroupEnumType;
+
+ WERROR
+ clusapi_CreateGroupResourceEnum(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] ClusterGroupEnumType dwType,
+ [ out ] ENUM_LIST **ReturnEnum,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x36 */
+
+ WERROR
+ clusapi_SetGroupNodeList(
+ [ in ] HGROUP_RPC hGroup,
+ [ in, unique, size_is(cchListSize) ] uint16 *multiSzNodeList,
+ [ in ] uint32 cchListSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x37 */
+#if 0
+ HNOTIFY_RPC
+ clusapi_CreateNotify(
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_CreateNotify(
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HNOTIFY_RPC *hNotify
+ );
+#endif
+ /*****************/
+ /* Function 0x38 */
+
+ WERROR
+ clusapi_CloseNotify(
+ [ in, out ] HNOTIFY_RPC *Notify
+ );
+
+ /*****************/
+ /* Function 0x39 */
+
+ WERROR
+ clusapi_AddNotifyCluster(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x3A */
+
+ WERROR
+ clusapi_AddNotifyNode(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ out ] uint32 *dwStateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x3B */
+
+ WERROR
+ clusapi_AddNotifyGroup(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ out ] uint32 *dwStateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x3C */
+
+ WERROR
+ clusapi_AddNotifyResource(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HRES_RPC hResource,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ out ] uint32 *dwStateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x3D */
+
+ WERROR
+ clusapi_AddNotifyKey(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HKEY_RPC hKey,
+ [ in ] uint32 dwNotifyKey,
+ [ in ] uint32 Filter,
+ [ in ] boolean8 WatchSubTree,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x3E */
+
+ WERROR
+ clusapi_ReAddNotifyNode(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ in ] uint32 StateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x3F */
+
+ WERROR
+ clusapi_ReAddNotifyGroup(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ in ] uint32 StateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x40 */
+
+ WERROR
+ clusapi_ReAddNotifyResource(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HRES_RPC hResource,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ in ] uint32 StateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x41 */
+
+ WERROR
+ clusapi_GetNotify(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ out ] uint32 *dwNotifyKey,
+ [ out ] uint32 *dwFilter,
+ [ out ] uint32 *dwStateSequence,
+ [ out, string ] [charset(UTF16)] uint16 **Name,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x42 */
+#if 0
+ HNODE_RPC
+ clusapi_OpenNode(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNodeName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenNode(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNodeName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HNODE_RPC *hNode
+ );
+#endif
+ /*****************/
+ /* Function 0x43 */
+
+ WERROR
+ clusapi_CloseNode(
+ [ in, out ] HNODE_RPC *Node
+ );
+
+ /*****************/
+ /* Function 0x44 */
+
+ typedef [v1_enum] enum {
+ ClusterNodeUp = 0x00000000,
+ ClusterNodeDown = 0x00000001,
+ ClusterNodePaused = 0x00000002,
+ ClusterNodeJoining = 0x00000003,
+ ClusterNodeStateUnknown = 0xFFFFFFFF
+ } clusapi_ClusterNodeState;
+
+ WERROR
+ clusapi_GetNodeState(
+ [ in ] HNODE_RPC hNode,
+ [ out ] clusapi_ClusterNodeState *State,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x45 */
+
+ WERROR
+ clusapi_PauseNode(
+ [ in ] HNODE_RPC hNode,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x46 */
+
+ WERROR
+ clusapi_ResumeNode(
+ [ in ] HNODE_RPC hNode,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x47 */
+
+ WERROR
+ clusapi_EvictNode(
+ [ in ] HNODE_RPC hNode,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x48 */
+
+ WERROR
+ clusapi_NodeResourceControl(
+ [ in ] HRES_RPC hResource,
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x49 */
+
+ typedef [v1_enum] enum {
+ CLUS_RESCLASS_UNKNOWN = 0x00000000,
+ CLUS_RESCLASS_STORAGE = 0x00000001,
+ CLUS_RESCLASS_NETWORK = 0x00000002
+ } clusapi_ResourceClass;
+
+ typedef [public] struct {
+ clusapi_ResourceClass Class;
+ uint32 SubClass;
+ } CLUS_RESOURCE_CLASS_INFO;
+
+ typedef [v1_enum] enum {
+ CLUSCTL_RESOURCE_UNKNOWN = 0x01000000,
+ CLUSCTL_RESOURCE_GET_CHARACTERISTICS = 0x01000005,
+ CLUSCTL_RESOURCE_GET_FLAGS = 0x01000009,
+ CLUSCTL_RESOURCE_GET_CLASS_INFO = 0x0100000D,
+ CLUSCTL_RESOURCE_GET_REQUIRED_DEPENDENCIES = 0x01000011,
+ CLUSCTL_RESOURCE_GET_NAME = 0x01000029,
+ CLUSCTL_RESOURCE_GET_RESOURCE_TYPE = 0x0100002D,
+ CLUSCTL_RESOURCE_GET_ID = 0x01000039,
+ CLUSCTL_RESOURCE_ENUM_COMMON_PROPERTIES = 0x01000051,
+ CLUSCTL_RESOURCE_GET_RO_COMMON_PROPERTIES = 0x01000055,
+ CLUSCTL_RESOURCE_GET_COMMON_PROPERTIES = 0x01000059,
+ CLUSCTL_RESOURCE_SET_COMMON_PROPERTIES = 0x0140005E,
+ CLUSCTL_RESOURCE_VALIDATE_COMMON_PROPERTIES = 0x01000061,
+ CLUSCTL_RESOURCE_GET_COMMON_PROPERTY_FMTS = 0x01000065,
+ CLUSCTL_RESOURCE_ENUM_PRIVATE_PROPERTIES = 0x01000079,
+ CLUSCTL_RESOURCE_GET_RO_PRIVATE_PROPERTIES = 0x0100007D,
+ CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES = 0x01000081,
+ CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES = 0x01400086,
+ CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES = 0x01000089,
+ CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTY_FMTS = 0x0100008D,
+ CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT = 0x014000A2,
+ CLUSCTL_RESOURCE_DELETE_REGISTRY_CHECKPOINT = 0x014000A6,
+ CLUSCTL_RESOURCE_GET_REGISTRY_CHECKPOINTS = 0x010000A9,
+ CLUSCTL_RESOURCE_ADD_CRYPTO_CHECKPOINT = 0x014000AE,
+ CLUSCTL_RESOURCE_DELETE_CRYPTO_CHECKPOINT = 0x014000B2,
+ CLUSCTL_RESOURCE_GET_CRYPTO_CHECKPOINTS = 0x010000B5,
+ CLUSCTL_RESOURCE_UPGRADE_DLL = 0x014000BA,
+ CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT_64BIT = 0x014000BE,
+ CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT_32BIT = 0x014000C2,
+ CLUSCTL_RESOURCE_GET_NETWORK_NAME = 0x01000169,
+ CLUSCTL_RESOURCE_NETNAME_REGISTER_DNS_RECORDS = 0x01000172,
+ CLUSCTL_RESOURCE_GET_DNS_NAME = 0x01000175,
+ CLUSCTL_RESOURCE_NETNAME_SET_PWD_INFO = 0x0100017A,
+ CLUSCTL_RESOURCE_NETNAME_DELETE_CO = 0x0100017E,
+ CLUSCTL_RESOURCE_NETNAME_VALIDATE_VCO = 0x01000181,
+ CLUSCTL_RESOURCE_NETNAME_RESET_VCO = 0x01000185,
+ CLUSCTL_RESOURCE_NETNAME_CREDS_UPDATED = 0x01c0018a,
+ CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO = 0x01000191,
+ CLUSCTL_RESOURCE_STORAGE_IS_PATH_VALID = 0x01000199,
+ CLUSCTL_RESOURCE_IPADDRESS_RENEW_LEASE = 0x014001BE,
+ CLUSCTL_RESOURCE_IPADDRESS_RELEASE_LEASE = 0x014001C2,
+ CLUSCTL_RESOURCE_QUERY_MAINTENANCE_MODE = 0x010001E1,
+ CLUSCTL_RESOURCE_SET_MAINTENANCE_MODE = 0x014001E6,
+ CLUSCTL_RESOURCE_STORAGE_SET_DRIVELETTER = 0x014001EA,
+ CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO_EX = 0x010001F1,
+ CLUSCTL_RESOURCE_STORAGE_GET_DIRTY = 0x01000219,
+ CLUSCTL_RESOURCE_STORAGE_GET_MOUNTPOINTS = 0x01000211,
+ CLUSCTL_RESOURCE_STORAGE_GET_SHARED_VOLUME_INFO = 0x01000225,
+ CLUSCTL_RESOURCE_VM_START_MIGRATION = 0x01600004,
+ CLUSCTL_RESOURCE_VM_CANCEL_MIGRATION = 0x01600008,
+ CLUSCTL_RESOURCE_SET_CSV_MAINTENANCE_MODE = 0x01400296,
+ CLUSCTL_RESOURCE_ENABLE_SHARED_VOLUME_DIRECTIO = 0x0140028a,
+ CLUSCTL_RESOURCE_DISABLE_SHARED_VOLUME_DIRECTIO = 0x0140028e,
+ CLUSCTL_RESOURCE_SET_SHARED_VOLUME_BACKUP_MODE = 0x0140029a,
+ CLUSCTL_RESOURCE_GET_RELATED_RESOURCE_NAMES = 0x01001fad,
+ CLUSCTL_RESOURCE_POOL_GET_DRIVE_INFO = 0x010002b5,
+ CLUSCTL_RESOURCE_CLOUD_WITNESS_UPDATE_TOKEN = 0x014020e6,
+ CLUSCTL_RESOURCE_NETNAME_CHECK_OU_PERMISSIONS = 0x07002121,
+ CLUSCTL_RESOURCE_NETNAME_CHECK_AD_STATE = 0x07002125
+ } clusapi_ResourceControlCode;
+
+ WERROR
+ clusapi_ResourceControl(
+ [ in ] HRES_RPC hResource,
+ [ in ] clusapi_ResourceControlCode dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x4A */
+
+ WERROR
+ clusapi_NodeResourceTypeControl(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceTypeName,
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x4B */
+
+ typedef [v1_enum] enum {
+ CLUSCTL_RESOURCE_TYPE_UNKNOWN = 0x02000000,
+ CLUSCTL_RESOURCE_TYPE_GET_CHARACTERISTICS = 0x02000005,
+ CLUSCTL_RESOURCE_TYPE_GET_FLAGS = 0x02000009,
+ CLUSCTL_RESOURCE_TYPE_GET_CLASS_INFO = 0x0200000D,
+ CLUSCTL_RESOURCE_TYPE_GET_REQUIRED_DEPENDENCIES = 0x02000011,
+ CLUSCTL_RESOURCE_TYPE_GET_ARB_TIMEOUT = 0x02000015,
+ CLUSCTL_RESOURCE_TYPE_ENUM_COMMON_PROPERTIES = 0x02000051,
+ CLUSCTL_RESOURCE_TYPE_GET_RO_COMMON_PROPERTIES = 0x02000055,
+ CLUSCTL_RESOURCE_TYPE_GET_COMMON_PROPERTIES = 0x02000059,
+ CLUSCTL_RESOURCE_TYPE_SET_COMMON_PROPERTIES = 0x0240005E,
+ CLUSCTL_RESOURCE_TYPE_VALIDATE_COMMON_PROPERTIES = 0x02000061,
+ CLUSCTL_RESOURCE_TYPE_GET_COMMON_PROPERTY_FMTS = 0x02000065,
+ CLUSCTL_RESOURCE_TYPE_GET_COMMON_RESOURCE_PROPERTY_FMTS = 0x02000069,
+ CLUSCTL_RESOURCE_TYPE_ENUM_PRIVATE_PROPERTIES = 0x02000079,
+ CLUSCTL_RESOURCE_TYPE_GET_RO_PRIVATE_PROPERTIES = 0x0200007D,
+ CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES = 0x02000081,
+ CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES = 0x02400086,
+ CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES = 0x02000089,
+ CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTY_FMTS = 0x0200008D,
+ CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_RESOURCE_PROPERTY_FMTS= 0x02000091,
+ CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS = 0x02000195,
+ CLUSCTL_RESOURCE_TYPE_NETNAME_VALIDATE_NETNAME = 0x02000235,
+ CLUSCTL_RESOURCE_TYPE_VALIDATE_PATH = 0x02000231,
+ CLUSCTL_RESOURCE_TYPE_GEN_APP_VALIDATE_DIRECTORY = 0x02000239,
+ CLUSCTL_RESOURCE_TYPE_STORAGE_GET_DRIVELETTERS = 0x020001ED,
+ CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX = 0x020001F5,
+ CLUSCTL_RESOURCE_TYPE_STORAGE_REMAP_DRIVELETTER = 0x02000201,
+ CLUSCTL_RESOURCE_TYPE_STORAGE_GET_DISKID = 0x02000205,
+ CLUSCTL_RESOURCE_TYPE_STORAGE_IS_CLUSTERABLE = 0x02000209,
+ CLUSCTL_RESOURCE_TYPE_STORAGE_RELEASE_OWNERSHIP = 0x0240020E,
+ CLUSCTL_RESOURCE_TYPE_STORAGE_IS_CSV_FILE = 0x1000229,
+ CLUSCTL_RESOURCE_TYPE_CLOUD_WITNESS_VALIDATE_CREDENTIALS= 0x020020e1,
+ CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_LOGDISKS = 0x02002149,
+ CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_TARGET_DATADISKS = 0x0200214D,
+ CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_SOURCE_DATADISKS = 0x02002151,
+ CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_REPLICA_VOLUMES = 0x02002159,
+ CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_LOG_VOLUME = 0x0200215D,
+ CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_REPLICATED_DISKS = 0x02002155,
+ CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_RESOURCE_GROUP = 0x02002161
+ } clusapi_ResourceTypeControlCode;
+
+ WERROR
+ clusapi_ResourceTypeControl(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceTypeName,
+ [ in ] clusapi_ResourceTypeControlCode dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x4C */
+
+ WERROR
+ clusapi_NodeGroupControl(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x4D */
+
+ typedef [v1_enum] enum {
+ CLUSCTL_GROUP_UNKNOWN = 0x03000000,
+ CLUSCTL_GROUP_GET_CHARACTERISTICS = 0x03000005,
+ CLUSCTL_GROUP_GET_FLAGS = 0x03000009,
+ CLUSCTL_GROUP_GET_NAME = 0x03000029,
+ CLUSCTL_GROUP_GET_ID = 0x03000039,
+ CLUSCTL_GROUP_ENUM_COMMON_PROPERTIES = 0x03000051,
+ CLUSCTL_GROUP_GET_RO_COMMON_PROPERTIES = 0x03000055,
+ CLUSCTL_GROUP_GET_COMMON_PROPERTIES = 0x03000059,
+ CLUSCTL_GROUP_SET_COMMON_PROPERTIES = 0x0340005E,
+ CLUSCTL_GROUP_VALIDATE_COMMON_PROPERTIES = 0x03000061,
+ CLUSCTL_GROUP_GET_COMMON_PROPERTY_FMTS = 0x03000065,
+ CLUSCTL_GROUP_ENUM_PRIVATE_PROPERTIES = 0x03000079,
+ CLUSCTL_GROUP_GET_RO_PRIVATE_PROPERTIES = 0x0300007D,
+ CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES = 0x03000081,
+ CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES = 0x03400086,
+ CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES = 0x03000089
+ } clusapi_GroupControlCode;
+
+ WERROR
+ clusapi_GroupControl(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] clusapi_GroupControlCode dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x4E */
+
+ WERROR
+ clusapi_NodeNodeControl(
+ [ in ] HNODE_RPC hNode,
+ [ in ] HNODE_RPC hHostNode,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x4F */
+
+ typedef [v1_enum] enum {
+ CLUSCTL_NODE_UNKNOWN = 0x04000000,
+ CLUSCTL_NODE_GET_CHARACTERISTICS = 0x04000005,
+ CLUSCTL_NODE_GET_FLAGS = 0x04000009,
+ CLUSCTL_NODE_GET_NAME = 0x04000029,
+ CLUSCTL_NODE_GET_ID = 0x04000039,
+ CLUSCTL_NODE_GET_CLUSTER_SERVICE_ACCOUNT_NAME = 0x04000041,
+ CLUSCTL_NODE_ENUM_COMMON_PROPERTIES = 0x04000051,
+ CLUSCTL_NODE_GET_RO_COMMON_PROPERTIES = 0x04000055,
+ CLUSCTL_NODE_GET_COMMON_PROPERTIES = 0x04000059,
+ CLUSCTL_NODE_SET_COMMON_PROPERTIES = 0x0440005E,
+ CLUSCTL_NODE_VALIDATE_COMMON_PROPERTIES = 0x04000061,
+ CLUSCTL_NODE_ENUM_PRIVATE_PROPERTIES = 0x04000079,
+ CLUSCTL_NODE_GET_RO_PRIVATE_PROPERTIES = 0x0400007D,
+ CLUSCTL_NODE_GET_PRIVATE_PROPERTIES = 0x04000081,
+ CLUSCTL_NODE_SET_PRIVATE_PROPERTIES = 0x04400086,
+ CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES = 0x04000089
+ } clusapi_NodeControlCode;
+
+ WERROR
+ clusapi_NodeControl(
+ [ in ] HNODE_RPC hNode,
+ [ in ] clusapi_NodeControlCode dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x50 */
+
+ WERROR
+ Opnum80NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x51 */
+#if 0
+ HNETWORK_RPC
+ clusapi_OpenNetwork(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenNetwork(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HNETWORK_RPC *hNetwork
+ );
+#endif
+ /*****************/
+ /* Function 0x52 */
+
+ WERROR
+ clusapi_CloseNetwork(
+ [ in, out ] HNETWORK_RPC *Network
+ );
+
+ /*****************/
+ /* Function 0x53 */
+
+ typedef [v1_enum] enum {
+ ClusterNetworkUnavailable = 0x00000000,
+ ClusterNetworkDown = 0x00000001,
+ ClusterNetworkPartitioned = 0x00000002,
+ ClusterNetworkUp = 0x00000003,
+ ClusterNetworkStateUnknown = 0xFFFFFFFF
+ } clusapi_ClusterNetworkState;
+
+ WERROR
+ clusapi_GetNetworkState(
+ [ in ] HNETWORK_RPC hNetwork,
+ [ out ] clusapi_ClusterNetworkState *State,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x54 */
+
+ WERROR
+ clusapi_SetNetworkName(
+ [ in ] HNETWORK_RPC hNetwork,
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x55 */
+
+ WERROR
+ clusapi_CreateNetworkEnum(
+ [ in ] HNETWORK_RPC hNetwork,
+ [ in ] uint32 dwType,
+ [ out ] ENUM_LIST **ReturnEnum,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x56 */
+
+ WERROR
+ clusapi_GetNetworkId(
+ [ in ] HNETWORK_RPC hNetwork,
+ [ out, string ] [charset(UTF16)] uint16 **pGuid,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x57 */
+
+ WERROR
+ clusapi_SetNetworkPriorityOrder(
+ [ in, range(0, 1000)] uint32 NetworkCount,
+ [ in, string, size_is(NetworkCount) ] [charset(UTF16)] uint16 NetworkIdList[*],
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x58 */
+
+ WERROR
+ clusapi_NodeNetworkControl(
+ [ in ] HNETWORK_RPC hNetwork,
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x59 */
+
+ WERROR
+ clusapi_NetworkControl(
+ [ in ] HNETWORK_RPC hNetwork,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x5A */
+
+ WERROR
+ clusapi_AddNotifyNetwork(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HNETWORK_RPC hNetwork,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ out ] uint32 *dwStateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x5B */
+
+ WERROR
+ clusapi_ReAddNotifyNetwork(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HNETWORK_RPC hNetwork,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ in ] uint32 StateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x5C */
+#if 0
+ HNETINTERFACE_RPC
+ clusapi_OpenNetInterface(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetInterfaceName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenNetInterface(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetInterfaceName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HNETINTERFACE_RPC *hNetInterface
+ );
+#endif
+ /*****************/
+ /* Function 0x5D */
+
+ WERROR
+ clusapi_CloseNetInterface(
+ [ in, out ] HNETINTERFACE_RPC *NetInterface
+ );
+
+ /*****************/
+ /* Function 0x5E */
+
+ typedef [v1_enum] enum {
+ ClusterNetInterfaceFailed = 0x00000000,
+ ClusterNetInterfaceUnreachable = 0x00000001,
+ ClusterNetInterfaceUnavailable = 0x00000002,
+ ClusterNetInterfaceUp = 0x00000003,
+ ClusterNetInterfaceStateUnknown = 0xFFFFFFFF
+ } clusapi_ClusterNetInterfaceState;
+
+ WERROR
+ clusapi_GetNetInterfaceState(
+ [ in ] HNETINTERFACE_RPC hNetInterface,
+ [ out ] clusapi_ClusterNetInterfaceState *State,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x5F */
+
+ WERROR
+ clusapi_GetNetInterface(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNodeName,
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName,
+ [ out, string ] [charset(UTF16)] uint16 **lppszInterfaceName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x60 */
+
+ WERROR
+ clusapi_GetNetInterfaceId(
+ [ in ] HNETINTERFACE_RPC hNetInterface,
+ [ out, string ] [charset(UTF16)] uint16 **pGuid,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x61 */
+
+ WERROR
+ clusapi_NodeNetInterfaceControl(
+ [ in ] HNETINTERFACE_RPC hNetInterface,
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x62 */
+
+ WERROR
+ clusapi_NetInterfaceControl(
+ [ in ] HNETINTERFACE_RPC hNetInterface,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x63 */
+
+ WERROR
+ clusapi_AddNotifyNetInterface(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HNETINTERFACE_RPC hNetInterface,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ out ] uint32 *dwStateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x64 */
+
+ WERROR
+ clusapi_ReAddNotifyNetInterface(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HNETINTERFACE_RPC hNetInterface,
+ [ in ] uint32 dwFilter,
+ [ in ] uint32 dwNotifyKey,
+ [ in ] uint32 StateSequence,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x65 */
+
+ WERROR
+ clusapi_CreateNodeEnum(
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwType,
+ [ out ] ENUM_LIST **ReturnEnum,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x66 */
+
+ WERROR
+ clusapi_GetClusterVersion2(
+ [ out ] uint16 *lpwMajorVersion,
+ [ out ] uint16 *lpwMinorVersion,
+ [ out ] uint16 *lpwBuildNumber,
+ [ out, string ] [charset(UTF16)] uint16 **lpszVendorId,
+ [ out, string ] [charset(UTF16)] uint16 **lpszCSDVersion,
+ [ out ] CLUSTER_OPERATIONAL_VERSION_INFO **ppClusterOpVerInfo,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x67 */
+
+ typedef [bitmap32bit] bitmap {
+ CLUSTER_RESOURCE_TYPE_ENUM_NODES = 0x00000001,
+ CLUSTER_RESOURCE_TYPE_ENUM_RESOURCES = 0x00000002
+ } ClusterResTypeEnumType;
+
+ WERROR
+ clusapi_CreateResTypeEnum(
+ [ in, string ] [charset(UTF16)] uint16 *lpszTypeName,
+ [ in ] ClusterResTypeEnumType dwType,
+ [ out ] ENUM_LIST **ReturnEnum,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x68 */
+
+ WERROR
+ clusapi_BackupClusterDatabase(
+ [ in, string ] [charset(UTF16)] uint16 *lpszPathName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x69 */
+
+ WERROR
+ clusapi_NodeClusterControl(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in ] HNODE_RPC hHostNode,
+ [ in ] uint32 dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x6A */
+
+ typedef [v1_enum] enum {
+ CLUSCTL_CLUSTER_UNKNOWN = 0x07000000,
+ CLUSCTL_CLUSTER_GET_FQDN = 0x0700003D,
+ CLUSCTL_CLUSTER_CHECK_VOTER_EVICT = 0x07000045,
+ CLUSCTL_CLUSTER_CHECK_VOTER_DOWN = 0x07000049,
+ CLUSCTL_CLUSTER_SHUTDOWN = 0x0700004D,
+ CLUSCTL_CLUSTER_ENUM_COMMON_PROPERTIES = 0x07000051,
+ CLUSCTL_CLUSTER_GET_RO_COMMON_PROPERTIES = 0x07000055,
+ CLUSCTL_CLUSTER_GET_COMMON_PROPERTIES = 0x07000059,
+ CLUSCTL_CLUSTER_SET_COMMON_PROPERTIES = 0x0740005E,
+ CLUSCTL_CLUSTER_VALIDATE_COMMON_PROPERTIES = 0x07000061,
+ CLUSCTL_CLUSTER_GET_COMMON_PROPERTY_FMTS = 0x07000065,
+ CLUSCTL_CLUSTER_ENUM_PRIVATE_PROPERTIES = 0x07000079,
+ CLUSCTL_CLUSTER_GET_RO_PRIVATE_PROPERTIES = 0x0700007D,
+ CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTIES = 0x07000081,
+ CLUSCTL_CLUSTER_SET_PRIVATE_PROPERTIES = 0x07400086,
+ CLUSCTL_CLUSTER_VALIDATE_PRIVATE_PROPERTIES = 0x07000089,
+ CLUSCTL_CLUSTER_GET_SHARED_VOLUME_ID = 0x07000291,
+ CLUSCTL_CLUSTER_UPGRADE_CLUSTER_VERSION = 0x074000ce,
+ CLUSCTL_CLUSTER_CLEAR_UPGRADE_IN_PROGRESS = 0x074000d2,
+ CLUSCTL_CLUSTER_IS_READY_FOR_UPGRADE = 0x070000d5
+ } clusapi_ClusterControlCode;
+
+ typedef [v1_enum] enum {
+ CLUSPROP_SYNTAX_ENDMARK = 0x00000000,
+ CLUSPROP_SYNTAX_NAME = 0x00040003,
+ CLUSPROP_SYNTAX_RESCLASS = 0x00020002,
+ CLUSPROP_SYNTAX_LIST_VALUE_SZ = 0x00010003,
+ CLUSPROP_SYNTAX_LIST_VALUE_EXPAND_SZ = 0x00010004,
+ CLUSPROP_SYNTAX_LIST_VALUE_DWORD = 0x00010002,
+ CLUSPROP_SYNTAX_LIST_VALUE_BINARY = 0x00010001,
+ CLUSPROP_SYNTAX_LIST_VALUE_MULTI_SZ = 0x00010005,
+ CLUSPROP_SYNTAX_LIST_VALUE_LONG = 0x00010007,
+ CLUSPROP_SYNTAX_LIST_VALUE_EXPANDED_SZ = 0x00010008,
+ CLUSPROP_SYNTAX_LIST_VALUE_SECURITY_DESCRIPTOR = 0x00010009,
+ CLUSPROP_SYNTAX_LIST_VALUE_LARGE_INTEGER = 0x0001000a,
+ CLUSPROP_SYNTAX_LIST_VALUE_ULARGE_INTEGER = 0x00010006,
+ CLUSPROP_SYNTAX_LIST_VALUE_WORD = 0x0001000b,
+ CLUSPROP_SYNTAX_LIST_VALUE_FILETIME = 0x0001000c,
+ CLUSPROP_SYNTAX_DISK_SIGNATURE = 0x00050002,
+ CLUSPROP_SYNTAX_SCSI_ADDRESS = 0x00060002,
+ CLUSPROP_SYNTAX_DISK_NUMBER = 0x00070002,
+ CLUSPROP_SYNTAX_PARTITION_INFO = 0x00080001,
+ CLUSPROP_SYNTAX_DISK_SERIALNUMBER = 0x000a0003,
+ CLUSPROP_SYNTAX_DISK_GUID = 0x000b0003,
+ CLUSPROP_SYNTAX_DISK_SIZE = 0x000c0006,
+ CLUSPROP_SYNTAX_PARTITION_INFO_EX = 0x000d0001
+ } CLUSTER_PROPERTY_SYNTAX;
+
+ typedef struct {
+ CLUSTER_PROPERTY_SYNTAX Syntax;
+ uint32 Size;
+ [subcontext(0),subcontext_size(Size)] [flag(NDR_REMAINING)] DATA_BLOB Buffer;
+ [flag(NDR_ALIGN4)] DATA_BLOB Padding;
+ } clusapi_propertyValues;
+
+ typedef struct {
+ [value(CLUSPROP_SYNTAX_NAME)] CLUSTER_PROPERTY_SYNTAX syntax_name;
+ [value(strlen_m_term(buffer)*2)] uint32 size;
+ nstring buffer;
+ [flag(NDR_ALIGN2)] DATA_BLOB padding;
+ clusapi_propertyValues PropertyValues;
+ [value(CLUSPROP_SYNTAX_ENDMARK)] CLUSTER_PROPERTY_SYNTAX end_mark;
+ } clusapi_propertyValue;
+
+ typedef [public] struct {
+ uint32 propertyCount;
+ clusapi_propertyValue propertyValues[propertyCount];
+ [value(CLUSPROP_SYNTAX_ENDMARK)] CLUSTER_PROPERTY_SYNTAX end_mark;
+ } clusapi_PROPERTY_LIST;
+
+ WERROR
+ clusapi_ClusterControl(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in ] clusapi_ClusterControlCode dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize),
+ length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in ] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x6B */
+
+ WERROR
+ clusapi_UnblockGetNotifyCall(
+ [ in ] HNOTIFY_RPC hNotify
+ );
+
+ /*****************/
+ /* Function 0x6C */
+
+ WERROR
+ clusapi_SetServiceAccountPassword(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNewPassword,
+ [ in ] IDL_CLUSTER_SET_PASSWORD_FLAGS dwFlags,
+ [ out, size_is(ReturnStatusBufferSize), length_is(*SizeReturned) ]
+ IDL_CLUSTER_SET_PASSWORD_STATUS ReturnStatusBufferPtr[*],
+ [ in, range(0, (64 * 1024)) ] uint32 ReturnStatusBufferSize,
+ [ out ] uint32 *SizeReturned,
+ [ out ] uint32 *ExpectedBufferSize
+ );
+
+ /*****************/
+ /* Function 0x6D */
+
+ WERROR
+ clusapi_SetResourceDependencyExpression(
+ [ in ] HRES_RPC hResource,
+ [ in, string, unique ] [charset(UTF16)] uint16 *lpszDependencyExpression,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x6E */
+
+ WERROR
+ clusapi_GetResourceDependencyExpression(
+ [ in ] HRES_RPC hResource,
+ [ out, string ] [charset(UTF16)] uint16 **lpszDependencyExpression,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x6F */
+
+ WERROR
+ Opnum111NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x70 */
+
+ WERROR
+ clusapi_GetResourceNetworkName(
+ [ in ] HRES_RPC hResource,
+ [ out, string ] [charset(UTF16)] uint16 **lpszName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x71 */
+
+ WERROR
+ clusapi_ExecuteBatch(
+ [ in ] HKEY_RPC hKey,
+ [ in ] uint32 cbData,
+ [ in, size_is(cbData)] uint8 *lpData,
+ [ out ] int *pdwFailedCommand,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x72 */
+
+ WERROR
+ clusapi_CreateBatchPort(
+ [ in ] HKEY_RPC hKey,
+ [ out ] HBATCH_PORT_RPC *phBatchPort,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x73 */
+
+ WERROR
+ clusapi_GetBatchNotification(
+ [ in ] HBATCH_PORT_RPC hBatchNotify,
+ [ out ] uint32 *cbData,
+ [ out, size_is(,*cbData) ] uint8 ** lpData
+ );
+
+ /*****************/
+ /* Function 0x74 */
+
+ WERROR
+ clusapi_CloseBatchPort(
+ [ in, out ] HBATCH_PORT_RPC *phBatchPort
+ );
+
+ /*****************/
+ /* Function 0x75 */
+
+ typedef [bitmap32bit] bitmap {
+ CLUSAPI_READ_ACCESS = 0x00000001,
+ CLUSAPI_CHANGE_ACCESS = 0x00000002,
+ CLUSAPI_GENERIC_READ = 0x80000000,
+ CLUSAPI_GENERIC_WRITE = 0x40000000,
+ CLUSAPI_GENERIC_EXECUTE = 0x20000000,
+ CLUSAPI_GENERIC_ALL = 0x10000000,
+ CLUSAPI_MAXIMUM_ALLOWED = 0x02000000
+ } clusapi_DesiredAccessMask;
+
+#if 0
+ HCLUSTER_RPC
+ clusapi_OpenClusterEx(
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status
+ );
+#else
+ void
+ clusapi_OpenClusterEx(
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] HCLUSTER_RPC *hCluster
+ );
+#endif
+
+ /*****************/
+ /* Function 0x76 */
+#if 0
+ HNODE_RPC
+ clusapi_OpenNodeEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNodeName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenNodeEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNodeName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HNODE_RPC *hNode
+ );
+#endif
+ /*****************/
+ /* Function 0x77 */
+#if 0
+ HGROUP_RPC
+ clusapi_OpenGroupEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenGroupEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HGROUP_RPC *hGroup
+ );
+#endif
+ /*****************/
+ /* Function 0x78 */
+#if 0
+ HRES_RPC
+ clusapi_OpenResourceEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenResourceEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszResourceName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HRES_RPC *hResource
+ );
+#endif
+ /*****************/
+ /* Function 0x79 */
+#if 0
+ HNETWORK_RPC
+ clusapi_OpenNetworkEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenNetworkEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HNETWORK_RPC *hNetwork
+ );
+#endif
+ /*****************/
+ /* Function 0x7A */
+#if 0
+ HNETINTERFACE_RPC
+ clusapi_OpenNetInterfaceEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetInterfaceName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenNetInterfaceEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszNetInterfaceName,
+ [ in ] clusapi_DesiredAccessMask dwDesiredAccess,
+ [ out ] uint32 *lpdwGrantedAccess,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HNETINTERFACE_RPC *hNetInterface
+ );
+#endif
+ /*****************/
+ /* Function 0x7B */
+
+ WERROR
+ clusapi_ChangeCsvState(
+ [ in ] HRES_RPC hResource,
+ [ in ] uint32 dwState,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x7C */
+
+ WERROR
+ clusapi_CreateNodeEnumEx(
+ [in] HNODE_RPC hNode,
+ [in] uint32 dwType,
+ [in] uint32 dwOptions,
+ [out] ENUM_LIST **ReturnIdEnum,
+ [out] ENUM_LIST **ReturnNameEnum,
+ [out] WERROR* rpc_status
+ );
+
+ /*****************/
+ /* Function 0x7D */
+
+ WERROR
+ clusapi_CreateEnumEx(
+ [in] HCLUSTER_RPC hCluster,
+ [in] ClusterEnumType dwType,
+ [in] uint32 dwOptions,
+ [out] ENUM_LIST **ReturnIdEnum,
+ [out] ENUM_LIST **ReturnNameEnum,
+ [out] WERROR* rpc_status
+ );
+
+ /*****************/
+ /* Function 0x7E */
+
+ WERROR
+ clusapi_PauseNodeEx(
+ [ in ] HNODE_RPC hNode,
+ [ in ] boolean8 bDrainNode,
+ [ in ] uint32 dwPauseFlags,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x7F */
+
+ WERROR
+ clusapi_PauseNodeWithDrainTarget(
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwPauseFlags,
+ [ in ] HNODE_RPC hNodeDrainTarget,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x80 */
+
+ WERROR
+ clusapi_ResumeNodeEx(
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwResumeFailbackType,
+ [ in ] uint32 dwResumeFlagsReserved,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x81 */
+#if 0
+ HGROUP_RPC
+ clusapi_CreateGroupEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ in, unique ] CLUSTER_CREATE_GROUP_INFO_RPC *pGroupInfo,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_CreateGroupEx(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupName,
+ [ in, unique ] CLUSTER_CREATE_GROUP_INFO_RPC *pGroupInfo,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HGROUP_RPC *hGroup
+ );
+#endif
+ /*****************/
+ /* Function 0x82 */
+
+ WERROR
+ clusapi_OnlineGroupEx(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] uint32 dwOnlineFlags,
+ [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer,
+ [ in ] uint32 cbInBufferSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x83 */
+
+ WERROR
+ clusapi_OfflineGroupEx(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] uint32 dwOfflineFlags,
+ [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer,
+ [ in ] uint32 cbInBufferSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x84 */
+
+ WERROR
+ clusapi_MoveGroupEx(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] uint32 dwMoveFlags,
+ [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer,
+ [ in ] uint32 cbInBufferSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x85 */
+
+ WERROR
+ clusapi_MoveGroupToNodeEx(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] HNODE_RPC hNode,
+ [ in ] uint32 dwMoveFlags,
+ [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer,
+ [ in ] uint32 cbInBufferSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x86 */
+
+ WERROR
+ clusapi_CancelClusterGroupOperation(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] uint32 dwCancelFlags,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x87 */
+
+ WERROR
+ clusapi_OnlineResourceEx(
+ [ in ] HRES_RPC hResource,
+ [ in ] uint32 dwOnlineFlags,
+ [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer,
+ [ in ] uint32 cbInBufferSize,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x88 */
+
+ WERROR
+ clusapi_OfflineResourceEx(
+ [ in ] HRES_RPC hResource,
+ [ in ] uint32 dwOfflineFlags,
+ [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer,
+ [ in ] uint32 cbInBufferSize,
+ [ out ] WERROR *rpc_status
+ );
+
+#define HGENERIC_RPC policy_handle
+#if 0
+ typedef [context_handle] void *HGENERIC_RPC;
+#endif
+
+ typedef struct {
+ uint32 dwObjectType; /* really of type CLUSTER_OBJECT_TYPE_RPC */
+ hyper FilterFlags;
+ } NOTIFY_FILTER_AND_TYPE_RPC;
+
+ typedef struct {
+ NOTIFY_FILTER_AND_TYPE_RPC FilterAndType;
+ [ size_is(dwBufferSize ) ] uint8* buffer;
+ uint32 dwBufferSize;
+ [string] [charset(UTF16)] uint16 *ObjectId;
+ [string] [charset(UTF16)] uint16 *ParentId;
+ [string] [charset(UTF16)] uint16 *Name;
+ [string] [charset(UTF16)] uint16 *Type;
+ } NOTIFICATION_DATA_RPC;
+
+ typedef struct {
+ uint32 *dwNotifyKey;
+ NOTIFICATION_DATA_RPC NotificationData;
+ } NOTIFICATION_RPC;
+
+ /*****************/
+ /* Function 0x89 */
+
+ /*
+ * Notify interface V2 functions
+ */
+#if 0
+ HNOTIFY_RPC
+ clusapi_CreateNotifyV2(
+ [ out ] WERROR *rpc_error,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_CreateNotifyV2(
+ [ out ] WERROR *rpc_error,
+ [ out ] WERROR *rpc_status,
+ [ out ] HNOTIFY_RPC *hNotify
+ );
+
+#endif
+ /*****************/
+ /* Function 0x8A */
+
+ WERROR
+ clusapi_AddNotifyV2(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] HGENERIC_RPC hObject,
+ [ in ] NOTIFY_FILTER_AND_TYPE_RPC filter,
+ [ in ] uint32 dwNotifyKey,
+ [ in ] uint32 dwVersion,
+ [ in ] boolean8 isTargetedAtObject,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x8B */
+
+ WERROR
+ clusapi_GetNotifyV2(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ out, size_is(,*dwNumNotifications) ] NOTIFICATION_RPC **Notifications,
+ [ out ] uint32 *dwNumNotifications
+ );
+
+ /*****************/
+ /* Function 0x8C */
+
+ WERROR
+ clusapi_QueryAllValues(
+ [ in ] HKEY_RPC hKey,
+ [ out ] uint32 *pcbData,
+ [ out, size_is(1, *pcbData) ] uint8 ** ppData,
+ [ out ] WERROR *rpc_status
+ );
+
+ typedef struct {
+ uint32 DiskIdType;
+ uint8 DiskIdBlob[16];
+ } CLUSTER_DISKID;
+
+ /*****************/
+ /* Function 0x8D */
+
+ WERROR
+ clusapi_StmFindDisk(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in ] uint32 dwFlags,
+ [ in, out, unique ] CLUSTER_DISKID *pDiskId,
+ [ in, size_is(uniqueIdSize), unique ] uint8 *pUniqueId,
+ [ in ] uint32 uniqueIdSize,
+ [ out, ref, string ] [charset(UTF16)] uint16 **ppszDeviceName,
+ [ out ] WERROR *rpc_status
+ );
+
+ typedef struct{
+ [string] [charset(UTF16)] uint16 *pszNodeName;
+ HRESULT ResultCode;
+ uint32 ResultSize;
+ [unique, size_is(ResultSize)] uint8 *pResultData;
+ } CLUSTER_MRR_NODE_RESPONSE;
+
+ typedef struct {
+ uint32 NodeCount;
+ [size_is(NodeCount)] CLUSTER_MRR_NODE_RESPONSE *pNodes;
+ } CLUSTER_MRR_RESPONSE;
+
+ /*****************/
+ /* Function 0x8E */
+
+ WERROR
+ clusapi_ClusterMrr(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in ] boolean8 fExcludeSelf,
+ [ in ] hyper nodeSet,
+ [ in ] uint32 dwTimeout,
+ [ in ] uint32 dwComponent,
+ [ in ] uint32 dwControlCode,
+ [ in ] uint32 inSize,
+ [ in, unique, size_is(inSize) ] uint8 *pInData,
+ [ out, ref, size_is(1, 1) ] CLUSTER_MRR_RESPONSE **ppInfo,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x8F */
+
+ WERROR
+ clusapi_CreateGroupEnum(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in, unique, size_is(cbProperties)] uint8* pProperties,
+ [ in ] uint32 cbProperties,
+ [ in, unique, size_is(cbRoProperties)] uint8* pRoProperties,
+ [ in ] uint32 cbRoProperties,
+ [ out ] GROUP_ENUM_LIST **ppResultList,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x90 */
+
+ WERROR
+ clusapi_CreateResourceEnum(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ in, unique, size_is(cbProperties)] uint8* pProperties,
+ [ in ] uint32 cbProperties,
+ [ in, unique, size_is(cbRoProperties)] uint8* pRoProperties,
+ [ in ] uint32 cbRoProperties,
+ [ out ] RESOURCE_ENUM_LIST **ppResultList,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x91 */
+
+ WERROR
+ clusapi_ExecuteReadBatch(
+ [ in ] HKEY_RPC hKey,
+ [ in ] uint32 cbInData,
+ [ in, size_is(cbInData)] uint8 *lpInData,
+ [ out ] uint32 *cbOutData,
+ [ out, size_is(,*cbOutData) ] uint8 ** lpOutData,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x92 */
+
+ WERROR
+ clusapi_RestartResource(
+ [ in ] HRES_RPC hResource,
+ [ in ] uint32 dwFlags,
+ [ out ] WERROR *rpc_status
+ );
+
+ typedef struct {
+ uint32 dwNotifyKey;
+ uint32 dwFilter;
+ [string] [charset(UTF16)] uint16 *Name;
+ } NOTIFICATION_DATA_ASYNC_RPC;
+
+ /*****************/
+ /* Function 0x93 */
+
+ WERROR
+ clusapi_GetNotifyAsync(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ out, size_is(,*dwNumNotifications) ] NOTIFICATION_DATA_ASYNC_RPC **Notifications,
+ [ out ] uint32 *dwNumNotifications
+ );
+
+ typedef enum {
+ DiskIdSignature = 0x00000001,
+ DiskIdGuid = 0x00000002,
+ DiskIdUnKnown = 0x00001388
+ } CLUSDSK_DISKID_ENUM;
+
+#if 0
+ typedef struct {
+ CLUSDSK_DISKID_ENUM DiskIdType;
+ [switch_is(DiskIdType)] union {
+ [case(DiskIdSignature)] uint32 DiskSignature;
+ [case(DiskIdGuid)] GUID DiskGuid;
+ };
+ } CLUSDSK_DISKID;
+#endif
+ typedef enum {
+ CLUSPROP_TYPE_ENDMARK = 0x0000,
+ CLUSPROP_TYPE_LIST_VALUE = 0x0001,
+ CLUSPROP_TYPE_RESCLASS = 0x0002,
+ CLUSPROP_TYPE_NAME = 0x0004,
+ CLUSPROP_TYPE_SIGNATURE = 0x0005,
+ CLUSPROP_TYPE_SCSIADDRESS = 0x0006,
+ CLUSPROP_TYPE_DISK_NUMBER = 0x0007,
+ CLUSPROP_TYPE_PARTITION_INFO = 0x0008,
+ CLUSPROP_TYPE_DISK_SERIALNUMBER = 0x000a,
+ CLUSPROP_TYPE_DISK_GUID = 0x000b,
+ CLUSPROP_TYPE_DISK_SIZE = 0x000c,
+ CLUSPROP_TYPE_PARTITION_INFO_EX = 0x000d
+ } CLUSTER_PROPERTY_TYPE;
+
+ typedef enum {
+ CLUSPROP_FORMAT_UNKNOWN = 0x0000,
+ CLUSPROP_FORMAT_BINARY = 0x0001,
+ CLUSPROP_FORMAT_DWORD = 0x0002,
+ CLUSPROP_FORMAT_SZ = 0x0003,
+ CLUSPROP_FORMAT_EXPAND_SZ = 0x0004,
+ CLUSPROP_FORMAT_MULTI_SZ = 0x0005,
+ CLUSPROP_FORMAT_ULARGE_INTEGER = 0x0006,
+ CLUSPROP_FORMAT_LONG = 0x0007,
+ CLUSPROP_FORMAT_EXPANDED_SZ = 0x0008,
+ CLUSPROP_FORMAT_SECURITY_DESCRIPTOR = 0x0009,
+ CLUSPROP_FORMAT_LARGE_INTEGER = 0x000a,
+ CLUSPROP_FORMAT_WORD = 0x000b,
+ CLUSPROP_FORMAT_FILETIME = 0x000c
+ } CLUSTER_PROPERTY_FORMAT;
+
+ typedef enum {
+ CLUS_CHAR_UNKNOWN = 0x00000000,
+ CLUS_CHAR_QUORUM = 0x00000001,
+ CLUS_CHAR_DELETE_REQUIRES_ALL_NODES = 0x00000002,
+ CLUS_CHAR_LOCAL_QUORUM = 0x00000004,
+ CLUS_CHAR_BROADCAST_DELETE = 0x00000020,
+ CLUS_CHAR_SINGLE_CLUSTER_INSTANCE = 0x00000040,
+ CLUS_CHAR_SINGLE_GROUP_INSTANCE = 0x00000080,
+ CLUS_CHAR_COEXIST_IN_SHARED_VOLUME_GROUP = 0x00000100,
+ CLUS_CHAR_RESERVED1 = 0x00000200,
+ CLUS_CHAR_MONITOR_DETACH = 0x00000400,
+ CLUS_CHAR_RESERVED2 = 0x00000800,
+ CLUS_CHAR_RESERVED3 = 0x00001000,
+ CLUS_CHAR_RESERVED4 = 0x00002000
+ } CLUS_CHARACTERISTICS;
+
+ typedef enum {
+ CLUS_FLAG_CORE = 0x00000001
+ } CLUS_FLAGS;
+
+ typedef enum {
+ MaintenanceModeTypeDisableIsAliveCheck = 1,
+ MaintenanceModeTypeOfflineResource = 2,
+ MaintenanceModeTypeUnclusterResource = 3
+ } MAINTENANCE_MODE_TYPE;
+
+ typedef enum {
+ CLUSTER_CHANGE_NODE_STATE = 0x00000001,
+ CLUSTER_CHANGE_NODE_DELETED = 0x00000002,
+ CLUSTER_CHANGE_NODE_ADDED = 0x00000004,
+ CLUSTER_CHANGE_NODE_PROPERTY = 0x00000008,
+ CLUSTER_CHANGE_REGISTRY_NAME = 0x00000010,
+ CLUSTER_CHANGE_REGISTRY_ATTRIBUTES = 0x00000020,
+ CLUSTER_CHANGE_REGISTRY_VALUE = 0x00000040,
+ CLUSTER_CHANGE_REGISTRY_SUBTREE = 0x00000080,
+ CLUSTER_CHANGE_RESOURCE_STATE = 0x00000100,
+ CLUSTER_CHANGE_RESOURCE_DELETED = 0x00000200,
+ CLUSTER_CHANGE_RESOURCE_ADDED = 0x00000400,
+ CLUSTER_CHANGE_RESOURCE_PROPERTY = 0x00000800,
+ CLUSTER_CHANGE_GROUP_STATE = 0x00001000,
+ CLUSTER_CHANGE_GROUP_DELETED = 0x00002000,
+ CLUSTER_CHANGE_GROUP_ADDED = 0x00004000,
+ CLUSTER_CHANGE_GROUP_PROPERTY = 0x00008000,
+ CLUSTER_CHANGE_RESOURCE_TYPE_DELETED = 0x00010000,
+ CLUSTER_CHANGE_RESOURCE_TYPE_ADDED = 0x00020000,
+ CLUSTER_CHANGE_RESOURCE_TYPE_PROPERTY = 0x00040000,
+ CLUSTER_CHANGE_CLUSTER_RECONNECT = 0x00080000,
+ CLUSTER_CHANGE_NETWORK_STATE = 0x00100000,
+ CLUSTER_CHANGE_NETWORK_DELETED = 0x00200000,
+ CLUSTER_CHANGE_NETWORK_ADDED = 0x00400000,
+ CLUSTER_CHANGE_NETWORK_PROPERTY = 0x00800000,
+ CLUSTER_CHANGE_NETINTERFACE_STATE = 0x01000000,
+ CLUSTER_CHANGE_NETINTERFACE_DELETED = 0x02000000,
+ CLUSTER_CHANGE_NETINTERFACE_ADDED = 0x04000000,
+ CLUSTER_CHANGE_NETINTERFACE_PROPERTY = 0x08000000,
+ CLUSTER_CHANGE_QUORUM_STATE = 0x10000000,
+ CLUSTER_CHANGE_CLUSTER_STATE = 0x20000000,
+ CLUSTER_CHANGE_CLUSTER_PROPERTY = 0x40000000,
+ CLUSTER_CHANGE_HANDLE_CLOSE = 0x80000000
+ } CLUSTER_CHANGE;
+
+ typedef enum {
+ CLUSREG_SET_VALUE = 1,
+ CLUSREG_CREATE_KEY = 2,
+ CLUSREG_DELETE_KEY = 3,
+ CLUSREG_DELETE_VALUE = 4,
+ CLUSREG_VALUE_DELETED = 6,
+ CLUSREG_READ_KEY = 7,
+ CLUSREG_READ_VALUE = 8,
+ CLUSREG_READ_ERROR = 9
+ } CLUSTER_REG_BATCH_COMMAND;
+#if 0
+ typedef enum {
+ IDL_CLUSTER_SET_PASSWORD_IGNORE_DOWN_NODES = 1
+ } IDL_CLUSTER_SET_PASSWORD_FLAGS;
+#endif
+ typedef enum {
+ CLUSTER_QUORUM_MAINTAINED = 0,
+ CLUSTER_QUORUM_LOST = 1
+ } CLUSTER_QUORUM_VALUE;
+
+ typedef enum {
+ CLUSTER_OBJECT_TYPE_CLUSTER = 0x00000001,
+ CLUSTER_OBJECT_TYPE_GROUP = 0x00000002,
+ CLUSTER_OBJECT_TYPE_RESOURCE = 0x00000003,
+ CLUSTER_OBJECT_TYPE_RESOURCE_TYPE = 0x00000004,
+ CLUSTER_OBJECT_TYPE_NETWORK_INTERFACE = 0x00000005,
+ CLUSTER_OBJECT_TYPE_NETWORK = 0x00000006,
+ CLUSTER_OBJECT_TYPE_NODE = 0x00000007,
+ CLUSTER_OBJECT_TYPE_REGISTRY = 0x00000008,
+ CLUSTER_OBJECT_TYPE_QUORUM = 0x00000009,
+ CLUSTER_OBJECT_TYPE_SHARED_VOLUME = 0x0000000a
+ } CLUSTER_OBJECT_TYPE;
+
+ typedef enum {
+ CLUSTER_CHANGE_CLUSTER_RECONNECT_V2 = 0x00000001,
+ CLUSTER_CHANGE_CLUSTER_STATE_V2 = 0x00000002,
+ CLUSTER_CHANGE_CLUSTER_GROUP_ADDED_V2 = 0x00000004,
+ CLUSTER_CHANGE_CLUSTER_HANDLE_CLOSE_V2 = 0x00000008,
+ CLUSTER_CHANGE_CLUSTER_NETWORK_ADDED_V2 = 0x00000010,
+ CLUSTER_CHANGE_CLUSTER_NODE_ADDED_V2 = 0x00000020,
+ CLUSTER_CHANGE_CLUSTER_RESOURCE_TYPE_ADDED_V2 = 0x00000040,
+ CLUSTER_CHANGE_CLUSTER_COMMON_PROPERTY_V2 = 0x00000080,
+ CLUSTER_CHANGE_CLUSTER_PRIVATE_PROPERTY_V2 = 0x00000100,
+ CLUSTER_CHANGE_CLUSTER_LOST_NOTIFICATIONS_V2 = 0x00000200,
+ CLUSTER_CHANGE_CLUSTER_RENAME_V2 = 0x00000400
+ } CLUSTER_CHANGE_CLUSTER_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_GROUP_DELETED_V2 = 0x00000001,
+ CLUSTER_CHANGE_GROUP_COMMON_PROPERTY_V2 = 0x00000002,
+ CLUSTER_CHANGE_GROUP_PRIVATE_PROPERTY_V2 = 0x00000004,
+ CLUSTER_CHANGE_GROUP_STATE_V2 = 0x00000008,
+ CLUSTER_CHANGE_GROUP_OWNER_NODE_V2 = 0x00000010,
+ CLUSTER_CHANGE_GROUP_PREFERRED_OWNERS_V2 = 0x00000020,
+ CLUSTER_CHANGE_GROUP_RESOURCE_ADDED_V2 = 0x00000040,
+ CLUSTER_CHANGE_GROUP_RESOURCE_GAINED_V2 = 0x00000080,
+ CLUSTER_CHANGE_GROUP_RESOURCE_LOST_V2 = 0x00000100,
+ CLUSTER_CHANGE_GROUP_HANDLE_CLOSE_V2 = 0x00000200
+ } CLUSTER_CHANGE_GROUP_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_RESOURCE_COMMON_PROPERTY_V2 = 0x00000001,
+ CLUSTER_CHANGE_RESOURCE_PRIVATE_PROPERTY_V2 = 0x00000002,
+ CLUSTER_CHANGE_RESOURCE_STATE_V2 = 0x00000004,
+ CLUSTER_CHANGE_RESOURCE_OWNER_GROUP_V2 = 0x00000008,
+ CLUSTER_CHANGE_RESOURCE_DEPENDENCIES_V2 = 0x00000010,
+ CLUSTER_CHANGE_RESOURCE_DEPENDENTS_V2 = 0x00000020,
+ CLUSTER_CHANGE_RESOURCE_POSSIBLE_OWNERS_V2 = 0x00000040,
+ CLUSTER_CHANGE_RESOURCE_DELETED_V2 = 0x00000080,
+ CLUSTER_CHANGE_RESOURCE_DLL_UPGRADED_V2 = 0x00000100,
+ CLUSTER_CHANGE_RESOURCE_HANDLE_CLOSE_V2 = 0x00000200
+ } CLUSTER_CHANGE_RESOURCE_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_RESOURCE_TYPE_DELETED_V2 = 0x00000001,
+ CLUSTER_CHANGE_RESOURCE_TYPE_COMMON_PROPERTY_V2 = 0x00000002,
+ CLUSTER_CHANGE_RESOURCE_TYPE_PRIVATE_PROPERTY_V2 = 0x00000004,
+ CLUSTER_CHANGE_RESOURCE_TYPE_POSSIBLE_OWNERS_V2 = 0x00000008,
+ CLUSTER_CHANGE_RESOURCE_TYPE_DLL_UPGRADED_V2 = 0x00000010
+ } CHANGE_RESOURCE_TYPE_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_NETINTERFACE_DELETED_V2 = 0x00000001,
+ CLUSTER_CHANGE_NETINTERFACE_COMMON_PROPERTY_V2 = 0x00000002,
+ CLUSTER_CHANGE_NETINTERFACE_PRIVATE_PROPERTY_V2 = 0x00000004,
+ CLUSTER_CHANGE_NETINTERFACE_STATE_V2 = 0x00000008,
+ CLUSTER_CHANGE_NETINTERFACE_HANDLE_CLOSE_V2 = 0x00000010
+ } CLUSTER_CHANGE_NETINTERFACE_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_NETWORK_DELETED_V2 = 0x00000001,
+ CLUSTER_CHANGE_NETWORK_COMMON_PROPERTY_V2 = 0x00000002,
+ CLUSTER_CHANGE_NETWORK_PRIVATE_PROPERTY_V2 = 0x00000004,
+ CLUSTER_CHANGE_NETWORK_STATE_V2 = 0x00000008,
+ CLUSTER_CHANGE_NETWORK_HANDLE_CLOSE_V2 = 0x00000010
+ } CLUSTER_CHANGE_NETWORK_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_NODE_NETINTERFACE_ADDED_V2 = 0x00000001,
+ CLUSTER_CHANGE_NODE_DELETED_V2 = 0x00000002,
+ CLUSTER_CHANGE_NODE_COMMON_PROPERTY_V2 = 0x00000004,
+ CLUSTER_CHANGE_NODE_PRIVATE_PROPERTY_V2 = 0x00000008,
+ CLUSTER_CHANGE_NODE_STATE_V2 = 0x00000010,
+ CLUSTER_CHANGE_NODE_GROUP_GAINED_V2 = 0x00000020,
+ CLUSTER_CHANGE_NODE_GROUP_LOST_V2 = 0x00000040,
+ CLUSTER_CHANGE_NODE_HANDLE_CLOSE_V2 = 0x00000080
+ } CLUSTER_CHANGE_NODE_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_REGISTRY_ATTRIBUTES_V2 = 0x00000001,
+ CLUSTER_CHANGE_REGISTRY_NAME_V2 = 0x00000002,
+ CLUSTER_CHANGE_REGISTRY_SUBTREE_V2 = 0x00000004,
+ CLUSTER_CHANGE_REGISTRY_VALUE_V2 = 0x00000008,
+ CLUSTER_CHANGE_REGISTRY_HANDLE_CLOSE_V2 = 0x00000010
+ } CLUSTER_CHANGE_REGISTRY_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_QUORUM_STATE_V2 = 0x00000001
+ } CLUSTER_CHANGE_QUORUM_V2;
+
+ typedef enum {
+ CLUSTER_CHANGE_SHARED_VOLUME_STATE_V2 = 0x00000001
+ } CLUSTER_CHANGE_SHARED_VOLUME_V2;
+#if 0
+ typedef enum {
+ DiskIdSignature = 0x00000001,
+ DiskIdGuid = 0x00000002,
+ DiskIdUnKnown = 0x00001388
+ } CLUSDSK_DISKID_ENUM;
+#endif
+
+ /*****************/
+ /* Function 0x94 */
+
+ WERROR
+ Opnum148NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x95 */
+
+ WERROR
+ Opnum149otUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x96 */
+
+ WERROR
+ Opnum150NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x97 */
+
+ WERROR
+ Opnum151NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x98 */
+
+ WERROR
+ Opnum152NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x99 */
+
+ WERROR
+ Opnum153NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x9A */
+
+ WERROR
+ Opnum154NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x9B */
+
+ WERROR
+ clusapi_AddNotifyResourceTypeV2(
+ [ in ] HNOTIFY_RPC hNotify,
+ [ in ] hyper filter,
+ [ in ] uint32 dwNotifyKey,
+ [ in, string ] [charset(UTF16)] uint16 *resTypeName,
+ [ in ] uint32 dwVersion,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x9C */
+
+ WERROR
+ Opnum156NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x9D */
+
+ WERROR
+ clusapi_ExecuteReadBatchEx(
+ [in] HKEY_RPC hKey,
+ [in] uint32 cbInData,
+ [in, size_is(cbInData)] uint8* lpInData,
+ [in] uint32 flags,
+ [out] uint32* cbOutData,
+ [out, size_is(,*cbOutData)] uint8** lpOutData,
+ [out] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0x9E */
+
+ WERROR
+ Opnum158NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0x9F */
+
+ WERROR
+ Opnum159NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0xA0 */
+
+ WERROR
+ Opnum160NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0xA1 */
+
+ WERROR
+ Opnum161NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0xA2 */
+
+ WERROR
+ Opnum162NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0xA3 */
+
+#define HGROUPSET_RPC policy_handle
+#if 0
+ typedef [context_handle] void *HGROUPSET_RPC;
+#endif
+#if 0
+ HGROUPSET_RPC
+ clusapi_CreateGroupSet (
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_CreateGroupSet (
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HGROUPSET_RPC *hGroupSet
+ );
+#endif
+
+ /*****************/
+ /* Function 0xA4 */
+#if 0
+ HGROUPSET_RPC
+ clusapi_OpenGroupSet(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status
+ );
+#else
+ void
+ clusapi_OpenGroupSet(
+ [ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName,
+ [ out ] WERROR *Status,
+ [ out ] WERROR *rpc_status,
+ [ out ] HGROUPSET_RPC *hGroupSet
+ );
+#endif
+
+ /*****************/
+ /* Function 0xA5 */
+
+ WERROR
+ clusapi_CloseGroupSet(
+ [ in, out ] HGROUPSET_RPC *GroupSet
+ );
+
+ /*****************/
+ /* Function 0xA6 */
+
+ WERROR
+ clusapi_DeleteGroupSet(
+ [ in ] HGROUPSET_RPC GroupSet,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xA7 */
+
+ WERROR
+ clusapi_AddGroupToGroupSet(
+ [ in ] HGROUPSET_RPC GroupSet,
+ [ in ] HGROUP_RPC Group,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xA8 */
+
+ WERROR
+ clusapi_RemoveGroupFromGroupSet(
+ [ in ] HGROUP_RPC Group,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xA9 */
+
+ WERROR
+ clusapi_MoveGroupToGroupSet(
+ [ in ] HGROUPSET_RPC GroupSet,
+ [ in ] HGROUP_RPC Group,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xAA */
+
+ WERROR
+ Opnum170NotUsedOnWire(void);
+
+ /*****************/
+ /* Function 0xAB */
+
+ WERROR
+ clusapi_AddGroupSetDependency(
+ [ in ] HGROUPSET_RPC DependentGroupSet,
+ [ in ] HGROUPSET_RPC ProviderGroupSet,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xAC */
+
+ WERROR
+ clusapi_AddGroupToGroupSetDependency(
+ [ in ] HGROUP_RPC DependentGroup,
+ [ in ] HGROUPSET_RPC ProviderGroupSet,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xAD */
+
+ typedef [v1_enum] enum {
+ CLUSCTL_GROUPSET_GET_ID = 0x08000039,
+ CLUSCTL_GROUPSET_GET_RO_COMMON_PROPERTIES = 0x08000055,
+ CLUSCTL_GROUPSET_GET_COMMON_PROPERTIES = 0x08000059,
+ CLUSCTL_GROUPSET_GET_GROUPS = 0x08002D71,
+ CLUSCTL_GROUPSET_GET_PROVIDER_GROUPS = 0x08002D75,
+ CLUSCTL_GROUPSET_GET_PROVIDER_GROUPSETS = 0x08002D79,
+ CLUSCTL_GROUPSET_SET_COMMON_PROPERTIES = 0x0840005E
+ } clusapi_GroupSetControlCode;
+
+ WERROR
+ clusapi_NodeGroupSetControl(
+ [ in ] HGROUPSET_RPC hGroupSet,
+ [ in ] HNODE_RPC hNode,
+ [ in ] clusapi_GroupSetControlCode dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize), length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in, range(0, MAX_CLUSTER_CONTROL_CODE_BUFFER_SIZE)] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xAE */
+
+ WERROR
+ clusapi_GroupSetControl(
+ [ in ] HGROUPSET_RPC hGroupSet,
+ [ in ] clusapi_GroupSetControlCode dwControlCode,
+ [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+ [ in ] uint32 nInBufferSize,
+ [ out, size_is(nOutBufferSize), length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+ [ in, range(0, 0x7FFFFFFF)] uint32 nOutBufferSize,
+ [ out ] uint32 *lpBytesReturned,
+ [ out ] uint32 *lpcbRequired,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xAF */
+
+ WERROR
+ clusapi_SetGroupDependencyExpression(
+ [ in ] HGROUP_RPC hGroup,
+ [ in, string ] [charset(UTF16)] uint16 *lpszDependencyExpression,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xB0 */
+
+ WERROR
+ clusapi_RemoveClusterGroupDependency(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] HGROUP_RPC hDependsOn,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xB1 */
+
+ WERROR
+ clusapi_SetGroupSetDependencyExpression(
+ [ in ] HGROUPSET_RPC hGroupSet,
+ [ in, string ] [charset(UTF16)] uint16 *lpszDependencyExpression,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xB2 */
+
+ WERROR
+ clusapi_RemoveGroupSetDependency(
+ [ in ] HGROUPSET_RPC hGroupSet,
+ [ in ] HGROUPSET_RPC hDependsOn,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xB3 */
+
+ WERROR
+ clusapi_RemoveClusterGroupToGroupSetDependency(
+ [ in ] HGROUP_RPC hGroup,
+ [ in ] HGROUPSET_RPC hDependsOn,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xB4 */
+
+ WERROR
+ clusapi_CreateGroupSetEnum(
+ [ in ] HCLUSTER_RPC hCluster,
+ [ out ] ENUM_LIST **ReturnEnum,
+ [ out ] WERROR * rpc_status
+ );
+
+ /*****************/
+ /* Function 0xB5 */
+
+ WERROR
+ clusapi_CreateNetInterfaceEnum(
+ [in] HCLUSTER_RPC hCluster,
+ [in, string] [charset(UTF16)] uint16 *lpszNodeName,
+ [in, string] [charset(UTF16)] uint16 *lpszNetworkName,
+ [out] ENUM_LIST **ReturnEnum,
+ [out] WERROR * rpc_status
+ );
+
+ /*****************/
+ /* Function 0xB6 */
+
+ WERROR
+ clusapi_ChangeCsvStateEx(
+ [ in ] HRES_RPC hResource,
+ [ in ] uint32 dwState,
+ [ in, string ] [charset(UTF16)] uint16 *lpszVolumeName,
+ [ out ] WERROR *rpc_status
+ );
+
+ /*****************/
+ /* Function 0xB7 */
+
+ WERROR
+ clusapi_AddGroupToGroupSetEx(
+ [ in ] HGROUPSET_RPC GroupSet,
+ [ in ] HGROUP_RPC Group,
+ [ in ] uint32 FaultDomain,
+ [ in ] uint32 UpdateDomain,
+ [ in ] boolean8 UseDomains,
+ [ in ] uint32 *Reserved,
+ [ out ] WERROR *rpc_status
+ );
+}
diff --git a/librpc/idl/dbgidl.idl b/librpc/idl/dbgidl.idl
new file mode 100644
index 0000000..0712392
--- /dev/null
+++ b/librpc/idl/dbgidl.idl
@@ -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();
+}
diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
new file mode 100644
index 0000000..1850526
--- /dev/null
+++ b/librpc/idl/dcerpc.idl
@@ -0,0 +1,662 @@
+#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 [C706 - DCE 1.1: Remote Procedure Call] for the OpenGroup
+ DCERPC specification:
+ http://pubs.opengroup.org/onlinepubs/9629399/toc.htm
+
+ See C706 - Chapter 12: RPC PDU Encodings for packet layouts:
+ http://www.opengroup.org/onlinepubs/9629399/chap12.htm
+
+ See also [MS-RPCE] for the Microsoft
+ "Remote Procedure Call Protocol Extensions".
+ http://msdn.microsoft.com/en-us/library/cc243560.aspx
+
+*/
+import "misc.idl";
+
+cpp_quote("extern const uint8_t DCERPC_SEC_VT_MAGIC[8];")
+
+[
+ helper("../librpc/ndr/ndr_dcerpc.h")
+]
+interface dcerpc
+{
+ typedef struct {
+ uint16 context_id;
+ uint8 num_transfer_syntaxes;
+ ndr_syntax_id abstract_syntax;
+ ndr_syntax_id transfer_syntaxes[num_transfer_syntaxes];
+ } dcerpc_ctx_list;
+
+ typedef [public] 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_REMAINING)] DATA_BLOB auth_info;
+ } dcerpc_bind;
+
+ const uint8 DCERPC_REQUEST_LENGTH = 24;
+
+ typedef struct {
+ } dcerpc_empty;
+
+ typedef [nodiscriminant] union {
+ [case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
+ [default] dcerpc_empty empty;
+ } dcerpc_object;
+
+ typedef struct {
+ uint32 alloc_hint;
+ uint16 context_id;
+ uint16 opnum;
+ /*
+ * NDR_DCERPC_REQUEST_OBJECT_PRESENT
+ * is defined differently for ndr_dcerpc.c and py_dcerpc.c
+ */
+ [switch_is(NDR_DCERPC_REQUEST_OBJECT_PRESENT)] dcerpc_object object;
+ [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
+ } dcerpc_request;
+
+ typedef [enum16bit] enum {
+ DCERPC_BIND_ACK_RESULT_ACCEPTANCE = 0,
+ DCERPC_BIND_ACK_RESULT_USER_REJECTION = 1,
+ DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION = 2,
+ DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK = 3
+ } dcerpc_bind_ack_result;
+
+ const int DCERPC_BIND_PROVIDER_REJECT =
+ DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION;
+
+ typedef [enum16bit] enum {
+ DCERPC_BIND_ACK_REASON_NOT_SPECIFIED = 0,
+ DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED = 1,
+ DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED = 2,
+ DCERPC_BIND_ACK_REASON_LOCAL_LIMIT_EXCEEDED = 3
+ } dcerpc_bind_ack_reason_values;
+
+ const int DCERPC_BIND_REASON_ASYNTAX =
+ DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED;
+
+ typedef [bitmap16bit] bitmap {
+ DCERPC_BIND_TIME_SECURITY_CONTEXT_MULTIPLEXING = 0x0001,
+ DCERPC_BIND_TIME_KEEP_CONNECTION_ON_ORPHAN = 0x0002
+ } dcerpc_bind_time_features;
+
+ typedef [nodiscriminant] union {
+ [case(DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK)]
+ dcerpc_bind_time_features negotiate;
+ [default] dcerpc_bind_ack_reason_values value;
+ } dcerpc_bind_ack_reason;
+
+ typedef struct {
+ dcerpc_bind_ack_result result;
+ [switch_is(result)] dcerpc_bind_ack_reason reason;
+ ndr_syntax_id syntax;
+ } dcerpc_ack_ctx;
+
+ typedef struct {
+ uint16 max_xmit_frag;
+ uint16 max_recv_frag;
+ uint32 assoc_group_id;
+ [value(strlen_m_term_null(secondary_address))] uint16 secondary_address_size;
+ [charset(DOS)] uint8 secondary_address[secondary_address_size];
+ [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 [public,enum16bit] enum {
+ DCERPC_BIND_NAK_REASON_NOT_SPECIFIED = 0,
+ DCERPC_BIND_NAK_REASON_TEMPORARY_CONGESTION = 1,
+ DCERPC_BIND_NAK_REASON_LOCAL_LIMIT_EXCEEDED = 2,
+ DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED = 4,
+ DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE = 8,
+ DCERPC_BIND_NAK_REASON_INVALID_CHECKSUM = 9
+ } dcerpc_bind_nak_reason;
+
+ const int DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED =
+ DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED;
+ const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE =
+ DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE;
+
+ typedef [public] struct {
+ uint8 rpc_vers; /* RPC version */
+ uint8 rpc_vers_minor; /* Minor version */
+ } dcerpc_bind_nak_version;
+
+ typedef [public,nopull] struct {
+ dcerpc_bind_nak_reason reject_reason;
+ uint8 num_versions;
+ dcerpc_bind_nak_version versions[num_versions];
+ [flag(NDR_REMAINING)] DATA_BLOB _pad;
+ } dcerpc_bind_nak;
+
+ const uint8 DCERPC_RESPONSE_LENGTH = 24;
+
+ typedef struct {
+ uint32 alloc_hint;
+ uint16 context_id;
+ uint8 cancel_count;
+ [value(0)] uint8 reserved;
+ [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
+ } dcerpc_response;
+
+ typedef [v1_enum] enum {
+ DCERPC_NCA_S_COMM_FAILURE = 0x1C010001,
+ DCERPC_NCA_S_OP_RNG_ERROR = 0x1C010002,
+ DCERPC_NCA_S_UNKNOWN_IF = 0x1C010003,
+ DCERPC_NCA_S_WRONG_BOOT_TIME = 0x1C010006,
+ DCERPC_NCA_S_YOU_CRASHED = 0x1C010009,
+ DCERPC_NCA_S_PROTO_ERROR = 0x1C01000B,
+ DCERPC_NCA_S_OUT_ARGS_TOO_BIG = 0x1C010013,
+ DCERPC_NCA_S_SERVER_TOO_BUSY = 0x1C010014,
+ DCERPC_NCA_S_FAULT_STRING_TOO_LARGE = 0x1C010015,
+ DCERPC_NCA_S_UNSUPPORTED_TYPE = 0x1C010017,
+ DCERPC_NCA_S_FAULT_INT_DIV_BY_ZERO = 0x1C000001,
+ DCERPC_NCA_S_FAULT_ADDR_ERROR = 0x1C000002,
+ DCERPC_NCA_S_FAULT_FP_DIV_BY_ZERO = 0x1C000003,
+ DCERPC_NCA_S_FAULT_FP_UNDERFLOW = 0x1C000004,
+ DCERPC_NCA_S_FAULT_FP_OVERRFLOW = 0x1C000005,
+ DCERPC_NCA_S_FAULT_INVALID_TAG = 0x1C000006,
+ DCERPC_NCA_S_FAULT_INVALID_BOUND = 0x1C000007,
+ DCERPC_NCA_S_FAULT_RPC_VERSION_MISMATCH = 0x1C000008,
+ DCERPC_NCA_S_FAULT_UNSPEC_REJECT = 0x1C000009,
+ DCERPC_NCA_S_FAULT_BAD_ACTID = 0x1C00000A,
+ DCERPC_NCA_S_FAULT_WHO_ARE_YOU_FAILED = 0x1C00000B,
+ DCERPC_NCA_S_FAULT_MANAGER_NOT_ENTERED = 0x1C00000C,
+ DCERPC_NCA_S_FAULT_CANCEL = 0x1C00000D,
+ DCERPC_NCA_S_FAULT_ILL_INST = 0x1C00000E,
+ DCERPC_NCA_S_FAULT_FP_ERROR = 0x1C00000F,
+ DCERPC_NCA_S_FAULT_INT_OVERFLOW = 0x1C000010,
+ DCERPC_NCA_S_UNUSED_1C000011 = 0x1C000011,
+ DCERPC_NCA_S_FAULT_UNSPEC = 0x1C000012,
+ DCERPC_NCA_S_FAULT_REMOTE_COMM_FAILURE = 0x1C000013,
+ DCERPC_NCA_S_FAULT_PIPE_EMPTY = 0x1C000014,
+ DCERPC_NCA_S_FAULT_PIPE_CLOSED = 0x1C000015,
+ DCERPC_NCA_S_FAULT_PIPE_ORDER = 0x1C000016,
+ DCERPC_NCA_S_FAULT_PIPE_DISCIPLINE = 0x1C000017,
+ DCERPC_NCA_S_FAULT_PIPE_COMM_ERROR = 0x1C000018,
+ DCERPC_NCA_S_FAULT_PIPE_MEMORY = 0x1C000019,
+ DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH = 0x1C00001A,
+ DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY = 0x1C00001B,
+ DCERPC_NCA_S_INVALID_PRES_CONTEXT_ID = 0x1C00001C,
+ DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL = 0x1C00001D,
+ DCERPC_NCA_S_UNUSED_1C00001E = 0x1C00001E,
+ DCERPC_NCA_S_INVALID_CHECKSUM = 0x1C00001F,
+ DCERPC_NCA_S_INVALID_CRC = 0x1C000020,
+ DCERPC_NCA_S_FAULT_USER_DEFINED = 0x1C000021,
+ DCERPC_NCA_S_FAULT_TX_OPEN_FAILED = 0x1C000022,
+ DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR = 0x1C000023,
+ DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND = 0x1C000024,
+ DCERPC_NCA_S_FAULT_NO_CLIENT_STUB = 0x1C000025,
+ DCERPC_FAULT_ACCESS_DENIED = 0x00000005,
+ DCERPC_FAULT_SERVER_UNAVAILABLE = 0x000006ba,
+ DCERPC_FAULT_NO_CALL_ACTIVE = 0x000006bd,
+ DCERPC_FAULT_CANT_PERFORM = 0x000006d8,
+ DCERPC_FAULT_OUT_OF_RESOURCES = 0x000006d9,
+ DCERPC_FAULT_BAD_STUB_DATA = 0x000006f7,
+ DCERPC_FAULT_SEC_PKG_ERROR = 0x00000721
+ } dcerpc_nca_status;
+
+ const int DCERPC_FAULT_OP_RNG_ERROR = DCERPC_NCA_S_OP_RNG_ERROR;
+ const int DCERPC_FAULT_NDR = DCERPC_FAULT_BAD_STUB_DATA;
+ const int DCERPC_FAULT_INVALID_TAG = DCERPC_NCA_S_FAULT_INVALID_TAG;
+ const int DCERPC_FAULT_CONTEXT_MISMATCH = DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH;
+ const int DCERPC_FAULT_OTHER = 0x00000001;
+
+ /* 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 [bitmap8bit] bitmap {
+ DCERPC_FAULT_FLAG_EXTENDED_ERROR_INFORMATION = 0x01
+ } dcerpc_fault_flags;
+
+ typedef struct {
+ uint32 alloc_hint;
+ uint16 context_id;
+ uint8 cancel_count;
+ dcerpc_fault_flags flags;
+ dcerpc_nca_status status;
+ [value(0)] uint32 reserved;
+ [flag(NDR_REMAINING)] DATA_BLOB error_and_verifier;
+ } dcerpc_fault;
+
+ const uint8 DCERPC_FAULT_LENGTH = 32;
+
+ /* the auth types we know about */
+ typedef [enum8bit] enum {
+ DCERPC_AUTH_TYPE_NONE = 0,
+ /* this seems to be not krb5! */
+ DCERPC_AUTH_TYPE_KRB5_1 = 1,
+ DCERPC_AUTH_TYPE_SPNEGO = 9,
+ DCERPC_AUTH_TYPE_NTLMSSP = 10,
+ DCERPC_AUTH_TYPE_KRB5 = 16,
+ DCERPC_AUTH_TYPE_DPA = 17,
+ DCERPC_AUTH_TYPE_MSN = 18,
+ DCERPC_AUTH_TYPE_DIGEST = 21,
+ DCERPC_AUTH_TYPE_SCHANNEL = 68,
+ DCERPC_AUTH_TYPE_MSMQ = 100,
+ DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM = 200
+ } dcerpc_AuthType;
+ const char *AS_SYSTEM_MAGIC_PATH_TOKEN = "/root/ncalrpc_as_system";
+
+ typedef [enum8bit] enum {
+ DCERPC_AUTH_LEVEL_NONE = 1,
+ DCERPC_AUTH_LEVEL_CONNECT = 2,
+ DCERPC_AUTH_LEVEL_CALL = 3,
+ DCERPC_AUTH_LEVEL_PACKET = 4,
+ DCERPC_AUTH_LEVEL_INTEGRITY = 5,
+ DCERPC_AUTH_LEVEL_PRIVACY = 6
+ } dcerpc_AuthLevel;
+
+ typedef [public] struct {
+ dcerpc_AuthType auth_type;
+ dcerpc_AuthLevel auth_level;
+ uint8 auth_pad_length;
+ uint8 auth_reserved;
+ uint32 auth_context_id;
+ [flag(NDR_REMAINING)] DATA_BLOB credentials;
+ } dcerpc_auth;
+
+ const uint8 DCERPC_AUTH_TRAILER_LENGTH = 8;
+ const uint8 DCERPC_AUTH_PAD_ALIGNMENT = 16;
+
+ typedef [public] struct {
+ [value(0)] uint32 _pad;
+ [flag(NDR_REMAINING)] DATA_BLOB auth_info;
+ } dcerpc_auth3;
+
+ typedef [public] struct {
+ [flag(NDR_REMAINING)] DATA_BLOB auth_info;
+ } dcerpc_orphaned;
+
+ typedef [public] struct {
+ [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;
+
+ /* RTS data structures */
+ typedef [public] struct {
+ GUID Cookie;
+ } RTSCookie;
+
+ typedef [v1_enum,public] enum {
+ RTS_IPV4 = 0,
+ RTS_IPV6 = 1
+ } AddressType;
+
+ typedef [nodiscriminant] union {
+ [case(RTS_IPV4)] ipv4address ClientAddressIPV4;
+ [case(RTS_IPV6)] ipv6address ClientAddressIPV6;
+ } ClientAddressType;
+
+ typedef [public] struct {
+ AddressType AddressType;
+ [switch_is(AddressType)] ClientAddressType ClientAddress;
+ uint8 Padding[12];
+ } ClientAddress;
+
+ typedef [v1_enum, public] enum {
+ FDClient = 0,
+ FDInProxy = 1,
+ FDServer = 2,
+ FDOutProxy = 3
+ } ForwardDestination;
+
+ typedef [public] struct {
+ uint32 BytesReceived;
+ uint32 AvailableWindow;
+ RTSCookie ChannelCookie;
+ } FlowControlAcknowledgment;
+
+ /* RTS commands */
+
+ /* RTS command: 0x0 */
+ typedef [public] struct {
+ [range(0x2000,0x40000)] uint32 ReceiveWindowSize;
+ } dcerpc_rts_cmd_ReceiveWindowSize;
+
+ /* RTS command: 0x1 */
+ typedef [public] struct {
+ FlowControlAcknowledgment Ack;
+ } dcerpc_rts_cmd_FlowControlAck;
+
+ /* RTS command: 0x2 */
+ typedef [public] struct {
+ [range(0x1D4C0,0xDBBA00)] uint32 ConnectionTimeout;
+ } dcerpc_rts_cmd_ConnectionTimeout;
+
+ /* RTS command: 0x3 */
+ typedef [public] struct {
+ RTSCookie Cookie;
+ } dcerpc_rts_cmd_Cookie;
+
+ /* RTS command: 0x4 */
+ typedef [public] struct {
+ [range(0x20000,0x80000000)] uint32 ChannelLifetime;
+ } dcerpc_rts_cmd_ChannelLifetime;
+
+ /* RTS command: 0x5 */
+ typedef [public] struct {
+ uint32 ClientKeepalive;
+ } dcerpc_rts_cmd_ClientKeepalive;
+
+ /* RTS command: 0x6 */
+ typedef [public] struct {
+ uint32 Version;
+ } dcerpc_rts_cmd_Version;
+
+ /* RTS command: 0x7 */
+ typedef [public] struct {
+ } dcerpc_rts_cmd_Empty;
+
+ /* RTS command: 0x8 */
+ typedef [public] struct {
+ [range(0x0,0xFFFF)] uint32 ConformanceCount;
+ uint8 Padding[ConformanceCount];
+ } dcerpc_rts_cmd_Padding;
+
+ /* RTS command: 0x9 */
+ typedef [public] struct {
+ } dcerpc_rts_cmd_NegativeANCE;
+
+ /* RTS Command: 0xA */
+ typedef [public] struct {
+ } dcerpc_rts_cmd_ANCE;
+
+ /* RTS command: 0xB */
+ typedef [public] struct {
+ ClientAddress ClientAddress;
+ } dcerpc_rts_cmd_ClientAddress;
+
+ /* RTS command: 0xC */
+ typedef [public] struct {
+ RTSCookie AssociationGroupId;
+ } dcerpc_rts_cmd_AssociationGroupId;
+
+ /* RTS command: 0xD */
+ typedef [public] struct {
+ ForwardDestination ForwardDestination;
+ } dcerpc_rts_cmd_Destination;
+
+ /* RTS command: 0xE */
+ typedef [public] struct {
+ uint32 PingTrafficSent;
+ } dcerpc_rts_cmd_PingTrafficSentNotify;
+
+ typedef [nodiscriminant] union {
+ [case(0x0)] dcerpc_rts_cmd_ReceiveWindowSize ReceiveWindowSize;
+ [case(0x1)] dcerpc_rts_cmd_FlowControlAck FlowControlAck;
+ [case(0x2)] dcerpc_rts_cmd_ConnectionTimeout ConnectionTimeout;
+ [case(0x3)] dcerpc_rts_cmd_Cookie Cookie;
+ [case(0x4)] dcerpc_rts_cmd_ChannelLifetime ChannelLifetime;
+ [case(0x5)] dcerpc_rts_cmd_ClientKeepalive ClientKeepalive;
+ [case(0x6)] dcerpc_rts_cmd_Version Version;
+ [case(0x7)] dcerpc_rts_cmd_Empty Empty;
+ [case(0x8)] dcerpc_rts_cmd_Padding Padding;
+ [case(0x9)] dcerpc_rts_cmd_NegativeANCE NegativeANCE;
+ [case(0xA)] dcerpc_rts_cmd_ANCE ANCE;
+ [case(0xB)] dcerpc_rts_cmd_ClientAddress ClientAddress;
+ [case(0xC)] dcerpc_rts_cmd_AssociationGroupId AssociationGroupId;
+ [case(0xD)] dcerpc_rts_cmd_Destination Destination;
+ [case(0xE)] dcerpc_rts_cmd_PingTrafficSentNotify PingTrafficSentNotify;
+ } dcerpc_rts_cmds;
+
+ typedef [public] struct {
+ uint32 CommandType;
+ [switch_is(CommandType)] dcerpc_rts_cmds Command;
+ } dcerpc_rts_cmd;
+
+ /* The RTS flags */
+ typedef [public, bitmap16bit] bitmap {
+ RTS_FLAG_NONE = 0x0000,
+ RTS_FLAG_PING = 0x0001,
+ RTS_FLAG_OTHER_CMD = 0x0002,
+ RTS_FLAG_RECYCLE_CHANNEL = 0x0004,
+ RTS_FLAG_IN_CHANNEL = 0x0008,
+ RTS_FLAG_OUT_CHANNEL = 0x0010,
+ RTS_FLAG_EOF = 0x0020,
+ RTS_FLAG_ECHO = 0x0040
+ } dcerpc_rts_flags;
+
+ typedef [public] struct {
+ dcerpc_rts_flags Flags;
+ uint16 NumberOfCommands;
+ dcerpc_rts_cmd Commands[NumberOfCommands];
+ } dcerpc_rts;
+
+ typedef [public,enum8bit] enum {
+ DCERPC_PKT_REQUEST = 0, /* Ordinary request. */
+ DCERPC_PKT_PING = 1, /* Connectionless is server alive ? */
+ DCERPC_PKT_RESPONSE = 2, /* Ordinary reply. */
+ DCERPC_PKT_FAULT = 3, /* Fault in processing of call. */
+ DCERPC_PKT_WORKING = 4, /* Connectionless reply to a ping when server busy. */
+ DCERPC_PKT_NOCALL = 5, /* Connectionless reply to a ping when server has lost part of clients call. */
+ DCERPC_PKT_REJECT = 6, /* Refuse a request with a code. */
+ DCERPC_PKT_ACK = 7, /* Connectionless client to server code. */
+ DCERPC_PKT_CL_CANCEL = 8, /* Connectionless cancel. */
+ DCERPC_PKT_FACK = 9, /* Connectionless fragment ack. Both client and server send. */
+ DCERPC_PKT_CANCEL_ACK = 10, /* Server ACK to client cancel request. */
+ DCERPC_PKT_BIND = 11, /* Bind to interface. */
+ DCERPC_PKT_BIND_ACK = 12, /* Server ack of bind. */
+ DCERPC_PKT_BIND_NAK = 13, /* Server nack of bind. */
+ DCERPC_PKT_ALTER = 14, /* Alter auth. */
+ DCERPC_PKT_ALTER_RESP = 15, /* Reply to alter auth. */
+ DCERPC_PKT_AUTH3 = 16, /* not the real name! this is undocumented! */
+ DCERPC_PKT_SHUTDOWN = 17, /* Server to client request to shutdown. */
+ DCERPC_PKT_CO_CANCEL = 18, /* Connection-oriented cancel request. */
+ DCERPC_PKT_ORPHANED = 19, /* Client telling server it's aborting a partially sent request or telling server to stop sending replies. */
+ DCERPC_PKT_RTS = 20 /* RTS packets used in ncacn_http */
+ } dcerpc_pkt_type;
+
+ typedef [public,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;
+ [case(DCERPC_PKT_RTS)] dcerpc_rts rts;
+ } dcerpc_payload;
+
+ /* pfc_flags values */
+ typedef [public,bitmap8bit] bitmap {
+ DCERPC_PFC_FLAG_FIRST = 0x01, /* First fragment */
+ DCERPC_PFC_FLAG_LAST = 0x02, /* Last fragment */
+ DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING = 0x04, /* depends on the pdu type */
+ DCERPC_PFC_FLAG_CONC_MPX = 0x10, /* supports concurrent multiplexing of a single connection. */
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE = 0x20, /* on a fault it means the server hasn't done anything */
+ DCERPC_PFC_FLAG_MAYBE = 0x40, /* `maybe' call semantics requested */
+ DCERPC_PFC_FLAG_OBJECT_UUID = 0x80 /* on valid guid is in the optional object field */
+ } dcerpc_pfc_flags;
+
+ /* Cancel was pending at sender */
+ const int DCERPC_PFC_FLAG_PENDING_CANCEL =
+ DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING;
+ const int DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN =
+ DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING;
+
+ /* these offsets are needed by the signing code */
+ const uint8 DCERPC_PFC_OFFSET = 3;
+ const uint8 DCERPC_DREP_OFFSET = 4;
+ const uint8 DCERPC_FRAG_LEN_OFFSET = 8;
+ const uint32 DCERPC_FRAG_MAX_SIZE = 5840;
+ const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
+ const uint8 DCERPC_NCACN_PAYLOAD_OFFSET = 16;
+
+ /*
+ * See [MS-RPCE] 3.3.3.5.4 Maximum Server Input Data Size
+ * 4 MByte is the default limit of reassembled request payload
+ */
+ const uint32 DCERPC_NCACN_REQUEST_DEFAULT_MAX_SIZE = 0x400000;
+
+ /*
+ * See [MS-RPCE] 3.3.2.5.2 Handling Responses
+ *
+ * Indicates that Windows accepts up to 0x7FFFFFFF ~2 GByte
+ *
+ * talloc has a limit of 256 MByte, so we need to use something smaller.
+ *
+ * For now we try our luck with 240 MByte.
+ */
+ const uint32 DCERPC_NCACN_RESPONSE_DEFAULT_MAX_SIZE = 0xf000000; /* 240 MByte */
+
+ /* little-endian flag */
+ const uint8 DCERPC_DREP_LE = 0x10;
+
+ typedef [public,nopush,nopull,noprint] struct {
+ uint8 rpc_vers; /* RPC version */
+ uint8 rpc_vers_minor; /* Minor version */
+ dcerpc_pkt_type ptype; /* Packet type */
+ dcerpc_pfc_flags 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;
+
+ typedef [bitmap16bit] bitmap {
+ DCERPC_SEC_VT_COMMAND_ENUM = 0x3FFF,
+ DCERPC_SEC_VT_COMMAND_END = 0x4000,
+ DCERPC_SEC_VT_MUST_PROCESS = 0x8000
+ } dcerpc_sec_vt_command;
+
+ typedef [enum16bit] enum {
+ DCERPC_SEC_VT_COMMAND_BITMASK1 = 0x0001,
+ DCERPC_SEC_VT_COMMAND_PCONTEXT = 0x0002,
+ DCERPC_SEC_VT_COMMAND_HEADER2 = 0x0003
+ } dcerpc_sec_vt_command_enum;
+
+ typedef [bitmap32bit] bitmap {
+ DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING = 0x00000001
+ } dcerpc_sec_vt_bitmask1;
+
+ typedef struct {
+ ndr_syntax_id abstract_syntax;
+ ndr_syntax_id transfer_syntax;
+ } dcerpc_sec_vt_pcontext;
+
+ typedef struct {
+ dcerpc_pkt_type ptype; /* Packet type */
+ [value(0)] uint8 reserved1;
+ [value(0)] uint16 reserved2;
+ uint8 drep[4]; /* NDR data representation */
+ uint32 call_id; /* Call identifier */
+ uint16 context_id;
+ uint16 opnum;
+ } dcerpc_sec_vt_header2;
+
+ typedef [switch_type(dcerpc_sec_vt_command_enum),nodiscriminant] union {
+ [case(DCERPC_SEC_VT_COMMAND_BITMASK1)] dcerpc_sec_vt_bitmask1 bitmask1;
+ [case(DCERPC_SEC_VT_COMMAND_PCONTEXT)] dcerpc_sec_vt_pcontext pcontext;
+ [case(DCERPC_SEC_VT_COMMAND_HEADER2)] dcerpc_sec_vt_header2 header2;
+ [default,flag(NDR_REMAINING)] DATA_BLOB _unknown;
+ } dcerpc_sec_vt_union;
+
+ typedef struct {
+ dcerpc_sec_vt_command command;
+ [switch_is(command & DCERPC_SEC_VT_COMMAND_ENUM)]
+ [subcontext(2),flag(NDR_SUBCONTEXT_NO_UNREAD_BYTES)]
+ dcerpc_sec_vt_union u;
+ } dcerpc_sec_vt;
+
+ typedef [public,nopush,nopull] struct {
+ uint16 count;
+ } dcerpc_sec_vt_count;
+
+ /*
+ * We assume that the whole verification trailer fits into
+ * the last 1024 bytes after the stub data.
+ *
+ * There're currently only 3 commands defined and each should
+ * only be used once.
+ */
+ const uint16 DCERPC_SEC_VT_MAX_SIZE = 1024;
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ [flag(NDR_ALIGN4)] DATA_BLOB _pad;
+ [value(DCERPC_SEC_VT_MAGIC)] uint8 magic[8];
+ dcerpc_sec_vt_count count;
+ dcerpc_sec_vt commands[count.count];
+ } dcerpc_sec_verification_trailer;
+}
diff --git a/librpc/idl/dcom.idl b/librpc/idl/dcom.idl
new file mode 100644
index 0000000..5559811
--- /dev/null
+++ b/librpc/idl/dcom.idl
@@ -0,0 +1,314 @@
+/**
+ DCOM interfaces
+ http://www.ietf.org/internet-drafts/draft-brown-dcom-v1-spec-04.txt
+ */
+
+import "misc.idl";
+
+[
+ 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),unique] 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,unique] GUID *ripid, /* interface to QI on */
+ [in] uint32 cRefs, /* count of AddRefs requested */
+ [in] uint16 cIids, /* count of IIDs that follow */
+ [in, unique, size_is(cIids)] GUID *iids, /* IIDs to QI for */
+ [out, size_is(cIids), unique] MInterfacePointer *ip
+ );
+
+ 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), unique] WERROR *pResults
+ );
+
+ [call_as(Release)] WERROR RemRelease (
+ [in] uint16 cInterfaceRefs,
+ [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
+ );
+}
+
+[
+ uuid("00000140-0000-0000-c000-000000000046"),
+ 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"),
+ object
+]
+ interface ISystemActivator : IClassActivator
+{
+ WERROR ISystemActivatorRemoteCreateInstance(
+ [in] hyper unknown1, /* OXID ? */
+ [in] MInterfacePointer iface1,
+ [in] hyper unknown2,
+ [out] uint32 *unknown3,
+ [out] 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), unique] GUID *iids,
+ [out, size_is(cIids), unique] WERROR *phr,
+ [out, size_is(cIids), unique] MInterfacePointer *ppMIF
+ );
+}
+
+[
+ object,
+ pointer_default(unique),
+ uuid("00020400-0000-0000-C000-000000000046")
+] interface IDispatch : IUnknown
+{
+ /*****************/
+ /* Function 0x03 */
+ WERROR GetTypeInfoCount(
+ [out, unique] uint16 *pctinfo
+ );
+
+ typedef struct {
+ } REF_ITypeInfo;
+
+ /*****************/
+ /* Function 0x04 */
+ WERROR GetTypeInfo (
+ [in] uint16 iTInfo,
+ [in] uint32 lcid,
+ [out, unique] 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), unique] uint32 *rgDispId
+ );
+
+ typedef struct {
+ uint16 vartype;
+ uint16 FIXME;
+ } VARIANT;
+
+ typedef struct {
+ uint16 FIXME;
+ } DISPPARAMS;
+
+ /* Exception ? */
+ typedef struct {
+ uint16 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, unique] VARIANT *pVarResult,
+ [out, unique] EXCEPINFO *pExcepInfo,
+ [out, unique] 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,
+ 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] uint32 *num_read
+ );
+
+ WERROR Write(
+ [in,size_is(num_requested),unique] uint8 *data,
+ [in] uint32 num_requested,
+ [out] uint32 *num_written
+ );
+}
+
+[
+ uuid("5e9ddec7-5767-11cf-beab-00aa006c3606"),
+ progid("Samba.Simple"),
+ helpstring("simple class"),
+ internal
+] coclass simple
+{
+ interface IStream;
+}
diff --git a/librpc/idl/dfs.idl b/librpc/idl/dfs.idl
new file mode 100644
index 0000000..1b145f3
--- /dev/null
+++ b/librpc/idl/dfs.idl
@@ -0,0 +1,419 @@
+/*
+ dfs interface definition
+*/
+
+import "misc.idl";
+
+[ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"),
+ version(3.0),
+ pointer_default(unique),
+ helpstring("Settings for Microsoft Distributed File System"),
+ endpoint("ncacn_np:[\\pipe\\netdfs]", "ncacn_ip_tcp:", "ncalrpc:")
+] interface netdfs
+{
+ /******************/
+ /* Function: 0x00 */
+ typedef [v1_enum] enum {
+ DFS_MANAGER_VERSION_NT4 = 1,
+ DFS_MANAGER_VERSION_W2K = 2,
+ DFS_MANAGER_VERSION_W2K3 = 4,
+ DFS_MANAGER_VERSION_W2K8 = 6
+ } dfs_ManagerVersion;
+
+ [public] 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;
+
+ typedef [public,bitmap32bit] bitmap {
+ DFS_VOLUME_STATE_OK = 0x1,
+ DFS_VOLUME_STATE_INCONSISTENT = 0x2,
+ DFS_VOLUME_STATE_OFFLINE = 0x3,
+ DFS_VOLUME_STATE_ONLINE = 0x4,
+ 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_Info5 *s;
+ } dfs_EnumArray5;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] dfs_Info6 *s;
+ } dfs_EnumArray6;
+
+ 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(5)] dfs_EnumArray5 *info5;
+ [case(6)] dfs_EnumArray6 *info6;
+ [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 */
+ [todo] WERROR dfs_Rename();
+
+ /* Function 0x07 */
+ [todo] WERROR dfs_Move();
+
+ /* Function 0x08 */
+ [todo] WERROR dfs_ManagerGetConfigInfo();
+
+ /* Function 0x09 */
+ [todo] 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(
+ [in] [string,charset(UTF16)] uint16 servername[],
+ [in,out,ref] [string,charset(UTF16)] uint16 **server_fullname,
+ [in,out,ref] boolean8 *is_root,
+ [in,out,ref] uint32 *ttl
+ );
+
+ /* Function 0x11 */
+ WERROR dfs_SetDcAddress(
+ [in] [string,charset(UTF16)] uint16 servername[],
+ [in] [string,charset(UTF16)] uint16 server_fullname[],
+ [in] uint32 flags,
+ [in] uint32 ttl
+ );
+
+ /* Function 0x12 */
+ WERROR dfs_FlushFtTable(
+ [in] [string,charset(UTF16)] uint16 servername[],
+ [in] [string,charset(UTF16)] uint16 rootshare[]
+ );
+
+ /* Function 0x13 */
+ [todo] WERROR dfs_Add2();
+
+ /* Function 0x14 */
+ [todo] WERROR dfs_Remove2();
+
+ /* Function 0x15 */
+ [public] 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 */
+ [todo] WERROR dfs_SetInfo2();
+}
diff --git a/librpc/idl/dfsblobs.idl b/librpc/idl/dfsblobs.idl
new file mode 100644
index 0000000..7b8795d
--- /dev/null
+++ b/librpc/idl/dfsblobs.idl
@@ -0,0 +1,115 @@
+#include "idl_types.h"
+
+import "misc.idl";
+/*
+dfs blobs interface definition
+*/
+
+
+[
+ pointer_default(unique),
+ helpstring("dfs referral blobs"),
+ uuid("12345778-1234-abcd-0001-00000003")
+]
+
+
+interface dfsblobs
+{
+ typedef [bitmap32bit] bitmap {
+ DFS_HEADER_FLAG_REFERAL_SVR = 0x00000001,
+ DFS_HEADER_FLAG_STORAGE_SVR = 0x00000002,
+ DFS_HEADER_FLAG_TARGET_BCK = 0x00000004
+ } DFS_HEADER_FLAG;
+
+ typedef [enum16bit] enum {
+ DFS_SERVER_NON_ROOT = 0x0000,
+ DFS_SERVER_ROOT = 0x0001
+ } DFS_SERVER_TYPE;
+
+ typedef [enum16bit] enum {
+ DFS_FLAG_REFERRAL_DOMAIN_RESP = 0x0002,
+ DFS_FLAG_REFERRAL_FIRST_TARGET_SET = 0x0004
+ } DFS_FLAGS_REFERRAL;
+
+ typedef struct {
+ uint16 size;
+ uint16 server_type;
+ uint16 entry_flags;
+ nstring *share_name;
+ } dfs_referral_v1;
+
+ typedef struct {
+ uint16 size;
+ DFS_SERVER_TYPE server_type;
+ DFS_FLAGS_REFERRAL entry_flags;
+ uint32 proximity;
+ uint32 ttl;
+ [relative_short] nstring *DFS_path;
+ [relative_short] nstring *DFS_alt_path;
+ [relative_short] nstring *netw_address;
+ } dfs_referral_v2;
+
+ typedef struct {
+ [relative_short] nstring *DFS_path;
+ [relative_short] nstring *DFS_alt_path;
+ [relative_short] nstring *netw_address;
+ } dfs_normal_referral;
+
+ typedef struct {
+ [relative_short] nstring *special_name;
+ uint16 nb_expanded_names;
+ [relative_short,subcontext(0),flag(NDR_REMAINING|STR_NULLTERM)] string_array *expanded_names;
+ } dfs_domain_referral;
+
+ typedef [nodiscriminant] union {
+ [case(0)] dfs_normal_referral r1;
+ [case(2)] dfs_domain_referral r2;
+ [default];
+ } dfs_referral;
+
+ typedef [nodiscriminant] union {
+ [case(16)] uint8 value[16];
+ [default];
+ } dfs_padding;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ uint16 size;
+ DFS_SERVER_TYPE server_type;
+ DFS_FLAGS_REFERRAL entry_flags;
+ uint32 ttl;
+ [switch_is(entry_flags & DFS_FLAG_REFERRAL_DOMAIN_RESP)] dfs_referral referrals;
+ /* this is either 0 or 16 bytes */
+ [switch_is(size - 18)] dfs_padding service_site_guid;
+ } dfs_referral_v3;
+
+ typedef [nodiscriminant] union {
+ [case(1)] dfs_referral_v1 v1;
+ [case(2)] dfs_referral_v2 v2;
+ [case(3)] dfs_referral_v3 v3;
+ [case(4)] dfs_referral_v3 v4;
+ [default];
+ } dfs_referral_version;
+
+ typedef [flag(NDR_NOALIGN)] [relative_base] struct {
+ uint16 version;
+ [switch_is(version)] dfs_referral_version referral;
+ } dfs_referral_type;
+
+ typedef [public] struct {
+ uint16 path_consumed;
+ uint16 nb_referrals;
+ DFS_HEADER_FLAG header_flags;
+ dfs_referral_type referral_entries[nb_referrals];
+ } dfs_referral_resp;
+
+ typedef [public] struct {
+ uint16 max_referral_level;
+ nstring servername;
+ } dfs_GetDFSReferral_in;
+
+ [public] void dfs_GetDFSReferral(
+ [in] dfs_GetDFSReferral_in req,
+ [out,ref] dfs_referral_resp *resp
+ );
+
+}
diff --git a/librpc/idl/dns.idl b/librpc/idl/dns.idl
new file mode 100644
index 0000000..ec8668a
--- /dev/null
+++ b/librpc/idl/dns.idl
@@ -0,0 +1,282 @@
+#include "idl_types.h"
+
+/*
+ IDL structures for DNS operations
+
+ DNS 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 "misc.idl", "dnsp.idl";
+[
+ helper("librpc/ndr/ndr_dns.h"),
+ helpstring("DNS records"),
+ version(0.0),
+ uuid("a047c001-5f22-40b0-9d52-7042c43f711a")
+]
+interface dns
+{
+ const int DNS_SERVICE_PORT = 53;
+ const int DNS_MAX_LABELS = 127;
+ const int DNS_MAX_DOMAIN_LENGTH = 253;
+ const int DNS_MAX_LABEL_LENGTH = 63;
+
+ typedef [public,bitmap16bit] bitmap {
+ DNS_RCODE = 0x001F,
+ DNS_FLAG_RECURSION_AVAIL = 0x0080,
+ DNS_FLAG_RECURSION_DESIRED = 0x0100,
+ DNS_FLAG_TRUNCATION = 0x0200,
+ DNS_FLAG_AUTHORITATIVE = 0x0400,
+ DNS_OPCODE = 0x7800,
+ DNS_FLAG_REPLY = 0x8000
+ } dns_operation;
+
+ /* the opcodes are in the operation field, masked with
+ DNS_OPCODE */
+ typedef [public] enum {
+ DNS_OPCODE_QUERY = (0x0<<11),
+ DNS_OPCODE_IQUERY = (0x1<<11),
+ DNS_OPCODE_STATUS = (0x2<<11),
+ DNS_OPCODE_UPDATE = (0x5<<11),
+ DNS_OPCODE_RELEASE = (0x6<<11),
+ DNS_OPCODE_WACK = (0x7<<11),
+ DNS_OPCODE_REFRESH = (0x8<<11),
+ DNS_OPCODE_REFRESH2 = (0x9<<11),
+ DNS_OPCODE_MULTI_HOME_REG = (0xf<<11)
+ } dns_opcode;
+
+ /* rcode values */
+ typedef [public] enum {
+ DNS_RCODE_OK = 0x00,
+ DNS_RCODE_FORMERR = 0x01,
+ DNS_RCODE_SERVFAIL = 0x02,
+ DNS_RCODE_NXDOMAIN = 0x03,
+ DNS_RCODE_NOTIMP = 0x04,
+ DNS_RCODE_REFUSED = 0x05,
+ DNS_RCODE_YXDOMAIN = 0x06,
+ DNS_RCODE_YXRRSET = 0x07,
+ DNS_RCODE_NXRRSET = 0x08,
+ DNS_RCODE_NOTAUTH = 0x09,
+ DNS_RCODE_NOTZONE = 0x0A,
+ DNS_RCODE_BADSIG = 0x10,
+ DNS_RCODE_BADKEY = 0x11,
+ DNS_RCODE_BADTIME = 0x12,
+ DNS_RCODE_BADMODE = 0x13,
+ DNS_RCODE_BADNAME = 0x14,
+ DNS_RCODE_BADALG = 0x15
+ } dns_rcode;
+
+ typedef [public,enum16bit] enum {
+ DNS_QCLASS_IN = 0x0001,
+ DNS_QCLASS_NONE = 0x00FE,
+ DNS_QCLASS_ANY = 0x00FF
+ } dns_qclass;
+
+ /* These vese values could have been merged with NBT_QTYPE values, but
+ DNS_QTYPE_SRV and NBT_QTYPE_STATUS have the same numeric value. */
+ typedef [public,enum16bit] enum {
+ DNS_QTYPE_ZERO = 0x0000,
+ DNS_QTYPE_A = 0x0001,
+ DNS_QTYPE_NS = 0x0002,
+ DNS_QTYPE_MD = 0x0003,
+ DNS_QTYPE_MF = 0x0004,
+ DNS_QTYPE_CNAME = 0x0005,
+ DNS_QTYPE_SOA = 0x0006,
+ DNS_QTYPE_MB = 0x0007,
+ DNS_QTYPE_MG = 0x0008,
+ DNS_QTYPE_MR = 0x0009,
+ DNS_QTYPE_NULL = 0x000A,
+ DNS_QTYPE_WKS = 0x000B,
+ DNS_QTYPE_PTR = 0x000C,
+ DNS_QTYPE_HINFO = 0x000D,
+ DNS_QTYPE_MINFO = 0x000E,
+ DNS_QTYPE_MX = 0x000F,
+ DNS_QTYPE_TXT = 0x0010,
+ DNS_QTYPE_RP = 0x0011,
+ DNS_QTYPE_AFSDB = 0x0012,
+ DNS_QTYPE_X25 = 0x0013,
+ DNS_QTYPE_ISDN = 0x0014,
+ DNS_QTYPE_RT = 0x0015,
+ DNS_QTYPE_SIG = 0x0018,
+ DNS_QTYPE_KEY = 0x0019,
+ DNS_QTYPE_AAAA = 0x001C,
+ DNS_QTYPE_LOC = 0x001D,
+ DNS_QTYPE_NXT = 0x001E,
+ DNS_QTYPE_NETBIOS= 0x0020,
+ DNS_QTYPE_SRV = 0x0021,
+ DNS_QTYPE_ATMA = 0x0022,
+ DNS_QTYPE_NAPTR = 0x0023,
+ DNS_QTYPE_CERT = 0x0025,
+ DNS_QTYPE_DNAME = 0x0027,
+ DNS_QTYPE_OPT = 0x0029,
+ DNS_QTYPE_DS = 0x002B,
+ DNS_QTYPE_SSHFP = 0x002C,
+ DNS_QTYPE_IPSECKEY = 0x002D,
+ DNS_QTYPE_RRSIG = 0x002E,
+ DNS_QTYPE_NSEC = 0x002F,
+ DNS_QTYPE_DNSKEY = 0x0030,
+ DNS_QTYPE_DHCID = 0x0031,
+ DNS_QTYPE_NSEC3 = 0x0032,
+ DNS_QTYPE_NSEC3PARAM = 0x0033,
+ DNS_QTYPE_TLSA = 0x0034,
+ DNS_QTYPE_CDS = 0x003B,
+ DNS_QTYPE_CDNSKEY = 0x003C,
+ DNS_QTYPE_SVCB = 0x0040,
+ DNS_QTYPE_HTTPS = 0x0041,
+ DNS_QTYPE_TKEY = 0x00F9,
+ DNS_QTYPE_TSIG = 0x00FA,
+ DNS_QTYPE_IXFR = 0x00FB,
+ DNS_QTYPE_AXFR = 0x00FC,
+ DNS_QTYPE_MAILB = 0x00FD,
+ DNS_QTYPE_MAILA = 0x00FE,
+ DNS_QTYPE_ALL = 0x00FF,
+ DNS_QTYPE_URI = 0x0100,
+ DNS_QTYPE_CAA = 0x0101
+ } dns_qtype;
+
+ typedef [public,enum16bit] enum {
+ DNS_TKEY_MODE_NULL = 0x0000,
+ DNS_TKEY_MODE_SERVER = 0x0001,
+ DNS_TKEY_MODE_DH = 0x0002,
+ DNS_TKEY_MODE_GSSAPI = 0x0003,
+ DNS_TKEY_MODE_CLIENT = 0x0004,
+ DNS_TKEY_MODE_DELETE = 0x0005,
+ DNS_TKEY_MODE_LAST = 0xFFFF
+ } dns_tkey_mode;
+
+ typedef [public] struct {
+ dns_string name;
+ dns_qtype question_type;
+ dns_qclass question_class;
+ } dns_name_question;
+
+ typedef [public] struct {
+ uint16 length;
+ uint8 data[length];
+ } dns_rdata_data;
+
+ typedef struct {
+ dns_string mname;
+ dns_string rname;
+ uint32 serial;
+ uint32 refresh;
+ uint32 retry;
+ uint32 expire;
+ uint32 minimum;
+ } dns_soa_record;
+
+ typedef [public] struct {
+ uint16 preference;
+ dns_string exchange;
+ } dns_mx_record;
+
+ typedef [public,nopull] struct {
+ dnsp_string_list txt;
+ } dns_txt_record;
+
+ typedef [public] struct {
+ dns_string mbox;
+ dns_string txt;
+
+ } dns_rp_record;
+
+ typedef [public] struct {
+ uint16 priority;
+ uint16 weight;
+ uint16 port;
+ dns_string target;
+ } dns_srv_record;
+
+ typedef [public] struct {
+ uint16 option_code;
+ uint16 option_length;
+ uint8 option_data[option_length];
+ } dns_opt_record;
+
+ typedef [flag(NDR_NO_COMP),public] struct {
+ dns_string algorithm;
+ uint32 inception;
+ uint32 expiration;
+ dns_tkey_mode mode;
+ uint16 error;
+ uint16 key_size;
+ uint8 key_data[key_size];
+ uint16 other_size;
+ uint8 other_data[other_size];
+ } dns_tkey_record;
+
+ typedef [flag(NDR_NO_COMP),public] struct {
+ dns_string algorithm_name;
+ uint16 time_prefix; /* 0 until February 2106*/
+ uint32 time;
+ uint16 fudge;
+ uint16 mac_size;
+ uint8 mac[mac_size];
+ uint16 original_id;
+ uint16 error;
+ uint16 other_size;
+ uint8 other_data[other_size];
+ } dns_tsig_record;
+
+ typedef [flag(NDR_NO_COMP|NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
+ dns_string name;
+ dns_qclass rr_class;
+ uint32 ttl;
+ dns_string algorithm_name;
+ uint16 time_prefix; /* 0 until February 2106*/
+ uint32 time;
+ uint16 fudge;
+ uint16 error;
+ uint16 other_size;
+ uint8 other_data[other_size];
+ } dns_fake_tsig_rec;
+
+ typedef [nodiscriminant,public,flag(NDR_NOALIGN)] union {
+ [case(DNS_QTYPE_A)] ipv4address ipv4_record;
+ [case(DNS_QTYPE_NS)] dns_string ns_record;
+ [case(DNS_QTYPE_CNAME)] dns_string cname_record;
+ [case(DNS_QTYPE_SOA)] dns_soa_record soa_record;
+ [case(DNS_QTYPE_PTR)] dns_string ptr_record;
+ [case(DNS_QTYPE_HINFO)] dnsp_hinfo hinfo_record;
+ [case(DNS_QTYPE_MX)] dns_mx_record mx_record;
+ [case(DNS_QTYPE_TXT)] dns_txt_record txt_record;
+ [case(DNS_QTYPE_RP)] dns_rp_record rp_record;
+ [case(DNS_QTYPE_AAAA)] ipv6address ipv6_record;
+ [case(DNS_QTYPE_SRV)] dns_srv_record srv_record;
+ [case(DNS_QTYPE_OPT)] dns_opt_record opt_record;
+ [case(DNS_QTYPE_TSIG)] dns_tsig_record tsig_record;
+ [case(DNS_QTYPE_TKEY)] dns_tkey_record tkey_record;
+ [default];
+ } dns_rdata;
+
+ typedef [flag(LIBNDR_PRINT_ARRAY_HEX|NDR_NOALIGN),nopush,nopull] struct {
+ dns_string name;
+ dns_qtype rr_type;
+ dns_qclass rr_class;
+ uint32 ttl;
+ uint16 length; /* Should be set to either UINT16_MAX or 0 */
+ [switch_is(rr_type)] dns_rdata rdata;
+ DATA_BLOB unexpected;
+ } dns_res_rec;
+
+ typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
+ uint16 id;
+ dns_operation operation;
+ uint16 qdcount;
+ uint16 ancount;
+ uint16 nscount;
+ uint16 arcount;
+ dns_name_question questions[qdcount];
+ dns_res_rec answers[ancount];
+ dns_res_rec nsrecs[nscount];
+ dns_res_rec additional[arcount];
+ } dns_name_packet;
+
+ /*
+ this is a convenience hook for ndrdump
+ */
+ [nopython] void decode_dns_name_packet(
+ [in] dns_name_packet packet
+ );
+}
diff --git a/librpc/idl/dnsp.idl b/librpc/idl/dnsp.idl
new file mode 100644
index 0000000..0cb18bf
--- /dev/null
+++ b/librpc/idl/dnsp.idl
@@ -0,0 +1,293 @@
+#include "idl_types.h"
+
+/*
+ IDL structures for DNSP structures
+
+ See [MS-DNSP].pdf in MCPP for details
+*/
+
+import "misc.idl";
+
+/*
+ note that this is not a real RPC interface. We are just using PIDL
+ to save us a lot of tedious hand parsing of the dnsRecord
+ attribute. The uuid is randomly generated.
+ */
+[
+ uuid("bdd66e9e-d45f-4202-85c0-6132edc4f30a"),
+ version(0.0),
+ pointer_default(unique),
+ helper("../librpc/ndr/ndr_dnsp.h"),
+ helpstring("DNSP interfaces")
+]
+
+interface dnsp
+{
+ typedef [enum16bit,public] enum {
+ DNS_TYPE_TOMBSTONE = 0x0,
+ DNS_TYPE_A = 0x1,
+ DNS_TYPE_NS = 0x2,
+ DNS_TYPE_MD = 0x3,
+ DNS_TYPE_MF = 0x4,
+ DNS_TYPE_CNAME = 0x5,
+ DNS_TYPE_SOA = 0x6,
+ DNS_TYPE_MB = 0x7,
+ DNS_TYPE_MG = 0x8,
+ DNS_TYPE_MR = 0x9,
+ DNS_TYPE_NULL = 0xA,
+ DNS_TYPE_WKS = 0xB,
+ DNS_TYPE_PTR = 0xC,
+ DNS_TYPE_HINFO = 0xD,
+ DNS_TYPE_MINFO = 0xE,
+ DNS_TYPE_MX = 0xF,
+ DNS_TYPE_TXT = 0x10,
+ DNS_TYPE_RP = 0x11,
+ DNS_TYPE_AFSDB = 0x12,
+ DNS_TYPE_X25 = 0x13,
+ DNS_TYPE_ISDN = 0x14,
+ DNS_TYPE_RT = 0x15,
+ DNS_TYPE_SIG = 0x18,
+ DNS_TYPE_KEY = 0x19,
+ DNS_TYPE_AAAA = 0x1C,
+ DNS_TYPE_LOC = 0x1D,
+ DNS_TYPE_NXT = 0x1E,
+ DNS_TYPE_SRV = 0x21,
+ DNS_TYPE_ATMA = 0x22,
+ DNS_TYPE_NAPTR = 0x23,
+ DNS_TYPE_CERT = 0x25,
+ DNS_TYPE_DNAME = 0x27,
+ DNS_TYPE_DS = 0x2B,
+ DNS_TYPE_SSHFP = 0x2C,
+ DNS_TYPE_IPSECKEY = 0x2D,
+ DNS_TYPE_RRSIG = 0x2E,
+ DNS_TYPE_NSEC = 0x2F,
+ DNS_TYPE_DNSKEY= 0x30,
+ DNS_TYPE_DHCID = 0x31,
+ DNS_TYPE_NSEC3 = 0x32,
+ DNS_TYPE_NSEC3PARAM = 0x33,
+ DNS_TYPE_TLSA = 0x34,
+ DNS_TYPE_CDS = 0x3B,
+ DNS_TYPE_CDNSKEY = 0x3C,
+ DNS_TYPE_SVCB = 0x40,
+ DNS_TYPE_HTTPS = 0x41,
+ DNS_TYPE_ALL = 0xFF,
+ DNS_TYPE_URI = 0x100,
+ DNS_TYPE_CAA = 0x101,
+ DNS_TYPE_WINS = 0xFF01,
+ DNS_TYPE_WINSR = 0xFF02
+ } dns_record_type;
+
+ typedef [bitmap32bit] bitmap {
+ DNS_RPC_FLAG_SUPPRESS_NOTIFY = 0x00010000,
+ DNS_RPC_FLAG_AGING_ON = 0x00020000,
+ DNS_RPC_FLAG_OPEN_ACL = 0x00040000,
+ DNS_RPC_FLAG_RECORD_WIRE_FORMAT = 0x00100000,
+ DNS_RPC_FLAG_SUPPRESS_RECORD_UPDATE_PTR = 0x00200000,
+ DNS_RPC_FLAG_NODE_COMPLETE = 0x00800000,
+ DNS_RPC_FLAG_NODE_STICKY = 0x01000000,
+ DNS_RPC_FLAG_RECORD_CREATE_PTR = 0x02000000,
+ DNS_RPC_FLAG_RECORD_TTL_CHANGE = 0x04000000,
+ DNS_RPC_FLAG_RECORD_DEFAULT_TTL = 0x08000000,
+ DNS_RPC_FLAG_ZONE_DELEGATION = 0x10000000,
+ DNS_RPC_FLAG_AUTH_ZONE_ROOT = 0x20000000,
+ DNS_RPC_FLAG_ZONE_ROOT = 0x40000000,
+ DNS_RPC_FLAG_CACHE_DATA = 0x80000000
+ }
+ dns_rpc_node_flags;
+
+
+ typedef [enum8bit] enum {
+ DNS_RANK_NONE = 0x00,
+ DNS_RANK_CACHE_BIT = 0x01,
+ DNS_RANK_ROOT_HINT = 0x08,
+ DNS_RANK_OUTSIDE_GLUE = 0x20,
+ DNS_RANK_CACHE_NA_ADDITIONAL = 0x31,
+ DNS_RANK_CACHE_NA_AUTHORITY = 0x41,
+ DNS_RANK_CACHE_A_ADDITIONAL = 0x51,
+ DNS_RANK_CACHE_NA_ANSWER = 0x61,
+ DNS_RANK_CACHE_A_AUTHORITY = 0x71,
+ DNS_RANK_GLUE = 0x80,
+ DNS_RANK_NS_GLUE = 0x82,
+ DNS_RANK_CACHE_A_ANSWER = 0xc1,
+ DNS_RANK_ZONE = 0xf0
+ } dns_record_rank;
+
+ typedef [v1_enum] enum {
+ DNS_ZONE_TYPE_CACHE = 0x00,
+ DNS_ZONE_TYPE_PRIMARY = 0x01,
+ DNS_ZONE_TYPE_SECONDARY = 0x02,
+ DNS_ZONE_TYPE_STUB = 0x03,
+ DNS_ZONE_TYPE_FORWARDER = 0x04,
+ DNS_ZONE_TYPE_SECONDARY_CACHE = 0x05
+ } dns_zone_type;
+
+ typedef [public,enum8bit] enum {
+ DNS_ZONE_UPDATE_OFF = 0x00,
+ DNS_ZONE_UPDATE_UNSECURE = 0x01,
+ DNS_ZONE_UPDATE_SECURE = 0x02
+ } dns_zone_update;
+
+ typedef [v1_enum] enum {
+ DSPROPERTY_ZONE_EMPTY = 0x00,
+ DSPROPERTY_ZONE_TYPE = 0x01,
+ DSPROPERTY_ZONE_ALLOW_UPDATE = 0x02,
+ DSPROPERTY_ZONE_SECURE_TIME = 0x08,
+ DSPROPERTY_ZONE_NOREFRESH_INTERVAL = 0x10,
+ DSPROPERTY_ZONE_SCAVENGING_SERVERS = 0x11,
+ DSPROPERTY_ZONE_AGING_ENABLED_TIME = 0x12,
+ DSPROPERTY_ZONE_REFRESH_INTERVAL = 0x20,
+ DSPROPERTY_ZONE_AGING_STATE = 0x40,
+ DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME = 0x80,
+ DSPROPERTY_ZONE_MASTER_SERVERS = 0x81,
+ DSPROPERTY_ZONE_AUTO_NS_SERVERS = 0x82,
+ DSPROPERTY_ZONE_DCPROMO_CONVERT = 0x83,
+ DSPROPERTY_ZONE_SCAVENGING_SERVERS_DA = 0x90,
+ DSPROPERTY_ZONE_MASTER_SERVERS_DA = 0x91,
+ DSPROPERTY_ZONE_NS_SERVERS_DA = 0x92,
+ DSPROPERTY_ZONE_NODE_DBFLAGS = 0x100
+
+ } dns_property_id;
+
+ typedef [enum8bit] enum {
+ DCPROMO_CONVERT_NONE = 0x00,
+ DCPROMO_CONVERT_DOMAIN = 0x01,
+ DCPROMO_CONVERT_FOREST = 0x02
+ } dns_dcpromo_flag;
+
+ typedef [public] struct {
+ uint32 serial;
+ uint32 refresh;
+ uint32 retry;
+ uint32 expire;
+ uint32 minimum;
+ dnsp_name mname;
+ dnsp_name rname;
+ } dnsp_soa;
+
+ typedef [public] struct {
+ uint16 wPriority;
+ dnsp_name nameTarget;
+ } dnsp_mx;
+
+ typedef [public] struct {
+ dnsp_string cpu;
+ dnsp_string os;
+ } dnsp_hinfo;
+
+ typedef [public] struct {
+ uint16 wPriority;
+ uint16 wWeight;
+ uint16 wPort;
+ dnsp_name nameTarget;
+ } dnsp_srv;
+
+ typedef struct {
+ uint32 addrCount;
+ uint32 addrArray[addrCount];
+ } dnsp_ip4_array;
+
+ typedef struct {
+ uint16 family;
+ [flag(NDR_BIG_ENDIAN)] uint16 port;
+ [flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
+ ipv6address ipv6;
+ uint8 pad[8];
+ uint32 unused[8];
+ } dnsp_dns_addr;
+
+ typedef [public] struct {
+ uint32 MaxCount;
+ uint32 AddrCount;
+ uint32 Tag;
+ uint16 Family;
+ uint16 Reserved0;
+ uint32 Flags;
+ uint32 MatchFlag;
+ uint32 Reserved1;
+ uint32 Reserved2;
+ dnsp_dns_addr AddrArray[AddrCount];
+ } dnsp_dns_addr_array;
+
+ typedef [public,nopull,nopush,noprint,gensize] struct {
+ uint8 count;
+ dnsp_string str[count];
+ } dnsp_string_list;
+
+ typedef [nodiscriminant,gensize] union {
+ [case(DNS_TYPE_TOMBSTONE)] NTTIME EntombedTime;
+ [case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
+ [case(DNS_TYPE_NS)] dnsp_name ns;
+ [case(DNS_TYPE_CNAME)] dnsp_name cname;
+ [case(DNS_TYPE_SOA)] [flag(NDR_BIG_ENDIAN)] dnsp_soa soa;
+ [case(DNS_TYPE_MX)] [flag(NDR_BIG_ENDIAN)] dnsp_mx mx;
+ [case(DNS_TYPE_TXT)] dnsp_string_list txt;
+ [case(DNS_TYPE_PTR)] dnsp_name ptr;
+ [case(DNS_TYPE_HINFO)] dnsp_hinfo hinfo;
+ [case(DNS_TYPE_AAAA)] ipv6address ipv6;
+ [case(DNS_TYPE_SRV)] [flag(NDR_BIG_ENDIAN)] dnsp_srv srv;
+ [default] [flag(NDR_REMAINING)] DATA_BLOB data;
+ } dnsRecordData;
+
+ /* this is the format for the dnsRecord attribute in the DNS
+ partitions in AD */
+ typedef [public] struct {
+ [value(ndr_size_dnsRecordData(&data,wType,ndr->flags))] uint16 wDataLength;
+ dns_record_type wType;
+ [value(5)] uint8 version;
+ dns_record_rank rank;
+ uint16 flags;
+ uint32 dwSerial;
+ [flag(NDR_BIG_ENDIAN)] uint32 dwTtlSeconds;
+ uint32 dwReserved;
+ uint32 dwTimeStamp;
+ [switch_is(wType)] dnsRecordData data;
+ } dnsp_DnssrvRpcRecord;
+
+ typedef [nodiscriminant,gensize] union {
+ [case(DSPROPERTY_ZONE_EMPTY)] ;
+ [case(DSPROPERTY_ZONE_TYPE)] dns_zone_type zone_type;
+ [case(DSPROPERTY_ZONE_ALLOW_UPDATE)] dns_zone_update allow_update_flag;
+ [case(DSPROPERTY_ZONE_SECURE_TIME)] NTTIME zone_secure_time;
+ [case(DSPROPERTY_ZONE_NOREFRESH_INTERVAL)] uint32 norefresh_hours;
+ [case(DSPROPERTY_ZONE_REFRESH_INTERVAL)] uint32 refresh_hours;
+ [case(DSPROPERTY_ZONE_AGING_STATE)] uint32 aging_enabled;
+ [case(DSPROPERTY_ZONE_SCAVENGING_SERVERS)] dnsp_ip4_array servers;
+ [case(DSPROPERTY_ZONE_AGING_ENABLED_TIME)] uint32 next_scavenging_cycle_hours;
+ [case(DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME)] nstring deleted_by_hostname;
+ [case(DSPROPERTY_ZONE_MASTER_SERVERS)] dnsp_ip4_array master_servers;
+ [case(DSPROPERTY_ZONE_AUTO_NS_SERVERS)] dnsp_ip4_array ns_servers;
+ [case(DSPROPERTY_ZONE_DCPROMO_CONVERT)] dns_dcpromo_flag dcpromo_flag;
+ [case(DSPROPERTY_ZONE_SCAVENGING_SERVERS_DA)] dnsp_dns_addr_array s_ns_servers;
+ [case(DSPROPERTY_ZONE_MASTER_SERVERS_DA)] dnsp_dns_addr_array z_master_servers;
+ [case(DSPROPERTY_ZONE_NS_SERVERS_DA)] dnsp_dns_addr_array d_ns_servers;
+ [case(DSPROPERTY_ZONE_NODE_DBFLAGS)] dns_rpc_node_flags flags;
+ } dnsPropertyData;
+
+ /* this is the format for the dnsProperty attribute in the DNS
+ partitions in AD */
+ typedef [flag(NDR_NOALIGN),public] struct {
+ [value(ndr_size_dnsPropertyData(&data,id,ndr->flags))] uint32 wDataLength;
+ uint32 namelength;
+ [value(0)] uint32 flag;
+ [value(1)] uint32 version;
+ dns_property_id id;
+ [switch_is(id)] dnsPropertyData data;
+ uint32 name;
+ } dnsp_DnsProperty;
+
+ /*
+ * this is the format for the dnsProperty attribute in the DNS
+ * partitions in AD when the wDataLength is 0. This is an
+ * invalid format seen from some Windows servers in the same
+ * domain.
+ */
+ typedef [flag(NDR_NOALIGN),public] struct {
+ [range(0, 0), value(0)] uint32 wDataLength;
+ uint32 namelength;
+ [value(0)] uint32 flag;
+ [value(1)] uint32 version;
+ dns_property_id id;
+ [switch_is(DSPROPERTY_ZONE_EMPTY)] dnsPropertyData data;
+ uint32 name;
+ } dnsp_DnsProperty_short;
+}
diff --git a/librpc/idl/dnsserver.idl b/librpc/idl/dnsserver.idl
new file mode 100644
index 0000000..a6c413a
--- /dev/null
+++ b/librpc/idl/dnsserver.idl
@@ -0,0 +1,1529 @@
+#include "idl_types.h"
+/*
+ dnsserver interface definition
+ for a protocol description see [MS-DNSP].pdf
+*/
+
+import "misc.idl", "dnsp.idl";
+
+[ uuid("50abc2a4-574d-40b3-9d66-ee4fd5fba076"),
+ version(5.0),
+ pointer_default(unique),
+ endpoint("ncacn_ip_tcp:", "ncacn_np:[\\pipe\\dnsserver]"),
+ helper("../librpc/ndr/ndr_dnsserver.h"),
+ helpstring("DNS Management Server")
+] interface dnsserver
+{
+
+#define wchar_t uint16
+#define BOOLEAN boolean8
+#define BOOL boolean32
+#define BYTE uint8
+#define UCHAR uint8
+#define CHAR char
+#define PBYTE BYTE*
+#define DWORD uint32
+#define PDWORD uint32 *
+
+ /* */
+ /* DNS RPC data types */
+ /* */
+
+ typedef [v1_enum] enum {
+ DNS_RPC_USE_TCPIP = 0x00000001,
+ DNS_RPC_USE_NAMED_PIPE = 0x00000002,
+ DNS_RPC_USE_LPC = 0x00000004,
+ DNS_RPC_USE_ALL_PROTOCOLS = 0xFFFFFFFF
+ }
+ DNS_RPC_PROTOCOLS;
+
+ typedef [v1_enum] enum {
+ DNS_CLIENT_VERSION_W2K = 0x00000000,
+ DNS_CLIENT_VERSION_DOTNET = 0x00060000,
+ DNS_CLIENT_VERSION_LONGHORN = 0x00070000
+ }
+ DNS_RPC_CLIENT_VERSION;
+
+ /* Return buffer */
+ typedef struct {
+ DWORD dwLength;
+ [size_is(dwLength)] BYTE Buffer[];
+ } DNS_RPC_BUFFER;
+
+ /* String Array */
+ typedef struct {
+ [range(0,10000)] DWORD dwCount;
+ [size_is(dwCount),string,charset(UTF8)] char * pszStrings[];
+ } DNS_RPC_UTF8_STRING_LIST;
+
+ /* Name and parameter value */
+ typedef struct {
+ DWORD dwParam;
+ [string, charset(UTF8)] char * pszNodeName;
+ }
+ DNS_RPC_NAME_AND_PARAM;
+
+
+ /* */
+ /* DNS Resource Record data types */
+ /* */
+
+ /* DNS_RECORD_TYPE is defined in dnsp.idl as dns_record_type */
+ /* DNS_RPC_NODE_FLAGS is defined in dnsp.idl as dns_rpc_node_flags */
+
+ typedef [public,gensize] struct {
+ [value(strlen(str))] uint8 len;
+ [charset(UNIX)] uint8 str[len];
+ }
+ DNS_RPC_NAME;
+
+ typedef struct {
+ uint16 wLength;
+ uint16 wRecordCount;
+ uint32 dwFlags;
+ uint32 dwChildCount;
+ DNS_RPC_NAME dnsNodeName;
+ }
+ DNS_RPC_NODE;
+
+ typedef struct {
+ uint32 dwSerialNo;
+ uint32 dwRefresh;
+ uint32 dwRetry;
+ uint32 dwExpire;
+ uint32 dwMinimumTtl;
+ DNS_RPC_NAME NamePrimaryServer;
+ DNS_RPC_NAME ZoneAdministratorEmail;
+ }
+ DNS_RPC_RECORD_SOA;
+
+ typedef struct {
+ uint16 wPreference;
+ DNS_RPC_NAME nameExchange;
+ }
+ DNS_RPC_RECORD_NAME_PREFERENCE;
+
+ typedef [nopull,nopush] struct {
+ uint8 count;
+ DNS_RPC_NAME str[count];
+ }
+ DNS_RPC_RECORD_STRING;
+
+ typedef struct {
+ uint16 wPriority;
+ uint16 wWeight;
+ uint16 wPort;
+ DNS_RPC_NAME nameTarget;
+ }
+ DNS_RPC_RECORD_SRV;
+
+ typedef [nodiscriminant,gensize,flag(NDR_NOALIGN)] union {
+ [case(DNS_TYPE_TOMBSTONE)] NTTIME EntombedTime;
+ [case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
+ [case(DNS_TYPE_NS)] DNS_RPC_NAME name;
+ [case(DNS_TYPE_MD)] DNS_RPC_NAME name;
+ [case(DNS_TYPE_MF)] DNS_RPC_NAME name;
+ [case(DNS_TYPE_CNAME)] DNS_RPC_NAME name;
+ [case(DNS_TYPE_SOA)] DNS_RPC_RECORD_SOA soa;
+ [case(DNS_TYPE_MB)] DNS_RPC_NAME name;
+ [case(DNS_TYPE_MG)] DNS_RPC_NAME name;
+ [case(DNS_TYPE_MR)] DNS_RPC_NAME name;
+ [case(DNS_TYPE_PTR)] DNS_RPC_NAME ptr;
+ [case(DNS_TYPE_HINFO)] DNS_RPC_NAME hinfo;
+ [case(DNS_TYPE_MX)] DNS_RPC_RECORD_NAME_PREFERENCE mx;
+ [case(DNS_TYPE_TXT)] DNS_RPC_RECORD_STRING txt;
+ [case(DNS_TYPE_AAAA)] ipv6address ipv6;
+ [case(DNS_TYPE_SRV)] DNS_RPC_RECORD_SRV srv;
+ [case(DNS_TYPE_DNAME)] DNS_RPC_NAME name;
+ }
+ DNS_RPC_RECORD_DATA;
+
+ typedef [public] struct {
+ [value(ndr_size_DNS_RPC_RECORD_DATA(&data,wType,0))] uint16 wDataLength;
+ dns_record_type wType;
+ DWORD dwFlags;
+ DWORD dwSerial;
+ DWORD dwTtlSeconds;
+ DWORD dwTimeStamp;
+ DWORD dwReserved;
+ [subcontext(0),subcontext_size(wDataLength),switch_is(wType)] DNS_RPC_RECORD_DATA data;
+ }
+ DNS_RPC_RECORD;
+
+ typedef struct {
+ [value(ndr_size_DNS_RPC_RECORD_DATA(&rec.data,rec.wType,0))] uint3264 wContextLength;
+ DNS_RPC_RECORD rec;
+ }
+ DNS_RPC_RECORD_BUF;
+
+
+ /* */
+ /* DNS Address Information data types */
+ /* */
+
+ typedef [v1_enum] enum {
+ DNS_IPVAL_DNS_SERVERS = 0x00,
+ DNS_IPVAL_DNS_ROOTHINTS = 0x01,
+ DNS_IPVAL_DNS_FORWARDERS = 0x02,
+ DNS_IPVAL_DNS_ZONE_MASTERS = 0x03,
+ DNS_IPVAL_DNS_DELEGATIONS = 0x04
+ }
+ DNS_IPVAL_CONTEXT;
+
+ typedef [v1_enum] enum {
+ ERROR_SUCCESS = 0x00,
+ DNS_IPVAL_INVALID_ADDR = 0x01,
+ DNS_IPVAL_UNREACHABLE = 0x02,
+ DNS_IPVAL_NO_RESPONSE = 0x03,
+ DNS_IPVAL_NOT_AUTH_FOR_ZONE = 0x04,
+ DNS_IPVAL_UNKNOWN_ERROR = 0xFF,
+ DNS_IPVAL_NO_TCP = 0x80000000
+ }
+ DNS_IP_VALIDATE_RETURN_FLAGS;
+
+ typedef struct {
+ DWORD AddrCount;
+ [size_is( AddrCount )] DWORD AddrArray[];
+ } IP4_ARRAY;
+#define PIP4_ARRAY IP4_ARRAY*
+
+ typedef struct {
+ CHAR MaxSa[32];
+ DWORD DnsAddrUserDword[8];
+ } DNS_ADDR;
+
+ typedef struct {
+ DWORD MaxCount;
+ DWORD AddrCount;
+ DWORD Tag;
+ WORD Family;
+ WORD WordReserved;
+ DWORD Flags;
+ DWORD MatchFlag;
+ DWORD Reserved1;
+ DWORD Reserved2;
+ [size_is( AddrCount )] DNS_ADDR AddrArray[];
+ } DNS_ADDR_ARRAY;
+#define PDNS_ADDR_ARRAY DNS_ADDR_ARRAY*
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ DWORD dwContext;
+ DWORD dwReserved1;
+ [string, charset(UTF8)] char * pszContextName;
+ PDNS_ADDR_ARRAY aipValidateAddrs;
+ }
+ DNS_RPC_IP_VALIDATE;
+
+
+ /* */
+ /* DNS Server data types */
+ /* */
+
+ typedef [enum8bit] enum {
+ DNS_BOOT_METHOD_UNINITIALIZED = 0x00,
+ DNS_BOOT_METHOD_FILE = 0x01,
+ DNS_BOOT_METHOD_REGISTRY = 0x02,
+ DNS_BOOT_METHOD_DIRECTORY = 0x03
+ }
+ DNS_BOOT_METHOD;
+
+ typedef [v1_enum] enum {
+ DNS_ALLOW_RFC_NAMES_ONLY = 0x00,
+ DNS_ALLOW_NONRFC_NAMES = 0x01,
+ DNS_ALLOW_MULTIBYTE_NAMES = 0x02,
+ DNS_ALLOW_ALL_NAMES = 0x03
+ }
+ DNS_NAME_CHECK_FLAG;
+
+ typedef struct {
+ /* version */
+ /* basic configuration flags */
+
+ DWORD dwVersion;
+ DNS_BOOT_METHOD fBootMethod;
+ BOOLEAN fAdminConfigured;
+ BOOLEAN fAllowUpdate;
+ BOOLEAN fDsAvailable;
+
+ /* pointer section */
+
+ [string, charset(UTF8)] char * pszServerName;
+
+ /* DS container */
+
+ [string, charset(UTF16)] wchar_t * pszDsContainer;
+
+ /* IP interfaces */
+
+ PIP4_ARRAY aipServerAddrs;
+ PIP4_ARRAY aipListenAddrs;
+
+ /* forwarders */
+
+ PIP4_ARRAY aipForwarders;
+
+ /* future extensions */
+
+ PDWORD pExtension1;
+ PDWORD pExtension2;
+ PDWORD pExtension3;
+ PDWORD pExtension4;
+ PDWORD pExtension5;
+
+ /* DWORD section */
+
+ /* logging */
+
+ DWORD dwLogLevel;
+ DWORD dwDebugLevel;
+
+ /* configuration DWORDs */
+
+ DWORD dwForwardTimeout;
+ DWORD dwRpcProtocol;
+ DNS_NAME_CHECK_FLAG dwNameCheckFlag;
+ DWORD cAddressAnswerLimit;
+ DWORD dwRecursionRetry;
+ DWORD dwRecursionTimeout;
+ DWORD dwMaxCacheTtl;
+ DWORD dwDsPollingInterval;
+
+ /* aging / scavenging */
+
+ DWORD dwScavengingInterval;
+ DWORD dwDefaultRefreshInterval;
+ DWORD dwDefaultNoRefreshInterval;
+
+ DWORD dwReserveArray[10];
+
+ /* BYTE section */
+
+ /* configuration flags */
+
+ BOOLEAN fAutoReverseZones;
+ BOOLEAN fAutoCacheUpdate;
+
+ /* recursion control */
+
+ BOOLEAN fRecurseAfterForwarding;
+ BOOLEAN fForwardDelegations;
+ BOOLEAN fNoRecursion;
+ BOOLEAN fSecureResponses;
+
+ /* lookup control */
+
+ BOOLEAN fRoundRobin;
+ BOOLEAN fLocalNetPriority;
+
+ /* BIND compatibility and mimicking */
+
+ BOOLEAN fBindSecondaries;
+ BOOLEAN fWriteAuthorityNs;
+
+ /* Bells and whistles */
+
+ BOOLEAN fStrictFileParsing;
+ BOOLEAN fLooseWildcarding;
+
+ /* aging / scavenging */
+
+ BOOLEAN fDefaultAgingState;
+ BOOLEAN fReserveArray[15];
+ }
+ DNS_RPC_SERVER_INFO_W2K;
+
+ typedef struct {
+ [string, charset(UTF8)] uint8 *extension;
+ } DNS_EXTENSION;
+
+ typedef [public] struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ /* basic configuration flags */
+
+ DWORD dwVersion;
+ DNS_BOOT_METHOD fBootMethod;
+ BOOLEAN fAdminConfigured;
+ BOOLEAN fAllowUpdate;
+ BOOLEAN fDsAvailable;
+
+ /* pointer section */
+
+ [string, charset(UTF8)] char * pszServerName;
+
+ /* DS container */
+
+ [string, charset(UTF16)] wchar_t * pszDsContainer;
+
+ /* IP interfaces */
+
+ PIP4_ARRAY aipServerAddrs;
+ PIP4_ARRAY aipListenAddrs;
+
+ /* forwarders */
+
+ PIP4_ARRAY aipForwarders;
+
+ /* logging */
+
+ PIP4_ARRAY aipLogFilter;
+ [string, charset(UTF16)] wchar_t * pwszLogFilePath;
+
+ /* Server domain/forest */
+
+ [string, charset(UTF8)] char * pszDomainName; /* UTF-8 FQDN */
+ [string, charset(UTF8)] char * pszForestName; /* UTF-8 FQDN */
+
+ /* Built-in directory partitions */
+
+ [string, charset(UTF8)] char * pszDomainDirectoryPartition; /* UTF-8 FQDN */
+ [string, charset(UTF8)] char * pszForestDirectoryPartition; /* UTF-8 FQDN */
+
+ /* future extensions */
+ DNS_EXTENSION pExtensions[6];
+
+ /* DWORD section */
+
+ /* logging */
+
+ DWORD dwLogLevel;
+ DWORD dwDebugLevel;
+
+ /* configuration DWORDs */
+
+ DWORD dwForwardTimeout;
+ DWORD dwRpcProtocol;
+ DNS_NAME_CHECK_FLAG dwNameCheckFlag;
+ DWORD cAddressAnswerLimit;
+ DWORD dwRecursionRetry;
+ DWORD dwRecursionTimeout;
+ DWORD dwMaxCacheTtl;
+ DWORD dwDsPollingInterval;
+ DWORD dwLocalNetPriorityNetMask;
+
+ /* aging and scavenging */
+
+ DWORD dwScavengingInterval;
+ DWORD dwDefaultRefreshInterval;
+ DWORD dwDefaultNoRefreshInterval;
+ DWORD dwLastScavengeTime;
+
+ /* more logging */
+
+ DWORD dwEventLogLevel;
+ DWORD dwLogFileMaxSize;
+
+ /* Active Directory information */
+
+ DWORD dwDsForestVersion;
+ DWORD dwDsDomainVersion;
+ DWORD dwDsDsaVersion;
+
+ DWORD dwReserveArray[ 4 ];
+
+ /* BYTE section */
+
+ /* configuration flags */
+
+ BOOLEAN fAutoReverseZones;
+ BOOLEAN fAutoCacheUpdate;
+
+ /* recursion control */
+
+ BOOLEAN fRecurseAfterForwarding;
+ BOOLEAN fForwardDelegations;
+ BOOLEAN fNoRecursion;
+ BOOLEAN fSecureResponses;
+
+ /* lookup control */
+
+ BOOLEAN fRoundRobin;
+ BOOLEAN fLocalNetPriority;
+
+ /* BIND compatibility and mimicking */
+
+ BOOLEAN fBindSecondaries;
+ BOOLEAN fWriteAuthorityNs;
+
+ /* Bells and whistles */
+
+ BOOLEAN fStrictFileParsing;
+ BOOLEAN fLooseWildcarding;
+
+ /* aging \ scavenging */
+
+ BOOLEAN fDefaultAgingState;
+
+ BOOLEAN fReserveArray[ 15 ];
+ }
+ DNS_RPC_SERVER_INFO_DOTNET;
+
+ typedef [public] struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ /* basic configuration flags */
+
+ DWORD dwVersion;
+ DNS_BOOT_METHOD fBootMethod;
+ BOOLEAN fAdminConfigured;
+ BOOLEAN fAllowUpdate;
+ BOOLEAN fDsAvailable;
+
+ /* pointer section */
+
+ [string, charset(UTF8)] char * pszServerName;
+
+ /* DS container */
+
+ [string, charset(UTF16)] wchar_t * pszDsContainer;
+
+ /* IP interfaces */
+
+ PDNS_ADDR_ARRAY aipServerAddrs;
+ PDNS_ADDR_ARRAY aipListenAddrs;
+
+ /* forwarders */
+
+ PDNS_ADDR_ARRAY aipForwarders;
+
+ /* logging */
+
+ PDNS_ADDR_ARRAY aipLogFilter;
+ [string, charset(UTF16)] wchar_t * pwszLogFilePath;
+
+ /* Server domain/forest */
+
+ [string, charset(UTF8)] char * pszDomainName; /* UTF-8 FQDN */
+ [string, charset(UTF8)] char * pszForestName; /* UTF-8 FQDN */
+
+ /* Built-in directory partitions */
+
+ [string, charset(UTF8)] char * pszDomainDirectoryPartition; /* UTF-8 FQDN */
+ [string, charset(UTF8)] char * pszForestDirectoryPartition; /* UTF-8 FQDN */
+
+ /* future extensions */
+ DNS_EXTENSION pExtensions[6];
+
+ /* DWORD section */
+
+ /* logging */
+
+ DWORD dwLogLevel;
+ DWORD dwDebugLevel;
+
+ /* configuration DWORDs */
+
+ DWORD dwForwardTimeout;
+ DWORD dwRpcProtocol;
+ DNS_NAME_CHECK_FLAG dwNameCheckFlag;
+ DWORD cAddressAnswerLimit;
+ DWORD dwRecursionRetry;
+ DWORD dwRecursionTimeout;
+ DWORD dwMaxCacheTtl;
+ DWORD dwDsPollingInterval;
+ DWORD dwLocalNetPriorityNetMask;
+
+ /* aging and scavenging */
+
+ DWORD dwScavengingInterval;
+ DWORD dwDefaultRefreshInterval;
+ DWORD dwDefaultNoRefreshInterval;
+ DWORD dwLastScavengeTime;
+
+ /* more logging */
+
+ DWORD dwEventLogLevel;
+ DWORD dwLogFileMaxSize;
+
+ /* Active Directory information */
+
+ DWORD dwDsForestVersion;
+ DWORD dwDsDomainVersion;
+ DWORD dwDsDsaVersion;
+ BOOLEAN fReadOnlyDC;
+
+ DWORD dwReserveArray[ 3 ];
+
+ /* BYTE section */
+
+ /* configuration flags */
+
+ BOOLEAN fAutoReverseZones;
+ BOOLEAN fAutoCacheUpdate;
+
+ /* recursion control */
+
+ BOOLEAN fRecurseAfterForwarding;
+ BOOLEAN fForwardDelegations;
+ BOOLEAN fNoRecursion;
+ BOOLEAN fSecureResponses;
+
+ /* lookup control */
+
+ BOOLEAN fRoundRobin;
+ BOOLEAN fLocalNetPriority;
+
+ /* BIND compatibility and mimicking */
+
+ BOOLEAN fBindSecondaries;
+ BOOLEAN fWriteAuthorityNs;
+
+ /* Bells and whistles */
+
+ BOOLEAN fStrictFileParsing;
+ BOOLEAN fLooseWildcarding;
+
+ /* aging \ scavenging */
+
+ BOOLEAN fDefaultAgingState;
+
+ BOOLEAN fReserveArray[ 15 ];
+ }
+ DNS_RPC_SERVER_INFO_LONGHORN;
+#define DNS_RPC_SERVER_INFO DNS_RPC_SERVER_INFO_LONGHORN
+
+
+ /* */
+ /* DNS Application directory partition data types */
+ /* */
+
+ typedef [bitmap32bit] bitmap {
+ DNS_DP_AUTOCREATED = 0x00000001,
+ DNS_DP_LEGACY = 0x00000002,
+ DNS_DP_DOMAIN_DEFAULT = 0x00000004,
+ DNS_DP_FOREST_DEFAULT = 0x00000008,
+ DNS_DP_ENLISTED = 0x00000010,
+ DNS_DP_DELETED = 0x00000020
+ }
+ DNS_RPC_DP_FLAGS;
+
+ typedef struct {
+ [string, charset(UTF16)] wchar_t * pszReplicaDn;
+ }
+ DNS_RPC_DP_REPLICA;
+#define PDNS_RPC_DP_REPLICA DNS_RPC_DP_REPLICA*
+
+ typedef [v1_enum] enum {
+ DNS_DP_OKAY = 0x00,
+ DNS_DP_STATE_REPL_INCOMING = 0x01,
+ DNS_DP_STATE_REPL_OUTGOING = 0x02,
+ DNS_DP_STATE_UNKNOWN = 0x03
+ } DNS_DP_STATE;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ [string, charset(UTF8)] char * pszDpFqdn;
+ [string, charset(UTF16)] wchar_t * pszDpDn;
+ [string, charset(UTF16)] wchar_t * pszCrDn;
+ DWORD dwFlags;
+ DWORD dwZoneCount;
+ DNS_DP_STATE dwState;
+
+ DWORD dwReserved[ 3 ];
+ DNS_EXTENSION pwszReserved[ 3 ];
+ [range(0,10000)] DWORD dwReplicaCount;
+ [size_is(dwReplicaCount)] PDNS_RPC_DP_REPLICA ReplicaArray[];
+ }
+ DNS_RPC_DP_INFO;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ [string, charset(UTF8)] char * pszDpFqdn;
+ DWORD dwFlags;
+ DWORD dwZoneCount;
+ }
+ DNS_RPC_DP_ENUM;
+#define PDNS_RPC_DP_ENUM DNS_RPC_DP_ENUM*
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ [range(0,5000)] DWORD dwDpCount;
+ [size_is(dwDpCount)] PDNS_RPC_DP_ENUM DpArray[];
+ }
+ DNS_RPC_DP_LIST;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ [string, charset(UTF8)] char * pszDpFqdn; /* UTF8 */
+ DWORD dwOperation;
+ }
+ DNS_RPC_ENLIST_DP;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ [string, charset(UTF8)] char * pszDestPartition;
+ }
+ DNS_RPC_ZONE_CHANGE_DP;
+
+
+ /* */
+ /* DNS Zone data types */
+ /* */
+
+ /* DNS_ZONE_TYPE defined in dnsp as dns_zone_type */
+
+ typedef [v1_enum] enum {
+ DNS_ZONE_SECSECURE_NO_SECURITY = 0x00,
+ DNS_ZONE_SECSECURE_NS_ONLY = 0x01,
+ DNS_ZONE_SECSECURE_LIST_ONLY = 0x02,
+ DNS_ZONE_SECSECURE_NO_XFER = 0x03
+ }
+ DNS_ZONE_SECONDARY_SECURITY;
+
+ typedef [v1_enum] enum {
+ DNS_ZONE_NOTIFY_OFF = 0x00,
+ DNS_ZONE_NOTIFY_ALL_SECONDARIES = 0x01,
+ DNS_ZONE_NOTIFY_LIST_ONLY = 0x02
+ }
+ DNS_ZONE_NOTIFY_LEVEL;
+
+ typedef [v1_enum] enum {
+ DNS_ZONE_REQUEST_PRIMARY = 0x00000001,
+ DNS_ZONE_REQUEST_SECONDARY = 0x00000002,
+ DNS_ZONE_REQUEST_CACHE = 0x00000004,
+ DNS_ZONE_REQUEST_AUTO = 0x00000008,
+ DNS_ZONE_REQUEST_FORWARD = 0x00000010,
+ DNS_ZONE_REQUEST_REVERSE = 0x00000020,
+ DNS_ZONE_REQUEST_FORWARDER = 0x00000040,
+ DNS_ZONE_REQUEST_STUB = 0x00000080,
+ DNS_ZONE_REQUEST_DS = 0x00000100,
+ DNS_ZONE_REQUEST_NON_DS = 0x00000200,
+ DNS_ZONE_REQUEST_DOMAIN_DP = 0x00000400,
+ DNS_ZONE_REQUEST_FOREST_DP = 0x00000800,
+ DNS_ZONE_REQUEST_CUSTOM_DP = 0x00001000,
+ DNS_ZONE_REQUEST_LEGACY_DP = 0x00002000
+ }
+ DNS_ZONE_REQUEST_FILTERS;
+
+ typedef [bitmap32bit] bitmap {
+ DNS_RPC_ZONE_PAUSED = 0x0001,
+ DNS_RPC_ZONE_SHUTDOWN = 0x0002,
+ DNS_RPC_ZONE_REVERSE = 0x0004,
+ DNS_RPC_ZONE_AUTOCREATED = 0x0008,
+ DNS_RPC_ZONE_DSINTEGRATED = 0x0010,
+ DNS_RPC_ZONE_AGING = 0x0020,
+ DNS_RPC_ZONE_UPDATE_UNSECURE = 0x0040,
+ DNS_RPC_ZONE_UPDATE_SECURE = 0x0080,
+ DNS_RPC_ZONE_READONLY = 0x0100
+ } DNS_RPC_ZONE_FLAGS;
+
+ typedef struct {
+ [string, charset(UTF16)] uint16 * pszZoneName;
+ DNS_RPC_ZONE_FLAGS Flags;
+ UCHAR ZoneType;
+ UCHAR Version;
+ }
+ DNS_RPC_ZONE_W2K;
+#define PDNS_RPC_ZONE_W2K DNS_RPC_ZONE_W2K*
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ [string, charset(UTF16)] wchar_t * pszZoneName;
+ DNS_RPC_ZONE_FLAGS Flags;
+ UCHAR ZoneType;
+ UCHAR Version;
+ DNS_RPC_DP_FLAGS dwDpFlags;
+ [string, charset(UTF8)] char * pszDpFqdn;
+ }
+ DNS_RPC_ZONE_DOTNET;
+#define DNS_RPC_ZONE DNS_RPC_ZONE_DOTNET
+#define PDNS_RPC_ZONE_DOTNET DNS_RPC_ZONE_DOTNET*
+
+ /* Zone enumeration */
+ typedef struct {
+ [range(0,500000)] DWORD dwZoneCount;
+ [size_is(dwZoneCount)] PDNS_RPC_ZONE_W2K ZoneArray[];
+ }
+ DNS_RPC_ZONE_LIST_W2K;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ [range(0,500000)] DWORD dwZoneCount;
+ [size_is(dwZoneCount)] PDNS_RPC_ZONE_DOTNET ZoneArray[];
+ }
+ DNS_RPC_ZONE_LIST_DOTNET;
+#define DNS_RPC_ZONE_LIST DNS_RPC_ZONE_LIST_DOTNET
+
+ /* Zone information */
+ typedef struct {
+ [string, charset(UTF8)] char * pszZoneName;
+ DWORD dwZoneType;
+ BOOL fReverse;
+ dns_zone_update fAllowUpdate;
+ DWORD fPaused;
+ DWORD fShutdown;
+ DWORD fAutoCreated;
+
+ /* Database info */
+ DWORD fUseDatabase;
+ [string, charset(UTF8)] char * pszDataFile;
+
+ /* Masters */
+ PIP4_ARRAY aipMasters;
+
+ /* Secondaries */
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+ PIP4_ARRAY aipSecondaries;
+ PIP4_ARRAY aipNotify;
+
+ /* WINS or NetBIOS lookup */
+ BOOL fUseWins;
+ BOOL fUseNbstat;
+
+ /* Aging */
+ BOOL fAging;
+ DWORD dwNoRefreshInterval;
+ DWORD dwRefreshInterval;
+ DWORD dwAvailForScavengeTime;
+ PIP4_ARRAY aipScavengeServers;
+
+ /* save some space, just in case */
+ /* avoid versioning issues if possible */
+ DWORD pvReserved1;
+ DWORD pvReserved2;
+ DWORD pvReserved3;
+ DWORD pvReserved4;
+ }
+ DNS_RPC_ZONE_INFO_W2K;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ [string, charset(UTF8)] char * pszZoneName;
+ DWORD dwZoneType;
+ BOOL fReverse;
+ dns_zone_update fAllowUpdate;
+ DWORD fPaused;
+ DWORD fShutdown;
+ DWORD fAutoCreated;
+
+ /* Database info */
+ DWORD fUseDatabase;
+ [string, charset(UTF8)] char * pszDataFile;
+
+ /* Masters */
+ PIP4_ARRAY aipMasters;
+
+ /* Secondaries */
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+ PIP4_ARRAY aipSecondaries;
+ PIP4_ARRAY aipNotify;
+
+ /* WINS or NetBIOS lookup */
+ BOOL fUseWins;
+ BOOL fUseNbstat;
+
+ /* Aging */
+ BOOL fAging;
+ DWORD dwNoRefreshInterval;
+ DWORD dwRefreshInterval;
+ DWORD dwAvailForScavengeTime;
+ PIP4_ARRAY aipScavengeServers;
+
+ /* Forwarder zones */
+ DWORD dwForwarderTimeout;
+ DWORD fForwarderSlave;
+
+ /* Stub zones */
+ PIP4_ARRAY aipLocalMasters;
+
+ /* Directory partition */
+ DWORD dwDpFlags;
+ [string, charset(UTF8)] char * pszDpFqdn;
+ [string, charset(UTF16)] wchar_t * pwszZoneDn;
+
+ /* Xfr time information */
+ DWORD dwLastSuccessfulSoaCheck;
+ DWORD dwLastSuccessfulXfr;
+
+ /* save some space, just in case */
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ DWORD dwReserved3;
+ DWORD dwReserved4;
+ DWORD dwReserved5;
+ [string, charset(UTF8)] char * pReserved1;
+ [string, charset(UTF8)] char * pReserved2;
+ [string, charset(UTF8)] char * pReserved3;
+ [string, charset(UTF8)] char * pReserved4;
+ }
+ DNS_RPC_ZONE_INFO_DOTNET;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ [string, charset(UTF8)] char * pszZoneName;
+ DWORD dwZoneType;
+ BOOL fReverse;
+ dns_zone_update fAllowUpdate;
+ DWORD fPaused;
+ DWORD fShutdown;
+ DWORD fAutoCreated;
+
+ /* Database info */
+ DWORD fUseDatabase;
+ [string, charset(UTF8)] char * pszDataFile;
+
+ /* Masters */
+ PDNS_ADDR_ARRAY aipMasters;
+
+ /* Secondaries */
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+ PDNS_ADDR_ARRAY aipSecondaries;
+ PDNS_ADDR_ARRAY aipNotify;
+
+ /* WINS or NetBIOS lookup */
+ BOOL fUseWins;
+ BOOL fUseNbstat;
+
+ /* Aging */
+ BOOL fAging;
+ DWORD dwNoRefreshInterval;
+ DWORD dwRefreshInterval;
+ DWORD dwAvailForScavengeTime;
+ PDNS_ADDR_ARRAY aipScavengeServers;
+
+ /* Forwarder zones */
+ DWORD dwForwarderTimeout;
+ DWORD fForwarderSlave;
+
+ /* Stub zones */
+ PDNS_ADDR_ARRAY aipLocalMasters;
+
+ /* Directory partition */
+ DWORD dwDpFlags;
+ [string, charset(UTF8)] char * pszDpFqdn;
+ [string, charset(UTF16)] wchar_t * pwszZoneDn;
+ /* Xfr time information */
+ DWORD dwLastSuccessfulSoaCheck;
+ DWORD dwLastSuccessfulXfr;
+
+ DWORD fQueuedForBackgroundLoad;
+ DWORD fBackgroundLoadInProgress;
+ BOOL fReadOnlyZone;
+
+ /* Additional zone transfer information */
+ DWORD dwLastXfrAttempt;
+ DWORD dwLastXfrResult;
+ }
+ DNS_RPC_ZONE_INFO_LONGHORN;
+#define DNS_RPC_ZONE_INFO DNS_RPC_ZONE_INFO_LONGHORN
+
+ /* Zone property data */
+ typedef struct {
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+ PIP4_ARRAY aipSecondaries;
+ PIP4_ARRAY aipNotify;
+ }
+ DNS_RPC_ZONE_SECONDARIES_W2K;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+ PIP4_ARRAY aipSecondaries;
+ PIP4_ARRAY aipNotify;
+ }
+ DNS_RPC_ZONE_SECONDARIES_DOTNET;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+ PDNS_ADDR_ARRAY aipSecondaries;
+ PDNS_ADDR_ARRAY aipNotify;
+ }
+ DNS_RPC_ZONE_SECONDARIES_LONGHORN;
+#define DNS_RPC_ZONE_SECONDARIES DNS_RPC_ZONE_SECONDARIES_LONGHORN
+
+ /* Zone database */
+ typedef struct {
+ DWORD fDsIntegrated;
+ [string, charset(UTF8)] char * pszFileName;
+ }
+ DNS_RPC_ZONE_DATABASE_W2K;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ DWORD fDsIntegrated;
+ [string, charset(UTF8)] char * pszFileName;
+ }
+ DNS_RPC_ZONE_DATABASE_DOTNET;
+#define DNS_RPC_ZONE_DATABASE DNS_RPC_ZONE_DATABASE_DOTNET
+
+ /* Zone create data */
+ typedef struct {
+ [string, charset(UTF8)] char * pszZoneName;
+ DWORD dwZoneType;
+ dns_zone_update fAllowUpdate;
+ BOOL fAging;
+ DWORD dwFlags;
+
+ /* Database info */
+
+ [string, charset(UTF8)] char * pszDataFile;
+ DWORD fDsIntegrated;
+ DWORD fLoadExisting;
+
+ /* Admin name (if auto-create SOA) */
+
+ [string, charset(UTF8)] char * pszAdmin;
+
+ /* Masters (if secondary) */
+
+ PIP4_ARRAY aipMasters;
+
+ /* Secondaries */
+
+ PIP4_ARRAY aipSecondaries;
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+
+ /* Reserve some space to avoid versioning issues */
+
+ [string, charset(UTF8)] char * pvReserved1;
+ [string, charset(UTF8)] char * pvReserved2;
+ [string, charset(UTF8)] char * pvReserved3;
+ [string, charset(UTF8)] char * pvReserved4;
+ [string, charset(UTF8)] char * pvReserved5;
+ [string, charset(UTF8)] char * pvReserved6;
+ [string, charset(UTF8)] char * pvReserved7;
+ [string, charset(UTF8)] char * pvReserved8;
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ DWORD dwReserved3;
+ DWORD dwReserved4;
+ DWORD dwReserved5;
+ DWORD dwReserved6;
+ DWORD dwReserved7;
+ DWORD dwReserved8;
+ }
+ DNS_RPC_ZONE_CREATE_INFO_W2K;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ [string, charset(UTF8)] char * pszZoneName;
+ DWORD dwZoneType;
+ dns_zone_update fAllowUpdate;
+ BOOL fAging;
+ DWORD dwFlags;
+
+ /* Database info */
+
+ [string, charset(UTF8)] char * pszDataFile;
+ DWORD fDsIntegrated;
+ DWORD fLoadExisting;
+
+ /* Admin name (if auto-create SOA) */
+
+ [string, charset(UTF8)] char * pszAdmin;
+
+ /* Masters (if secondary) */
+
+ PIP4_ARRAY aipMasters;
+
+ /* Secondaries */
+
+ PIP4_ARRAY aipSecondaries;
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+
+ /* Forwarder zones */
+
+ DWORD dwTimeout;
+ DWORD fRecurseAfterForwarding;
+
+ /* Directory partition */
+
+ DWORD dwDpFlags; /* specify built-in DP or */
+ [string, charset(UTF8)] char * pszDpFqdn; /* UTF8 FQDN of partition */
+
+ DWORD dwReserved[ 32 ];
+ }
+ DNS_RPC_ZONE_CREATE_INFO_DOTNET;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ [string, charset(UTF8)] char * pszZoneName;
+ DWORD dwZoneType;
+ dns_zone_update fAllowUpdate;
+ BOOL fAging;
+ DWORD dwFlags;
+
+ /* Database info */
+
+ [string, charset(UTF8)] char * pszDataFile;
+ DWORD fDsIntegrated;
+ DWORD fLoadExisting;
+
+ /* Admin name (if auto-create SOA) */
+
+ [string, charset(UTF8)] char * pszAdmin;
+
+ /* Masters (if secondary) */
+
+ PDNS_ADDR_ARRAY aipMasters;
+
+ /* Secondaries */
+
+ PDNS_ADDR_ARRAY aipSecondaries;
+ DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries;
+ DNS_ZONE_NOTIFY_LEVEL fNotifyLevel;
+
+ /* Forwarder zones */
+
+ DWORD dwTimeout;
+ DWORD fRecurseAfterForwarding;
+
+ /* Directory partition */
+
+ DWORD dwDpFlags; /* specify built-in DP or */
+ [string, charset(UTF8)] char * pszDpFqdn; /* UTF8 FQDN of partition */
+
+ DWORD dwReserved[ 32 ];
+ }
+ DNS_RPC_ZONE_CREATE_INFO_LONGHORN;
+#define DNS_RPC_ZONE_CREATE_INFO DNS_RPC_ZONE_CREATE_INFO_LONGHORN
+
+ /* Zone export */
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ [string, charset(UTF8)] char * pszZoneExportFile;
+ }
+ DNS_RPC_ZONE_EXPORT_INFO;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+
+ DWORD dwFilter;
+ [string, charset(UTF8)] char * pszPartitionFqdn;
+ [string, charset(UTF8)] char * pszQueryString;
+
+ DNS_EXTENSION pszReserved[ 6 ];
+ }
+ DNS_RPC_ENUM_ZONES_FILTER;
+
+ /* Forwarders information */
+ typedef struct {
+ DWORD fRecurseAfterForwarding;
+ DWORD dwForwardTimeout;
+ PIP4_ARRAY aipForwarders;
+ }
+ DNS_RPC_FORWARDERS_W2K;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ DWORD fRecurseAfterForwarding;
+ DWORD dwForwardTimeout;
+ PIP4_ARRAY aipForwarders;
+ }
+ DNS_RPC_FORWARDERS_DOTNET;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ DWORD fRecurseAfterForwarding;
+ DWORD dwForwardTimeout;
+ PDNS_ADDR_ARRAY aipForwarders;
+ }
+ DNS_RPC_FORWARDERS_LONGHORN;
+#define DNS_RPC_FORWARDERS DNS_RPC_FORWARDERS_LONGHORN
+
+
+ /* */
+ /* DNS autoconfig data types */
+ /* */
+
+ typedef [v1_enum] enum {
+ DNS_RPC_AUTOCONFIG_INTERNAL_ROOTHINTS = 0x00000001,
+ DNS_RPC_AUTOCONFIG_INTERNAL_FORWARDERS = 0x00000002,
+ DNS_RPC_AUTOCONFIG_INTERNAL_ZONES = 0x00000004,
+ DNS_RPC_AUTOCONFIG_INTERNAL_SELFPOINT = 0x00000010,
+ DNS_RPC_AUTOCONFIG_INTERNAL_SELFPOINT_PREPEND = 0x00000020,
+ DNS_RPC_AUTOCONFIG_INTERNAL_SELFPOINT_APPEND = 0x00000040,
+ DNS_RPC_AUTOCONFIG_INTERNAL_RETURN_ERROR = 0x00008000,
+ DNS_RPC_AUTOCONFIG_ALL = 0xFFFFFFFF
+ }
+ DNS_RPC_AUTOCONFIG;
+
+ typedef struct {
+ DWORD dwRpcStructureVersion;
+ DWORD dwReserved0;
+ DNS_RPC_AUTOCONFIG dwAutoConfigFlags;
+ DWORD dwReserved1;
+ [string, charset(UTF8)] char * pszNewDomainName;
+ }
+ DNS_RPC_AUTOCONFIGURE;
+
+
+ /* */
+ /* DNS logging data types */
+ /* */
+
+ typedef [bitmap32bit] bitmap {
+ DNS_EVENT_LOG_SUCCESS = 0x00000000,
+ DNS_EVENT_LOG_ERROR_TYPE = 0x00000001,
+ DNS_EVENT_LOG_WARNING_TYPE = 0x00000002,
+ DNS_EVENT_LOG_INFORMATION_TYPE = 0x00000004
+ }
+ DNS_EVENT_LOG_TYPES;
+
+ typedef [bitmap32bit] bitmap {
+ DNS_RPC_VIEW_AUTHORITY_DATA = 0x00000001,
+ DNS_RPC_VIEW_CACHE_DATA = 0x00000002,
+ DNS_RPC_VIEW_GLUE_DATA = 0x00000004,
+ DNS_RPC_VIEW_ROOT_HINT_DATA = 0x00000008,
+ DNS_RPC_VIEW_ADDITIONAL_DATA = 0x00000010,
+ DNS_RPC_VIEW_NO_CHILDREN = 0x00010000,
+ DNS_RPC_VIEW_ONLY_CHILDREN = 0x00020000
+ }
+ DNS_SELECT_FLAGS;
+
+
+ /* */
+ /* DNS statistics data types */
+ /* */
+
+ typedef struct {
+ DWORD StatId;
+ WORD wLength;
+ BOOLEAN fClear;
+ UCHAR fReserved;
+ }
+ DNSSRV_STAT_HEADER;
+
+ typedef struct {
+ DNSSRV_STAT_HEADER Header;
+ BYTE Buffer[1];
+ }
+ DNSSRV_STAT;
+
+
+ /* */
+ /* DNS Typid and Union of all RPC data types */
+ /* */
+
+ typedef [v1_enum] enum {
+ DNSSRV_TYPEID_NULL = 0,
+ DNSSRV_TYPEID_DWORD = 1,
+ DNSSRV_TYPEID_LPSTR = 2,
+ DNSSRV_TYPEID_LPWSTR = 3,
+ DNSSRV_TYPEID_IPARRAY = 4,
+ DNSSRV_TYPEID_BUFFER = 5,
+ DNSSRV_TYPEID_SERVER_INFO_W2K = 6,
+ DNSSRV_TYPEID_STATS = 7,
+ DNSSRV_TYPEID_FORWARDERS_W2K = 8,
+ DNSSRV_TYPEID_ZONE_W2K = 9,
+ DNSSRV_TYPEID_ZONE_INFO_W2K = 10,
+ DNSSRV_TYPEID_ZONE_SECONDARIES_W2K = 11,
+ DNSSRV_TYPEID_ZONE_DATABASE_W2K = 12,
+ DNSSRV_TYPEID_ZONE_TYPE_RESET_W2K = 13,
+ DNSSRV_TYPEID_ZONE_CREATE_W2K = 14,
+ DNSSRV_TYPEID_NAME_AND_PARAM = 15,
+ DNSSRV_TYPEID_ZONE_LIST_W2K = 16,
+ DNSSRV_TYPEID_ZONE_RENAME = 17,
+ DNSSRV_TYPEID_ZONE_EXPORT = 18,
+ DNSSRV_TYPEID_SERVER_INFO_DOTNET = 19,
+ DNSSRV_TYPEID_FORWARDERS_DOTNET = 20,
+ DNSSRV_TYPEID_ZONE = 21,
+ DNSSRV_TYPEID_ZONE_INFO_DOTNET = 22,
+ DNSSRV_TYPEID_ZONE_SECONDARIES_DOTNET = 23,
+ DNSSRV_TYPEID_ZONE_DATABASE = 24,
+ DNSSRV_TYPEID_ZONE_TYPE_RESET_DOTNET = 25,
+ DNSSRV_TYPEID_ZONE_CREATE_DOTNET = 26,
+ DNSSRV_TYPEID_ZONE_LIST = 27,
+ DNSSRV_TYPEID_DP_ENUM = 28,
+ DNSSRV_TYPEID_DP_INFO = 29,
+ DNSSRV_TYPEID_DP_LIST = 30,
+ DNSSRV_TYPEID_ENLIST_DP = 31,
+ DNSSRV_TYPEID_ZONE_CHANGE_DP = 32,
+ DNSSRV_TYPEID_ENUM_ZONES_FILTER = 33,
+ DNSSRV_TYPEID_ADDRARRAY = 34,
+ DNSSRV_TYPEID_SERVER_INFO = 35,
+ DNSSRV_TYPEID_ZONE_INFO = 36,
+ DNSSRV_TYPEID_FORWARDERS = 37,
+ DNSSRV_TYPEID_ZONE_SECONDARIES = 38,
+ DNSSRV_TYPEID_ZONE_TYPE_RESET = 39,
+ DNSSRV_TYPEID_ZONE_CREATE = 40,
+ DNSSRV_TYPEID_IP_VALIDATE = 41,
+ DNSSRV_TYPEID_AUTOCONFIGURE = 42,
+ DNSSRV_TYPEID_UTF8_STRING_LIST = 43,
+ DNSSRV_TYPEID_UNICODE_STRING_LIST = 44
+ }
+ DNS_RPC_TYPEID;
+
+ typedef [switch_type(uint3264)] union {
+ [case(DNSSRV_TYPEID_NULL)] PBYTE Null;
+
+ [case(DNSSRV_TYPEID_DWORD)] DWORD Dword;
+
+ [case(DNSSRV_TYPEID_LPSTR)] [string, charset(UTF8)] char * String;
+
+ [case(DNSSRV_TYPEID_LPWSTR)] [string, charset(UTF16)] wchar_t * WideString;
+
+ [case(DNSSRV_TYPEID_IPARRAY)] IP4_ARRAY *IpArray;
+
+ [case(DNSSRV_TYPEID_BUFFER)]
+ DNS_RPC_BUFFER *Buffer;
+
+ [case(DNSSRV_TYPEID_SERVER_INFO_W2K)]
+ DNS_RPC_SERVER_INFO_W2K *ServerInfoW2K;
+
+ [case(DNSSRV_TYPEID_STATS)]
+ DNSSRV_STAT *Stats;
+
+ [case(DNSSRV_TYPEID_FORWARDERS_W2K)]
+ DNS_RPC_FORWARDERS_W2K *ForwardersW2K;
+
+ [case(DNSSRV_TYPEID_ZONE_W2K)]
+ DNS_RPC_ZONE_W2K *ZoneW2K;
+
+ [case(DNSSRV_TYPEID_ZONE_INFO_W2K)]
+ DNS_RPC_ZONE_INFO_W2K *ZoneInfoW2K;
+
+ [case(DNSSRV_TYPEID_ZONE_SECONDARIES_W2K)]
+ DNS_RPC_ZONE_SECONDARIES_W2K *SecondariesW2K;
+
+ [case(DNSSRV_TYPEID_ZONE_DATABASE_W2K)]
+ DNS_RPC_ZONE_DATABASE_W2K *DatabaseW2K;
+
+ [case(DNSSRV_TYPEID_ZONE_CREATE_W2K)]
+ DNS_RPC_ZONE_CREATE_INFO_W2K *ZoneCreateW2K;
+
+ [case(DNSSRV_TYPEID_NAME_AND_PARAM)]
+ DNS_RPC_NAME_AND_PARAM *NameAndParam;
+
+ [case(DNSSRV_TYPEID_ZONE_LIST_W2K)]
+ DNS_RPC_ZONE_LIST_W2K *ZoneListW2K;
+
+ [case(DNSSRV_TYPEID_SERVER_INFO_DOTNET)]
+ DNS_RPC_SERVER_INFO_DOTNET *ServerInfoDotNet;
+
+ [case(DNSSRV_TYPEID_FORWARDERS_DOTNET)]
+ DNS_RPC_FORWARDERS_DOTNET *ForwardersDotNet;
+
+ [case(DNSSRV_TYPEID_ZONE)]
+ DNS_RPC_ZONE *Zone;
+
+ [case(DNSSRV_TYPEID_ZONE_INFO_DOTNET)]
+ DNS_RPC_ZONE_INFO_DOTNET *ZoneInfoDotNet;
+
+ [case(DNSSRV_TYPEID_ZONE_SECONDARIES_DOTNET)]
+ DNS_RPC_ZONE_SECONDARIES_DOTNET *SecondariesDotNet;
+
+ [case(DNSSRV_TYPEID_ZONE_DATABASE)]
+ DNS_RPC_ZONE_DATABASE *Database;
+
+ [case(DNSSRV_TYPEID_ZONE_CREATE_DOTNET)]
+ DNS_RPC_ZONE_CREATE_INFO_DOTNET *ZoneCreateDotNet;
+
+ [case(DNSSRV_TYPEID_ZONE_LIST)]
+ DNS_RPC_ZONE_LIST *ZoneList;
+
+ [case(DNSSRV_TYPEID_ZONE_EXPORT)]
+ DNS_RPC_ZONE_EXPORT_INFO *ZoneExport;
+
+ [case(DNSSRV_TYPEID_DP_INFO)]
+ DNS_RPC_DP_INFO *DirectoryPartition;
+
+ [case(DNSSRV_TYPEID_DP_ENUM)]
+ DNS_RPC_DP_ENUM *DirectoryPartitionEnum;
+
+ [case(DNSSRV_TYPEID_DP_LIST)]
+ DNS_RPC_DP_LIST *DirectoryPartitionList;
+
+ [case(DNSSRV_TYPEID_ENLIST_DP)]
+ DNS_RPC_ENLIST_DP *EnlistDirectoryPartition;
+
+ [case(DNSSRV_TYPEID_ZONE_CHANGE_DP)]
+ DNS_RPC_ZONE_CHANGE_DP *ZoneChangeDirectoryPartition;
+
+ [case(DNSSRV_TYPEID_ENUM_ZONES_FILTER)]
+ DNS_RPC_ENUM_ZONES_FILTER *EnumZonesFilter;
+
+ [case(DNSSRV_TYPEID_ADDRARRAY)]
+ DNS_ADDR_ARRAY *AddrArray;
+
+ [case(DNSSRV_TYPEID_SERVER_INFO)]
+ DNS_RPC_SERVER_INFO *ServerInfo;
+
+ [case(DNSSRV_TYPEID_ZONE_CREATE)]
+ DNS_RPC_ZONE_CREATE_INFO *ZoneCreate;
+
+ [case(DNSSRV_TYPEID_FORWARDERS)]
+ DNS_RPC_FORWARDERS *Forwarders;
+
+ [case(DNSSRV_TYPEID_ZONE_SECONDARIES)]
+ DNS_RPC_ZONE_SECONDARIES *Secondaries;
+
+ [case(DNSSRV_TYPEID_IP_VALIDATE)]
+ DNS_RPC_IP_VALIDATE *IpValidate;
+
+ [case(DNSSRV_TYPEID_ZONE_INFO)]
+ DNS_RPC_ZONE_INFO *ZoneInfo;
+
+ [case(DNSSRV_TYPEID_AUTOCONFIGURE)]
+ DNS_RPC_AUTOCONFIGURE *AutoConfigure;
+
+ [case(DNSSRV_TYPEID_UTF8_STRING_LIST)]
+ DNS_RPC_UTF8_STRING_LIST *Utf8StringList;
+ } DNSSRV_RPC_UNION;
+
+
+ /* */
+ /* DNS RPC interface */
+ /* */
+
+ typedef [public,gensize] struct {
+ [value((12+ndr_size_DNS_RPC_NAME(&dnsNodeName,0)+3) & ~3)] uint16 wLength;
+ uint16 wRecordCount;
+ uint32 dwFlags;
+ uint32 dwChildCount;
+ DNS_RPC_NAME dnsNodeName;
+ DNS_RPC_RECORD records[wRecordCount];
+ } DNS_RPC_RECORDS;
+
+ typedef [public,nopull,nopush,gensize] struct {
+ uint32 count;
+ DNS_RPC_RECORDS rec[count];
+ } DNS_RPC_RECORDS_ARRAY;
+
+ WERROR DnssrvOperation(
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in] DWORD dwContext,
+ [in,unique,string,charset(UTF8)] uint8 *pszOperation,
+ [in] DNS_RPC_TYPEID dwTypeId,
+ [in, switch_is(dwTypeId)] DNSSRV_RPC_UNION pData
+ );
+
+ WERROR DnssrvQuery(
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in,unique,string,charset(UTF8)] uint8 *pszOperation,
+ [out] DNS_RPC_TYPEID *pdwTypeId,
+ [out, switch_is(*pdwTypeId)] DNSSRV_RPC_UNION *ppData
+ );
+
+ WERROR DnssrvComplexOperation(
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in,unique,string,charset(UTF8)] uint8 *pszOperation,
+ [in] DNS_RPC_TYPEID dwTypeIn,
+ [in, switch_is(dwTypeIn)] DNSSRV_RPC_UNION pDataIn,
+ [out] DNS_RPC_TYPEID *pdwTypeOut,
+ [out, switch_is(*pdwTypeOut)] DNSSRV_RPC_UNION *ppDataOut
+ );
+
+ WERROR DnssrvEnumRecords(
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in,unique,string,charset(UTF8)] uint8 *pszNodeName,
+ [in,unique,string,charset(UTF8)] uint8 *pszStartChild,
+ [in] dns_record_type wRecordType,
+ [in] DNS_SELECT_FLAGS fSelectFlag,
+ [in,unique,string,charset(UTF8)] uint8 *pszFilterStart,
+ [in,unique,string,charset(UTF8)] uint8 *pszFilterStop,
+ [out] DWORD *pdwBufferLength,
+ [out,ref,subcontext(4),subcontext_size(*pdwBufferLength)] DNS_RPC_RECORDS_ARRAY **pBuffer
+ );
+
+ WERROR DnssrvUpdateRecord(
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in,unique,string,charset(UTF8)] uint8 *pszNodeName,
+ [in, unique] DNS_RPC_RECORD_BUF *pAddRecord,
+ [in, unique] DNS_RPC_RECORD_BUF *pDeleteRecord
+ );
+
+ WERROR DnssrvOperation2(
+ [in] DNS_RPC_CLIENT_VERSION dwClientVersion,
+ [in] uint32 dwSettingFlags,
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in] DWORD dwContext,
+ [in,unique,string,charset(UTF8)] uint8 *pszOperation,
+ [in] DNS_RPC_TYPEID dwTypeId,
+ [in, switch_is(dwTypeId)] DNSSRV_RPC_UNION pData
+ );
+
+ WERROR DnssrvQuery2(
+ [in] DNS_RPC_CLIENT_VERSION dwClientVersion,
+ [in] uint32 dwSettingFlags,
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in,unique,string,charset(UTF8)] uint8 *pszOperation,
+ [out] DNS_RPC_TYPEID *pdwTypeId,
+ [out, switch_is(*pdwTypeId)] DNSSRV_RPC_UNION *ppData
+ );
+
+ WERROR DnssrvComplexOperation2(
+ [in] DNS_RPC_CLIENT_VERSION dwClientVersion,
+ [in] uint32 dwSettingFlags,
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in,unique,string,charset(UTF8)] uint8 *pszOperation,
+ [in] DNS_RPC_TYPEID dwTypeIn,
+ [in, switch_is(dwTypeIn)] DNSSRV_RPC_UNION pDataIn,
+ [out] DNS_RPC_TYPEID *pdwTypeOut,
+ [out, switch_is(*pdwTypeOut)] DNSSRV_RPC_UNION *ppDataOut
+ );
+
+ WERROR DnssrvEnumRecords2(
+ [in] DNS_RPC_CLIENT_VERSION dwClientVersion,
+ [in] DWORD dwSettingFlags,
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in,unique,string,charset(UTF8)] uint8 *pszNodeName,
+ [in,unique,string,charset(UTF8)] uint8 *pszStartChild,
+ [in] dns_record_type wRecordType,
+ [in] DNS_SELECT_FLAGS fSelectFlag,
+ [in,unique,string,charset(UTF8)] uint8 *pszFilterStart,
+ [in,unique,string,charset(UTF8)] uint8 *pszFilterStop,
+ [out] uint32 *pdwBufferLength,
+ [out,ref,subcontext(4),subcontext_size(*pdwBufferLength)] DNS_RPC_RECORDS_ARRAY **pBuffer
+ );
+
+ WERROR DnssrvUpdateRecord2(
+ [in] DNS_RPC_CLIENT_VERSION dwClientVersion,
+ [in] uint32 dwSettingFlags,
+ [in,unique,string,charset(UTF16)] uint16 *pwszServerName,
+ [in,unique,string,charset(UTF8)] uint8 *pszZone,
+ [in,string,charset(UTF8)] uint8 *pszNodeName,
+ [in, unique] DNS_RPC_RECORD_BUF *pAddRecord,
+ [in, unique] DNS_RPC_RECORD_BUF *pDeleteRecord
+ );
+}
diff --git a/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl
new file mode 100644
index 0000000..8e66042
--- /dev/null
+++ b/librpc/idl/drsblobs.idl
@@ -0,0 +1,680 @@
+#include "idl_types.h"
+
+import "drsuapi.idl", "misc.idl", "samr.idl", "lsa.idl", "security.idl";
+
+[
+ uuid("12345778-1234-abcd-0001-00000001"),
+ version(0.0),
+ pointer_default(unique),
+ helper("../librpc/ndr/ndr_drsblobs.h"),
+ helpstring("Active Directory Replication LDAP Blobs")
+]
+interface drsblobs {
+ typedef bitmap drsuapi_DrsOptions drsuapi_DrsOptions;
+ typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId;
+ typedef [v1_enum] enum lsa_TrustAuthType lsa_TrustAuthType;
+ /*
+ * replPropertyMetaData
+ * w2k uses version 1
+ * w2k3 uses version 1
+ *
+ * Also equivalent to
+ * MS-DRSR 4.1.10.2.22 PROPERTY_META_DATA
+ */
+ typedef [public] struct {
+ drsuapi_DsAttributeId attid;
+ uint32 version;
+ NTTIME_1sec originating_change_time;
+ GUID originating_invocation_id;
+ hyper originating_usn;
+ hyper local_usn;
+ } replPropertyMetaData1;
+
+ typedef struct {
+ uint32 count;
+ [value(0)] uint32 reserved;
+ replPropertyMetaData1 array[count];
+ } replPropertyMetaDataCtr1;
+
+ typedef [nodiscriminant] union {
+ [case(1)] replPropertyMetaDataCtr1 ctr1;
+ } replPropertyMetaDataCtr;
+
+ typedef [public] struct {
+ uint32 version;
+ [value(0)] uint32 reserved;
+ [switch_is(version)] replPropertyMetaDataCtr ctr;
+ } replPropertyMetaDataBlob;
+
+ /*
+ * replUpToDateVector
+ * w2k uses version 1
+ * w2k3 uses version 2
+ */
+ typedef struct {
+ uint32 count;
+ [value(0)] uint32 reserved;
+ drsuapi_DsReplicaCursor cursors[count];
+ } replUpToDateVectorCtr1;
+
+ typedef struct {
+ uint32 count;
+ [value(0)] uint32 reserved;
+ drsuapi_DsReplicaCursor2 cursors[count];
+ } replUpToDateVectorCtr2;
+
+ typedef [nodiscriminant] union {
+ [case(1)] replUpToDateVectorCtr1 ctr1;
+ [case(2)] replUpToDateVectorCtr2 ctr2;
+ } replUpToDateVectorCtr;
+
+ typedef [public] struct {
+ uint32 version;
+ [value(0)] uint32 reserved;
+ [switch_is(version)] replUpToDateVectorCtr ctr;
+ } replUpToDateVectorBlob;
+
+ /*
+ * repsFrom/repsTo
+ * w2k uses version 1
+ * w2k3 uses version 1
+ * w2k8 uses version 2
+ */
+ typedef [public,gensize] struct {
+ [value(strlen(dns_name)+1)] uint32 __dns_name_size;
+ [charset(DOS)] uint8 dns_name[__dns_name_size];
+ } repsFromTo1OtherInfo;
+
+ typedef [public,gensize,flag(NDR_PAHEX)] struct {
+ /* this includes the 8 bytes of the repsFromToBlob header */
+ [value(ndr_size_repsFromTo1(this, 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_DrsOptions replica_flags;
+ uint8 schedule[84];
+ [value(0)] 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 [public,relative_base,gensize] struct {
+ [value(ndr_size_repsFromTo2OtherInfo(this,ndr->flags))]
+ uint32 __ndr_size;
+ [relative] nstring *dns_name1;
+ uint32 unknown1;
+ [relative] nstring *dns_name2;
+ hyper unknown2;
+ } repsFromTo2OtherInfo;
+
+ typedef [public,gensize,flag(NDR_PAHEX)] struct {
+ /* this includes the 8 bytes of the repsFromToBlob header */
+ [value(ndr_size_repsFromTo2(this, ndr->flags)+8)] uint32 blobsize;
+ uint32 consecutive_sync_failures;
+ NTTIME_1sec last_success;
+ NTTIME_1sec last_attempt;
+ WERROR result_last_attempt;
+ [relative] repsFromTo2OtherInfo *other_info;
+ [value(ndr_size_repsFromTo2OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
+ drsuapi_DrsOptions replica_flags;
+ uint8 schedule[84];
+ [value(0)] 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;
+ hyper unknown1;
+ } repsFromTo2;
+
+ typedef [nodiscriminant] union {
+ [case(1)] repsFromTo1 ctr1;
+ [case(2)] repsFromTo2 ctr2;
+ } repsFromTo;
+
+ typedef [public] struct {
+ uint32 version;
+ [value(0)] uint32 reserved;
+ [switch_is(version)] repsFromTo ctr;
+ } repsFromToBlob;
+
+ /* Replication schedule structures as defined in MS-ADTS 7.1.4.5
+ * Appears as attribute of NTDSConnection object
+ */
+ typedef [public] struct {
+ [value(0)] uint32 type; /* always 0 */
+ uint32 offset;
+ } scheduleHeader;
+
+ typedef [public] struct {
+ uint8 slots[168];
+ } scheduleSlots;
+
+ typedef [public] struct {
+ uint32 size;
+ [value(0)] uint32 bandwidth; /* ignored */
+ uint32 numberOfSchedules; /* typically 1 */
+ scheduleHeader headerArray[numberOfSchedules];
+ scheduleSlots dataArray[numberOfSchedules];
+ } schedule;
+
+ /*
+ * partialAttributeSet
+ * w2k uses version 1
+ * w2k3 uses version 1
+ */
+ typedef struct {
+ uint32 count;
+ drsuapi_DsAttributeId array[count];
+ } partialAttributeSetCtr1;
+
+ typedef [nodiscriminant] union {
+ [case(1)] partialAttributeSetCtr1 ctr1;
+ } partialAttributeSetCtr;
+
+ typedef [public] struct {
+ uint32 version;
+ [value(0)] uint32 reserved;
+ [switch_is(version)] partialAttributeSetCtr ctr;
+ } partialAttributeSetBlob;
+
+ /*
+ * schemaInfo attribute
+ *
+ * Used as an attribute on Schema.
+ * Also during replication as part of
+ * prefixMap to identify what revision
+ * of Schema source DC has
+ */
+ typedef [public,flag(NDR_NOALIGN)] struct {
+ [value(0xFF)] uint8 marker;
+ [flag(NDR_BIG_ENDIAN)] uint32 revision;
+ GUID invocation_id;
+ } schemaInfoBlob;
+
+
+ /*
+ * MS w2k3 and w2k8 prefixMap format
+ * There is no version number. Format is:
+ * uint32 - number of entries in the map
+ * uint32 - total bytes that structure occupies
+ * ENTRIES:
+ * uint16 - prefix ID (OID's last sub-id encoded. see prefixMap)
+ * uint16 - number of bytes in prefix N
+ * uint8[N] - BER encoded prefix
+ */
+ typedef [noprint,flag(NDR_NOALIGN)] struct {
+ uint16 entryID;
+ uint16 length;
+ uint8 binary_oid[length];
+ } drsuapi_MSPrefixMap_Entry;
+
+ typedef [public,gensize] struct {
+ uint32 num_entries;
+ [value(ndr_size_drsuapi_MSPrefixMap_Ctr(r, ndr->flags))] uint32 __ndr_size;
+ drsuapi_MSPrefixMap_Entry entries[num_entries];
+ } drsuapi_MSPrefixMap_Ctr;
+
+ /*
+ * prefixMap
+ * w2k unknown
+ * w2k3 unknown
+ * samba4 uses 0x44534442 'DSDB'
+ *
+ * as we windows don't return the prefixMap attribute when you ask for
+ * we don't know the format, but the attribute is not replicated
+ * so that we can choose our own format...
+ */
+ typedef [v1_enum] enum {
+ PREFIX_MAP_VERSION_DSDB = 0x44534442
+ } prefixMapVersion;
+
+ typedef [nodiscriminant] union {
+ [case(PREFIX_MAP_VERSION_DSDB)] drsuapi_DsReplicaOIDMapping_Ctr dsdb;
+ } prefixMapCtr;
+
+ typedef [public] struct {
+ prefixMapVersion version;
+ [value(0)] uint32 reserved;
+ [switch_is(version)] prefixMapCtr ctr;
+ } prefixMapBlob;
+
+ /*
+ * the cookie for the LDAP dirsync control
+ */
+ typedef [nodiscriminant,gensize] union {
+ [case(0)];
+ [default] replUpToDateVectorBlob uptodateness_vector;
+ } ldapControlDirSyncExtra;
+
+ typedef struct {
+ [value(3)] uint32 u1;
+ NTTIME time;
+ uint32 u2;
+ uint32 u3;
+ [value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, 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;
+
+ typedef [public] struct {
+ [value(2*strlen_m(name))] uint16 name_len;
+ [value(strlen(data))] uint16 data_len;
+ uint16 reserved; /* 2 for 'Packages', 1 for 'Primary:*', but should be ignored */
+ [charset(UTF16)] uint8 name[name_len];
+ /*
+ * the data field contains data as HEX strings
+ *
+ * 'Packages':
+ * data contains the list of packages
+ * as non termiated UTF16 strings with
+ * a UTF16 NULL byte as separator
+ *
+ * 'Primary:Kerberos-Newer-Keys':
+ * ...
+ *
+ * 'Primary:Kerberos':
+ * ...
+ *
+ * 'Primary:WDigest':
+ * ...
+ *
+ * 'Primary:CLEARTEXT':
+ * data contains the cleartext password
+ * as UTF16 string encoded as HEX string
+ *
+ * 'Primary:userPassword':
+ * ...
+ *
+ * 'Primary:SambaGPG':
+ * ...
+ *
+ * 'Primary:NTLM-Strong-NTOWF':
+ * ... Not yet implemented.
+ *
+ */
+ [charset(DOS)] uint8 data[data_len];
+ } supplementalCredentialsPackage;
+
+ /* this are 0x30 (48) whitespaces (0x20) */
+ const string SUPPLEMENTAL_CREDENTIALS_PREFIX = " ";
+
+ typedef [flag(NDR_PAHEX),public] enum {
+ SUPPLEMENTAL_CREDENTIALS_SIGNATURE = 0x0050
+ } supplementalCredentialsSignature;
+
+ typedef [gensize,nopush,nopull] struct {
+ [value(SUPPLEMENTAL_CREDENTIALS_PREFIX),charset(UTF16)] uint16 prefix[0x30];
+ [value(SUPPLEMENTAL_CREDENTIALS_SIGNATURE)] supplementalCredentialsSignature signature;
+ uint16 num_packages;
+ supplementalCredentialsPackage packages[num_packages];
+ } supplementalCredentialsSubBlob;
+
+ typedef [public] struct {
+ [value(0)] uint32 unknown1;
+ [value(ndr_size_supplementalCredentialsSubBlob(&sub, ndr->flags))] uint32 __ndr_size;
+ [value(0)] uint32 unknown2;
+ [subcontext(0),subcontext_size(__ndr_size)] supplementalCredentialsSubBlob sub;
+ [value(0)] uint8 unknown3;
+ } supplementalCredentialsBlob;
+
+ typedef [public] struct {
+ [flag(STR_NOTERM|NDR_REMAINING)] string_array names;
+ } package_PackagesBlob;
+
+ typedef struct {
+ [value(2*strlen_m(string))] uint16 length;
+ [value(2*strlen_m(string))] uint16 size;
+ [relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string;
+ } package_PrimaryKerberosString;
+
+ typedef struct {
+ [value(0)] uint16 reserved1;
+ [value(0)] uint16 reserved2;
+ [value(0)] uint32 reserved3;
+ uint32 keytype;
+ [value((value?value->length:0))] uint32 value_len;
+ [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
+ } package_PrimaryKerberosKey3;
+
+ typedef struct {
+ uint16 num_keys;
+ uint16 num_old_keys;
+ package_PrimaryKerberosString salt;
+ package_PrimaryKerberosKey3 keys[num_keys];
+ package_PrimaryKerberosKey3 old_keys[num_old_keys];
+ [value(0)] uint32 padding1;
+ [value(0)] uint32 padding2;
+ [value(0)] uint32 padding3;
+ [value(0)] uint32 padding4;
+ [value(0)] uint32 padding5;
+ } package_PrimaryKerberosCtr3;
+
+ typedef struct {
+ [value(0)] uint16 reserved1;
+ [value(0)] uint16 reserved2;
+ [value(0)] uint32 reserved3;
+ uint32 iteration_count;
+ uint32 keytype;
+ [value((value?value->length:0))] uint32 value_len;
+ [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
+ } package_PrimaryKerberosKey4;
+
+ typedef struct {
+ uint16 num_keys;
+ [value(0)] uint16 num_service_keys;
+ uint16 num_old_keys;
+ uint16 num_older_keys;
+ package_PrimaryKerberosString salt;
+ uint32 default_iteration_count;
+ package_PrimaryKerberosKey4 keys[num_keys];
+ package_PrimaryKerberosKey4 service_keys[num_service_keys];
+ package_PrimaryKerberosKey4 old_keys[num_old_keys];
+ package_PrimaryKerberosKey4 older_keys[num_older_keys];
+ } package_PrimaryKerberosCtr4;
+
+ typedef [nodiscriminant] union {
+ [case(3)] package_PrimaryKerberosCtr3 ctr3;
+ [case(4)] package_PrimaryKerberosCtr4 ctr4;
+ } package_PrimaryKerberosCtr;
+
+ typedef [public] struct {
+ uint16 version;
+ [value(0)] uint16 flags;
+ [switch_is(version)] package_PrimaryKerberosCtr ctr;
+ } package_PrimaryKerberosBlob;
+
+ typedef [public] struct {
+ [flag(NDR_REMAINING)] DATA_BLOB cleartext;
+ } package_PrimaryCLEARTEXTBlob;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint8 hash[16];
+ } package_PrimaryWDigestHash;
+
+ typedef [public] struct {
+ [value(0x31)] uint16 unknown1;
+ [value(0x01)] uint8 unknown2;
+ uint8 num_hashes;
+ [value(0)] uint32 unknown3;
+ [value(0)] udlong uuknown4;
+ package_PrimaryWDigestHash hashes[num_hashes];
+ } package_PrimaryWDigestBlob;
+
+ typedef [public] struct {
+ [flag(NDR_REMAINING)] DATA_BLOB gpg_blob;
+ } package_PrimarySambaGPGBlob;
+
+ /*
+ * Password hashes stored in a scheme compatible with
+ * OpenLDAP's userPassword attribute. The Package is named
+ * Primary:userPassword each calculated hash,
+ * which is typically caclulated via crypt(), the scheme is stored.
+ * The scheme name and the {scheme} format is re-used from OpenLDAP's
+ * use for userPassword to aid interopability when exported.
+ *
+ * The currently supported scheme so far is {CRYPT}, which may
+ * be specified multiple times if both CryptSHA256 ($5$) and
+ * CryptSHA512 ($6$) are in use.
+ *
+ * current_nt_hash is either the unicodePwd or the
+ * NTLM-Strong-NTOWF, to allow us to prove this password is
+ * a valid element.
+ */
+ typedef struct {
+ [value(2*strlen_m(scheme))] uint16 scheme_len;
+ [charset(UTF16)] uint8 scheme[scheme_len];
+ [value((value?value->length:0))] uint32 value_len;
+ [relative,subcontext(0),subcontext_size(value_len),
+ flag(NDR_REMAINING)] DATA_BLOB *value;
+ } package_PrimaryUserPasswordValue;
+
+ typedef [public] struct {
+ samr_Password current_nt_hash;
+ uint16 num_hashes;
+ package_PrimaryUserPasswordValue hashes[num_hashes];
+ } package_PrimaryUserPasswordBlob;
+
+ typedef struct {
+ [value(0)] uint32 size;
+ } AuthInfoNone;
+
+ typedef struct {
+ [value(16)] uint32 size;
+ samr_Password password;
+ } AuthInfoNT4Owf;
+
+ /*
+ * the secret value is encoded as UTF16 if it's a string
+ * but depending the AuthType, it might also be krb5 trusts have random bytes here, so converting to UTF16
+ * mayfail...
+ *
+ * TODO: We should try handle the case of a random buffer in all places
+ * we deal with cleartext passwords from windows
+ *
+ * so we don't use this:
+ *
+ * uint32 value_len;
+ * [charset(UTF16)] uint8 value[value_len];
+ */
+
+ typedef struct {
+ uint32 size;
+ uint8 password[size];
+ } AuthInfoClear;
+
+ typedef struct {
+ [value(4)] uint32 size;
+ uint32 version;
+ } AuthInfoVersion;
+
+ typedef [nodiscriminant] union {
+ [case(TRUST_AUTH_TYPE_NONE)] AuthInfoNone none;
+ [case(TRUST_AUTH_TYPE_NT4OWF)] AuthInfoNT4Owf nt4owf;
+ [case(TRUST_AUTH_TYPE_CLEAR)] AuthInfoClear clear;
+ [case(TRUST_AUTH_TYPE_VERSION)] AuthInfoVersion version;
+ } AuthInfo;
+
+ typedef [public] struct {
+ NTTIME LastUpdateTime;
+ lsa_TrustAuthType AuthType;
+ [switch_is(AuthType)] AuthInfo AuthInfo;
+ [flag(NDR_ALIGN4)] DATA_BLOB _pad;
+ } AuthenticationInformation;
+
+ /* count is not on the wire */
+ typedef [public,nopull,nopush,gensize] struct {
+ uint32 count;
+ AuthenticationInformation array[count];
+ } AuthenticationInformationArray;
+
+ /* we cannot use [relative] pointers here because Windows expects the
+ * previous_offset to match the total size of the struct in case
+ * the previous array is empty, see MS-LSAD 2.2.7.16 - gd */
+ typedef [public,gensize,nopush] struct {
+ uint32 count;
+ [value((count > 0) ? 12 : 0)] uint32 current_offset;
+ [value((count > 0) ? 12 + ndr_size_AuthenticationInformationArray(&current, ndr->flags) : 0)] uint32 previous_offset;
+ [subcontext(0),subcontext_size((previous_offset)-(current_offset))] AuthenticationInformationArray current;
+ [subcontext(0)] [flag(NDR_REMAINING)] AuthenticationInformationArray previous;
+ } trustAuthInOutBlob;
+
+ typedef [public,nopull] struct {
+ uint8 confounder[512];
+ [subcontext(0),subcontext_size(outgoing_size)] trustAuthInOutBlob outgoing;
+ [subcontext(0),subcontext_size(incoming_size)] trustAuthInOutBlob incoming;
+ [value(ndr_size_trustAuthInOutBlob(&outgoing, ndr->flags))] uint32 outgoing_size;
+ [value(ndr_size_trustAuthInOutBlob(&incoming, ndr->flags))] uint32 incoming_size;
+ } trustDomainPasswords;
+
+ typedef [public] struct {
+ uint32 marker;
+ DATA_BLOB data;
+ } DsCompressedChunk;
+
+ typedef struct {
+ uint16 __size;
+ [size_is(__size),charset(DOS)] uint8 *string;
+ } ExtendedErrorAString;
+
+ typedef struct {
+ uint16 __size;
+ [size_is(__size),charset(UTF16)] uint16 *string;
+ } ExtendedErrorUString;
+
+ typedef struct {
+ uint16 length;
+ [size_is(length)] uint8 *data;
+ } ExtendedErrorBlob;
+
+ typedef enum {
+ EXTENDED_ERROR_COMPUTER_NAME_PRESENT = 1,
+ EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT= 2
+ } ExtendedErrorComputerNamePresent;
+
+ typedef [switch_type(ExtendedErrorComputerNamePresent)] union {
+ [case(EXTENDED_ERROR_COMPUTER_NAME_PRESENT)] ExtendedErrorUString name;
+ [case(EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT)];
+ } ExtendedErrorComputerNameU;
+
+ typedef struct {
+ ExtendedErrorComputerNamePresent present;
+ [switch_is(present)] ExtendedErrorComputerNameU n;
+ } ExtendedErrorComputerName;
+
+ typedef enum {
+ EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING = 1,
+ EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING = 2,
+ EXTENDED_ERROR_PARAM_TYPE_UINT32 = 3,
+ EXTENDED_ERROR_PARAM_TYPE_UINT16 = 4,
+ EXTENDED_ERROR_PARAM_TYPE_UINT64 = 5,
+ EXTENDED_ERROR_PARAM_TYPE_NONE = 6,
+ EXTENDED_ERROR_PARAM_TYPE_BLOB = 7
+ } ExtendedErrorParamType;
+
+ typedef [switch_type(ExtendedErrorParamType)] union {
+ [case(EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING)] ExtendedErrorAString a_string;
+ [case(EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING)] ExtendedErrorUString u_string;
+ [case(EXTENDED_ERROR_PARAM_TYPE_UINT32)] uint32 uint32;
+ [case(EXTENDED_ERROR_PARAM_TYPE_UINT16)] uint16 uint16;
+ [case(EXTENDED_ERROR_PARAM_TYPE_UINT64)] hyper uint64;
+ [case(EXTENDED_ERROR_PARAM_TYPE_NONE)];
+ [case(EXTENDED_ERROR_PARAM_TYPE_BLOB)] ExtendedErrorBlob blob;
+ } ExtendedErrorParamU;
+
+ typedef struct {
+ ExtendedErrorParamType type;
+ [switch_is(type)] ExtendedErrorParamU p;
+ } ExtendedErrorParam;
+
+ typedef [public] struct {
+ [max_recursion(20000)] ExtendedErrorInfo *next;
+ ExtendedErrorComputerName computer_name;
+ hyper pid;
+ NTTIME time;
+ uint32 generating_component;
+ WERROR status;
+ uint16 detection_location;
+ uint16 flags;
+ uint16 num_params;
+ [size_is(num_params)] ExtendedErrorParam params[];
+ } ExtendedErrorInfo;
+
+ typedef struct {
+ [unique] ExtendedErrorInfo *info;
+ } ExtendedErrorInfoPtr;
+
+ /* MS-ADTS 7.1.6.9.3 msDS-TrustForestTrustInfo Attribute */
+
+ typedef struct {
+ [value(strlen_m(string))] uint32 size;
+ [charset(UTF8)] uint8 string[size];
+ } ForestTrustString;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+ [subcontext(0),subcontext_size(sid_size)] dom_sid sid;
+ ForestTrustString dns_name;
+ ForestTrustString netbios_name;
+ } ForestTrustDataDomainInfo;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ uint32 size;
+ uint8 data[size];
+ } ForestTrustDataBinaryData;
+
+ typedef [nodiscriminant] union {
+ [case(FOREST_TRUST_TOP_LEVEL_NAME)] ForestTrustString name;
+ [case(FOREST_TRUST_TOP_LEVEL_NAME_EX)] ForestTrustString name;
+ [case(FOREST_TRUST_DOMAIN_INFO)] ForestTrustDataDomainInfo info;
+ [default] ForestTrustDataBinaryData data;
+ } ForestTrustData;
+
+ /* same as lsa_ForestTrustRecordType, but only 8 bit */
+ typedef [enum8bit] enum {
+ FOREST_TRUST_TOP_LEVEL_NAME = LSA_FOREST_TRUST_TOP_LEVEL_NAME,
+ FOREST_TRUST_TOP_LEVEL_NAME_EX = LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX,
+ FOREST_TRUST_DOMAIN_INFO = LSA_FOREST_TRUST_DOMAIN_INFO
+ } ForestTrustInfoRecordType;
+
+ /* meaning of flags depends on record type and values are
+ the same as in lsa.idl, see collision record types */
+ typedef [public,gensize,flag(NDR_NOALIGN)] struct {
+ lsa_ForestTrustRecordFlags flags;
+ NTTIME timestamp;
+ ForestTrustInfoRecordType type;
+ [switch_is(type)] ForestTrustData data;
+ } ForestTrustInfoRecord;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ [value(ndr_size_ForestTrustInfoRecord(&record, ndr->flags))] uint32 record_size;
+ ForestTrustInfoRecord record;
+ } ForestTrustInfoRecordArmor;
+
+ typedef [public,flag(NDR_NOALIGN)] struct {
+ uint32 version;
+ uint32 count;
+ ForestTrustInfoRecordArmor records[count];
+ } ForestTrustInfo;
+
+ typedef enum {
+ ENC_SECRET_AES_128_AEAD = 1
+ } EncryptedSecretAlgorithm;
+
+ const uint32 ENCRYPTED_SECRET_MAGIC_VALUE = 0xCA5CADED;
+
+ typedef [public] struct {
+ DATA_BLOB cleartext;
+ } PlaintextSecret;
+
+ /* The AEAD routines uses this as the additional authenticated data */
+ typedef [public] struct {
+ uint32 magic;
+ uint32 version;
+ uint32 algorithm;
+ uint32 flags;
+ } EncryptedSecretHeader;
+
+ typedef [public] struct {
+ /*
+ * The iv is before the header to ensure that the first bytes of
+ * the encrypted values are not predictable.
+ * We do this so that if the decryption gets disabled, we don't
+ * end up with predictable unicodePasswords.
+ */
+ DATA_BLOB iv;
+ EncryptedSecretHeader header;
+ [flag(NDR_REMAINING)] DATA_BLOB encrypted;
+ } EncryptedSecret;
+}
diff --git a/librpc/idl/drsuapi.idl b/librpc/idl/drsuapi.idl
new file mode 100644
index 0000000..59a795a
--- /dev/null
+++ b/librpc/idl/drsuapi.idl
@@ -0,0 +1,1915 @@
+#include "idl_types.h"
+
+import "security.idl", "misc.idl", "lsa.idl", "samr.idl";
+
+[
+ uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"),
+ version(4.0),
+ endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"),
+ authservice("ldap"),
+ helpstring("Active Directory Replication"),
+ helper("../librpc/ndr/ndr_drsuapi.h"),
+ pointer_default(unique)
+]
+interface drsuapi
+{
+ typedef bitmap security_GroupAttrs security_GroupAttrs;
+
+ /* see MS-DRSR section 5.39 */
+ typedef [public,bitmap32bit] bitmap {
+ DRSUAPI_DRS_ASYNC_OP = 0x00000001,
+ DRSUAPI_DRS_GETCHG_CHECK = 0x00000002,
+ DRSUAPI_DRS_UPDATE_NOTIFICATION = 0x00000002,
+ DRSUAPI_DRS_ADD_REF = 0x00000004,
+ DRSUAPI_DRS_SYNC_ALL = 0x00000008,
+ DRSUAPI_DRS_DEL_REF = 0x00000008,
+ DRSUAPI_DRS_WRIT_REP = 0x00000010,
+ DRSUAPI_DRS_INIT_SYNC = 0x00000020,
+ DRSUAPI_DRS_PER_SYNC = 0x00000040,
+ DRSUAPI_DRS_MAIL_REP = 0x00000080,
+ DRSUAPI_DRS_ASYNC_REP = 0x00000100,
+ DRSUAPI_DRS_IGNORE_ERROR = 0x00000100,
+ DRSUAPI_DRS_TWOWAY_SYNC = 0x00000200,
+ DRSUAPI_DRS_CRITICAL_ONLY = 0x00000400,
+ DRSUAPI_DRS_GET_ANC = 0x00000800,
+ DRSUAPI_DRS_GET_NC_SIZE = 0x00001000,
+ DRSUAPI_DRS_LOCAL_ONLY = 0x00001000,
+ DRSUAPI_DRS_NONGC_RO_REP = 0x00002000,
+ DRSUAPI_DRS_SYNC_BYNAME = 0x00004000,
+ DRSUAPI_DRS_REF_OK = 0x00004000,
+ DRSUAPI_DRS_FULL_SYNC_NOW = 0x00008000,
+ DRSUAPI_DRS_NO_SOURCE = 0x00008000,
+ DRSUAPI_DRS_FULL_SYNC_IN_PROGRESS = 0x00010000,
+ DRSUAPI_DRS_FULL_SYNC_PACKET = 0x00020000,
+ DRSUAPI_DRS_SYNC_REQUEUE = 0x00040000,
+ DRSUAPI_DRS_SYNC_URGENT = 0x00080000,
+ DRSUAPI_DRS_REF_GCSPN = 0x00100000,
+ DRSUAPI_DRS_NO_DISCARD = 0x00100000,
+ DRSUAPI_DRS_NEVER_SYNCED = 0x00200000,
+ DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING = 0x00400000,
+ DRSUAPI_DRS_INIT_SYNC_NOW = 0x00800000,
+ DRSUAPI_DRS_PREEMPTED = 0x01000000,
+ DRSUAPI_DRS_SYNC_FORCED = 0x02000000,
+ DRSUAPI_DRS_DISABLE_AUTO_SYNC = 0x04000000,
+ DRSUAPI_DRS_DISABLE_PERIODIC_SYNC = 0x08000000,
+ DRSUAPI_DRS_USE_COMPRESSION = 0x10000000,
+ DRSUAPI_DRS_NEVER_NOTIFY = 0x20000000,
+ DRSUAPI_DRS_SYNC_PAS = 0x40000000,
+ DRSUAPI_DRS_GET_ALL_GROUP_MEMBERSHIP = 0x80000000
+ } drsuapi_DrsOptions;
+
+ typedef [public,bitmap32bit] bitmap {
+ DRSUAPI_DRS_GET_TGT = 0x00000001
+ } drsuapi_DrsMoreOptions;
+
+ /* see DRS_MSG_REPMOD_V1 */
+ typedef [public,bitmap32bit] bitmap {
+ DRSUAPI_DRS_UPDATE_FLAGS = 0x00000001,
+ DRSUAPI_DRS_UPDATE_ADDRESS = 0x00000002,
+ DRSUAPI_DRS_UPDATE_SCHEDULE = 0x00000004
+ } drsuapi_DrsUpdate;
+
+ /*****************/
+ /* Function 0x00 drsuapi_DsBind() */
+
+ /* MS-DRSR 5.39 DRS_EXTENSIONS_INT */
+ typedef [bitmap32bit] bitmap {
+ DRSUAPI_SUPPORTED_EXTENSION_BASE = 0x00000001,
+ DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION = 0x00000002,
+ DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI = 0x00000004,
+ DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2 = 0x00000008,
+ DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS = 0x00000010,
+ DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1 = 0x00000020,
+ DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION = 0x00000040,
+ DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY = 0x00000080,
+ DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE = 0x00000100,
+ DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2 = 0x00000200,
+ DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION = 0x00000400,
+ DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2 = 0x00000800,
+ DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000,
+ DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND = 0x00002000,
+ DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO = 0x00004000,
+ DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION = 0x00008000,
+ DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01 = 0x00010000,
+ DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP = 0x00020000,
+ DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY = 0x00040000,
+ DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3 = 0x00080000,
+ DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V5 = 0x00100000,
+ DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2 = 0x00200000,
+ DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6 = 0x00400000,
+ DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS = 0x00800000,
+ DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8 = 0x01000000,
+ DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5 = 0x02000000,
+ DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6 = 0x04000000,
+ /*
+ * the following 3 have the same value
+ * repadmin.exe /bind says that
+ */
+ DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3 = 0x08000000,
+ DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7 = 0x08000000,
+ DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT = 0x08000000,
+ DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS = 0x10000000,
+ DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10 = 0x20000000,
+ DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2 = 0x40000000,
+ DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3 = 0x80000000
+ } drsuapi_SupportedExtensions;
+
+ typedef [bitmap32bit] bitmap {
+ DRSUAPI_SUPPORTED_EXTENSION_ADAM = 0x00000001,
+ DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2 = 0x00000002,
+ DRSUAPI_SUPPORTED_EXTENSION_RECYCLE_BIN = 0x00000004
+ } drsuapi_SupportedExtensionsExt;
+
+ /* this is used by w2k */
+ typedef [public] struct {
+ drsuapi_SupportedExtensions supported_extensions;
+ GUID site_guid;
+ uint32 pid;
+ } drsuapi_DsBindInfo24;
+
+ /* this is used by w2k3 */
+ typedef [public] struct {
+ drsuapi_SupportedExtensions supported_extensions;
+ GUID site_guid;
+ uint32 pid;
+ uint32 repl_epoch;
+ } drsuapi_DsBindInfo28;
+
+ typedef [public] struct {
+ drsuapi_SupportedExtensions supported_extensions;
+ GUID site_guid;
+ uint32 pid;
+ uint32 repl_epoch;
+ drsuapi_SupportedExtensionsExt supported_extensions_ext;
+ } drsuapi_DsBindInfo32;
+
+ /* this is used by w2k8 */
+ typedef [public] struct {
+ drsuapi_SupportedExtensions supported_extensions;
+ GUID site_guid;
+ uint32 pid;
+ uint32 repl_epoch;
+ drsuapi_SupportedExtensionsExt supported_extensions_ext;
+ GUID config_dn_guid;
+ } drsuapi_DsBindInfo48;
+
+ /* this is used by w2k12 R2 [MS-DRSR] Section 5.39 */
+ typedef [public] struct {
+ drsuapi_SupportedExtensions supported_extensions;
+ GUID site_guid;
+ uint32 pid;
+ uint32 repl_epoch;
+ drsuapi_SupportedExtensionsExt supported_extensions_ext;
+ GUID config_dn_guid;
+ drsuapi_SupportedExtensionsExt supported_capabilities_ext;
+ } drsuapi_DsBindInfo52;
+
+ typedef [public] struct {
+ [flag(NDR_REMAINING)] DATA_BLOB info;
+ } drsuapi_DsBindInfoFallBack;
+
+ typedef [nopull, nopush, noprint] [nodiscriminant] union {
+ [case(24)][subcontext(0), subcontext_size(24)] drsuapi_DsBindInfo24 info24;
+ [case(28)][subcontext(0), subcontext_size(28)] drsuapi_DsBindInfo28 info28;
+ [case(32)][subcontext(0), subcontext_size(32)] drsuapi_DsBindInfo32 info32;
+ [case(48)][subcontext(0), subcontext_size(48)] drsuapi_DsBindInfo48 info48;
+ [case(52)][subcontext(0), subcontext_size(52)] drsuapi_DsBindInfo52 info52;
+ /*
+ * The size for the defaut case is a bit arbitrary it in fact the value
+ * of the switch but we can't reference it.
+ * As we hand(un-)marshall this structure it has 0 impact and makes
+ * pidl happy for wireshark too
+ */
+ [default][subcontext(0), subcontext_size(48)] drsuapi_DsBindInfoFallBack Fallback;
+ } drsuapi_DsBindInfo;
+
+ /* the drsuapi_DsBindInfoCtr was this before
+ * typedef [flag(NDR_PAHEX)] struct {
+ * [range(1,10000)] uint32 length;
+ * [size_is(length)] uint8 data[];
+ * } drsuapi_DsBindInfo;
+ *
+ * but we don't want the caller to manually decode this blob,
+ * so we're doing it here
+ */
+
+ /*
+ * MS-DRSR.pdf gives the following definition
+ typedef struct {
+ [range(1,10000)] DWORD cb;
+ [size_is(cb)] BYTE rgb[];
+ } DRS_EXTENSIONS;
+
+ But we use a subcontext which has a slighly different signification on how
+ data are laid out.
+ With the MS-DRSR definition we will have
+ size_is_cb cv rgb_array
+ with size_is_cb being a uint3264 and cv being a uint32
+
+ We used to have
+ typedef struct {
+ [range(1,10000)] uint32 length;
+ [switch_is(length)] drsuapi_DsBindInfo info;
+ } drsuapi_DsBindInfoCtr;
+
+ typedef [nodiscriminant] union {
+ [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
+ [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
+ [case(48)][subcontext(4)] drsuapi_DsBindInfo48 info48;
+ [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack;
+ } drsuapi_DsBindInfo;
+
+ With this definition data is laid out this way:
+ length subcontext_size drsuapi_DsBindInfoxx
+ with length being a uint32 and subcontext_size being a uint3264
+
+ It has clearly an impact on the way things are aligned when using NDR64
+ */
+ typedef [flag(NDR_NOALIGN)] struct {
+ [range(1,10000)] uint3264 length;
+ [value(length)] uint32 __ndr_length;
+ [switch_is(length)] drsuapi_DsBindInfo info;
+ } drsuapi_DsBindInfoCtr;
+
+ /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
+ *
+ * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
+ */
+ const char *DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";
+ /*
+ * this magic guid are needed to fetch the whole tree with drsuapi_DsGetNCChanges()
+ * as administrator and this values are also used in the destination_dsa_guid field
+ * of drsuapi_DsGetNCChangesReq5/8 and the source_dsa_guid is zero.
+ */
+ const char *DRSUAPI_DS_BIND_GUID_W2K = "6abec3d1-3054-41c8-a362-5a0c5b7d5d71";
+ const char *DRSUAPI_DS_BIND_GUID_W2K3 = "6afab99c-6e26-464a-975f-f58f105218bc";
+
+ [public] WERROR drsuapi_DsBind(
+ [in,unique] GUID *bind_guid,
+ [in,out,unique] drsuapi_DsBindInfoCtr *bind_info,
+ [out] policy_handle *bind_handle
+ );
+
+ /*****************/
+ /* Function 0x01 */
+ WERROR drsuapi_DsUnbind(
+ [in,out] policy_handle *bind_handle
+ );
+
+ /*****************/
+ /* Function 0x02 */
+ typedef [public,gensize] struct {
+ [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size;
+ [value(ndr_size_dom_sid28(&sid, ndr->flags))] uint32 __ndr_size_sid;
+ GUID guid;
+ dom_sid28 sid;
+ [value(strlen_m(dn))] uint32 __ndr_size_dn;
+ [charset(UTF16),size_is(__ndr_size_dn+1)] uint16 dn[];
+ } drsuapi_DsReplicaObjectIdentifier;
+
+ typedef struct {
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ GUID source_dsa_guid;
+ [charset(DOS),string] char *source_dsa_dns; /* Source DSA dns_name in <guid>._msdcs.<domain_dns> form */
+ drsuapi_DrsOptions options;
+ } drsuapi_DsReplicaSyncRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsReplicaSyncRequest1 req1;
+ } drsuapi_DsReplicaSyncRequest;
+
+ WERROR drsuapi_DsReplicaSync(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,switch_is(level)] drsuapi_DsReplicaSyncRequest *req
+ );
+
+ /*****************/
+ /* Function 0x03 */
+ typedef [public] struct {
+ hyper tmp_highest_usn; /* updated after each object update */
+ hyper reserved_usn;
+ hyper highest_usn; /* updated after a full replication cycle */
+ } drsuapi_DsReplicaHighWaterMark;
+
+ typedef [public] struct {
+ GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
+ hyper highest_usn; /* updated after a full replication cycle */
+ } drsuapi_DsReplicaCursor;
+
+ typedef struct {
+ [value(1)] uint32 version;
+ [value(0)] uint32 reserved1;
+ [range(0,0x100000)] uint32 count;
+ [value(0)] uint32 reserved2;
+ [size_is(count)] drsuapi_DsReplicaCursor cursors[];
+ } drsuapi_DsReplicaCursorCtrEx;
+
+ typedef [flag(NDR_PAHEX),v1_enum] enum {
+ DRSUAPI_EXOP_NONE = 0x00000000,
+ DRSUAPI_EXOP_FSMO_REQ_ROLE = 0x00000001,
+ DRSUAPI_EXOP_FSMO_RID_ALLOC = 0x00000002,
+ DRSUAPI_EXOP_FSMO_RID_REQ_ROLE = 0x00000003,
+ DRSUAPI_EXOP_FSMO_REQ_PDC = 0x00000004,
+ DRSUAPI_EXOP_FSMO_ABANDON_ROLE = 0x00000005,
+ DRSUAPI_EXOP_REPL_OBJ = 0x00000006,
+ DRSUAPI_EXOP_REPL_SECRET = 0x00000007
+ } drsuapi_DsExtendedOperation;
+
+ typedef [flag(NDR_PAHEX),v1_enum] enum {
+ DRSUAPI_EXOP_ERR_NONE = 0x00000000,
+ DRSUAPI_EXOP_ERR_SUCCESS = 0x00000001,
+ DRSUAPI_EXOP_ERR_UNKNOWN_OP = 0x00000002,
+ DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER = 0x00000003,
+ DRSUAPI_EXOP_ERR_UPDATE_ERR = 0x00000004,
+ DRSUAPI_EXOP_ERR_EXCEPTION = 0x00000005,
+ DRSUAPI_EXOP_ERR_UNKNOWN_CALLER = 0x00000006,
+ DRSUAPI_EXOP_ERR_RID_ALLOC = 0x00000007,
+ DRSUAPI_EXOP_ERR_FSMO_OWNER_DELETED = 0x00000008,
+ DRSUAPI_EXOP_ERR_FMSO_PENDING_OP = 0x00000009,
+ DRSUAPI_EXOP_ERR_MISMATCH = 0x0000000A,
+ DRSUAPI_EXOP_ERR_COULDNT_CONTACT = 0x0000000B,
+ DRSUAPI_EXOP_ERR_FSMO_REFUSING_ROLES = 0x0000000C,
+ DRSUAPI_EXOP_ERR_DIR_ERROR = 0x0000000D,
+ DRSUAPI_EXOP_ERR_FSMO_MISSING_SETTINGS = 0x0000000E,
+ DRSUAPI_EXOP_ERR_ACCESS_DENIED = 0x0000000F,
+ DRSUAPI_EXOP_ERR_PARAM_ERROR = 0x00000010
+ } drsuapi_DsExtendedError;
+
+ typedef struct {
+ GUID destination_dsa_guid;
+ GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ drsuapi_DsReplicaHighWaterMark highwatermark;
+ drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
+ drsuapi_DrsOptions replica_flags;
+ uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
+ uint32 max_ndr_size; /* w2k3 seems to ignore this */
+ drsuapi_DsExtendedOperation extended_op;
+ hyper fsmo_info;
+ } drsuapi_DsGetNCChangesRequest5;
+
+ /*
+ * In DRSUAPI all attributes with syntax 2.5.5.2
+ * are identified by uint32 values
+ *
+ * the following table shows the mapping used between the two representations
+ * e.g. - objectClass 'nTDSDSA' has governsID: 1.2.840.113556.1.5.7000.47
+ * and a UINT32-ID of '0x0017002F'.
+ * - so the OID 1.2.840.113556.1.5.7000.47 is splitted into a
+ * OID-prefix: 1.2.840.113556.1.5.7000
+ * and a value: 47 => 0x2F
+ * - the mapping table gives a UINT32-prefix: 0x00170000
+ * - and the UINT32-ID is 0x0017002F = 0x00170000 | 0x2F
+ *
+ * This prefix mapping table is replied in the drsuapi_DsReplicaOIDMapping_Ctr
+ * array. The following are the default mappings of w2k3
+ *
+ * OID-prefix => UINT32-Id prefix
+ *
+ * 2.5.4.* => 0x00000000 (standard attributes RFC2256 core.schema)
+ * 2.5.6.* => 0x00010000 (standard object classes RFC2256 core.schema)
+ * 1.2.840.113556.1.2.* => 0x00020000
+ * 1.2.840.113556.1.3.* => 0x00030000
+ * 2.5.5.* => 0x00080000 (attributeSyntax OID's)
+ * 1.2.840.113556.1.4.* => 0x00090000
+ * 1.2.840.113556.1.5.* => 0x000A0000
+ * 2.16.840.1.113730.3.* => 0x00140000
+ * 0.9.2342.19200300.100.1.* => 0x00150000
+ * 2.16.840.1.113730.3.1.* => 0x00160000
+ * 1.2.840.113556.1.5.7000.* => 0x00170000
+ * 2.5.21.* => 0x00180000 (attrs for SubSchema)
+ * 2.5.18.* => 0x00190000 (createTimeStamp,modifyTimeStamp, SubSchema)
+ * 2.5.20.* => 0x001A0000
+ * 1.3.6.1.4.1.1466.101.119.* => 0x001B0000 (dynamicObject, entryTTL)
+ * 2.16.840.1.113730.3.2.* => 0x001C0000
+ * 1.3.6.1.4.1.250.1.* => 0x001D0000
+ * 1.2.840.113549.1.9.* => 0x001E0000 (unstructuredAddress,unstructuredName)
+ * 0.9.2342.19200300.100.4.* => 0x001F0000
+ *
+ * Here's a list of used 'attributeSyntax' OID's
+ *
+ * 2.5.5.1 => Object(DS-DN) string
+ * struct drsuapi_DsObjectIdentifier3
+ *
+ * 2.5.5.2 => OID-string
+ * => all values are represented as uint32 values in drsuapi
+ * => governsID, attributeID and attributeSyntax returned as OID-Strings in LDAP
+ * => mayContain, mustContain and all other attributes with 2.5.5.2 syntax
+ * are returned as attribute names
+ *
+ * 2.5.5.4 => String(Teletex) case-insensitive string with teletex charset
+ *
+ * 2.5.5.5 => String(IA5) case-sensitive string
+ *
+ * 2.5.5.6 => String(Numeric)
+ * => eg. internationalISDNNumber
+ *
+ * 2.5.5.7 => Object(DN-Binary) B:<byte count>:<bytes>:<object DN>
+ * => e.g. wellKnownObjects
+ *
+ * 2.5.5.8 => BOOL
+ *
+ * 2.5.5.9 => int32
+ *
+ * 2.5.5.10 => DATA_BLOB
+ * => struct GUID
+ *
+ * 2.5.5.11 => LDAP timestring
+ * => NTTIME_1sec
+ *
+ * 2.5.5.12 => String(Unicode) case-insensitive string
+ * => 'standard strings'
+ *
+ * 2.5.5.13 => Object(Presentation-Address) string
+ * => used in objectClass applicationEntity
+ *
+ * 2.5.5.14 => Object(DN-String) S:<char count>:<string>:<object DN>
+ * => not used
+ *
+ * 2.5.5.15 => ntSecurityDescriptor
+ *
+ * 2.5.5.16 => int64
+ *
+ * 2.5.5.17 => dom_sid
+ */
+ typedef [noprint] struct {
+ [range(0,10000)] uint32 length;
+ [size_is(length)] uint8 *binary_oid; /* partial-binary-OID encoded with asn1_write_partial_OID_String() */
+ } drsuapi_DsReplicaOID;
+
+ typedef struct {
+ uint32 id_prefix;
+ drsuapi_DsReplicaOID oid;
+ } drsuapi_DsReplicaOIDMapping;
+
+ typedef [public] struct {
+ [range(0,0x100000)] uint32 num_mappings;
+ [size_is(num_mappings)] drsuapi_DsReplicaOIDMapping *mappings;
+ } drsuapi_DsReplicaOIDMapping_Ctr;
+
+ typedef [flag(NDR_PAHEX),v1_enum] enum {
+ DRSUAPI_OBJECTCLASS_top = 0x00010000,
+ DRSUAPI_OBJECTCLASS_classSchema = 0x0003000d,
+ DRSUAPI_OBJECTCLASS_attributeSchema = 0x0003000e
+ } drsuapi_DsObjectClassId;
+
+ typedef [flag(NDR_PAHEX),v1_enum,public] enum {
+ DRSUAPI_ATTID_objectClass = 0x00000000,
+ DRSUAPI_ATTID_cn = 0x00000003,
+ DRSUAPI_ATTID_ou = 0x0000000b,
+ DRSUAPI_ATTID_description = 0x0000000d,
+ DRSUAPI_ATTID_member = 0x0000001f,
+ DRSUAPI_ATTID_distinguishedName = 0x00000031,
+ DRSUAPI_ATTID_instanceType = 0x00020001,
+ DRSUAPI_ATTID_whenCreated = 0x00020002,
+ DRSUAPI_ATTID_possSuperiors = 0x00020008,
+ DRSUAPI_ATTID_displayName = 0x0002000d,
+ DRSUAPI_ATTID_hasMasterNCs = 0x0002000e,
+ DRSUAPI_ATTID_nCName = 0x00020010,
+ DRSUAPI_ATTID_subClassOf = 0x00020015,
+ DRSUAPI_ATTID_governsID = 0x00020016,
+ DRSUAPI_ATTID_mustContain = 0x00020018,
+ DRSUAPI_ATTID_mayContain = 0x00020019,
+ DRSUAPI_ATTID_rDNAttId = 0x0002001A,
+ DRSUAPI_ATTID_attributeID = 0x0002001e,
+ DRSUAPI_ATTID_attributeSyntax = 0x00020020,
+ DRSUAPI_ATTID_isSingleValued = 0x00020021,
+ DRSUAPI_ATTID_rangeLower = 0x00020022,
+ DRSUAPI_ATTID_rangeUpper = 0x00020023,
+ DRSUAPI_ATTID_dMDLocation = 0x00020024,
+ DRSUAPI_ATTID_isDeleted = 0x00020030,
+ DRSUAPI_ATTID_objectVersion = 0x0002004c,
+ DRSUAPI_ATTID_invocationId = 0x00020073,
+ DRSUAPI_ATTID_showInAdvancedViewOnly = 0x000200a9,
+ DRSUAPI_ATTID_adminDisplayName = 0x000200c2,
+ DRSUAPI_ATTID_adminDescription = 0x000200e2,
+ DRSUAPI_ATTID_oMSyntax = 0x000200e7,
+ DRSUAPI_ATTID_ntSecurityDescriptor = 0x00020119,
+ DRSUAPI_ATTID_searchFlags = 0x0002014e,
+ DRSUAPI_ATTID_auxiliaryClass = 0x0002015f,
+ DRSUAPI_ATTID_lDAPDisplayName = 0x000201cc,
+ DRSUAPI_ATTID_name = 0x00090001,
+ DRSUAPI_ATTID_objectGUID = 0x00090002,
+ DRSUAPI_ATTID_replPropertyMetaData = 0x00090003,
+ DRSUAPI_ATTID_userAccountControl = 0x00090008,
+ DRSUAPI_ATTID_badPwdCount = 0x0009000c,
+ DRSUAPI_ATTID_codePage = 0x00090010,
+ DRSUAPI_ATTID_countryCode = 0x00090019,
+ DRSUAPI_ATTID_currentValue = 0x0009001b,
+ DRSUAPI_ATTID_homeDirectory = 0x0009002c,
+ DRSUAPI_ATTID_homeDrive = 0x0009002d,
+ DRSUAPI_ATTID_lastLogoff = 0x00090033,
+ DRSUAPI_ATTID_lastLogon = 0x00090034,
+ DRSUAPI_ATTID_dBCSPwd = 0x00090037,/* lmPwdHash */
+ DRSUAPI_ATTID_scriptPath = 0x0009003e,
+ DRSUAPI_ATTID_logonHours = 0x00090040,
+ DRSUAPI_ATTID_userWorkstations = 0x00090056,
+ DRSUAPI_ATTID_unicodePwd = 0x0009005a,/* ntPwdHash */
+ DRSUAPI_ATTID_ntPwdHistory = 0x0009005e,
+ DRSUAPI_ATTID_pwdLastSet = 0x00090060,
+ DRSUAPI_ATTID_primaryGroupID = 0x00090062,
+ DRSUAPI_ATTID_priorValue = 0x00090064,
+ DRSUAPI_ATTID_supplementalCredentials = 0x0009007d,
+ DRSUAPI_ATTID_trustAuthIncoming = 0x00090081,
+ DRSUAPI_ATTID_trustDirection = 0x00090084,
+ DRSUAPI_ATTID_trustPartner = 0x00090085,
+ DRSUAPI_ATTID_trustPosixOffset = 0x00090086,
+ DRSUAPI_ATTID_trustAuthOutgoing = 0x00090087,
+ DRSUAPI_ATTID_trustType = 0x00090088,
+ DRSUAPI_ATTID_userParameters = 0x0009008a,
+ DRSUAPI_ATTID_profilePath = 0x0009008b,
+ DRSUAPI_ATTID_operatorCount = 0x00090090,
+ DRSUAPI_ATTID_objectSid = 0x00090092,
+ DRSUAPI_ATTID_schemaIDGUID = 0x00090094,
+ DRSUAPI_ATTID_adminCount = 0x00090096,
+ DRSUAPI_ATTID_comment = 0x0009009C,/* User-Comment */
+ DRSUAPI_ATTID_accountExpires = 0x0009009f,
+ DRSUAPI_ATTID_lmPwdHistory = 0x000900a0,
+ DRSUAPI_ATTID_logonCount = 0x000900a9,
+ DRSUAPI_ATTID_systemPossSuperiors = 0x000900c3,
+ DRSUAPI_ATTID_systemMayContain = 0x000900c4,
+ DRSUAPI_ATTID_systemMustContain = 0x000900c5,
+ DRSUAPI_ATTID_systemAuxiliaryClass = 0x000900c6,
+ DRSUAPI_ATTID_sAMAccountName = 0x000900dd,
+ DRSUAPI_ATTID_sAMAccountType = 0x0009012e,
+ DRSUAPI_ATTID_options = 0x00090133,
+ DRSUAPI_ATTID_fSMORoleOwner = 0x00090171,
+ DRSUAPI_ATTID_systemFlags = 0x00090177,
+ DRSUAPI_ATTID_trustAttributes = 0x000901d6,
+ DRSUAPI_ATTID_trustParent = 0x000901d7,
+ DRSUAPI_ATTID_flatName = 0x000901ff,
+ DRSUAPI_ATTID_serverReference = 0x00090203,
+ DRSUAPI_ATTID_serverReferenceBL = 0x00090204,
+ DRSUAPI_ATTID_nonSecurityMember = 0x00090212,
+ DRSUAPI_ATTID_initialAuthIncoming = 0x0009021b,
+ DRSUAPI_ATTID_initialAuthOutgoing = 0x0009021c,
+ DRSUAPI_ATTID_wellKnownObjects = 0x0009026a,
+ DRSUAPI_ATTID_dNSHostName = 0x0009026b,
+ DRSUAPI_ATTID_isMemberOfPartialAttributeSet = 0x0009027f,
+ DRSUAPI_ATTID_managedBy = 0x0009028d,
+ DRSUAPI_ATTID_userPrincipalName = 0x00090290,
+ DRSUAPI_ATTID_groupType = 0x000902ee,
+ DRSUAPI_ATTID_servicePrincipalName = 0x00090303,
+ DRSUAPI_ATTID_lastKnownParent = 0x0009030d,
+ DRSUAPI_ATTID_objectCategory = 0x0009030e,
+ DRSUAPI_ATTID_gPLink = 0x0009037b,
+ DRSUAPI_ATTID_transportAddressAttribute = 0x0009037f,
+ DRSUAPI_ATTID_schemaInfo = 0x0009054e,
+ DRSUAPI_ATTID_msDS_Behavior_Version = 0x000905b3,
+ DRSUAPI_ATTID_msDS_TrustForestTrustInfo = 0x000906a6,
+ DRSUAPI_ATTID_msDS_KeyVersionNumber = 0x000906f6,
+ DRSUAPI_ATTID_msDS_NonMembers = 0x00090701,
+ DRSUAPI_ATTID_msDS_MembersForAzRole = 0x0009070e,
+ DRSUAPI_ATTID_msDS_HasDomainNCs = 0x0009071c,
+ DRSUAPI_ATTID_msDS_hasMasterNCs = 0x0009072c,
+ DRSUAPI_ATTID_msDS_NeverRevealGroup = 0x00090786,
+ DRSUAPI_ATTID_msDS_RevealOnDemandGroup = 0x00090788,
+ DRSUAPI_ATTID_msDS_SupportedEncryptionTypes = 0x000907ab,
+ DRSUAPI_ATTID_msDS_HostServiceAccount = 0x00090808,
+ DRSUAPI_ATTID_isRecycled = 0x0009080a,
+
+ DRSUAPI_ATTID_INVALID = 0xFFFFFFFF
+ } drsuapi_DsAttributeId;
+
+ typedef struct {
+ [value(1)] uint32 version;
+ [value(0)] uint32 reserved1;
+ [range(1,0x100000)] uint32 num_attids;
+ [size_is(num_attids)] drsuapi_DsAttributeId attids[];
+ } drsuapi_DsPartialAttributeSet;
+
+ typedef [public] struct {
+ GUID destination_dsa_guid;
+ GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ drsuapi_DsReplicaHighWaterMark highwatermark;
+ drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
+ drsuapi_DrsOptions replica_flags;
+ uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
+ uint32 max_ndr_size; /* w2k3 seems to ignore this */
+ drsuapi_DsExtendedOperation extended_op;
+ hyper fsmo_info;
+ drsuapi_DsPartialAttributeSet *partial_attribute_set;
+ drsuapi_DsPartialAttributeSet *partial_attribute_set_ex;
+ drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
+ } drsuapi_DsGetNCChangesRequest8;
+
+ typedef [public] struct {
+ GUID destination_dsa_guid;
+ GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ drsuapi_DsReplicaHighWaterMark highwatermark;
+ drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
+ drsuapi_DrsOptions replica_flags;
+ uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
+ uint32 max_ndr_size; /* w2k3 seems to ignore this */
+ drsuapi_DsExtendedOperation extended_op;
+ hyper fsmo_info;
+ drsuapi_DsPartialAttributeSet *partial_attribute_set;
+ drsuapi_DsPartialAttributeSet *partial_attribute_set_ex;
+ drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
+ drsuapi_DrsMoreOptions more_flags;
+ } drsuapi_DsGetNCChangesRequest10;
+
+ typedef [switch_type(uint32)] union {
+ [case(5)] drsuapi_DsGetNCChangesRequest5 req5;
+ [case(8)] drsuapi_DsGetNCChangesRequest8 req8;
+ [case(10)] drsuapi_DsGetNCChangesRequest10 req10;
+ } drsuapi_DsGetNCChangesRequest;
+
+ typedef [public] struct {
+ GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
+ hyper highest_usn; /* updated after a full replication cycle */
+ NTTIME last_sync_success;
+ } drsuapi_DsReplicaCursor2;
+
+ typedef struct {
+ [value(2)] uint32 version;
+ [value(0)] uint32 reserved1;
+ [range(0,0x100000)] uint32 count;
+ [value(0)] uint32 reserved2;
+ [size_is(count)] drsuapi_DsReplicaCursor2 cursors[];
+ } drsuapi_DsReplicaCursor2CtrEx;
+
+ /* Generic DATA_BLOB values */
+ typedef struct {
+ [range(0,26214400),value(ndr_size_DATA_BLOB(0,blob,0))] uint32 __ndr_size;
+ DATA_BLOB *blob;
+ } drsuapi_DsAttributeValue;
+
+ typedef struct {
+ [range(0,10485760)] uint32 num_values;
+ [size_is(num_values)] drsuapi_DsAttributeValue *values;
+ } drsuapi_DsAttributeValueCtr;
+
+ /* DN String values */
+ typedef [public,gensize] struct {
+ [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags))] uint32 __ndr_size;
+ [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid;
+ GUID guid;
+ dom_sid28 sid;
+ [value(strlen_m(dn))] uint32 __ndr_size_dn;
+ [charset(UTF16)] uint16 dn[__ndr_size_dn+1];
+ } drsuapi_DsReplicaObjectIdentifier3;
+
+ typedef [public] struct {
+ [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(r, ndr->flags))] uint32 __ndr_size;
+ [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid;
+ GUID guid;
+ dom_sid28 sid;
+ [value(strlen_m(dn))] uint32 __ndr_size_dn;
+ [charset(UTF16)] uint16 dn[__ndr_size_dn+1];
+ [value(binary.length + 4)] uint32 __ndr_size_binary;
+ [flag(NDR_REMAINING)] DATA_BLOB binary;
+ } drsuapi_DsReplicaObjectIdentifier3Binary;
+
+ typedef [public,noprint] struct {
+ drsuapi_DsAttributeId attid;
+ drsuapi_DsAttributeValueCtr value_ctr;
+ } drsuapi_DsReplicaAttribute;
+
+ typedef struct {
+ [range(0,1048576)] uint32 num_attributes;
+ [size_is(num_attributes)] drsuapi_DsReplicaAttribute *attributes;
+ } drsuapi_DsReplicaAttributeCtr;
+
+ typedef [public] bitmap {
+ DRSUAPI_DS_REPLICA_OBJECT_FROM_MASTER = 0x00000001,
+ DRSUAPI_DS_REPLICA_OBJECT_DYNAMIC = 0x00000002,
+ DRSUAPI_DS_REPLICA_OBJECT_REMOTE_MODIFY = 0x00010000
+ } drsuapi_DsReplicaObjectFlags;
+
+ typedef [public] struct {
+ drsuapi_DsReplicaObjectIdentifier *identifier;
+ drsuapi_DsReplicaObjectFlags flags;
+ drsuapi_DsReplicaAttributeCtr attribute_ctr;
+ } drsuapi_DsReplicaObject;
+
+ typedef struct {
+ uint32 version;
+ NTTIME_1sec originating_change_time;
+ GUID originating_invocation_id;
+ hyper originating_usn;
+ } drsuapi_DsReplicaMetaData;
+
+ typedef [public] struct {
+ [range(0,1048576)] uint32 count;
+ [size_is(count)] drsuapi_DsReplicaMetaData meta_data[];
+ } drsuapi_DsReplicaMetaDataCtr;
+
+ typedef [public,noprint] struct {
+ [max_recursion(20000)]
+ drsuapi_DsReplicaObjectListItemEx *next_object;
+ drsuapi_DsReplicaObject object;
+ boolean32 is_nc_prefix;
+ GUID *parent_object_guid;
+ drsuapi_DsReplicaMetaDataCtr *meta_data_ctr;
+ } drsuapi_DsReplicaObjectListItemEx;
+
+ typedef [public,gensize] struct {
+ GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */
+ GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
+ drsuapi_DsReplicaObjectIdentifier *naming_context;
+ drsuapi_DsReplicaHighWaterMark old_highwatermark;
+ drsuapi_DsReplicaHighWaterMark new_highwatermark;
+ drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
+ drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
+ drsuapi_DsExtendedError extended_ret; /* w2k sends the nc_object_count value here */
+ uint32 object_count;
+ /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
+ [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size;
+ drsuapi_DsReplicaObjectListItemEx *first_object;
+ boolean32 more_data;
+ } drsuapi_DsGetNCChangesCtr1;
+
+ /*
+ * if the DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE flag
+ * isn't there it means the value is deleted
+ */
+ typedef [public] bitmap {
+ DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE = 0x00000001
+ } drsuapi_DsLinkedAttributeFlags;
+
+ typedef [public] struct {
+ drsuapi_DsReplicaObjectIdentifier *identifier;
+ drsuapi_DsAttributeId attid;
+ drsuapi_DsAttributeValue value;
+ drsuapi_DsLinkedAttributeFlags flags;
+ NTTIME_1sec originating_add_time;
+ drsuapi_DsReplicaMetaData meta_data;
+ } drsuapi_DsReplicaLinkedAttribute;
+
+ /* [MS-DRSR] section 4.1.10.2.11 DRS_MSG_GETCHGREPLY_V6 */
+ typedef [public,gensize] struct {
+ GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */
+ GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
+ drsuapi_DsReplicaObjectIdentifier *naming_context;
+ drsuapi_DsReplicaHighWaterMark old_highwatermark;
+ drsuapi_DsReplicaHighWaterMark new_highwatermark;
+ drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
+ drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
+ drsuapi_DsExtendedError extended_ret;
+ uint32 object_count;
+ /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
+ [value(ndr_size_drsuapi_DsGetNCChangesCtr6(r,ndr->flags)+55)] uint32 __ndr_size;
+ drsuapi_DsReplicaObjectListItemEx *first_object;
+ boolean32 more_data;
+ uint32 nc_object_count; /* estimated amount of objects in the whole NC */
+ uint32 nc_linked_attributes_count; /* estimated amount of linked values in the whole NC */
+ [range(0,1048576)] uint32 linked_attributes_count;
+ [size_is(linked_attributes_count)] drsuapi_DsReplicaLinkedAttribute *linked_attributes;
+ WERROR drs_error;
+ } drsuapi_DsGetNCChangesCtr6;
+
+ typedef [public] struct {
+ [subcontext(0xFFFFFC01)] drsuapi_DsGetNCChangesCtr1 ctr1;
+ } drsuapi_DsGetNCChangesCtr1TS;
+
+ typedef [public] struct {
+ [subcontext(0xFFFFFC01)] drsuapi_DsGetNCChangesCtr6 ctr6;
+ } drsuapi_DsGetNCChangesCtr6TS;
+
+ typedef [nopush] struct {
+ uint32 decompressed_length;
+ uint32 compressed_length;
+ [subcontext(4),subcontext_size(compressed_length),
+ compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
+ drsuapi_DsGetNCChangesCtr1TS *ts;
+ } drsuapi_DsGetNCChangesMSZIPCtr1;
+
+ typedef [nopush] struct {
+ uint32 decompressed_length;
+ uint32 compressed_length;
+ [subcontext(4),subcontext_size(compressed_length),
+ compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
+ drsuapi_DsGetNCChangesCtr6TS *ts;
+ } drsuapi_DsGetNCChangesMSZIPCtr6;
+
+ typedef [nopush] struct {
+ uint32 decompressed_length;
+ uint32 compressed_length;
+ [subcontext(4),subcontext_size(compressed_length),
+ compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
+ drsuapi_DsGetNCChangesCtr1TS *ts;
+ } drsuapi_DsGetNCChangesXPRESSCtr1;
+
+ typedef [nopush] struct {
+ uint32 decompressed_length;
+ uint32 compressed_length;
+ [subcontext(4),subcontext_size(compressed_length),
+ compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
+ drsuapi_DsGetNCChangesCtr6TS *ts;
+ } drsuapi_DsGetNCChangesXPRESSCtr6;
+
+ typedef [enum16bit] enum {
+ DRSUAPI_COMPRESSION_TYPE_MSZIP = 2,
+ DRSUAPI_COMPRESSION_TYPE_XPRESS = 3
+ } drsuapi_DsGetNCChangesCompressionType;
+
+ typedef [nodiscriminant,flag(NDR_PAHEX)] union {
+ [case(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
+ [case(6|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr6 mszip6;
+ [case(1|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr1 xpress1;
+ [case(6|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr6 xpress6;
+ } drsuapi_DsGetNCChangesCompressedCtr;
+
+ typedef struct {
+ drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
+ } drsuapi_DsGetNCChangesCtr2;
+
+ typedef struct {
+ [range(0,6)] uint32 level;
+ [range(2,3)] drsuapi_DsGetNCChangesCompressionType type;
+ [switch_is(level | (type<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
+ } drsuapi_DsGetNCChangesCtr7;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1;
+ [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2;
+ [case(6)] drsuapi_DsGetNCChangesCtr6 ctr6;
+ [case(7)] drsuapi_DsGetNCChangesCtr7 ctr7;
+ } drsuapi_DsGetNCChangesCtr;
+
+ WERROR drsuapi_DsGetNCChanges(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] drsuapi_DsGetNCChangesRequest *req,
+ [out,ref] uint32 *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsGetNCChangesCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x04 */
+ /* [MS-DRSR] 4.1.26 */
+
+ typedef struct {
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ [ref,charset(DOS),string] uint8 *dest_dsa_dns_name;
+ GUID dest_dsa_guid;
+ drsuapi_DrsOptions options;
+ } drsuapi_DsReplicaUpdateRefsRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
+ } drsuapi_DsReplicaUpdateRefsRequest;
+
+ WERROR drsuapi_DsReplicaUpdateRefs(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
+ );
+
+ /*****************/
+ /* Function 0x05 */
+
+ typedef struct {
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ [charset(UTF16),string] uint16 *source_dsa_address;
+ uint8 schedule[84];
+ drsuapi_DrsOptions options;
+ } drsuapi_DsReplicaAddRequest1;
+
+ typedef struct {
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ drsuapi_DsReplicaObjectIdentifier *source_dsa_dn;
+ drsuapi_DsReplicaObjectIdentifier *transport_dn;
+ [charset(UTF16),string] uint16 *source_dsa_address;
+ uint8 schedule[84];
+ drsuapi_DrsOptions options;
+ } drsuapi_DsReplicaAddRequest2;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsReplicaAddRequest1 req1;
+ [case(2)] drsuapi_DsReplicaAddRequest2 req2;
+ } drsuapi_DsReplicaAddRequest;
+
+ WERROR drsuapi_DsReplicaAdd(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,switch_is(level)] drsuapi_DsReplicaAddRequest req
+ );
+
+
+ /*****************/
+ /* Function 0x06 */
+ typedef struct {
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ [charset(UTF8), string] uint8 *source_dsa_address;
+ drsuapi_DrsOptions options;
+ } drsuapi_DsReplicaDelRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsReplicaDelRequest1 req1;
+ } drsuapi_DsReplicaDelRequest;
+
+ WERROR drsuapi_DsReplicaDel(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,switch_is(level)] drsuapi_DsReplicaDelRequest req
+ );
+
+ /*****************/
+ /* Function 0x07 */
+
+ typedef struct {
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ GUID source_dra;
+ [charset(UTF16),string] uint16 *source_dra_address;
+ uint8 schedule[84];
+ drsuapi_DrsOptions replica_flags;
+ uint32 modify_fields;
+ drsuapi_DrsOptions options;
+ } drsuapi_DsReplicaModRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsReplicaModRequest1 req1;
+ } drsuapi_DsReplicaModRequest;
+
+ WERROR drsuapi_DsReplicaMod(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,switch_is(level)] drsuapi_DsReplicaModRequest req
+ );
+
+ /*****************/
+ /* Function 0x08 */
+ [todo] WERROR DRSUAPI_VERIFY_NAMES();
+
+ /*****************/
+ /* Function 0x09 */
+
+ /* how are type 4 and 7 different from 2 and 3 ? */
+ typedef [v1_enum] enum {
+ DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_AND_DOMAIN_GROUPS = 1,
+ DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS = 2,
+ DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS = 3,
+ DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS2 = 4,
+ DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_GROUPS = 5,
+ DRSUAPI_DS_MEMBERSHIP_TYPE_GROUPMEMBERS = 6,
+ DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS2 = 7
+ } drsuapi_DsMembershipType;
+
+ typedef struct {
+ NTSTATUS status;
+ [range(0,10000)] uint32 num_memberships;
+ [range(0,10000)] uint32 num_sids;
+ [size_is(num_memberships)] drsuapi_DsReplicaObjectIdentifier **info_array;
+ [size_is(num_memberships)] security_GroupAttrs *group_attrs;
+ [size_is(num_sids)] dom_sid28 **sids;
+ } drsuapi_DsGetMembershipsCtr1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
+ } drsuapi_DsGetMembershipsCtr;
+
+ const int DRSUAPI_DS_MEMBERSHIP_FLAG_GROUP_ATTR = 0x1;
+
+ typedef struct {
+ [range(1,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsReplicaObjectIdentifier **info_array;
+ uint32 flags;
+ [range(1,7)] drsuapi_DsMembershipType type;
+ drsuapi_DsReplicaObjectIdentifier *domain;
+ } drsuapi_DsGetMembershipsRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetMembershipsRequest1 req1;
+ } drsuapi_DsGetMembershipsRequest;
+
+ WERROR drsuapi_DsGetMemberships(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref] [switch_is(level)] drsuapi_DsGetMembershipsRequest *req,
+ [out,ref] uint32 *level_out,
+ [out,ref] [switch_is(*level_out)] drsuapi_DsGetMembershipsCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x0a */
+ [todo] WERROR DRSUAPI_INTER_DOMAIN_MOVE();
+
+ /*****************/
+ /* Function 0x0b */
+ typedef [bitmap32bit] bitmap {
+ DRSUAPI_NT4_CHANGELOG_GET_CHANGELOG = 0x00000001,
+ DRSUAPI_NT4_CHANGELOG_GET_SERIAL_NUMBERS = 0x00000002
+ } drsuapi_DsGetNT4ChangeLogFlags;
+
+ typedef struct {
+ drsuapi_DsGetNT4ChangeLogFlags flags;
+ uint32 preferred_maximum_length;
+ [range(0,0x00A00000)] uint32 restart_length;
+ [size_is(restart_length)] uint8 *restart_data;
+ } drsuapi_DsGetNT4ChangeLogRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetNT4ChangeLogRequest1 req1;
+ } drsuapi_DsGetNT4ChangeLogRequest;
+
+ typedef struct {
+ [range(0,0x00A00000)] uint32 restart_length;
+ [range(0,0x00A00000)] uint32 log_length;
+ hyper sam_serial_number;
+ NTTIME sam_creation_time;
+ hyper builtin_serial_number;
+ NTTIME builtin_creation_time;
+ hyper lsa_serial_number;
+ NTTIME lsa_creation_time;
+ NTSTATUS status;
+ [size_is(restart_length)] uint8 *restart_data;
+ [size_is(log_length)] uint8 *log_data;
+ } drsuapi_DsGetNT4ChangeLogInfo1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetNT4ChangeLogInfo1 info1;
+ } drsuapi_DsGetNT4ChangeLogInfo;
+
+ WERROR drsuapi_DsGetNT4ChangeLog(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref] [switch_is(level)] drsuapi_DsGetNT4ChangeLogRequest *req,
+ [out,ref] uint32 *level_out,
+ [out,ref] [switch_is(*level_out)] drsuapi_DsGetNT4ChangeLogInfo *info
+ );
+
+ /*****************/
+ /* Function 0x0c */
+ typedef [v1_enum] enum {
+ DRSUAPI_DS_NAME_STATUS_OK = 0,
+ DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR = 1,
+ DRSUAPI_DS_NAME_STATUS_NOT_FOUND = 2,
+ DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE = 3,
+ DRSUAPI_DS_NAME_STATUS_NO_MAPPING = 4,
+ DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY = 5,
+ DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING = 6,
+ DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL = 7
+ } drsuapi_DsNameStatus;
+
+ typedef [v1_enum] enum {
+ DRSUAPI_DS_NAME_FLAG_NO_FLAGS = 0x0,
+ DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY = 0x1,
+ DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC = 0x2,
+ DRSUAPI_DS_NAME_FLAG_GCVERIFY = 0x4,
+ DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL = 0x8
+ } drsuapi_DsNameFlags;
+
+ typedef [v1_enum] enum {
+ DRSUAPI_DS_NAME_FORMAT_UNKNOWN = 0x00000000,
+ DRSUAPI_DS_NAME_FORMAT_FQDN_1779 = 0x00000001,
+ DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT = 0x00000002,
+ DRSUAPI_DS_NAME_FORMAT_DISPLAY = 0x00000003,
+ DRSUAPI_DS_NAME_FORMAT_GUID = 0x00000006,
+ DRSUAPI_DS_NAME_FORMAT_CANONICAL = 0x00000007,
+ DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL = 0x00000008,
+ DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX = 0x00000009,
+ DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL = 0x0000000A,
+ DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY = 0x0000000B,
+ DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN = 0x0000000C,
+ DRSUAPI_DS_NAME_FORMAT_UPN_AND_ALTSECID = 0xFFFFFFEF,
+ DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX = 0xFFFFFFF0,
+ DRSUAPI_DS_NAME_FORMAT_LIST_GLOBAL_CATALOG_SERVERS = 0xFFFFFFF1,
+ DRSUAPI_DS_NAME_FORMAT_UPN_FOR_LOGON = 0xFFFFFFF2,
+ DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_WITH_DCS_IN_SITE = 0xFFFFFFF3,
+ DRSUAPI_DS_NAME_FORMAT_STRING_SID_NAME = 0xFFFFFFF4,
+ DRSUAPI_DS_NAME_FORMAT_ALT_SECURITY_IDENTITIES_NAME = 0xFFFFFFF5,
+ DRSUAPI_DS_NAME_FORMAT_LIST_NCS = 0xFFFFFFF6,
+ DRSUAPI_DS_NAME_FORMAT_LIST_DOMAINS = 0xFFFFFFF7,
+ DRSUAPI_DS_NAME_FORMAT_MAP_SCHEMA_GUID = 0xFFFFFFF8,
+ DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT_NAME_SANS_DOMAIN = 0xFFFFFFF9,
+ DRSUAPI_DS_NAME_FORMAT_LIST_ROLES = 0xFFFFFFFA,
+ DRSUAPI_DS_NAME_FORMAT_LIST_INFO_FOR_SERVER = 0xFFFFFFFB,
+ DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_FOR_DOMAIN_IN_SITE = 0xFFFFFFFC,
+ DRSUAPI_DS_NAME_FORMAT_LIST_DOMAINS_IN_SITE = 0xFFFFFFFD,
+ DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_IN_SITE = 0xFFFFFFFE,
+ DRSUAPI_DS_NAME_FORMAT_LIST_SITES = 0xFFFFFFFF
+ } drsuapi_DsNameFormat;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *str;
+ } drsuapi_DsNameString;
+
+ typedef struct {
+ uint32 codepage; /* 0x000004e4 - 1252 is german codepage*/
+ uint32 language; /* 0x00000407 - german language ID*/
+ drsuapi_DsNameFlags format_flags;
+ drsuapi_DsNameFormat format_offered;
+ drsuapi_DsNameFormat format_desired;
+ [range(1,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsNameString *names;
+ } drsuapi_DsNameRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsNameRequest1 req1;
+ } drsuapi_DsNameRequest;
+
+ typedef struct {
+ drsuapi_DsNameStatus status;
+ [charset(UTF16),string] uint16 *dns_domain_name;
+ [charset(UTF16),string] uint16 *result_name;
+ } drsuapi_DsNameInfo1;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] drsuapi_DsNameInfo1 *array;
+ } drsuapi_DsNameCtr1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsNameCtr1 *ctr1;
+ } drsuapi_DsNameCtr;
+
+ WERROR drsuapi_DsCrackNames(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] drsuapi_DsNameRequest *req,
+ [out,ref] uint32 *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsNameCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x0d */
+ typedef [v1_enum] enum {
+ DRSUAPI_DS_SPN_OPERATION_ADD = 0,
+ DRSUAPI_DS_SPN_OPERATION_REPLACE= 1,
+ DRSUAPI_DS_SPN_OPERATION_DELETE = 2
+ } drsuapi_DsSpnOperation;
+
+ typedef struct {
+ drsuapi_DsSpnOperation operation;
+ uint32 unknown1;
+ [charset(UTF16),string] uint16 *object_dn;
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsNameString *spn_names;
+ } drsuapi_DsWriteAccountSpnRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
+ } drsuapi_DsWriteAccountSpnRequest;
+
+ typedef struct {
+ WERROR status;
+ } drsuapi_DsWriteAccountSpnResult1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
+ } drsuapi_DsWriteAccountSpnResult;
+
+ WERROR drsuapi_DsWriteAccountSpn(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] drsuapi_DsWriteAccountSpnRequest *req,
+ [out,ref] uint32 *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsWriteAccountSpnResult *res
+ );
+
+ /*****************/
+ /* Function 0x0e */
+ typedef struct {
+ [charset(UTF16),string] uint16 *server_dn;
+ [charset(UTF16),string] uint16 *domain_dn;
+ boolean32 commit;
+ } drsuapi_DsRemoveDSServerRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsRemoveDSServerRequest1 req1;
+ } drsuapi_DsRemoveDSServerRequest;
+
+ typedef struct {
+ boolean32 last_dc_in_domain;
+ } drsuapi_DsRemoveDSServerResult1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsRemoveDSServerResult1 res1;
+ } drsuapi_DsRemoveDSServerResult;
+
+ WERROR drsuapi_DsRemoveDSServer(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] drsuapi_DsRemoveDSServerRequest *req,
+ [out,ref] uint32 *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsRemoveDSServerResult *res
+ );
+
+ /*****************/
+ /* Function 0x0f */
+ [todo] WERROR DRSUAPI_REMOVE_DS_DOMAIN();
+
+ /*****************/
+ /* Function 0x10 */
+ typedef [v1_enum] enum {
+ DRSUAPI_DC_INFO_CTR_1 = 1,
+ DRSUAPI_DC_INFO_CTR_2 = 2,
+ DRSUAPI_DC_INFO_CTR_3 = 3,
+ DRSUAPI_DC_CONNECTION_CTR_01 = 0xFFFFFFFF
+ } drsuapi_DsGetDCInfoCtrLevels;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *domain_name; /* netbios or dns */
+ drsuapi_DsGetDCInfoCtrLevels level; /* specifies the switch level for the request */
+ } drsuapi_DsGetDCInfoRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetDCInfoRequest1 req1;
+ } drsuapi_DsGetDCInfoRequest;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *netbios_name;
+ [charset(UTF16),string] uint16 *dns_name;
+ [charset(UTF16),string] uint16 *site_name;
+ [charset(UTF16),string] uint16 *computer_dn;
+ [charset(UTF16),string] uint16 *server_dn;
+ uint32 is_pdc;
+ uint32 is_enabled;
+ } drsuapi_DsGetDCInfo1;
+
+ typedef struct {
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsGetDCInfo1 *array;
+ } drsuapi_DsGetDCInfoCtr1;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *netbios_name;
+ [charset(UTF16),string] uint16 *dns_name;
+ [charset(UTF16),string] uint16 *site_name;
+ [charset(UTF16),string] uint16 *site_dn;
+ [charset(UTF16),string] uint16 *computer_dn;
+ [charset(UTF16),string] uint16 *server_dn;
+ [charset(UTF16),string] uint16 *ntds_dn;
+ uint32 is_pdc;
+ uint32 is_enabled;
+ uint32 is_gc;
+ GUID site_guid;
+ GUID computer_guid;
+ GUID server_guid;
+ GUID ntds_guid;
+ } drsuapi_DsGetDCInfo2;
+
+ typedef struct {
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsGetDCInfo2 *array;
+ } drsuapi_DsGetDCInfoCtr2;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *netbios_name;
+ [charset(UTF16),string] uint16 *dns_name;
+ [charset(UTF16),string] uint16 *site_name;
+ [charset(UTF16),string] uint16 *site_dn;
+ [charset(UTF16),string] uint16 *computer_dn;
+ [charset(UTF16),string] uint16 *server_dn;
+ [charset(UTF16),string] uint16 *ntds_dn;
+ uint32 is_pdc;
+ uint32 is_enabled;
+ uint32 is_gc;
+ uint32 is_rodc;
+ GUID site_guid;
+ GUID computer_guid;
+ GUID server_guid;
+ GUID ntds_guid;
+ } drsuapi_DsGetDCInfo3;
+
+ typedef struct {
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsGetDCInfo3 *array;
+ } drsuapi_DsGetDCInfoCtr3;
+
+ /*
+ * this represents an active connection to the
+ * Directory System Agent (DSA)
+ * this can be via LDAP or DRSUAPI
+ */
+ typedef struct {
+ [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address;
+ uint32 unknown2;
+ uint32 connection_time; /* in seconds */
+ uint32 unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ /*
+ * client_account can be the following:
+ * "W2K3\Administrator"
+ * "Administrator@W2K3"
+ * "cn=Administrator,cn=Users,DC=w2k3,DC=vmnet1,DC=vm,DC=base"
+ * ""
+ * or NULL
+ */
+ [charset(UTF16),string] uint16 *client_account;
+ } drsuapi_DsGetDCConnection01;
+
+ typedef struct {
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsGetDCConnection01 *array;
+ } drsuapi_DsGetDCConnectionCtr01;
+
+ typedef [switch_type(drsuapi_DsGetDCInfoCtrLevels)] union {
+ [case(DRSUAPI_DC_INFO_CTR_1)] drsuapi_DsGetDCInfoCtr1 ctr1;
+ [case(DRSUAPI_DC_INFO_CTR_2)] drsuapi_DsGetDCInfoCtr2 ctr2;
+ [case(DRSUAPI_DC_INFO_CTR_3)] drsuapi_DsGetDCInfoCtr3 ctr3;
+ [case(DRSUAPI_DC_CONNECTION_CTR_01)] drsuapi_DsGetDCConnectionCtr01 ctr01;
+ } drsuapi_DsGetDCInfoCtr;
+
+ WERROR drsuapi_DsGetDomainControllerInfo(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] drsuapi_DsGetDCInfoRequest *req,
+ [out,ref] drsuapi_DsGetDCInfoCtrLevels *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsGetDCInfoCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x11 */
+ typedef [public,noprint] struct {
+ [max_recursion(20000)]
+ drsuapi_DsReplicaObjectListItem *next_object;
+ drsuapi_DsReplicaObject object;
+ } drsuapi_DsReplicaObjectListItem;
+
+ /*
+ * The DsAddEntry() call which creates a nTDSDSA object,
+ * also adds a servicePrincipalName in the following form
+ * to the computer account of the new domain controller
+ * referenced by the "serverReferenece" attribute.
+ *
+ * E3514235-4B06-11D1-AB04-00C04FC2DCD2/<new-ntdsdsa-object-guid-as-string>/<domain-dns-name>
+ *
+ * also note that the "serverReference" isn't added to the new object!
+ */
+ const char *DRSUAPI_NTDSDSA_KRB5_SERVICE_GUID = "E3514235-4B06-11D1-AB04-00C04FC2DCD2";
+
+ /* Error codes to classify an error that occurs
+ * during a search for, or the update of,
+ * a directory object */
+ typedef [v1_enum] enum {
+ DRSUAPI_DIRERR_OK = 0,
+ DRSUAPI_DIRERR_ATTRIBUTE = 1,
+ DRSUAPI_DIRERR_NAME = 2,
+ DRSUAPI_DIRERR_REFERRAL = 3,
+ DRSUAPI_DIRERR_SECURITY = 4,
+ DRSUAPI_DIRERR_SERVICE = 5,
+ DRSUAPI_DIRERR_UPDATE = 6,
+ DRSUAPI_DIRERR_SYSTEM = 7
+ } drsuapi_DsAddEntry_DirErr;
+
+ /*
+ * Ref: DRS_MSG_ADDENTRYREQ_V2, [MS-DRSR]: 4.1.1.1.3
+ */
+ typedef struct {
+ drsuapi_DsReplicaObjectListItem first_object;
+ } drsuapi_DsAddEntryRequest2;
+
+ /* Buffer type is actually more
+ * like a semi Flags
+ * Ref: DRS_SecBuffer, [MS-DRSR]: 5.41 */
+ typedef [v1_enum,noprint] enum {
+ DRSUAPI_SECBUFFER_EMPTY = 0x00000000,
+ DRSUAPI_SECBUFFER_DATA = 0x00000001,
+ DRSUAPI_SECBUFFER_TOKEN = 0x00000002,
+ DRSUAPI_SECBUFFER_PKG_PARAMS = 0x00000003,
+ DRSUAPI_SECBUFFER_MISSING = 0x00000004,
+ DRSUAPI_SECBUFFER_EXTRA = 0x00000005,
+ DRSUAPI_SECBUFFER_STREAM_TRAILER = 0x00000006,
+ DRSUAPI_SECBUFFER_STREAM_HEADER = 0x00000007,
+ DRSUAPI_SECBUFFER_READONLY = 0x80000000
+ } drsuapi_SecBufferType;
+
+ typedef struct {
+ [range(0,10000)] uint32 buf_size;
+ drsuapi_SecBufferType buf_type;
+ [size_is(buf_size)] uint8 *buffer;
+ } drsuapi_SecBuffer;
+
+ typedef struct {
+ [value(0)] uint32 version;
+ [range(0,10000)] uint32 buff_count;
+ [size_is(buff_count)] drsuapi_SecBuffer *buffers;
+ } drsuapi_SecBufferDesc;
+
+ /*
+ * Ref: DRS_MSG_ADDENTRYREQ_V3, [MS-DRSR]: 4.1.1.1.4
+ */
+ typedef struct {
+ drsuapi_DsReplicaObjectListItem first_object;
+ drsuapi_SecBufferDesc *client_creds;
+ } drsuapi_DsAddEntryRequest3;
+
+ typedef [switch_type(uint32)] union {
+ [case(2)] drsuapi_DsAddEntryRequest2 req2;
+ [case(3)] drsuapi_DsAddEntryRequest3 req3;
+ } drsuapi_DsAddEntryRequest;
+
+ /* Generic extended error info
+ * commonly used in most places
+ * where rich error info is returned */
+ typedef struct {
+ uint32 dsid; /* implementation-specific diagnostic code */
+ WERROR extended_err; /* 0, STATUS code, or Windows error code */
+ uint32 extended_data; /* implementation-specific diagnostic code */
+ uint16 problem; /* 0 or PROBLEM error code */
+ } drsuapi_DsAddEntryErrorInfoX;
+
+ /* Attribute errors
+ * Ref: ATRERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.11 */
+ typedef struct {
+ uint32 dsid;
+ WERROR extended_err;
+ uint32 extended_data;
+ uint16 problem;
+ drsuapi_DsAttributeId attid;
+ boolean32 is_val_returned;
+ drsuapi_DsAttributeValue attr_val;
+ } drsuapi_DsAddEntry_AttrErr_V1;
+
+ typedef [noprint] struct {
+ [max_recursion(20000)]
+ drsuapi_DsAddEntry_AttrErrListItem_V1 *next;
+ drsuapi_DsAddEntry_AttrErr_V1 err_data;
+ } drsuapi_DsAddEntry_AttrErrListItem_V1;
+
+ typedef struct {
+ drsuapi_DsReplicaObjectIdentifier *id;
+ uint32 count;
+ drsuapi_DsAddEntry_AttrErrListItem_V1 first;
+ } drsuapi_DsAddEntryErrorInfo_Attr_V1;
+
+ /* Name resolution error
+ * Ref: NAMERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.14 */
+ typedef struct {
+ uint32 dsid;
+ WERROR extended_err;
+ uint32 extended_data;
+ uint16 problem;
+ drsuapi_DsReplicaObjectIdentifier *id_matched; /* The best match for the supplied object identity */
+ } drsuapi_DsAddEntryErrorInfo_Name_V1;
+
+ /* Referral error
+ * Ref: REFERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.15 */
+ typedef struct {
+ [value(83)] uint8 name_res; /* Must be 'S' */
+ [value(0)] uint8 unused_pad;
+ [value(0)] uint16 next_rdn;
+ } drsuapi_NameResOp_V1;
+
+ typedef [enum16bit] enum {
+ DRSUAPI_CH_REFTYPE_SUPERIOR = 0x0000, /* referral to a superior DC */
+ DRSUAPI_CH_REFTYPE_SUBORDINATE = 0x0001, /* referral to a subordinate DC */
+ DRSUAPI_CH_REFTYPE_NSSR = 0x0002, /* Not used */
+ DRSUAPI_CH_REFTYPE_CROSS = 0x0003 /* A referral to an external crossRef object */
+ } drsuapi_DsAddEntry_RefType;
+
+ typedef [enum8bit] enum {
+ DRSUAPI_SE_CHOICE_BASE_ONLY = 0x00,
+ DRSUAPI_SE_CHOICE_IMMED_CHLDRN = 0x01,
+ DRSUAPI_SE_CHOICE_WHOLE_SUBTREE = 0x02
+ } drsuapi_DsAddEntry_ChoiceType;
+
+ /* list of network names of the DCs
+ * to which the referral is directed */
+ typedef struct {
+ [max_recursion(1024)] drsuapi_DsaAddressListItem_V1 *next;
+ lsa_String *address;
+ } drsuapi_DsaAddressListItem_V1;
+
+ typedef struct {
+ drsuapi_DsReplicaObjectIdentifier *id_target; /* object to which the referral is directed */
+ drsuapi_NameResOp_V1 op_state;
+ [value(0)] uint16 rdn_alias;
+ [value(0)] uint16 rdn_internal;
+ drsuapi_DsAddEntry_RefType ref_type;
+ uint16 addr_list_count;
+ drsuapi_DsaAddressListItem_V1 *addr_list;
+ [max_recursion(20000)]
+ drsuapi_DsAddEntry_RefErrListItem_V1 *next;
+ boolean32 is_choice_set;
+ drsuapi_DsAddEntry_ChoiceType choice;
+ } drsuapi_DsAddEntry_RefErrListItem_V1;
+
+ typedef struct {
+ uint32 dsid;
+ WERROR extended_err;
+ uint32 extended_data;
+ drsuapi_DsAddEntry_RefErrListItem_V1 refer;
+ } drsuapi_DsAddEntryErrorInfo_Referr_V1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsAddEntryErrorInfo_Attr_V1 attr_err;
+ [case(2)] drsuapi_DsAddEntryErrorInfo_Name_V1 name_err;
+ [case(3)] drsuapi_DsAddEntryErrorInfo_Referr_V1 referral_err;
+ [case(4)] drsuapi_DsAddEntryErrorInfoX security_err;
+ [case(5)] drsuapi_DsAddEntryErrorInfoX service_err;
+ [case(6)] drsuapi_DsAddEntryErrorInfoX update_err;
+ [case(7)] drsuapi_DsAddEntryErrorInfoX system_err;
+ } drsuapi_DsAddEntryErrorInfo;
+
+ typedef struct {
+ WERROR status;
+ drsuapi_DsAddEntry_DirErr dir_err;
+ [switch_is(dir_err)] drsuapi_DsAddEntryErrorInfo *info;
+ } drsuapi_DsAddEntry_ErrData_V1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsAddEntry_ErrData_V1 v1;
+ } drsuapi_DsAddEntry_ErrData;
+
+ typedef struct {
+ GUID guid;
+ dom_sid28 sid;
+ } drsuapi_DsReplicaObjectIdentifier2;
+
+ typedef struct {
+ drsuapi_DsReplicaObjectIdentifier *id;
+ drsuapi_DsAddEntry_DirErr dir_err;
+ uint32 dsid; /* implementation-specific diagnostic code */
+ WERROR extended_err; /* 0, STATUS code, or Windows error code */
+ uint32 extended_data; /* implementation-specific diagnostic code */
+ uint16 problem; /* 0 or PROBLEM error code */
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
+ } drsuapi_DsAddEntryCtr2;
+
+ typedef struct {
+ drsuapi_DsReplicaObjectIdentifier *id;
+ uint32 err_ver; /* Must be 1 */
+ [switch_is(err_ver)] drsuapi_DsAddEntry_ErrData *err_data;
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
+ } drsuapi_DsAddEntryCtr3;
+
+ typedef [switch_type(uint32)] union {
+ [case(2)] drsuapi_DsAddEntryCtr2 ctr2;
+ [case(3)] drsuapi_DsAddEntryCtr3 ctr3;
+ } drsuapi_DsAddEntryCtr;
+
+ [public] WERROR drsuapi_DsAddEntry(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] drsuapi_DsAddEntryRequest *req,
+ [out,ref] uint32 *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsAddEntryCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x12 */
+ typedef bitmap {
+ DRSUAPI_DS_EXECUTE_KCC_ASYNCHRONOUS_OPERATION = 0x00000001,
+ DRSUAPI_DS_EXECUTE_KCC_DAMPED = 0x00000002
+ } drsuapi_DsExecuteKCCFlags;
+
+ typedef struct {
+ uint32 taskID;
+ drsuapi_DsExecuteKCCFlags flags;
+ } drsuapi_DsExecuteKCC1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsExecuteKCC1 ctr1;
+ } drsuapi_DsExecuteKCCRequest;
+
+ WERROR drsuapi_DsExecuteKCC(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in, ref, switch_is(level)] drsuapi_DsExecuteKCCRequest *req
+ );
+
+ /*****************/
+ /* Function 0x13 */
+ typedef [v1_enum] enum {
+ DRSUAPI_DS_REPLICA_GET_INFO = 1,
+ DRSUAPI_DS_REPLICA_GET_INFO2 = 2
+ } drsuapi_DsReplicaGetInfoLevel;
+
+ typedef [v1_enum] enum {
+ DRSUAPI_DS_REPLICA_INFO_NEIGHBORS = 0,
+ DRSUAPI_DS_REPLICA_INFO_CURSORS = 1,
+ DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA = 2,
+ DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES = 3,
+ DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES = 4,
+ DRSUAPI_DS_REPLICA_INFO_PENDING_OPS = 5,
+ DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA = 6,
+ DRSUAPI_DS_REPLICA_INFO_CURSORS2 = 7,
+ DRSUAPI_DS_REPLICA_INFO_CURSORS3 = 8,
+ DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2 = 9,
+ DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2 = 10,
+ DRSUAPI_DS_REPLICA_INFO_REPSTO = -2,
+ DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS = -4,
+ DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1 = -5,
+ DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS = -6
+ } drsuapi_DsReplicaInfoType;
+
+ typedef struct {
+ drsuapi_DsReplicaInfoType info_type;
+ [charset(UTF16),string] uint16 *object_dn;
+ GUID source_dsa_guid;
+ } drsuapi_DsReplicaGetInfoRequest1;
+
+ typedef struct {
+ drsuapi_DsReplicaInfoType info_type;
+ [charset(UTF16),string] uint16 *object_dn;
+ GUID source_dsa_guid;
+ uint32 flags;
+ [charset(UTF16),string] uint16 *attribute_name;
+ [charset(UTF16),string] uint16 *value_dn_str;
+ uint32 enumeration_context;
+ } drsuapi_DsReplicaGetInfoRequest2;
+
+ typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union {
+ [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1;
+ [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2;
+ } drsuapi_DsReplicaGetInfoRequest;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *naming_context_dn;
+ [charset(UTF16),string] uint16 *source_dsa_obj_dn;
+ [charset(UTF16),string] uint16 *source_dsa_address;
+ [charset(UTF16),string] uint16 *transport_obj_dn;
+ drsuapi_DrsOptions replica_flags;
+ uint32 reserved;
+ GUID naming_context_obj_guid;
+ GUID source_dsa_obj_guid;
+ GUID source_dsa_invocation_id;
+ GUID transport_obj_guid;
+ hyper tmp_highest_usn;
+ hyper highest_usn;
+ NTTIME last_success;
+ NTTIME last_attempt;
+ WERROR result_last_attempt;
+ uint32 consecutive_sync_failures;
+ } drsuapi_DsReplicaNeighbour;
+
+ typedef struct {
+ uint32 count;
+ uint32 reserved;
+ [size_is(count)] drsuapi_DsReplicaNeighbour array[];
+ } drsuapi_DsReplicaNeighbourCtr;
+
+ typedef struct {
+ uint32 count;
+ uint32 reserved;
+ [size_is(count)] drsuapi_DsReplicaCursor array[];
+ } drsuapi_DsReplicaCursorCtr;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *attribute_name;
+ uint32 version;
+ NTTIME originating_change_time;
+ GUID originating_invocation_id;
+ hyper originating_usn;
+ hyper local_usn;
+ } drsuapi_DsReplicaObjMetaData;
+
+ typedef struct {
+ uint32 count;
+ uint32 reserved;
+ [size_is(count)] drsuapi_DsReplicaObjMetaData array[];
+ } drsuapi_DsReplicaObjMetaDataCtr;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *dsa_obj_dn;
+ GUID dsa_obj_guid;
+ NTTIME first_failure;
+ uint32 num_failures;
+ WERROR last_result;
+ } drsuapi_DsReplicaKccDsaFailure;
+
+ typedef struct {
+ uint32 count;
+ uint32 reserved;
+ [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[];
+ } drsuapi_DsReplicaKccDsaFailuresCtr;
+
+ typedef enum {
+ DRSUAPI_DS_REPLICA_OP_TYPE_SYNC = 0,
+ DRSUAPI_DS_REPLICA_OP_TYPE_ADD = 1,
+ DRSUAPI_DS_REPLICA_OP_TYPE_DELETE = 2,
+ DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY = 3,
+ DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS = 4
+ } drsuapi_DsReplicaOpType;
+
+ typedef struct {
+ NTTIME operation_start;
+ uint32 serial_num; /* unique till reboot */
+ uint32 priority;
+ drsuapi_DsReplicaOpType operation_type;
+ drsuapi_DrsOptions options;
+ [charset(UTF16),string] uint16 *nc_dn;
+ [charset(UTF16),string] uint16 *remote_dsa_obj_dn;
+ [charset(UTF16),string] uint16 *remote_dsa_address;
+ GUID nc_obj_guid;
+ GUID remote_dsa_obj_guid;
+ } drsuapi_DsReplicaOp;
+
+ typedef struct {
+ NTTIME time;
+ uint32 count;
+ [size_is(count)] drsuapi_DsReplicaOp array[];
+ } drsuapi_DsReplicaOpCtr;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *attribute_name;
+ [charset(UTF16),string] uint16 *object_dn;
+ [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary;
+ DATA_BLOB *binary;
+ NTTIME deleted;
+ NTTIME created;
+ uint32 version;
+ NTTIME originating_change_time;
+ GUID originating_invocation_id;
+ hyper originating_usn;
+ hyper local_usn;
+ } drsuapi_DsReplicaAttrValMetaData;
+
+ typedef struct {
+ uint32 count;
+ uint32 enumeration_context;
+ [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
+ } drsuapi_DsReplicaAttrValMetaDataCtr;
+
+ typedef struct {
+ uint32 count;
+ uint32 enumeration_context;
+ [size_is(count)] drsuapi_DsReplicaCursor2 array[];
+ } drsuapi_DsReplicaCursor2Ctr;
+
+ typedef struct {
+ GUID source_dsa_invocation_id;
+ hyper highest_usn;
+ NTTIME last_sync_success;
+ [charset(UTF16),string] uint16 *source_dsa_obj_dn;
+ } drsuapi_DsReplicaCursor3;
+
+ typedef struct {
+ uint32 count;
+ uint32 enumeration_context;
+ [size_is(count)] drsuapi_DsReplicaCursor3 array[];
+ } drsuapi_DsReplicaCursor3Ctr;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *attribute_name;
+ uint32 version;
+ NTTIME originating_change_time;
+ GUID originating_invocation_id;
+ hyper originating_usn;
+ hyper local_usn;
+ [charset(UTF16),string] uint16 *originating_dsa_dn;
+ } drsuapi_DsReplicaObjMetaData2;
+
+ typedef struct {
+ uint32 count;
+ uint32 enumeration_context;
+ [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
+ } drsuapi_DsReplicaObjMetaData2Ctr;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *attribute_name;
+ [charset(UTF16),string] uint16 *object_dn;
+ [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary;
+ DATA_BLOB *binary;
+ NTTIME deleted;
+ NTTIME created;
+ uint32 version;
+ NTTIME originating_change_time;
+ GUID originating_invocation_id;
+ hyper originating_usn;
+ hyper local_usn;
+ [charset(UTF16),string] uint16 *originating_dsa_dn;
+ } drsuapi_DsReplicaAttrValMetaData2;
+
+ typedef struct {
+ uint32 count;
+ uint32 enumeration_context;
+ [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
+ } drsuapi_DsReplicaAttrValMetaData2Ctr;
+
+ typedef struct {
+ hyper u1; /* session number? */
+ uint32 u2;
+ uint32 u3;
+ GUID bind_guid;
+ NTTIME_1sec bind_time;
+ [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address;
+ uint32 u5; /* this is the same value the client used as pid in the DsBindInfoX struct */
+ } drsuapi_DsReplicaConnection04;
+
+ typedef struct {
+ [range(0,10000)] uint32 count;
+ uint32 reserved;
+ [size_is(count)] drsuapi_DsReplicaConnection04 array[];
+ } drsuapi_DsReplicaConnection04Ctr;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *str1;
+ uint32 u1;
+ uint32 u2;
+ uint32 u3;
+ uint32 u4;
+ uint32 u5;
+ hyper u6;
+ uint32 u7;
+ } drsuapi_DsReplica06;
+
+ typedef struct {
+ [range(0,256)] uint32 count;
+ uint32 reserved;
+ [size_is(count)] drsuapi_DsReplica06 array[];
+ } drsuapi_DsReplica06Ctr;
+
+ typedef [switch_type(drsuapi_DsReplicaInfoType)] union {
+ [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours;
+ [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCursorCtr *cursors;
+ [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata;
+ [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures;
+ [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures;
+ [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops;
+ [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata;
+ [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCursor2Ctr *cursors2;
+ [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCursor3Ctr *cursors3;
+ [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
+ [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
+ [case(DRSUAPI_DS_REPLICA_INFO_REPSTO)] drsuapi_DsReplicaNeighbourCtr *repsto;
+ [case(DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS)] drsuapi_DsReplicaConnection04Ctr *clientctx;
+ [case(DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1)] drsuapi_DsReplicaCursorCtrEx *udv1;
+ [case(DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS)] drsuapi_DsReplica06Ctr *srvoutgoingcalls;
+ } drsuapi_DsReplicaInfo;
+
+ WERROR drsuapi_DsReplicaGetInfo(
+ [in] policy_handle *bind_handle,
+ [in] drsuapi_DsReplicaGetInfoLevel level,
+ [in,ref,switch_is(level)] drsuapi_DsReplicaGetInfoRequest *req,
+ [out,ref] drsuapi_DsReplicaInfoType *info_type,
+ [out,ref,switch_is(*info_type)] drsuapi_DsReplicaInfo *info
+ );
+
+ /*****************/
+ /* Function 0x14 */
+ [todo] WERROR DRSUAPI_ADD_SID_HISTORY();
+
+ /*****************/
+ /* Function 0x15 */
+
+ typedef struct {
+ [range(0,10000)] uint32 num_entries;
+ [size_is(num_entries)] drsuapi_DsGetMembershipsCtr1 **ctrl_array;
+ } drsuapi_DsGetMemberships2Ctr1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
+ } drsuapi_DsGetMemberships2Ctr;
+
+ typedef struct {
+ [range(1,10000)] uint32 num_req;
+ [size_is(num_req)] drsuapi_DsGetMembershipsRequest1 **req_array;
+ } drsuapi_DsGetMemberships2Request1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetMemberships2Request1 req1;
+ } drsuapi_DsGetMemberships2Request;
+
+ WERROR drsuapi_DsGetMemberships2(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref] [switch_is(level)] drsuapi_DsGetMemberships2Request *req,
+ [out,ref] uint32 *level_out,
+ [out,ref] [switch_is(*level_out)] drsuapi_DsGetMemberships2Ctr *ctr
+ );
+
+ /*****************/
+ /* Function 0x16 */
+ [todo] WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();
+
+ /*****************/
+ /* Function 0x17 */
+ [todo] WERROR DRSUAPI_GET_OBJECT_EXISTENCE();
+
+ /*****************/
+ /* Function 0x18 */
+ typedef struct {
+ WERROR error_code;
+ uint32 site_cost;
+ } drsuapi_DsSiteCostInfo;
+
+ typedef struct {
+ [range(0,10000)] uint32 num_info;
+ [size_is(num_info)] drsuapi_DsSiteCostInfo *info;
+ [value(0)] uint32 flags_reserved;
+ } drsuapi_QuerySitesByCostCtr1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_QuerySitesByCostCtr1 ctr1;
+ } drsuapi_QuerySitesByCostCtr;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *site_from;
+ [range(1,10000)] uint32 num_req;
+ [size_is(num_req)] [charset(UTF16),string] uint16 **site_to;
+ uint32 flags;
+ } drsuapi_QuerySitesByCostRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_QuerySitesByCostRequest1 req1;
+ } drsuapi_QuerySitesByCostRequest;
+
+ WERROR drsuapi_QuerySitesByCost(
+ [in] policy_handle *bind_handle,
+ [in] uint32 level,
+ [in,ref] [switch_is(level)] drsuapi_QuerySitesByCostRequest *req,
+ [out,ref] uint32 *level_out,
+ [out,ref] [switch_is(*level_out)] drsuapi_QuerySitesByCostCtr *ctr
+ );
+}
diff --git a/librpc/idl/dsbackup.idl b/librpc/idl/dsbackup.idl
new file mode 100644
index 0000000..72e8bf9
--- /dev/null
+++ b/librpc/idl/dsbackup.idl
@@ -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
+{
+ [todo] void HrRBackupPrepare();
+ [todo] void HrRBackupEnd();
+ [todo] void HrRBackupGetAttachmentInformation();
+ [todo] void HrRBackupOpenFile();
+ [todo] void HrRBackupRead();
+ [todo] void HrRBackupClose();
+ [todo] void HrRBackupGetBackupLogs();
+ [todo] void HrRBackupTruncateLogs();
+ [todo] void HrRBackupPing();
+}
+
+[
+ uuid("16e0cf3a-a604-11d0-96b1-00a0c91ece30"),
+ version(1.0),
+ pointer_default(unique),
+ helpstring("Restoring Active Directory backups")
+] interface ad_restore
+{
+ [todo] void HrRIsNTDSOnline();
+ [todo] void HrRRestorePrepare();
+ [todo] void HrRRestoreRegister();
+ [todo] void HrRRestoreRegisterComplete();
+ [todo] void HrRRestoreGetDatabaseLocations();
+ [todo] void HrRRestoreEnd();
+ [todo] void HrRRestoreSetCurrentLogNumber();
+ [todo] void HrRRestoreCheckLogsForBackup();
+}
diff --git a/librpc/idl/dssetup.idl b/librpc/idl/dssetup.idl
new file mode 100644
index 0000000..14de9f7
--- /dev/null
+++ b/librpc/idl/dssetup.idl
@@ -0,0 +1,101 @@
+/*
+ dssetup interface definition
+*/
+
+import "misc.idl";
+
+[
+ 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.
+ */
+ [todo] WERROR dssetup_DsRoleDnsNameToFlatName();
+ [todo] WERROR dssetup_DsRoleDcAsDc();
+ [todo] WERROR dssetup_DsRoleDcAsReplica();
+ [todo] WERROR dssetup_DsRoleDemoteDc();
+ [todo] WERROR dssetup_DsRoleGetDcOperationProgress();
+ [todo] WERROR dssetup_DsRoleGetDcOperationResults();
+ [todo] WERROR dssetup_DsRoleCancel();
+ [todo] WERROR dssetup_DsRoleServerSaveStateForUpgrade();
+ [todo] WERROR dssetup_DsRoleUpgradeDownlevelServer();
+ [todo] WERROR dssetup_DsRoleAbortDownlevelServerUpgrade();
+}
diff --git a/librpc/idl/echo.idl b/librpc/idl/echo.idl
new file mode 100644
index 0000000..bf1e318
--- /dev/null
+++ b/librpc/idl/echo.idl
@@ -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 [public] struct {
+ uint8 v;
+ } echo_info1;
+
+ typedef struct {
+ uint16 v;
+ } echo_info2;
+
+ typedef struct {
+ uint32 v;
+ } echo_info3;
+
+ struct echo_info4 {
+ hyper v;
+ };
+
+ typedef struct {
+ uint8 v1;
+ hyper v2;
+ } echo_info5;
+
+ typedef struct {
+ uint8 v1;
+ echo_info1 info1;
+ } echo_info6;
+
+ typedef struct {
+ uint8 v1;
+ struct 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)] struct 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);
+}
diff --git a/librpc/idl/efs.idl b/librpc/idl/efs.idl
new file mode 100644
index 0000000..4279b08
--- /dev/null
+++ b/librpc/idl/efs.idl
@@ -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
+ );
+
+[todo] WERROR EfsRpcReadFileRaw(
+ [in,ref] policy_handle *pvContext
+/* incomplete */
+);
+
+
+[todo] 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
+);
+
+[todo] WERROR EfsRpcRemoveUsersFromFile(
+ [in] [charset(UTF16),string] uint16 FileName[]
+ /* [in] ENCRYPTION_CERTIFICATE_LIST Hashes*/
+);
+
+[todo] 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
+);
+
+[todo] WERROR EfsRpcNotSupported(
+);
+
+[todo] WERROR EfsRpcFileKeyInfo(
+);
+
+[todo] WERROR EfsRpcDuplicateEncryptionInfoFile(
+);
+
+}
diff --git a/librpc/idl/epmapper.idl b/librpc/idl/epmapper.idl
new file mode 100644
index 0000000..fd8eeb4
--- /dev/null
+++ b/librpc/idl/epmapper.idl
@@ -0,0 +1,328 @@
+#include "idl_types.h"
+
+/*
+ endpoint mapper interface
+ Related links:
+ http://www.opengroup.org/onlinepubs/9629399/apdxo.htm : The official IDL for this pipe
+ 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
+
+*/
+
+import "misc.idl";
+
+[
+ uuid("e1af8308-5d1f-11c9-91a4-08002b14a0fa"),
+ version(3.0),
+ endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]",
+ "ncacn_http:[593]", "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_CANT_PERFORM_OP = 0x6d8;
+ 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_NAMED_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_named_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_NAMED_PIPE)] epm_rhs_named_pipe named_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(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 [public] 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;
+ /*
+ * In theory this should be:
+ * [charset(DOS),string] uint8 annotation[64]
+ * But midl treats this as:
+ * [charset(DOS),string] uint8 annotation[]
+ * and pidl doesn't support this yet
+ */
+ [value(0)] uint32 __annotation_offset;
+ [value(strlen(annotation)+1)] uint32 __annotation_length;
+ [charset(DOS)] uint8 annotation[__annotation_length];
+ } 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[]
+ );
+
+ typedef [v1_enum] enum {
+ RPC_C_EP_ALL_ELTS = 0x00000000,
+ RPC_C_EP_MATCH_BY_IF = 0x00000001,
+ RPC_C_EP_MATCH_BY_OBJ = 0x00000002,
+ RPC_C_EP_MATCH_BY_BOTH = 0x00000003
+ } epm_InquiryType;
+
+ typedef [v1_enum] enum {
+ RPC_C_VERS_ALL = 0x00000000,
+ RPC_C_VERS_COMPATIBLE = 0x00000001,
+ RPC_C_VERS_EXACT = 0x00000002,
+ RPC_C_VERS_MAJOR_ONLY = 0x00000003,
+ RPC_C_VERS_UPTO = 0x00000004
+ } epm_VersionOption;
+
+ /**********************/
+ /* Function 0x02 */
+ error_status_t epm_Lookup(
+ [in] epm_InquiryType inquiry_type,
+ [in,ptr] GUID *object,
+ [in,ptr] rpc_if_id_t *interface_id,
+ [in] epm_VersionOption 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;
+
+ [public] 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 */
+ [todo] error_status_t epm_MapAuth();
+}
diff --git a/librpc/idl/eventlog.idl b/librpc/idl/eventlog.idl
new file mode 100644
index 0000000..e269467
--- /dev/null
+++ b/librpc/idl/eventlog.idl
@@ -0,0 +1,324 @@
+#include "idl_types.h"
+
+/*
+ eventlog interface definition
+*/
+
+import "lsa.idl", "security.idl";
+
+[ uuid("82273fdc-e32a-18c3-3f78-827929dc23ea"),
+ version(0.0),
+ helpstring("Event Logger")
+] interface eventlog
+{
+ typedef [bitmap32bit] bitmap {
+ EVENTLOG_SEQUENTIAL_READ = 0x0001,
+ EVENTLOG_SEEK_READ = 0x0002,
+ EVENTLOG_FORWARDS_READ = 0x0004,
+ EVENTLOG_BACKWARDS_READ = 0x0008
+ } eventlogReadFlags;
+
+ typedef [public] enum {
+ 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;
+
+ /* compat structure for samba3 on-disc eventlog format,
+ this is *NOT* used on the wire. - gd */
+
+ typedef [flag(NDR_NOALIGN|NDR_PAHEX),public] struct {
+ uint32 size;
+ [charset(DOS),value("eLfL")] uint8 reserved[4];
+ uint32 record_number;
+ time_t time_generated;
+ time_t time_written;
+ uint32 event_id;
+ eventlogEventTypes event_type;
+ [range(0,256)] uint16 num_of_strings;
+ uint16 event_category;
+ uint16 reserved_flags;
+ uint32 closing_record_number;
+ uint32 stringoffset;
+ [value(sid.length)] uint32 sid_length;
+ uint32 sid_offset;
+ [value(data.length)] uint32 data_length;
+ uint32 data_offset;
+ [value(2*strlen_m_term(source_name))] uint32 source_name_len;
+ nstring source_name;
+ [value(2*strlen_m_term(computer_name))] uint32 computer_name_len;
+ nstring computer_name;
+ uint32 sid_padding;
+ DATA_BLOB sid;
+ [value(2*ndr_size_string_array(strings, num_of_strings, STR_NULLTERM))] uint32 strings_len;
+ nstring strings[num_of_strings];
+ DATA_BLOB data;
+ uint32 padding;
+ } eventlog_Record_tdb;
+
+ typedef [v1_enum] enum {
+ ELF_LOGFILE_HEADER_DIRTY = 0x0001,
+ ELF_LOGFILE_HEADER_WRAP = 0x0002,
+ ELF_LOGFILE_LOGFULL_WRITTEN = 0x0004,
+ ELF_LOGFILE_ARCHIVE_SET = 0x0008
+ } EVENTLOG_HEADER_FLAGS;
+
+ typedef [public] struct {
+ [value(0x30)] uint32 HeaderSize;
+ [charset(DOS),value("LfLe")] uint8 Signature[4];
+ [value(1)] uint32 MajorVersion;
+ [value(1)] uint32 MinorVersion;
+ uint32 StartOffset;
+ uint32 EndOffset;
+ uint32 CurrentRecordNumber;
+ uint32 OldestRecordNumber;
+ uint32 MaxSize;
+ EVENTLOG_HEADER_FLAGS Flags;
+ uint32 Retention;
+ [value(0x30)] uint32 EndHeaderSize;
+ } EVENTLOGHEADER;
+
+ typedef [public,gensize] struct {
+ uint32 Length;
+ [charset(DOS),value("LfLe")] uint8 Reserved[4];
+ uint32 RecordNumber;
+ time_t TimeGenerated;
+ time_t TimeWritten;
+ uint32 EventID;
+ eventlogEventTypes EventType;
+ uint16 NumStrings;
+ uint16 EventCategory;
+ uint16 ReservedFlags;
+ uint32 ClosingRecordNumber;
+ [value(56+2*(strlen_m_term(SourceName)+strlen_m_term(Computername))+UserSidLength)] uint32 StringOffset;
+ [value(ndr_size_dom_sid0(&UserSid, ndr->flags))] uint32 UserSidLength;
+ [value(56+2*(strlen_m_term(SourceName)+strlen_m_term(Computername)))] uint32 UserSidOffset;
+ uint32 DataLength;
+ [value(56+2*(strlen_m_term(SourceName)+strlen_m_term(Computername))+UserSidLength+(2*ndr_size_string_array(Strings, NumStrings, STR_NULLTERM)))] uint32 DataOffset;
+ nstring SourceName;
+ nstring Computername;
+ [flag(NDR_ALIGN4),subcontext(0),subcontext_size(UserSidLength)] dom_sid0 UserSid;
+ nstring Strings[NumStrings];
+ [flag(NDR_PAHEX)] uint8 Data[DataLength];
+ astring Pad;
+ [value(Length)] uint32 Length2;
+ } EVENTLOGRECORD;
+
+ typedef [public] struct {
+ [value(0x28)] uint32 RecordSizeBeginning;
+ [value(0x11111111)] uint32 One;
+ [value(0x22222222)] uint32 Two;
+ [value(0x33333333)] uint32 Three;
+ [value(0x44444444)] uint32 Four;
+ uint32 BeginRecord;
+ uint32 EndRecord;
+ uint32 CurrentRecordNumber;
+ uint32 OldestRecordNumber;
+ [value(0x28)] uint32 RecordSizeEnd;
+ } EVENTLOGEOF;
+
+ /* the following is true for a non-wrapped evt file (e.g. backups
+ * generated and viewed with eventvwr) */
+
+ typedef [public] struct {
+ EVENTLOGHEADER hdr;
+ EVENTLOGRECORD records[hdr.CurrentRecordNumber-hdr.OldestRecordNumber];
+ EVENTLOGEOF eof;
+ } EVENTLOG_EVT_FILE;
+
+ /******************/
+ /* Function: 0x00 */
+ NTSTATUS eventlog_ClearEventLogW(
+ [in] policy_handle *handle,
+ [in,unique] lsa_String *backupfile
+ );
+
+ /******************/
+ /* Function: 0x01 */
+ NTSTATUS eventlog_BackupEventLogW(
+ [in] policy_handle *handle,
+ [in,ref] lsa_String *backup_filename
+ );
+
+ /******************/
+ /* Function: 0x02 */
+ NTSTATUS eventlog_CloseEventLog(
+ [in,out] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x03 */
+ NTSTATUS eventlog_DeregisterEventSource(
+ [in,out] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x04 */
+ NTSTATUS eventlog_GetNumRecords(
+ [in] policy_handle *handle,
+ [out,ref] uint32 *number
+ );
+
+ /******************/
+ /* Function: 0x05 */
+ NTSTATUS eventlog_GetOldestRecord(
+ [in] policy_handle *handle,
+ [out,ref] uint32 *oldest_entry
+ );
+
+ /******************/
+ /* Function: 0x06 */
+ [todo] NTSTATUS eventlog_ChangeNotify();
+
+ /******************/
+ /* Function: 0x07 */
+ NTSTATUS eventlog_OpenEventLogW(
+ [in,unique] eventlog_OpenUnknown0 *unknown0,
+ [in,ref] lsa_String *logname,
+ [in,ref] lsa_String *servername,
+ [in] uint32 major_version,
+ [in] uint32 minor_version,
+ [out] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x08 */
+ NTSTATUS eventlog_RegisterEventSourceW(
+ [in,unique] eventlog_OpenUnknown0 *unknown0,
+ [in,ref] lsa_String *module_name,
+ [in,ref] lsa_String *reg_module_name,
+ [in] uint32 major_version,
+ [in] uint32 minor_version,
+ [out] policy_handle *log_handle
+ );
+
+ /******************/
+ /* Function: 0x09 */
+ NTSTATUS eventlog_OpenBackupEventLogW(
+ [in,unique] eventlog_OpenUnknown0 *unknown0,
+ [in,ref] lsa_String *backup_logname,
+ [in] uint32 major_version,
+ [in] uint32 minor_version,
+ [out] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x0a */
+ NTSTATUS eventlog_ReadEventLogW(
+ [in] policy_handle *handle,
+ [in] eventlogReadFlags flags,
+ [in] uint32 offset,
+ [in] [range(0,0x7FFFF)] uint32 number_of_bytes,
+ [out,ref,size_is(number_of_bytes)] uint8 *data,
+ [out,ref] uint32 *sent_size,
+ [out,ref] uint32 *real_size
+ );
+
+ /*****************/
+ /* Function 0x0b */
+ NTSTATUS eventlog_ReportEventW(
+ [in] policy_handle *handle,
+ [in] time_t timestamp,
+ [in] eventlogEventTypes event_type,
+ [in] uint16 event_category,
+ [in] uint32 event_id,
+ [in] [range(0,256)] uint16 num_of_strings,
+ [in] [range(0,0x3FFFF)] uint32 data_size,
+ [in,ref] lsa_String *servername,
+ [in,unique] dom_sid *user_sid,
+ [in,unique] [size_is(num_of_strings)] lsa_String **strings,
+ [in,unique] [size_is(data_size)] uint8 *data,
+ [in] uint16 flags,
+ [in,out,unique] uint32 *record_number,
+ [in,out,unique] time_t *time_written
+ );
+
+ /*****************/
+ /* Function 0x0c */
+ [todo] NTSTATUS eventlog_ClearEventLogA();
+
+ /******************/
+ /* Function: 0x0d */
+ [todo] NTSTATUS eventlog_BackupEventLogA();
+
+ /*****************/
+ /* Function 0x0e */
+ [todo] NTSTATUS eventlog_OpenEventLogA();
+
+ /*****************/
+ /* Function 0x0f */
+ [todo] NTSTATUS eventlog_RegisterEventSourceA();
+
+ /*****************/
+ /* Function 0x10 */
+ [todo] NTSTATUS eventlog_OpenBackupEventLogA();
+
+ /*****************/
+ /* Function 0x11 */
+ [todo] NTSTATUS eventlog_ReadEventLogA();
+
+ /*****************/
+ /* Function 0x12 */
+ [todo] NTSTATUS eventlog_ReportEventA();
+
+ /*****************/
+ /* Function 0x13 */
+ [todo] NTSTATUS eventlog_RegisterClusterSvc();
+
+ /*****************/
+ /* Function 0x14 */
+ [todo] NTSTATUS eventlog_DeregisterClusterSvc();
+
+ /*****************/
+ /* Function 0x15 */
+ [todo] NTSTATUS eventlog_WriteClusterEvents();
+
+ /*****************/
+ /* Function 0x16 */
+
+ typedef [public] struct {
+ boolean32 full;
+ } EVENTLOG_FULL_INFORMATION;
+
+ NTSTATUS eventlog_GetLogInformation(
+ [in] policy_handle *handle,
+ [in] uint32 level,
+ [out,ref] [size_is(buf_size)] uint8 *buffer,
+ [in] [range(0,1024)] uint32 buf_size,
+ [out,ref] uint32 *bytes_needed
+ );
+
+ /*****************/
+ /* Function 0x17 */
+ NTSTATUS eventlog_FlushEventLog(
+ [in] policy_handle *handle
+ );
+
+ /*****************/
+ /* Function 0x18 */
+ NTSTATUS eventlog_ReportEventAndSourceW(
+ [in] policy_handle *handle,
+ [in] time_t timestamp,
+ [in] eventlogEventTypes event_type,
+ [in] uint16 event_category,
+ [in] uint32 event_id,
+ [in,ref] lsa_String *sourcename,
+ [in] [range(0,256)] uint16 num_of_strings,
+ [in] [range(0,0x3FFFF)] uint32 data_size,
+ [in,ref] lsa_String *servername,
+ [in,unique] dom_sid *user_sid,
+ [in,unique] [size_is(num_of_strings)] lsa_String **strings,
+ [in,unique] [size_is(data_size)] uint8 *data,
+ [in] uint16 flags,
+ [in,out,unique] uint32 *record_number,
+ [in,out,unique] time_t *time_written
+ );
+}
diff --git a/librpc/idl/eventlog6.idl b/librpc/idl/eventlog6.idl
new file mode 100644
index 0000000..57216cd
--- /dev/null
+++ b/librpc/idl/eventlog6.idl
@@ -0,0 +1,343 @@
+#include "idl_types.h"
+
+
+import "misc.idl";
+
+cpp_quote("#define MAX_RPC_GUID_ARRAY_COUNT (MAX_PAYLOAD / sizeof(struct GUID))")
+cpp_quote("#define eventlog6_EvtRpcSubscribePull 0x10000000")
+cpp_quote("#define eventlog6_EvtRpcVarFlagsModified 0x00000001")
+
+[
+ uuid (f6beaff7-1e19-4fbb-9f8f-b89e2018337c),
+ version(1.0),
+ endpoint("ncacn_ip_tcp:"),
+ helpstring("Eventlog6"),
+ pointer_default(unique)
+]
+interface eventlog6
+{
+ const int MAX_PAYLOAD = 2 * 1024 * 1024;
+ const int MAX_RPC_QUERY_LENGTH = MAX_PAYLOAD / sizeof(uint16_t);
+ const int MAX_RPC_CHANNEL_NAME_LENGTH = 512;
+ const int MAX_RPC_QUERY_CHANNEL_SIZE = 512;
+ const int MAX_RPC_EVENT_ID_SIZE = 256;
+ const int MAX_RPC_FILE_PATH_LENGTH = 32768;
+ const int MAX_RPC_CHANNEL_PATH_LENGTH = 32768;
+ const int MAX_RPC_BOOKMARK_LENGTH = MAX_PAYLOAD / sizeof(uint16_t);
+ const int MAX_RPC_PUBLISHER_ID_LENGTH = 2048;
+ const int MAX_RPC_PROPERTY_BUFFER_SIZE = MAX_PAYLOAD;
+ const int MAX_RPC_FILTER_LENGTH = MAX_RPC_QUERY_LENGTH;
+ const int MAX_RPC_RECORD_COUNT = 1024;
+ const int MAX_RPC_EVENT_SIZE = MAX_PAYLOAD;
+ const int MAX_RPC_BATCH_SIZE = MAX_PAYLOAD;
+ const int MAX_RPC_RENDERED_STRING_SIZE = MAX_PAYLOAD;
+ const int MAX_RPC_CHANNEL_COUNT = 8192;
+ const int MAX_RPC_PUBLISHER_COUNT = 8192;
+ const int MAX_RPC_EVENT_METADATA_COUNT = 256;
+ const int MAX_RPC_VARIANT_LIST_COUNT = 256;
+ const int MAX_RPC_BOOLEAN8_ARRAY_COUNT = MAX_PAYLOAD / sizeof(uint8_t);
+ const int MAX_RPC_UINT32_ARRAY_COUNT = MAX_PAYLOAD / sizeof(uint32_t);
+ const int MAX_RPC_UINT64_ARRAY_COUNT = MAX_PAYLOAD / sizeof(uint64_t);
+ const int MAX_RPC_STRING_ARRAY_COUNT = MAX_PAYLOAD / 512;
+ const int MAX_RPC_STRING_LENGTH = MAX_PAYLOAD / sizeof(uint16_t);
+
+ typedef struct {
+ uint32 error;
+ uint32 sub_err;
+ uint32 sub_err_param;
+ } eventlog6_RpcInfo;
+
+ typedef struct {
+ [range(0, MAX_RPC_BOOLEAN8_ARRAY_COUNT)] uint32 count;
+ [size_is(count)] boolean8* ptr;
+ } eventlog6_boolean8Array;
+
+ typedef struct {
+ [range(0, MAX_RPC_UINT32_ARRAY_COUNT)] uint32 count;
+ [size_is(count)] uint32* ptr;
+ } eventlog6_UInt32Array;
+
+ typedef struct {
+ [range(0, MAX_RPC_UINT64_ARRAY_COUNT)] uint32 count;
+ [size_is(count)] hyper* ptr;
+ } eventlog6_UInt64Array;
+
+ typedef struct {
+ [range(0, MAX_RPC_STRING_ARRAY_COUNT)] uint32 count;
+ [size_is(count),charset(UTF16),string] uint16 **ptr;
+ } eventlog6_StringArray;
+
+ typedef struct {
+ [range(0, MAX_RPC_GUID_ARRAY_COUNT)] uint32 count;
+ [size_is(count)] GUID* ptr;
+ } eventlog6_GuidArray;
+
+ typedef [v1_enum] enum {
+ EvtRpcVarTypeNull = 0,
+ EvtRpcVarTypeboolean8 = 1,
+ EvtRpcVarTypeUInt32 = 2,
+ EvtRpcVarTypeUInt64 = 3,
+ EvtRpcVarTypeString = 4,
+ EvtRpcVarTypeGuid = 5,
+ EvtRpcVarTypeboolean8Array = 6,
+ EvtRpcVarTypeUInt32Array = 7,
+ EvtRpcVarTypeUInt64Array = 8,
+ EvtRpcVarTypeStringArray = 9,
+ EvtRpcVarTypeGuidArray = 10
+ } eventlog6_EvtRpcVariantType;
+
+ typedef [v1_enum] enum {
+ EvtRpcChannelPath = 0,
+ EvtRpcPublisherName = 1
+ } eventlog6_EvtRpcAssertConfigFlags;
+
+ typedef [switch_type(eventlog6_EvtRpcVariantType)] union {
+ [case(EvtRpcVarTypeNull)] int nullVal;
+ [case(EvtRpcVarTypeboolean8)] boolean8 boolean8Val;
+ [case(EvtRpcVarTypeUInt32)] uint32 uint32Val;
+ [case(EvtRpcVarTypeUInt64)] hyper uint64Val;
+ [case(EvtRpcVarTypeString)] [charset(UTF16),string] uint16 *stringVal;
+ [case(EvtRpcVarTypeGuid)] GUID *guidVal;
+ [case(EvtRpcVarTypeboolean8Array)] eventlog6_boolean8Array boolean8Array;
+ [case(EvtRpcVarTypeUInt32Array)] eventlog6_UInt32Array uint32Array;
+ [case(EvtRpcVarTypeUInt64Array)] eventlog6_UInt64Array uint64Array;
+ [case(EvtRpcVarTypeStringArray)] eventlog6_StringArray stringArray;
+ [case(EvtRpcVarTypeGuidArray)] eventlog6_GuidArray guidArray;
+ } eventlog6_EvtRpcVariantUnion;
+
+ typedef struct {
+ eventlog6_EvtRpcVariantType type;
+ uint32 flags;
+ [in,ref,switch_is(type)] eventlog6_EvtRpcVariantUnion *var;
+ } eventlog6_EvtRpcVariant;
+
+ typedef struct {
+ [range(0, MAX_RPC_VARIANT_LIST_COUNT)] uint32 count;
+ [size_is(count)] eventlog6_EvtRpcVariant* props;
+ } eventlog6_EvtRpcVariantList;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *name;
+ uint32 status;
+ } eventlog6_EvtRpcQueryChannelInfo;
+
+ WERROR eventlog6_EvtRpcRegisterRemoteSubscription(
+ [in, unique, range(0, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath,
+ [in, range(1, MAX_RPC_QUERY_LENGTH),charset(UTF16),string] uint16 *query,
+ [in, unique, range(0, MAX_RPC_BOOKMARK_LENGTH),charset(UTF16),string] uint16 *bookmarkXml,
+ [in] uint32 flags,
+ [out, ref] policy_handle *handle,
+ [out, ref] policy_handle *control,
+ [out, ref] uint32 *queryChannelInfoSize,
+ [out, size_is(,*queryChannelInfoSize), range(0, MAX_RPC_QUERY_CHANNEL_SIZE)]
+ eventlog6_EvtRpcQueryChannelInfo **queryChannelInfo,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcRemoteSubscriptionNextAsync(
+ [in, ref] policy_handle *handle,
+ [in] uint32 numRequestedRecords,
+ [in] uint32 flags,
+ [out, ref] uint32 *numActualRecords,
+ [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)]
+ uint32 **eventDataIndices,
+ [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)]
+ uint32 **eventDataSizes,
+ [out, ref] uint32* resultBufferSize,
+ [out, size_is(,*resultBufferSize), range(0, MAX_RPC_BATCH_SIZE)]
+ uint8 **resultBuffer);
+
+ WERROR eventlog6_EvtRpcRemoteSubscriptionNext(
+ [in, ref] policy_handle *handle,
+ [in] uint32 numRequestedRecords,
+ [in] uint32 timeOut,
+ [in] uint32 flags,
+ [out, ref] uint32 *numActualRecords,
+ [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)]
+ uint32 **eventDataIndices,
+ [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)]
+ uint32 **eventDataSizes,
+ [out, ref] uint32 *resultBufferSize,
+ [out, size_is(,*resultBufferSize), range(0, MAX_RPC_BATCH_SIZE)]
+ uint8 **resultBuffer);
+
+ WERROR eventlog6_EvtRpcRemoteSubscriptionWaitAsync(
+ [in, ref] policy_handle *handle);
+
+ WERROR eventlog6_EvtRpcRegisterControllableOperation(
+ [out, ref] policy_handle *handle);
+
+ WERROR eventlog6_EvtRpcRegisterLogQuery(
+ [in, unique, range(0, MAX_RPC_CHANNEL_PATH_LENGTH),charset(UTF16),string] uint16 *path,
+ [in, range(1, MAX_RPC_QUERY_LENGTH),charset(UTF16),string] uint16 *query,
+ [in] uint32 flags,
+ [out, ref] policy_handle *handle,
+ [out, ref] policy_handle *opControl,
+ [out, ref] uint32 *queryChannelInfoSize,
+ [out, size_is(,*queryChannelInfoSize), range(0, MAX_RPC_QUERY_CHANNEL_SIZE)]
+ eventlog6_EvtRpcQueryChannelInfo **queryChannelInfo,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcClearLog(
+ [in, ref] policy_handle *control,
+ [in, range(0, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath,
+ [in, unique, range(0, MAX_RPC_FILE_PATH_LENGTH),charset(UTF16),string] uint16 *backupPath,
+ [in] uint32 flags,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcExportLog(
+ [in, ref] policy_handle *control,
+ [in, unique, range(0, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath,
+ [in, range(1, MAX_RPC_QUERY_LENGTH),charset(UTF16),string] uint16 *query,
+ [in, range(1, MAX_RPC_FILE_PATH_LENGTH),charset(UTF16),string] uint16 *backupPath,
+ [in] uint32 flags,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcLocalizeExportLog(
+ [in, ref] policy_handle *control,
+ [in, range(1, MAX_RPC_FILE_PATH_LENGTH),charset(UTF16),string] uint16 *logFilePath,
+ [in] uint32 locale,
+ [in] uint32 flags,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcMessageRender(
+ [in, ref] policy_handle *pubCfgObj,
+ [in, range(1, MAX_RPC_EVENT_ID_SIZE)] uint32 sizeEventId,
+ [in, size_is(sizeEventId)] uint8 *eventId,
+ [in] uint32 messageId,
+ [in] eventlog6_EvtRpcVariantList *values,
+ [in] uint32 flags,
+ [in] uint32 maxSizeString,
+ [out, ref] uint32 *actualSizeString,
+ [out, ref] uint32 *neededSizeString,
+ [out, size_is(,*actualSizeString), range(0, MAX_RPC_RENDERED_STRING_SIZE)]
+ uint8 **string,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcMessageRenderDefault(
+ [in, range(1, MAX_RPC_EVENT_ID_SIZE)] uint32 sizeEventId,
+ [in, size_is(sizeEventId)] uint8 *eventId,
+ [in] uint32 messageId,
+ [in] eventlog6_EvtRpcVariantList *values,
+ [in] uint32 flags,
+ [in] uint32 maxSizeString,
+ [out, ref] uint32 *actualSizeString,
+ [out, ref] uint32 *neededSizeString,
+ [out, size_is(,*actualSizeString), range(0, MAX_RPC_RENDERED_STRING_SIZE)]
+ uint8 **string,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcQueryNext(
+ [in, ref] policy_handle *logQuery,
+ [in] uint32 numRequestedRecords,
+ [in] uint32 timeOutEnd,
+ [in] uint32 flags,
+ [out, ref] uint32 *numActualRecords,
+ [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)]
+ uint32 **eventDataIndices,
+ [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)]
+ uint32 **eventDataSizes,
+ [out, ref] uint32 *resultBufferSize,
+ [out, size_is(,*resultBufferSize), range(0, MAX_RPC_BATCH_SIZE)]
+ uint8 **resultBuffer);
+
+ WERROR eventlog6_EvtRpcQuerySeek(
+ [in, ref] policy_handle *logQuery,
+ [in] hyper pos,
+ [in, unique, range(0, MAX_RPC_BOOKMARK_LENGTH),charset(UTF16),string] uint16 *bookmarkXml,
+ [in] uint32 timeOut,
+ [in] uint32 flags,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcClose(
+ [in, out, ref] policy_handle **handle);
+
+ WERROR eventlog6_EvtRpcCancel(
+ [in, ref] policy_handle *handle);
+
+ WERROR eventlog6_EvtRpcAssertConfig(
+ [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *path,
+ [in] uint32 flags);
+
+ WERROR eventlog6_EvtRpcRetractConfig(
+ [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *path,
+ [in] uint32 flags );
+
+ WERROR eventlog6_EvtRpcOpenLogHandle(
+ [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channel,
+ [in] uint32 flags,
+ [out, ref] policy_handle *handle,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcGetLogFileInfo(
+ [in, ref] policy_handle *logHandle,
+ [in] uint32 propertyId,
+ [in, range(0, MAX_RPC_PROPERTY_BUFFER_SIZE)]
+ uint32 propertyValueBufferSize,
+ [out, size_is(propertyValueBufferSize)] uint8 *propertyValueBuffer,
+ [out, ref] uint32 *propertyValueBufferLength);
+
+ WERROR eventlog6_EvtRpcGetChannelList(
+ [in] uint32 flags,
+ [out, ref] uint32 *numChannelPaths,
+ [out, size_is(,*numChannelPaths), range(0, MAX_RPC_CHANNEL_COUNT),charset(UTF16),string]
+ uint16 ***channelPaths);
+
+ WERROR eventlog6_EvtRpcGetChannelConfig(
+ [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath,
+ [in] uint32 flags,
+ [out, ref] eventlog6_EvtRpcVariantList* props);
+
+ WERROR eventlog6_EvtRpcPutChannelConfig(
+ [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath,
+ [in] uint32 flags,
+ [in] eventlog6_EvtRpcVariantList* props,
+ [out, ref] eventlog6_RpcInfo *error);
+
+ WERROR eventlog6_EvtRpcGetPublisherList(
+ [in] uint32 flags,
+ [out, ref] uint32 *numPublisherIds,
+ [out, size_is(,*numPublisherIds), range(0, MAX_RPC_PUBLISHER_COUNT),charset(UTF16),string]
+ uint16 ***publisherIds);
+
+ WERROR eventlog6_EvtRpcGetPublisherListForChannel(
+ [in] uint16 *channelName,
+ [in] uint32 flags,
+ [out, ref] uint32* numPublisherIds,
+ [out, size_is(,*numPublisherIds), range(0, MAX_RPC_PUBLISHER_COUNT),charset(UTF16),string]
+ uint16 ***publisherIds);
+
+ WERROR eventlog6_EvtRpcGetPublisherMetadata(
+ [in, unique, range(0, MAX_RPC_PUBLISHER_ID_LENGTH),charset(UTF16),string] uint16 *publisherId,
+ [in, unique, range(0, MAX_RPC_FILE_PATH_LENGTH),charset(UTF16),string] uint16 *logFilePath,
+ [in] uint32 locale,
+ [in] uint32 flags,
+ [out, ref] eventlog6_EvtRpcVariantList* pubMetadataProps,
+ [out, ref] policy_handle *pubMetadata);
+
+ WERROR eventlog6_EvtRpcGetPublisherResourceMetadata(
+ [in, ref] policy_handle *handle,
+ [in] uint32 propertyId,
+ [in] uint32 flags,
+ [out, ref] eventlog6_EvtRpcVariantList *pubMetadataProps);
+
+ WERROR eventlog6_EvtRpcGetEventMetadataEnum(
+ [in, ref] policy_handle *pubMetadata,
+ [in] uint32 flags,
+ [in, unique, range(0, MAX_RPC_FILTER_LENGTH),charset(UTF16),string] uint16 *reservedForFilter,
+ [out, ref] policy_handle *eventMetaDataEnum);
+
+ WERROR eventlog6_EvtRpcGetNextEventMetadata(
+ [in, ref] policy_handle *eventMetaDataEnum,
+ [in] uint32 flags,
+ [in] uint32 numRequested,
+ [out, ref] uint32 *numReturned,
+ [out, size_is(,*numReturned), range(0, MAX_RPC_EVENT_METADATA_COUNT)]
+ eventlog6_EvtRpcVariantList **eventMetadataInstances);
+
+ WERROR eventlog6_EvtRpcGetClassicLogDisplayName(
+ [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *logName,
+ [in] uint32 locale,
+ [in] uint32 flags,
+ [out] uint16 **displayName);
+}
+
diff --git a/librpc/idl/file_id.idl b/librpc/idl/file_id.idl
new file mode 100644
index 0000000..cd1febe
--- /dev/null
+++ b/librpc/idl/file_id.idl
@@ -0,0 +1,14 @@
+[
+ pointer_default(unique)
+]
+interface file_id
+{
+ typedef [public] struct {
+ /* we don't use SMB_DEV_T and SMB_INO_T as we want a fixed size here,
+ and we may be using file system specific code to fill in something
+ other than a dev_t for the device */
+ udlong devid;
+ udlong inode;
+ udlong extid; /* Support systems that use an extended id (e.g. snapshots). */
+ } file_id;
+}
diff --git a/librpc/idl/frsapi.idl b/librpc/idl/frsapi.idl
new file mode 100644
index 0000000..ea7880c
--- /dev/null
+++ b/librpc/idl/frsapi.idl
@@ -0,0 +1,128 @@
+#include "idl_types.h"
+
+import "misc.idl";
+
+[
+ 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 */
+ [todo] void FRSAPI_VERIFY_PROMOTION();
+
+ /****************/
+ /* Function 0x01 */
+ [todo] void FRSAPI_PROMOTION_STATUS();
+
+ /****************/
+ /* Function 0x02 */
+ [todo] void FRSAPI_START_DEMOTION();
+
+ /****************/
+ /* Function 0x03 */
+ [todo] void FRSAPI_COMMIT_DEMOTION();
+
+ /****************/
+ /* Function 0x04 */
+
+ /* The DsPollingLongInterval and DsPollingShortInterval attributes
+ represent registry attributes below HKLM\System\CCS\Services\NtFrs */
+
+ WERROR frsapi_SetDsPollingIntervalW(
+ [in] uint32 CurrentInterval,
+ [in] uint32 DsPollingLongInterval,
+ [in] uint32 DsPollingShortInterval
+ );
+
+ /****************/
+ /* Function 0x05 */
+ WERROR frsapi_GetDsPollingIntervalW(
+ [out] uint32 *CurrentInterval,
+ [out] uint32 *DsPollingLongInterval,
+ [out] uint32 *DsPollingShortInterval
+ );
+
+ /****************/
+ /* Function 0x06 */
+ [todo] void FRSAPI_VERIFY_PROMOTION_W();
+
+ /****************/
+ /* Function 0x07 */
+ typedef [v1_enum] enum {
+ FRSAPI_INFO_VERSION = 0,
+ FRSAPI_INFO_SETS = 1,
+ FRSAPI_INFO_DS = 2,
+ FRSAPI_INFO_MEMORY = 3,
+ FRSAPI_INFO_IDTABLE = 4,
+ FRSAPI_INFO_OUTLOG = 5,
+ FRSAPI_INFO_INLOG = 6,
+ FRSAPI_INFO_THREADS = 7,
+ FRSAPI_INFO_STAGE = 8,
+ FRSAPI_INFO_CONFIGTABLE = 9
+ } frsapi_InfoEnum;
+
+ typedef struct {
+ uint32 length;
+ GUID guid;
+ uint32 length2;
+ uint32 unknown1;
+ frsapi_InfoEnum level;
+ uint32 query_counter;
+ uint32 unknown2;
+ uint32 offset;
+ uint32 blob_len;
+ /* [size_is(length-offset)] uint8 *data; */
+ [subcontext_size(length-offset),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB blob;
+ } frsapi_Info;
+
+ WERROR frsapi_InfoW(
+ [in] [range(0,0x10000)] uint32 length,
+ /* [in,out] [size_is(length)] [unique] uint8 *data */
+ [in,out,unique] frsapi_Info *info
+
+ );
+
+ /****************/
+ /* Function 0x08 */
+ typedef [v1_enum] enum {
+ FRSAPI_REPLICA_SET_TYPE_0 = 0x00000000,
+ FRSAPI_REPLICA_SET_TYPE_DOMAIN = 0x00000002,
+ FRSAPI_REPLICA_SET_TYPE_DFS = 0x00000003
+ } frsapi_ReplicaSetType;
+
+ WERROR frsapi_IsPathReplicated(
+ [in,unique] [string,charset(UTF16)] uint16 *path,
+ [in] frsapi_ReplicaSetType replica_set_type,
+ [out] uint32 *replicated,
+ [out] uint32 *primary,
+ [out] uint32 *root,
+ [out] GUID *replica_set_guid
+ );
+
+ /****************/
+ /* Function 0x09 */
+ typedef [v1_enum] enum {
+ FRSAPI_WRITER_COMMAND_FREEZE = 0x00000001,
+ FRSAPI_WRITER_COMMAND_THAW = 0x00000002
+ } frsapi_WriterCommandsValues;
+
+ WERROR frsapi_WriterCommand(
+ [in] frsapi_WriterCommandsValues command
+ );
+
+ /****************/
+ /* Function 0x0a */
+ /* not supported before w2k3 sp2 */
+ WERROR frsapi_ForceReplication(
+ [in,unique] GUID *replica_set_guid,
+ [in,unique] GUID *connection_guid,
+ [in,unique] [charset(UTF16),string] uint16 *replica_set_name,
+ [in,unique] [charset(UTF16),string] uint16 *partner_dns_name
+ );
+
+}
diff --git a/librpc/idl/frsrpc.idl b/librpc/idl/frsrpc.idl
new file mode 100644
index 0000000..016095f
--- /dev/null
+++ b/librpc/idl/frsrpc.idl
@@ -0,0 +1,458 @@
+#include "idl_types.h"
+
+import "misc.idl";
+import "fscc.idl";
+import "bkupblobs.idl";
+
+[
+ uuid("f5cc59b4-4264-101a-8c59-08002b2f8426"),
+ version(1.1),
+ endpoint("ncacn_ip_tcp:", "ncalrpc:"),
+ helpstring("File Replication Service"),
+ helper("../librpc/ndr/ndr_frsrpc.h"),
+ pointer_default(unique)
+]
+interface frsrpc
+{
+
+ /*****************/
+ /* Function 0x00 */
+
+ typedef struct {
+ [subcontext(4)] GUID guid;
+ [subcontext(4)] nstring name;
+ } frsrpc_CommPktChunkGuidName;
+
+ typedef struct {
+ hyper vsn;
+ GUID guid;
+ } frsrpc_CommPktGSVN;
+
+ typedef [bitmap32bit,flag(NDR_PAHEX)] bitmap {
+ FRSRPC_CO_FLAG_ABORT_CO = 0x00000001,
+ FRSRPC_CO_FLAG_VV_ACTIVATED = 0x00000002,
+ FRSRPC_CO_FLAG_CONTENT_CMD = 0x00000004,
+ FRSRPC_CO_FLAG_LOCATION_CMD = 0x00000008,
+ FRSRPC_CO_FLAG_ONLIST = 0x00000010,
+ FRSRPC_CO_FLAG_LOCALCO = 0x00000020,
+ FRSRPC_CO_FLAG_RETRY = 0x00000040,
+ FRSRPC_CO_FLAG_INST_INCOMPLETE = 0x00000080,
+ FRSRPC_CO_FLAG_OUT_OF_ORDER = 0x00000200,
+ FRSRPC_CO_FLAG_NEW_FILE = 0x00000400,
+ FRSRPC_CO_FLAG_CONTROL = 0x00001000,
+ FRSRPC_CO_FLAG_DIRECTED_CO = 0x00002000,
+ FRSRPC_CO_FLAG_VVJOIN_TO_ORIG = 0x00040000,
+ FRSRPC_CO_FLAG_SKIP_ORIG_REC_C = 0x00100000,
+ FRSRPC_CO_FLAG_MOVEIN_GEN = 0x00200000,
+ FRSRPC_CO_FLAG_MORPH_GEN_HEAD = 0x00400000,
+ FRSRPC_CO_FLAG_JUST_OID_RESET = 0x00800000,
+ FRSRPC_CO_FLAG_COMPRESSED_STAGE = 0x01000000,
+ FRSRPC_CO_FLAG_SKIP_VV_UPDATE = 0x02000000
+ } frsrpc_CommPktCoCmdFlags;
+
+ const uint32 FRSRPC_CO_IFLAG_NONE = 0x0000000;
+
+ const string FRSRPC_COMPRESSION_GUID = "64d2f7d2-2695-436d-8830-8d3c58701e15";
+
+
+ typedef [bitmap32bit,flag(NDR_PAHEX)] bitmap {
+ FRSRPC_CO_IFLAG_VVRETIRE_EXEC = 0x00000001,
+ FRSRPC_CO_IFLAG_CO_ABORT = 0x00000002,
+ FRSRPC_CO_IFLAG_DIR_ENUM_PENDING= 0x00000004
+ } frsrpc_CommPktCoCmdIFlags;
+
+ typedef [v1_enum,flag(NDR_PAHEX)] enum {
+ FRSRPC_CO_STATUS_CO_ENTERED_LOG = 0x00000000,
+ FRSRPC_CO_STATUS_ALLOC_STAGING_LOCAL_CO = 0x00000001,
+ FRSRPC_CO_STATUS_LOCAL_CO_STAGING_STARTED = 0x00000002,
+ FRSRPC_CO_STATUS_LOCAL_CO_STAGING_COMPLETED = 0x00000003,
+ FRSRPC_CO_STATUS_WAIT_RETRY_LOCAL_CO_STAGING = 0x00000004,
+ FRSRPC_CO_STATUS_ALLOC_STAGING_REMOTE_CO = 0x00000005,
+ FRSRPC_CO_STATUS_REMOTE_CO_STAGING_STARTED = 0x00000006,
+ FRSRPC_CO_STATUS_REMOTE_CO_STAGING_COMPLETED = 0x00000007,
+ FRSRPC_CO_STATUS_WAIT_RETRY_REMOTE_CO_STAGING = 0x00000008,
+ FRSRPC_CO_STATUS_FILE_INSTALL_REQUESTED = 0x00000009,
+ FRSRPC_CO_STATUS_FILE_INSTALL_STARTED = 0x0000000A,
+ FRSRPC_CO_STATUS_FILE_INSTALL_COMPLETED = 0x0000000B,
+ FRSRPC_CO_STATUS_FILE_INSTALL_WAIT_RETRY = 0x0000000C,
+ FRSRPC_CO_STATUS_FILE_INSTALL_RETRYING = 0x0000000D,
+ FRSRPC_CO_STATUS_FILE_INSTALL_RENAME_RETRYING = 0x0000000E,
+ FRSRPC_CO_STATUS_FILE_INSTALL_DELETE_RETRYING = 0x0000000F,
+ FRSRPC_CO_STATUS_CO_RECYCLED_FOR_ENUM = 0x00000013,
+ FRSRPC_CO_STATUS_REQUEST_OUTBOUND_PROPAGATION = 0x00000014,
+ FRSRPC_CO_STATUS_REQUEST_ACCEPTED_OUTBOUND_LOG = 0x00000015,
+ FRSRPC_CO_STATUS_DB_STATE_UPDATE_STARTED = 0x00000016,
+ FRSRPC_CO_STATUS_DB_STATE_UPDATE_COMPLETED = 0x00000017,
+ FRSRPC_CO_STATUS_CO_ABORTED = 0x00000018
+ } frsrpc_CommPktCoCmdStatus;
+
+ typedef [bitmap32bit,flag(NDR_PAHEX)] bitmap {
+ FRSRPC_CONTENT_REASON_DATA_OVERWRITE = 0x00000001,
+ FRSRPC_CONTENT_REASON_DATA_EXTEND = 0x00000002,
+ FRSRPC_CONTENT_REASON_DATA_TRUNCATION = 0x00000004,
+ FRSRPC_CONTENT_REASON_NAMED_DATA_OVERWRITE = 0x00000010,
+ FRSRPC_CONTENT_REASON_NAMED_DATA_EXTEND = 0x00000020,
+ FRSRPC_CONTENT_REASON_NAMED_DATA_TRUNCATION = 0x00000040,
+ FRSRPC_CONTENT_REASON_FILE_CREATE = 0x00000100,
+ FRSRPC_CONTENT_REASON_FILE_DELETE = 0x00000200,
+ FRSRPC_CONTENT_REASON_EA_CHANGE = 0x00000400,
+ FRSRPC_CONTENT_REASON_SECURITY_CHANGE = 0x00000800,
+ FRSRPC_CONTENT_REASON_OLD_NAME = 0x00001000,
+ FRSRPC_CONTENT_REASON_NEW_NAME = 0x00002000,
+ FRSRPC_CONTENT_REASON_BASIC_INFO_CHANGE = 0x00004000,
+ FRSRPC_CONTENT_REASON_COMPRESSION_CHANGE = 0x00020000
+ } frsrpc_CommPktCoCmdContentCmd;
+
+ typedef [v1_enum,flag(NDR_PAHEX)] enum {
+ FRSRPC_CO_LOCATION_FILE_CREATE = 0x00000000,
+ FRSRPC_CO_LOCATION_DIR_CREATE = 0x00000000 | 0x00000001,
+ FRSRPC_CO_LOCATION_FILE_DELETE = 0x00000002,
+ FRSRPC_CO_LOCATION_DIR_DELETE = 0x00000002 | 0x00000001,
+ FRSRPC_CO_LOCATION_FILE_MOVEIN = 0x00000004,
+ FRSRPC_CO_LOCATION_DIR_MOVEIN = 0x00000004 | 0x00000001,
+ FRSRPC_CO_LOCATION_FILE_MOVEIN2 = 0x00000006,
+ FRSRPC_CO_LOCATION_DIR_MOVEIN2 = 0x00000006 | 0x00000001,
+ FRSRPC_CO_LOCATION_FILE_MOVEOUT = 0x00000008,
+ FRSRPC_CO_LOCATION_DIR_MOVEOUT = 0x00000008 | 0x00000001,
+ FRSRPC_CO_LOCATION_FILE_MOVERS = 0x0000000a,
+ FRSRPC_CO_LOCATION_DIR_MOVERS = 0x0000000a | 0x00000001,
+ FRSRPC_CO_LOCATION_FILE_MOVEDIR = 0x0000000c,
+ FRSRPC_CO_LOCATION_DIR_MOVEDIR = 0x0000000c | 0x00000001,
+ FRSRPC_CO_LOCATION_FILE_NO_CMD = 0x0000000e,
+ FRSRPC_CO_LOCATION_DIR_NO_CMD = 0x0000000e | 0x00000001
+ } frsrpc_CommPktCoCmdLocationCmd;
+
+ [public] typedef struct {
+ uint32 sequence_number;
+ frsrpc_CommPktCoCmdFlags flags;
+ frsrpc_CommPktCoCmdIFlags iflags;
+ frsrpc_CommPktCoCmdStatus status;
+ frsrpc_CommPktCoCmdContentCmd content_cmd;
+ frsrpc_CommPktCoCmdLocationCmd location_cmd;
+ uint32 file_attributes;
+ uint32 file_version_number;
+ uint32 partern_ack_sequence_number;
+ [value(0)] uint32 not_used;
+ hyper file_size;
+ hyper file_offset;
+ hyper frs_vsn;
+ hyper file_usn;
+ hyper jrnl_usn;
+ hyper jrnl_first_usn;
+ uint32 original_replica_num;
+ uint32 new_replica_num;
+ GUID change_order_guid;
+ GUID originator_guid;
+ GUID file_guid;
+ GUID old_parent_guid;
+ GUID new_parent_guid;
+ GUID connection_guid;
+ hyper ack_version;
+ [value(0)] hyper spare2ul1;
+ [value(0)] hyper spare1guid_p1;
+ [value(0)] hyper spare1guid_p2;
+ [value(0)] hyper spare2guid_p1;
+ [value(0)] hyper spare3guid_p2;
+ [value(0)] uint32 spare1wcs;
+ [value(0)] uint32 spare2wcs;
+ [value(0)] uint32 extension;
+ [value(0)] uint32 spare2bin;
+ NTTIME event_time;
+ [value(2*strlen_m(file_name))] uint16 file_name_length;
+#define FRSRPC_MAX_PATH 260
+ [charset(UTF16)] uint16 file_name[FRSRPC_MAX_PATH+1];
+ [value(0)] uint8 padding1;
+ [value(0)] uint8 padding2;
+ [value(0)] uint8 padding3;
+ [value(0)] uint8 padding4;
+ } frsrpc_CommPktChangeOrderCommand;
+
+ typedef [v1_enum,flag(NDR_PAHEX)] enum {
+ FRSRPC_DATA_EXTENSION_TERMINATOR = 0x00000000,
+ FRSRPC_DATA_EXTENSION_MD5_CHECKSUM = 0x00000001,
+ FRSRPC_DATA_EXTENSION_RETRY_TIMEOUT = 0x00000002
+ } frsrpc_CommPktDataExtensionType;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ [value(0x00000018)] uint32 prefix_size;
+ [value(FRSRPC_DATA_EXTENSION_MD5_CHECKSUM)]
+ frsrpc_CommPktDataExtensionType prefix_type;
+ uint8 data[16];
+ } frsrpc_CommPktDataExtensionChecksum;
+
+ typedef struct {
+ [value(0x00000018)] uint32 prefix_size;
+ [value(FRSRPC_DATA_EXTENSION_RETRY_TIMEOUT)]
+ frsrpc_CommPktDataExtensionType prefix_type;
+ uint32 count;
+ [value(0)] uint32 not_used;
+ NTTIME first_try_time;
+ } frsrpc_CommPktDataExtensionRetryTimeout;
+
+ typedef [flag(NDR_PAHEX)] enum {
+ FRSRPC_CO_RECORD_EXTENSION_VERSION_WIN2K = 0x0000,
+ FRSRPC_CO_RECORD_EXTENSION_VERSION_1 = 0x0001
+ } frsrpc_CommPktCoRecordExtensionMajor;
+
+ typedef struct {
+ [value(0x00000028)] uint32 field_size;
+ [value(FRSRPC_CO_RECORD_EXTENSION_VERSION_WIN2K)]
+ frsrpc_CommPktCoRecordExtensionMajor major;
+ [value(0x0001)] uint16 offset_count;
+ [value(0x00000010)] uint32 offset;
+ [value(0)] uint32 offset_last;
+ frsrpc_CommPktDataExtensionChecksum data_checksum;
+ } frsrpc_CommPktCoRecordExtensionWin2k;
+
+ typedef struct {
+ [value(0x00000048)] uint32 field_size;
+ frsrpc_CommPktCoRecordExtensionMajor major;
+ [value(0x0002)] uint16 offset_count;
+ [value(0x00000018)] uint32 offset0;
+ [value(0x00000030)] uint32 offset1;
+ [value(0)] uint32 offset_last;
+ [value(0)] uint32 not_used;
+ frsrpc_CommPktDataExtensionChecksum data_checksum;
+ frsrpc_CommPktDataExtensionRetryTimeout data_retry_timeout;
+ } frsrpc_CommPktChangeOrderRecordExtension;
+
+ typedef [v1_enum,flag(NDR_PAHEX)] enum {
+ FRSRPC_COMMAND_REMOTE_CO = 0x00000218,
+ FRSRPC_COMMAND_RECEIVING_STATE = 0x00000238,
+ FRSRPC_COMMAND_REMOTE_CO_DONE = 0x00000250,
+ FRSRPC_COMMAND_ABORT_FETCH = 0x00000246,
+ FRSRPC_COMMAND_RETRY_FETCH = 0x00000244,
+ FRSRPC_COMMAND_NEED_JOIN = 0x00000121,
+ FRSRPC_COMMAND_START_JOIN = 0x00000122,
+ FRSRPC_COMMAND_JOINING = 0x00000130,
+ FRSRPC_COMMAND_JOINED = 0x00000128,
+ FRSRPC_COMMAND_UNJOIN_REMOTE = 0x00000148,
+ FRSRPC_COMMAND_VVJOIN_DONE = 0x00000136,
+ FRSRPC_COMMAND_SEND_STAGE = 0x00000228
+ } frsrpc_CommPktCommand;
+
+ typedef [flag(NDR_PAHEX)] enum {
+ FRSRPC_COMM_PKT_CHUNK_BOP = 0x0001,
+ FRSRPC_COMM_PKT_CHUNK_COMMAND = 0x0002,
+ FRSRPC_COMM_PKT_CHUNK_TO = 0x0003,
+ FRSRPC_COMM_PKT_CHUNK_FROM = 0x0004,
+ FRSRPC_COMM_PKT_CHUNK_REPLICA = 0x0005,
+ FRSRPC_COMM_PKT_CHUNK_CONNECTION = 0x0008,
+ FRSRPC_COMM_PKT_CHUNK_JOIN_GUID = 0x0006,
+ FRSRPC_COMM_PKT_CHUNK_LAST_JOIN_TIME = 0x0012,
+
+ FRSRPC_COMM_PKT_CHUNK_VVECTOR = 0x0007,
+ FRSRPC_COMM_PKT_CHUNK_JOIN_TIME = 0x0011,
+ FRSRPC_COMM_PKT_CHUNK_REPLICA_VERSION_GUID = 0x0014,
+ FRSRPC_COMM_PKT_CHUNK_COMPRESSION_GUID = 0x0018,
+
+ FRSRPC_COMM_PKT_CHUNK_BLOCK = 0x0009,
+ FRSRPC_COMM_PKT_CHUNK_BLOCK_SIZE = 0x000A,
+ FRSRPC_COMM_PKT_CHUNK_FILE_SIZE = 0x000B,
+ FRSRPC_COMM_PKT_CHUNK_FILE_OFFSET = 0x000C,
+ FRSRPC_COMM_PKT_CHUNK_GVSN = 0x000E,
+ FRSRPC_COMM_PKT_CHUNK_CO_GUID = 0x000F,
+ FRSRPC_COMM_PKT_CHUNK_CO_SEQUENCE_NUMBER = 0x0010,
+
+ FRSRPC_COMM_PKT_CHUNK_REMOTE_CO = 0x000D,
+ FRSRPC_COMM_PKT_CHUNK_CO_EXT_WIN2K = 0x0016,
+ FRSRPC_COMM_PKT_CHUNK_CO_EXTENTION_2 = 0x0017,
+
+ FRSRPC_COMM_PKT_CHUNK_EOP = 0x0013
+ } frsrpc_CommPktChunkType;
+
+ typedef [nodiscriminant] union {
+ [default,flag(NDR_REMAINING)] DATA_BLOB blob;
+ [case(FRSRPC_COMM_PKT_CHUNK_BOP)]
+ [value(0)] uint32 bop;
+ [case(FRSRPC_COMM_PKT_CHUNK_COMMAND)]
+ frsrpc_CommPktCommand command;
+ [case(FRSRPC_COMM_PKT_CHUNK_TO)]
+ frsrpc_CommPktChunkGuidName to;
+ [case(FRSRPC_COMM_PKT_CHUNK_FROM)]
+ frsrpc_CommPktChunkGuidName from;
+ [case(FRSRPC_COMM_PKT_CHUNK_REPLICA)]
+ frsrpc_CommPktChunkGuidName replica;
+ [case(FRSRPC_COMM_PKT_CHUNK_CONNECTION)]
+ frsrpc_CommPktChunkGuidName connection;
+ [case(FRSRPC_COMM_PKT_CHUNK_JOIN_GUID)][subcontext(4)]
+ GUID join_guid;
+ [case(FRSRPC_COMM_PKT_CHUNK_LAST_JOIN_TIME)]
+ NTTIME last_join_time;
+ [case(FRSRPC_COMM_PKT_CHUNK_VVECTOR)][subcontext(4)]
+ frsrpc_CommPktGSVN vvector;
+ [case(FRSRPC_COMM_PKT_CHUNK_JOIN_TIME)][subcontext(4)]
+ NTTIME join_time;
+ [case(FRSRPC_COMM_PKT_CHUNK_REPLICA_VERSION_GUID)][subcontext(4)]
+ GUID replica_version_guid;
+ [case(FRSRPC_COMM_PKT_CHUNK_COMPRESSION_GUID)]
+ GUID compression_guid;
+ [case(FRSRPC_COMM_PKT_CHUNK_BLOCK)]
+ DATA_BLOB block;
+ [case(FRSRPC_COMM_PKT_CHUNK_BLOCK_SIZE)]
+ hyper block_size;
+ [case(FRSRPC_COMM_PKT_CHUNK_FILE_SIZE)]
+ hyper file_size;
+ [case(FRSRPC_COMM_PKT_CHUNK_FILE_OFFSET)]
+ hyper file_offset;
+ [case(FRSRPC_COMM_PKT_CHUNK_GVSN)][subcontext(4)]
+ frsrpc_CommPktGSVN gvsn;
+ [case(FRSRPC_COMM_PKT_CHUNK_CO_GUID)][subcontext(4)]
+ GUID co_guid;
+ [case(FRSRPC_COMM_PKT_CHUNK_CO_SEQUENCE_NUMBER)]
+ uint32 co_sequence_number;
+ [case(FRSRPC_COMM_PKT_CHUNK_REMOTE_CO)][subcontext(4)]
+ frsrpc_CommPktChangeOrderCommand remote_co;
+ [case(FRSRPC_COMM_PKT_CHUNK_CO_EXT_WIN2K)][subcontext(4)]
+ frsrpc_CommPktCoRecordExtensionWin2k co_ext_win2k;
+ [case(FRSRPC_COMM_PKT_CHUNK_CO_EXTENTION_2)]
+ frsrpc_CommPktChangeOrderRecordExtension co_extension2;
+ [case(FRSRPC_COMM_PKT_CHUNK_EOP)]
+ [value(0xFFFFFFFF)] uint32 bopend;
+ } frsrpc_CommPktChunkData;
+
+ typedef [public,flag(NDR_NOALIGN)] struct {
+ frsrpc_CommPktChunkType type;
+ [subcontext(4),switch_is(type)] frsrpc_CommPktChunkData data;
+ } frsrpc_CommPktChunk;
+
+ typedef [nopull,nopush,flag(NDR_NOALIGN)] struct {
+ uint32 num_chunks; /* this doesn't appear on the wire */
+ frsrpc_CommPktChunk chunks[num_chunks];
+ } frsrpc_CommPktChunkCtr;
+
+ typedef [v1_enum] enum {
+ FRSRPC_COMM_PKT_MAJOR_0 = 0x00000000
+ } frsrpc_CommPktMajor;
+
+ typedef [v1_enum] enum {
+ FRSRPC_COMM_PKT_MINOR_0 = 0x00000000,
+ FRSRPC_COMM_PKT_MINOR_1 = 0x00000001,
+ FRSRPC_COMM_PKT_MINOR_2 = 0x00000002,
+ FRSRPC_COMM_PKT_MINOR_3 = 0x00000003,
+ FRSRPC_COMM_PKT_MINOR_4 = 0x00000004,
+ FRSRPC_COMM_PKT_MINOR_5 = 0x00000005,
+ FRSRPC_COMM_PKT_MINOR_6 = 0x00000006,
+ FRSRPC_COMM_PKT_MINOR_7 = 0x00000007,
+ FRSRPC_COMM_PKT_MINOR_8 = 0x00000008,
+ FRSRPC_COMM_PKT_MINOR_9 = 0x00000009
+ } frsrpc_CommPktMinor;
+
+ [public] typedef struct {
+ frsrpc_CommPktMajor major;
+ frsrpc_CommPktMinor minor;
+ [value(1)] uint32 cs_id;
+ [value(pkt_len+12)] uint32 memory_len;
+ [value(ndr_size_frsrpc_CommPktChunkCtr(r->ctr,
+ ndr->flags))]
+ [range(0, 262144)]
+ uint32 pkt_len;
+ [value(0)] uint32 upk_len;
+ [subcontext(4),subcontext_size(pkt_len)]
+ frsrpc_CommPktChunkCtr *ctr;
+ [value(0)] uint3264 data_name;
+ [value(0)] uint3264 data_handle;
+ } frsrpc_FrsSendCommPktReq;
+
+ WERROR frsrpc_FrsSendCommPkt(
+ [in] frsrpc_FrsSendCommPktReq req
+ );
+
+ /*****************/
+ /* Function 0x01 */
+ /* this function always return WERR_CALL_NOT_IMPLEMENTED */
+ WERROR frsrpc_FrsVerifyPromotionParent(
+ [in,unique,string,charset(UTF16)] uint16 *parent_account,
+ [in,unique,string,charset(UTF16)] uint16 *parent_password,
+ [in,unique,string,charset(UTF16)] uint16 *replica_set_name,
+ [in,unique,string,charset(UTF16)] uint16 *replica_set_type,
+ [in] frsrpc_PartnerAuthLevel partner_auth_level,
+ [in] uint32 __ndr_guid_size
+ );
+
+ /*****************/
+ /* Function 0x02 */
+ typedef [v1_enum,flag(NDR_PAHEX)] enum {
+ FRSRPC_PARENT_AUTH_LEVEL_ENCRYPTED_KERBEROS = 0x00000000,
+ FRSRPC_PARENT_AUTH_LEVEL_NO_AUTHENTICATION = 0x00000001
+ } frsrpc_PartnerAuthLevel;
+
+ WERROR frsrpc_FrsStartPromotionParent(
+ [in,unique,string,charset(UTF16)] uint16 *parent_account,
+ [in,unique,string,charset(UTF16)] uint16 *parent_password,
+ [in,unique,string,charset(UTF16)] uint16 *replica_set_name,
+ [in,unique,string,charset(UTF16)] uint16 *replica_set_type,
+ [in,unique,string,charset(UTF16)] uint16 *connection_name,
+ [in,unique,string,charset(UTF16)] uint16 *partner_name,
+ [in,unique,string,charset(UTF16)] uint16 *partner_princ_name,
+ [in] frsrpc_PartnerAuthLevel partner_auth_level,
+ [in,value(16),range(16,16)] uint32 __ndr_guid_size,
+ [in,unique,subcontext(4),subcontext_size(16)]
+ GUID *connection_guid,
+ [in,unique,subcontext(4),subcontext_size(16)]
+ GUID *partner_guid,
+ [in,out,unique,subcontext(4),subcontext_size(16)]
+ GUID *parent_guid
+ );
+
+ typedef [public,flag(NDR_NOALIGN)] struct {
+ uint32 major;
+ uint32 minor;
+ uint32 dataHigh;
+ uint32 dataLow;
+ uint16 compression;
+ uint8 unused[6];
+ fscc_FileNetworkOpenInformation attributes;
+ frsrpc_CommPktChangeOrderCommand command;
+ fscc_FileObjectIdBuffer_2 fileObjId;
+ frsrpc_CommPktCoRecordExtensionWin2k cocExt;
+ GUID compressionGuid;
+ uint32 encDataHigh;
+ uint32 encDataLow;
+ hyper dataSize;
+ uint32 reparseDataPresent;
+ uint32 reparseDataHigh;
+ uint32 reparseDataLow;
+ uint32 padding2;
+ } frsrpc_StageHeader;
+
+ /*****************/
+ /* Function 0x03 */
+ WERROR frsrpc_FrsNOP();
+
+ /*
+ *For Op from 4 to 10 Microsoft use
+ *the notation OpnumxxNotUsedOnWire
+ *where xx is the number of the OP.
+ *They are only declared in the IDL of MS-FRS1.pdf.
+ *Not in the core of the document.
+ */
+
+ /*****************/
+ /* Function 0x04 */
+ /*[todo] void FRSRPC_BACKUP_COMPLETE();*/
+
+ /*****************/
+ /* Function 0x05 */
+ /*[todo] void FRSRPC_BACKUP_COMPLETE_5();*/
+
+ /*****************/
+ /* Function 0x06 */
+ /*[todo] void FRSRPC_BACKUP_COMPLETE_6();*/
+
+ /*****************/
+ /* Function 0x07 */
+ /*[todo] void FRSRPC_BACKUP_COMPLETE_7();*/
+
+ /*****************/
+ /* Function 0x08 */
+ /*[todo] void FRSRPC_BACKUP_COMPLETE_8();*/
+
+ /*****************/
+ /* Function 0x09 */
+ /*[todo] void FRSRPC_BACKUP_COMPLETE_9();*/
+
+ /*****************/
+ /* Function 0x0a */
+ /*[todo] void FRSRPC_VERIFY_PROMOTION_PARENT_EX();*/
+}
diff --git a/librpc/idl/frstrans.idl b/librpc/idl/frstrans.idl
new file mode 100644
index 0000000..ed5b105
--- /dev/null
+++ b/librpc/idl/frstrans.idl
@@ -0,0 +1,295 @@
+#include "idl_types.h"
+
+import "misc.idl";
+
+[
+ uuid("897e2e5f-93f3-4376-9c9c-fd2277495c27"),
+ version(1.0),
+ endpoint("ncacn_ip_tcp:", "ncalrpc:"),
+ helpstring("File Replication Service DFS-R"),
+ pointer_default(unique)
+]
+interface frstrans
+{
+ /*****************/
+ /* Function 0x00 */
+ WERROR frstrans_CheckConnectivity(
+ [in] GUID replica_set_guid,
+ [in] GUID connection_guid
+ );
+
+ /*****************/
+ /* Function 0x01 */
+ typedef [v1_enum,flag(NDR_PAHEX)] enum {
+ FRSTRANS_PROTOCOL_VERSION_W2K3R2 = 0x00050000,
+ FRSTRANS_PROTOCOL_VERSION_LONGHORN_SERVER = 0x00050002
+ } frstrans_ProtocolVersion;
+
+ typedef [bitmap32bit] bitmap {
+ FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY = 0x00000001
+ } frstrans_TransportFlags;
+
+ WERROR frstrans_EstablishConnection(
+ [in] GUID replica_set_guid,
+ [in] GUID connection_guid,
+ [in] frstrans_ProtocolVersion downstream_protocol_version,
+ [in] frstrans_TransportFlags downstream_flags,
+ [out,ref] frstrans_ProtocolVersion *upstream_protocol_version,
+ [out,ref] frstrans_TransportFlags *upstream_flags
+ );
+
+ /*****************/
+ /* Function 0x02 */
+ WERROR frstrans_EstablishSession(
+ [in] GUID connection_guid,
+ [in] GUID content_set_guid
+ );
+
+ /*****************/
+ /* Function 0x03 */
+ typedef enum {
+ FRSTRANS_UPDATE_REQUEST_ALL = 0x0000,
+ FRSTRANS_UPDATE_REQUEST_TOMBSTONES = 0x0001,
+ FRSTRANS_UPDATE_REQUEST_LIVE = 0x0002
+ } frstrans_UpdateRequestType;
+
+ typedef enum {
+ FRSTRANS_UPDATE_STATUS_DONE = 0x0002,
+ FRSTRANS_UPDATE_STATUS_MORE = 0x0003
+ } frstrans_UpdateStatus;
+
+ typedef [public] struct {
+ GUID db_guid;
+ hyper low;
+ hyper high;
+ } frstrans_VersionVector;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ boolean32 present;
+ boolean32 name_conflict;
+ uint32 attributes;
+ NTTIME fence;
+ NTTIME clock;
+ NTTIME create_time;
+ GUID content_set_guid;
+ uint8 sha1_hash[20];
+ uint8 rdc_similarity[16];
+ GUID uid_db_guid;
+ hyper uid_version;
+ GUID gsvn_db_guid;
+ hyper gsvn_version;
+ GUID parent_db_guid;
+ hyper parent_version;
+ [string,charset(UTF16)] uint16 name[261];
+ uint32 flags;
+ } frstrans_Update;
+
+ WERROR frstrans_RequestUpdates(
+ [in] GUID connection_guid,
+ [in] GUID content_set_guid,
+ [in,range(0,256)] uint32 credits_available,
+ [in,range(0,1)] boolean32 hash_requested,
+ [in,range(0,2)]
+ frstrans_UpdateRequestType update_request_type,
+ [in] uint32 version_vector_diff_count,
+ [in,size_is(version_vector_diff_count)]
+ frstrans_VersionVector *version_vector_diff,
+ [out,ref,size_is(credits_available),length_is(*update_count)]
+ frstrans_Update *frs_update,
+ [out,ref] uint32 *update_count,
+ [out,ref] frstrans_UpdateStatus *update_status,
+ [out,ref] GUID *gvsn_db_guid,
+ [out,ref] hyper *gvsn_version
+ );
+
+ /*****************/
+ /* Function 0x04 */
+ typedef enum {
+ FRSTRANS_VERSION_REQUEST_NORNAL_SYNC = 0x0000,
+ FRSTRANS_VERSION_REQUEST_SLOW_SYNC = 0x0001,
+ FRSTRANS_VERSION_REQUEST_SLAVE_SYNC = 0x0002
+ } frstrans_VersionRequestType;
+
+ typedef enum {
+ FRSTRANS_VERSION_CHANGE_NOTIFY = 0x0000,
+ FRSTRANS_VERSION_CHANGE_ALL = 0x0002
+ } frstrans_VersionChangeType;
+
+ WERROR frstrans_RequestVersionVector(
+ [in] uint32 sequence_number,
+ [in] GUID connection_guid,
+ [in] GUID content_set_guid,
+ [in,range(0,2)] frstrans_VersionRequestType request_type,
+ [in,range(0,2)] frstrans_VersionChangeType change_type,
+ [in] hyper vv_generation
+ );
+
+ /*****************/
+ /* Function 0x05 */
+ typedef struct {
+ GUID machine_guid;
+ uint32 year;
+ uint32 month;
+ uint32 day_of_week;
+ uint32 day;
+ uint32 hour;
+ uint32 minute;
+ uint32 second;
+ uint32 milli_seconds;
+ } frstrans_EpoqueVector;
+
+ typedef struct {
+ hyper vv_generation;
+ uint32 version_vector_count;
+ [size_is(version_vector_count)]
+ frstrans_VersionVector *version_vector;
+ uint32 epoque_vector_count;
+ [size_is(epoque_vector_count)]
+ frstrans_EpoqueVector *epoque_vector;
+ } frstrans_AsyncVersionVectorResponse;
+
+ typedef struct {
+ uint32 sequence_number;
+ WERROR status;
+ frstrans_AsyncVersionVectorResponse response;
+ } frstrans_AsyncResponseContext;
+
+ WERROR frstrans_AsyncPoll(
+ [in] GUID connection_guid,
+ [out,ref] frstrans_AsyncResponseContext *response
+ );
+
+ /*****************/
+ /* Function 0x06 */
+ [todo] void FRSTRANS_REQUEST_RECORDS();
+
+ /*****************/
+ /* Function 0x07 */
+ [todo] void FRSTRANS_UPDATE_CANCEL();
+
+ /*****************/
+ /* Function 0x08 */
+ [todo] void FRSTRANS_RAW_GET_FILE_DATA();
+
+ /*****************/
+ /* Function 0x09 */
+ [todo] void FRSTRANS_RDC_GET_SIGNATURES();
+
+ /*****************/
+ /* Function 0x0a */
+ [todo] void FRSTRANS_RDC_PUSH_SOURCE_NEEDS();
+
+ /*****************/
+ /* Function 0x0b */
+ [todo] void FRSTRANS_RDC_GET_FILE_DATA();
+
+ /*****************/
+ /* Function 0x0c */
+ WERROR frstrans_RdcClose(
+ [in,out,ref] policy_handle *server_context
+ );
+
+ /*****************/
+ /* Function 0x0d */
+ typedef enum {
+ FRSTRANS_STAGING_POLICY_SERVER_DEFAULTY = 0x0000,
+ FRSTRANS_STAGING_POLICY_STATGING_REQUIRED = 0x0001,
+ FRSTRANS_STAGING_POLICY_RESTATGING_REQUIRED = 0x0002
+ } frstrans_RequestedStagingPolicy;
+
+ typedef enum {
+ FRSTRANS_RDC_FILTER_GENERIC = 0x0000,
+ FRSTRANS_RDC_FILTER_MAX = 0x0001,
+ FRSTRANS_RDC_FILTER_POINT = 0x0002,
+ FRSTRANS_RDC_MAX_ALGORITHM = 0x0003
+ } frstrans_RdcChunckerAlgorithm;
+
+ typedef struct {
+ frstrans_RdcChunckerAlgorithm chunker_type;
+ uint8 chunker_parameters[64];
+ } frstrans_RdcParameterGeneric;
+
+ typedef struct {
+ [range(128,1024*16)] uint16 min_horizon_size;
+ [range(2,96)] uint16 max_window_size;
+ } frstrans_RdcParameterFilterMax;
+
+ typedef struct {
+ uint16 min_chunk_size;
+ uint16 max_chunk_size;
+ } frstrans_RdcParameterFilterPoint;
+
+ typedef [switch_type(frstrans_RdcChunckerAlgorithm)] union {
+ [case(FRSTRANS_RDC_FILTER_GENERIC)]
+ frstrans_RdcParameterGeneric filter_generic;
+ [case(FRSTRANS_RDC_FILTER_MAX)]
+ frstrans_RdcParameterFilterMax filter_max;
+ [case(FRSTRANS_RDC_FILTER_POINT)]
+ frstrans_RdcParameterFilterPoint filter_point;
+ } frstrans_RdcParameterUnion;
+
+ typedef struct {
+ frstrans_RdcChunckerAlgorithm rdc_chunker_algorithm;
+ [switch_is(rdc_chunker_algorithm)] frstrans_RdcParameterUnion u;
+ } frstrans_RdcParameters;
+
+ typedef enum {
+ FRSTRANS_RDC_VERSION = 0x0001
+ } frstrans_RdcVersion;
+
+ typedef enum {
+ FRSTRANS_RDC_VERSION_COMPATIBLE = 0x0001
+ } frstrans_RdcVersionCompatible;
+
+ typedef enum {
+ FRSTRANS_RDC_UNCOMPRESSED = 0x0000,
+ FRSTRANS_RDC_XPRESS = 0x0001
+ } frstrans_RdcCompressionAlgorithm;
+
+ typedef struct {
+ hyper on_disk_file_size;
+ hyper file_size_estimate;
+ frstrans_RdcVersion rdc_version;
+ frstrans_RdcVersionCompatible rdc_minimum_compatible_version;
+ [range(0,8)] uint8 rdc_signature_levels;
+ frstrans_RdcCompressionAlgorithm compression_algorithm;
+ [size_is(rdc_signature_levels)]
+ frstrans_RdcParameters rdc_filter_parameters[*];
+ } frstrans_RdcFileInfo;
+
+ WERROR frstrans_InitializeFileTransferAsync(
+ [in] GUID connection_guid,
+ [in,out,ref] frstrans_Update *frs_update,
+ [in,range(0,1)] boolean32 rdc_desired,
+ [in,out,ref] frstrans_RequestedStagingPolicy *staging_policy,
+ [out,ref] policy_handle *server_context,
+ [out,ref] frstrans_RdcFileInfo **rdc_file_info,
+ [out,ref,size_is(buffer_size),length_is(*size_read)]
+ uint8 *data_buffer,
+ [in,range(0,262144)] uint32 buffer_size,
+ [out,ref] uint32 *size_read,
+ [out,ref] boolean32 *is_end_of_file
+ );
+
+ /*****************/
+ /* Function 0x0e */
+ [todo] void FRSTRANS_OPNUM_0E_NOT_USED_ON_THE_WIRE();
+
+ /* The following functions are new in Windows 2008 */
+
+ /*****************/
+ /* Function 0x0f */
+ typedef [flag(NDR_PAHEX)] pipe uint8 frstrans_BytePipe;
+
+ WERROR frstrans_RawGetFileDataAsync(
+ [in,ref] policy_handle *server_context,
+ [out,ref] frstrans_BytePipe *byte_pipe
+ );
+
+ /*****************/
+ /* Function 0x10 */
+ WERROR frstrans_RdcGetFileDataAsync(
+ [in,ref] policy_handle *server_context,
+ [out,ref] frstrans_BytePipe *byte_pipe
+ );
+}
diff --git a/librpc/idl/fscc.idl b/librpc/idl/fscc.idl
new file mode 100644
index 0000000..9947dcc
--- /dev/null
+++ b/librpc/idl/fscc.idl
@@ -0,0 +1,47 @@
+#include "idl_types.h"
+
+import "misc.idl";
+/* fscc structures */
+
+[
+ pointer_default(unique),
+ helpstring("fscc structures")
+]
+
+
+interface fscc
+{
+ typedef [public] struct {
+ GUID id;
+ GUID birthVolumeId;
+ GUID initialObjectId;
+ GUID domainId;
+ } fscc_FileObjectIdBuffer_2;
+
+ typedef [bitmap32bit,flag(NDR_PAHEX)] bitmap{
+ FSCC_FILE_ATTRIBUTE_READONLY = 0x00000001,
+ FSCC_FILE_ATTRIBUTE_HIDDEN = 0x00000002,
+ FSCC_FILE_ATTRIBUTE_SYSTEM = 0x00000004,
+ FSCC_FILE_ATTRIBUTE_NORMAL = 0x00000008,
+ FSCC_FILE_ATTRIBUTE_DIRECTORY = 0x00000010,
+ FSCC_FILE_ATTRIBUTE_ARCHIVE = 0x00000020,
+ FSCC_FILE_ATTRIBUTE_TEMPORARY = 0x00000100,
+ FSCC_FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200,
+ FSCC_FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400,
+ FSCC_FILE_ATTRIBUTE_COMPRESSED = 0x00000800,
+ FSCC_FILE_ATTRIBUTE_OFFLINE = 0x00001000,
+ FSCC_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000,
+ FSCC_FILE_ATTRIBUTE_ENCRYPTED = 0x00004000
+ } fscc_FileAttributes;
+
+ typedef [public] struct {
+ hyper creationTime;
+ hyper lastAccessTime;
+ hyper lastWriteTime;
+ hyper changeTime;
+ hyper allocSize;
+ hyper endOfFile;
+ fscc_FileAttributes fileAttribute;
+ uint32 reserved;
+ } fscc_FileNetworkOpenInformation;
+}
diff --git a/librpc/idl/fsrvp.idl b/librpc/idl/fsrvp.idl
new file mode 100644
index 0000000..aebd689
--- /dev/null
+++ b/librpc/idl/fsrvp.idl
@@ -0,0 +1,107 @@
+#include "idl_types.h"
+
+/*
+ * File Server Remote VSS Protocol Definitions
+ */
+
+import "misc.idl";
+
+[ uuid("a8e0653c-2744-4389-a61d-7373df8b2292"),
+ version(1.0),
+ endpoint("ncacn_np:[\\pipe\\FssagentRpc]"),
+ helpstring("File Server Remote VSS Protocol"),
+ pointer_default(unique)
+] interface FileServerVssAgent
+{
+ const uint32 FSRVP_E_BAD_STATE = 0x80042301;
+ const uint32 FSRVP_E_SHADOW_COPY_SET_IN_PROGRESS = 0x80042316;
+ const uint32 FSRVP_E_NOT_SUPPORTED = 0x8004230C;
+ const uint32 FSRVP_E_WAIT_TIMEOUT = 0x00000102;
+ const uint32 FSRVP_E_WAIT_FAILED = 0xFFFFFFFF;
+ const uint32 FSRVP_E_OBJECT_ALREADY_EXISTS = 0x8004230D;
+ const uint32 FSRVP_E_OBJECT_NOT_FOUND = 0x80042308;
+ const uint32 FSRVP_E_UNSUPPORTED_CONTEXT = 0x8004231B;
+ const uint32 FSRVP_E_BAD_ID = 0x80042302; /* wire, not documented */
+ const uint32 FSRVP_E_SHADOWCOPYSET_ID_MISMATCH = 0x80042501;
+ typedef struct {
+ GUID ShadowCopySetId;
+ GUID ShadowCopyId;
+ [string,charset(UTF16)] uint16 *ShareNameUNC;
+ [string,charset(UTF16)] uint16 *ShadowCopyShareName;
+ NTTIME tstamp;
+ } fssagent_share_mapping_1;
+
+ typedef union {
+ [case(1)] fssagent_share_mapping_1 *ShareMapping1;
+ [default];
+ } fssagent_share_mapping;
+
+ const uint32 FSRVP_RPC_VERSION_1 = 0x000000001;
+ DWORD fss_GetSupportedVersion(
+ [out] uint32 *MinVersion,
+ [out] uint32 *MaxVersion);
+
+ const uint32 ATTR_PERSISTENT = 0x00000001;
+ const uint32 ATTR_NO_AUTO_RECOVERY = 0x00000002;
+ const uint32 ATTR_NO_AUTO_RELEASE = 0x00000008;
+ const uint32 ATTR_NO_WRITERS = 0x00000010;
+ const uint32 ATTR_FILE_SHARE = 0x04000000;
+ const uint32 ATTR_AUTO_RECOVERY = 0x00400000;
+
+ const uint32 FSRVP_CTX_BACKUP = 0x00000000;
+ const uint32 FSRVP_CTX_FILE_SHARE_BACKUP = 0x00000010;
+ const uint32 FSRVP_CTX_NAS_ROLLBACK = 0x00000019;
+ const uint32 FSRVP_CTX_APP_ROLLBACK = 0x00000009;
+ DWORD fss_SetContext(
+ [in] uint32 Context);
+
+ DWORD fss_StartShadowCopySet(
+ [in] GUID ClientShadowCopySetId,
+ [out] GUID *pShadowCopySetId);
+
+ DWORD fss_AddToShadowCopySet(
+ [in] GUID ClientShadowCopyId,
+ [in] GUID ShadowCopySetId,
+ [in] [string,charset(UTF16)] uint16 *ShareName,
+ [out] GUID *pShadowCopyId);
+
+ DWORD fss_CommitShadowCopySet(
+ [in] GUID ShadowCopySetId,
+ [in] uint32 TimeOutInMilliseconds);
+
+ DWORD fss_ExposeShadowCopySet(
+ [in] GUID ShadowCopySetId,
+ [in] uint32 TimeOutInMilliseconds);
+
+ DWORD fss_RecoveryCompleteShadowCopySet(
+ [in] GUID ShadowCopySetId);
+
+ DWORD fss_AbortShadowCopySet(
+ [in] GUID ShadowCopySetId);
+
+ DWORD fss_IsPathSupported(
+ [in] [string,charset(UTF16)] uint16 *ShareName,
+ [out] boolean32 *SupportedByThisProvider,
+ [out] [string,charset(UTF16)] uint16 **OwnerMachineName);
+
+ DWORD fss_IsPathShadowCopied(
+ [in] [string,charset(UTF16)] uint16 *ShareName,
+ [out] boolean32 *ShadowCopyPresent,
+ [out] int32 *ShadowCopyCompatibility);
+
+ DWORD fss_GetShareMapping(
+ [in] GUID ShadowCopyId,
+ [in] GUID ShadowCopySetId,
+ [in] [string,charset(UTF16)] uint16 *ShareName,
+ [in] uint32 Level,
+ [out,switch_is(Level)] fssagent_share_mapping *ShareMapping);
+
+ DWORD fss_DeleteShareMapping(
+ [in] GUID ShadowCopySetId,
+ [in] GUID ShadowCopyId,
+ [in] [string,charset(UTF16)] uint16 *ShareName);
+
+ DWORD fss_PrepareShadowCopySet(
+ [in] GUID ShadowCopySetId,
+ [in] uint32 TimeOutInMilliseconds);
+}
diff --git a/librpc/idl/fsrvp_state.idl b/librpc/idl/fsrvp_state.idl
new file mode 100644
index 0000000..9fcec12
--- /dev/null
+++ b/librpc/idl/fsrvp_state.idl
@@ -0,0 +1,36 @@
+#include "idl_types.h"
+[
+ pointer_default(unique)
+]
+interface fsrvp_state
+{
+ /* database format version, NOT the FSRVP protocol version */
+ const uint32 FSRVP_STATE_DB_VERSION = 1;
+
+ /*
+ * These data structures describe the FSRVP server on-disk format. Any
+ * changes should result in a new DB version number, and corresponding
+ * upgrade function.
+ */
+ typedef [public] struct {
+ [flag(STR_UTF8|STR_NULLTERM)] string share_name;
+ [flag(STR_UTF8|STR_NULLTERM)] string sc_share_name;
+ [flag(STR_UTF8|STR_NULLTERM)] string sc_share_comment;
+ boolean32 is_exposed;
+ } fsrvp_state_smap;
+
+ typedef [public] struct {
+ [flag(STR_UTF8|STR_NULLTERM)] string id_str;
+ [flag(STR_UTF8|STR_NULLTERM)] string volume_name;
+ [flag(STR_UTF8|STR_NULLTERM)] string sc_path;
+ time_t create_ts;
+ int smaps_count;
+ } fsrvp_state_sc;
+
+ typedef [public] struct {
+ [flag(STR_UTF8|STR_NULLTERM)] string id_str;
+ int state;
+ int context;
+ int scs_count;
+ } fsrvp_state_sc_set;
+}
diff --git a/librpc/idl/idl_types.h b/librpc/idl/idl_types.h
new file mode 100644
index 0000000..2d063de
--- /dev/null
+++ b/librpc/idl/idl_types.h
@@ -0,0 +1,64 @@
+#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_CONFORMANT LIBNDR_FLAG_STR_CONFORMANT
+#define STR_CHARLEN LIBNDR_FLAG_STR_CHARLEN
+#define STR_UTF8 LIBNDR_FLAG_STR_UTF8
+#define STR_RAW8 LIBNDR_FLAG_STR_RAW8
+
+/*
+ a null terminated UCS2 string
+*/
+#define nstring [flag(STR_NULLTERM|NDR_ALIGN2)] 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 "raw" string (null terminated byte sequence)
+*/
+#define raw8string [flag(STR_RAW8|STR_NULLTERM)] string
+
+/*
+ a null terminated UCS2 string
+*/
+#define nstring_array [flag(STR_NULLTERM|NDR_ALIGN2)] 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
+#define NDR_NO_COMP LIBNDR_FLAG_NO_COMPRESSION
+
+/* 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
+
+/*
+ * Mark an element as SECRET, it won't be printed by
+ * via ndr_print* unless NDR_PRINT_SECRETS is specified.
+ */
+#define NDR_SECRET LIBNDR_FLAG_IS_SECRET
+
+#define NDR_RELATIVE_REVERSE LIBNDR_FLAG_RELATIVE_REVERSE
+#define NDR_NO_RELATIVE_REVERSE LIBNDR_FLAG_NO_RELATIVE_REVERSE
+
+#define NDR_SUBCONTEXT_NO_UNREAD_BYTES LIBNDR_FLAG_SUBCONTEXT_NO_UNREAD_BYTES
diff --git a/librpc/idl/idmap.idl b/librpc/idl/idmap.idl
new file mode 100644
index 0000000..e58e392
--- /dev/null
+++ b/librpc/idl/idmap.idl
@@ -0,0 +1,53 @@
+#include "idl_types.h"
+
+import "security.idl";
+
+[
+ pointer_default(unique)
+]
+interface idmap
+{
+ typedef [public] enum {
+ ID_TYPE_NOT_SPECIFIED,
+ ID_TYPE_UID,
+ ID_TYPE_GID,
+ ID_TYPE_BOTH,
+ /*
+ * This are internal between winbindd
+ * parent and child.
+ *
+ * It means the idmap backend/child requires a valid type_hint
+ * for wbint_Sids2UnixIDs():
+ *
+ * - ID_TYPE_UID or ID_TYPE_GID means the user/group exists
+ * - ID_TYPE_BOTH means that only the domain exist
+ */
+ ID_TYPE_WB_REQUIRE_TYPE
+ } id_type;
+
+ typedef [public] struct {
+ uint32 id;
+ id_type type;
+ } unixid;
+
+ typedef [public] enum {
+ ID_UNKNOWN,
+ ID_MAPPED,
+ ID_UNMAPPED,
+ ID_EXPIRED,
+ /*
+ * This means the idmap backend requires a valid type_hint
+ * in order to map a sid to a unix id.
+ *
+ * - ID_TYPE_UID or ID_TYPE_GID means the user/group exists
+ * - ID_TYPE_BOTH means that only the domain exist
+ */
+ ID_REQUIRE_TYPE
+ } id_mapping;
+
+ typedef [public] struct {
+ dom_sid *sid;
+ unixid xid;
+ id_mapping status;
+ } id_map;
+}
diff --git a/librpc/idl/initshutdown.idl b/librpc/idl/initshutdown.idl
new file mode 100644
index 0000000..63cf62b
--- /dev/null
+++ b/librpc/idl/initshutdown.idl
@@ -0,0 +1,91 @@
+#include "idl_types.h"
+
+/*
+ initshutdown interface definition
+*/
+
+import "lsa.idl";
+
+[
+ uuid("894de0c0-0d55-11d3-a322-00c04fa321a1"),
+ version(1.0),
+ endpoint("ncacn_np:[\\pipe\\InitShutdown]"),
+ pointer_default(unique),
+ helpstring("Init shutdown service")
+] interface initshutdown
+{
+ typedef [v1_enum] enum {
+ SHTDN_REASON_MAJOR_OTHER = 0x00000000,
+ SHTDN_REASON_MAJOR_HARDWARE = 0x00010000,
+ SHTDN_REASON_MAJOR_OPERATINGSYSTEM = 0x00020000,
+ SHTDN_REASON_MAJOR_SOFTWARE = 0x00030000,
+ SHTDN_REASON_MAJOR_APPLICATION = 0x00040000,
+ SHTDN_REASON_MAJOR_SYSTEM = 0x00050000,
+ SHTDN_REASON_MAJOR_POWER = 0x00060000,
+ SHTDN_REASON_MAJOR_LEGACY_API = 0x00070000
+ } initshutdown_ReasonMajor;
+
+ typedef [v1_enum] enum {
+ SHTDN_REASON_MINOR_OTHER = 0x00000000,
+ SHTDN_REASON_MINOR_MAINTENANCE = 0x00000001,
+ SHTDN_REASON_MINOR_INSTALLATION = 0x00000002,
+ SHTDN_REASON_MINOR_UPGRADE = 0x00000003,
+ SHTDN_REASON_MINOR_RECONFIG = 0x00000004,
+ SHTDN_REASON_MINOR_HUNG = 0x00000005,
+ SHTDN_REASON_MINOR_UNSTABLE = 0x00000006,
+ SHTDN_REASON_MINOR_DISK = 0x00000007,
+ SHTDN_REASON_MINOR_PROCESSOR = 0x00000008,
+ SHTDN_REASON_MINOR_NETWORKCARD = 0x00000009,
+ SHTDN_REASON_MINOR_POWER_SUPPLY = 0x0000000a,
+ SHTDN_REASON_MINOR_CORDUNPLUGGED = 0x0000000b,
+ SHTDN_REASON_MINOR_ENVIRONMENT = 0x0000000c,
+ SHTDN_REASON_MINOR_HARDWARE_DRIVER = 0x0000000d,
+ SHTDN_REASON_MINOR_OTHERDRIVER = 0x0000000e,
+ SHTDN_REASON_MINOR_BLUESCREEN = 0x0000000f,
+ SHTDN_REASON_MINOR_SERVICEPACK = 0x00000010,
+ SHTDN_REASON_MINOR_HOTFIX = 0x00000011,
+ SHTDN_REASON_MINOR_SECURITYFIX = 0x00000012,
+ SHTDN_REASON_MINOR_SECURITY = 0x00000013,
+ SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014,
+ SHTDN_REASON_MINOR_WMI = 0x00000015,
+ SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL= 0x00000016,
+ SHTDN_REASON_MINOR_HOTFIX_UNINSTALL = 0x00000017,
+ SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL= 0x00000018,
+ SHTDN_REASON_MINOR_MMC = 0x00000019,
+ SHTDN_REASON_MINOR_TERMSRV = 0x00000020
+ } initshutdown_ReasonMinor;
+
+ typedef [bitmap32bit] bitmap {
+ SHTDN_REASON_FLAG_USER_DEFINED = 0x40000000,
+ SHTDN_REASON_FLAG_PLANNED = 0x80000000
+ } initshutdown_ReasonFlags;
+
+ WERROR initshutdown_Init(
+ [in,unique] uint16 *hostname,
+ /*
+ * Note: lsa_String and winreg_String both result
+ * in WERR_INVALID_PARAMETER
+ */
+ [in,unique] lsa_StringLarge *message,
+ [in] uint32 timeout,
+ [in] uint8 force_apps,
+ [in] uint8 do_reboot
+ );
+
+ WERROR initshutdown_Abort(
+ [in,unique] uint16 *server
+ );
+
+ WERROR initshutdown_InitEx(
+ [in,unique] uint16 *hostname,
+ /*
+ * Note: lsa_String and winreg_String both result
+ * in WERR_INVALID_PARAMETER
+ */
+ [in,unique] lsa_StringLarge *message,
+ [in] uint32 timeout,
+ [in] uint8 force_apps,
+ [in] uint8 do_reboot,
+ [in] uint32 reason
+ );
+}
diff --git a/librpc/idl/ioctl.idl b/librpc/idl/ioctl.idl
new file mode 100644
index 0000000..b2f3aec
--- /dev/null
+++ b/librpc/idl/ioctl.idl
@@ -0,0 +1,230 @@
+#include "idl_types.h"
+[
+ pointer_default(unique)
+]
+interface copychunk
+{
+ typedef [public] struct {
+ uint8 resume_key[24];
+ uint32 context_len;
+ /* <56> Windows sends 4 bytes of zero for the context field. */
+ uint8 context[4];
+ } req_resume_key_rsp;
+
+ const uint32 COPYCHUNK_MAX_CHUNKS = 256; /* 2k8r2 & win8 = 256 */
+ const uint32 COPYCHUNK_MAX_CHUNK_LEN = 1048576; /* 2k8r2 & win8 = 1048576 */
+ const uint32 COPYCHUNK_MAX_TOTAL_LEN = 16777216; /* 2k8r2 & win8 = 16777216 */
+
+ typedef struct {
+ hyper source_off;
+ hyper target_off;
+ uint32 length;
+ uint32 reserved;
+ } srv_copychunk;
+
+ typedef [public] struct {
+ uint8 source_key[24];
+ uint32 chunk_count;
+ uint32 reserved;
+ srv_copychunk chunks[chunk_count];
+ } srv_copychunk_copy;
+
+ typedef [public] struct {
+ uint32 chunks_written;
+ uint32 chunk_bytes_written;
+ uint32 total_bytes_written;
+ } srv_copychunk_rsp;
+
+ typedef [public] struct {
+ uint32 version;
+ uint32 size;
+ uint32 maximum_token_lifetime;
+ uint32 default_token_lifetime;
+ hyper maximum_xfer_size;
+ hyper optimal_xfer_count;
+ uint32 maximum_data_descriptors;
+ uint32 maximum_xfer_length_per_descriptor;
+ uint32 optimal_xfer_length_per_descriptor;
+ uint16 optimal_xfer_length_granularity;
+ uint8 reserved[2];
+ } device_copy_offload_descriptor;
+
+ const uint32 STORAGE_OFFLOAD_TOKEN_TYPE_ZERO_DATA = 0xffff0001;
+
+ typedef [public] struct {
+ uint32 token_type;
+ uint8 reserved[2];
+ uint16 token_id_len;
+ uint8 token[token_id_len];
+ } storage_offload_token;
+
+ typedef [public] struct {
+ uint32 size;
+ uint32 flags;
+ uint32 token_time_to_live;
+ uint32 reserved;
+ hyper file_offset;
+ hyper length;
+ } fsctl_offload_read_input;
+
+ typedef [public,bitmap32bit] bitmap {
+ OFFLOAD_READ_FLAG_FILE_TOO_SMALL = 0x01,
+ OFFLOAD_READ_FLAG_ALL_ZERO_BEYOND_RANGE = 0x02,
+ OFFLOAD_READ_FLAG_CANNOT_OFFLOAD_BEYOND_RANGE = 0x04
+ } offload_flags;
+
+ typedef [public] struct {
+ uint32 size;
+ offload_flags flags;
+ hyper xfer_length;
+ storage_offload_token token;
+ } fsctl_offload_read_output;
+
+ typedef [public] struct {
+ uint32 size;
+ offload_flags flags;
+ hyper file_offset;
+ hyper copy_length;
+ hyper xfer_offset;
+ storage_offload_token token;
+ } fsctl_offload_write_input;
+
+ typedef [public] struct {
+ uint32 size;
+ uint32 flags;
+ hyper length_written;
+ } fsctl_offload_write_output;
+
+ typedef [public] struct {
+ uint8 source_fid[16];
+ hyper source_off;
+ hyper target_off;
+ hyper byte_count;
+ } fsctl_dup_extents_to_file;
+}
+
+interface compression
+{
+ const uint16 COMPRESSION_FORMAT_NONE = 0x0000;
+ const uint16 COMPRESSION_FORMAT_DEFAULT = 0x0001;
+ const uint16 COMPRESSION_FORMAT_LZNT1 = 0x0002;
+
+ typedef [public] struct {
+ uint16 format;
+ } compression_state;
+}
+
+interface netinterface
+{
+ typedef [bitmap32bit] bitmap {
+ FSCTL_NET_IFACE_NONE_CAPABLE = 0x00000000,
+ FSCTL_NET_IFACE_RSS_CAPABLE = 0x00000001,
+ FSCTL_NET_IFACE_RDMA_CAPABLE = 0x00000002
+ } fsctl_net_iface_capability;
+
+ typedef [enum16bit] enum {
+ FSCTL_NET_IFACE_AF_INET = 0x0002,
+ FSCTL_NET_IFACE_AF_INET6 = 0x0017
+ } fsctl_sockaddr_af;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ [value(0)] uint16 port;
+ [flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
+ [value(0)] hyper reserved;
+ } fsctl_sockaddr_in;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ [value(0)] uint16 port;
+ [value(0)] uint32 flowinfo;
+ [flag(NDR_BIG_ENDIAN)] ipv6address ipv6;
+ [value(0)] uint32 scopeid;
+ } fsctl_sockaddr_in6;
+
+ typedef [nodiscriminant,flag(NDR_NOALIGN)] union {
+ [case (FSCTL_NET_IFACE_AF_INET)] fsctl_sockaddr_in saddr_in;
+ [case (FSCTL_NET_IFACE_AF_INET6)] fsctl_sockaddr_in6 saddr_in6;
+ } fsctl_sockaddr_union;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ fsctl_sockaddr_af family;
+ [subcontext(0),subcontext_size(126),switch_is(family)] fsctl_sockaddr_union saddr;
+ } fsctl_sockaddr_storage;
+
+ typedef [public,relative_base,noprint] struct {
+ [relative,max_recursion(20000)] fsctl_net_iface_info *next;
+ uint32 ifindex;
+ fsctl_net_iface_capability capability;
+ [value(0)] uint32 reserved;
+ hyper linkspeed;
+ fsctl_sockaddr_storage sockaddr;
+ } fsctl_net_iface_info;
+}
+
+interface sparse
+{
+ /* MS-FSCC 2.3.33 FSCTL_QUERY_ALLOCATED_RANGES Request */
+ typedef [public] struct {
+ hyper file_off;
+ hyper len;
+ } file_alloced_range_buf;
+
+ typedef [public] struct {
+ file_alloced_range_buf buf;
+ } fsctl_query_alloced_ranges_req;
+
+ /*
+ * 2.3.34 FSCTL_QUERY_ALLOCATED_RANGES Reply
+ * ...
+ * The number of FILE_ALLOCATED_RANGE_BUFFER elements returned is
+ * computed by dividing the size of the returned output buffer (from
+ * either SMB or SMB2, the lower-layer protocol that carries the FSCTL)
+ * by the size of the FILE_ALLOCATED_RANGE_BUFFER element.
+ *
+ * This logic can't (currently) be represented in pidl, so just use a
+ * blob. Perhaps in future we'll support:
+ * [flag(NDR_REMAINING)] file_alloced_range_buf array[];
+ */
+ typedef [public] struct {
+ [flag(NDR_REMAINING)] DATA_BLOB far_buf_array;
+ } fsctl_query_alloced_ranges_rsp;
+
+ /* 2.3.65 FSCTL_SET_ZERO_DATA Request */
+ typedef [public] struct {
+ hyper file_off;
+ hyper beyond_final_zero;
+ } file_zero_data_info;
+
+ typedef [public] struct {
+ file_zero_data_info info;
+ } fsctl_set_zero_data_req;
+}
+
+interface resiliency
+{
+ /* 2.2.31.3 NETWORK_RESILIENCY_REQUEST */
+ typedef [public] struct {
+ uint32 timeout;
+ uint32 reserved;
+ } network_resiliency_request;
+}
+
+interface trim
+{
+ /* MS-FSCC 2.3.73.1 FILE_LEVEL_TRIM_RANGE */
+ typedef [public] struct {
+ hyper off;
+ hyper len;
+ } file_level_trim_range;
+
+ /* MS-FSCC 2.3.73 FSCTL_FILE_LEVEL_TRIM Request */
+ typedef [public] struct {
+ uint32 key;
+ uint32 num_ranges;
+ file_level_trim_range ranges[num_ranges];
+ } fsctl_file_level_trim_req;
+
+ /* MS-FSCC 2.3.74 FSCTL_FILE_LEVEL_TRIM Reply */
+ typedef [public] struct {
+ uint32 num_ranges_processed;
+ } fsctl_file_level_trim_rsp;
+}
diff --git a/librpc/idl/keysvc.idl b/librpc/idl/keysvc.idl
new file mode 100644
index 0000000..9d05f7d
--- /dev/null
+++ b/librpc/idl/keysvc.idl
@@ -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();
+}
diff --git a/librpc/idl/krb5ccache.idl b/librpc/idl/krb5ccache.idl
new file mode 100644
index 0000000..1f0cfa7
--- /dev/null
+++ b/librpc/idl/krb5ccache.idl
@@ -0,0 +1,115 @@
+/*
+ krb5 credentials cache (version 3 or 4)
+ specification: https://web.mit.edu/kerberos/krb5-devel/doc/formats/ccache_file_format.html
+*/
+
+#include "idl_types.h"
+
+[
+ uuid("1702b695-99ca-4f32-93e4-1e1c4d5ddb53"),
+ version(0.0),
+ pointer_default(unique),
+ helpstring("KRB5 credentials cache")
+]
+interface krb5ccache
+{
+ typedef struct {
+ uint32 name_type;
+ uint32 component_count;
+ [flag(STR_SIZE4|STR_NOTERM|STR_UTF8)] string realm;
+ [flag(STR_SIZE4|STR_NOTERM|STR_UTF8)] string components[component_count];
+ } PRINCIPAL;
+
+ typedef struct {
+ uint16 enctype;
+ DATA_BLOB data;
+ } KEYBLOCK;
+
+ typedef struct {
+ uint16 addrtype;
+ DATA_BLOB data;
+ } ADDRESS;
+
+ typedef struct {
+ uint32 count;
+ ADDRESS data[count];
+ } ADDRESSES;
+
+ typedef struct {
+ uint16 ad_type;
+ DATA_BLOB data;
+ } AUTHDATUM;
+
+ typedef struct {
+ uint32 count;
+ AUTHDATUM data[count];
+ } AUTHDATA;
+
+ typedef struct {
+ PRINCIPAL client;
+ PRINCIPAL server;
+ KEYBLOCK keyblock;
+ uint32 authtime;
+ uint32 starttime;
+ uint32 endtime;
+ uint32 renew_till;
+ uint8 is_skey;
+ uint32 ticket_flags;
+ ADDRESSES addresses;
+ AUTHDATA authdata;
+ DATA_BLOB ticket;
+ DATA_BLOB second_ticket;
+ } CREDENTIAL;
+
+ typedef struct {
+ [value(0)] int32 kdc_sec_offset;
+ [value(0)] int32 kdc_usec_offset;
+ } DELTATIME_TAG;
+
+ typedef [nodiscriminant] union {
+ [case(1)] DELTATIME_TAG deltatime_tag;
+ } FIELD;
+
+ typedef struct {
+ [value(1)] uint16 tag;
+ [subcontext(2),switch_is(tag)] FIELD field;
+ } V4TAG;
+
+ typedef struct {
+ V4TAG tag;
+ /*
+ * We should allow for more than one tag to be properly parsed, but that
+ * would require manual parsing.
+ */
+ [flag(NDR_REMAINING)] DATA_BLOB further_tags;
+ } V4TAGS;
+
+ typedef struct {
+ [subcontext(2)] V4TAGS v4tags;
+ } V4HEADER;
+
+ typedef [nodiscriminant] union {
+ /*
+ * We don't attempt to support file format versions 1 and 2 as they
+ * assume native CPU byte order, which makes no sense in PIDL.
+ */
+ [case(3)] ;
+ [case(4)] V4HEADER v4header;
+ } OPTIONAL_HEADER;
+
+ /* Public structures. */
+
+ typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
+ [value(5)] uint8 pvno;
+ [value(4)] uint8 version;
+ [switch_is(version)] OPTIONAL_HEADER optional_header;
+ PRINCIPAL principal;
+ CREDENTIAL cred;
+ [flag(NDR_REMAINING)] DATA_BLOB further_creds;
+ } CCACHE;
+
+ typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
+ CREDENTIAL cred;
+ [flag(NDR_REMAINING)] DATA_BLOB further_creds;
+ } MULTIPLE_CREDENTIALS;
+}
diff --git a/librpc/idl/krb5pac.idl b/librpc/idl/krb5pac.idl
new file mode 100644
index 0000000..a21533f
--- /dev/null
+++ b/librpc/idl/krb5pac.idl
@@ -0,0 +1,225 @@
+/*
+ krb5 PAC
+*/
+
+#include "idl_types.h"
+
+import "security.idl", "lsa.idl", "netlogon.idl", "samr.idl";
+
+[
+ uuid("12345778-1234-abcd-0000-00000000"),
+ version(0.0),
+ pointer_default(unique),
+ helpstring("Active Directory KRB5 PAC"),
+ helper("../librpc/ndr/ndr_krb5pac.h")
+]
+interface krb5pac
+{
+ typedef struct {
+ NTTIME logon_time;
+ [value(2*strlen_m(account_name))] uint16 size;
+ [charset(UTF16)] uint8 account_name[size];
+ } PAC_LOGON_NAME;
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ uint32 type;
+ [flag(NDR_REMAINING)] DATA_BLOB signature;
+ } PAC_SIGNATURE_DATA;
+
+ typedef struct {
+ dom_sid2 *domain_sid;
+ samr_RidWithAttributeArray groups;
+ } PAC_DOMAIN_GROUP_MEMBERSHIP;
+
+ typedef struct {
+ netr_SamInfo3 info3;
+ /*
+ * On ndr_push:
+ * Pointers values of info3.sids[*].sid
+ * should be allocated before the following ones?
+ * (just the 0x30 0x00 0x02 0x00 value).
+ */
+ PAC_DOMAIN_GROUP_MEMBERSHIP resource_groups;
+ } PAC_LOGON_INFO;
+
+ typedef [bitmap32bit] bitmap {
+ PAC_CREDENTIAL_NTLM_HAS_LM_HASH = 0x00000001,
+ PAC_CREDENTIAL_NTLM_HAS_NT_HASH = 0x00000002
+ } PAC_CREDENTIAL_NTLM_FLAGS;
+
+ typedef [public] struct {
+ [value(0)] uint32 version;
+ PAC_CREDENTIAL_NTLM_FLAGS flags;
+ [noprint] samr_Password lm_password;
+ [noprint] samr_Password nt_password;
+ } PAC_CREDENTIAL_NTLM_SECPKG;
+
+ typedef [public] struct {
+ lsa_String package_name;
+ uint32 credential_size;
+ [size_is(credential_size), noprint] uint8 *credential;
+ } PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG;
+
+ typedef [public] struct {
+ uint32 credential_count;
+ [size_is(credential_count)] PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG credentials[*];
+ } PAC_CREDENTIAL_DATA;
+
+ typedef [public] struct {
+ PAC_CREDENTIAL_DATA *data;
+ } PAC_CREDENTIAL_DATA_CTR;
+
+ typedef [public] struct {
+ [subcontext(0xFFFFFC01)] PAC_CREDENTIAL_DATA_CTR ctr;
+ } PAC_CREDENTIAL_DATA_NDR;
+
+ typedef [public] struct {
+ [value(0)] uint32 version;
+ uint32 encryption_type;
+ [flag(NDR_REMAINING)] DATA_BLOB encrypted_data;
+ } PAC_CREDENTIAL_INFO;
+
+ typedef struct {
+ lsa_String proxy_target;
+ uint32 num_transited_services;
+ [size_is(num_transited_services)] lsa_String *transited_services;
+ } PAC_CONSTRAINED_DELEGATION;
+
+ typedef [bitmap32bit] bitmap {
+ PAC_UPN_DNS_FLAG_CONSTRUCTED = 0x00000001,
+ PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID = 0x00000002
+ } PAC_UPN_DNS_FLAGS;
+
+ typedef struct {
+ [value(2*strlen_m(samaccountname))] uint16 samaccountname_size;
+ [relative_short,subcontext(0),subcontext_size(samaccountname_size),flag(NDR_ALIGN8|STR_NOTERM|NDR_REMAINING)] string *samaccountname;
+ [value(ndr_size_dom_sid(objectsid, ndr->flags))] uint16 objectsid_size;
+ [relative_short,subcontext(0),subcontext_size(objectsid_size)] dom_sid *objectsid;
+ } PAC_UPN_DNS_INFO_SAM_NAME_AND_SID;
+
+ typedef [nodiscriminant] union {
+ [case(PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID)] PAC_UPN_DNS_INFO_SAM_NAME_AND_SID sam_name_and_sid;
+ [default];
+ } PAC_UPN_DNS_INFO_EX;
+
+ typedef struct {
+ [value(2*strlen_m(upn_name))] uint16 upn_name_size;
+ [relative_short,subcontext(0),subcontext_size(upn_name_size),flag(NDR_ALIGN8|STR_NOTERM|NDR_REMAINING)] string *upn_name;
+ [value(2*strlen_m(dns_domain_name))] uint16 dns_domain_name_size;
+ [relative_short,subcontext(0),subcontext_size(dns_domain_name_size),flag(NDR_ALIGN8|STR_NOTERM|NDR_REMAINING)] string *dns_domain_name;
+ PAC_UPN_DNS_FLAGS flags;
+ [switch_is(flags & PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID)] PAC_UPN_DNS_INFO_EX ex;
+ } PAC_UPN_DNS_INFO;
+
+ typedef [bitmap32bit] bitmap {
+ PAC_ATTRIBUTE_FLAG_PAC_WAS_REQUESTED = 0x00000001,
+ PAC_ATTRIBUTE_FLAG_PAC_WAS_GIVEN_IMPLICITLY = 0x00000002
+ } PAC_ATTRIBUTE_INFO_FLAGS;
+
+ typedef struct {
+ uint32 flags_length; /* length in bits */
+ PAC_ATTRIBUTE_INFO_FLAGS flags;
+ } PAC_ATTRIBUTES_INFO;
+
+ typedef struct {
+ dom_sid sid;
+ } PAC_REQUESTER_SID;
+
+ typedef [public] struct {
+ PAC_LOGON_INFO *info;
+ } PAC_LOGON_INFO_CTR;
+
+ typedef [public] struct {
+ PAC_CONSTRAINED_DELEGATION *info;
+ } PAC_CONSTRAINED_DELEGATION_CTR;
+
+ typedef [public,v1_enum] enum {
+ PAC_TYPE_LOGON_INFO = 1,
+ PAC_TYPE_CREDENTIAL_INFO = 2,
+ PAC_TYPE_SRV_CHECKSUM = 6,
+ PAC_TYPE_KDC_CHECKSUM = 7,
+ PAC_TYPE_LOGON_NAME = 10,
+ PAC_TYPE_CONSTRAINED_DELEGATION = 11,
+ PAC_TYPE_UPN_DNS_INFO = 12,
+ PAC_TYPE_CLIENT_CLAIMS_INFO = 13,
+ PAC_TYPE_DEVICE_INFO = 14,
+ PAC_TYPE_DEVICE_CLAIMS_INFO = 15,
+ PAC_TYPE_TICKET_CHECKSUM = 16,
+ PAC_TYPE_ATTRIBUTES_INFO = 17,
+ PAC_TYPE_REQUESTER_SID = 18,
+ PAC_TYPE_FULL_CHECKSUM = 19
+ } PAC_TYPE;
+
+ typedef struct {
+ [flag(NDR_REMAINING)] DATA_BLOB remaining;
+ } DATA_BLOB_REM;
+
+ typedef [public,nodiscriminant,gensize] union {
+ [case(PAC_TYPE_LOGON_INFO)][subcontext(0xFFFFFC01)] PAC_LOGON_INFO_CTR logon_info;
+ [case(PAC_TYPE_CREDENTIAL_INFO)] PAC_CREDENTIAL_INFO credential_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;
+ [case(PAC_TYPE_CONSTRAINED_DELEGATION)][subcontext(0xFFFFFC01)]
+ PAC_CONSTRAINED_DELEGATION_CTR constrained_delegation;
+ [case(PAC_TYPE_UPN_DNS_INFO)] PAC_UPN_DNS_INFO upn_dns_info;
+ [case(PAC_TYPE_TICKET_CHECKSUM)] PAC_SIGNATURE_DATA ticket_checksum;
+ [case(PAC_TYPE_ATTRIBUTES_INFO)] PAC_ATTRIBUTES_INFO attributes_info;
+ [case(PAC_TYPE_REQUESTER_SID)] PAC_REQUESTER_SID requester_sid;
+ [case(PAC_TYPE_FULL_CHECKSUM)] PAC_SIGNATURE_DATA full_checksum;
+ /* when new PAC info types are added they are supposed to be done
+ in such a way that they are backwards compatible with existing
+ servers. This makes it safe to just use a [default] for
+ unknown types, which lets us ignore the data */
+ [default] [subcontext(0)] DATA_BLOB_REM unknown;
+ } PAC_INFO;
+
+ typedef [public,nopush,nopull] struct {
+ PAC_TYPE type;
+ [value(_ndr_size_PAC_INFO(info, type, LIBNDR_FLAG_ALIGN8))] uint32 _ndr_size;
+ /*
+ * We need to have two subcontexts to get the padding right,
+ * the outer subcontext uses NDR_ROUND(_ndr_size, 8), while
+ * the inner subcontext only uses _ndr_size.
+ *
+ * We do that in non-generated push/pull functions.
+ */
+ [relative,switch_is(type),subcontext(0),subcontext_size(NDR_ROUND(_ndr_size,8)),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 [public] struct {
+ PAC_TYPE type;
+ uint32 ndr_size;
+ [relative,subcontext(0),subcontext_size(NDR_ROUND(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;
+
+ const int NETLOGON_GENERIC_KRB5_PAC_VALIDATE = 3;
+
+ typedef [public] struct {
+ [value(NETLOGON_GENERIC_KRB5_PAC_VALIDATE)] uint32 MessageType;
+ uint32 ChecksumLength;
+ int32 SignatureType;
+ uint32 SignatureLength;
+ [flag(NDR_REMAINING)] DATA_BLOB ChecksumAndSignature;
+ } PAC_Validate;
+
+ /* used for samba3 netsamlogon cache */
+ typedef [public] struct {
+ time_t timestamp;
+ netr_SamInfo3 info3;
+ } netsamlogoncache_entry;
+}
diff --git a/librpc/idl/lsa.idl b/librpc/idl/lsa.idl
new file mode 100644
index 0000000..39ed3be
--- /dev/null
+++ b/librpc/idl/lsa.idl
@@ -0,0 +1,1407 @@
+#include "idl_types.h"
+
+/*
+ lsa interface definition
+*/
+
+import "misc.idl", "security.idl";
+
+[ uuid("12345778-1234-abcd-ef00-0123456789ab"),
+ version(0.0),
+ endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"),
+ pyhelper("librpc/ndr/py_lsa.c"),
+ pointer_default(unique),
+ helpstring("Local Security Authority")
+] interface lsarpc
+{
+ typedef bitmap security_secinfo security_secinfo;
+ typedef bitmap kerb_EncTypes kerb_EncTypes;
+
+ typedef [public] 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_term(string))] 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;
+ [charset(DOS),size_is(size),length_is(length)] uint8 *string;
+ } lsa_AsciiString;
+
+ typedef [public] struct {
+ [value(strlen_m(string))] uint16 length;
+ [value(strlen_m_term(string))] uint16 size;
+ [charset(DOS),size_is(size),length_is(length)] uint8 *string;
+ } lsa_AsciiStringLarge;
+
+ typedef [public] struct {
+ uint16 length;
+ uint16 size;
+ [size_is(size/2),length_is(length/2)] uint16 *array;
+ } lsa_BinaryString;
+
+ /******************/
+ /* Function: 0x00 */
+ NTSTATUS lsa_Close (
+ [in,out] policy_handle *handle
+ );
+
+
+ /******************/
+ /* Function: 0x01 */
+ [public] 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;
+
+ [public] NTSTATUS lsa_EnumPrivs (
+ [in] policy_handle *handle,
+ [in,out,ref] uint32 *resume_handle,
+ [out,ref] lsa_PrivArray *privs,
+ [in] uint32 max_count
+ );
+
+ /******************/
+ /* Function: 0x03 */
+ NTSTATUS lsa_QuerySecurity (
+ [in] policy_handle *handle,
+ [in] security_secinfo sec_info,
+ [out,ref] sec_desc_buf **sdbuf
+ );
+
+ /******************/
+ /* Function: 0x04 */
+ NTSTATUS lsa_SetSecObj(
+ [in] policy_handle *handle,
+ [in] security_secinfo sec_info,
+ [in,ref] sec_desc_buf *sdbuf
+ );
+
+ /******************/
+ /* Function: 0x05 */
+ [todo] NTSTATUS lsa_ChangePassword ();
+
+
+ /******************/
+ /* Function: 0x06 */
+ typedef struct {
+ uint3264 len; /* ignored */
+ uint16 impersonation_level;
+ uint8 context_mode;
+ uint8 effective_only;
+ } lsa_QosInfo;
+
+ typedef struct {
+ uint3264 len; /* ignored */
+ uint8 *root_dir;
+ [string,charset(UTF16)] uint16 *object_name;
+ uint32 attributes;
+ security_descriptor *sec_desc;
+ lsa_QosInfo *sec_qos;
+ } lsa_ObjectAttribute;
+
+ typedef [public,bitmap32bit] bitmap {
+ LSA_POLICY_VIEW_LOCAL_INFORMATION = 0x00000001,
+ LSA_POLICY_VIEW_AUDIT_INFORMATION = 0x00000002,
+ LSA_POLICY_GET_PRIVATE_INFORMATION = 0x00000004,
+ LSA_POLICY_TRUST_ADMIN = 0x00000008,
+ LSA_POLICY_CREATE_ACCOUNT = 0x00000010,
+ LSA_POLICY_CREATE_SECRET = 0x00000020,
+ LSA_POLICY_CREATE_PRIVILEGE = 0x00000040,
+ LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS = 0x00000080,
+ LSA_POLICY_SET_AUDIT_REQUIREMENTS = 0x00000100,
+ LSA_POLICY_AUDIT_LOG_ADMIN = 0x00000200,
+ LSA_POLICY_SERVER_ADMIN = 0x00000400,
+ LSA_POLICY_LOOKUP_NAMES = 0x00000800,
+ LSA_POLICY_NOTIFICATION = 0x00001000
+ } lsa_PolicyAccessMask;
+
+ const int LSA_POLICY_ALL_ACCESS =
+ (STANDARD_RIGHTS_REQUIRED_ACCESS |
+ LSA_POLICY_VIEW_LOCAL_INFORMATION |
+ LSA_POLICY_VIEW_AUDIT_INFORMATION |
+ LSA_POLICY_GET_PRIVATE_INFORMATION |
+ LSA_POLICY_TRUST_ADMIN |
+ LSA_POLICY_CREATE_ACCOUNT |
+ LSA_POLICY_CREATE_SECRET |
+ LSA_POLICY_CREATE_PRIVILEGE |
+ LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS |
+ LSA_POLICY_SET_AUDIT_REQUIREMENTS |
+ LSA_POLICY_AUDIT_LOG_ADMIN |
+ LSA_POLICY_SERVER_ADMIN |
+ LSA_POLICY_LOOKUP_NAMES |
+ LSA_POLICY_NOTIFICATION);
+
+ const int LSA_POLICY_READ =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ LSA_POLICY_VIEW_LOCAL_INFORMATION |
+ LSA_POLICY_VIEW_AUDIT_INFORMATION |
+ LSA_POLICY_GET_PRIVATE_INFORMATION);
+
+ const int LSA_POLICY_WRITE =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ LSA_POLICY_TRUST_ADMIN |
+ LSA_POLICY_CREATE_ACCOUNT |
+ LSA_POLICY_CREATE_SECRET |
+ LSA_POLICY_CREATE_PRIVILEGE |
+ LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS |
+ LSA_POLICY_SET_AUDIT_REQUIREMENTS |
+ LSA_POLICY_AUDIT_LOG_ADMIN |
+ LSA_POLICY_SERVER_ADMIN);
+
+ const int LSA_POLICY_EXECUTE =
+ (STANDARD_RIGHTS_EXECUTE_ACCESS |
+ LSA_POLICY_VIEW_LOCAL_INFORMATION |
+ LSA_POLICY_LOOKUP_NAMES);
+
+ typedef [public,bitmap32bit] bitmap {
+ LSA_ACCOUNT_VIEW = 0x00000001,
+ LSA_ACCOUNT_ADJUST_PRIVILEGES = 0x00000002,
+ LSA_ACCOUNT_ADJUST_QUOTAS = 0x00000004,
+ LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS = 0x00000008
+ } lsa_AccountAccessMask;
+
+ const int LSA_ACCOUNT_ALL_ACCESS =
+ (STANDARD_RIGHTS_REQUIRED_ACCESS |
+ LSA_ACCOUNT_VIEW |
+ LSA_ACCOUNT_ADJUST_PRIVILEGES |
+ LSA_ACCOUNT_ADJUST_QUOTAS |
+ LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS);
+
+ const int LSA_ACCOUNT_READ =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ LSA_ACCOUNT_VIEW);
+
+ const int LSA_ACCOUNT_WRITE =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ LSA_ACCOUNT_ADJUST_PRIVILEGES |
+ LSA_ACCOUNT_ADJUST_QUOTAS |
+ LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS);
+
+ const int LSA_ACCOUNT_EXECUTE =
+ (STANDARD_RIGHTS_EXECUTE_ACCESS);
+
+ typedef [public,bitmap32bit] bitmap {
+ LSA_SECRET_SET_VALUE = 0x00000001,
+ LSA_SECRET_QUERY_VALUE = 0x00000002
+ } lsa_SecretAccessMask;
+
+ const int LSA_SECRET_ALL_ACCESS =
+ (LSA_SECRET_QUERY_VALUE |
+ LSA_SECRET_SET_VALUE |
+ SEC_STD_DELETE |
+ STANDARD_RIGHTS_READ_ACCESS |
+ SEC_STD_WRITE_DAC |
+ SEC_STD_WRITE_OWNER); /* 0x000F0003 */
+
+ const int LSA_SECRET_READ =
+ (LSA_SECRET_QUERY_VALUE |
+ STANDARD_RIGHTS_READ_ACCESS); /* 0x00020002 */
+
+ const int LSA_SECRET_WRITE =
+ (LSA_SECRET_SET_VALUE |
+ STANDARD_RIGHTS_READ_ACCESS); /* 0x00020001 */
+
+ const int LSA_SECRET_EXECUTE =
+ (STANDARD_RIGHTS_READ_ACCESS); /* 0x00020000 */
+
+ typedef [public,bitmap32bit] bitmap {
+ LSA_TRUSTED_QUERY_DOMAIN_NAME = 0x00000001,
+ LSA_TRUSTED_QUERY_CONTROLLERS = 0x00000002,
+ LSA_TRUSTED_SET_CONTROLLERS = 0x00000004,
+ LSA_TRUSTED_QUERY_POSIX = 0x00000008,
+ LSA_TRUSTED_SET_POSIX = 0x00000010,
+ LSA_TRUSTED_SET_AUTH = 0x00000020,
+ LSA_TRUSTED_QUERY_AUTH = 0x00000040
+ } lsa_TrustedAccessMask;
+
+ const int LSA_TRUSTED_DOMAIN_ALL_ACCESS =
+ (LSA_TRUSTED_QUERY_DOMAIN_NAME |
+ LSA_TRUSTED_QUERY_CONTROLLERS |
+ LSA_TRUSTED_SET_CONTROLLERS |
+ LSA_TRUSTED_QUERY_POSIX |
+ LSA_TRUSTED_SET_POSIX |
+ LSA_TRUSTED_SET_AUTH |
+ LSA_TRUSTED_QUERY_AUTH |
+ SEC_STD_DELETE |
+ STANDARD_RIGHTS_READ_ACCESS |
+ SEC_STD_WRITE_DAC |
+ SEC_STD_WRITE_OWNER); /* 0x000F007F */
+
+ const int LSA_TRUSTED_DOMAIN_READ =
+ (LSA_TRUSTED_QUERY_DOMAIN_NAME |
+ STANDARD_RIGHTS_READ_ACCESS); /* 0x00020001 */
+
+ const int LSA_TRUSTED_DOMAIN_WRITE =
+ (LSA_TRUSTED_SET_CONTROLLERS |
+ LSA_TRUSTED_SET_POSIX |
+ LSA_TRUSTED_SET_AUTH |
+ STANDARD_RIGHTS_READ_ACCESS); /* 0x00020034 */
+
+ const int LSA_TRUSTED_DOMAIN_EXECUTE =
+ (LSA_TRUSTED_QUERY_DOMAIN_NAME |
+ LSA_TRUSTED_QUERY_POSIX |
+ STANDARD_RIGHTS_READ_ACCESS); /* 0x0002000C */
+
+
+ /* notice the screwup with the system_name - thats why MS created
+ OpenPolicy2 */
+ [public] NTSTATUS lsa_OpenPolicy (
+ [in,unique] uint16 *system_name,
+ [in] lsa_ObjectAttribute *attr,
+ [in] lsa_PolicyAccessMask access_mask,
+ [out] policy_handle *handle
+ );
+
+
+
+ /******************/
+ /* Function: 0x07 */
+
+ typedef struct {
+ uint32 percent_full;
+ uint32 maximum_log_size;
+ hyper retention_time;
+ uint8 shutdown_in_progress;
+ hyper time_to_shutdown;
+ uint32 next_audit_record;
+ } lsa_AuditLogInfo;
+
+ typedef [v1_enum] enum {
+ LSA_AUDIT_POLICY_NONE=0,
+ LSA_AUDIT_POLICY_SUCCESS=1,
+ LSA_AUDIT_POLICY_FAILURE=2,
+ LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE),
+ LSA_AUDIT_POLICY_CLEAR=4
+ } lsa_PolicyAuditPolicy;
+
+ typedef enum {
+ LSA_AUDIT_CATEGORY_SYSTEM = 0,
+ LSA_AUDIT_CATEGORY_LOGON = 1,
+ LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2,
+ LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3,
+ LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4,
+ LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5,
+ LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6,
+ LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7, /* only in win2k/2k3 */
+ LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8 /* only in win2k/2k3 */
+ } lsa_PolicyAuditEventType;
+
+ typedef struct {
+ uint32 auditing_mode;
+ [size_is(count)] lsa_PolicyAuditPolicy *settings;
+ uint32 count;
+ } lsa_AuditEventsInfo;
+
+ typedef struct {
+ lsa_StringLarge name;
+ dom_sid2 *sid;
+ } lsa_DomainInfo;
+
+ typedef struct {
+ lsa_String name;
+ } lsa_PDAccountInfo;
+
+ typedef [v1_enum] enum {
+ LSA_ROLE_BACKUP=2,
+ LSA_ROLE_PRIMARY=3
+ } lsa_Role;
+
+ typedef struct {
+ lsa_Role 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_hyper db_create_time;
+ } lsa_ModificationInfo;
+
+ typedef struct {
+ uint8 shutdown_on_full;
+ } lsa_AuditFullSetInfo;
+
+ typedef struct {
+ uint8 shutdown_on_full;
+ uint8 log_is_full;
+ } lsa_AuditFullQueryInfo;
+
+ typedef [public] 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_MOD=9,
+ LSA_POLICY_INFO_AUDIT_FULL_SET=10,
+ LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
+ LSA_POLICY_INFO_DNS=12,
+ LSA_POLICY_INFO_DNS_INT=13,
+ LSA_POLICY_INFO_L_ACCOUNT_DOMAIN=14
+ } lsa_PolicyInfo;
+
+ 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_MOD)] lsa_ModificationInfo mod;
+ [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;
+ [case(LSA_POLICY_INFO_DNS_INT)] lsa_DnsDomainInfo dns;
+ [case(LSA_POLICY_INFO_L_ACCOUNT_DOMAIN)] lsa_DomainInfo l_account_domain;
+ } lsa_PolicyInformation;
+
+ NTSTATUS lsa_QueryInfoPolicy(
+ [in] policy_handle *handle,
+ [in] lsa_PolicyInfo level,
+ [out,ref,switch_is(level)] lsa_PolicyInformation **info
+ );
+
+ /******************/
+ /* Function: 0x08 */
+ NTSTATUS lsa_SetInfoPolicy (
+ [in] policy_handle *handle,
+ [in] lsa_PolicyInfo level,
+ [in,switch_is(level)] lsa_PolicyInformation *info
+ );
+
+ /******************/
+ /* Function: 0x09 */
+ [todo] NTSTATUS lsa_ClearAuditLog ();
+
+ /******************/
+ /* Function: 0x0a */
+ [public] NTSTATUS lsa_CreateAccount (
+ [in] policy_handle *handle,
+ [in,ref] dom_sid2 *sid,
+ [in] lsa_AccountAccessMask 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,20480)] uint32 num_sids;
+ [size_is(num_sids)] lsa_SidPtr *sids;
+ } lsa_SidArray;
+
+ [public] NTSTATUS lsa_EnumAccounts(
+ [in] policy_handle *handle,
+ [in,out,ref] uint32 *resume_handle,
+ [out,ref] lsa_SidArray *sids,
+ [in,range(0,8192)] uint32 num_entries
+ );
+
+ /*************************************************/
+ /* Function: 0x0c */
+
+ [public] NTSTATUS lsa_CreateTrustedDomain(
+ [in] policy_handle *policy_handle,
+ [in] lsa_DomainInfo *info,
+ [in] lsa_TrustedAccessMask 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,ref] uint32 *resume_handle,
+ [out,ref] lsa_DomainList *domains,
+ [in] uint32 max_size
+ );
+
+
+ /******************/
+ /* Function: 0x0e */
+ typedef [public] 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 */
+ SID_NAME_LABEL = 10 /* Mandatory Label */
+ } 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 [public] struct {
+ [range(0,1000)] uint32 count;
+ [size_is(count)] lsa_DomainInfo *domains;
+ uint32 max_size;
+ } lsa_RefDomainList;
+
+ /* Level 1: Ask everywhere
+ * Level 2: Ask domain and trusted domains, no builtin and wkn
+ * Level 3: Only ask domain
+ * Level 4: W2k3ad: Only ask AD trusts
+ * Level 5: Only ask transitive forest trusts
+ * Level 6: Like 4
+ */
+
+ typedef [public] enum {
+ LSA_LOOKUP_NAMES_ALL = 1,
+ LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2,
+ LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY = 3,
+ LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY = 4,
+ LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY = 5,
+ LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6,
+ LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC = 7
+ } lsa_LookupNamesLevel;
+
+ [public] NTSTATUS lsa_LookupNames (
+ [in] policy_handle *handle,
+ [in,range(0,1000)] uint32 num_names,
+ [in,size_is(num_names)] lsa_String names[],
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransSidArray *sids,
+ [in] lsa_LookupNamesLevel level,
+ [in,out,ref] uint32 *count
+ );
+
+
+ /******************/
+ /* Function: 0x0f */
+
+ typedef struct {
+ lsa_SidType sid_type;
+ lsa_String name;
+ uint32 sid_index;
+ } lsa_TranslatedName;
+
+ typedef [public] struct {
+ [range(0,20480)] uint32 count;
+ [size_is(count)] lsa_TranslatedName *names;
+ } lsa_TransNameArray;
+
+ [public] NTSTATUS lsa_LookupSids(
+ [in] policy_handle *handle,
+ [in,ref] lsa_SidArray *sids,
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransNameArray *names,
+ [in] lsa_LookupNamesLevel level,
+ [in,out,ref] uint32 *count
+ );
+
+
+ /* Function: 0x10 */
+ [public] NTSTATUS lsa_CreateSecret(
+ [in] policy_handle *handle,
+ [in] lsa_String name,
+ [in] lsa_SecretAccessMask access_mask,
+ [out] policy_handle *sec_handle
+ );
+
+
+ /*****************************************/
+ /* Function: 0x11 */
+ NTSTATUS lsa_OpenAccount(
+ [in] policy_handle *handle,
+ [in,ref] dom_sid2 *sid,
+ [in] lsa_AccountAccessMask 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,ref] lsa_PrivilegeSet **privs
+ );
+
+
+ /****************************************/
+ /* Function: 0x13 */
+ NTSTATUS lsa_AddPrivilegesToAccount(
+ [in] policy_handle *handle,
+ [in,ref] lsa_PrivilegeSet *privs
+ );
+
+
+ /****************************************/
+ /* Function: 0x14 */
+ NTSTATUS lsa_RemovePrivilegesFromAccount(
+ [in] policy_handle *handle,
+ [in] uint8 remove_all,
+ [in,unique] lsa_PrivilegeSet *privs
+ );
+
+ /* Function: 0x15 */
+ [todo] NTSTATUS lsa_GetQuotasForAccount();
+
+ /* Function: 0x16 */
+ [todo] NTSTATUS lsa_SetQuotasForAccount();
+
+ /* Function: 0x17 */
+ NTSTATUS lsa_GetSystemAccessAccount(
+ [in] policy_handle *handle,
+ [out,ref] lsa_AccountAccessMask *access_mask
+ );
+
+ /* Function: 0x18 */
+ NTSTATUS lsa_SetSystemAccessAccount(
+ [in] policy_handle *handle,
+ [in] lsa_AccountAccessMask access_mask
+ );
+
+ /* Function: 0x19 */
+ NTSTATUS lsa_OpenTrustedDomain(
+ [in] policy_handle *handle,
+ [in] dom_sid2 *sid,
+ [in] lsa_TrustedAccessMask access_mask,
+ [out] policy_handle *trustdom_handle
+ );
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint3264 length;
+ uint3264 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 = 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_AUTH_INFO_INTERNAL = 9,
+ LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL = 10,
+ LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL = 11,
+ LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL = 12,
+ LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES = 13
+ } lsa_TrustDomInfoEnum;
+
+ typedef [public,bitmap32bit] bitmap {
+ LSA_TRUST_DIRECTION_INBOUND = 0x00000001,
+ LSA_TRUST_DIRECTION_OUTBOUND = 0x00000002
+ } lsa_TrustDirection;
+
+ typedef [public,v1_enum] enum {
+ LSA_TRUST_TYPE_DOWNLEVEL = 0x00000001,
+ LSA_TRUST_TYPE_UPLEVEL = 0x00000002,
+ LSA_TRUST_TYPE_MIT = 0x00000003,
+ LSA_TRUST_TYPE_DCE = 0x00000004
+ } lsa_TrustType;
+
+ typedef [public,bitmap32bit] bitmap {
+ LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE = 0x00000001,
+ LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY = 0x00000002,
+ LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004,
+ LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE = 0x00000008,
+ LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010,
+ LSA_TRUST_ATTRIBUTE_WITHIN_FOREST = 0x00000020,
+ LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL = 0x00000040,
+ LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION = 0x00000080,
+ LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION_NO_TGT_DELEGATION = 0x00000200,
+ LSA_TRUST_ATTRIBUTE_PIM_TRUST = 0x00000400,
+ LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION_ENABLE_TGT_DELEGATION = 0x00000800
+ } lsa_TrustAttributes;
+
+ typedef struct {
+ lsa_StringLarge netbios_name;
+ } lsa_TrustDomainInfoName;
+
+
+ typedef struct {
+ uint32 entries;
+ [size_is(entries)] lsa_StringLarge *netbios_names;
+ } lsa_TrustDomainInfoControllers;
+
+ 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 [public] struct {
+ lsa_StringLarge domain_name;
+ lsa_StringLarge netbios_name;
+ dom_sid2 *sid;
+ lsa_TrustDirection trust_direction;
+ lsa_TrustType trust_type;
+ lsa_TrustAttributes trust_attributes;
+ } lsa_TrustDomainInfoInfoEx;
+
+ typedef [public,v1_enum] enum {
+ TRUST_AUTH_TYPE_NONE = 0,
+ TRUST_AUTH_TYPE_NT4OWF = 1,
+ TRUST_AUTH_TYPE_CLEAR = 2,
+ TRUST_AUTH_TYPE_VERSION = 3
+ } lsa_TrustAuthType;
+
+ typedef struct {
+ NTTIME_hyper last_update_time;
+ lsa_TrustAuthType AuthType;
+ lsa_DATA_BUF2 data;
+ } lsa_TrustDomainInfoBuffer;
+
+ typedef [public] 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_DATA_BUF2 auth_blob;
+ } lsa_TrustDomainInfoAuthInfoInternal;
+
+ typedef struct {
+ lsa_TrustDomainInfoInfoEx info_ex;
+ lsa_TrustDomainInfoPosixOffset posix_offset;
+ lsa_TrustDomainInfoAuthInfoInternal auth_info;
+ } lsa_TrustDomainInfoFullInfoInternal;
+
+ typedef struct {
+ lsa_TrustDomainInfoInfoEx info_ex;
+ uint32 forest_trust_length;
+ [size_is(forest_trust_length)] uint8 *forest_trust_data;
+ } lsa_TrustDomainInfoInfoEx2Internal;
+
+ typedef struct {
+ lsa_TrustDomainInfoInfoEx2Internal info;
+ lsa_TrustDomainInfoPosixOffset posix_offset;
+ lsa_TrustDomainInfoAuthInfo auth_info;
+ } lsa_TrustDomainInfoFullInfo2Internal;
+
+ typedef struct {
+ kerb_EncTypes enc_types;
+ } lsa_TrustDomainInfoSupportedEncTypes;
+
+ typedef [switch_type(lsa_TrustDomInfoEnum)] union {
+ [case(LSA_TRUSTED_DOMAIN_INFO_NAME)]
+ lsa_TrustDomainInfoName name;
+ [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)]
+ lsa_TrustDomainInfoControllers controllers;
+ [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_AUTH_INFO_INTERNAL)]
+ lsa_TrustDomainInfoAuthInfoInternal auth_info_internal;
+ [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)]
+ lsa_TrustDomainInfoFullInfoInternal full_info_internal;
+ [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)]
+ lsa_TrustDomainInfoInfoEx2Internal info_ex2_internal;
+ [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)]
+ lsa_TrustDomainInfoFullInfo2Internal full_info2_internal;
+ [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES)]
+ lsa_TrustDomainInfoSupportedEncTypes enc_types;
+ } lsa_TrustedDomainInfo;
+
+ /* Function: 0x1a */
+ NTSTATUS lsa_QueryTrustedDomainInfo(
+ [in] policy_handle *trustdom_handle,
+ [in] lsa_TrustDomInfoEnum level,
+ [out,switch_is(level),ref] lsa_TrustedDomainInfo **info
+ );
+
+ /* Function: 0x1b */
+ NTSTATUS lsa_SetInformationTrustedDomain(
+ [in] policy_handle *trustdom_handle,
+ [in] lsa_TrustDomInfoEnum level,
+ [in,switch_is(level)] lsa_TrustedDomainInfo *info
+ );
+
+ /* Function: 0x1c */
+ [public] NTSTATUS lsa_OpenSecret(
+ [in] policy_handle *handle,
+ [in] lsa_String name,
+ [in] lsa_SecretAccessMask access_mask,
+ [out] policy_handle *sec_handle
+ );
+
+ /* Function: 0x1d */
+
+ [public] 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 */
+ [public] 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,ref] lsa_String *name,
+ [out,ref] lsa_LUID *luid
+ );
+
+
+ /* Function: 0x20 */
+ NTSTATUS lsa_LookupPrivName(
+ [in] policy_handle *handle,
+ [in,ref] lsa_LUID *luid,
+ [out,ref] lsa_StringLarge **name
+ );
+
+
+ /*******************/
+ /* Function: 0x21 */
+ NTSTATUS lsa_LookupPrivDisplayName(
+ [in] policy_handle *handle,
+ [in,ref] lsa_String *name,
+ [in] uint16 language_id,
+ [in] uint16 language_id_sys,
+ [out,ref] lsa_StringLarge **disp_name,
+ /* see http://www.microsoft.com/globaldev/nlsweb/ for
+ language definitions */
+ [out,ref] uint16 *returned_language_id
+ );
+
+ /*******************/
+ /* Function: 0x22 */
+ NTSTATUS lsa_DeleteObject (
+ [in,out] policy_handle *handle
+ );
+
+ /*******************/
+ /* 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 {
+ [range(0,256)] uint32 count;
+ [size_is(count)] lsa_StringLarge *names;
+ } lsa_RightSet;
+
+ NTSTATUS lsa_EnumAccountRights (
+ [in] policy_handle *handle,
+ [in,ref] dom_sid2 *sid,
+ [out,ref] lsa_RightSet *rights
+ );
+
+
+ /**********************/
+ /* Function: 0x25 */
+ NTSTATUS lsa_AddAccountRights (
+ [in] policy_handle *handle,
+ [in,ref] dom_sid2 *sid,
+ [in,ref] lsa_RightSet *rights
+ );
+
+ /**********************/
+ /* Function: 0x26 */
+ NTSTATUS lsa_RemoveAccountRights (
+ [in] policy_handle *handle,
+ [in,ref] dom_sid2 *sid,
+ [in] uint8 remove_all,
+ [in,ref] lsa_RightSet *rights
+ );
+
+ /* Function: 0x27 */
+ NTSTATUS lsa_QueryTrustedDomainInfoBySid(
+ [in] policy_handle *handle,
+ [in,ref] dom_sid2 *dom_sid,
+ [in] lsa_TrustDomInfoEnum level,
+ [out,switch_is(level),ref] lsa_TrustedDomainInfo **info
+ );
+
+ /* Function: 0x28 */
+ NTSTATUS lsa_SetTrustedDomainInfo(
+ [in] policy_handle *handle,
+ [in] dom_sid2 *dom_sid,
+ [in] lsa_TrustDomInfoEnum level,
+ [in,switch_is(level)] lsa_TrustedDomainInfo *info
+ );
+
+ /* Function: 0x29 */
+ NTSTATUS lsa_DeleteTrustedDomain(
+ [in] policy_handle *handle,
+ [in] dom_sid2 *dom_sid
+ );
+
+ /* Function: 0x2a */
+ NTSTATUS lsa_StorePrivateData(
+ [in] policy_handle *handle,
+ [in,ref] lsa_String *name,
+ [in,unique] lsa_DATA_BUF *val
+ );
+
+ /* Function: 0x2b */
+ NTSTATUS lsa_RetrievePrivateData(
+ [in] policy_handle *handle,
+ [in,ref] lsa_String *name,
+ [in,out,ref] lsa_DATA_BUF **val
+ );
+
+ /**********************/
+ /* Function: 0x2c */
+ [public] NTSTATUS lsa_OpenPolicy2 (
+ [in,unique] [string,charset(UTF16)] uint16 *system_name,
+ [in] lsa_ObjectAttribute *attr,
+ [in] lsa_PolicyAccessMask access_mask,
+ [out] policy_handle *handle
+ );
+
+ /**********************/
+ /* Function: 0x2d */
+ NTSTATUS lsa_GetUserName(
+ [in,unique] [string,charset(UTF16)] uint16 *system_name,
+ [in,out,ref] lsa_String **account_name,
+ [in,out,unique] lsa_String **authority_name
+ );
+
+ /**********************/
+ /* Function: 0x2e */
+
+ NTSTATUS lsa_QueryInfoPolicy2(
+ [in] policy_handle *handle,
+ [in] lsa_PolicyInfo level,
+ [out,ref,switch_is(level)] lsa_PolicyInformation **info
+ );
+
+ /* Function 0x2f */
+ NTSTATUS lsa_SetInfoPolicy2(
+ [in] policy_handle *handle,
+ [in] lsa_PolicyInfo level,
+ [in,switch_is(level)] lsa_PolicyInformation *info
+ );
+
+ /**********************/
+ /* Function 0x30 */
+ NTSTATUS lsa_QueryTrustedDomainInfoByName(
+ [in] policy_handle *handle,
+ [in,ref] lsa_String *trusted_domain,
+ [in] lsa_TrustDomInfoEnum level,
+ [out,ref,switch_is(level)] lsa_TrustedDomainInfo **info
+ );
+
+ /**********************/
+ /* Function 0x31 */
+ [public] NTSTATUS lsa_SetTrustedDomainInfoByName(
+ [in] policy_handle *handle,
+ [in,ref] lsa_String *trusted_domain,
+ [in] lsa_TrustDomInfoEnum level,
+ [in,ref,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(
+ [in] policy_handle *policy_handle,
+ [in] lsa_TrustDomainInfoInfoEx *info,
+ [in] lsa_TrustDomainInfoAuthInfo *auth_info,
+ [in] lsa_TrustedAccessMask access_mask,
+ [out] policy_handle *trustdom_handle
+ );
+
+
+ /* Function 0x34 */
+ NTSTATUS lsa_CloseTrustedDomainEx(
+ [in,out] policy_handle *handle
+ );
+
+ /* Function 0x35 */
+ typedef [bitmap32bit] bitmap {
+ LSA_POLICY_KERBEROS_VALIDATE_CLIENT = 0x00000080
+ } lsa_krbAuthenticationOptions;
+
+ /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000
+ for reserved - gd */
+ typedef struct {
+ lsa_krbAuthenticationOptions authentication_options;
+ hyper service_tkt_lifetime;
+ hyper user_tkt_lifetime;
+ hyper user_tkt_renewaltime;
+ hyper clock_skew;
+ hyper reserved;
+ } 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,ref,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] lsa_TrustedAccessMask access_mask,
+ [out] policy_handle *trustdom_handle
+ );
+
+ /* Function 0x38 */
+ [todo] 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;
+
+ typedef [v1_enum] enum {
+ LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES = 0x00000000,
+ LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES_LOCAL = 0x80000000
+ } lsa_LookupOptions;
+
+ typedef [v1_enum] enum {
+ LSA_CLIENT_REVISION_1 = 0x00000001,
+ LSA_CLIENT_REVISION_2 = 0x00000002
+ } lsa_ClientRevision;
+
+ [public] NTSTATUS lsa_LookupSids2(
+ [in] policy_handle *handle,
+ [in,ref] lsa_SidArray *sids,
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransNameArray2 *names,
+ [in] lsa_LookupNamesLevel level,
+ [in,out,ref] uint32 *count,
+ [in] lsa_LookupOptions lookup_options,
+ [in] lsa_ClientRevision client_revision
+ );
+
+ /**********************/
+ /* 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;
+
+ [public] NTSTATUS lsa_LookupNames2 (
+ [in] policy_handle *handle,
+ [in,range(0,1000)] uint32 num_names,
+ [in,size_is(num_names)] lsa_String names[],
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransSidArray2 *sids,
+ [in] lsa_LookupNamesLevel level,
+ [in,out,ref] uint32 *count,
+ [in] lsa_LookupOptions lookup_options,
+ [in] lsa_ClientRevision client_revision
+ );
+
+ /* Function 0x3b */
+ NTSTATUS lsa_CreateTrustedDomainEx2(
+ [in] policy_handle *policy_handle,
+ [in] lsa_TrustDomainInfoInfoEx *info,
+ [in] lsa_TrustDomainInfoAuthInfoInternal *auth_info_internal,
+ [in] lsa_TrustedAccessMask access_mask,
+ [out] policy_handle *trustdom_handle
+ );
+
+ /* Function 0x3c */
+ [todo] NTSTATUS lsa_CREDRWRITE();
+
+ /* Function 0x3d */
+ [todo] NTSTATUS lsa_CREDRREAD();
+
+ /* Function 0x3e */
+ [todo] NTSTATUS lsa_CREDRENUMERATE();
+
+ /* Function 0x3f */
+ [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
+
+ /* Function 0x40 */
+ [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
+
+ /* Function 0x41 */
+ [todo] NTSTATUS lsa_CREDRDELETE();
+
+ /* Function 0x42 */
+ [todo] NTSTATUS lsa_CREDRGETTARGETINFO();
+
+ /* Function 0x43 */
+ [todo] NTSTATUS lsa_CREDRPROFILELOADED();
+
+ /**********************/
+ /* Function 0x44 */
+ typedef struct {
+ lsa_SidType sid_type;
+ dom_sid2 *sid;
+ uint32 sid_index;
+ uint32 flags;
+ } lsa_TranslatedSid3;
+
+ typedef struct {
+ [range(0,1000)] uint32 count;
+ [size_is(count)] lsa_TranslatedSid3 *sids;
+ } lsa_TransSidArray3;
+
+ [public] NTSTATUS lsa_LookupNames3 (
+ [in] policy_handle *handle,
+ [in,range(0,1000)] uint32 num_names,
+ [in,size_is(num_names)] lsa_String names[],
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransSidArray3 *sids,
+ [in] lsa_LookupNamesLevel level,
+ [in,out,ref] uint32 *count,
+ [in] lsa_LookupOptions lookup_options,
+ [in] lsa_ClientRevision client_revision
+ );
+
+ /* Function 0x45 */
+ [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES();
+
+ /* Function 0x46 */
+ [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT();
+
+ /* Function 0x47 */
+ [todo] NTSTATUS lsa_LSARGENAUDITEVENT();
+
+ /* Function 0x48 */
+ [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
+
+ /* Function 0x49 */
+ typedef [bitmap32bit,public] bitmap {
+ /* these apply to LSA_FOREST_TRUST_TOP_LEVEL_NAME */
+ LSA_TLN_DISABLED_NEW = 0x00000001,
+ LSA_TLN_DISABLED_ADMIN = 0x00000002,
+ LSA_TLN_DISABLED_CONFLICT = 0x00000004,
+
+ /* these apply to LSA_FOREST_TRUST_DOMAIN_INFO */
+ LSA_SID_DISABLED_ADMIN = 0x00000001,
+ LSA_SID_DISABLED_CONFLICT = 0x00000002,
+ LSA_NB_DISABLED_ADMIN = 0x00000004,
+ LSA_NB_DISABLED_CONFLICT = 0x00000008
+ } lsa_ForestTrustRecordFlags;
+
+ const uint32 LSA_TLN_DISABLED_MASK = (
+ LSA_TLN_DISABLED_NEW |
+ LSA_TLN_DISABLED_ADMIN |
+ LSA_TLN_DISABLED_CONFLICT);
+ const uint32 LSA_SID_DISABLED_MASK = (
+ LSA_SID_DISABLED_ADMIN |
+ LSA_SID_DISABLED_CONFLICT);
+ const uint32 LSA_NB_DISABLED_MASK = (
+ LSA_NB_DISABLED_ADMIN |
+ LSA_NB_DISABLED_CONFLICT);
+
+ typedef enum {
+ LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
+ LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
+ LSA_FOREST_TRUST_DOMAIN_INFO = 2,
+ LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
+ } lsa_ForestTrustRecordType;
+
+ typedef struct {
+ [range(0,131072)] uint3264 length;
+ [size_is(length)] uint8 *data;
+ } lsa_ForestTrustBinaryData;
+
+ typedef struct {
+ dom_sid2 *domain_sid;
+ lsa_StringLarge dns_domain_name;
+ lsa_StringLarge netbios_domain_name;
+ } lsa_ForestTrustDomainInfo;
+
+ typedef [switch_type(lsa_ForestTrustRecordType)] union {
+ [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_StringLarge top_level_name;
+ [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
+ [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
+ [default] lsa_ForestTrustBinaryData data;
+ } lsa_ForestTrustData;
+
+ typedef struct {
+ lsa_ForestTrustRecordFlags flags;
+ lsa_ForestTrustRecordType type;
+ NTTIME_hyper time;
+ [switch_is(type)] lsa_ForestTrustData forest_trust_data;
+ } lsa_ForestTrustRecord;
+
+ typedef [public] struct {
+ [range(0,4000)] uint32 count;
+ [size_is(count)] lsa_ForestTrustRecord **entries;
+ } lsa_ForestTrustInformation;
+
+ [public] NTSTATUS lsa_lsaRQueryForestTrustInformation(
+ [in] policy_handle *handle,
+ [in,ref] lsa_String *trusted_domain_name,
+ [in] lsa_ForestTrustRecordType highest_record_type,
+ [out,ref] lsa_ForestTrustInformation **forest_trust_info
+ );
+
+ /*****************
+ * Function 0x4a */
+
+ typedef [v1_enum] enum {
+ LSA_FOREST_TRUST_COLLISION_TDO = 0,
+ LSA_FOREST_TRUST_COLLISION_XREF = 1,
+ LSA_FOREST_TRUST_COLLISION_OTHER = 2
+ } lsa_ForestTrustCollisionRecordType;
+
+ typedef [public] struct {
+ uint32 index;
+ lsa_ForestTrustCollisionRecordType type;
+ lsa_ForestTrustRecordFlags flags;
+ lsa_String name;
+ } lsa_ForestTrustCollisionRecord;
+
+ typedef [public] struct {
+ uint32 count;
+ [size_is(count)] lsa_ForestTrustCollisionRecord **entries;
+ } lsa_ForestTrustCollisionInfo;
+
+ [public] NTSTATUS lsa_lsaRSetForestTrustInformation(
+ [in] policy_handle *handle,
+ [in,ref] lsa_StringLarge *trusted_domain_name,
+ [in] lsa_ForestTrustRecordType highest_record_type,
+ [in,ref] lsa_ForestTrustInformation *forest_trust_info,
+ [in] boolean8 check_only,
+ [out,ref] lsa_ForestTrustCollisionInfo **collision_info
+ );
+
+ /* Function 0x4b */
+ [todo] NTSTATUS lsa_CREDRRENAME();
+
+ /*****************/
+ /* Function 0x4c */
+
+ [public] NTSTATUS lsa_LookupSids3(
+ [in,ref] lsa_SidArray *sids,
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransNameArray2 *names,
+ [in] lsa_LookupNamesLevel level,
+ [in,out,ref] uint32 *count,
+ [in] lsa_LookupOptions lookup_options,
+ [in] lsa_ClientRevision client_revision
+ );
+
+ const int LSA_CLIENT_REVISION_NO_DNS = 0x00000001;
+ const int LSA_CLIENT_REVISION_DNS = 0x00000002;
+
+ const int LSA_LOOKUP_OPTIONS_NO_ISOLATED = 0x80000000;
+
+ /* Function 0x4d */
+ NTSTATUS lsa_LookupNames4(
+ [in,range(0,1000)] uint32 num_names,
+ [in,size_is(num_names)] lsa_String names[],
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransSidArray3 *sids,
+ [in] lsa_LookupNamesLevel level,
+ [in,out,ref] uint32 *count,
+ [in] lsa_LookupOptions lookup_options,
+ [in] lsa_ClientRevision client_revision
+ );
+
+ /* Function 0x4e */
+ [todo] NTSTATUS lsa_LSAROPENPOLICYSCE();
+
+ /* Function 0x4f */
+ [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
+
+ /* Function 0x50 */
+ [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
+
+ /* Function 0x51 */
+ [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
+
+}
diff --git a/librpc/idl/mdssvc.idl b/librpc/idl/mdssvc.idl
new file mode 100644
index 0000000..e7004f0
--- /dev/null
+++ b/librpc/idl/mdssvc.idl
@@ -0,0 +1,68 @@
+import "misc.idl";
+[
+ uuid("885d85fb-c754-4062-a0e7-6872ce0064f4"),
+ endpoint("ncacn_np:[\\pipe\\mdssvc]", "ncalrpc:"),
+ version(2.0),
+ helpstring("Spotlight metadata search service")
+]
+interface mdssvc
+{
+ void mdssvc_open(
+ [in,out,ref] uint32 *device_id,
+ [in,out,ref] uint32 *unkn2, /* always 0x17 ? */
+ [in,out,ref] uint32 *unkn3, /* always 0 ? */
+ [in][string,charset(UTF8),size_is(1025)] uint8 share_mount_path[],
+ [in][string,charset(UTF8),size_is(1025)] uint8 share_name[],
+ [out,string,charset(UTF8),size_is(1025)] uint8 share_path[],
+ [out,ref] policy_handle *handle
+ );
+
+ void mdssvc_unknown1(
+ [in] policy_handle *handle,
+ [in] uint32 unkn1, /* always 0, some status ? */
+ [in] uint32 device_id,
+ [in] uint32 unkn3, /* = mdssvc_open.unkn2 ? */
+ [in] uint32 unkn4, /* always 0, some status ? */
+ [in] uint32 uid,
+ [in] uint32 gid,
+ [out,ref] uint32 *status,
+ [out,ref] uint32 *flags, /* always 0x6b000001 ? */
+ [out,ref] uint32 *unkn7 /* always 0 ? */
+ );
+
+ typedef [public] struct {
+ uint32 length;
+ uint32 size;
+ [size_is(size),length_is(length)] uint8 *spotlight_blob;
+ } mdssvc_blob;
+
+ void mdssvc_cmd(
+ [in] policy_handle *handle,
+ [in] uint32 unkn1, /* always 0, status ? */
+ [in] uint32 device_id,
+ [in] uint32 unkn3, /* = mdssvc_open.unkn2 ? */
+ [in] uint32 unkn4, /* always 0 ? */
+ [in] uint32 flags, /* always 0x6b000001 ? */
+ [in] mdssvc_blob request_blob,
+ [in] uint32 unkn5, /* always 0 ? */
+ [in] uint32 max_fragment_size1,
+ [in] uint32 unkn6, /* always 1 ? */
+ /* always max_fragment_size1 = max_fragment_size2 ? */
+ [in] uint32 max_fragment_size2,
+ [in] uint32 unkn7, /* always 0 ? */
+ [in] uint32 unkn8, /* always 0 ? */
+ [out,ref] uint32 *fragment,
+ [out,ref] mdssvc_blob *response_blob,
+ [out,ref] uint32 *unkn9 /* always 0 ? */
+ );
+
+ void mdssvc_close(
+ [in] policy_handle *in_handle,
+ [in] uint32 unkn1, /* always 0, some status ? */
+ [in] uint32 device_id,
+ [in] uint32 unkn2, /* = mdssvc_open.unkn2 ? */
+ [in] uint32 unkn3, /* always 0, some status ? */
+ [out,ref] policy_handle *out_handle,
+ [out,ref] uint32 *status
+ );
+}
diff --git a/librpc/idl/messaging.idl b/librpc/idl/messaging.idl
new file mode 100644
index 0000000..5d217c0
--- /dev/null
+++ b/librpc/idl/messaging.idl
@@ -0,0 +1,202 @@
+#include "idl_types.h"
+
+import "server_id.idl";
+
+/*
+ IDL structures for messaging code
+*/
+
+[
+ pointer_default(unique)
+]
+interface messaging
+{
+ const int MSG_TYPE_MASK = 0xFFFF;
+
+ typedef [v1_enum,public] enum {
+
+ /* general messages */
+ MSG_DEBUG = 0x0001,
+ MSG_PING = 0x0002,
+ MSG_PONG = 0x0003,
+ MSG_PROFILE = 0x0004,
+ MSG_REQ_DEBUGLEVEL = 0x0005,
+ MSG_DEBUGLEVEL = 0x0006,
+ MSG_REQ_PROFILELEVEL = 0x0007,
+ MSG_PROFILELEVEL = 0x0008,
+ MSG_REQ_POOL_USAGE = 0x0009,
+ MSG_POOL_USAGE = 0x000A,
+
+ /* If dmalloc is included, set a steady-state mark */
+ MSG_REQ_DMALLOC_MARK = 0x000B,
+
+ /* If dmalloc is included, dump to the dmalloc log a description of
+ * what has changed since the last MARK */
+ MSG_REQ_DMALLOC_LOG_CHANGED = 0x000C,
+ MSG_SHUTDOWN = 0x000D,
+
+ /* ID_CACHE_FLUSH = 0x000E, obsoleted */
+ ID_CACHE_DELETE = 0x000F,
+ ID_CACHE_KILL = 0x0010,
+
+ /* Changes to smb.conf are really of general interest */
+ MSG_SMB_CONF_UPDATED = 0x0021,
+
+ MSG_PREFORK_CHILD_EVENT = 0x0031,
+ MSG_PREFORK_PARENT_EVENT = 0x0032,
+
+ MSG_REQ_RINGBUF_LOG = 0x0033,
+ MSG_RINGBUF_LOG = 0x0034,
+
+ MSG_DAEMON_READY_FD = 0x0035,
+
+ /* nmbd messages */
+ MSG_FORCE_ELECTION = 0x0101,
+ MSG_WINS_NEW_ENTRY = 0x0102,
+ MSG_SEND_PACKET = 0x0103,
+
+ /* printing messages */
+ /* MSG_PRINTER_NOTIFY = 0x2001, Obsoleted */
+ MSG_PRINTER_NOTIFY2 = 0x0202,
+ MSG_PRINTER_DRVUPGRADE = 0x0203,
+ MSG_PRINTERDATA_INIT_RESET = 0x0204,
+ MSG_PRINTER_UPDATE = 0x0205,
+ MSG_PRINTER_MOD = 0x0206,
+ MSG_PRINTER_PCAP = 0x0207,
+
+ /* smbd messages */
+ /* MSG_SMB_CONF_UPDATED = 0x0301, Obsoleted */
+ MSG_SMB_FORCE_TDIS = 0x0302,
+ /* MSG_SMB_SAM_SYNC = 0x0303, Obsoleted */
+ /* MSG_SMB_SAM_REPL = 0x0304, Obsoleted */
+ /* MSG_SMB_UNLOCK = 0x0305, Obsoleted */
+ MSG_SMB_BREAK_REQUEST = 0x0306,
+ /* MSG_SMB_BREAK_RESPONSE = 0x0307, Obsoleted */
+ /* MSG_SMB_ASYNC_LEVEL2_BREAK = 0x0308, Obsoleted */
+ /* MSG_SMB_OPEN_RETRY = 0x0309, Obsoleted */
+ MSG_SMB_KERNEL_BREAK = 0x030A,
+ MSG_SMB_FILE_RENAME = 0x030B,
+ MSG_SMB_INJECT_FAULT = 0x030C,
+ MSG_SMB_BLOCKING_LOCK_CANCEL = 0x030D,
+ MSG_SMB_NOTIFY = 0x030E,
+ MSG_SMB_STAT_CACHE_DELETE = 0x030F,
+
+ /* Samba4 compatibility */
+ MSG_PVFS_NOTIFY = 0x0310,
+
+ /* cluster reconfigure events */
+ /* MSG_SMB_BRL_VALIDATE = 0x0311, Oboleted */
+
+ /*Close a specific file given a share entry. */
+ MSG_SMB_CLOSE_FILE = 0x0313,
+
+ /* Trigger a notify cleanup run */
+ MSG_SMB_NOTIFY_CLEANUP = 0x0314,
+ MSG_SMB_SCAVENGER = 0x0315,
+
+ /* shutdown connection for given client */
+ MSG_SMB_KILL_CLIENT_IP = 0x0316,
+
+ /* Tell number of child processes */
+ MSG_SMB_TELL_NUM_CHILDREN = 0x0317,
+ MSG_SMB_NUM_CHILDREN = 0x0318,
+
+ /* Cancel a notify, directory got deleted */
+ MSG_SMB_NOTIFY_CANCEL_DELETED = 0x0319,
+
+ /* notifyd messages */
+ MSG_SMB_NOTIFY_REC_CHANGE = 0x031A,
+ MSG_SMB_NOTIFY_TRIGGER = 0x031B,
+ MSG_SMB_NOTIFY_GET_DB = 0x031C,
+ MSG_SMB_NOTIFY_DB = 0x031D,
+ MSG_SMB_NOTIFY_REC_CHANGES = 0x031E,
+ MSG_SMB_NOTIFY_STARTED = 0x031F,
+ MSG_SMB_SLEEP = 0x0320,
+
+ /* smbd message */
+ MSG_SMB_FORCE_TDIS_DENIED = 0x0321,
+
+ /* winbind messages */
+ MSG_WINBIND_FINISHED = 0x0401,
+ MSG_WINBIND_FORGET_STATE = 0x0402,
+ MSG_WINBIND_ONLINE = 0x0403,
+ MSG_WINBIND_OFFLINE = 0x0404,
+ MSG_WINBIND_ONLINESTATUS = 0x0405,
+
+ MSG_WINBIND_VALIDATE_CACHE = 0x0408,
+ MSG_WINBIND_DUMP_DOMAIN_LIST = 0x0409,
+ MSG_WINBIND_IP_DROPPED = 0x040A,
+ MSG_WINBIND_DOMAIN_ONLINE = 0x040B,
+ MSG_WINBIND_DOMAIN_OFFLINE = 0x040C,
+ MSG_WINBIND_RELOAD_TRUSTED_DOMAINS = 0x040D,
+ MSG_WINBIND_DISCONNECT_DC = 0x040E,
+
+ /* event messages */
+ /* MSG_DUMP_EVENT_LIST = 0x0500, Obsoleted */
+
+ /* smbXsrv messages */
+ MSG_SMBXSRV_SESSION_CLOSE = 0x0600,
+ MSG_SMBXSRV_CONNECTION_PASS = 0x0601,
+ MSG_SMBXSRV_CONNECTION_PASSED = 0x0602,
+ MSG_SMBXSRV_CONNECTION_DROP = 0x0603,
+
+ /* source4 and NTVFS smb server messages */
+ MSG_BRL_RETRY = 0x0700,
+ MSG_PVFS_RETRY_OPEN = 0x0701,
+ MSG_IRPC = 0x0702,
+ MSG_NTVFS_OPLOCK_BREAK = 0x0703,
+ MSG_DREPL_ALLOCATE_RID = 0x0704,
+
+ /*
+ * Audit, Authentication and Authorisation event
+ * messages
+ */
+ MSG_AUTH_LOG = 0x0800,
+ MSG_DSDB_LOG = 0x0801,
+ MSG_DSDB_PWD_LOG = 0x0802,
+ MSG_GROUP_LOG = 0x0803,
+
+ /* dbwrap messages 4001-4999 (0x0FA0 - 0x1387) */
+ /* MSG_DBWRAP_TDB2_CHANGES = 4001, */
+ /* MSG_DBWRAP_G_LOCK_RETRY = 4002, */
+ MSG_DBWRAP_MODIFIED = 4003,
+
+ MSG_RPC_HOST_NEW_CLIENT = 4004,
+ MSG_RPC_WORKER_STATUS = 4005,
+ MSG_RPC_DUMP_STATUS = 4006,
+
+ /*
+ * source4 allows new messages to be registered at
+ * runtime (currently used in python bindings and in
+ * smbtorture). Temporary messaging endpoints are
+ * allocated above this line
+ */
+ MSG_TMP_BASE = 0xF000
+ } messaging_type;
+
+ /* messaging struct sent across the sockets and stored in the tdb */
+
+ typedef [public] struct {
+ [skip] messaging_rec *prev;
+ [skip] messaging_rec *next;
+ uint32 msg_version;
+ messaging_type msg_type;
+ server_id dest;
+ server_id src;
+ DATA_BLOB buf;
+ uint8 num_fds;
+ dlong fds[num_fds];
+ } messaging_rec;
+
+ typedef [public] struct {
+ hyper rec_index;
+ uint32 num_recs;
+ messaging_rec *recs[num_recs];
+ } messaging_reclog;
+
+ /* This allows this well known service name to be referenced in python and C */
+ const string AUTH_EVENT_NAME = "auth_event";
+ const string DSDB_EVENT_NAME = "dsdb_event";
+ const string DSDB_PWD_EVENT_NAME = "dsdb_password_event";
+ const string DSDB_GROUP_EVENT_NAME = "dsdb_group_event";
+}
diff --git a/librpc/idl/mgmt.idl b/librpc/idl/mgmt.idl
new file mode 100644
index 0000000..17c8cc4
--- /dev/null
+++ b/librpc/idl/mgmt.idl
@@ -0,0 +1,75 @@
+/*
+ dcerpc remote management interface
+*/
+
+import "misc.idl";
+
+[
+ uuid("afa8bd80-7d8a-11c9-bef4-08002b102989"),
+ version(1.0),
+ pointer_default(unique),
+ helpstring("DCE/RPC Remote Management")
+]
+interface mgmt
+{
+ typedef struct {
+ ndr_syntax_id *id;
+ } ndr_syntax_id_p;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] ndr_syntax_id_p if_id[*];
+ } rpc_if_id_vector_t;
+
+
+ /***********************/
+ /* Function 0x00 */
+ WERROR mgmt_inq_if_ids (
+ [out] 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,ref] mgmt_statistics *statistics
+ );
+
+
+ /***********************/
+ /* Function 0x02 */
+ boolean32 mgmt_is_server_listening (
+ [out,ref] 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,size_is(princ_name_size),charset(DOS)] uint8 princ_name[]
+ );
+}
diff --git a/librpc/idl/misc.idl b/librpc/idl/misc.idl
new file mode 100644
index 0000000..a705b53
--- /dev/null
+++ b/librpc/idl/misc.idl
@@ -0,0 +1,149 @@
+#include "idl_types.h"
+
+/*
+ miscellaneous IDL structures
+*/
+
+
+[
+ pyhelper("librpc/ndr/py_misc.c"),
+ pointer_default(unique)
+]
+interface misc
+{
+ /*
+ * While structures are not normally known by their order,
+ * please keep this as the first struct, we use this for a
+ * test of 'ndrdump misc 0 struct' (this helps debug failures
+ * from our NDR fuzzing tool, which doesn't use string names)
+ */
+ typedef [public,noprint,gensize] struct {
+ uint32 time_low;
+ uint16 time_mid;
+ uint16 time_hi_and_version;
+ uint8 clock_seq[2];
+ uint8 node[6];
+ } GUID;
+
+ typedef [public] struct {
+ GUID uuid;
+ /* The major version is encoded in the 16 least significant bits,
+ the minor in the 16 most significant bits.
+ http://www.opengroup.org/onlinepubs/9629399/chap12.htm */
+ uint32 if_version;
+ } ndr_syntax_id;
+
+ 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_NULL = 0,
+ SEC_CHAN_LOCAL = 1,
+ SEC_CHAN_WKSTA = 2,
+ SEC_CHAN_DNS_DOMAIN = 3,
+ SEC_CHAN_DOMAIN = 4,
+ SEC_CHAN_LANMAN = 5,
+ SEC_CHAN_BDC = 6,
+ SEC_CHAN_RODC = 7
+ } netr_SchannelType;
+
+ typedef [public] struct {
+ NTSTATUS ntstatus;
+ uint32 unknown1;
+ uint32 unknown2; /* 0x00000001 */
+ } KRB5_EDATA_NTSTATUS;
+
+ typedef [public,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 [nodiscriminant,public,flag(NDR_LITTLE_ENDIAN)] union {
+ [case(REG_NONE)];
+ [case(REG_SZ)] nstring string;
+ [case(REG_EXPAND_SZ)] nstring string;
+ [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
+ [case(REG_DWORD)] uint32 value;
+ [case(REG_DWORD_BIG_ENDIAN),flag(NDR_BIG_ENDIAN)] uint32 value;
+ [case(REG_MULTI_SZ)] nstring_array string_array;
+ [case(REG_QWORD)] hyper qword;
+ [default,flag(NDR_REMAINING)] DATA_BLOB data;
+ } winreg_Data;
+
+ /*
+ * We duplicate the above winreg_Data for usage in the GPO python
+ * parsers which cannot handle nstring_array. This should be only
+ * temporary, until we can get PIDL to generate the correct bindings.
+ */
+ typedef [nodiscriminant,public,flag(NDR_LITTLE_ENDIAN),gensize] union {
+ [case(REG_NONE)];
+ [case(REG_SZ)] nstring string;
+ [case(REG_EXPAND_SZ)] nstring string;
+ [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
+ [case(REG_DWORD)] uint32 value;
+ [case(REG_DWORD_BIG_ENDIAN),flag(NDR_BIG_ENDIAN)] uint32 value;
+ /*
+ * There are no python handlers for nstring_array.
+ * Prefer a fallback to DATA_BLOB instead.
+ *
+ * [case(REG_MULTI_SZ)] nstring_array string_array;
+ */
+ [case(REG_QWORD)] hyper qword;
+ [default,flag(NDR_REMAINING)] DATA_BLOB data;
+ } winreg_Data_GPO;
+
+ /* 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,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;
+}
diff --git a/librpc/idl/msgsvc.idl b/librpc/idl/msgsvc.idl
new file mode 100644
index 0000000..d196daf
--- /dev/null
+++ b/librpc/idl/msgsvc.idl
@@ -0,0 +1,22 @@
+/* Works over UDP */
+
+[
+ uuid("17fdd703-1827-4e34-79d4-24a55c53bb37"),
+ version(1.0),
+ pointer_default(unique),
+ helpstring("Messaging Service")
+] interface msgsvc
+{
+ [todo] void NetrMessageNameAdd();
+ [todo] void NetrMessageNameEnum();
+ [todo] void NetrMessageNameGetInfo();
+ [todo] void NetrMessageNameDel();
+}
+
+[
+ uuid("5a7b91f8-ff00-11d0-a9b2-00c04fb6e6fc"),
+ version(1.0)
+] interface msgsvcsend
+{
+ [todo] void NetrSendMessage();
+}
diff --git a/librpc/idl/named_pipe_auth.idl b/librpc/idl/named_pipe_auth.idl
new file mode 100644
index 0000000..b2c9201
--- /dev/null
+++ b/librpc/idl/named_pipe_auth.idl
@@ -0,0 +1,58 @@
+#include "idl_types.h"
+/*
+ miscellaneous IDL structures
+*/
+
+import "netlogon.idl", "security.idl", "auth.idl";
+
+[
+ pointer_default(unique)
+]
+interface named_pipe_auth
+{
+ const char *NAMED_PIPE_AUTH_MAGIC = "NPAM";
+
+ typedef [public] struct {
+ uint8 transport;
+ [charset(UTF8),string] uint8 *remote_client_name;
+ [charset(DOS),string] uint8 *remote_client_addr;
+ uint16 remote_client_port;
+ [charset(UTF8),string] uint8 *local_server_name;
+ [charset(DOS),string] uint8 *local_server_addr;
+ uint16 local_server_port;
+ auth_session_info_transport *session_info;
+ } named_pipe_auth_req_info7;
+
+ typedef [switch_type(uint32)] union {
+ [case(7)] named_pipe_auth_req_info7 info7;
+ } named_pipe_auth_req_info;
+
+ typedef [public,gensize] struct {
+ [flag(NDR_BIG_ENDIAN),
+ value(ndr_size_named_pipe_auth_req(r,ndr->flags)-4)]
+ uint32 length;
+ [charset(DOS),value(NAMED_PIPE_AUTH_MAGIC)] uint8 magic[4];
+ uint32 level;
+ [switch_is(level)] named_pipe_auth_req_info info;
+ } named_pipe_auth_req;
+
+ typedef struct {
+ uint16 file_type;
+ uint16 device_state;
+ hyper allocation_size;
+ } named_pipe_auth_rep_info7;
+
+ typedef [switch_type(uint32)] union {
+ [case(7)] named_pipe_auth_rep_info7 info7;
+ } named_pipe_auth_rep_info;
+
+ typedef [public,gensize] struct {
+ [flag(NDR_BIG_ENDIAN),
+ value(ndr_size_named_pipe_auth_rep(r,ndr->flags)-4)]
+ uint32 length;
+ [charset(DOS),value(NAMED_PIPE_AUTH_MAGIC)] uint8 magic[4];
+ uint32 level;
+ [switch_is(level)] named_pipe_auth_rep_info info;
+ NTSTATUS status;
+ } named_pipe_auth_rep;
+}
diff --git a/librpc/idl/nbt.idl b/librpc/idl/nbt.idl
new file mode 100644
index 0000000..50b52a5
--- /dev/null
+++ b/librpc/idl/nbt.idl
@@ -0,0 +1,687 @@
+#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 "misc.idl", "security.idl";
+[
+ helper("../librpc/ndr/ndr_nbt.h"),
+ helpstring("NBT messages"),
+ uuid("6def41b6-86e4-4c32-997c-ed33af7bcd8e")
+]
+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_AUTHORITATIVE = 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 [public,enum16bit] enum {
+ NBT_QCLASS_IP = 0x01
+ } nbt_qclass;
+
+ typedef [public,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 {
+ [charset(DOS)] uint8 name[15];
+ 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,public] 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 around the problem
+ * that we need to use nbt_rdata_data
+ * together with NBT_QTYPE_NETBIOS
+ * for WACK replies
+ */
+ typedef [flag(LIBNDR_PRINT_ARRAY_HEX),nopush] struct {
+ nbt_name name;
+ nbt_qtype rr_type;
+ nbt_qclass rr_class;
+ uint32 ttl;
+ [switch_is(rr_type)] 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+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
+ * and
+ * \MAILSLOT\NET\NTLOGON mailslot requests
+ */
+
+ typedef [public,gensize] struct {
+ uint32 sockaddr_family;
+ [flag(NDR_BIG_ENDIAN)] ipv4address pdc_ip;
+ [flag(NDR_REMAINING)] DATA_BLOB remaining;
+ } nbt_sockaddr;
+
+ typedef [bitmap32bit,public] 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_NDNC = 0x00000400,
+ NBT_SERVER_SELECT_SECRET_DOMAIN_6 = 0x00000800,
+ NBT_SERVER_FULL_SECRET_DOMAIN_6 = 0x00001000,
+ NBT_SERVER_ADS_WEB_SERVICE = 0x00002000,
+ NBT_SERVER_DS_8 = 0x00004000,
+ NBT_SERVER_HAS_DNS_NAME = 0x20000000,
+ NBT_SERVER_IS_DEFAULT_NC = 0x40000000,
+ NBT_SERVER_FOREST_ROOT = 0x80000000
+ } nbt_server_type;
+
+ typedef [bitmap32bit,public] bitmap {
+ NETLOGON_NT_VERSION_1 = 0x00000001,
+ NETLOGON_NT_VERSION_5 = 0x00000002,
+ NETLOGON_NT_VERSION_5EX = 0x00000004,
+ NETLOGON_NT_VERSION_5EX_WITH_IP = 0x00000008,
+ NETLOGON_NT_VERSION_WITH_CLOSEST_SITE = 0x00000010,
+ NETLOGON_NT_VERSION_AVOID_NT4EMUL = 0x01000000,
+ NETLOGON_NT_VERSION_PDC = 0x10000000,
+ NETLOGON_NT_VERSION_IP = 0x20000000,
+ NETLOGON_NT_VERSION_LOCAL = 0x40000000,
+ NETLOGON_NT_VERSION_GC = 0x80000000
+ } netlogon_nt_version_flags;
+
+ typedef [enum16bit,public] enum {
+ LOGON_REQUEST = 0,
+ LOGON_RESPONSE2 = 6,
+ LOGON_PRIMARY_QUERY = 7, /* Was also NETLOGON_QUERY_FOR_PDC */
+ NETLOGON_ANNOUNCE_UAS = 10,
+ NETLOGON_RESPONSE_FROM_PDC = 12,
+ LOGON_SAM_LOGON_REQUEST = 18, /* Was also NETLOGON_QUERY_FOR_PDC2, NTLOGON_SAM_LOGON */
+ LOGON_SAM_LOGON_RESPONSE = 19, /* Was also NTLOGON_SAM_LOGON_REPLY */
+ LOGON_SAM_LOGON_PAUSE_RESPONSE = 20,
+ LOGON_SAM_LOGON_USER_UNKNOWN = 21, /* Was also NTLOGON_SAM_LOGON_REPLY15 */
+ LOGON_SAM_LOGON_RESPONSE_EX = 23, /* was NETLOGON_RESPONSE_FROM_PDC2 */
+ LOGON_SAM_LOGON_PAUSE_RESPONSE_EX = 24,
+ LOGON_SAM_LOGON_USER_UNKNOWN_EX = 25 /* was NETLOGON_RESPONSE_FROM_PDC_USER */
+ } netlogon_command;
+
+ /* query to dc hand marshaled, as it has 'optional'
+ * parts */
+ typedef [nopull,nopush] struct {
+ uint16 request_count;
+ nstring computer_name;
+ nstring user_name;
+ astring mailslot_name;
+ uint32 acct_control;
+ /* samr_AcctFlags acct_control; */
+ [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+ /* The manual alignment is required because this
+ * structure is marked flag(NDR_NOALIGN) via the
+ * nbt_netlogon_packet below.
+ *
+ * However, both MUST only be present if sid_size > 0
+ */
+ [flag(NDR_ALIGN4)] DATA_BLOB _pad;
+ [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
+ netlogon_nt_version_flags nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } NETLOGON_SAM_LOGON_REQUEST;
+
+ typedef struct {
+ astring computer_name;
+ astring user_name;
+ astring mailslot_name;
+ uint8 request_count;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } NETLOGON_LOGON_REQUEST;
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ netlogon_command command;
+ nstring pdc_name;
+ nstring user_name;
+ nstring domain_name;
+ netlogon_nt_version_flags nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } NETLOGON_SAM_LOGON_RESPONSE_NT40;
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ netlogon_command command;
+ nstring pdc_name;
+ nstring user_name;
+ nstring domain_name;
+ GUID domain_uuid;
+ GUID zero_uuid;
+ nbt_string forest;
+ nbt_string dns_domain;
+ nbt_string pdc_dns_name;
+ ipv4address pdc_ip;
+ nbt_server_type server_type;
+ netlogon_nt_version_flags nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } NETLOGON_SAM_LOGON_RESPONSE;
+
+ /* response from pdc hand marshaled (we have an additional
+ * function that uses this structure), as it has 'optional'
+ * parts */
+ typedef [flag(NDR_NOALIGN),public] struct {
+ netlogon_command command;
+ uint16 sbz; /* From the docs */
+ nbt_server_type server_type;
+ GUID domain_uuid;
+ nbt_string forest;
+ nbt_string dns_domain;
+ nbt_string pdc_dns_name;
+ nbt_string domain_name;
+ nbt_string pdc_name;
+ nbt_string user_name;
+ nbt_string server_site;
+ nbt_string client_site;
+
+ /* Optional on NETLOGON_NT_VERSION_5EX_WITH_IP */
+ [value(ndr_size_nbt_sockaddr(&sockaddr, ndr->flags))] uint8 sockaddr_size;
+ [subcontext(0),subcontext_size(sockaddr_size)] nbt_sockaddr sockaddr;
+
+ /* Optional on NETLOGON_NT_VERSION_WITH_CLOSEST_SITE */
+ nbt_string next_closest_site;
+
+ netlogon_nt_version_flags nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } NETLOGON_SAM_LOGON_RESPONSE_EX;
+
+ typedef [nopush,nopull] union {
+ [case(NETLOGON_NT_VERSION_1)] NETLOGON_SAM_LOGON_RESPONSE_NT40 nt4;
+ [case(NETLOGON_NT_VERSION_5)] NETLOGON_SAM_LOGON_RESPONSE nt5;
+ [case(NETLOGON_NT_VERSION_5EX)] NETLOGON_SAM_LOGON_RESPONSE_EX nt5_ex;
+ } netlogon_samlogon_response_union;
+
+ typedef [nopush,nopull] struct {
+ uint32 ntver;
+ [switch_is(ntver)] netlogon_samlogon_response_union data;
+ } netlogon_samlogon_response;
+
+ /* query for pdc request */
+ typedef struct {
+ astring computer_name;
+ astring mailslot_name;
+ [flag(NDR_ALIGN2)] DATA_BLOB _pad;
+ nstring unicode_name;
+ netlogon_nt_version_flags nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_netlogon_query_for_pdc;
+
+ /* response from pdc */
+ typedef [public] struct {
+ netlogon_command command;
+ astring pdc_name;
+ [flag(NDR_ALIGN2)] DATA_BLOB _pad;
+ nstring unicode_pdc_name;
+ nstring domain_name;
+ netlogon_nt_version_flags nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_netlogon_response_from_pdc;
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ netlogon_command command;
+ astring pdc_name;
+ uint16 lm20_token;
+ } nbt_netlogon_response2;
+
+ /* used to announce SAM changes - MS-NRPC 2.2.1.5.1 */
+ typedef struct {
+ netr_SamDatabaseID db_index;
+ hyper serial;
+ NTTIME timestamp;
+ } nbt_db_change_info;
+
+ 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_info dbchange[db_count];
+ [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+ [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
+ uint32 message_format_version;
+ uint32 message_token;
+ } NETLOGON_DB_CHANGE;
+
+ typedef [nodiscriminant] union {
+ [case(LOGON_REQUEST)] NETLOGON_LOGON_REQUEST logon0;
+ [case(LOGON_SAM_LOGON_REQUEST)] NETLOGON_SAM_LOGON_REQUEST logon;
+ [case(LOGON_PRIMARY_QUERY)] nbt_netlogon_query_for_pdc pdc;
+ [case(NETLOGON_ANNOUNCE_UAS)] NETLOGON_DB_CHANGE uas;
+ } nbt_netlogon_request;
+
+#if 0
+ /* These responses are all handled manually, as they cannot be encoded in IDL fully
+
+ See push_nbt_netlogon_response()
+ */
+ [case(NETLOGON_RESPONSE_FROM_PDC)] nbt_netlogon_response_from_pdc response;
+ [case(NETLOGON_RESPONSE_FROM_PDC_USER)] nbt_netlogon_response_from_pdc2 response2;
+
+ [case(LOGON_SAM_LOGON_PAUSE_RESPONSE)] NETLOGON_SAM_LOGON_RESPONSE reply;
+ [case(LOGON_SAM_LOGON_RESPONSE)] NETLOGON_SAM_LOGON_RESPONSE reply;
+ [case(LOGON_SAM_LOGON_USER_UNKNOWN)] NETLOGON_SAM_LOGON_RESPONSE reply;
+ [case(LOGON_SAM_LOGON_RESPONSE_EX)] NETLOGON_SAM_LOGON_RESPONSE_EX reply_ex;
+ [case(LOGON_SAM_LOGON_PAUSE_RESPONSE_EX)] NETLOGON_SAM_LOGON_RESPONSE_EX reply_ex;
+ [case(LOGON_SAM_LOGON_USER_UNKNOWN_EX)] NETLOGON_SAM_LOGON_RESPONSE_EX reply_ex;
+#endif
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ netlogon_command command;
+ [switch_is(command)] nbt_netlogon_request req;
+ } nbt_netlogon_packet;
+
+ /********************************************************/
+ /* \MAILSLOT\BROWSE mailslot requests */
+ /* for details see http://ubiqx.org/cifs/Browsing.html */
+ /********************************************************/
+ typedef bitmap svcctl_ServerType 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;
+}
diff --git a/librpc/idl/negoex.idl b/librpc/idl/negoex.idl
new file mode 100644
index 0000000..eb3511d
--- /dev/null
+++ b/librpc/idl/negoex.idl
@@ -0,0 +1,152 @@
+#include "idl_types.h"
+
+/*
+ NEGOEX interface definition
+ See http://ietfreport.isoc.org/all-ids/draft-zhu-negoex-04.txt
+*/
+
+import "misc.idl";
+
+[
+ uuid("fcc30ddc-98d0-11e5-8a56-83e9a6706f2f"),
+ helper("../librpc/ndr/ndr_negoex.h"),
+ helpstring("NEGOEX messages")
+]
+interface negoex
+{
+ typedef [nopush,nopull,noprint] struct {
+#if 0
+ [relative,size_is(length)] uint8 *data;
+ uint32 length;
+#else
+ DATA_BLOB blob;
+ /*
+ * internal helper variable */
+ uint32 _length;
+ /*
+ * the dummy pointer is needed in order to let the
+ * callers use NDR_BUFFERS
+ */
+ [relative] uint8 *_dummy;
+#endif
+ } negoex_BYTE_VECTOR;
+
+ typedef [public] struct {
+ GUID guid;
+ } negoex_AUTH_SCHEME;
+
+ typedef [nopush,nopull] struct {
+ [relative,size_is(count)] negoex_AUTH_SCHEME *array;
+ uint32 count;
+ } negoex_AUTH_SCHEME_VECTOR;
+
+ typedef [v1_enum] enum {
+ NEGOEX_EXTENSION_TYPE_TODO = 0 /* TODO */
+ } negoex_ExtensionTypes;
+
+ typedef [public] struct {
+ negoex_ExtensionTypes type;
+ negoex_BYTE_VECTOR value;
+ } negoex_EXTENSION;
+
+ typedef [nopush,nopull] struct {
+ [relative,size_is(count)] negoex_EXTENSION *array;
+ uint32 count;
+ } negoex_EXTENSION_VECTOR;
+
+ typedef [v1_enum] enum {
+ NEGOEX_CHECKSUM_SCHEME_RFC3961 = 1
+ } negoex_ChecksumSchemes;
+
+ typedef struct {
+ [value(20)] uint32 header_length;
+ negoex_ChecksumSchemes scheme;
+ uint32 type;
+ negoex_BYTE_VECTOR value;
+ } negoex_CHECKSUM;
+
+ typedef [v1_enum] enum {
+ NEGOEX_ALERT_VERIFY_NO_KEY = 1
+ } negoex_AlertReason;
+
+ typedef [public] struct {
+ [value(4)] uint32 header_length; /* TODO: is 4 correct? */
+ negoex_AlertReason reason;
+ } negoex_ALERT_PULSE;
+
+ typedef [v1_enum] enum {
+ NEGOEX_ALERT_TYPE_PULSE = 1
+ } negoex_AlertTypes;
+
+ typedef [public] struct {
+ negoex_AlertTypes type;
+ negoex_BYTE_VECTOR value;
+ } negoex_ALERT;
+
+ typedef [nopush,nopull] struct {
+ [relative,size_is(count)] negoex_ALERT *array;
+ uint32 count;
+ } negoex_ALERT_VECTOR;
+
+ typedef [public,v1_enum] enum {
+ NEGOEX_MESSAGE_TYPE_INITIATOR_NEGO = 0,
+ NEGOEX_MESSAGE_TYPE_ACCEPTOR_NEGO = 1,
+ NEGOEX_MESSAGE_TYPE_INITIATOR_META_DATA = 2,
+ NEGOEX_MESSAGE_TYPE_ACCEPTOR_META_DATA = 3,
+ NEGOEX_MESSAGE_TYPE_CHALLENGE = 4,
+ NEGOEX_MESSAGE_TYPE_AP_REQUEST = 5,
+ NEGOEX_MESSAGE_TYPE_VERIFY = 6,
+ NEGOEX_MESSAGE_TYPE_ALERT = 7
+ } negoex_MESSAGE_TYPE;
+
+ const uint32 NEGOEX_PROTOCOL_VERSION_0 = 0;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ [flag(NDR_PAHEX)] uint8 random[32];
+ [value(NEGOEX_PROTOCOL_VERSION_0)] udlong protocol_version;
+ negoex_AUTH_SCHEME_VECTOR auth_schemes;
+ negoex_EXTENSION_VECTOR extensions;
+ } negoex_NEGO_PAYLOAD;
+
+ typedef struct {
+ negoex_AUTH_SCHEME auth_scheme;
+ negoex_BYTE_VECTOR exchange;
+ } negoex_EXCHANGE_PAYLOAD;
+
+ typedef struct {
+ negoex_AUTH_SCHEME auth_scheme;
+ negoex_CHECKSUM checksum;
+ } negoex_VERIFY_PAYLOAD;
+
+ typedef struct {
+ negoex_AUTH_SCHEME auth_scheme;
+ NTSTATUS status;
+ negoex_ALERT_VECTOR alerts;
+ } negoex_ALERT_PAYLOAD;
+
+ typedef [public,nodiscriminant] union {
+ [case(NEGOEX_MESSAGE_TYPE_INITIATOR_NEGO)] negoex_NEGO_PAYLOAD nego;
+ [case(NEGOEX_MESSAGE_TYPE_ACCEPTOR_NEGO)] negoex_NEGO_PAYLOAD nego;
+ [case(NEGOEX_MESSAGE_TYPE_INITIATOR_META_DATA)] negoex_EXCHANGE_PAYLOAD exchange;
+ [case(NEGOEX_MESSAGE_TYPE_ACCEPTOR_META_DATA)] negoex_EXCHANGE_PAYLOAD exchange;
+ [case(NEGOEX_MESSAGE_TYPE_CHALLENGE)] negoex_EXCHANGE_PAYLOAD exchange;
+ [case(NEGOEX_MESSAGE_TYPE_AP_REQUEST)] negoex_EXCHANGE_PAYLOAD exchange;
+ [case(NEGOEX_MESSAGE_TYPE_VERIFY)] negoex_VERIFY_PAYLOAD verify;
+ [case(NEGOEX_MESSAGE_TYPE_ALERT)] negoex_ALERT_PAYLOAD alert;
+ } negoex_PAYLOAD;
+
+ typedef [public,relative_base,gensize,nopull] struct {
+ [charset(DOS),value("NEGOEXTS")] uint8 signature[8];
+ negoex_MESSAGE_TYPE type;
+ uint32 sequence_number;
+ [value(ndr_negoex_MESSAGE_header_length(r))] uint32 header_length;
+ [value(ndr_size_negoex_MESSAGE(r, ndr->flags))] uint32 message_length;
+ GUID conversation_id;
+ [switch_is(type)] negoex_PAYLOAD p;
+ } negoex_MESSAGE;
+
+ typedef [public,nopush,nopull,flag(NDR_NOALIGN)] struct {
+ uint32 count;
+ negoex_MESSAGE messages[count];
+ } negoex_MESSAGE_ARRAY;
+}
diff --git a/librpc/idl/netlogon.idl b/librpc/idl/netlogon.idl
new file mode 100644
index 0000000..c77151a
--- /dev/null
+++ b/librpc/idl/netlogon.idl
@@ -0,0 +1,1825 @@
+/*
+ netlogon interface
+ much of this was derived from the ethereal sources - thanks to everyone
+ who contributed!
+*/
+
+import "misc.idl", "lsa.idl", "samr.idl", "security.idl";
+
+#include "idl_types.h"
+
+cpp_quote("#define netr_DeltaEnum8Bit netr_DeltaEnum")
+cpp_quote("#define netr_SamDatabaseID8Bit netr_SamDatabaseID")
+
+cpp_quote("#define ENC_CRC32 KERB_ENCTYPE_DES_CBC_CRC")
+cpp_quote("#define ENC_RSA_MD5 KERB_ENCTYPE_DES_CBC_MD5")
+cpp_quote("#define ENC_RC4_HMAC_MD5 KERB_ENCTYPE_RC4_HMAC_MD5")
+cpp_quote("#define ENC_HMAC_SHA1_96_AES128 KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96")
+cpp_quote("#define ENC_HMAC_SHA1_96_AES256 KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96")
+cpp_quote("#define ENC_HMAC_SHA1_96_AES256_SK KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96_SK")
+cpp_quote("#define ENC_FAST_SUPPORTED KERB_ENCTYPE_FAST_SUPPORTED")
+cpp_quote("#define ENC_COMPOUND_IDENTITY_SUPPORTED KERB_ENCTYPE_COMPOUND_IDENTITY_SUPPORTED")
+cpp_quote("#define ENC_CLAIMS_SUPPORTED KERB_ENCTYPE_CLAIMS_SUPPORTED")
+cpp_quote("#define NETLOGON_SERVER_PIPE_STATE_MAGIC 0x4f555358")
+
+[
+ uuid("12345678-1234-abcd-ef00-01234567cffb"),
+ version(1.0),
+ endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
+ helper("../librpc/ndr/ndr_netlogon.h"),
+ ms_union,
+ pointer_default(unique)
+]
+
+interface netlogon
+{
+ typedef bitmap samr_AcctFlags samr_AcctFlags;
+ typedef bitmap security_GroupAttrs security_GroupAttrs;
+ typedef enum netr_DeltaEnum8Bit netr_DeltaEnum8Bit;
+ typedef enum netr_SamDatabaseID8Bit netr_SamDatabaseID8Bit;
+
+ /*****************/
+ /* Function 0x00 */
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *account_name;
+ uint32 priv;
+ uint32 auth_flags;
+ uint32 logon_count;
+ uint32 bad_pw_count;
+ time_t last_logon;
+ time_t last_logoff;
+ time_t logoff_time;
+ time_t kickoff_time;
+ uint32 password_age;
+ time_t pw_can_change;
+ time_t pw_must_change;
+ [string,charset(UTF16)] uint16 *computer;
+ [string,charset(UTF16)] uint16 *domain;
+ [string,charset(UTF16)] uint16 *script_path;
+ uint32 unknown;
+ } netr_UasInfo;
+
+ WERROR netr_LogonUasLogon(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *account_name,
+ [in] [string,charset(UTF16)] uint16 *workstation,
+ [out,ref] netr_UasInfo **info
+ );
+
+
+ /*****************/
+ /* Function 0x01 */
+
+ typedef struct {
+ uint32 duration;
+ uint16 logon_count;
+ } netr_UasLogoffInfo;
+
+ WERROR netr_LogonUasLogoff(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *account_name,
+ [in] [string,charset(UTF16)] uint16 *workstation,
+ [out,ref] netr_UasLogoffInfo *info
+ );
+
+
+ /*****************/
+ /* Function 0x02 */
+
+ /* in netr_AcctLockStr size seems to be be 24, and rrenard thinks
+ that the structure of the bindata looks like this:
+
+ dlong lockout_duration;
+ udlong reset_count;
+ uint32 bad_attempt_lockout;
+ uint32 dummy;
+
+ but it doesn't look as though this structure is reflected at the
+ NDR level. Maybe it is left to the application to decode the bindata array.
+ */
+ typedef [public] struct {
+ dlong lockout_duration;
+ udlong reset_count;
+ uint32 bad_attempt_lockout;
+ uint32 dummy;
+ } netr_AcctLockStr;
+
+ /* - MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT
+ * sets the NETLOGON_SERVER_TRUST_ACCOUNT user_flag
+ * - MSV1_0_UPDATE_LOGON_STATISTICS
+ * sets the logon time on network logon
+ * - MSV1_0_RETURN_USER_PARAMETERS
+ * sets the user parameters in the driveletter
+ * - MSV1_0_RETURN_PROFILE_PATH
+ * returns the profilepath in the driveletter and
+ * sets LOGON_PROFILE_PATH_RETURNED user_flag
+ */
+
+ typedef [public,bitmap32bit] bitmap {
+ MSV1_0_CLEARTEXT_PASSWORD_ALLOWED = 0x00000002,
+ MSV1_0_UPDATE_LOGON_STATISTICS = 0x00000004,
+ MSV1_0_RETURN_USER_PARAMETERS = 0x00000008,
+ MSV1_0_DONT_TRY_GUEST_ACCOUNT = 0x00000010,
+ MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT = 0x00000020,
+ MSV1_0_RETURN_PASSWORD_EXPIRY = 0x00000040,
+ MSV1_0_USE_CLIENT_CHALLENGE = 0x00000080,
+ MSV1_0_TRY_GUEST_ACCOUNT_ONLY = 0x00000100,
+ MSV1_0_RETURN_PROFILE_PATH = 0x00000200,
+ MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY = 0x00000400,
+ MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT = 0x00000800,
+ MSV1_0_DISABLE_PERSONAL_FALLBACK = 0x00001000,
+ MSV1_0_ALLOW_FORCE_GUEST = 0x00002000,
+ MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED = 0x00004000,
+ MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY = 0x00008000,
+ MSV1_0_ALLOW_MSVCHAPV2 = 0x00010000,
+ MSV1_0_S4U2SELF = 0x00020000,
+ MSV1_0_CHECK_LOGONHOURS_FOR_S4U = 0x00040000,
+ MSV1_0_SUBAUTHENTICATION_DLL_EX = 0x00100000
+ } netr_LogonParameterControl;
+
+ /* Summary of the of the Query and Response from Microsoft on
+ * the usage of logon_id in netr_IdendityInfo
+ *
+ * [REG:119013019612095] [MS-NRPC]: NETLOGON_LOGON_IDENTITY_INFO: Does
+ * the Reserved field have LogonId meaning?
+ *
+ * Questions:
+ * In NetrLogonSamLogonEx does the Reserved field
+ * (of NETLOGON_LOGON_IDENTITY_INFO) have LogonId meaning?
+ *
+ * What is a valid LogonID, and does have any audit usage?
+ *
+ * Samba is sending a constant "deadbeef" in hex and would like to
+ * understand any usage of this field.
+ *
+ * Response:
+ * The NRPC spec is accurate in defining the field as Reserved, and
+ * without protocol significance. In the header file in our source
+ * code, it is defined as LogonId and commented as such, but it’s
+ * effectively not used. This is probably why the API structure has
+ * that field name. It may have been intended as such but it’s not
+ * used.
+ *
+ * Samba now sends a random value in this field.
+ */
+ typedef struct {
+ lsa_String domain_name;
+ netr_LogonParameterControl parameter_control; /* see MSV1_0_* */
+ udlong logon_id;
+ lsa_String account_name;
+ lsa_String workstation;
+ } netr_IdentityInfo;
+
+ typedef struct {
+ netr_IdentityInfo identity_info;
+ samr_Password lmpassword;
+ samr_Password ntpassword;
+ } netr_PasswordInfo;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint16 length;
+ [value(length)] uint16 size;
+ [size_is(length),length_is(length)] uint8 *data;
+ } netr_ChallengeResponse;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ netr_IdentityInfo identity_info;
+ uint8 challenge[8];
+ netr_ChallengeResponse nt;
+ netr_ChallengeResponse lm;
+ } netr_NetworkInfo;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ netr_IdentityInfo identity_info;
+ lsa_String package_name;
+ uint32 length;
+ [size_is(length)] uint8 *data;
+ } netr_GenericInfo;
+
+ typedef [public] enum {
+ NetlogonInteractiveInformation = 1,
+ NetlogonNetworkInformation = 2,
+ NetlogonServiceInformation = 3,
+ NetlogonGenericInformation = 4,
+ NetlogonInteractiveTransitiveInformation = 5,
+ NetlogonNetworkTransitiveInformation = 6,
+ NetlogonServiceTransitiveInformation = 7
+ } netr_LogonInfoClass;
+
+ typedef [public,switch_type(netr_LogonInfoClass)] union {
+ [case(NetlogonInteractiveInformation)] netr_PasswordInfo *password;
+ [case(NetlogonNetworkInformation)] netr_NetworkInfo *network;
+ [case(NetlogonServiceInformation)] netr_PasswordInfo *password;
+ [case(NetlogonGenericInformation)] netr_GenericInfo *generic;
+ [case(NetlogonInteractiveTransitiveInformation)] netr_PasswordInfo *password;
+ [case(NetlogonNetworkTransitiveInformation)] netr_NetworkInfo *network;
+ [case(NetlogonServiceTransitiveInformation)] netr_PasswordInfo *password;
+ [default];
+ } netr_LogonLevel;
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ uint8 key[16];
+ } netr_UserSessionKey;
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ uint8 key[8];
+ } netr_LMSessionKey;
+
+ /* Flags for user_flags below */
+ typedef [public,bitmap32bit] bitmap {
+ NETLOGON_GUEST = 0x00000001,
+ NETLOGON_NOENCRYPTION = 0x00000002,
+ NETLOGON_CACHED_ACCOUNT = 0x00000004,
+ NETLOGON_USED_LM_PASSWORD = 0x00000008,
+ NETLOGON_EXTRA_SIDS = 0x00000020,
+ NETLOGON_SUBAUTH_SESSION_KEY = 0x00000040,
+ NETLOGON_SERVER_TRUST_ACCOUNT = 0x00000080,
+ NETLOGON_NTLMV2_ENABLED = 0x00000100,
+ NETLOGON_RESOURCE_GROUPS = 0x00000200,
+ NETLOGON_PROFILE_PATH_RETURNED = 0x00000400,
+ NETLOGON_GRACE_LOGON = 0x01000000
+ } netr_UserFlags;
+
+ typedef struct {
+ NTTIME logon_time;
+ NTTIME logoff_time;
+ NTTIME kickoff_time;
+ NTTIME last_password_change;
+ NTTIME allow_password_change;
+ NTTIME force_password_change;
+ lsa_String account_name;
+ lsa_String full_name;
+ lsa_String logon_script;
+ lsa_String profile_path;
+ lsa_String home_directory;
+ lsa_String home_drive;
+ uint16 logon_count;
+ uint16 bad_password_count;
+ uint32 rid;
+ uint32 primary_gid;
+ samr_RidWithAttributeArray groups;
+ netr_UserFlags user_flags;
+ [flag(NDR_SECRET)] netr_UserSessionKey key;
+ lsa_StringLarge logon_server;
+ lsa_StringLarge logon_domain;
+ dom_sid2 *domain_sid;
+ [flag(NDR_SECRET)] netr_LMSessionKey LMSessKey;
+ samr_AcctFlags acct_flags;
+ uint32 sub_auth_status;
+ NTTIME last_successful_logon;
+ NTTIME last_failed_logon;
+ uint32 failed_logon_count;
+ uint32 reserved;
+ } netr_SamBaseInfo;
+
+ typedef struct {
+ netr_SamBaseInfo base;
+ } netr_SamInfo2;
+
+ typedef [public] struct {
+ dom_sid2 *sid;
+ security_GroupAttrs attributes;
+ } netr_SidAttr;
+
+ typedef [public] struct {
+ netr_SamBaseInfo base;
+ uint32 sidcount;
+ [size_is(sidcount)] netr_SidAttr *sids;
+ } netr_SamInfo3;
+
+ typedef struct {
+ netr_SamBaseInfo base;
+ uint32 sidcount;
+ [size_is(sidcount)] netr_SidAttr *sids;
+ /*
+ * On ndr_push:
+ * Should pointer values be allocated
+ * of sids[*].sid before the following ones?
+ *
+ * That's at least the case for
+ * PAC_LOGON_INFO.
+ */
+ lsa_String dns_domainname;
+ lsa_String principal_name;
+ uint32 unknown4[20];
+ } netr_SamInfo6;
+
+ typedef struct {
+ uint32 pac_size;
+ [size_is(pac_size)] uint8 *pac;
+ lsa_String logon_domain;
+ lsa_String logon_server;
+ lsa_String principal_name;
+ uint32 auth_size;
+ [size_is(auth_size)] uint8 *auth;
+ netr_UserSessionKey user_session_key;
+ uint32 expansionroom[10];
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ } netr_PacInfo;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint32 length;
+ [size_is(length)] uint8 *data;
+ } netr_GenericInfo2;
+
+ typedef enum {
+ NetlogonValidationUasInfo = 1,
+ NetlogonValidationSamInfo = 2,
+ NetlogonValidationSamInfo2 = 3,
+ NetlogonValidationGenericInfo2 = 5,
+ NetlogonValidationSamInfo4 = 6
+ } netr_ValidationInfoClass;
+
+ typedef [public,switch_type(uint16)] union {
+ [case(NetlogonValidationSamInfo)] netr_SamInfo2 *sam2;
+ [case(NetlogonValidationSamInfo2)] netr_SamInfo3 *sam3;
+ [case(4)] netr_PacInfo *pac;
+ [case(NetlogonValidationGenericInfo2)] netr_GenericInfo2 *generic;
+ [case(NetlogonValidationSamInfo4)] netr_SamInfo6 *sam6;
+ [default];
+ } netr_Validation;
+
+ typedef [public, flag(NDR_PAHEX)] struct {
+ uint8 data[8];
+ } netr_Credential;
+
+ typedef [public] struct {
+ netr_Credential client_challenge;
+ netr_Credential server_challenge;
+ } netlogon_server_pipe_state;
+
+ typedef [public] struct {
+ netr_Credential cred;
+ time_t timestamp;
+ } netr_Authenticator;
+
+ [public] NTSTATUS netr_LogonSamLogon(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+ [in,unique] netr_Authenticator *credential,
+ [in,out,unique] netr_Authenticator *return_authenticator,
+ [in] netr_LogonInfoClass logon_level,
+ [in,ref] [switch_is(logon_level)] netr_LogonLevel *logon,
+ [in] uint16 validation_level,
+ [out,ref] [switch_is(validation_level)] netr_Validation *validation,
+ [out,ref] uint8 *authoritative
+ );
+
+
+ /*****************/
+ /* Function 0x03 */
+
+ NTSTATUS netr_LogonSamLogoff(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+ [in,unique] netr_Authenticator *credential,
+ [in,out,unique] netr_Authenticator *return_authenticator,
+ [in] netr_LogonInfoClass logon_level,
+ [in] [switch_is(logon_level)] netr_LogonLevel logon
+ );
+
+
+
+ /*****************/
+ /* Function 0x04 */
+
+ [public] NTSTATUS netr_ServerReqChallenge(
+ [in,unique,string,charset(UTF16)] uint16 *server_name,
+ [in,string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Credential *credentials,
+ [out,ref] netr_Credential *return_credentials
+ );
+
+
+ /*****************/
+ /* Function 0x05 */
+
+ typedef enum netr_SchannelType netr_SchannelType;
+
+ NTSTATUS netr_ServerAuthenticate(
+ [in,unique,string,charset(UTF16)] uint16 *server_name,
+ [in,string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in,string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Credential *credentials,
+ [out,ref] netr_Credential *return_credentials
+ );
+
+
+ /*****************/
+ /* Function 0x06 */
+
+ NTSTATUS netr_ServerPasswordSet(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [in,ref] samr_Password *new_password
+ );
+
+
+ /*****************/
+ /* Function 0x07 */
+
+ typedef enum netr_SamDatabaseID netr_SamDatabaseID;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *account_name;
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_DELETE_USER;
+
+ typedef struct {
+ uint16 length;
+ [value(length)] uint16 size;
+ uint32 flags;
+ samr_Password pwd;
+ } netr_USER_KEY16;
+
+ typedef struct {
+ uint16 nt_length;
+ [value(nt_length)] uint16 nt_size;
+ uint32 nt_flags;
+ uint16 lm_length;
+ [value(lm_length)] uint16 lm_size;
+ uint32 lm_flags;
+ uint8 nt_history[nt_length];
+ uint8 lm_history[lm_length];
+ } netr_PasswordHistory;
+
+ typedef struct {
+ netr_USER_KEY16 lmpassword;
+ netr_USER_KEY16 ntpassword;
+ netr_PasswordHistory history;
+ } netr_USER_KEYS2;
+
+ typedef struct { /* TODO: make this a union! */
+ netr_USER_KEYS2 keys2;
+ } netr_USER_KEY_UNION;
+
+ typedef [public] struct {
+ uint32 version;
+ netr_USER_KEY_UNION keys;
+ } netr_USER_KEYS;
+
+ typedef struct {
+ boolean8 SensitiveDataFlag;
+ uint32 DataLength;
+
+ /* netr_USER_KEYS encrypted with the session key */
+ [size_is(DataLength)][flag(NDR_PAHEX)] uint8 *SensitiveData;
+ } netr_USER_PRIVATE_INFO;
+
+ typedef struct {
+ lsa_String account_name;
+ lsa_String full_name;
+ uint32 rid;
+ uint32 primary_gid;
+ lsa_String home_directory;
+ lsa_String home_drive;
+ lsa_String logon_script;
+ lsa_String description;
+ lsa_String workstations;
+ NTTIME last_logon;
+ NTTIME last_logoff;
+ samr_LogonHours logon_hours;
+ uint16 bad_password_count;
+ uint16 logon_count;
+ NTTIME last_password_change;
+ NTTIME acct_expiry;
+ samr_AcctFlags acct_flags;
+ samr_Password lmpassword;
+ samr_Password ntpassword;
+ boolean8 nt_password_present;
+ boolean8 lm_password_present;
+ boolean8 password_expired;
+ lsa_String comment;
+ lsa_BinaryString parameters;
+ uint16 country_code;
+ uint16 code_page;
+ netr_USER_PRIVATE_INFO user_private_info;
+ uint32 SecurityInformation;
+ sec_desc_buf sdbuf;
+ lsa_String profile_path;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_USER;
+
+ typedef struct {
+ lsa_String domain_name;
+ lsa_String oem_information; /* comment */
+ dlong force_logoff_time;
+ uint16 min_password_length;
+ uint16 password_history_length;
+ /* yes, these are signed. They are in negative 100ns */
+ dlong max_password_age;
+ dlong min_password_age;
+ udlong sequence_num;
+ NTTIME domain_create_time;
+ uint32 SecurityInformation;
+ sec_desc_buf sdbuf;
+ lsa_BinaryString account_lockout;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 logon_to_chgpass;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_DOMAIN;
+
+ typedef struct {
+ lsa_String group_name;
+ uint32 rid;
+ uint32 attributes;
+ lsa_String description;
+ uint32 SecurityInformation;
+ sec_desc_buf sdbuf;
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_GROUP;
+
+ typedef struct {
+ lsa_String OldName;
+ lsa_String NewName;
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_RENAME;
+
+ typedef struct {
+ [size_is(num_rids)] uint32 *rids;
+ [size_is(num_rids)] uint32 *attribs;
+ uint32 num_rids;
+ uint32 unknown1;
+ uint32 unknown2;
+ uint32 unknown3;
+ uint32 unknown4;
+ } netr_DELTA_GROUP_MEMBER;
+
+ typedef struct {
+ lsa_String alias_name;
+ uint32 rid;
+ uint32 SecurityInformation;
+ sec_desc_buf sdbuf;
+ lsa_String description;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_ALIAS;
+
+ typedef struct {
+ lsa_SidArray sids;
+ uint32 unknown1;
+ uint32 unknown2;
+ uint32 unknown3;
+ uint32 unknown4;
+ } netr_DELTA_ALIAS_MEMBER;
+
+ typedef struct {
+ uint32 pagedpoollimit;
+ uint32 nonpagedpoollimit;
+ uint32 minimumworkingsetsize;
+ uint32 maximumworkingsetsize;
+ uint32 pagefilelimit;
+ NTTIME timelimit;
+ } netr_QUOTA_LIMITS;
+
+ typedef struct {
+ uint32 maxlogsize;
+ NTTIME auditretentionperiod;
+ boolean8 auditingmode;
+ uint32 maxauditeventcount;
+ [size_is(maxauditeventcount+1)] uint32 *eventauditoptions;
+ lsa_String primary_domain_name;
+ dom_sid2 *sid;
+ netr_QUOTA_LIMITS quota_limits;
+ udlong sequence_num;
+ NTTIME db_create_time;
+ uint32 SecurityInformation;
+ sec_desc_buf sdbuf;
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_POLICY;
+
+ typedef struct {
+ lsa_String domain_name;
+ uint32 num_controllers;
+ [size_is(num_controllers)] lsa_String *controller_names;
+ uint32 SecurityInformation;
+ sec_desc_buf sdbuf;
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 posix_offset;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_TRUSTED_DOMAIN;
+
+ typedef struct {
+ uint32 privilege_entries;
+ uint32 privilege_control;
+ [size_is(privilege_entries)] uint32 *privilege_attrib;
+ [size_is(privilege_entries)] lsa_String *privilege_name;
+ netr_QUOTA_LIMITS quotalimits;
+ uint32 system_flags;
+ uint32 SecurityInformation;
+ sec_desc_buf sdbuf;
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_ACCOUNT;
+
+ typedef struct {
+ uint32 len;
+ uint32 maxlen;
+ [size_is(maxlen)][length_is(len)] uint8 *cipher_data;
+ } netr_CIPHER_VALUE;
+
+ typedef struct {
+ netr_CIPHER_VALUE current_cipher;
+ NTTIME current_cipher_set_time;
+ netr_CIPHER_VALUE old_cipher;
+ NTTIME old_cipher_set_time;
+ uint32 SecurityInformation;
+ sec_desc_buf sdbuf;
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
+ lsa_String unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ uint32 unknown7;
+ uint32 unknown8;
+ } netr_DELTA_SECRET;
+
+ typedef enum {
+ NETR_DELTA_DOMAIN = 1,
+ NETR_DELTA_GROUP = 2,
+ NETR_DELTA_DELETE_GROUP = 3,
+ NETR_DELTA_RENAME_GROUP = 4,
+ NETR_DELTA_USER = 5,
+ NETR_DELTA_DELETE_USER = 6,
+ NETR_DELTA_RENAME_USER = 7,
+ NETR_DELTA_GROUP_MEMBER = 8,
+ NETR_DELTA_ALIAS = 9,
+ NETR_DELTA_DELETE_ALIAS = 10,
+ NETR_DELTA_RENAME_ALIAS = 11,
+ NETR_DELTA_ALIAS_MEMBER = 12,
+ NETR_DELTA_POLICY = 13,
+ NETR_DELTA_TRUSTED_DOMAIN = 14,
+ NETR_DELTA_DELETE_TRUST = 15,
+ NETR_DELTA_ACCOUNT = 16,
+ NETR_DELTA_DELETE_ACCOUNT = 17,
+ NETR_DELTA_SECRET = 18,
+ NETR_DELTA_DELETE_SECRET = 19,
+ NETR_DELTA_DELETE_GROUP2 = 20,
+ NETR_DELTA_DELETE_USER2 = 21,
+ NETR_DELTA_MODIFY_COUNT = 22
+ } netr_DeltaEnum;
+
+ typedef [switch_type(netr_DeltaEnum)] union {
+ [case(NETR_DELTA_DOMAIN)] netr_DELTA_DOMAIN *domain;
+ [case(NETR_DELTA_GROUP)] netr_DELTA_GROUP *group;
+ [case(NETR_DELTA_DELETE_GROUP)] ; /* rid only */
+ [case(NETR_DELTA_RENAME_GROUP)] netr_DELTA_RENAME *rename_group;
+ [case(NETR_DELTA_USER)] netr_DELTA_USER *user;
+ [case(NETR_DELTA_DELETE_USER)] ; /* rid only */
+ [case(NETR_DELTA_RENAME_USER)] netr_DELTA_RENAME *rename_user;
+ [case(NETR_DELTA_GROUP_MEMBER)] netr_DELTA_GROUP_MEMBER *group_member;
+ [case(NETR_DELTA_ALIAS)] netr_DELTA_ALIAS *alias;
+ [case(NETR_DELTA_DELETE_ALIAS)] ; /* rid only */
+ [case(NETR_DELTA_RENAME_ALIAS)] netr_DELTA_RENAME *rename_alias;
+ [case(NETR_DELTA_ALIAS_MEMBER)] netr_DELTA_ALIAS_MEMBER *alias_member;
+ [case(NETR_DELTA_POLICY)] netr_DELTA_POLICY *policy;
+ [case(NETR_DELTA_TRUSTED_DOMAIN)] netr_DELTA_TRUSTED_DOMAIN *trusted_domain;
+ [case(NETR_DELTA_DELETE_TRUST)] ; /* sid only */
+ [case(NETR_DELTA_ACCOUNT)] netr_DELTA_ACCOUNT *account;
+ [case(NETR_DELTA_DELETE_ACCOUNT)] ; /* sid only */
+ [case(NETR_DELTA_SECRET)] netr_DELTA_SECRET *secret;
+ [case(NETR_DELTA_DELETE_SECRET)] ; /* name only */
+ [case(NETR_DELTA_DELETE_GROUP2)] netr_DELTA_DELETE_USER *delete_group;
+ [case(NETR_DELTA_DELETE_USER2)] netr_DELTA_DELETE_USER *delete_user;
+ [case(NETR_DELTA_MODIFY_COUNT)] udlong *modified_count;
+ [default];
+ } netr_DELTA_UNION;
+
+ typedef [switch_type(netr_DeltaEnum)] union {
+ [case(NETR_DELTA_DOMAIN)] uint32 rid;
+ [case(NETR_DELTA_GROUP)] uint32 rid;
+ [case(NETR_DELTA_DELETE_GROUP)] uint32 rid;
+ [case(NETR_DELTA_RENAME_GROUP)] uint32 rid;
+ [case(NETR_DELTA_USER)] uint32 rid;
+ [case(NETR_DELTA_DELETE_USER)] uint32 rid;
+ [case(NETR_DELTA_RENAME_USER)] uint32 rid;
+ [case(NETR_DELTA_GROUP_MEMBER)] uint32 rid;
+ [case(NETR_DELTA_ALIAS)] uint32 rid;
+ [case(NETR_DELTA_DELETE_ALIAS)] uint32 rid;
+ [case(NETR_DELTA_RENAME_ALIAS)] uint32 rid;
+ [case(NETR_DELTA_ALIAS_MEMBER)] uint32 rid;
+ [case(NETR_DELTA_POLICY)] dom_sid2 *sid;
+ [case(NETR_DELTA_TRUSTED_DOMAIN)] dom_sid2 *sid;
+ [case(NETR_DELTA_DELETE_TRUST)] dom_sid2 *sid;
+ [case(NETR_DELTA_ACCOUNT)] dom_sid2 *sid;
+ [case(NETR_DELTA_DELETE_ACCOUNT)] dom_sid2 *sid;
+ [case(NETR_DELTA_SECRET)] [string,charset(UTF16)] uint16 *name;
+ [case(NETR_DELTA_DELETE_SECRET)] [string,charset(UTF16)] uint16 *name;
+ [case(NETR_DELTA_DELETE_GROUP2)] uint32 rid;
+ [case(NETR_DELTA_DELETE_USER2)] uint32 rid;
+ [case(NETR_DELTA_MODIFY_COUNT)] ;
+ [default];
+ } netr_DELTA_ID_UNION;
+
+ typedef struct {
+ netr_DeltaEnum delta_type;
+ [switch_is(delta_type)] netr_DELTA_ID_UNION delta_id_union;
+ [switch_is(delta_type)] netr_DELTA_UNION delta_union;
+ } netr_DELTA_ENUM;
+
+ typedef struct {
+ uint32 num_deltas;
+ [size_is(num_deltas)] netr_DELTA_ENUM *delta_enum;
+ } netr_DELTA_ENUM_ARRAY;
+
+ NTSTATUS netr_DatabaseDeltas(
+ [in] [string,charset(UTF16)] uint16 *logon_server,
+ [in] [string,charset(UTF16)] uint16 *computername,
+ [in,ref] netr_Authenticator *credential,
+ [in,out,ref] netr_Authenticator *return_authenticator,
+ [in] netr_SamDatabaseID database_id,
+ [in,out,ref] udlong *sequence_num,
+ [out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array,
+ [in] uint32 preferredmaximumlength
+ );
+
+
+ /*****************/
+ /* Function 0x08 */
+
+ NTSTATUS netr_DatabaseSync(
+ [in] [string,charset(UTF16)] uint16 *logon_server,
+ [in] [string,charset(UTF16)] uint16 *computername,
+ [in,ref] netr_Authenticator *credential,
+ [in,out,ref] netr_Authenticator *return_authenticator,
+ [in] netr_SamDatabaseID database_id,
+ [in,out,ref] uint32 *sync_context,
+ [out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array,
+ [in] uint32 preferredmaximumlength
+ );
+
+
+ /*****************/
+ /* Function 0x09 */
+
+ /* w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this call */
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint8 computer_name[16];
+ uint32 timecreated;
+ uint32 serial_number;
+ } netr_UAS_INFO_0;
+
+ typedef struct {
+ [flag(NDR_REMAINING)] DATA_BLOB blob;
+ } netr_AccountBuffer;
+
+ NTSTATUS netr_AccountDeltas(
+ [in,unique] [string,charset(UTF16)] uint16 *logon_server,
+ [in] [string,charset(UTF16)] uint16 *computername,
+ [in] netr_Authenticator credential,
+ [in,out,ref] netr_Authenticator *return_authenticator,
+ [in] netr_UAS_INFO_0 uas,
+ [in] uint32 count,
+ [in] uint32 level,
+ [in] uint32 buffersize,
+ [out,ref,subcontext(4)] netr_AccountBuffer *buffer,
+ [out,ref] uint32 *count_returned,
+ [out,ref] uint32 *total_entries,
+ [out,ref] netr_UAS_INFO_0 *recordid
+ );
+
+
+ /*****************/
+ /* Function 0x0A */
+
+ NTSTATUS netr_AccountSync(
+ [in,unique] [string,charset(UTF16)] uint16 *logon_server,
+ [in] [string,charset(UTF16)] uint16 *computername,
+ [in] netr_Authenticator credential,
+ [in,out,ref] netr_Authenticator *return_authenticator,
+ [in] uint32 reference,
+ [in] uint32 level,
+ [in] uint32 buffersize,
+ [out,ref,subcontext(4)] netr_AccountBuffer *buffer,
+ [out,ref] uint32 *count_returned,
+ [out,ref] uint32 *total_entries,
+ [out,ref] uint32 *next_reference,
+ [in,out,ref] netr_UAS_INFO_0 *recordid
+ );
+
+
+ /*****************/
+ /* Function 0x0B */
+
+ WERROR netr_GetDcName(
+ [in] [string,charset(UTF16)] uint16 *logon_server,
+ [in,unique] [string,charset(UTF16)] uint16 *domainname,
+ [out,ref] [string,charset(UTF16)] uint16 **dcname
+ );
+
+ /*****************/
+ /* Function 0x0C */
+
+ typedef [bitmap32bit] bitmap {
+ NETLOGON_REPLICATION_NEEDED = 0x00000001,
+ NETLOGON_REPLICATION_IN_PROGRESS = 0x00000002,
+ NETLOGON_FULL_SYNC_REPLICATION = 0x00000004,
+ NETLOGON_REDO_NEEDED = 0x00000008,
+ NETLOGON_HAS_IP = 0x00000010,
+ NETLOGON_HAS_TIMESERV = 0x00000020,
+ NETLOGON_DNS_UPDATE_FAILURE = 0x00000040,
+ NETLOGON_VERIFY_STATUS_RETURNED = 0x00000080
+ } netr_InfoFlags;
+
+ typedef struct {
+ netr_InfoFlags flags;
+ WERROR pdc_connection_status;
+ } netr_NETLOGON_INFO_1;
+
+ typedef struct {
+ netr_InfoFlags flags;
+ WERROR pdc_connection_status;
+ [string,charset(UTF16)] uint16 *trusted_dc_name;
+ WERROR tc_connection_status;
+ } netr_NETLOGON_INFO_2;
+
+ typedef struct {
+ netr_InfoFlags flags;
+ uint32 logon_attempts;
+ uint32 unknown1;
+ uint32 unknown2;
+ uint32 unknown3;
+ uint32 unknown4;
+ uint32 unknown5;
+ } netr_NETLOGON_INFO_3;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *trusted_dc_name;
+ [string,charset(UTF16)] uint16 *trusted_domain_name;
+ } netr_NETLOGON_INFO_4;
+
+ typedef [public] union {
+ [case(1)] netr_NETLOGON_INFO_1 *info1;
+ [case(2)] netr_NETLOGON_INFO_2 *info2;
+ [case(3)] netr_NETLOGON_INFO_3 *info3;
+ [case(4)] netr_NETLOGON_INFO_4 *info4;
+ [default] ;
+ } netr_CONTROL_QUERY_INFORMATION;
+
+ /* function_code values */
+ typedef [v1_enum,public] enum {
+ NETLOGON_CONTROL_QUERY = 0x00000001,
+ NETLOGON_CONTROL_REPLICATE = 0x00000002,
+ NETLOGON_CONTROL_SYNCHRONIZE = 0x00000003,
+ NETLOGON_CONTROL_PDC_REPLICATE = 0x00000004,
+ NETLOGON_CONTROL_REDISCOVER = 0x00000005,
+ NETLOGON_CONTROL_TC_QUERY = 0x00000006,
+ NETLOGON_CONTROL_TRANSPORT_NOTIFY = 0x00000007,
+ NETLOGON_CONTROL_FIND_USER = 0x00000008,
+ NETLOGON_CONTROL_CHANGE_PASSWORD = 0x00000009,
+ NETLOGON_CONTROL_TC_VERIFY = 0x0000000A,
+ NETLOGON_CONTROL_FORCE_DNS_REG = 0x0000000B,
+ NETLOGON_CONTROL_QUERY_DNS_REG = 0x0000000C,
+ NETLOGON_CONTROL_BACKUP_CHANGE_LOG = 0x0000FFFC,
+ NETLOGON_CONTROL_TRUNCATE_LOG = 0x0000FFFD,
+ NETLOGON_CONTROL_SET_DBFLAG = 0x0000FFFE,
+ NETLOGON_CONTROL_BREAKPOINT = 0x0000FFFF
+ } netr_LogonControlCode;
+
+ WERROR netr_LogonControl(
+ [in,unique] [string,charset(UTF16)] uint16 *logon_server,
+ [in] netr_LogonControlCode function_code,
+ [in] uint32 level,
+ [out,ref,switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query
+ );
+
+
+ /*****************/
+ /* Function 0x0D */
+
+ WERROR netr_GetAnyDCName(
+ [in,unique] [string,charset(UTF16)] uint16 *logon_server,
+ [in,unique] [string,charset(UTF16)] uint16 *domainname,
+ [out,ref] [string,charset(UTF16)] uint16 **dcname
+ );
+
+
+ /*****************/
+ /* Function 0x0E */
+
+ typedef [public,switch_type(netr_LogonControlCode)] union {
+ [case(NETLOGON_CONTROL_REDISCOVER)] [string,charset(UTF16)] uint16 *domain;
+ [case(NETLOGON_CONTROL_TC_QUERY)] [string,charset(UTF16)] uint16 *domain;
+ [case(NETLOGON_CONTROL_TRANSPORT_NOTIFY)] [string,charset(UTF16)] uint16 *domain;
+ [case(NETLOGON_CONTROL_CHANGE_PASSWORD)] [string,charset(UTF16)] uint16 *domain;
+ [case(NETLOGON_CONTROL_TC_VERIFY)] [string,charset(UTF16)] uint16 *domain;
+ [case(NETLOGON_CONTROL_FIND_USER)] [string,charset(UTF16)] uint16 *user;
+ [case(NETLOGON_CONTROL_SET_DBFLAG)] uint32 debug_level;
+ [default] ;
+ } netr_CONTROL_DATA_INFORMATION;
+
+ WERROR netr_LogonControl2(
+ [in,unique] [string,charset(UTF16)] uint16 *logon_server,
+ [in] netr_LogonControlCode function_code,
+ [in] uint32 level,
+ [in,ref][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION *data,
+ [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query
+ );
+
+
+ /* If NETLOGON_NEG_ARCFOUR flag is not set, then the passwords and LM
+ * session keys are encrypted with DES calls. (And the user session key
+ * is unencrypted) */
+
+ /*****************/
+ /* Function 0x0F */
+
+ typedef [public,bitmap32bit] bitmap {
+ NETLOGON_NEG_ACCOUNT_LOCKOUT = 0x00000001,
+ NETLOGON_NEG_PERSISTENT_SAMREPL = 0x00000002,
+ NETLOGON_NEG_ARCFOUR = 0x00000004,
+ NETLOGON_NEG_PROMOTION_COUNT = 0x00000008,
+ NETLOGON_NEG_CHANGELOG_BDC = 0x00000010,
+ NETLOGON_NEG_FULL_SYNC_REPL = 0x00000020,
+ NETLOGON_NEG_MULTIPLE_SIDS = 0x00000040,
+ NETLOGON_NEG_REDO = 0x00000080,
+ NETLOGON_NEG_PASSWORD_CHANGE_REFUSAL = 0x00000100,
+ NETLOGON_NEG_SEND_PASSWORD_INFO_PDC = 0x00000200,
+ NETLOGON_NEG_GENERIC_PASSTHROUGH = 0x00000400,
+ NETLOGON_NEG_CONCURRENT_RPC = 0x00000800,
+ NETLOGON_NEG_AVOID_ACCOUNT_DB_REPL = 0x00001000,
+ NETLOGON_NEG_AVOID_SECURITYAUTH_DB_REPL = 0x00002000,
+ NETLOGON_NEG_STRONG_KEYS = 0x00004000,
+ NETLOGON_NEG_TRANSITIVE_TRUSTS = 0x00008000,
+ NETLOGON_NEG_DNS_DOMAIN_TRUSTS = 0x00010000,
+ NETLOGON_NEG_PASSWORD_SET2 = 0x00020000,
+ NETLOGON_NEG_GETDOMAININFO = 0x00040000,
+ NETLOGON_NEG_CROSS_FOREST_TRUSTS = 0x00080000,
+ NETLOGON_NEG_NEUTRALIZE_NT4_EMULATION = 0x00100000,
+ NETLOGON_NEG_RODC_PASSTHROUGH = 0x00200000,
+ NETLOGON_NEG_SUPPORTS_AES_SHA2 = 0x00400000,
+ NETLOGON_NEG_SUPPORTS_AES = 0x01000000,
+ NETLOGON_NEG_AUTHENTICATED_RPC_LSASS = 0x20000000,
+ NETLOGON_NEG_AUTHENTICATED_RPC = 0x40000000
+ } netr_NegotiateFlags;
+
+ const uint32 NETLOGON_NEG_128BIT = NETLOGON_NEG_STRONG_KEYS;
+ const uint32 NETLOGON_NEG_SCHANNEL = NETLOGON_NEG_AUTHENTICATED_RPC;
+
+ NTSTATUS netr_ServerAuthenticate2(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Credential *credentials,
+ [out,ref] netr_Credential *return_credentials,
+ [in,out,ref] netr_NegotiateFlags *negotiate_flags
+ );
+
+
+ /*****************/
+ /* Function 0x10 */
+
+ typedef enum {
+ SYNCSTATE_NORMAL_STATE = 0,
+ SYNCSTATE_DOMAIN_STATE = 1,
+ SYNCSTATE_GROUP_STATE = 2,
+ SYNCSTATE_UAS_BUILT_IN_GROUP_STATE = 3,
+ SYNCSTATE_USER_STATE = 4,
+ SYNCSTATE_GROUP_MEMBER_STATE = 5,
+ SYNCSTATE_ALIAS_STATE = 6,
+ SYNCSTATE_ALIAS_MEMBER_STATE = 7,
+ SYNCSTATE_SAM_DONE_STATE = 8
+ } SyncStateEnum;
+
+ NTSTATUS netr_DatabaseSync2(
+ [in] [string,charset(UTF16)] uint16 *logon_server,
+ [in] [string,charset(UTF16)] uint16 *computername,
+ [in,ref] netr_Authenticator *credential,
+ [in,out,ref] netr_Authenticator *return_authenticator,
+ [in] netr_SamDatabaseID database_id,
+ [in] SyncStateEnum restart_state,
+ [in,out,ref] uint32 *sync_context,
+ [out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array,
+ [in] uint32 preferredmaximumlength
+ );
+
+
+ /*****************/
+ /* Function 0x11 */
+
+ /* i'm not at all sure how this call works */
+
+ typedef [bitmap16bit] bitmap {
+ NETR_CHANGELOG_IMMEDIATE_REPL_REQUIRED = 0x0001,
+ NETR_CHANGELOG_CHANGED_PASSWORD = 0x0002,
+ NETR_CHANGELOG_SID_INCLUDED = 0x0004,
+ NETR_CHANGELOG_NAME_INCLUDED = 0x0008,
+ NETR_CHANGELOG_FIRST_PROMOTION_OBJ = 0x0010
+ } netr_ChangeLogFlags;
+
+ typedef [nodiscriminant] union {
+ [case(NETR_CHANGELOG_SID_INCLUDED)] dom_sid object_sid;
+ [case(NETR_CHANGELOG_NAME_INCLUDED)] nstring object_name;
+ [default];
+ } netr_ChangeLogObject;
+
+ typedef [public,gensize] struct {
+ uint32 serial_number1;
+ uint32 serial_number2;
+ uint32 object_rid;
+ netr_ChangeLogFlags flags;
+ netr_SamDatabaseID8Bit db_index;
+ netr_DeltaEnum8Bit delta_type;
+ [switch_is(flags & (NETR_CHANGELOG_SID_INCLUDED|NETR_CHANGELOG_NAME_INCLUDED))] netr_ChangeLogObject object;
+ } netr_ChangeLogEntry;
+
+ NTSTATUS netr_DatabaseRedo(
+ [in] [string,charset(UTF16)] uint16 *logon_server,
+ [in] [string,charset(UTF16)] uint16 *computername,
+ [in] netr_Authenticator *credential,
+ [in,out,ref] netr_Authenticator *return_authenticator,
+ /*
+ * we cannot use subcontext_size() here, as
+ * change_log_entry_size is encoded after the subcontext
+ */
+ [in] [subcontext(4)/*,subcontext_size(change_log_entry_size)*/]
+ netr_ChangeLogEntry change_log_entry,
+ [in] [value(ndr_size_netr_ChangeLogEntry(&change_log_entry,
+ ndr->flags))]
+ uint32 change_log_entry_size,
+ [out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array
+ );
+
+
+ /*****************/
+ /* Function 0x12 */
+
+ WERROR netr_LogonControl2Ex(
+ [in,unique] [string,charset(UTF16)] uint16 *logon_server,
+ [in] netr_LogonControlCode function_code,
+ [in] uint32 level,
+ [in,ref][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION *data,
+ [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query
+ );
+
+ /*****************/
+ /* Function 0x13 */
+ typedef struct {
+ uint32 length;
+ [size_is(length)] uint8 *data;
+ } netr_Blob;
+
+ NTSTATUS netr_NetrEnumerateTrustedDomains(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [out,ref] netr_Blob *trusted_domains_blob
+ );
+
+ /*****************/
+ /* Function 0x14 */
+
+ /* one unknown bit still: DS_IP_VERSION_AGNOSTIC - gd*/
+
+ const int DSGETDC_VALID_FLAGS = (DS_FORCE_REDISCOVERY |
+ DS_DIRECTORY_SERVICE_REQUIRED |
+ DS_DIRECTORY_SERVICE_PREFERRED |
+ DS_GC_SERVER_REQUIRED |
+ DS_PDC_REQUIRED |
+ DS_BACKGROUND_ONLY |
+ DS_IP_REQUIRED |
+ DS_KDC_REQUIRED |
+ DS_TIMESERV_REQUIRED |
+ DS_WRITABLE_REQUIRED |
+ DS_GOOD_TIMESERV_PREFERRED |
+ DS_AVOID_SELF |
+ DS_ONLY_LDAP_NEEDED |
+ DS_IS_FLAT_NAME |
+ DS_IS_DNS_NAME |
+ DS_TRY_NEXTCLOSEST_SITE |
+ DS_DIRECTORY_SERVICE_6_REQUIRED |
+ DS_WEB_SERVICE_REQUIRED |
+ /*
+ * For now we skip these until
+ * we have test for them:
+ * DS_DIRECTORY_SERVICE_8_REQUIRED |
+ * DS_DIRECTORY_SERVICE_9_REQUIRED |
+ * DS_DIRECTORY_SERVICE_10_REQUIRED |
+ */
+ DS_RETURN_FLAT_NAME |
+ DS_RETURN_DNS_NAME);
+
+ typedef [bitmap32bit] bitmap {
+ DS_FORCE_REDISCOVERY = 0x00000001,
+ DS_DIRECTORY_SERVICE_REQUIRED = 0x00000010,
+ DS_DIRECTORY_SERVICE_PREFERRED = 0x00000020,
+ DS_GC_SERVER_REQUIRED = 0x00000040,
+ DS_PDC_REQUIRED = 0x00000080,
+ DS_BACKGROUND_ONLY = 0x00000100,
+ DS_IP_REQUIRED = 0x00000200,
+ DS_KDC_REQUIRED = 0x00000400,
+ DS_TIMESERV_REQUIRED = 0x00000800,
+ DS_WRITABLE_REQUIRED = 0x00001000,
+ DS_GOOD_TIMESERV_PREFERRED = 0x00002000,
+ DS_AVOID_SELF = 0x00004000,
+ DS_ONLY_LDAP_NEEDED = 0x00008000,
+ DS_IS_FLAT_NAME = 0x00010000,
+ DS_IS_DNS_NAME = 0x00020000,
+ DS_TRY_NEXTCLOSEST_SITE = 0x00040000,
+ DS_DIRECTORY_SERVICE_6_REQUIRED = 0x00080000, /* 2008 */
+ DS_WEB_SERVICE_REQUIRED = 0x00100000,
+ DS_DIRECTORY_SERVICE_8_REQUIRED = 0x00200000, /* 2012 */
+ DS_DIRECTORY_SERVICE_9_REQUIRED = 0x00400000, /* 2012R2 */
+ DS_DIRECTORY_SERVICE_10_REQUIRED= 0x00800000, /* 2016 */
+ DS_RETURN_DNS_NAME = 0x40000000,
+ DS_RETURN_FLAT_NAME = 0x80000000
+ } netr_DsRGetDCName_flags;
+
+ typedef [v1_enum] enum {
+ DS_ADDRESS_TYPE_INET = 1,
+ DS_ADDRESS_TYPE_NETBIOS = 2
+ } netr_DsRGetDCNameInfo_AddressType;
+
+ typedef [bitmap32bit] bitmap {
+ DS_SERVER_PDC = 0x00000001,
+ DS_SERVER_GC = 0x00000004,
+ DS_SERVER_LDAP = 0x00000008,
+ DS_SERVER_DS = 0x00000010,
+ DS_SERVER_KDC = 0x00000020,
+ DS_SERVER_TIMESERV = 0x00000040,
+ DS_SERVER_CLOSEST = 0x00000080,
+ DS_SERVER_WRITABLE = 0x00000100,
+ DS_SERVER_GOOD_TIMESERV = 0x00000200,
+ DS_SERVER_NDNC = 0x00000400,
+ DS_SERVER_SELECT_SECRET_DOMAIN_6 = 0x00000800, /* 2008 / RODC */
+ DS_SERVER_FULL_SECRET_DOMAIN_6 = 0x00001000, /* 2008 / RWDC */
+ DS_SERVER_WEBSERV = 0x00002000,
+ DS_SERVER_DS_8 = 0x00004000, /* 2012 */
+ DS_SERVER_DS_9 = 0x00008000, /* 2012R2 */
+ DS_SERVER_DS_10 = 0x00010000, /* 2016 */
+ DS_DNS_CONTROLLER = 0x20000000,
+ DS_DNS_DOMAIN = 0x40000000,
+ DS_DNS_FOREST_ROOT = 0x80000000
+ } netr_DsR_DcFlags;
+
+ typedef [public] struct {
+ [string,charset(UTF16)] uint16 *dc_unc;
+ [string,charset(UTF16)] uint16 *dc_address;
+ netr_DsRGetDCNameInfo_AddressType dc_address_type;
+ GUID domain_guid;
+ [string,charset(UTF16)] uint16 *domain_name;
+ [string,charset(UTF16)] uint16 *forest_name;
+ netr_DsR_DcFlags dc_flags;
+ [string,charset(UTF16)] uint16 *dc_site_name;
+ [string,charset(UTF16)] uint16 *client_site_name;
+ } netr_DsRGetDCNameInfo;
+
+ WERROR netr_DsRGetDCName(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *domain_name,
+ [in,unique] GUID *domain_guid,
+ [in,unique] GUID *site_guid,
+ [in] netr_DsRGetDCName_flags flags,
+ [out,ref] netr_DsRGetDCNameInfo **info
+ );
+
+ /*****************/
+ /* Function 0x15 */
+ typedef [switch_type(uint32)] union {
+ [case(1)] netr_NegotiateFlags server_capabilities;
+ [case(2)] netr_NegotiateFlags server_capabilities;
+ } netr_Capabilities;
+
+ NTSTATUS netr_LogonGetCapabilities(
+ [in] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [in,out,ref] netr_Authenticator *return_authenticator,
+ [in] uint32 query_level,
+ [out,ref,switch_is(query_level)] netr_Capabilities *capabilities
+ );
+
+ /****************/
+ /* Function 0x16 */
+ [todo] WERROR netr_NETRLOGONSETSERVICEBITS();
+
+ /****************/
+ /* Function 0x17 */
+ WERROR netr_LogonGetTrustRid(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *domain_name,
+ [out,ref] uint32 *rid
+ );
+
+ /****************/
+ /* Function 0x18 */
+ [todo] WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();
+
+ /****************/
+ /* Function 0x19 */
+ [todo] WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();
+
+ /****************/
+ /* Function 0x1a */
+ [public] NTSTATUS netr_ServerAuthenticate3(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Credential *credentials,
+ [out,ref] netr_Credential *return_credentials,
+ [in,out,ref] netr_NegotiateFlags *negotiate_flags,
+ [out,ref] uint32 *rid
+ );
+
+ /****************/
+ /* Function 0x1b */
+
+ WERROR netr_DsRGetDCNameEx(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *domain_name,
+ [in,unique] GUID *domain_guid,
+ [in,unique] [string,charset(UTF16)] uint16 *site_name,
+ [in] netr_DsRGetDCName_flags flags,
+ [out,ref] netr_DsRGetDCNameInfo **info
+ );
+
+
+ /****************/
+ /* Function 0x1c */
+ WERROR netr_DsRGetSiteName(
+ [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+ [out,ref] [string,charset(UTF16)] uint16 **site
+ );
+
+ /****************/
+ /* Function 0x1d */
+ typedef [public,bitmap32bit] bitmap {
+ NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
+ NETR_TRUST_FLAG_OUTBOUND = 0x00000002,
+ NETR_TRUST_FLAG_TREEROOT = 0x00000004,
+ NETR_TRUST_FLAG_PRIMARY = 0x00000008,
+ NETR_TRUST_FLAG_NATIVE = 0x00000010,
+ NETR_TRUST_FLAG_INBOUND = 0x00000020,
+ NETR_TRUST_FLAG_MIT_KRB5 = 0x00000080,
+ NETR_TRUST_FLAG_AES = 0x00000100
+ } netr_TrustFlags;
+
+ typedef [bitmap32bit] bitmap {
+ NETR_WS_FLAG_HANDLES_INBOUND_TRUSTS = 0x00000001,
+ NETR_WS_FLAG_HANDLES_SPN_UPDATE = 0x00000002
+ } netr_WorkstationFlags;
+
+ typedef [bitmap16bit] bitmap {
+ NETR_VER_SUITE_BACKOFFICE = 0x0004,
+ NETR_VER_SUITE_BLADE = 0x0400,
+ NETR_VER_SUITE_COMPUTE_SERVER = 0x4000,
+ NETR_VER_SUITE_DATACENTER = 0x0080,
+ NETR_VER_SUITE_ENTERPRISE = 0x0002,
+ NETR_VER_SUITE_EMBEDDEDNT = 0x0040,
+ NETR_VER_SUITE_PERSONAL = 0x0200,
+ NETR_VER_SUITE_SINGLEUSERTS = 0x0100,
+ NETR_VER_SUITE_SMALLBUSINESS = 0x0001,
+ NETR_VER_SUITE_SMALLBUSINESS_RESTRICTED = 0x0020,
+ NETR_VER_SUITE_STORAGE_SERVER = 0x2000,
+ NETR_VER_SUITE_TERMINAL = 0x0010,
+ NETR_VER_SUITE_WH_SERVER = 0x8000
+ } netr_SuiteMask;
+
+ typedef [bitmap8bit] bitmap {
+ NETR_VER_NT_DOMAIN_CONTROLLER = 0x02,
+ NETR_VER_NT_SERVER = 0x03,
+ NETR_VER_NT_WORKSTATION = 0x01
+ } netr_ProductType;
+
+ typedef struct {
+ uint32 policy_size;
+ [size_is(policy_size)] uint8 *policy;
+ } netr_LsaPolicyInformation;
+
+ typedef struct {
+ [value(284)] uint32 OSVersionInfoSize;
+ uint32 MajorVersion;
+ uint32 MinorVersion;
+ uint32 BuildNumber;
+ uint32 PlatformId;
+ [subcontext(0),subcontext_size(256)] nstring CSDVersion;
+ uint16 ServicePackMajor;
+ uint16 ServicePackMinor;
+ netr_SuiteMask SuiteMask;
+ netr_ProductType ProductType;
+ uint8 Reserved;
+ } netr_OsVersionInfoEx;
+
+ typedef struct {
+ /* these first 3 values come from the fact windows
+ actually encodes this structure as a UNICODE_STRING
+ - see MS-NRPC section 2.2.1.3.9 */
+ /* 142 * 2 = 284 (length of structure "netr_OsVersionInfoEx") */
+ [value(142)] uint3264 length;
+ [value(0)] uint3264 dummy;
+ [value(142)] uint3264 size;
+ [subcontext(0),subcontext_size(size*2)]
+ netr_OsVersionInfoEx os;
+ } netr_OsVersion;
+
+ typedef struct {
+ /* value is 284 when info != os, otherwise 0 (for length and
+ size) */
+ [value(os == NULL ? 0 : 284)] uint16 length;
+ [value(os == NULL ? 0 : 284)] uint16 size;
+ netr_OsVersion *os;
+ } netr_OsVersionContainer;
+
+ typedef struct {
+ netr_LsaPolicyInformation lsa_policy;
+ [string,charset(UTF16)] uint16 *dns_hostname;
+ [string,charset(UTF16)] uint16 *sitename;
+ [string,charset(UTF16)] uint16 *dummy1;
+ [string,charset(UTF16)] uint16 *dummy2;
+ [string,charset(UTF16)] uint16 *dummy3;
+ [string,charset(UTF16)] uint16 *dummy4;
+ netr_OsVersionContainer os_version;
+ lsa_String os_name;
+ lsa_String dummy_string3;
+ lsa_String dummy_string4;
+ netr_WorkstationFlags workstation_flags;
+ kerb_EncTypes supported_enc_types;
+ uint32 dummy_long3;
+ uint32 dummy_long4;
+ } netr_WorkstationInformation;
+
+ typedef union {
+ [case(1)] netr_WorkstationInformation *workstation_info;
+ [case(2)] netr_WorkstationInformation *lsa_policy_info;
+ } netr_WorkstationInfo;
+
+ typedef struct {
+ netr_TrustFlags flags;
+ uint32 parent_index;
+ lsa_TrustType trust_type;
+ lsa_TrustAttributes trust_attributes;
+ } netr_trust_extension_info;
+
+ typedef struct {
+ /* these first 3 values come from the fact windows
+ actually encodes this structure as a UNICODE_STRING
+ - see MS-NRPC section 2.2.1.3.9 */
+ [value(8)] uint3264 length;
+ [value(0)] uint3264 dummy;
+ [value(8)] uint3264 size;
+ [subcontext(0),subcontext_size(size*2)]
+ netr_trust_extension_info info;
+ } netr_trust_extension;
+
+ typedef struct {
+ /* value is 16 when info != NULL, otherwise 0 */
+ [value(info == NULL ? 0 : 16)] uint16 length;
+ [value(info == NULL ? 0 : 16)] uint16 size;
+ netr_trust_extension *info;
+ } netr_trust_extension_container;
+
+ typedef struct {
+ lsa_StringLarge domainname;
+ lsa_StringLarge dns_domainname;
+ lsa_StringLarge dns_forestname;
+ GUID domain_guid;
+ dom_sid2 *domain_sid;
+ netr_trust_extension_container trust_extension;
+ lsa_StringLarge dummy_string2;
+ lsa_StringLarge dummy_string3;
+ lsa_StringLarge dummy_string4;
+ uint32 dummy_long1;
+ uint32 dummy_long2;
+ uint32 dummy_long3;
+ uint32 dummy_long4;
+ } netr_OneDomainInfo;
+
+ typedef struct {
+ netr_OneDomainInfo primary_domain;
+ uint32 trusted_domain_count;
+ [size_is(trusted_domain_count)] netr_OneDomainInfo *trusted_domains;
+ netr_LsaPolicyInformation lsa_policy;
+ lsa_StringLarge dns_hostname;
+ lsa_StringLarge dummy_string2;
+ lsa_StringLarge dummy_string3;
+ lsa_StringLarge dummy_string4;
+ netr_WorkstationFlags workstation_flags;
+ kerb_EncTypes supported_enc_types;
+ uint32 dummy_long3;
+ uint32 dummy_long4;
+ } netr_DomainInformation;
+
+ typedef union {
+ [case(1)] netr_DomainInformation *domain_info;
+ [case(2)] netr_LsaPolicyInformation *lsa_policy_info;
+ } netr_DomainInfo;
+
+ [public] NTSTATUS netr_LogonGetDomainInfo(
+ [in] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [in,out,ref] netr_Authenticator *return_authenticator,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] netr_WorkstationInfo *query,
+ [out,ref,switch_is(level)] netr_DomainInfo *info
+ );
+
+ /*****************/
+ /* Function 0x1e */
+
+ /* [MS-NRPC] 2.2.1.3.8 NL_PASSWORD_VERSION */
+
+ /* someone's birthday ? */
+ const int NETLOGON_PASSWORD_VERSION_NUMBER_PRESENT = 0x02231968;
+
+ typedef struct {
+ uint32 ReservedField;
+ uint32 PasswordVersionNumber;
+ uint32 PasswordVersionPresent;
+ } NL_PASSWORD_VERSION;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint8 data[512];
+ uint32 length;
+ } netr_CryptPassword;
+
+ NTSTATUS netr_ServerPasswordSet2(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [in,ref] netr_CryptPassword *new_password
+ );
+
+ /****************/
+ /* Function 0x1f */
+ NTSTATUS netr_ServerPasswordGet(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [out,ref] samr_Password *password
+ );
+
+ typedef [public] enum {
+ SendToSamUpdatePassword = 0,
+ SendToSamResetBadPasswordCount = 1,
+ SendToSamUpdatePasswordForward = 2,
+ SendToSamUpdateLastLogonTimestamp = 3,
+ SendToSamResetSmartCardPassword = 4
+ } netr_SendToSamType;
+
+ typedef struct {
+ GUID guid;
+ } netr_SendToSamResetBadPasswordCount;
+
+ typedef [nodiscriminant, public,switch_type(netr_SendToSamType)] union {
+ /* TODO Implement other SendToSam message types
+ * [case(SendToSamUpdatePassword)] netr_SendToSamUpdatePassword ...; */
+ [case(SendToSamResetBadPasswordCount)] netr_SendToSamResetBadPasswordCount reset_bad_password;
+ /*
+ * [case(SendToSamUpdatePasswordForward)] netrSendToSamUpdatePasswordForward ...;
+ * [case(SendToSamUpdateLastLogonTimestamp)] netrSendToSamUpdateLastLogonTimestamp ...;
+ * [case(SendToSamResetSmartCardPassword)] netrSendToSamResetSmartCardPassword ...;
+ */
+ [default];
+ } netr_SendToSamMessage;
+
+ typedef [public] struct {
+ netr_SendToSamType message_type;
+ uint32 message_size;
+ [switch_is(message_type), subcontext(0), subcontext_size(message_size)] netr_SendToSamMessage message;
+ } netr_SendToSamBase;
+
+ /****************/
+ /* Function 0x20 */
+ NTSTATUS netr_NetrLogonSendToSam(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [in,ref] [size_is(buffer_len)] uint8 *opaque_buffer,
+ [in] uint32 buffer_len
+ );
+
+ /****************/
+ /* Function 0x21 */
+ typedef struct {
+ uint32 count;
+ [size_is(count)] lsa_String *sitename;
+ } netr_DsRAddressToSitenamesWCtr;
+
+ typedef struct {
+ [size_is(size)] uint8 *buffer;
+ uint32 size;
+ } netr_DsRAddress;
+
+ WERROR netr_DsRAddressToSitenamesW(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [range(0,32000)] uint32 count,
+ [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
+ [out] [ref] netr_DsRAddressToSitenamesWCtr **ctr
+ );
+
+ /****************/
+ /* Function 0x22 */
+ WERROR netr_DsRGetDCNameEx2(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *client_account,
+ [in] samr_AcctFlags mask,
+ [in,unique] [string,charset(UTF16)] uint16 *domain_name,
+ [in,unique] GUID *domain_guid,
+ [in,unique] [string,charset(UTF16)] uint16 *site_name,
+ [in] netr_DsRGetDCName_flags flags,
+ [out,ref] netr_DsRGetDCNameInfo **info
+ );
+
+ /****************/
+ /* Function 0x23 */
+ [todo] WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();
+
+ /****************/
+ /* Function 0x24 */
+
+ typedef [public] struct {
+ [string,charset(UTF16)] uint16 *netbios_name;
+ [string,charset(UTF16)] uint16 *dns_name;
+ netr_TrustFlags trust_flags;
+ uint32 parent_index;
+ lsa_TrustType trust_type;
+ lsa_TrustAttributes trust_attributes;
+ dom_sid2 *sid;
+ GUID guid;
+ } netr_DomainTrust;
+
+ typedef [public] struct {
+ uint32 count;
+ [size_is(count)] netr_DomainTrust *array;
+ } netr_DomainTrustList;
+
+ WERROR netr_NetrEnumerateTrustedDomainsEx(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [out,ref] netr_DomainTrustList *dom_trust_list
+ );
+
+ /****************/
+ /* Function 0x25 */
+ typedef struct {
+ uint32 count;
+ [size_is(count)] lsa_String *sitename;
+ [size_is(count)] lsa_String *subnetname;
+ } netr_DsRAddressToSitenamesExWCtr;
+
+ WERROR netr_DsRAddressToSitenamesExW(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [range(0,32000)] uint32 count,
+ [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
+ [out] [ref] netr_DsRAddressToSitenamesExWCtr **ctr
+ );
+
+ /****************/
+ /* Function 0x26 */
+
+ typedef struct {
+ uint32 num_sites;
+ [size_is(num_sites)] [unique] lsa_String *sites;
+ } DcSitesCtr;
+
+ WERROR netr_DsrGetDcSiteCoverageW(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [out,ref] DcSitesCtr **ctr
+ );
+
+ /****************/
+ /* Function 0x27 */
+ typedef [public,bitmap32bit] bitmap {
+ /* Request MUST be passed to the domain controller at the root of the forest. */
+ NETLOGON_SAMLOGON_FLAG_PASS_TO_FOREST_ROOT = 0x00000001,
+ /* Request MUST be passed to the DC at the end of the first hop over a cross-forest trust. */
+ NETLOGON_SAMLOGON_FLAG_PASS_CROSS_FOREST_HOP = 0x00000002,
+ /* Request was passed by an RODC to a DC in a different domain. */
+ NETLOGON_SAMLOGON_FLAG_RODC_TO_OTHER_DOMAIN = 0x00000004,
+ /* Request is an NTLM authentication package request passed by an RODC. */
+ NETLOGON_SAMLOGON_FLAG_RODC_NTLM_REQUEST = 0x00000008
+ } netr_LogonSamLogon_flags;
+
+ NTSTATUS netr_LogonSamLogonEx(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+ [in] netr_LogonInfoClass logon_level,
+ [in,ref] [switch_is(logon_level)] netr_LogonLevel *logon,
+ [in] uint16 validation_level,
+ [out,ref] [switch_is(validation_level)] netr_Validation *validation,
+ [out,ref] uint8 *authoritative,
+ [in,out,ref] netr_LogonSamLogon_flags *flags
+ );
+
+ /****************/
+ /* Function 0x28 */
+
+ WERROR netr_DsrEnumerateDomainTrusts(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] netr_TrustFlags trust_flags,
+ [out,ref] netr_DomainTrustList *trusts
+ );
+
+
+ /****************/
+ /* Function 0x29 */
+ WERROR netr_DsrDeregisterDNSHostRecords(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *domain,
+ [in,unique] GUID *domain_guid,
+ [in,unique] GUID *dsa_guid,
+ [in,ref] [string,charset(UTF16)] uint16 *dns_host
+ );
+
+ /****************/
+ /* Function 0x2a */
+ NTSTATUS netr_ServerTrustPasswordsGet(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [out,ref] samr_Password *new_owf_password,
+ [out,ref] samr_Password *old_owf_password
+ );
+
+ /****************/
+ /* Function 0x2b */
+
+ const int DS_GFTI_UPDATE_TDO = 0x1;
+
+ WERROR netr_DsRGetForestTrustInformation(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *trusted_domain_name,
+ [in] uint32 flags,
+ [out,ref] lsa_ForestTrustInformation **forest_trust_info
+ );
+
+ /****************/
+ /* Function 0x2c */
+ NTSTATUS netr_GetForestTrustInformation(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [in] uint32 flags,
+ [out,ref] lsa_ForestTrustInformation **forest_trust_info
+ );
+
+ /****************/
+ /* Function 0x2d */
+
+ /* this is the ADS varient. I don't yet know what the "flags" are for */
+ NTSTATUS netr_LogonSamLogonWithFlags(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+ [in,unique] netr_Authenticator *credential,
+ [in,out,unique] netr_Authenticator *return_authenticator,
+ [in] netr_LogonInfoClass logon_level,
+ [in,ref] [switch_is(logon_level)] netr_LogonLevel *logon,
+ [in] uint16 validation_level,
+ [out,ref] [switch_is(validation_level)] netr_Validation *validation,
+ [out,ref] uint8 *authoritative,
+ [in,out,ref] netr_LogonSamLogon_flags *flags
+ );
+
+ /****************/
+ /* Function 0x2e */
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] uint32 *data;
+ uint32 entry_count;
+ [size_is(count)] lsa_String *entries;
+ } netr_TrustInfo;
+
+ NTSTATUS netr_ServerGetTrustInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in,ref] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [out,ref] samr_Password *new_owf_password,
+ [out,ref] samr_Password *old_owf_password,
+ [out,ref] netr_TrustInfo **trust_info
+ );
+
+ /****************/
+ /* Function 0x2f */
+
+ NTSTATUS netr_Unused47(void);
+
+
+ /****************/
+ /* Function 0x30 */
+
+ typedef enum {
+ NlDnsLdapAtSite = 22,
+ NlDnsGcAtSite = 25,
+ NlDnsDsaCname = 28,
+ NlDnsKdcAtSite = 30,
+ NlDnsDcAtSite = 32,
+ NlDnsRfc1510KdcAtSite = 34,
+ NlDnsGenericGcAtSite = 36
+ } netr_DnsType;
+
+ typedef enum {
+ NlDnsInfoTypeNone = 0,
+ NlDnsDomainName = 1,
+ NlDnsDomainNameAlias = 2,
+ NlDnsForestName = 3,
+ NlDnsForestNameAlias = 4,
+ NlDnsNdncDomainName = 5,
+ NlDnsRecordName = 6
+ } netr_DnsDomainInfoType;
+
+ typedef struct {
+ netr_DnsType type;
+ [string,charset(UTF16)] uint16 *dns_domain_info;
+ netr_DnsDomainInfoType dns_domain_info_type;
+ uint32 priority;
+ uint32 weight;
+ uint32 port;
+ boolean32 dns_register;
+ uint32 status;
+ } NL_DNS_NAME_INFO;
+
+ typedef [public] struct {
+ uint32 count;
+ [size_is(count)] NL_DNS_NAME_INFO *names;
+ } NL_DNS_NAME_INFO_ARRAY;
+
+ NTSTATUS netr_DsrUpdateReadOnlyServerDnsRecords(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *computer_name,
+ [in, ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [in,unique] [string,charset(UTF16)] uint16 *site_name,
+ [in] uint32 dns_ttl,
+ [in,out,ref] NL_DNS_NAME_INFO_ARRAY *dns_names
+ );
+}
diff --git a/librpc/idl/nfs4acl.idl b/librpc/idl/nfs4acl.idl
new file mode 100644
index 0000000..10a60ed
--- /dev/null
+++ b/librpc/idl/nfs4acl.idl
@@ -0,0 +1,51 @@
+#include "idl_types.h"
+
+/*
+ NFS4 ACL format on disk
+ see http://www.suse.de/~agruen/nfs4acl/
+*/
+
+import "misc.idl", "security.idl";
+
+[
+ version(1.0),
+ pointer_default(unique)
+]
+interface nfs4acl_interface
+{
+ const char *NFS4ACL_NDR_XATTR_NAME = "security.nfs4acl_ndr";
+
+ const char *NFS4ACL_XATTR_OWNER_WHO = "OWNER@";
+ const char *NFS4ACL_XATTR_GROUP_WHO = "GROUP@";
+ const char *NFS4ACL_XATTR_EVERYONE_WHO = "EVERYONE@";
+
+ const uint8 ACL4_XATTR_VERSION_40 = 0x00;
+ const uint8 ACL4_XATTR_VERSION_41 = 0x01;
+ const uint8 ACL4_XATTR_VERSION_DEFAULT = ACL4_XATTR_VERSION_41;
+
+ const uint8 ACL4_AUTO_INHERIT = 0x01;
+ const uint8 ACL4_PROTECTED = 0x02;
+ const uint8 ACL4_DEFAULTED = 0x04;
+ const uint8 ACL4_WRITE_THROUGH = 0x40;
+
+ /* 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;
+}
diff --git a/librpc/idl/notify.idl b/librpc/idl/notify.idl
new file mode 100644
index 0000000..5f83f4f
--- /dev/null
+++ b/librpc/idl/notify.idl
@@ -0,0 +1,94 @@
+#include "idl_types.h"
+
+import "file_id.idl", "server_id.idl";
+
+/*
+ IDL structures for notify change code
+
+ this defines the structures used in the notify database code, and
+ the change notify buffers
+*/
+
+[
+ pointer_default(unique)
+]
+interface notify
+{
+
+ /* structure used in the notify database */
+ typedef [public] struct {
+ server_id server;
+ uint32 filter; /* filter to apply in this directory */
+ uint32 subdir_filter; /* filter to apply in child directories */
+ uint32 dir_fd; /* fd of open directory */
+ file_id dir_id; /* file_id of open directory */
+ utf8string path;
+ uint32 path_len; /* saves some computation on search */
+ pointer private_data;
+ } notify_entry;
+
+ typedef [public] struct {
+ uint32 num_entries;
+ notify_entry entries[num_entries];
+ } notify_entry_array;
+
+ typedef [public] struct {
+ server_id server;
+ uint32 filter; /* filter to apply in this directory */
+ uint32 subdir_filter; /* filter to apply in child directories */
+ pointer private_data;
+ } notify_db_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 dir;
+ utf8string path;
+ pointer private_data;
+ } notify_event;
+
+ typedef [v1_enum] enum {
+ FILE_ACTION_ADDED = 0x00000001,
+ FILE_ACTION_REMOVED = 0x00000002,
+ FILE_ACTION_MODIFIED = 0x00000003,
+ FILE_ACTION_RENAMED_OLD_NAME = 0x00000004,
+ FILE_ACTION_RENAMED_NEW_NAME = 0x00000005,
+ FILE_ACTION_ADDED_STREAM = 0x00000006,
+ FILE_ACTION_REMOVED_STREAM = 0x00000007,
+ FILE_ACTION_MODIFIED_STREAM = 0x00000008
+ } FILE_NOTIFY_ACTION;
+
+ /* structure sent at the CIFS layer */
+ /* Align on 4-byte boundary according to MS-CIFS 2.2.7.4.2 */
+ typedef [public,gensize,flag(NDR_ALIGN4)] struct {
+ uint32 NextEntryOffset;
+ FILE_NOTIFY_ACTION Action;
+ [value(strlen_m(FileName1)*2)] uint32 FileNameLength;
+ [charset(UTF16),flag(STR_NOTERM)]
+ uint16 FileName1[strlen_m(FileName1)];
+ DATA_BLOB _pad;
+ } FILE_NOTIFY_INFORMATION;
+}
diff --git a/librpc/idl/ntlmssp.idl b/librpc/idl/ntlmssp.idl
new file mode 100644
index 0000000..dd4c0b9
--- /dev/null
+++ b/librpc/idl/ntlmssp.idl
@@ -0,0 +1,307 @@
+#include "idl_types.h"
+
+import "security.idl";
+
+/*
+ ntlmssp interface definition
+*/
+
+[
+ pointer_default(unique),
+ helper("../librpc/ndr/ndr_ntlmssp.h"),
+ helpstring("NTLM messages"),
+ uuid("6e746c6d-7373-700a-0000-00000000")
+]
+interface ntlmssp
+{
+ typedef [v1_enum] enum {
+ NtLmNegotiate = 0x00000001,
+ NtLmChallenge = 0x00000002,
+ NtLmAuthenticate = 0x00000003
+ } ntlmssp_MessageType;
+
+ /* [MS-NLMP] 2.2.2.5 NEGOTIATE */
+
+ typedef [bitmap32bit] bitmap {
+ NTLMSSP_NEGOTIATE_UNICODE = 0x00000001,
+ NTLMSSP_NEGOTIATE_OEM = 0x00000002, /* NTLM_NEGOTIATE_OEM in MS-NLMP */
+ NTLMSSP_REQUEST_TARGET = 0x00000004,
+ NTLMSSP_NEGOTIATE_SIGN = 0x00000010, /* Message integrity */
+ NTLMSSP_NEGOTIATE_SEAL = 0x00000020, /* Message confidentiality */
+ NTLMSSP_NEGOTIATE_DATAGRAM = 0x00000040,
+ NTLMSSP_NEGOTIATE_LM_KEY = 0x00000080,
+ NTLMSSP_NEGOTIATE_NETWARE = 0x00000100, /* not mentioned in MS-NLMP */
+ NTLMSSP_NEGOTIATE_NTLM = 0x00000200,
+ NTLMSSP_NEGOTIATE_NT_ONLY = 0x00000400,
+ NTLMSSP_ANONYMOUS = 0x00000800, /* no symbol name in MS-NLMP */
+ NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED = 0x00001000,
+ NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED = 0x00002000,
+ NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL = 0x00004000, /* not mentioned in MS-NLMP */
+ NTLMSSP_NEGOTIATE_ALWAYS_SIGN = 0x00008000,
+ NTLMSSP_TARGET_TYPE_DOMAIN = 0x00010000,
+ NTLMSSP_TARGET_TYPE_SERVER = 0x00020000,
+ NTLMSSP_TARGET_TYPE_SHARE = 0x00040000,
+ NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY = 0x00080000,
+ NTLMSSP_NEGOTIATE_IDENTIFY = 0x00100000,
+ NTLMSSP_REQUEST_NON_NT_SESSION_KEY = 0x00400000,
+ NTLMSSP_NEGOTIATE_TARGET_INFO = 0x00800000,
+ NTLMSSP_NEGOTIATE_VERSION = 0x02000000,
+ NTLMSSP_NEGOTIATE_128 = 0x20000000, /* 128-bit encryption */
+ NTLMSSP_NEGOTIATE_KEY_EXCH = 0x40000000,
+ NTLMSSP_NEGOTIATE_56 = 0x80000000
+ } NEGOTIATE;
+
+ /* convenience mapping */
+ const int NTLMSSP_NEGOTIATE_NTLM2 = NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY;
+
+ /*
+ NTLMSSP_WINDOWS_MAJOR_VERSION_5: Windows XP SP2 and Server 2003
+ NTLMSSP_WINDOWS_MAJOR_VERSION_6: Windows Vista, Server 2008, 7, Server 2008 R2, 8, Server 2012, 8.1, Server 2012 R2
+ NTLMSSP_WINDOWS_MAJOR_VERSION_10: Windows 10, Windows Server 2016 Technical Preview
+ */
+
+ typedef [enum8bit] enum {
+ NTLMSSP_WINDOWS_MAJOR_VERSION_5 = 0x05,
+ NTLMSSP_WINDOWS_MAJOR_VERSION_6 = 0x06,
+ NTLMSSP_WINDOWS_MAJOR_VERSION_10 = 0x0A
+ } ntlmssp_WindowsMajorVersion;
+
+ /*
+ NTLMSSP_WINDOWS_MINOR_VERSION_0: Windows Vista, 10, Server 2016 Technical Preview
+ NTLMSSP_WINDOWS_MINOR_VERSION_1: Windows XP SP2, 7, Server 2008 R2
+ NTLMSSP_WINDOWS_MINOR_VERSION_2: Windows Server 2003, 8, Server 2012
+ NTLMSSP_WINDOWS_MINOR_VERSION_3: Windows 8.1, Server 2012 R2
+ */
+
+ typedef [enum8bit] enum {
+ NTLMSSP_WINDOWS_MINOR_VERSION_0 = 0x00,
+ NTLMSSP_WINDOWS_MINOR_VERSION_1 = 0x01,
+ NTLMSSP_WINDOWS_MINOR_VERSION_2 = 0x02,
+ NTLMSSP_WINDOWS_MINOR_VERSION_3 = 0x03
+ } ntlmssp_WindowsMinorVersion;
+
+ /*
+ NTLMSSP_REVISION_W2K3_RC1:
+ NTLMSSP_REVISION_W2K3: Windows XP SP2, Server 2003, Vista, Server 2008, 7, Server 2008 R2
+ */
+
+ typedef [enum8bit] enum {
+ NTLMSSP_REVISION_W2K3_RC1 = 0x0A,
+ NTLMSSP_REVISION_W2K3 = 0x0F
+ } ntlmssp_NTLMRevisionCurrent;
+
+ /* [MS-NLMP] 2.2.2.10 VERSION */
+
+ typedef [public] struct {
+ ntlmssp_WindowsMajorVersion ProductMajorVersion;
+ ntlmssp_WindowsMinorVersion ProductMinorVersion;
+ uint16 ProductBuild;
+ uint8 Reserved[3];
+ ntlmssp_NTLMRevisionCurrent NTLMRevisionCurrent;
+ } ntlmssp_VERSION;
+
+ typedef [noprint,nodiscriminant] union {
+ [case(NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_VERSION version;
+ [default];
+ } ntlmssp_Version;
+
+ /* [MS-NLMP] 2.2.1.1 NEGOTIATE_MESSAGE */
+
+ typedef [public] struct {
+ [charset(DOS),value("NTLMSSP")] uint8 Signature[8];
+ [value(NtLmNegotiate)] ntlmssp_MessageType MessageType;
+ NEGOTIATE NegotiateFlags;
+ [value(DomainName ? strlen(DomainName) : 0)] uint16 DomainNameLen;
+ [value(DomainNameLen)] uint16 DomainNameMaxLen;
+ [relative] [subcontext(0),subcontext_size(DomainNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *DomainName;
+ [value(Workstation ? strlen(Workstation) : 0)] uint16 WorkstationLen;
+ [value(WorkstationLen)] uint16 WorkstationMaxLen;
+ [relative] [subcontext(0),subcontext_size(WorkstationLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *Workstation;
+ [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version;
+ } NEGOTIATE_MESSAGE;
+
+ typedef enum {
+ MsvAvEOL = 0,
+ MsvAvNbComputerName = 1,
+ MsvAvNbDomainName = 2,
+ MsvAvDnsComputerName = 3,
+ MsvAvDnsDomainName = 4,
+ MsvAvDnsTreeName = 5,
+ MsvAvFlags = 6,
+ MsvAvTimestamp = 7,
+ MsvAvSingleHost = 8,
+ MsvAvTargetName = 9,
+ MsvChannelBindings = 10
+ } ntlmssp_AvId;
+
+ /* [MS-NLMP] 2.2.2.2 SingleHostData */
+
+ typedef [flag(NDR_PAHEX)] struct {
+ [value(8+ndr_size_LSAP_TOKEN_INFO_INTEGRITY(&r->token_info, 0)+r->remaining.length)] uint32 Size;
+ [value(0)] uint32 Z4;
+ LSAP_TOKEN_INFO_INTEGRITY token_info;
+ [flag(NDR_REMAINING)] DATA_BLOB remaining;
+ } ntlmssp_SingleHostData;
+
+ typedef [bitmap32bit] bitmap {
+ NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT = 0x00000001,
+ NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE = 0x00000002,
+ NTLMSSP_AVFLAG_TARGET_SPN_FROM_UNTRUSTED_SOURCE = 0x00000004
+ } ntlmssp_AvFlags;
+
+ typedef [gensize,nodiscriminant,flag(NDR_NOALIGN)] union {
+ [case(MsvAvEOL)] ;
+ [case(MsvAvNbComputerName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvNbComputerName;
+ [case(MsvAvNbDomainName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvNbDomainName;
+ [case(MsvAvDnsComputerName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsComputerName;
+ [case(MsvAvDnsDomainName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsDomainName;
+ [case(MsvAvDnsTreeName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsTreeName;
+ [case(MsvAvFlags)] ntlmssp_AvFlags AvFlags;
+ [case(MsvAvTimestamp)] NTTIME AvTimestamp;
+ [case(MsvAvSingleHost)] ntlmssp_SingleHostData AvSingleHost;
+ [case(MsvAvTargetName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvTargetName;
+ [case(MsvChannelBindings)] uint8 ChannelBindings[16];
+ [default] [flag(NDR_REMAINING)] DATA_BLOB blob;
+ } ntlmssp_AvValue;
+
+ /* [MS-NLMP] 2.2.2.1 AV_PAIR */
+
+ typedef [public,flag(NDR_NOALIGN)] struct {
+ ntlmssp_AvId AvId;
+ [value(ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, 0))] uint16 AvLen;
+ [subcontext(0),subcontext_size(AvLen),switch_is(AvId)] ntlmssp_AvValue Value;
+ } AV_PAIR;
+
+ typedef [public,gensize,nopush,nopull,flag(NDR_NOALIGN)] struct {
+ uint32 count;
+ AV_PAIR pair[count];
+ } AV_PAIR_LIST;
+
+ /* [MS-NLMP] 2.2.1.2 CHALLENGE_MESSAGE */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ [charset(DOS),value("NTLMSSP")] uint8 Signature[8];
+ [value(NtLmChallenge)] ntlmssp_MessageType MessageType;
+ [value(ndr_ntlmssp_string_length(NegotiateFlags, TargetName))] uint16 TargetNameLen;
+ [value(TargetNameLen)] uint16 TargetNameMaxLen;
+ [relative] [subcontext(0),subcontext_size(TargetNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *TargetName;
+ NEGOTIATE NegotiateFlags;
+ uint8 ServerChallenge[8];
+ uint8 Reserved[8];
+ [value(ndr_size_AV_PAIR_LIST(TargetInfo, ndr->flags))] uint16 TargetInfoLen;
+ [value(TargetInfoLen)] uint16 TargetInfoMaxLen;
+ [relative] [subcontext(0),subcontext_size(TargetInfoLen)] AV_PAIR_LIST *TargetInfo;
+ [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version;
+ } CHALLENGE_MESSAGE;
+
+ /* [MS-NLMP] 2.2.2.3 LM_RESPONSE */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ uint8 Response[24];
+ } LM_RESPONSE;
+
+ /* [MS-NLMP] 2.2.2.4 LMv2_RESPONSE */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ uint8 Response[16];
+ uint8 ChallengeFromClient[8];
+ } LMv2_RESPONSE;
+
+ typedef [nodiscriminant] union {
+ [case(24)] LM_RESPONSE v1;
+ [default];
+ } ntlmssp_LM_RESPONSE_with_len;
+
+ /* [MS-NLMP] 2.2.2.6 NTLM_RESPONSE */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ uint8 Response[24];
+ } NTLM_RESPONSE;
+
+ /* [MS-NLMP] 2.2.2.7 NTLMv2_CLIENT_CHALLENGE */
+
+ typedef [flag(NDR_PAHEX)] struct {
+ [value(1)] uint8 RespType;
+ [value(1)] uint8 HiRespType;
+ uint16 Reserved1;
+ uint32 Reserved2;
+ NTTIME TimeStamp;
+ uint8 ChallengeFromClient[8];
+ uint32 Reserved3;
+ [subcontext(0)] [flag(NDR_REMAINING)] AV_PAIR_LIST AvPairs;
+ } NTLMv2_CLIENT_CHALLENGE;
+
+ /* [MS-NLMP] 2.2.2.8 NTLMv2_RESPONSE */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ uint8 Response[16];
+ NTLMv2_CLIENT_CHALLENGE Challenge;
+ } NTLMv2_RESPONSE;
+
+ typedef [public,nodiscriminant] union {
+ [case(0)] ;
+ [case(0x18)] NTLM_RESPONSE v1;
+ [default] NTLMv2_RESPONSE v2;
+ } ntlmssp_NTLM_RESPONSE_with_len;
+
+ const int NTLMSSP_MIC_OFFSET = 72;
+ const int NTLMSSP_MIC_SIZE = 16;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint8 MIC[NTLMSSP_MIC_SIZE];
+ } ntlmssp_MIC;
+
+ /* [MS-NLMP] 2.2.1.3 AUTHENTICATE_MESSAGE */
+
+ typedef [public,flag(NDR_REMAINING)] struct {
+ [charset(DOS),value("NTLMSSP")] uint8 Signature[8];
+ [value(NtLmAuthenticate)] ntlmssp_MessageType MessageType;
+ uint16 LmChallengeResponseLen;
+ [value(LmChallengeResponseLen)] uint16 LmChallengeResponseMaxLen;
+ [relative] [subcontext(0),subcontext_size(LmChallengeResponseLen),switch_is(LmChallengeResponseLen)] ntlmssp_LM_RESPONSE_with_len *LmChallengeResponse;
+ uint16 NtChallengeResponseLen;
+ [value(NtChallengeResponseLen)] uint16 NtChallengeResponseMaxLen;
+ [relative] [subcontext(0),subcontext_size(NtChallengeResponseMaxLen),switch_is(NtChallengeResponseLen)] ntlmssp_NTLM_RESPONSE_with_len *NtChallengeResponse;
+ [value(ndr_ntlmssp_string_length(NegotiateFlags, DomainName))] uint16 DomainNameLen;
+ [value(DomainNameLen)] uint16 DomainNameMaxLen;
+ [relative] [subcontext(0),subcontext_size(DomainNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *DomainName;
+ [value(ndr_ntlmssp_string_length(NegotiateFlags, UserName))] uint16 UserNameLen;
+ [value(UserNameLen)] uint16 UserNameMaxLen;
+ [relative] [subcontext(0),subcontext_size(UserNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *UserName;
+ [value(ndr_ntlmssp_string_length(NegotiateFlags, Workstation))] uint16 WorkstationLen;
+ [value(WorkstationLen)] uint16 WorkstationMaxLen;
+ [relative] [subcontext(0),subcontext_size(WorkstationLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *Workstation;
+ [value(EncryptedRandomSessionKey == NULL ? 0 : EncryptedRandomSessionKey->length)] uint16 EncryptedRandomSessionKeyLen;
+ [value(EncryptedRandomSessionKeyLen)] uint16 EncryptedRandomSessionKeyMaxLen;
+ [relative] [subcontext(0),subcontext_size(EncryptedRandomSessionKeyLen)] DATA_BLOB *EncryptedRandomSessionKey;
+ NEGOTIATE NegotiateFlags;
+ [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version;
+ /* MIC (Message Integrity) is only included when the client has
+ * sent a timestap Av struct in the CHALLENGE_MESSAGE AvPair */
+ /* [flag(NDR_REMAINING)] ntlmssp_MIC mic; */
+ } AUTHENTICATE_MESSAGE;
+
+ /* NTLMSSP signature version */
+ const int NTLMSSP_SIGN_VERSION = 0x01;
+
+ /* NTLMSSP signature size */
+ const int NTLMSSP_SIG_SIZE = 16;
+
+ /* [MS-NLMP] 2.2.2.9.1 NTLMSSP_MESSAGE_SIGNATURE */
+
+ typedef [public] struct {
+ [value(NTLMSSP_SIGN_VERSION)] uint32 Version;
+ uint32 RandomPad;
+ uint32 Checksum;
+ uint32 SeqNum;
+ } NTLMSSP_MESSAGE_SIGNATURE;
+
+ /* [MS-NLMP] 2.2.2.9.2 NTLMSSP_MESSAGE_SIGNATURE for Extended Session Security */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ [value(NTLMSSP_SIGN_VERSION)] uint32 Version;
+ uint8 Checksum[8];
+ uint32 SeqNum;
+ } NTLMSSP_MESSAGE_SIGNATURE_NTLMv2;
+
+}
diff --git a/librpc/idl/ntprinting.idl b/librpc/idl/ntprinting.idl
new file mode 100644
index 0000000..cfb1922
--- /dev/null
+++ b/librpc/idl/ntprinting.idl
@@ -0,0 +1,156 @@
+#include "idl_types.h"
+
+/*
+ old s3 spoolss tdb on-disc interface definitions
+*/
+
+[
+ pointer_default(unique),
+ helpstring("s3 printing tdb formats"),
+ uuid("a025d3cb-c605-40d6-86e1-4cff18e7dd94"),
+ helper("../librpc/ndr/ndr_ntprinting.h")
+]
+interface ntprinting
+{
+ /* Samba 3 tdb storage format: forms
+ * "dddddddd" */
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ uint32 position;
+ uint32 flag;
+ uint32 width;
+ uint32 length;
+ uint32 left;
+ uint32 top;
+ uint32 right;
+ uint32 bottom;
+ } ntprinting_form;
+
+ /*
+ * First the string flags and then the Samba 3 tdb storage
+ * format: drivers
+ * "dffffffff" followed by a remaining buffer of "f" array */
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ [skip_noinit] uint32 string_flags;
+
+ uint32 version;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string name;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string environment;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string driverpath;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string datafile;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string configfile;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string helpfile;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string monitorname;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string defaultdatatype;
+ [flag((ndr_ntprinting_string_flags(r->string_flags)&~STR_NULLTERM)|STR_NOTERM|NDR_REMAINING)] string_array dependent_files;
+ } ntprinting_driver;
+
+ /* Samba 3 tdb storage format: devicemode
+ * "p" ptr to devicemode
+ * "ffwwwwwwwwwwwwwwwwwwdddddddddddddd"
+ * "p" ptr to devicemode private data
+ * "B" private data blob */
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ [skip_noinit] uint32 string_flags;
+
+ /* uint32 devicemode_ptr; */
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string devicename;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string formname;
+ uint16 specversion;
+ uint16 driverversion;
+ uint16 size;
+ uint16 driverextra;
+ uint16 orientation;
+ uint16 papersize;
+ uint16 paperlength;
+ uint16 paperwidth;
+ uint16 scale;
+ uint16 copies;
+ uint16 defaultsource;
+ uint16 printquality;
+ uint16 color;
+ uint16 duplex;
+ uint16 yresolution;
+ uint16 ttoption;
+ uint16 collate;
+ uint16 logpixels;
+ uint32 fields;
+ uint32 bitsperpel;
+ uint32 pelswidth;
+ uint32 pelsheight;
+ uint32 displayflags;
+ uint32 displayfrequency;
+ uint32 icmmethod;
+ uint32 icmintent;
+ uint32 mediatype;
+ uint32 dithertype;
+ uint32 reserved1;
+ uint32 reserved2;
+ uint32 panningwidth;
+ uint32 panningheight;
+ DATA_BLOB *nt_dev_private;
+ } ntprinting_devicemode;
+
+ /*
+ * First the string flags and then the Samba 3 tdb storage
+ * format: printer_data
+ * "p" ptr to printer_data
+ * "fdB" */
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ [skip_noinit] uint32 string_flags;
+
+ uint32 ptr;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string name;
+ uint32 type;
+ DATA_BLOB data;
+ } ntprinting_printer_data;
+
+ /*
+ * First the string flags and then the Samba 3 tdb storage
+ * format: printer_info
+ * "dddddddddddfffffPfffff"
+ */
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ [skip_noinit] uint32 string_flags;
+
+ uint32 attributes;
+ uint32 priority;
+ uint32 default_priority;
+ uint32 starttime;
+ uint32 untiltime;
+ uint32 status;
+ uint32 cjobs;
+ uint32 averageppm;
+ uint32 changeid;
+ uint32 c_setprinter;
+ uint32 setuptime;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string servername;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string printername;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string sharename;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string portname;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string drivername;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string comment;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string location;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string sepfile;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string printprocessor;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string datatype;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string parameters;
+ } ntprinting_printer_info;
+
+ /* Abstract Samba 3 printer
+ * printer_info
+ * followed by ntprinting_devicemode
+ * followed by remaining buffer of ntprinting_printer_data array */
+
+ typedef [flag(NDR_NOALIGN),public,nopull] struct {
+ ntprinting_printer_info info;
+ ntprinting_devicemode *devmode;
+ uint32 count;
+ ntprinting_printer_data printer_data[count];
+ } ntprinting_printer;
+
+}
diff --git a/librpc/idl/ntsvcs.idl b/librpc/idl/ntsvcs.idl
new file mode 100644
index 0000000..91a85b9
--- /dev/null
+++ b/librpc/idl/ntsvcs.idl
@@ -0,0 +1,399 @@
+/*
+ plug and play services
+*/
+
+import "misc.idl";
+
+[
+ uuid("8d9f4e40-a03d-11ce-8f69-08003e30051b"),
+ version(1.0),
+ endpoint("ncacn_np:[\\pipe\\ntsvcs]","ncacn_np:[\\pipe\\plugplay]"),
+ helpstring("Plug and Play services")
+]
+interface ntsvcs
+{
+ /******************/
+ /* Function: 0x00 */
+
+ [todo] WERROR PNP_Disconnect();
+
+ /******************/
+ /* Function: 0x01 */
+
+ [todo] WERROR PNP_Connect();
+
+ /******************/
+ /* Function: 0x02 */
+
+ WERROR PNP_GetVersion(
+ [out,ref] uint16 *version
+ );
+
+ /******************/
+ /* Function: 0x03 */
+
+ [todo] WERROR PNP_GetGlobalState();
+
+ /******************/
+ /* Function: 0x04 */
+
+ [todo] WERROR PNP_InitDetection();
+
+ /******************/
+ /* Function: 0x05 */
+
+ [todo] WERROR PNP_ReportLogOn();
+
+ /******************/
+ /* Function: 0x06 */
+
+ WERROR PNP_ValidateDeviceInstance(
+ [in,ref] [string,charset(UTF16)] uint16 *devicepath,
+ [in] uint32 flags
+ );
+
+ /******************/
+ /* Function: 0x07 */
+
+ [todo] WERROR PNP_GetRootDeviceInstance();
+
+ /******************/
+ /* Function: 0x08 */
+
+ [todo] WERROR PNP_GetRelatedDeviceInstance();
+
+ /******************/
+ /* Function: 0x09 */
+
+ [todo] WERROR PNP_EnumerateSubKeys();
+
+ /******************/
+ /* Function: 0x0a */
+
+ const int CM_GETIDLIST_FILTER_NONE = 0x00000000;
+
+ typedef [bitmap32bit] bitmap {
+ CM_GETIDLIST_FILTER_ENUMERATOR = 0x00000001,
+ CM_GETIDLIST_FILTER_SERVICE = 0x00000002,
+ CM_GETIDLIST_FILTER_EJECTRELATIONS = 0x00000004,
+ CM_GETIDLIST_FILTER_REMOVALRELATIONS = 0x00000008,
+ CM_GETIDLIST_FILTER_POWERRELATIONS = 0x00000010,
+ CM_GETIDLIST_FILTER_BUSRELATIONS = 0x00000020,
+ CM_GETIDLIST_DONOTGENERATE = 0x10000040,
+ CM_GETIDLIST_FILTER_TRANSPORTRELATIONS = 0x00000080,
+ CM_GETIDLIST_FILTER_PRESENT = 0x00000100,
+ CM_GETIDLIST_FILTER_CLASS = 0x00000200
+ } PNP_GetIdListFlags;
+
+ WERROR PNP_GetDeviceList(
+ [in,unique] [string,charset(UTF16)] uint16 *filter,
+ [out,ref] [size_is(*length),length_is(*length)] uint16 *buffer,
+ [in,out,ref] uint32 *length,
+ [in] PNP_GetIdListFlags flags
+ );
+
+ /******************/
+ /* Function: 0x0b */
+
+ WERROR PNP_GetDeviceListSize(
+ [in,unique] [string,charset(UTF16)] uint16 *devicename,
+ [out,ref] uint32 *size,
+ [in] PNP_GetIdListFlags flags
+ );
+
+ /******************/
+ /* Function: 0x0c */
+
+ [todo] WERROR PNP_GetDepth();
+
+ /******************/
+ /* Function: 0x0d */
+
+ const int DEV_REGPROP_DESC = 1;
+
+ WERROR PNP_GetDeviceRegProp(
+ [in,ref] [string,charset(UTF16)] uint16 *devicepath,
+ [in] uint32 property,
+ [in,out,ref] winreg_Type *reg_data_type,
+ [out,ref] [size_is(*buffer_size)] [length_is(*buffer_size)] uint8 *buffer,
+ [in,out,ref] uint32 *buffer_size,
+ [in,out,ref] uint32 *needed,
+ [in] uint32 flags
+ );
+
+ /******************/
+ /* Function: 0x0e */
+
+ [todo] WERROR PNP_SetDeviceRegProp();
+
+ /******************/
+ /* Function: 0x0f */
+
+ [todo] WERROR PNP_GetClassInstance();
+
+ /******************/
+ /* Function: 0x10 */
+
+ [todo] WERROR PNP_CreateKey();
+
+ /******************/
+ /* Function: 0x11 */
+
+ [todo] WERROR PNP_DeleteRegistryKey();
+
+ /******************/
+ /* Function: 0x12 */
+
+ [todo] WERROR PNP_GetClassCount();
+
+ /******************/
+ /* Function: 0x13 */
+
+ [todo] WERROR PNP_GetClassName();
+
+ /******************/
+ /* Function: 0x14 */
+
+ [todo] WERROR PNP_DeleteClassKey();
+
+ /******************/
+ /* Function: 0x15 */
+
+ [todo] WERROR PNP_GetInterfaceDeviceAlias();
+
+ /******************/
+ /* Function: 0x16 */
+
+ [todo] WERROR PNP_GetInterfaceDeviceList();
+
+ /******************/
+ /* Function: 0x17 */
+
+ [todo] WERROR PNP_GetInterfaceDeviceListSize();
+
+ /******************/
+ /* Function: 0x18 */
+
+ [todo] WERROR PNP_RegisterDeviceClassAssociation();
+
+ /******************/
+ /* Function: 0x19 */
+
+ [todo] WERROR PNP_UnregisterDeviceClassAssociation();
+
+ /******************/
+ /* Function: 0x1a */
+
+ [todo] WERROR PNP_GetClassRegProp();
+
+ /******************/
+ /* Function: 0x1b */
+
+ [todo] WERROR PNP_SetClassRegProp();
+
+ /******************/
+ /* Function: 0x1c */
+
+ [todo] WERROR PNP_CreateDevInst();
+
+ /******************/
+ /* Function: 0x1d */
+
+ [todo] WERROR PNP_DeviceInstanceAction();
+
+ /******************/
+ /* Function: 0x1e */
+
+ [todo] WERROR PNP_GetDeviceStatus();
+
+ /******************/
+ /* Function: 0x1f */
+
+ [todo] WERROR PNP_SetDeviceProblem();
+
+ /******************/
+ /* Function: 0x20 */
+
+ [todo] WERROR PNP_DisableDevInst();
+
+ /******************/
+ /* Function: 0x21 */
+
+ [todo] WERROR PNP_UninstallDevInst();
+
+ /******************/
+ /* Function: 0x22 */
+
+ [todo] WERROR PNP_AddID();
+
+ /******************/
+ /* Function: 0x23 */
+
+ [todo] WERROR PNP_RegisterDriver();
+
+ /******************/
+ /* Function: 0x24 */
+
+ [todo] WERROR PNP_QueryRemove();
+
+ /******************/
+ /* Function: 0x25 */
+
+ [todo] WERROR PNP_RequestDeviceEject();
+
+ /******************/
+ /* Function: 0x26 */
+
+ [todo] WERROR PNP_IsDockStationPresent();
+
+ /******************/
+ /* Function: 0x27 */
+
+ [todo] WERROR PNP_RequestEjectPC();
+
+ /******************/
+ /* Function: 0x28 */
+
+ WERROR PNP_HwProfFlags(
+ [in] uint32 action,
+ [in,ref] [string,charset(UTF16)] uint16 *devicepath,
+ [in] uint32 config,
+ [in,out,ref] uint32 *profile_flags,
+ [in,out,unique] uint16 *veto_type,
+ [in,unique] [string,charset(UTF16)] uint16 *unknown5,
+ [out,unique] [string,charset(UTF16)] uint16 **unknown5a,
+ [in] uint32 name_length,
+ [in] uint32 flags
+ );
+
+ /******************/
+ /* Function: 0x29 */
+
+ typedef struct {
+ uint32 profile_handle;
+ uint16 friendly_name[80];
+ uint32 flags;
+ } PNP_HwProfInfo;
+
+ WERROR PNP_GetHwProfInfo(
+ [in] uint32 idx,
+ [in,out,ref] PNP_HwProfInfo *info,
+ [in] uint32 size,
+ [in] uint32 flags
+ );
+
+ /******************/
+ /* Function: 0x2a */
+
+ [todo] WERROR PNP_AddEmptyLogConf();
+
+ /******************/
+ /* Function: 0x2b */
+
+ [todo] WERROR PNP_FreeLogConf();
+
+ /******************/
+ /* Function: 0x2c */
+
+ [todo] WERROR PNP_GetFirstLogConf();
+
+ /******************/
+ /* Function: 0x2d */
+
+ [todo] WERROR PNP_GetNextLogConf();
+
+ /******************/
+ /* Function: 0x2e */
+
+ [todo] WERROR PNP_GetLogConfPriority();
+
+ /******************/
+ /* Function: 0x2f */
+
+ [todo] WERROR PNP_AddResDes();
+
+ /******************/
+ /* Function: 0x30 */
+
+ [todo] WERROR PNP_FreeResDes();
+
+ /******************/
+ /* Function: 0x31 */
+
+ [todo] WERROR PNP_GetNextResDes();
+
+ /******************/
+ /* Function: 0x32 */
+
+ [todo] WERROR PNP_GetResDesData();
+
+ /******************/
+ /* Function: 0x33 */
+
+ [todo] WERROR PNP_GetResDesDataSize();
+
+ /******************/
+ /* Function: 0x34 */
+
+ [todo] WERROR PNP_ModifyResDes();
+
+ /******************/
+ /* Function: 0x35 */
+
+ [todo] WERROR PNP_DetectResourceLimit();
+
+ /******************/
+ /* Function: 0x36 */
+
+ [todo] WERROR PNP_QueryResConfList();
+
+ /******************/
+ /* Function: 0x37 */
+
+ [todo] WERROR PNP_SetHwProf();
+
+ /******************/
+ /* Function: 0x38 */
+
+ [todo] WERROR PNP_QueryArbitratorFreeData();
+
+ /******************/
+ /* Function: 0x39 */
+
+ [todo] WERROR PNP_QueryArbitratorFreeSize();
+
+ /******************/
+ /* Function: 0x3a */
+
+ [todo] WERROR PNP_RunDetection();
+
+ /******************/
+ /* Function: 0x3b */
+
+ [todo] WERROR PNP_RegisterNotification();
+
+ /******************/
+ /* Function: 0x3c */
+
+ [todo] WERROR PNP_UnregisterNotification();
+
+ /******************/
+ /* Function: 0x3d */
+
+ [todo] WERROR PNP_GetCustomDevProp();
+
+ /******************/
+ /* Function: 0x3e */
+
+ [todo] WERROR PNP_GetVersionInternal();
+
+ /******************/
+ /* Function: 0x3f */
+
+ [todo] WERROR PNP_GetBlockedDriverInfo();
+
+ /******************/
+ /* Function: 0x40 */
+
+ [todo] WERROR PNP_GetServerSideDeviceInstallFlags();
+}
diff --git a/librpc/idl/orpc.idl b/librpc/idl/orpc.idl
new file mode 100644
index 0000000..34a35e2
--- /dev/null
+++ b/librpc/idl/orpc.idl
@@ -0,0 +1,230 @@
+#include "idl_types.h"
+
+/**
+ DCOM interfaces
+ http://www.ietf.org/internet-drafts/draft-brown-dcom-v1-spec-04.txt
+ */
+
+import "misc.idl";
+
+[
+ 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. */
+ [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 */
+ 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;
+}
diff --git a/librpc/idl/oxidresolver.idl b/librpc/idl/oxidresolver.idl
new file mode 100644
index 0000000..07700d5
--- /dev/null
+++ b/librpc/idl/oxidresolver.idl
@@ -0,0 +1,96 @@
+/**
+ 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 "misc.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,ref] uint8 *pReserved
+ );
+}
diff --git a/librpc/idl/policyagent.idl b/librpc/idl/policyagent.idl
new file mode 100644
index 0000000..ab137fa
--- /dev/null
+++ b/librpc/idl/policyagent.idl
@@ -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 */
+ [todo] WERROR policyagent_Dummy();
+}
diff --git a/librpc/idl/preg.idl b/librpc/idl/preg.idl
new file mode 100644
index 0000000..c3adb50
--- /dev/null
+++ b/librpc/idl/preg.idl
@@ -0,0 +1,44 @@
+#include "idl_types.h"
+
+import "misc.idl";
+
+/*
+ IDL structures defining PReg files
+
+ more info can be found at:
+ http://msdn2.microsoft.com/en-us/library/aa374407.aspx
+*/
+
+[
+ pointer_default(unique),
+ helper("../librpc/ndr/ndr_preg.h"),
+ helpstring("PReg structure"),
+ uuid("67655250-0000-0000-0000-00000000")
+]
+ interface preg
+{
+ typedef [public,flag(NDR_PAHEX)] struct {
+ [charset(DOS),value("["),noprint] uint8 _opening_bracket[2];
+ nstring keyname;
+ [charset(DOS),value(";"),noprint] uint8 _sep1[2];
+ nstring valuename;
+ [charset(DOS),value(";"),noprint] uint8 _sep2[2];
+ winreg_Type type;
+ [charset(DOS),value(";"),noprint] uint8 _sep3[2];
+ [value(ndr_size_winreg_Data_GPO(&data,type,ndr->flags))] uint32 size;
+ [charset(DOS),value(";"),noprint] uint8 _sep4[2];
+ [subcontext(0),subcontext_size(size),flag(NDR_REMAINING), switch_is(type)] winreg_Data_GPO data;
+ [charset(DOS),value("]"),noprint] uint8 _closing_bracket[2];
+ } preg_entry;
+
+ typedef [public] struct {
+ [charset(DOS),value("PReg")] uint8 signature[4];
+ [value(1)] uint32 version;
+ } preg_header;
+
+ typedef [public,flag(NDR_NOALIGN),nopush,nopull] struct {
+ preg_header header;
+ uint32 num_entries;
+ preg_entry entries[num_entries];
+ } preg_file;
+}
diff --git a/librpc/idl/printcap.idl b/librpc/idl/printcap.idl
new file mode 100644
index 0000000..d9c34f3
--- /dev/null
+++ b/librpc/idl/printcap.idl
@@ -0,0 +1,18 @@
+#include "idl_types.h"
+[
+ pointer_default(unique)
+]
+interface printcap
+{
+ typedef struct {
+ [charset(UTF8),string] uint8 *name;
+ [charset(UTF8),string] uint8 *info;
+ [charset(UTF8),string] uint8 *location;
+ } pcap_printer;
+
+ typedef [public] struct {
+ NTSTATUS status;
+ uint32 count;
+ [size_is(count)] pcap_printer printers[];
+ } pcap_data;
+}
diff --git a/librpc/idl/quota.idl b/librpc/idl/quota.idl
new file mode 100644
index 0000000..8d713c8
--- /dev/null
+++ b/librpc/idl/quota.idl
@@ -0,0 +1,54 @@
+#include "idl_types.h"
+
+import "security.idl";
+
+[
+ pointer_default(unique)
+]
+
+interface file_quota {
+
+ /* MS-FSCC 2.4.33.1 */
+ typedef [public] struct {
+ uint32 next_entry_offset;
+ uint32 sid_length;
+ dom_sid sid;
+ } file_get_quota_info;
+
+ /* MS-FSCC 2.4.33 */
+ typedef [public] struct {
+ uint32 next_entry_offset;
+ uint32 sid_length;
+ hyper change_time;
+ hyper quota_used;
+ hyper quota_threshold;
+ hyper quota_limit;
+ dom_sid sid;
+ } file_quota_information;
+}
+
+interface smb2_query_quota
+{
+ /* MS-SMB2 2.2.37.1 */
+ typedef [public] struct {
+ uint8 return_single;
+ uint8 restart_scan;
+ uint16 reserved;
+ uint32 sid_list_length;
+ uint32 start_sid_length;
+ uint32 start_sid_offset;
+ } smb2_query_quota_info;
+}
+
+interface smb1_nt_transact_query_quota
+{
+ /* MS-SMB 2.2.7.5.1 */
+ typedef [public] struct {
+ uint16 fid;
+ uint8 return_single_entry;
+ uint8 restart_scan;
+ uint32 sid_list_length;
+ uint32 start_sid_length;
+ uint32 start_sid_offset;
+ } nttrans_query_quota_params;
+}
diff --git a/librpc/idl/rap.idl b/librpc/idl/rap.idl
new file mode 100644
index 0000000..780951c
--- /dev/null
+++ b/librpc/idl/rap.idl
@@ -0,0 +1,1076 @@
+#include "idl_types.h"
+
+/*
+ rap interface definition
+*/
+
+[
+ pointer_default(unique),
+ helper("../librpc/ndr/ndr_rap.h")
+]
+interface rap
+{
+ typedef [public,noprint] enum {
+ NERR_Success = 0
+ } rap_status;
+
+ const int RAP_WshareEnum = 0;
+ const int RAP_WshareGetInfo = 1;
+ const int RAP_WshareSetInfo = 2;
+ const int RAP_WshareAdd = 3;
+ const int RAP_WshareDel = 4;
+ const int RAP_NetShareCheck = 5;
+ const int RAP_WsessionEnum = 6;
+ const int RAP_WsessionGetInfo = 7;
+ const int RAP_WsessionDel = 8;
+ const int RAP_WconnectionEnum = 9;
+ const int RAP_WfileEnum = 10;
+ const int RAP_WfileGetInfo = 11;
+ const int RAP_WfileClose = 12;
+ const int RAP_WserverGetInfo = 13;
+ const int RAP_WserverSetInfo = 14;
+ const int RAP_WserverDiskEnum = 15;
+ const int RAP_WserverAdminCommand = 16;
+ const int RAP_NetAuditOpen = 17;
+ const int RAP_WauditClear = 18;
+ const int RAP_NetErrorLogOpen = 19;
+ const int RAP_WerrorLogClear = 20;
+ const int RAP_NetCharDevEnum = 21;
+ const int RAP_NetCharDevGetInfo = 22;
+ const int RAP_WCharDevControl = 23;
+ const int RAP_NetCharDevQEnum = 24;
+ const int RAP_NetCharDevQGetInfo = 25;
+ const int RAP_WCharDevQSetInfo = 26;
+ const int RAP_WCharDevQPurge = 27;
+ const int RAP_WCharDevQPurgeSelf = 28;
+ const int RAP_WMessageNameEnum = 29;
+ const int RAP_WMessageNameGetInfo = 30;
+ const int RAP_WMessageNameAdd = 31;
+ const int RAP_WMessageNameDel = 32;
+ const int RAP_WMessageNameFwd = 33;
+ const int RAP_WMessageNameUnFwd = 34;
+ const int RAP_WMessageBufferSend = 35;
+ const int RAP_WMessageFileSend = 36;
+ const int RAP_WMessageLogFileSet = 37;
+ const int RAP_WMessageLogFileGet = 38;
+ const int RAP_WServiceEnum = 39;
+ const int RAP_WServiceInstall = 40;
+ const int RAP_WServiceControl = 41;
+ const int RAP_WAccessEnum = 42;
+ const int RAP_WAccessGetInfo = 43;
+ const int RAP_WAccessSetInfo = 44;
+ const int RAP_WAccessAdd = 45;
+ const int RAP_WAccessDel = 46;
+ const int RAP_WGroupEnum = 47;
+ const int RAP_WGroupAdd = 48;
+ const int RAP_WGroupDel = 49;
+ const int RAP_WGroupAddUser = 50;
+ const int RAP_WGroupDelUser = 51;
+ const int RAP_WGroupGetUsers = 52;
+ const int RAP_WUserEnum = 53;
+ const int RAP_WUserAdd = 54;
+ const int RAP_WUserDel = 55;
+ const int RAP_WUserGetInfo = 56;
+ const int RAP_WUserSetInfo = 57;
+ const int RAP_WUserPasswordSet = 58;
+ const int RAP_WUserGetGroups = 59;
+ const int RAP_WWkstaSetUID = 62;
+ const int RAP_WWkstaGetInfo = 63;
+ const int RAP_WWkstaSetInfo = 64;
+ const int RAP_WUseEnum = 65;
+ const int RAP_WUseAdd = 66;
+ const int RAP_WUseDel = 67;
+ const int RAP_WUseGetInfo = 68;
+ const int RAP_WPrintQEnum = 69;
+ const int RAP_WPrintQGetInfo = 70;
+ const int RAP_WPrintQSetInfo = 71;
+ const int RAP_WPrintQAdd = 72;
+ const int RAP_WPrintQDel = 73;
+ const int RAP_WPrintQPause = 74;
+ const int RAP_WPrintQContinue = 75;
+ const int RAP_WPrintJobEnum = 76;
+ const int RAP_WPrintJobGetInfo = 77;
+ const int RAP_WPrintJobSetInfo_OLD = 78;
+ const int RAP_WPrintJobDel = 81;
+ const int RAP_WPrintJobPause = 82;
+ const int RAP_WPrintJobContinue = 83;
+ const int RAP_WPrintDestEnum = 84;
+ const int RAP_WPrintDestGetInfo = 85;
+ const int RAP_WPrintDestControl = 86;
+ const int RAP_WProfileSave = 87;
+ const int RAP_WProfileLoad = 88;
+ const int RAP_WStatisticsGet = 89;
+ const int RAP_WStatisticsClear = 90;
+ const int RAP_NetRemoteTOD = 91;
+ const int RAP_WNetBiosEnum = 92;
+ const int RAP_WNetBiosGetInfo = 93;
+ const int RAP_NetServerEnum = 94;
+ const int RAP_I_NetServerEnum = 95;
+ const int RAP_WServiceGetInfo = 96;
+ const int RAP_WPrintQPurge = 103;
+ const int RAP_NetServerEnum2 = 104;
+ const int RAP_WAccessGetUserPerms = 105;
+ const int RAP_WGroupGetInfo = 106;
+ const int RAP_WGroupSetInfo = 107;
+ const int RAP_WGroupSetUsers = 108;
+ const int RAP_WUserSetGroups = 109;
+ const int RAP_WUserModalsGet = 110;
+ const int RAP_WUserModalsSet = 111;
+ const int RAP_WFileEnum2 = 112;
+ const int RAP_WUserAdd2 = 113;
+ const int RAP_WUserSetInfo2 = 114;
+ const int RAP_WUserPasswordSet2 = 115;
+ const int RAP_I_NetServerEnum2 = 116;
+ const int RAP_WConfigGet2 = 117;
+ const int RAP_WConfigGetAll2 = 118;
+ const int RAP_WGetDCName = 119;
+ const int RAP_NetHandleGetInfo = 120;
+ const int RAP_NetHandleSetInfo = 121;
+ const int RAP_WStatisticsGet2 = 122;
+ const int RAP_WBuildGetInfo = 123;
+ const int RAP_WFileGetInfo2 = 124;
+ const int RAP_WFileClose2 = 125;
+ const int RAP_WNetServerReqChallenge = 126;
+ const int RAP_WNetServerAuthenticate = 127;
+ const int RAP_WNetServerPasswordSet = 128;
+ const int RAP_WNetAccountDeltas = 129;
+ const int RAP_WNetAccountSync = 130;
+ const int RAP_WUserEnum2 = 131;
+ const int RAP_WWkstaUserLogon = 132;
+ const int RAP_WWkstaUserLogoff = 133;
+ const int RAP_WLogonEnum = 134;
+ const int RAP_WErrorLogRead = 135;
+ const int RAP_NetPathType = 136;
+ const int RAP_NetPathCanonicalize = 137;
+ const int RAP_NetPathCompare = 138;
+ const int RAP_NetNameValidate = 139;
+ const int RAP_NetNameCanonicalize = 140;
+ const int RAP_NetNameCompare = 141;
+ const int RAP_WAuditRead = 142;
+ const int RAP_WPrintDestAdd = 143;
+ const int RAP_WPrintDestSetInfo = 144;
+ const int RAP_WPrintDestDel = 145;
+ const int RAP_WUserValidate2 = 146;
+ const int RAP_WPrintJobSetInfo = 147;
+ const int RAP_TI_NetServerDiskEnum = 148;
+ const int RAP_TI_NetServerDiskGetInfo = 149;
+ const int RAP_TI_FTVerifyMirror = 150;
+ const int RAP_TI_FTAbortVerify = 151;
+ const int RAP_TI_FTGetInfo = 152;
+ const int RAP_TI_FTSetInfo = 153;
+ const int RAP_TI_FTLockDisk = 154;
+ const int RAP_TI_FTFixError = 155;
+ const int RAP_TI_FTAbortFix = 156;
+ const int RAP_TI_FTDiagnoseError = 157;
+ const int RAP_TI_FTGetDriveStats = 158;
+ const int RAP_TI_FTErrorGetInfo = 160;
+ const int RAP_NetAccessCheck = 163;
+ const int RAP_NetAlertRaise = 164;
+ const int RAP_NetAlertStart = 165;
+ const int RAP_NetAlertStop = 166;
+ const int RAP_NetAuditWrite = 167;
+ const int RAP_NetIRemoteAPI = 168;
+ const int RAP_NetServiceStatus = 169;
+ const int RAP_NetServerRegister = 170;
+ const int RAP_NetServerDeregister = 171;
+ const int RAP_NetSessionEntryMake = 172;
+ const int RAP_NetSessionEntryClear = 173;
+ const int RAP_NetSessionEntryGetInfo = 174;
+ const int RAP_NetSessionEntrySetInfo = 175;
+ const int RAP_NetConnectionEntryMake = 176;
+ const int RAP_NetConnectionEntryClear = 177;
+ const int RAP_NetConnectionEntrySetInfo = 178;
+ const int RAP_NetConnectionEntryGetInfo = 179;
+ const int RAP_NetFileEntryMake = 180;
+ const int RAP_NetFileEntryClear = 181;
+ const int RAP_NetFileEntrySetInfo = 182;
+ const int RAP_NetFileEntryGetInfo = 183;
+ const int RAP_AltSrvMessageBufferSend = 184;
+ const int RAP_AltSrvMessageFileSend = 185;
+ const int RAP_wI_NetRplWkstaEnum = 186;
+ const int RAP_wI_NetRplWkstaGetInfo = 187;
+ const int RAP_wI_NetRplWkstaSetInfo = 188;
+ const int RAP_wI_NetRplWkstaAdd = 189;
+ const int RAP_wI_NetRplWkstaDel = 190;
+ const int RAP_wI_NetRplProfileEnum = 191;
+ const int RAP_wI_NetRplProfileGetInfo = 192;
+ const int RAP_wI_NetRplProfileSetInfo = 193;
+ const int RAP_wI_NetRplProfileAdd = 194;
+ const int RAP_wI_NetRplProfileDel = 195;
+ const int RAP_wI_NetRplProfileClone = 196;
+ const int RAP_wI_NetRplBaseProfileEnum = 197;
+ const int RAP_WIServerSetInfo = 201;
+ const int RAP_WPrintDriverEnum = 205;
+ const int RAP_WPrintQProcessorEnum = 206;
+ const int RAP_WPrintPortEnum = 207;
+ const int RAP_WNetWriteUpdateLog = 208;
+ const int RAP_WNetAccountUpdate = 209;
+ const int RAP_WNetAccountConfirmUpdate = 210;
+ const int RAP_WConfigSet = 211;
+ const int RAP_WAccountsReplicate = 212;
+ const int RAP_SamOEMChgPasswordUser2_P = 214;
+ const int RAP_NetServerEnum3 = 215;
+ const int RAP_WprintDriverGetInfo = 250;
+ const int RAP_WprintDriverSetInfo = 251;
+ const int RAP_WaliasAdd = 252;
+ const int RAP_WaliasDel = 253;
+ const int RAP_WaliasGetInfo = 254;
+ const int RAP_WaliasSetInfo = 255;
+ const int RAP_WaliasEnum = 256;
+ const int RAP_WuserGetLogonAsn = 257;
+ const int RAP_WuserSetLogonAsn = 258;
+ const int RAP_WuserGetAppSel = 259;
+ const int RAP_WuserSetAppSel = 260;
+ const int RAP_WappAdd = 261;
+ const int RAP_WappDel = 262;
+ const int RAP_WappGetInfo = 263;
+ const int RAP_WappSetInfo = 264;
+ const int RAP_WappEnum = 265;
+ const int RAP_WUserDCDBInit = 266;
+ const int RAP_WDASDAdd = 267;
+ const int RAP_WDASDDel = 268;
+ const int RAP_WDASDGetInfo = 269;
+ const int RAP_WDASDSetInfo = 270;
+ const int RAP_WDASDEnum = 271;
+ const int RAP_WDASDCheck = 272;
+ const int RAP_WDASDCtl = 273;
+ const int RAP_WuserRemoteLogonCheck = 274;
+ const int RAP_WUserPasswordSet3 = 275;
+ const int RAP_WCreateRIPLMachine = 276;
+ const int RAP_WDeleteRIPLMachine = 277;
+ const int RAP_WGetRIPLMachineInfo = 278;
+ const int RAP_WSetRIPLMachineInfo = 279;
+ const int RAP_WEnumRIPLMachine = 280;
+ const int RAP_I_ShareAdd = 281;
+ const int RAP_AliasEnum = 282;
+ const int RAP_WaccessApply = 283;
+ const int RAP_WPrt16Query = 284;
+ const int RAP_WPrt16Set = 285;
+ const int RAP_WUserDel100 = 286;
+ const int RAP_WUserRemoteLogonCheck2 = 287;
+ const int RAP_WRemoteTODSet = 294;
+ const int RAP_WprintJobMoveAll = 295;
+ const int RAP_W16AppParmAdd = 296;
+ const int RAP_W16AppParmDel = 297;
+ const int RAP_W16AppParmGet = 298;
+ const int RAP_W16AppParmSet = 299;
+ const int RAP_W16RIPLMachineCreate = 300;
+ const int RAP_W16RIPLMachineGetInfo = 301;
+ const int RAP_W16RIPLMachineSetInfo = 302;
+ const int RAP_W16RIPLMachineEnum = 303;
+ const int RAP_W16RIPLMachineListParmEnum = 304;
+ const int RAP_W16RIPLMachClassGetInfo = 305;
+ const int RAP_W16RIPLMachClassEnum = 306;
+ const int RAP_W16RIPLMachClassCreate = 307;
+ const int RAP_W16RIPLMachClassSetInfo = 308;
+ const int RAP_W16RIPLMachClassDelete = 309;
+ const int RAP_W16RIPLMachClassLPEnum = 310;
+ const int RAP_W16RIPLMachineDelete = 311;
+ const int RAP_W16WSLevelGetInfo = 312;
+ const int RAP_WserverNameAdd = 313;
+ const int RAP_WserverNameDel = 314;
+ const int RAP_WserverNameEnum = 315;
+ const int RAP_I_WDASDEnum = 316;
+ const int RAP_WDASDEnumTerminate = 317;
+ const int RAP_WDASDSetInfo2 = 318;
+ const int MAX_API = 318;
+
+ /* sizes of fixed-length fields, including null terminator */
+ const int RAP_GROUPNAME_LEN = 21;
+ const int RAP_USERNAME_LEN = 21;
+ const int RAP_SHARENAME_LEN = 13;
+ const int RAP_UPASSWD_LEN = 16; /* user password */
+ const int RAP_SPASSWD_LEN = 9; /* share password */
+ const int RAP_MACHNAME_LEN = 16;
+ const int RAP_SRVCNAME_LEN = 16;
+ const int RAP_SRVCCMNT_LEN = 64;
+ const int RAP_DATATYPE_LEN = 10;
+
+ typedef struct {
+ uint8 group_name[21];
+ char reserved1;
+ astring *comment;
+ } rap_group_info_1;
+
+ typedef struct {
+ uint8 user_name[21];
+ char reserved1;
+ uint8 passwrd[16];
+ uint32 pwage;
+ uint16 priv;
+ astring *home_dir;
+ astring *comment;
+ uint16 userflags;
+ astring *logon_script;
+ } rap_user_info_1;
+
+ typedef struct {
+ uint8 service_name[16];
+ uint16 status;
+ uint32 installcode;
+ uint16 process_num;
+ astring *comment;
+ } rap_service_info_2;
+
+ typedef struct {
+ uint8 share_name[13];
+ } rap_share_info_0;
+
+ typedef struct {
+ uint8 share_name[13];
+ char reserved1;
+ uint16 share_type;
+ astring *comment;
+ } rap_share_info_1;
+
+ typedef struct {
+ uint8 share_name[13];
+ char reserved1;
+ uint16 share_type;
+ astring *comment;
+ uint16 perms;
+ uint16 maximum_users;
+ uint16 active_users;
+ astring *path;
+ uint8 password[9];
+ char reserved2;
+ } rap_share_info_2;
+
+ typedef [nodiscriminant] union {
+ [case(0)] rap_share_info_0 info0;
+ [case(1)] rap_share_info_1 info1;
+ [case(2)] rap_share_info_2 info2;
+ } rap_share_info;
+
+ [public] void rap_NetShareEnum(
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 count,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_share_info *info
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetShareAdd(
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [in,switch_is(level)] rap_share_info info,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ typedef struct {
+ uint8 name[16];
+ } rap_server_info_0;
+
+ typedef struct {
+ uint8 name[16];
+ uint8 version_major;
+ uint8 version_minor;
+ uint32 servertype;
+ astring *comment;
+ } rap_server_info_1;
+
+ typedef [nodiscriminant] union {
+ [case(0)] rap_server_info_0 info0;
+ [case(1)] rap_server_info_1 info1;
+ } rap_server_info;
+
+ [public] void rap_NetServerEnum2(
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [in] uint32 servertype,
+ [in] astring *domain,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 count,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_server_info info[count]
+ );
+
+ [public] void rap_WserverGetInfo(
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_server_info info
+ );
+
+ typedef [public] enum {
+ PRJ_QS_QUEUED = 0x0000,
+ PRJ_QS_PAUSED = 0x0001,
+ PRJ_QS_SPOOLING = 0x0002,
+ PRJ_QS_PRINTING = 0x0003,
+ PRJ_QS_ERROR = 0x0010
+ } rap_PrintJStatusCode;
+
+ typedef struct {
+ uint16 JobID;
+ } rap_PrintJobInfo0;
+
+ typedef struct {
+ uint16 JobID;
+ [charset(DOS)] uint8 UserName[21];
+ uint8 Pad;
+ [charset(DOS)] uint8 NotifyName[16];
+ [charset(DOS)] uint8 DataType[10];
+ [relative_short] astring *PrintParameterString;
+ uint16 PrintParameterStringHigh;
+ uint16 JobPosition;
+ rap_PrintJStatusCode JobStatus;
+ [relative_short] astring *JobStatusString;
+ uint16 JobStatusStringHigh;
+ time_t TimeSubmitted;
+ uint32 JobSize;
+ [relative_short] astring *JobCommentString;
+ uint16 JobCommentStringHigh;
+ } rap_PrintJobInfo1;
+
+ typedef struct {
+ uint16 JobID;
+ uint16 Priority;
+ [relative_short] astring *UserName;
+ uint16 UserNameHigh;
+ uint16 JobPosition;
+ rap_PrintJStatusCode JobStatus;
+ time_t TimeSubmitted;
+ uint32 JobSize;
+ [relative_short] astring *JobCommentString;
+ uint16 JobCommentStringHigh;
+ [relative_short] astring *DocumentName;
+ uint16 DocumentNameHigh;
+ } rap_PrintJobInfo2;
+
+ typedef struct {
+ uint16 JobID;
+ uint16 Priority;
+ [relative_short] astring *UserName;
+ uint16 UserNameHigh;
+ uint16 JobPosition;
+ rap_PrintJStatusCode JobStatus;
+ time_t TimeSubmitted;
+ uint32 JobSize;
+ [relative_short] astring *JobCommentString;
+ uint16 JobCommentStringHigh;
+ [relative_short] astring *DocumentName;
+ uint16 DocumentNameHigh;
+ [relative_short] astring *NotifyName;
+ uint16 NotifyNameHigh;
+ [relative_short] astring *DataType;
+ uint16 DataTypeHigh;
+ [relative_short] astring *PrintParameterString;
+ uint16 PrintParameterStringHigh;
+ [relative_short] astring *StatusString;
+ uint16 StatusStringHigh;
+ [relative_short] astring *QueueName;
+ uint16 QueueNameHigh;
+ [relative_short] astring *PrintProcessorName;
+ uint16 PrintProcessorNameHigh;
+ [relative_short] astring *PrintProcessorParams;
+ uint16 PrintProcessorParamsHigh;
+ [relative_short] astring *DriverName;
+ uint16 DriverNameHigh;
+ [relative_short] astring *DriverDataOffset;
+ uint16 DriverDataOffsetHigh;
+ [relative_short] astring *PrinterNameOffset;
+ uint16 PrinterNameOffsetHigh;
+ } rap_PrintJobInfo3;
+
+ typedef [public,nodiscriminant] union {
+ [case(0)] rap_PrintJobInfo0 info0;
+ [case(1)] rap_PrintJobInfo1 info1;
+ [case(2)] rap_PrintJobInfo2 info2;
+ [case(3)] rap_PrintJobInfo3 info3;
+ } rap_printj_info;
+
+ typedef [public] enum {
+ PRQ_ACTIVE = 0x0000,
+ PRQ_PAUSE = 0x0001,
+ PRQ_ERROR = 0x0002,
+ PRQ_PENDING = 0x0003
+ } rap_PrintQStatusCode;
+
+ typedef struct {
+ [charset(DOS)] uint8 PrintQName[13];
+ } rap_PrintQueue0;
+
+ typedef struct {
+ [charset(DOS)] uint8 PrintQName[13];
+ uint8 Pad1;
+ uint16 Priority;
+ uint16 StartTime;
+ uint16 UntilTime;
+ [relative_short] astring *SeparatorPageFilename;
+ uint16 SeparatorPageFilenameHigh;
+ [relative_short] astring *PrintProcessorDllName;
+ uint16 PrintProcessorDllNameHigh;
+ [relative_short] astring *PrintDestinationsName;
+ uint16 PrintDestinationsNameHigh;
+ [relative_short] astring *PrintParameterString;
+ uint16 PrintParameterStringHigh;
+ [relative_short] astring *CommentString;
+ uint16 CommentStringHigh;
+ rap_PrintQStatusCode PrintQStatus;
+ uint16 PrintJobCount;
+ } rap_PrintQueue1;
+
+ typedef struct {
+ rap_PrintQueue1 queue;
+ rap_PrintJobInfo1 job[queue.PrintJobCount];
+ } rap_PrintQueue2;
+
+ typedef [public] struct {
+ [relative_short] astring *PrintQueueName;
+ uint16 PrintQueueNameHigh;
+ uint16 Priority;
+ uint16 StartTime;
+ uint16 UntilTime;
+ uint16 Pad;
+ [relative_short] astring *SeparatorPageFilename;
+ uint16 SeparatorPageFilenameHigh;
+ [relative_short] astring *PrintProcessorDllName;
+ uint16 PrintProcessorDllNameHigh;
+ [relative_short] astring *PrintParameterString;
+ uint16 PrintParameterStringHigh;
+ [relative_short] astring *CommentString;
+ uint16 CommentStringHigh;
+ rap_PrintQStatusCode PrintQStatus;
+ uint16 PrintJobCount;
+ [relative_short] astring *Printers;
+ uint16 PrintersHigh;
+ [relative_short] astring *DriverName;
+ uint16 DriverNameHigh;
+ [relative_short] astring *PrintDriverData;
+ uint16 PrintDriverDataHigh;
+ } rap_PrintQueue3;
+
+ typedef struct {
+ rap_PrintQueue3 queue;
+ rap_PrintJobInfo2 job[queue.PrintJobCount];
+ } rap_PrintQueue4;
+
+ typedef struct {
+ [relative_short] astring *PrintQueueName;
+ uint16 PrintQueueNameHigh;
+ } rap_PrintQueue5;
+
+ typedef [public,nodiscriminant] union {
+ [case(0)] rap_PrintQueue0 info0;
+ [case(1)] rap_PrintQueue1 info1;
+ [case(2)] rap_PrintQueue2 info2;
+ [case(3)] rap_PrintQueue3 info3;
+ [case(4)] rap_PrintQueue4 info4;
+ [case(5)] rap_PrintQueue5 info5;
+ } rap_printq_info;
+
+ [public] void rap_NetPrintQEnum(
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 count,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_printq_info info[count]
+ );
+
+ [public] void rap_NetPrintQGetInfo(
+ [in] astring PrintQueueName,
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_printq_info info
+ );
+
+ [public] void rap_NetPrintJobPause(
+ [in] uint16 JobID,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ [public] void rap_NetPrintJobContinue(
+ [in] uint16 JobID,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ [public] void rap_NetPrintJobDelete(
+ [in] uint16 JobID,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetPrintQueuePause(
+ [in] astring PrintQueueName,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetPrintQueueResume(
+ [in] astring PrintQueueName,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetPrintQueuePurge(
+ [in] astring PrintQueueName,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetPrintJobEnum(
+ [in] astring PrintQueueName,
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 count,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_printj_info info[count]
+ );
+
+ [public] void rap_NetPrintJobGetInfo(
+ [in] uint16 JobID,
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_printj_info info
+ );
+
+ typedef enum {
+ RAP_PARAM_JOBNUM = 0x0001,
+ RAP_PARAM_USERNAME = 0x0002,
+ RAP_PARAM_NOTIFYNAME = 0x0003,
+ RAP_PARAM_DATATYPE = 0x0004,
+ RAP_PARAM_PARAMETERS_STRING = 0x0005,
+ RAP_PARAM_JOBPOSITION = 0x0006,
+ RAP_PARAM_JOBSTATUS = 0x0007,
+ RAP_PARAM_JOBSTATUSSTR = 0x0008,
+ RAP_PARAM_TIMESUBMITTED = 0x0009,
+ RAP_PARAM_JOBSIZE = 0x000a,
+ RAP_PARAM_JOBCOMMENT = 0x000b
+ } rap_JobInfoParamNum;
+
+ typedef [nodiscriminant] union {
+ [case (RAP_PARAM_JOBNUM)] uint16 value;
+ [case (RAP_PARAM_USERNAME)] astring string;
+ [case (RAP_PARAM_NOTIFYNAME)] astring string;
+ [case (RAP_PARAM_DATATYPE)] astring string;
+ [case (RAP_PARAM_PARAMETERS_STRING)] astring string;
+ [case (RAP_PARAM_JOBPOSITION)] uint16 value;
+ [case (RAP_PARAM_JOBSTATUS)] uint16 value;
+ [case (RAP_PARAM_JOBSTATUSSTR)] astring string;
+ [case (RAP_PARAM_TIMESUBMITTED)] uint32 value4;
+ [case (RAP_PARAM_JOBSIZE)] uint32 value4;
+ [case (RAP_PARAM_JOBCOMMENT)] astring string;
+ } rap_JobInfoParam;
+
+ [public] void rap_NetPrintJobSetInfo(
+ [in] uint16 JobID,
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [in] rap_JobInfoParamNum ParamNum,
+ [in,switch_is(ParamNum)] rap_JobInfoParam Param,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ /* all not documented in MS-RAP */
+
+ typedef struct {
+ [charset(DOS)] uint8 PrintDestName[9];
+ } rap_PrintDest0;
+
+ typedef struct {
+ [charset(DOS)] uint8 PrintDestName[9];
+ [charset(DOS)] uint8 UserName[21];
+ uint16 JobId;
+ uint16 Status;
+ [relative_short] astring *StatusStringName;
+ uint16 PrintQueueNameHigh;
+ uint16 Time;
+ } rap_PrintDest1;
+
+ typedef struct {
+ [relative_short] astring *PrinterName;
+ uint16 PrinterNameHigh;
+ } rap_PrintDest2;
+
+ typedef struct {
+ [relative_short] astring *PrinterName;
+ uint16 PrinterNameHigh;
+ [relative_short] astring *UserName;
+ uint16 UserNameHigh;
+ [relative_short] astring *LogAddr;
+ uint16 LogAddrHigh;
+ uint16 JobId;
+ uint16 Status;
+ [relative_short] astring *StatusStringName;
+ uint16 PrintQueueNameHigh;
+ [relative_short] astring *Comment;
+ uint16 CommentHigh;
+ [relative_short] astring *Drivers;
+ uint16 DriversHigh;
+ uint16 Time;
+ uint16 Pad1;
+ } rap_PrintDest3;
+
+ typedef [public,nodiscriminant] union {
+ [case(0)] rap_PrintDest0 info0;
+ [case(1)] rap_PrintDest1 info1;
+ [case(2)] rap_PrintDest2 info2;
+ [case(3)] rap_PrintDest3 info3;
+ } rap_printdest_info;
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetPrintDestEnum(
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 count,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_printdest_info info[count]
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetPrintDestGetInfo(
+ [in] astring PrintDestName,
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_printdest_info info
+ );
+
+ [public] void rap_NetUserPasswordSet2(
+ [in] astring UserName,
+ [in] uint8 OldPassword[16],
+ [in] uint8 NewPassword[16],
+ [in] uint16 EncryptedPassword,
+ [in] uint16 RealPasswordLength,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetOEMChangePassword(
+ [in] astring UserName,
+ [in] uint8 crypt_password[516],
+ [in] uint8 password_hash[16],
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ typedef struct {
+ [charset(DOS)] uint8 Name[21];
+ } rap_NetUserInfo0;
+
+ typedef [public] enum {
+ USER_PRIV_GUEST = 0,
+ USER_PRIV_USER = 1,
+ USER_PRIV_ADMIN = 2
+ } rap_UserPriv;
+
+ typedef struct {
+ [charset(DOS)] uint8 Name[21];
+ uint8 Pad;
+ uint8 Password[16];
+ time_t PasswordAge;
+ rap_UserPriv Priv;
+ [relative_short] astring *HomeDir;
+ uint16 HomeDirHigh;
+ [relative_short] astring *Comment;
+ uint16 CommentHigh;
+ uint16 Flags; /* FIXME */
+ [relative_short] astring *ScriptPath;
+ uint16 ScriptPathHigh;
+ } rap_NetUserInfo1;
+
+ typedef [public,v1_enum] enum {
+ AF_OP_PRINT = 0,
+ AF_OP_COMM = 1,
+ AF_OP_SERVER = 2,
+ AF_OP_ACCOUNTS = 3
+ } rap_AuthFlags;
+
+ typedef [public] struct {
+ uint8 LogonHours[21];
+ } rap_LogonHours;
+
+ typedef struct {
+ [charset(DOS)] uint8 Name[21];
+ uint8 Pad;
+ uint8 Password[16];
+ time_t PasswordAge;
+ rap_UserPriv Priv;
+ [relative_short] astring *HomeDir;
+ uint16 HomeDirHigh;
+ [relative_short] astring *Comment;
+ uint16 CommentHigh;
+ uint16 Flags; /* FIXME */
+ [relative_short] astring *ScriptPath;
+ uint16 ScriptPathHigh;
+ rap_AuthFlags AuthFlags;
+ [relative_short] astring *FullName;
+ uint16 FullNameHigh;
+ [relative_short] astring *UsrComment;
+ uint16 UsrCommentHigh;
+ [relative_short] astring *pParms;
+ uint16 pParmsHigh;
+ [relative_short] astring *WorkStations;
+ uint16 WorkStationsHigh;
+ time_t LastLogon;
+ time_t LastLogOff;
+ time_t AcctExpires;
+ uint32 MaxStorage;
+ uint16 UnitsPerWeek;
+ [relative_short] rap_LogonHours *LogonHours;
+ uint16 LogonHoursHigh;
+ uint16 BadPwCount;
+ uint16 NumLogons;
+ [relative_short] astring *LogonServer;
+ uint16 LogonServerHigh;
+ uint16 CountryCode;
+ uint16 CodePage;
+ } rap_NetUserInfo2;
+
+ typedef struct {
+ [charset(DOS)] uint8 Name[21];
+ uint8 Pad;
+ [relative_short] astring *Comment;
+ uint16 CommentHigh;
+ [relative_short] astring *UsrComment;
+ uint16 UsrCommentHigh;
+ [relative_short] astring *FullName;
+ uint16 FullNameHigh;
+ } rap_NetUserInfo10;
+
+ typedef struct {
+ [charset(DOS)] uint8 Name[21];
+ uint8 Pad;
+ [relative_short] astring *Comment;
+ uint16 CommentHigh;
+ [relative_short] astring *UsrComment;
+ uint16 UsrCommentHigh;
+ [relative_short] astring *FullName;
+ uint16 FullNameHigh;
+ rap_UserPriv Priv;
+ rap_AuthFlags AuthFlags;
+ time_t PasswordAge;
+ [relative_short] astring *HomeDir;
+ uint16 HomeDirHigh;
+ [relative_short] astring *Parms;
+ uint16 ParmsHigh;
+ time_t LastLogon;
+ time_t LastLogOff;
+ uint16 BadPWCount;
+ uint16 NumLogons;
+ [relative_short] astring *LogonServer;
+ uint16 LogonServerHigh;
+ uint16 CountryCode;
+ [relative_short] astring *WorkStations;
+ uint16 WorkStationsHigh;
+ uint32 MaxStorage;
+ uint16 UnitsPerWeek;
+ [relative_short] rap_LogonHours *LogonHours;
+ uint16 LogonHoursHigh;
+ uint16 CodePage;
+ } rap_NetUserInfo11;
+
+ typedef [public,nodiscriminant] union {
+ [case(0)] rap_NetUserInfo0 info0;
+ [case(1)] rap_NetUserInfo1 info1;
+ [case(2)] rap_NetUserInfo2 info2;
+ [case(10)] rap_NetUserInfo10 info10;
+ [case(11)] rap_NetUserInfo11 info11;
+ } rap_netuser_info;
+
+ [public] void rap_NetUserGetInfo(
+ [in] astring UserName,
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_netuser_info info
+ );
+
+ typedef struct {
+ [relative_short] astring *ComputerName;
+ uint16 ComputerNameHigh;
+ [relative_short] astring *UserName;
+ uint16 UserNameHigh;
+ uint16 num_conns;
+ uint16 num_opens;
+ uint16 num_users;
+ uint32 sess_time;
+ uint32 idle_time;
+ uint32 user_flags;
+ [relative_short] astring *CliTypeName;
+ uint16 CliTypeNameHigh;
+ } rap_session_info_2;
+
+ typedef [public,nodiscriminant] union {
+ [case(2)] rap_session_info_2 info2;
+ } rap_session_info;
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetSessionEnum(
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 count,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_session_info info[count]
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetSessionGetInfo(
+ [in] astring SessionName,
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] uint16 available,
+ [out,switch_is(level)] rap_session_info info
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetUserAdd(
+ [in] uint16 level,
+ [in] uint16 bufsize,
+ [in] uint16 pwdlength,
+ [in] uint16 unknown,
+ [in,switch_is(level)] rap_netuser_info info,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ /* not documented in MS-RAP */
+ [public] void rap_NetUserDelete(
+ [in] astring UserName,
+ [out] rap_status status,
+ [out] uint16 convert
+ );
+
+ typedef [public] struct {
+ uint32 TimeSinceJan11970;
+ uint32 TimeSinceBoot;
+ uint8 Hours;
+ uint8 Minutes;
+ uint8 Seconds;
+ uint8 Hundreds;
+ uint16 TimeZone;
+ uint16 ClockFrequency;
+ uint8 Day;
+ uint8 Month;
+ uint16 Year;
+ uint8 Weekday;
+ } rap_TimeOfDayInfo;
+
+ [public] void rap_NetRemoteTOD(
+ [in] uint16 bufsize,
+ [out] rap_status status,
+ [out] uint16 convert,
+ [out] rap_TimeOfDayInfo tod
+ );
+
+ /* Parameter description strings for RAP calls */
+ /* Names are defined name for RAP call with _REQ */
+ /* appended to end. */
+
+ const string RAP_WFileEnum2_REQ = "zzWrLehb8g8";
+ const string RAP_WFileGetInfo2_REQ = "DWrLh";
+ const string RAP_WFileClose2_REQ = "D";
+
+ const string RAP_NetGroupEnum_REQ = "WrLeh";
+ const string RAP_NetGroupAdd_REQ = "WsT";
+ const string RAP_NetGroupDel_REQ = "z";
+ const string RAP_NetGroupAddUser_REQ = "zz";
+ const string RAP_NetGroupDelUser_REQ = "zz";
+ const string RAP_NetGroupGetUsers_REQ = "zWrLeh";
+ const string RAP_NetGroupSetUsers_REQ = "zWsTW";
+
+ const string RAP_NetUserAdd2_REQ = "WsTWW";
+ const string RAP_NetUserEnum_REQ = "WrLeh";
+ const string RAP_NetUserEnum2_REQ = "WrLDieh";
+ const string RAP_NetUserGetGroups_REQ = "zWrLeh";
+ const string RAP_NetUserSetGroups_REQ = "zWsTW";
+ const string RAP_NetUserPasswordSet_REQ = "zb16b16w";
+ const string RAP_NetUserPasswordSet2_REQ = "zb16b16WW";
+ const string RAP_SAMOEMChgPasswordUser2_REQ = "B516B16";
+ const string RAP_NetUserValidate2_REQ = "Wb62WWrLhWW";
+
+ const string RAP_NetServerEnum2_REQ = "WrLehDz";
+ const string RAP_WserverGetInfo_REQ = "WrLh";
+ const string RAP_NetWkstatGetInfo = "WrLh";
+
+ const string RAP_WShareAdd_REQ = "WsT";
+ const string RAP_WShareEnum_REQ = "WrLeh";
+ const string RAP_WShareDel_REQ = "zW";
+ const string RAP_WWkstaGetInfo_REQ = "WrLh";
+
+ const string RAP_NetPrintQEnum_REQ = "WrLeh";
+ const string RAP_NetPrintQGetInfo_REQ = "zWrLh";
+
+ const string RAP_NetServerAdminCommand_REQ = "zhrLeh";
+ const string RAP_NetServiceEnum_REQ = "WrLeh";
+ const string RAP_NetServiceControl_REQ = "zWWrL";
+ const string RAP_NetServiceInstall_REQ = "zF88sg88T";
+ const string RAP_NetServiceGetInfo_REQ = "zWrLh";
+ const string RAP_NetSessionEnum_REQ = "WrLeh";
+ const string RAP_NetSessionGetInfo_REQ = "zWrLh";
+ const string RAP_NetSessionDel_REQ = "zW";
+
+ const string RAP_NetConnectionEnum_REQ = "zWrLeh";
+
+ const string RAP_NetWkstaUserLogoff_REQ = "zzWb38WrLh";
+
+ /* Description strings for returned data in RAP calls */
+ /* I use all caps here in part to avoid accidental */
+ /* name collisions */
+
+ const string RAP_FILE_INFO_L2 = "D";
+ const string RAP_FILE_INFO_L3 = "DWWzz";
+ const string RAP_GROUP_INFO_L0 = "B21";
+ const string RAP_GROUP_INFO_L1 = "B21Bz";
+ const string RAP_GROUP_USERS_INFO_0 = "B21";
+ const string RAP_GROUP_USERS_INFO_1 = "B21BN";
+
+ const string RAP_USER_INFO_L0 = "B21";
+ const string RAP_USER_INFO_L1 = "B21BB16DWzzWz";
+
+ const string RAP_SERVER_INFO_L0 = "B16";
+ const string RAP_SERVER_INFO_L1 = "B16BBDz";
+ const string RAP_SERVER_INFO_L2 = "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWz";
+ const string RAP_SERVER_INFO_L3 = "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWzDWz";
+ const string RAP_SERVICE_INFO_L0 = "B16";
+ const string RAP_SERVICE_INFO_L2 = "B16WDWB64";
+ const string RAP_SHARE_INFO_L0 = "B13";
+ const string RAP_SHARE_INFO_L1 = "B13BWz";
+ const string RAP_SHARE_INFO_L2 = "B13BWzWWWzB9B";
+
+ const string RAP_PRINTQ_INFO_L2 = "B13BWWWzzzzzWN";
+ const string RAP_SMB_PRINT_JOB_L1 = "WB21BB16B10zWWzDDz";
+
+ const string RAP_SESSION_INFO_L2 = "zzWWWDDDz";
+ const string RAP_CONNECTION_INFO_L1 = "WWWWDzz";
+
+ const string RAP_USER_LOGOFF_INFO_L1 = "WDW";
+
+ const string RAP_WKSTA_INFO_L1 = "WDzzzzBBDWDWWWWWWWWWWWWWWWWWWWzzWzzW";
+ const string RAP_WKSTA_INFO_L10 = "zzzBBzz";
+};
diff --git a/librpc/idl/remact.idl b/librpc/idl/remact.idl
new file mode 100644
index 0000000..77134e7
--- /dev/null
+++ b/librpc/idl/remact.idl
@@ -0,0 +1,46 @@
+/**
+ DCOM interfaces
+ http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm
+ */
+
+import "misc.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 [v1_enum] 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_object,
+ [out,ref] ORPCTHAT *that,
+ [in] GUID Clsid,
+ [in] [unique,string,charset(UTF16)] uint16 *pwszObjectName,
+ [in] [unique] MInterfacePointer *pObjectStorage,
+ [in] imp_levels ClientImpLevel,
+ [in] uint32 Mode,
+ [in,range(1,32768)] uint32 Interfaces,
+ [in,unique,size_is(Interfaces)] 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] HRESULT *hr,
+ [out,size_is(Interfaces)] MInterfacePointer **ifaces,
+ [out,size_is(Interfaces)] HRESULT results[]
+ );
+}
diff --git a/librpc/idl/rot.idl b/librpc/idl/rot.idl
new file mode 100644
index 0000000..7239111
--- /dev/null
+++ b/librpc/idl/rot.idl
@@ -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
+ );
+}
diff --git a/librpc/idl/samr.idl b/librpc/idl/samr.idl
new file mode 100644
index 0000000..911f540
--- /dev/null
+++ b/librpc/idl/samr.idl
@@ -0,0 +1,1665 @@
+#include "idl_types.h"
+
+/*
+ samr interface definition
+*/
+import "misc.idl", "lsa.idl", "security.idl";
+
+/*
+ Thanks to Todd Sabin for some information from his samr.idl in acltools
+*/
+
+[ uuid("12345778-1234-abcd-ef00-0123456789ac"),
+ version(1.0),
+ endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
+ pointer_default(unique)
+] interface samr
+{
+ typedef bitmap security_secinfo security_secinfo;
+ typedef bitmap security_GroupAttrs security_GroupAttrs;
+
+ /* account control (acct_flags) bits */
+ typedef [public,bitmap32bit] bitmap {
+ ACB_DISABLED = 0x00000001, /* 1 = User account disabled */
+ ACB_HOMDIRREQ = 0x00000002, /* 1 = Home directory required */
+ ACB_PWNOTREQ = 0x00000004, /* 1 = User password not required */
+ ACB_TEMPDUP = 0x00000008, /* 1 = Temporary duplicate account */
+ ACB_NORMAL = 0x00000010, /* 1 = Normal user account */
+ ACB_MNS = 0x00000020, /* 1 = MNS logon user account */
+ ACB_DOMTRUST = 0x00000040, /* 1 = Interdomain trust account */
+ ACB_WSTRUST = 0x00000080, /* 1 = Workstation trust account */
+ ACB_SVRTRUST = 0x00000100, /* 1 = Server trust account */
+ ACB_PWNOEXP = 0x00000200, /* 1 = User password does not expire */
+ ACB_AUTOLOCK = 0x00000400, /* 1 = Account auto locked */
+ ACB_ENC_TXT_PWD_ALLOWED = 0x00000800, /* 1 = Encryped text password is allowed */
+ ACB_SMARTCARD_REQUIRED = 0x00001000, /* 1 = Smart Card required */
+ ACB_TRUSTED_FOR_DELEGATION = 0x00002000, /* 1 = Trusted for Delegation */
+ ACB_NOT_DELEGATED = 0x00004000, /* 1 = Not delegated */
+ ACB_USE_DES_KEY_ONLY = 0x00008000, /* 1 = Use DES key only */
+ ACB_DONT_REQUIRE_PREAUTH = 0x00010000, /* 1 = Preauth not required */
+ ACB_PW_EXPIRED = 0x00020000, /* 1 = Password Expired */
+ ACB_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = 0x00040000,
+ ACB_NO_AUTH_DATA_REQD = 0x00080000, /* 1 = No authorization data required */
+ ACB_PARTIAL_SECRETS_ACCOUNT = 0x00100000,
+ ACB_USE_AES_KEYS = 0x00200000
+ } samr_AcctFlags;
+
+ /* SAM server specific access rights */
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001,
+ SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002,
+ SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004,
+ SAMR_ACCESS_CREATE_DOMAIN = 0x00000008,
+ SAMR_ACCESS_ENUM_DOMAINS = 0x00000010,
+ SAMR_ACCESS_LOOKUP_DOMAIN = 0x00000020
+ } samr_ConnectAccessMask;
+
+ const int SAMR_ACCESS_ALL_ACCESS = 0x0000003F;
+
+ const int GENERIC_RIGHTS_SAM_ALL_ACCESS =
+ (STANDARD_RIGHTS_REQUIRED_ACCESS |
+ SAMR_ACCESS_ALL_ACCESS);
+
+ const int GENERIC_RIGHTS_SAM_READ =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ SAMR_ACCESS_ENUM_DOMAINS);
+
+ const int GENERIC_RIGHTS_SAM_WRITE =
+ (STANDARD_RIGHTS_WRITE_ACCESS |
+ SAMR_ACCESS_CREATE_DOMAIN |
+ SAMR_ACCESS_INITIALIZE_SERVER |
+ SAMR_ACCESS_SHUTDOWN_SERVER);
+
+ const int GENERIC_RIGHTS_SAM_EXECUTE =
+ (STANDARD_RIGHTS_EXECUTE_ACCESS |
+ SAMR_ACCESS_LOOKUP_DOMAIN |
+ SAMR_ACCESS_CONNECT_TO_SERVER);
+
+ /* User Object specific access rights */
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001,
+ SAMR_USER_ACCESS_GET_LOCALE = 0x00000002,
+ SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004,
+ SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008,
+ SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010,
+ SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020,
+ SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040,
+ SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080,
+ SAMR_USER_ACCESS_GET_GROUPS = 0x00000100,
+ SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200,
+ SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400
+ } samr_UserAccessMask;
+
+ const int SAMR_USER_ACCESS_ALL_ACCESS = 0x000007FF;
+
+ const int GENERIC_RIGHTS_USER_ALL_ACCESS =
+ (STANDARD_RIGHTS_REQUIRED_ACCESS |
+ SAMR_USER_ACCESS_ALL_ACCESS); /* 0x000f07ff */
+
+ const int GENERIC_RIGHTS_USER_READ =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP |
+ SAMR_USER_ACCESS_GET_GROUPS |
+ SAMR_USER_ACCESS_GET_ATTRIBUTES |
+ SAMR_USER_ACCESS_GET_LOGONINFO |
+ SAMR_USER_ACCESS_GET_LOCALE); /* 0x0002031a */
+
+ const int GENERIC_RIGHTS_USER_WRITE =
+ (STANDARD_RIGHTS_WRITE_ACCESS |
+ SAMR_USER_ACCESS_CHANGE_PASSWORD |
+ SAMR_USER_ACCESS_SET_LOC_COM |
+ SAMR_USER_ACCESS_SET_ATTRIBUTES |
+ SAMR_USER_ACCESS_SET_PASSWORD |
+ SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP); /* 0x000204e4 */
+
+ const int GENERIC_RIGHTS_USER_EXECUTE =
+ (STANDARD_RIGHTS_EXECUTE_ACCESS |
+ SAMR_USER_ACCESS_CHANGE_PASSWORD |
+ SAMR_USER_ACCESS_GET_NAME_ETC); /* 0x00020041 */
+
+ /* Domain Object specific access rights */
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001,
+ SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002,
+ SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004,
+ SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008,
+ SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010,
+ SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020,
+ SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040,
+ SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080,
+ SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100,
+ SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200,
+ SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400
+ } samr_DomainAccessMask;
+
+ const int SAMR_DOMAIN_ACCESS_ALL_ACCESS = 0x000007FF;
+
+ const int GENERIC_RIGHTS_DOMAIN_ALL_ACCESS =
+ (STANDARD_RIGHTS_REQUIRED_ACCESS |
+ SAMR_DOMAIN_ACCESS_ALL_ACCESS);
+
+ const int GENERIC_RIGHTS_DOMAIN_READ =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS |
+ SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2);
+
+ const int GENERIC_RIGHTS_DOMAIN_WRITE =
+ (STANDARD_RIGHTS_WRITE_ACCESS |
+ SAMR_DOMAIN_ACCESS_SET_INFO_3 |
+ SAMR_DOMAIN_ACCESS_CREATE_ALIAS |
+ SAMR_DOMAIN_ACCESS_CREATE_GROUP |
+ SAMR_DOMAIN_ACCESS_CREATE_USER |
+ SAMR_DOMAIN_ACCESS_SET_INFO_2 |
+ SAMR_DOMAIN_ACCESS_SET_INFO_1);
+
+ const int GENERIC_RIGHTS_DOMAIN_EXECUTE =
+ (STANDARD_RIGHTS_EXECUTE_ACCESS |
+ SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT |
+ SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS |
+ SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1);
+
+ /* Group Object specific access rights */
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001,
+ SAMR_GROUP_ACCESS_SET_INFO = 0x00000002,
+ SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004,
+ SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008,
+ SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010
+ } samr_GroupAccessMask;
+
+ const int SAMR_GROUP_ACCESS_ALL_ACCESS = 0x0000001F;
+
+ const int GENERIC_RIGHTS_GROUP_ALL_ACCESS =
+ (STANDARD_RIGHTS_REQUIRED_ACCESS |
+ SAMR_GROUP_ACCESS_ALL_ACCESS); /* 0x000f001f */
+
+ const int GENERIC_RIGHTS_GROUP_READ =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ SAMR_GROUP_ACCESS_GET_MEMBERS); /* 0x00020010 */
+
+ const int GENERIC_RIGHTS_GROUP_WRITE =
+ (STANDARD_RIGHTS_WRITE_ACCESS |
+ SAMR_GROUP_ACCESS_REMOVE_MEMBER |
+ SAMR_GROUP_ACCESS_ADD_MEMBER |
+ SAMR_GROUP_ACCESS_SET_INFO); /* 0x0002000e */
+
+ const int GENERIC_RIGHTS_GROUP_EXECUTE =
+ (STANDARD_RIGHTS_EXECUTE_ACCESS |
+ SAMR_GROUP_ACCESS_LOOKUP_INFO); /* 0x00020001 */
+
+ /* Alias Object specific access rights */
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001,
+ SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002,
+ SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004,
+ SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008,
+ SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010
+ } samr_AliasAccessMask;
+
+ const int SAMR_ALIAS_ACCESS_ALL_ACCESS = 0x0000001F;
+
+ const int GENERIC_RIGHTS_ALIAS_ALL_ACCESS =
+ (STANDARD_RIGHTS_REQUIRED_ACCESS |
+ SAMR_ALIAS_ACCESS_ALL_ACCESS); /* 0x000f001f */
+
+ const int GENERIC_RIGHTS_ALIAS_READ =
+ (STANDARD_RIGHTS_READ_ACCESS |
+ SAMR_ALIAS_ACCESS_GET_MEMBERS); /* 0x00020004 */
+
+ const int GENERIC_RIGHTS_ALIAS_WRITE =
+ (STANDARD_RIGHTS_WRITE_ACCESS |
+ SAMR_ALIAS_ACCESS_REMOVE_MEMBER |
+ SAMR_ALIAS_ACCESS_ADD_MEMBER |
+ SAMR_ALIAS_ACCESS_SET_INFO); /* 0x00020013 */
+
+ const int GENERIC_RIGHTS_ALIAS_EXECUTE =
+ (STANDARD_RIGHTS_EXECUTE_ACCESS |
+ SAMR_ALIAS_ACCESS_LOOKUP_INFO); /* 0x00020008 */
+
+ /******************/
+ /* Function: 0x00 */
+ NTSTATUS samr_Connect (
+ /* notice the lack of [string] */
+ [in,unique] uint16 *system_name,
+ [in] samr_ConnectAccessMask access_mask,
+ [out,ref] policy_handle *connect_handle
+ );
+
+
+ /******************/
+ /* Function: 0x01 */
+ [public] NTSTATUS samr_Close (
+ [in,out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x02 */
+
+ NTSTATUS samr_SetSecurity (
+ [in,ref] policy_handle *handle,
+ [in] security_secinfo sec_info,
+ [in,ref] sec_desc_buf *sdbuf
+ );
+
+ /******************/
+ /* Function: 0x03 */
+
+ NTSTATUS samr_QuerySecurity (
+ [in,ref] policy_handle *handle,
+ [in] security_secinfo sec_info,
+ [out,ref] sec_desc_buf **sdbuf
+ );
+
+ /******************/
+ /* Function: 0x04 */
+
+ /*
+ shutdown the SAM - once you call this the SAM will be dead
+ */
+ NTSTATUS samr_Shutdown (
+ [in,ref] policy_handle *connect_handle
+ );
+
+ /******************/
+ /* Function: 0x05 */
+ NTSTATUS samr_LookupDomain (
+ [in,ref] policy_handle *connect_handle,
+ [in,ref] lsa_String *domain_name,
+ [out,ref] dom_sid2 **sid
+ );
+
+
+ /******************/
+ /* Function: 0x06 */
+
+ typedef struct {
+ uint32 idx;
+ lsa_String name;
+ } samr_SamEntry;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] samr_SamEntry *entries;
+ } samr_SamArray;
+
+ NTSTATUS samr_EnumDomains (
+ [in,ref] policy_handle *connect_handle,
+ [in,out,ref] uint32 *resume_handle,
+ [out,ref] samr_SamArray **sam,
+ [in] uint32 buf_size,
+ [out,ref] uint32 *num_entries
+ );
+
+
+ /************************/
+ /* Function 0x07 */
+ [public] NTSTATUS samr_OpenDomain(
+ [in,ref] policy_handle *connect_handle,
+ [in] samr_DomainAccessMask access_mask,
+ [in,ref] dom_sid2 *sid,
+ [out,ref] policy_handle *domain_handle
+ );
+
+ /************************/
+ /* Function 0x08 */
+
+ typedef enum {
+ DomainPasswordInformation = 1,
+ DomainGeneralInformation = 2,
+ DomainLogoffInformation = 3,
+ DomainOemInformation = 4,
+ DomainNameInformation = 5,
+ DomainReplicationInformation = 6,
+ DomainServerRoleInformation = 7,
+ DomainModifiedInformation = 8,
+ DomainStateInformation = 9,
+ DomainUasInformation = 10,
+ DomainGeneralInformation2 = 11,
+ DomainLockoutInformation = 12,
+ DomainModifiedInformation2 = 13
+ } samr_DomainInfoClass;
+
+ /* server roles */
+ typedef [v1_enum] enum {
+ SAMR_ROLE_STANDALONE = 0,
+ SAMR_ROLE_DOMAIN_MEMBER = 1,
+ SAMR_ROLE_DOMAIN_BDC = 2,
+ SAMR_ROLE_DOMAIN_PDC = 3
+ } samr_Role;
+
+ /* password properties flags */
+ typedef [public,bitmap32bit] bitmap {
+ DOMAIN_PASSWORD_COMPLEX = 0x00000001,
+ DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002,
+ DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
+ DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008,
+ DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
+ DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020
+ } samr_PasswordProperties;
+
+ typedef [v1_enum] enum {
+ DOMAIN_SERVER_ENABLED = 1,
+ DOMAIN_SERVER_DISABLED = 2
+ } samr_DomainServerState;
+
+ typedef [public] struct {
+ uint16 min_password_length;
+ uint16 password_history_length;
+ samr_PasswordProperties password_properties;
+ /* yes, these are signed. They are in negative 100ns */
+ dlong max_password_age;
+ dlong min_password_age;
+ } samr_DomInfo1;
+
+ typedef struct {
+ NTTIME force_logoff_time;
+ lsa_String oem_information; /* comment */
+ lsa_String domain_name;
+ lsa_String primary; /* PDC name if this is a BDC */
+ udlong sequence_num;
+ samr_DomainServerState domain_server_state;
+ samr_Role role;
+ uint32 unknown3;
+ uint32 num_users;
+ uint32 num_groups;
+ uint32 num_aliases;
+ } samr_DomGeneralInformation;
+
+ typedef struct {
+ NTTIME force_logoff_time;
+ } samr_DomInfo3;
+
+ typedef struct {
+ lsa_String oem_information; /* comment */
+ } samr_DomOEMInformation;
+
+ typedef struct {
+ lsa_String domain_name;
+ } samr_DomInfo5;
+
+ typedef struct {
+ lsa_String primary;
+ } samr_DomInfo6;
+
+ typedef struct {
+ samr_Role role;
+ } samr_DomInfo7;
+
+ typedef struct {
+ hyper sequence_num;
+ NTTIME domain_create_time;
+ } samr_DomInfo8;
+
+ typedef struct {
+ samr_DomainServerState domain_server_state;
+ } samr_DomInfo9;
+
+ typedef struct {
+ samr_DomGeneralInformation general;
+ hyper lockout_duration;
+ hyper lockout_window;
+ uint16 lockout_threshold;
+ } samr_DomGeneralInformation2;
+
+ typedef struct {
+ hyper lockout_duration;
+ hyper lockout_window;
+ uint16 lockout_threshold;
+ } samr_DomInfo12;
+
+ typedef struct {
+ hyper sequence_num;
+ NTTIME domain_create_time;
+ hyper modified_count_at_last_promotion;
+ } samr_DomInfo13;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] samr_DomInfo1 info1;
+ [case(2)] samr_DomGeneralInformation general;
+ [case(3)] samr_DomInfo3 info3;
+ [case(4)] samr_DomOEMInformation oem;
+ [case(5)] samr_DomInfo5 info5;
+ [case(6)] samr_DomInfo6 info6;
+ [case(7)] samr_DomInfo7 info7;
+ [case(8)] samr_DomInfo8 info8;
+ [case(9)] samr_DomInfo9 info9;
+ [case(11)] samr_DomGeneralInformation2 general2;
+ [case(12)] samr_DomInfo12 info12;
+ [case(13)] samr_DomInfo13 info13;
+ } samr_DomainInfo;
+
+ NTSTATUS samr_QueryDomainInfo(
+ [in,ref] policy_handle *domain_handle,
+ [in] samr_DomainInfoClass level,
+ [out,ref,switch_is(level)] samr_DomainInfo **info
+ );
+
+ /************************/
+ /* Function 0x09 */
+ /*
+ only levels 1, 3, 4, 6, 7, 9, 12 are valid for this
+ call in w2k3
+ */
+ NTSTATUS samr_SetDomainInfo(
+ [in,ref] policy_handle *domain_handle,
+ [in] samr_DomainInfoClass level,
+ [in,switch_is(level),ref] samr_DomainInfo *info
+ );
+
+
+ /************************/
+ /* Function 0x0a */
+ NTSTATUS samr_CreateDomainGroup(
+ [in,ref] policy_handle *domain_handle,
+ [in,ref] lsa_String *name,
+ [in] samr_GroupAccessMask access_mask,
+ [out,ref] policy_handle *group_handle,
+ [out,ref] uint32 *rid
+ );
+
+
+ /************************/
+ /* Function 0x0b */
+ NTSTATUS samr_EnumDomainGroups(
+ [in] policy_handle *domain_handle,
+ [in,out,ref] uint32 *resume_handle,
+ [out,ref] samr_SamArray **sam,
+ [in] uint32 max_size,
+ [out,ref] uint32 *num_entries
+ );
+
+ /************************/
+ /* Function 0x0c */
+ NTSTATUS samr_CreateUser(
+ [in,ref] policy_handle *domain_handle,
+ [in,ref] lsa_String *account_name,
+ [in] samr_UserAccessMask access_mask,
+ [out,ref] policy_handle *user_handle,
+ [out,ref] uint32 *rid
+ );
+
+ /************************/
+ /* Function 0x0d */
+
+
+ /* w2k3 treats max_size as max_users*54 and sets the
+ resume_handle as the rid of the last user sent
+ */
+ const int SAMR_ENUM_USERS_MULTIPLIER = 54;
+
+ NTSTATUS samr_EnumDomainUsers(
+ [in] policy_handle *domain_handle,
+ [in,out,ref] uint32 *resume_handle,
+ [in] samr_AcctFlags acct_flags,
+ [out,ref] samr_SamArray **sam,
+ [in] uint32 max_size,
+ [out,ref] uint32 *num_entries
+ );
+
+ /************************/
+ /* Function 0x0e */
+ NTSTATUS samr_CreateDomAlias(
+ [in,ref] policy_handle *domain_handle,
+ [in,ref] lsa_String *alias_name,
+ [in] samr_AliasAccessMask access_mask,
+ [out,ref] policy_handle *alias_handle,
+ [out,ref] uint32 *rid
+ );
+
+ /************************/
+ /* Function 0x0f */
+ NTSTATUS samr_EnumDomainAliases(
+ [in] policy_handle *domain_handle,
+ [in,out,ref] uint32 *resume_handle,
+ [out,ref] samr_SamArray **sam,
+ [in] uint32 max_size,
+ [out,ref] uint32 *num_entries
+ );
+
+ /************************/
+ /* Function 0x10 */
+
+ typedef struct {
+ [range(0,1024)] uint32 count;
+ [size_is(count)] uint32 *ids;
+ } samr_Ids;
+
+ NTSTATUS samr_GetAliasMembership(
+ [in,ref] policy_handle *domain_handle,
+ [in,ref] lsa_SidArray *sids,
+ [out,ref] samr_Ids *rids
+ );
+
+ /************************/
+ /* Function 0x11 */
+
+ [public] NTSTATUS samr_LookupNames(
+ [in,ref] policy_handle *domain_handle,
+ [in,range(0,1000)] uint32 num_names,
+ [in,size_is(1000),length_is(num_names)] lsa_String names[],
+ [out,ref] samr_Ids *rids,
+ [out,ref] samr_Ids *types
+ );
+
+
+ /************************/
+ /* Function 0x12 */
+ NTSTATUS samr_LookupRids(
+ [in,ref] policy_handle *domain_handle,
+ [in,range(0,1000)] uint32 num_rids,
+ [in,size_is(1000),length_is(num_rids)] uint32 rids[],
+ [out,ref] lsa_Strings *names,
+ [out,ref] samr_Ids *types
+ );
+
+ /************************/
+ /* Function 0x13 */
+ NTSTATUS samr_OpenGroup(
+ [in,ref] policy_handle *domain_handle,
+ [in] samr_GroupAccessMask access_mask,
+ [in] uint32 rid,
+ [out,ref] policy_handle *group_handle
+ );
+
+ /************************/
+ /* Function 0x14 */
+
+ typedef struct {
+ lsa_String name;
+ security_GroupAttrs attributes;
+ uint32 num_members;
+ lsa_String description;
+ } samr_GroupInfoAll;
+
+ typedef struct {
+ security_GroupAttrs attributes;
+ } samr_GroupInfoAttributes;
+
+ typedef struct {
+ lsa_String description;
+ } samr_GroupInfoDescription;
+
+ typedef enum {
+ GROUPINFOALL = 1,
+ GROUPINFONAME = 2,
+ GROUPINFOATTRIBUTES = 3,
+ GROUPINFODESCRIPTION = 4,
+ GROUPINFOALL2 = 5
+ } samr_GroupInfoEnum;
+
+ typedef [switch_type(samr_GroupInfoEnum)] union {
+ [case(GROUPINFOALL)] samr_GroupInfoAll all;
+ [case(GROUPINFONAME)] lsa_String name;
+ [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes;
+ [case(GROUPINFODESCRIPTION)] lsa_String description;
+ [case(GROUPINFOALL2)] samr_GroupInfoAll all2;
+ } samr_GroupInfo;
+
+ NTSTATUS samr_QueryGroupInfo(
+ [in,ref] policy_handle *group_handle,
+ [in] samr_GroupInfoEnum level,
+ [out,ref,switch_is(level)] samr_GroupInfo **info
+ );
+
+ /************************/
+ /* Function 0x15 */
+ NTSTATUS samr_SetGroupInfo(
+ [in,ref] policy_handle *group_handle,
+ [in] samr_GroupInfoEnum level,
+ [in,switch_is(level),ref] samr_GroupInfo *info
+ );
+
+ /************************/
+ /* Function 0x16 */
+ NTSTATUS samr_AddGroupMember(
+ [in,ref] policy_handle *group_handle,
+ [in] uint32 rid,
+ [in] uint32 flags
+ );
+
+ /************************/
+ /* Function 0x17 */
+ NTSTATUS samr_DeleteDomainGroup(
+ [in,out,ref] policy_handle *group_handle
+ );
+
+ /************************/
+ /* Function 0x18 */
+ NTSTATUS samr_DeleteGroupMember(
+ [in,ref] policy_handle *group_handle,
+ [in] uint32 rid
+ );
+
+
+ /************************/
+ /* Function 0x19 */
+ typedef struct {
+ uint32 count;
+ [size_is(count)] uint32 *rids;
+ [size_is(count)] security_GroupAttrs *attributes;
+ } samr_RidAttrArray;
+
+ NTSTATUS samr_QueryGroupMember(
+ [in,ref] policy_handle *group_handle,
+ [out,ref] samr_RidAttrArray **rids
+ );
+
+
+ /************************/
+ /* Function 0x1a */
+
+ /*
+ win2003 seems to accept any data at all for the two integers
+ below, and doesn't seem to do anything with them that I can
+ see. Weird. I really expected the first integer to be a rid
+ and the second to be the attributes for that rid member.
+ */
+ NTSTATUS samr_SetMemberAttributesOfGroup(
+ [in,ref] policy_handle *group_handle,
+ [in] uint32 unknown1,
+ [in] uint32 unknown2
+ );
+
+
+ /************************/
+ /* Function 0x1b */
+ NTSTATUS samr_OpenAlias (
+ [in,ref] policy_handle *domain_handle,
+ [in] samr_AliasAccessMask access_mask,
+ [in] uint32 rid,
+ [out,ref] policy_handle *alias_handle
+ );
+
+
+ /************************/
+ /* Function 0x1c */
+
+ typedef struct {
+ lsa_String name;
+ uint32 num_members;
+ lsa_String description;
+ } samr_AliasInfoAll;
+
+ typedef enum {
+ ALIASINFOALL = 1,
+ ALIASINFONAME = 2,
+ ALIASINFODESCRIPTION = 3
+ } samr_AliasInfoEnum;
+
+ typedef [switch_type(samr_AliasInfoEnum)] union {
+ [case(ALIASINFOALL)] samr_AliasInfoAll all;
+ [case(ALIASINFONAME)] lsa_String name;
+ [case(ALIASINFODESCRIPTION)] lsa_String description;
+ } samr_AliasInfo;
+
+ NTSTATUS samr_QueryAliasInfo(
+ [in,ref] policy_handle *alias_handle,
+ [in] samr_AliasInfoEnum level,
+ [out,ref,switch_is(level)] samr_AliasInfo **info
+ );
+
+ /************************/
+ /* Function 0x1d */
+ NTSTATUS samr_SetAliasInfo(
+ [in,ref] policy_handle *alias_handle,
+ [in] samr_AliasInfoEnum level,
+ [in,switch_is(level),ref] samr_AliasInfo *info
+ );
+
+ /************************/
+ /* Function 0x1e */
+ NTSTATUS samr_DeleteDomAlias(
+ [in,out,ref] policy_handle *alias_handle
+ );
+
+ /************************/
+ /* Function 0x1f */
+ NTSTATUS samr_AddAliasMember(
+ [in,ref] policy_handle *alias_handle,
+ [in,ref] dom_sid2 *sid
+ );
+
+ /************************/
+ /* Function 0x20 */
+ NTSTATUS samr_DeleteAliasMember(
+ [in,ref] policy_handle *alias_handle,
+ [in,ref] dom_sid2 *sid
+ );
+
+ /************************/
+ /* Function 0x21 */
+ NTSTATUS samr_GetMembersInAlias(
+ [in,ref] policy_handle *alias_handle,
+ [out,ref] lsa_SidArray *sids
+ );
+
+ /************************/
+ /* Function 0x22 */
+ [public] NTSTATUS samr_OpenUser(
+ [in,ref] policy_handle *domain_handle,
+ [in] samr_UserAccessMask access_mask,
+ [in] uint32 rid,
+ [out,ref] policy_handle *user_handle
+ );
+
+ /************************/
+ /* Function 0x23 */
+ NTSTATUS samr_DeleteUser(
+ [in,out,ref] policy_handle *user_handle
+ );
+
+ /************************/
+ /* Function 0x24 */
+
+ typedef enum {
+ UserGeneralInformation = 1,
+ UserPreferencesInformation = 2,
+ UserLogonInformation = 3,
+ UserLogonHoursInformation = 4,
+ UserAccountInformation = 5,
+ UserNameInformation = 6,
+ UserAccountNameInformation = 7,
+ UserFullNameInformation = 8,
+ UserPrimaryGroupInformation = 9,
+ UserHomeInformation = 10,
+ UserScriptInformation = 11,
+ UserProfileInformation = 12,
+ UserAdminCommentInformation = 13,
+ UserWorkStationsInformation = 14,
+ UserControlInformation = 16,
+ UserExpiresInformation = 17,
+ UserInternal1Information = 18,
+ UserParametersInformation = 20,
+ UserAllInformation = 21,
+ UserInternal4Information = 23,
+ UserInternal5Information = 24,
+ UserInternal4InformationNew = 25,
+ UserInternal5InformationNew = 26,
+ UserInternal7InformationNew = 31,
+ UserInternal8InformationNew = 32
+ } samr_UserInfoLevel;
+
+ typedef struct {
+ lsa_String account_name;
+ lsa_String full_name;
+ uint32 primary_gid;
+ lsa_String description;
+ lsa_String comment;
+ } samr_UserInfo1;
+
+ typedef struct {
+ lsa_String comment;
+ lsa_String reserved; /* settable, but doesn't stick. probably obsolete */
+ uint16 country_code;
+ uint16 code_page;
+ } samr_UserInfo2;
+
+ /* this is also used in samr and netlogon */
+ typedef [public, flag(NDR_PAHEX)] struct {
+ uint16 units_per_week;
+ [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
+ } samr_LogonHours;
+
+ typedef struct {
+ lsa_String account_name;
+ lsa_String full_name;
+ uint32 rid;
+ uint32 primary_gid;
+ lsa_String home_directory;
+ lsa_String home_drive;
+ lsa_String logon_script;
+ lsa_String profile_path;
+ lsa_String workstations;
+ NTTIME last_logon;
+ NTTIME last_logoff;
+ NTTIME last_password_change;
+ NTTIME allow_password_change;
+ NTTIME force_password_change;
+ samr_LogonHours logon_hours;
+ uint16 bad_password_count;
+ uint16 logon_count;
+ samr_AcctFlags acct_flags;
+ } samr_UserInfo3;
+
+ typedef struct {
+ samr_LogonHours logon_hours;
+ } samr_UserInfo4;
+
+ typedef struct {
+ lsa_String account_name;
+ lsa_String full_name;
+ uint32 rid;
+ uint32 primary_gid;
+ lsa_String home_directory;
+ lsa_String home_drive;
+ lsa_String logon_script;
+ lsa_String profile_path;
+ lsa_String description;
+ lsa_String workstations;
+ NTTIME last_logon;
+ NTTIME last_logoff;
+ samr_LogonHours logon_hours;
+ uint16 bad_password_count;
+ uint16 logon_count;
+ NTTIME last_password_change;
+ NTTIME acct_expiry;
+ samr_AcctFlags acct_flags;
+ } samr_UserInfo5;
+
+ typedef struct {
+ lsa_String account_name;
+ lsa_String full_name;
+ } samr_UserInfo6;
+
+ typedef struct {
+ lsa_String account_name;
+ } samr_UserInfo7;
+
+ typedef struct {
+ lsa_String full_name;
+ } samr_UserInfo8;
+
+ typedef struct {
+ uint32 primary_gid;
+ } samr_UserInfo9;
+
+ typedef struct {
+ lsa_String home_directory;
+ lsa_String home_drive;
+ } samr_UserInfo10;
+
+ typedef struct {
+ lsa_String logon_script;
+ } samr_UserInfo11;
+
+ typedef struct {
+ lsa_String profile_path;
+ } samr_UserInfo12;
+
+ typedef struct {
+ lsa_String description;
+ } samr_UserInfo13;
+
+ typedef struct {
+ lsa_String workstations;
+ } samr_UserInfo14;
+
+ typedef struct {
+ samr_AcctFlags acct_flags;
+ } samr_UserInfo16;
+
+ typedef struct {
+ NTTIME acct_expiry;
+ } samr_UserInfo17;
+
+ typedef [public, flag(NDR_PAHEX)] struct {
+ uint8 hash[16];
+ } samr_Password;
+
+ typedef struct {
+ samr_Password nt_pwd;
+ samr_Password lm_pwd;
+ boolean8 nt_pwd_active;
+ boolean8 lm_pwd_active;
+ uint8 password_expired;
+ } samr_UserInfo18;
+
+ typedef struct {
+ lsa_BinaryString parameters;
+ } samr_UserInfo20;
+
+ /* this defines the bits used for fields_present in info21 */
+ typedef [bitmap32bit] bitmap {
+ SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
+ SAMR_FIELD_FULL_NAME = 0x00000002,
+ SAMR_FIELD_RID = 0x00000004,
+ SAMR_FIELD_PRIMARY_GID = 0x00000008,
+ SAMR_FIELD_DESCRIPTION = 0x00000010,
+ SAMR_FIELD_COMMENT = 0x00000020,
+ SAMR_FIELD_HOME_DIRECTORY = 0x00000040,
+ SAMR_FIELD_HOME_DRIVE = 0x00000080,
+ SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
+ SAMR_FIELD_PROFILE_PATH = 0x00000200,
+ SAMR_FIELD_WORKSTATIONS = 0x00000400,
+ SAMR_FIELD_LAST_LOGON = 0x00000800,
+ SAMR_FIELD_LAST_LOGOFF = 0x00001000,
+ SAMR_FIELD_LOGON_HOURS = 0x00002000,
+ SAMR_FIELD_BAD_PWD_COUNT = 0x00004000,
+ SAMR_FIELD_NUM_LOGONS = 0x00008000,
+ SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
+ SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
+ SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000,
+ SAMR_FIELD_ACCT_EXPIRY = 0x00080000,
+ SAMR_FIELD_ACCT_FLAGS = 0x00100000,
+ SAMR_FIELD_PARAMETERS = 0x00200000,
+ SAMR_FIELD_COUNTRY_CODE = 0x00400000,
+ SAMR_FIELD_CODE_PAGE = 0x00800000,
+ SAMR_FIELD_NT_PASSWORD_PRESENT = 0x01000000, /* either of these */
+ SAMR_FIELD_LM_PASSWORD_PRESENT = 0x02000000, /* two bits seems to work */
+ SAMR_FIELD_PRIVATE_DATA = 0x04000000,
+ SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
+ SAMR_FIELD_SEC_DESC = 0x10000000,
+ SAMR_FIELD_OWF_PWD = 0x20000000
+ } samr_FieldsPresent;
+
+ /* used for 'password_expired' in samr_UserInfo21 */
+ const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01;
+ const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00;
+
+ typedef struct {
+ NTTIME last_logon;
+ NTTIME last_logoff;
+ NTTIME last_password_change;
+ NTTIME acct_expiry;
+ NTTIME allow_password_change;
+ NTTIME force_password_change;
+ lsa_String account_name;
+ lsa_String full_name;
+ lsa_String home_directory;
+ lsa_String home_drive;
+ lsa_String logon_script;
+ lsa_String profile_path;
+ lsa_String description;
+ lsa_String workstations;
+ lsa_String comment;
+ lsa_BinaryString parameters;
+ lsa_BinaryString lm_owf_password;
+ lsa_BinaryString nt_owf_password;
+ lsa_String private_data;
+ uint32 buf_count;
+ [size_is(buf_count)] uint8 *buffer;
+ uint32 rid;
+ uint32 primary_gid;
+ samr_AcctFlags acct_flags;
+ samr_FieldsPresent fields_present;
+ samr_LogonHours logon_hours;
+ uint16 bad_password_count;
+ uint16 logon_count;
+ uint16 country_code;
+ uint16 code_page;
+ uint8 lm_password_set;
+ uint8 nt_password_set;
+ uint8 password_expired;
+ uint8 private_data_sensitive;
+ } samr_UserInfo21;
+
+ typedef [public, flag(NDR_PAHEX)] struct {
+ uint8 data[516];
+ } samr_CryptPassword;
+
+ typedef struct {
+ samr_UserInfo21 info;
+ samr_CryptPassword password;
+ } samr_UserInfo23;
+
+ typedef struct {
+ samr_CryptPassword password;
+ uint8 password_expired;
+ } samr_UserInfo24;
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint8 data[532];
+ } samr_CryptPasswordEx;
+
+ typedef struct {
+ samr_UserInfo21 info;
+ samr_CryptPasswordEx password;
+ } samr_UserInfo25;
+
+ typedef struct {
+ samr_CryptPasswordEx password;
+ uint8 password_expired;
+ } samr_UserInfo26;
+
+ typedef struct {
+ uint8 auth_data[64];
+ uint8 salt[16];
+ uint32 cipher_len;
+ [size_is(cipher_len)] uint8 *cipher;
+ hyper PBKDF2Iterations;
+ } samr_EncryptedPasswordAES;
+
+ typedef struct {
+ samr_EncryptedPasswordAES password;
+ uint8 password_expired;
+ } samr_UserInfo31;
+
+ typedef struct {
+ samr_UserInfo21 info;
+ samr_EncryptedPasswordAES password;
+ } samr_UserInfo32;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] samr_UserInfo1 info1;
+ [case(2)] samr_UserInfo2 info2;
+ [case(3)] samr_UserInfo3 info3;
+ [case(4)] samr_UserInfo4 info4;
+ [case(5)] samr_UserInfo5 info5;
+ [case(6)] samr_UserInfo6 info6;
+ [case(7)] samr_UserInfo7 info7;
+ [case(8)] samr_UserInfo8 info8;
+ [case(9)] samr_UserInfo9 info9;
+ [case(10)] samr_UserInfo10 info10;
+ [case(11)] samr_UserInfo11 info11;
+ [case(12)] samr_UserInfo12 info12;
+ [case(13)] samr_UserInfo13 info13;
+ [case(14)] samr_UserInfo14 info14;
+ [case(16)] samr_UserInfo16 info16;
+ [case(17)] samr_UserInfo17 info17;
+ [case(18)] samr_UserInfo18 info18;
+ [case(20)] samr_UserInfo20 info20;
+ [case(21)] samr_UserInfo21 info21;
+ [case(23)] samr_UserInfo23 info23;
+ [case(24)] samr_UserInfo24 info24;
+ [case(25)] samr_UserInfo25 info25;
+ [case(26)] samr_UserInfo26 info26;
+ [case(31)] samr_UserInfo31 info31;
+ [case(32)] samr_UserInfo32 info32;
+ } samr_UserInfo;
+
+ [public] NTSTATUS samr_QueryUserInfo(
+ [in,ref] policy_handle *user_handle,
+ [in] samr_UserInfoLevel level,
+ [out,ref,switch_is(level)] samr_UserInfo **info
+ );
+
+
+ /************************/
+ /* Function 0x25 */
+ [public] NTSTATUS samr_SetUserInfo(
+ [in,ref] policy_handle *user_handle,
+ [in] samr_UserInfoLevel level,
+ [in,ref,switch_is(level)] samr_UserInfo *info
+ );
+
+ /************************/
+ /* Function 0x26 */
+ /*
+ this is a password change interface that doesn't give
+ the server the plaintext password. Depricated.
+ */
+ NTSTATUS samr_ChangePasswordUser(
+ [in,ref] policy_handle *user_handle,
+ [in] boolean8 lm_present,
+ [in,unique] samr_Password *old_lm_crypted,
+ [in,unique] samr_Password *new_lm_crypted,
+ [in] boolean8 nt_present,
+ [in,unique] samr_Password *old_nt_crypted,
+ [in,unique] samr_Password *new_nt_crypted,
+ [in] boolean8 cross1_present,
+ [in,unique] samr_Password *nt_cross,
+ [in] boolean8 cross2_present,
+ [in,unique] samr_Password *lm_cross
+ );
+
+ /************************/
+ /* Function 0x27 */
+
+ typedef [public] struct {
+ uint32 rid;
+ security_GroupAttrs attributes;
+ } samr_RidWithAttribute;
+
+ typedef [public] struct {
+ uint32 count;
+ [size_is(count)] samr_RidWithAttribute *rids;
+ } samr_RidWithAttributeArray;
+
+ NTSTATUS samr_GetGroupsForUser(
+ [in,ref] policy_handle *user_handle,
+ [out,ref] samr_RidWithAttributeArray **rids
+ );
+
+ /************************/
+ /* Function 0x28 */
+
+ typedef struct {
+ uint32 idx;
+ uint32 rid;
+ samr_AcctFlags acct_flags;
+ lsa_String account_name;
+ lsa_String description;
+ lsa_String full_name;
+ } samr_DispEntryGeneral;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] samr_DispEntryGeneral *entries;
+ } samr_DispInfoGeneral;
+
+ typedef struct {
+ uint32 idx;
+ uint32 rid;
+ samr_AcctFlags acct_flags;
+ lsa_String account_name;
+ lsa_String description;
+ } samr_DispEntryFull;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] samr_DispEntryFull *entries;
+ } samr_DispInfoFull;
+
+ typedef struct {
+ uint32 idx;
+ uint32 rid;
+ security_GroupAttrs acct_flags;
+ lsa_String account_name;
+ lsa_String description;
+ } samr_DispEntryFullGroup;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] samr_DispEntryFullGroup *entries;
+ } samr_DispInfoFullGroups;
+
+ typedef struct {
+ uint32 idx;
+ lsa_AsciiStringLarge account_name;
+ } samr_DispEntryAscii;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] samr_DispEntryAscii *entries;
+ } samr_DispInfoAscii;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] samr_DispInfoGeneral info1;/* users */
+ [case(2)] samr_DispInfoFull info2; /* trust accounts? */
+ [case(3)] samr_DispInfoFullGroups info3; /* groups */
+ [case(4)] samr_DispInfoAscii info4; /* users */
+ [case(5)] samr_DispInfoAscii info5; /* groups */
+ } samr_DispInfo;
+
+ NTSTATUS samr_QueryDisplayInfo(
+ [in,ref] policy_handle *domain_handle,
+ [in] uint16 level,
+ [in] uint32 start_idx,
+ [in] uint32 max_entries,
+ [in] uint32 buf_size,
+ [out,ref] uint32 *total_size,
+ [out,ref] uint32 *returned_size,
+ [out,ref,switch_is(level)] samr_DispInfo *info
+ );
+
+
+ /************************/
+ /* Function 0x29 */
+
+ /*
+ this seems to be an alphabetic search function. The returned index
+ is the index for samr_QueryDisplayInfo needed to get names occurring
+ after the specified name. The supplied name does not need to exist
+ in the database (for example you can supply just a first letter for
+ searching starting at that letter)
+
+ The level corresponds to the samr_QueryDisplayInfo level
+ */
+ NTSTATUS samr_GetDisplayEnumerationIndex(
+ [in,ref] policy_handle *domain_handle,
+ [in] uint16 level,
+ [in,ref] lsa_String *name,
+ [out,ref] uint32 *idx
+ );
+
+
+
+ /************************/
+ /* Function 0x2a */
+
+ /*
+ w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
+ */
+ NTSTATUS samr_TestPrivateFunctionsDomain(
+ [in,ref] policy_handle *domain_handle
+ );
+
+
+ /************************/
+ /* Function 0x2b */
+
+ /*
+ w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
+ */
+ NTSTATUS samr_TestPrivateFunctionsUser(
+ [in,ref] policy_handle *user_handle
+ );
+
+
+ /************************/
+ /* Function 0x2c */
+
+ typedef struct {
+ uint16 min_password_length;
+ samr_PasswordProperties password_properties;
+ } samr_PwInfo;
+
+ [public] NTSTATUS samr_GetUserPwInfo(
+ [in,ref] policy_handle *user_handle,
+ [out,ref] samr_PwInfo *info
+ );
+
+ /************************/
+ /* Function 0x2d */
+ NTSTATUS samr_RemoveMemberFromForeignDomain(
+ [in,ref] policy_handle *domain_handle,
+ [in,ref] dom_sid2 *sid
+ );
+
+ /************************/
+ /* Function 0x2e */
+
+ /*
+ how is this different from QueryDomainInfo ??
+ */
+ NTSTATUS samr_QueryDomainInfo2(
+ [in,ref] policy_handle *domain_handle,
+ [in] samr_DomainInfoClass level,
+ [out,ref,switch_is(level)] samr_DomainInfo **info
+ );
+
+ /************************/
+ /* Function 0x2f */
+
+ /*
+ how is this different from QueryUserInfo ??
+ */
+ NTSTATUS samr_QueryUserInfo2(
+ [in,ref] policy_handle *user_handle,
+ [in] samr_UserInfoLevel level,
+ [out,ref,switch_is(level)] samr_UserInfo **info
+ );
+
+ /************************/
+ /* Function 0x30 */
+
+ /*
+ how is this different from QueryDisplayInfo??
+ */
+ NTSTATUS samr_QueryDisplayInfo2(
+ [in,ref] policy_handle *domain_handle,
+ [in] uint16 level,
+ [in] uint32 start_idx,
+ [in] uint32 max_entries,
+ [in] uint32 buf_size,
+ [out,ref] uint32 *total_size,
+ [out,ref] uint32 *returned_size,
+ [out,ref,switch_is(level)] samr_DispInfo *info
+ );
+
+ /************************/
+ /* Function 0x31 */
+
+ /*
+ how is this different from GetDisplayEnumerationIndex ??
+ */
+ NTSTATUS samr_GetDisplayEnumerationIndex2(
+ [in,ref] policy_handle *domain_handle,
+ [in] uint16 level,
+ [in,ref] lsa_String *name,
+ [out,ref] uint32 *idx
+ );
+
+
+ /************************/
+ /* Function 0x32 */
+ NTSTATUS samr_CreateUser2(
+ [in,ref] policy_handle *domain_handle,
+ [in,ref] lsa_String *account_name,
+ [in] samr_AcctFlags acct_flags,
+ [in] samr_UserAccessMask access_mask,
+ [out,ref] policy_handle *user_handle,
+ [out,ref] uint32 *access_granted,
+ [out,ref] uint32 *rid
+ );
+
+
+ /************************/
+ /* Function 0x33 */
+
+ /*
+ another duplicate. There must be a reason ....
+ */
+ NTSTATUS samr_QueryDisplayInfo3(
+ [in,ref] policy_handle *domain_handle,
+ [in] uint16 level,
+ [in] uint32 start_idx,
+ [in] uint32 max_entries,
+ [in] uint32 buf_size,
+ [out,ref] uint32 *total_size,
+ [out,ref] uint32 *returned_size,
+ [out,ref,switch_is(level)] samr_DispInfo *info
+ );
+
+ /************************/
+ /* Function 0x34 */
+ NTSTATUS samr_AddMultipleMembersToAlias(
+ [in,ref] policy_handle *alias_handle,
+ [in,ref] lsa_SidArray *sids
+ );
+
+ /************************/
+ /* Function 0x35 */
+ NTSTATUS samr_RemoveMultipleMembersFromAlias(
+ [in,ref] policy_handle *alias_handle,
+ [in,ref] lsa_SidArray *sids
+ );
+
+ /************************/
+ /* Function 0x36 */
+
+ NTSTATUS samr_OemChangePasswordUser2(
+ [in,unique] lsa_AsciiString *server,
+ [in,ref] lsa_AsciiString *account,
+ [in,unique] samr_CryptPassword *password,
+ [in,unique] samr_Password *hash
+ );
+
+ /************************/
+ /* Function 0x37 */
+ NTSTATUS samr_ChangePasswordUser2(
+ [in,unique] lsa_String *server,
+ [in,ref] lsa_String *account,
+ [in,unique] samr_CryptPassword *nt_password,
+ [in,unique] samr_Password *nt_verifier,
+ [in] boolean8 lm_change,
+ [in,unique] samr_CryptPassword *lm_password,
+ [in,unique] samr_Password *lm_verifier
+ );
+
+ /************************/
+ /* Function 0x38 */
+ NTSTATUS samr_GetDomPwInfo(
+ [in,unique] lsa_String *domain_name,
+ [out,ref] samr_PwInfo *info
+ );
+
+ /************************/
+ /* Function 0x39 */
+ NTSTATUS samr_Connect2(
+ [in,unique,string,charset(UTF16)] uint16 *system_name,
+ [in] samr_ConnectAccessMask access_mask,
+ [out,ref] policy_handle *connect_handle
+ );
+
+ /************************/
+ /* Function 0x3a */
+ /*
+ seems to be an exact alias for samr_SetUserInfo()
+ */
+ [public] NTSTATUS samr_SetUserInfo2(
+ [in,ref] policy_handle *user_handle,
+ [in] samr_UserInfoLevel level,
+ [in,ref,switch_is(level)] samr_UserInfo *info
+ );
+
+ /************************/
+ /* Function 0x3b */
+ /*
+ this one is mysterious. I have a few guesses, but nothing working yet
+ */
+ NTSTATUS samr_SetBootKeyInformation(
+ [in,ref] policy_handle *connect_handle,
+ [in] uint32 unknown1,
+ [in] uint32 unknown2,
+ [in] uint32 unknown3
+ );
+
+ /************************/
+ /* Function 0x3c */
+ NTSTATUS samr_GetBootKeyInformation(
+ [in,ref] policy_handle *domain_handle,
+ [out,ref] uint32 *unknown
+ );
+
+ /************************/
+ /* Function 0x3d */
+ NTSTATUS samr_Connect3(
+ [in,unique,string,charset(UTF16)] uint16 *system_name,
+ /* this unknown value seems to be completely ignored by w2k3 */
+ [in] uint32 unknown,
+ [in] samr_ConnectAccessMask access_mask,
+ [out,ref] policy_handle *connect_handle
+ );
+
+ /************************/
+ /* Function 0x3e */
+
+ typedef [v1_enum] enum {
+ SAMR_CONNECT_PRE_W2K = 1,
+ SAMR_CONNECT_W2K = 2,
+ SAMR_CONNECT_AFTER_W2K = 3
+ } samr_ConnectVersion;
+
+ NTSTATUS samr_Connect4(
+ [in,unique,string,charset(UTF16)] uint16 *system_name,
+ [in] samr_ConnectVersion client_version,
+ [in] samr_ConnectAccessMask access_mask,
+ [out,ref] policy_handle *connect_handle
+ );
+
+ /************************/
+ /* Function 0x3f */
+
+ typedef [public,v1_enum] enum {
+ SAM_PWD_CHANGE_NO_ERROR = 0,
+ SAM_PWD_CHANGE_PASSWORD_TOO_SHORT = 1,
+ SAM_PWD_CHANGE_PWD_IN_HISTORY = 2,
+ SAM_PWD_CHANGE_USERNAME_IN_PASSWORD = 3,
+ SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD = 4,
+ SAM_PWD_CHANGE_NOT_COMPLEX = 5,
+ SAM_PWD_CHANGE_MACHINE_NOT_DEFAULT = 6,
+ SAM_PWD_CHANGE_FAILED_BY_FILTER = 7,
+ SAM_PWD_CHANGE_PASSWORD_TOO_LONG = 8
+ } samPwdChangeReason;
+
+ typedef struct {
+ samPwdChangeReason extendedFailureReason;
+ lsa_String filterModuleName;
+ } userPwdChangeFailureInformation;
+
+ [public] NTSTATUS samr_ChangePasswordUser3(
+ [in,unique] lsa_String *server,
+ [in,ref] lsa_String *account,
+ [in,unique] samr_CryptPassword *nt_password,
+ [in,unique] samr_Password *nt_verifier,
+ [in] boolean8 lm_change,
+ [in,unique] samr_CryptPassword *lm_password,
+ [in,unique] samr_Password *lm_verifier,
+ [in,unique] samr_CryptPassword *password3,
+ [out,ref] samr_DomInfo1 **dominfo,
+ [out,ref] userPwdChangeFailureInformation **reject
+ );
+
+ /************************/
+ /* Function 0x40 */
+
+ typedef [v1_enum] enum {
+ SAMR_CONNECT_FEATURE_RID_ONLY = 0x00000001,
+ SAMR_CONNECT_FEATURE_RESRVED1 = 0x00000002,
+ SAMR_CONNECT_FEATURE_RESRVED2 = 0x00000004,
+ SAMR_CONNECT_FEATURE_USE_AES = 0x00000010
+ } samr_SupportedFeatures;
+
+ typedef struct {
+ samr_ConnectVersion client_version; /* w2k3 gives 3 */
+ samr_SupportedFeatures supported_features;
+ } samr_ConnectInfo1;
+
+ typedef union {
+ [case(1)] samr_ConnectInfo1 info1;
+ } samr_ConnectInfo;
+
+ [public] NTSTATUS samr_Connect5(
+ [in,unique,string,charset(UTF16)] uint16 *system_name,
+ [in] samr_ConnectAccessMask access_mask,
+ [in] uint32 level_in,
+ [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in,
+ [out,ref] uint32 *level_out,
+ [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out,
+ [out,ref] policy_handle *connect_handle
+ );
+
+ /************************/
+ /* Function 0x41 */
+ NTSTATUS samr_RidToSid(
+ [in,ref] policy_handle *domain_handle,
+ [in] uint32 rid,
+ [out,ref] dom_sid2 **sid
+ );
+
+ /************************/
+ /* Function 0x42 */
+
+ /*
+ this should set the DSRM password for the server, which is used
+ when booting into Directory Services Recovery Mode on a DC. Win2003
+ gives me NT_STATUS_NOT_SUPPORTED
+ */
+
+ NTSTATUS samr_SetDsrmPassword(
+ [in,unique] lsa_String *name,
+ [in] uint32 unknown,
+ [in,unique] samr_Password *hash
+ );
+
+
+ /************************/
+ /* Function 0x43 */
+ /************************/
+ typedef [bitmap32bit] bitmap {
+ SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001,
+ SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002,
+ SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004,
+ SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008,
+ SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010,
+ SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020
+ } samr_ValidateFieldsPresent;
+
+ typedef enum {
+ NetValidateAuthentication = 1,
+ NetValidatePasswordChange= 2,
+ NetValidatePasswordReset = 3
+ } samr_ValidatePasswordLevel;
+
+ /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
+ * identified the mapping of
+ * - NERR_PasswordFilterError
+ * - NERR_PasswordExpired and
+ * - NERR_PasswordCantChange
+ * yet - Guenther
+ */
+
+ typedef enum {
+ SAMR_VALIDATION_STATUS_SUCCESS = 0,
+ SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
+ SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
+ SAMR_VALIDATION_STATUS_PASSWORD_EXPIRED = 3,
+ SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
+ SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
+ SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
+ SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
+ SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
+ SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9,
+ SAMR_VALIDATION_STATUS_PASSWORD_FILTER_ERROR = 10
+ } samr_ValidationStatus;
+
+ typedef struct {
+ uint32 length;
+ [size_is(length)] uint8 *data;
+ } samr_ValidationBlob;
+
+ typedef struct {
+ samr_ValidateFieldsPresent fields_present;
+ NTTIME_hyper last_password_change;
+ NTTIME_hyper bad_password_time;
+ NTTIME_hyper lockout_time;
+ uint32 bad_pwd_count;
+ uint32 pwd_history_len;
+ [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
+ } samr_ValidatePasswordInfo;
+
+ typedef struct {
+ samr_ValidatePasswordInfo info;
+ samr_ValidationStatus status;
+ } samr_ValidatePasswordRepCtr;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] samr_ValidatePasswordRepCtr ctr1;
+ [case(2)] samr_ValidatePasswordRepCtr ctr2;
+ [case(3)] samr_ValidatePasswordRepCtr ctr3;
+ } samr_ValidatePasswordRep;
+
+ typedef struct {
+ samr_ValidatePasswordInfo info;
+ lsa_StringLarge password;
+ lsa_StringLarge account;
+ samr_ValidationBlob hash;
+ boolean8 pwd_must_change_at_next_logon;
+ boolean8 clear_lockout;
+ } samr_ValidatePasswordReq3;
+
+ typedef struct {
+ samr_ValidatePasswordInfo info;
+ lsa_StringLarge password;
+ lsa_StringLarge account;
+ samr_ValidationBlob hash;
+ boolean8 password_matched;
+ } samr_ValidatePasswordReq2;
+
+ typedef struct {
+ samr_ValidatePasswordInfo info;
+ boolean8 password_matched;
+ } samr_ValidatePasswordReq1;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] samr_ValidatePasswordReq1 req1;
+ [case(2)] samr_ValidatePasswordReq2 req2;
+ [case(3)] samr_ValidatePasswordReq3 req3;
+ } samr_ValidatePasswordReq;
+
+ NTSTATUS samr_ValidatePassword(
+ [in] samr_ValidatePasswordLevel level,
+ [in,switch_is(level)] samr_ValidatePasswordReq *req,
+ [out,ref,switch_is(level)] samr_ValidatePasswordRep **rep
+ );
+
+ /************************/
+ /* Function 0x44 */
+ /************************/
+ [todo] void samr_Opnum68NotUsedOnWire(void);
+
+ /************************/
+ /* Function 0x45 */
+ /************************/
+ [todo] void samr_Opnum69NotUsedOnWire(void);
+
+ /************************/
+ /* Function 0x46 */
+ /************************/
+ [todo] void samr_Opnum70NotUsedOnWire(void);
+
+ /************************/
+ /* Function 0x47 */
+ /************************/
+ [todo] void samr_Opnum71NotUsedOnWire(void);
+
+ /************************/
+ /* Function 0x48 */
+ /************************/
+ [todo] void samr_Opnum72NotUsedOnWire(void);
+
+ /************************/
+ /* Function 0x49 */
+ /************************/
+ [public] NTSTATUS samr_ChangePasswordUser4(
+ [in,unique] lsa_String *server,
+ [in,ref] lsa_String *account,
+ [in,ref] samr_EncryptedPasswordAES *password
+ );
+}
diff --git a/librpc/idl/scerpc.idl b/librpc/idl/scerpc.idl
new file mode 100644
index 0000000..2c3c4f8
--- /dev/null
+++ b/librpc/idl/scerpc.idl
@@ -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();
+}
+
diff --git a/librpc/idl/schannel.idl b/librpc/idl/schannel.idl
new file mode 100644
index 0000000..3bc8a92
--- /dev/null
+++ b/librpc/idl/schannel.idl
@@ -0,0 +1,113 @@
+#include "idl_types.h"
+
+/*
+ schannel structures
+*/
+
+import "netlogon.idl", "nbt.idl", "misc.idl", "security.idl";
+
+[
+ pointer_default(unique),
+ helper("../librpc/ndr/ndr_schannel.h", "../librpc/ndr/ndr_nbt.h")
+]
+interface schannel
+{
+ /* this structure is used internally in the NETLOGON server */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ netr_NegotiateFlags negotiate_flags;
+ uint8 session_key[16];
+ uint32 sequence;
+ netr_Credential seed;
+ netr_Credential client;
+ netr_Credential server;
+ netr_SchannelType secure_channel_type;
+ [string,charset(UTF8)] uint8 computer_name[];
+ [string,charset(UTF8)] uint8 account_name[];
+ dom_sid *sid;
+ } netlogon_creds_CredentialState;
+
+ /* This is used in the schannel_store.tdb */
+ typedef [public] struct {
+ [string,charset(UTF16)] uint16 *computer_name;
+ netr_Credential server_challenge;
+ netr_Credential client_challenge;
+ } netlogon_cache_entry;
+
+ /* MS-NRPC 2.2.1.3.1 NL_AUTH_MESSAGE */
+
+ typedef [v1_enum] enum {
+ NL_NEGOTIATE_REQUEST = 0x00000000,
+ NL_NEGOTIATE_RESPONSE = 0x00000001
+ } NL_AUTH_MESSAGE_TYPE;
+
+ typedef [bitmap32bit] bitmap {
+ NL_FLAG_OEM_NETBIOS_DOMAIN_NAME = 0x00000001,
+ NL_FLAG_OEM_NETBIOS_COMPUTER_NAME = 0x00000002,
+ NL_FLAG_UTF8_DNS_DOMAIN_NAME = 0x00000004,
+ NL_FLAG_UTF8_DNS_HOST_NAME = 0x00000008,
+ NL_FLAG_UTF8_NETBIOS_COMPUTER_NAME = 0x00000010
+ } NL_AUTH_MESSAGE_FLAGS;
+
+ typedef [public,nodiscriminant,noprint] union {
+ [case (NL_FLAG_OEM_NETBIOS_DOMAIN_NAME)] astring a;
+ [case (NL_FLAG_OEM_NETBIOS_COMPUTER_NAME)] astring a;
+ [case (NL_FLAG_UTF8_DNS_DOMAIN_NAME)] nbt_string u;
+ [case (NL_FLAG_UTF8_DNS_HOST_NAME)] nbt_string u;
+ [case (NL_FLAG_UTF8_NETBIOS_COMPUTER_NAME)] nbt_string u;
+ [default] ;
+ } NL_AUTH_MESSAGE_BUFFER;
+
+ typedef [public,nodiscriminant,noprint] union {
+ [case (NL_NEGOTIATE_RESPONSE)] uint32 dummy;
+ [default] ;
+ } NL_AUTH_MESSAGE_BUFFER_REPLY;
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ NL_AUTH_MESSAGE_TYPE MessageType;
+ NL_AUTH_MESSAGE_FLAGS Flags;
+ [switch_is(Flags & NL_FLAG_OEM_NETBIOS_DOMAIN_NAME)] NL_AUTH_MESSAGE_BUFFER oem_netbios_domain;
+ [switch_is(Flags & NL_FLAG_OEM_NETBIOS_COMPUTER_NAME)] NL_AUTH_MESSAGE_BUFFER oem_netbios_computer;
+ [switch_is(Flags & NL_FLAG_UTF8_DNS_DOMAIN_NAME)] NL_AUTH_MESSAGE_BUFFER utf8_dns_domain;
+ [switch_is(Flags & NL_FLAG_UTF8_DNS_HOST_NAME)] NL_AUTH_MESSAGE_BUFFER utf8_dns_host;
+ [switch_is(Flags & NL_FLAG_UTF8_NETBIOS_COMPUTER_NAME)] NL_AUTH_MESSAGE_BUFFER utf8_netbios_computer;
+ [switch_is(MessageType & NL_NEGOTIATE_RESPONSE)] NL_AUTH_MESSAGE_BUFFER_REPLY Buffer;
+ } NL_AUTH_MESSAGE;
+
+ /* MS-NRPC 2.2.1.3.2 NL_AUTH_SIGNATURE */
+
+ typedef enum {
+ NL_SIGN_HMAC_SHA256 = 0x0013,
+ NL_SIGN_HMAC_MD5 = 0x0077
+ } NL_SIGNATURE_ALGORITHM;
+
+ typedef enum {
+ NL_SEAL_AES128 = 0x001A,
+ NL_SEAL_RC4 = 0x007A,
+ NL_SEAL_NONE = 0xFFFF
+ } NL_SEAL_ALGORITHM;
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ [value(NL_SIGN_HMAC_MD5)] NL_SIGNATURE_ALGORITHM SignatureAlgorithm;
+ NL_SEAL_ALGORITHM SealAlgorithm;
+ uint16 Pad;
+ uint16 Flags;
+ uint8 SequenceNumber[8];
+ uint8 Checksum[8];
+ uint8 Confounder[8];
+ } NL_AUTH_SIGNATURE;
+
+ const int NL_AUTH_SIGNATURE_SIZE = 0x20;
+
+ /* MS-NRPC 2.2.1.3.3 NL_AUTH_SHA2_SIGNATURE */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ [value(NL_SIGN_HMAC_SHA256)] NL_SIGNATURE_ALGORITHM SignatureAlgorithm;
+ NL_SEAL_ALGORITHM SealAlgorithm;
+ uint16 Pad;
+ uint16 Flags;
+ uint8 SequenceNumber[8];
+ uint8 Checksum[32];
+ uint8 Confounder[8];
+ } NL_AUTH_SHA2_SIGNATURE;
+}
diff --git a/librpc/idl/security.cnf b/librpc/idl/security.cnf
new file mode 100644
index 0000000..37da8c7
--- /dev/null
+++ b/librpc/idl/security.cnf
@@ -0,0 +1 @@
+NOEMIT
diff --git a/librpc/idl/security.idl b/librpc/idl/security.idl
new file mode 100644
index 0000000..8cfdbf5
--- /dev/null
+++ b/librpc/idl/security.idl
@@ -0,0 +1,794 @@
+#include "idl_types.h"
+
+/*
+ security IDL structures
+*/
+
+import "misc.idl";
+
+/*
+ use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
+ just a dom sid, but with the sub_auths represented as a conformant
+ array. As with all in-structure conformant arrays, the array length
+ is placed before the start of the structure. That's what gives rise
+ to the extra num_auths elemenent. We don't want the Samba code to
+ have to bother with such esoteric NDR details, so its easier to just
+ define it as a dom_sid and use pidl magic to make it all work. It
+ just means you need to mark a sid as a "dom_sid2" in the IDL when you
+ know it is of the conformant array variety
+*/
+cpp_quote("#define dom_sid2 dom_sid")
+
+/* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
+cpp_quote("#define dom_sid28 dom_sid")
+
+/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */
+cpp_quote("#define dom_sid0 dom_sid")
+
+[
+ /*
+ * cbf7d408-2d6c-11e2-ae5b-0b5692790e18 just to make ndrdump happy
+ */
+ uuid("cbf7d408-2d6c-11e2-ae5b-0b5692790e18"),
+ version(0.0),
+ pyhelper("librpc/ndr/py_security.c"),
+ pointer_default(unique)
+]
+interface security
+{
+
+ typedef bitmap lsa_SystemAccessModeFlags lsa_SystemAccessModeFlags;
+
+ typedef [public,gensize,noprint,nosize,nopull,nopush] 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[15];
+ } dom_sid;
+ /*
+ 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;
+
+ /* invalid bits */
+ const int SEC_MASK_INVALID = 0x0ce0fe00;
+
+ /* 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;
+
+ /* rights granted by some specific privileges */
+ const int SEC_RIGHTS_PRIV_BACKUP = SEC_STD_READ_CONTROL |
+ SEC_FLAG_SYSTEM_SECURITY |
+ SEC_RIGHTS_FILE_READ |
+ SEC_DIR_TRAVERSE;
+
+ const int SEC_RIGHTS_PRIV_RESTORE = SEC_STD_WRITE_DAC |
+ SEC_STD_WRITE_OWNER |
+ SEC_FLAG_SYSTEM_SECURITY |
+ SEC_RIGHTS_FILE_WRITE |
+ SEC_DIR_ADD_FILE |
+ SEC_DIR_ADD_SUBDIR |
+ SEC_STD_DELETE;
+
+ /* combinations of standard masks. */
+ const int STANDARD_RIGHTS_ALL_ACCESS = SEC_STD_ALL; /* 0x001f0000 */
+ const int STANDARD_RIGHTS_MODIFY_ACCESS = SEC_STD_READ_CONTROL; /* 0x00020000 */
+ const int STANDARD_RIGHTS_EXECUTE_ACCESS = SEC_STD_READ_CONTROL; /* 0x00020000 */
+ const int STANDARD_RIGHTS_READ_ACCESS = SEC_STD_READ_CONTROL; /* 0x00020000 */
+ const int STANDARD_RIGHTS_WRITE_ACCESS =
+ (SEC_STD_WRITE_OWNER |
+ SEC_STD_WRITE_DAC |
+ SEC_STD_DELETE); /* 0x000d0000 */
+ const int STANDARD_RIGHTS_REQUIRED_ACCESS =
+ (SEC_STD_DELETE |
+ SEC_STD_READ_CONTROL |
+ SEC_STD_WRITE_DAC |
+ SEC_STD_WRITE_OWNER); /* 0x000f0000 */
+
+ /* generic->specific mappings for Directory Service objects */
+ /* directory specific part of GENERIC_ALL */
+ const int SEC_ADS_GENERIC_ALL_DS =
+ (SEC_STD_DELETE |
+ SEC_STD_WRITE_DAC |
+ SEC_STD_WRITE_OWNER |
+ SEC_ADS_CREATE_CHILD |
+ SEC_ADS_DELETE_CHILD |
+ SEC_ADS_DELETE_TREE |
+ SEC_ADS_CONTROL_ACCESS);
+ const int SEC_ADS_GENERIC_EXECUTE = SEC_STD_READ_CONTROL | SEC_ADS_LIST;
+ const int SEC_ADS_GENERIC_WRITE =
+ (SEC_STD_READ_CONTROL |
+ SEC_ADS_SELF_WRITE |
+ SEC_ADS_WRITE_PROP);
+ const int SEC_ADS_GENERIC_READ =
+ (SEC_STD_READ_CONTROL |
+ SEC_ADS_LIST |
+ SEC_ADS_READ_PROP |
+ SEC_ADS_LIST_OBJECT);
+ const int SEC_ADS_GENERIC_ALL =
+ (SEC_ADS_GENERIC_EXECUTE |
+ SEC_ADS_GENERIC_WRITE |
+ SEC_ADS_GENERIC_READ |
+ SEC_ADS_GENERIC_ALL_DS);
+
+ /***************************************************************/
+ /* WELL KNOWN SIDS */
+
+ /* a NULL sid */
+ const string SID_NULL = "S-1-0-0";
+
+ /* the world domain */
+ const string NAME_WORLD = "WORLD";
+
+ 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";
+ const string SID_OWNER_RIGHTS = "S-1-3-4";
+
+ /* SECURITY_NT_AUTHORITY */
+ const string NAME_NT_AUTHORITY = "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_IUSR = "S-1-5-17";
+ 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";
+ const string SID_NT_DIGEST_AUTHENTICATION = "S-1-5-64-21";
+ const string SID_NT_NTLM_AUTHENTICATION = "S-1-5-64-10";
+ const string SID_NT_SCHANNEL_AUTHENTICATION = "S-1-5-64-14";
+ const string SID_NT_OTHER_ORGANISATION = "S-1-5-1000";
+
+ /* SECURITY_BUILTIN_DOMAIN_RID */
+ const string NAME_BUILTIN = "BUILTIN";
+
+ 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";
+ const string SID_BUILTIN_REMOTE_DESKTOP_USERS = "S-1-5-32-555";
+ const string SID_BUILTIN_NETWORK_CONF_OPERATORS = "S-1-5-32-556";
+ const string SID_BUILTIN_INCOMING_FOREST_TRUST = "S-1-5-32-557";
+ const string SID_BUILTIN_PERFMON_USERS = "S-1-5-32-558";
+ const string SID_BUILTIN_PERFLOG_USERS = "S-1-5-32-559";
+ const string SID_BUILTIN_AUTH_ACCESS = "S-1-5-32-560";
+ const string SID_BUILTIN_TS_LICENSE_SERVERS = "S-1-5-32-561";
+ const string SID_BUILTIN_DISTRIBUTED_COM_USERS = "S-1-5-32-562";
+ const string SID_BUILTIN_IUSERS = "S-1-5-32-568";
+ const string SID_BUILTIN_CRYPTO_OPERATORS = "S-1-5-32-569";
+ const string SID_BUILTIN_EVENT_LOG_READERS = "S-1-5-32-573";
+ const string SID_BUILTIN_CERT_SERV_DCOM_ACCESS = "S-1-5-32-574";
+ const string SID_BUILTIN_RDS_REMOTE_ACCESS_SERVERS = "S-1-5-32-575";
+ const string SID_BUILTIN_RDS_ENDPOINT_SERVERS = "S-1-5-32-576";
+ const string SID_BUILTIN_RDS_MANAGEMENT_SERVERS = "S-1-5-32-577";
+ const string SID_BUILTIN_HYPER_V_ADMINS = "S-1-5-32-578";
+ const string SID_BUILTIN_ACCESS_CONTROL_ASSISTANCE_OPS = "S-1-5-32-579";
+ const string SID_BUILTIN_REMOTE_MANAGEMENT_USERS = "S-1-5-32-580";
+ const string SID_BUILTIN_SYSTEM_MANAGED_ACCOUNTS_GRP = "S-1-5-32-581";
+ const string SID_BUILTIN_STORAGE_REPLICA_ADMINISTRATORS = "S-1-5-32-582";
+
+ const string SID_SECURITY_RESTRICTED_CODE = "S-1-5-33";
+
+ /* UID/GID mapping Samba style */
+ const string SID_SAMBA_UNIX_USER_OWNER = "S-1-22-1";
+ const string SID_SAMBA_UNIX_GROUP_OWNER = "S-1-22-2";
+
+ /* SECURITY_NT_SERVICE */
+ const string NAME_NT_SERVICE = "NT SERVICE";
+
+ const string SID_NT_NT_SERVICE = "S-1-5-80";
+ const string SID_NT_TRUSTED_INSTALLER =
+ "S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464";
+
+ /*
+ * This is added during the AS-REQ/AS-REP exchange after
+ * pre-authentication was successful.
+ */
+ const string SID_AUTHENTICATION_AUTHORITY_ASSERTED_IDENTITY = "S-1-18-1";
+ /*
+ * This is added during S4U2Self PAC creation.
+ *
+ * It won't replace a possible
+ * SID_AUTHENTICATION_AUTHORITY_ASSERTED_IDENTITY
+ * during S4U2Proxy.
+ */
+ const string SID_SERVICE_ASSERTED_IDENTITY = "S-1-18-2";
+
+ const string SID_COMPOUNDED_AUTHENTICATION = "S-1-5-21-0-0-0-496";
+ const string SID_CLAIMS_VALID = "S-1-5-21-0-0-0-497";
+
+ const string SID_USER_MODE_DRIVERS = "S-1-5-84-0-0-0-0-0";
+
+ const string SID_SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE = "S-1-15-2-1";
+
+ const string SID_SECURITY_MANDATORY_LOW = "S-1-16-4096";
+ const string SID_SECURITY_MANDATORY_MEDIUM = "S-1-16-8192";
+ const string SID_SECURITY_MANDATORY_MEDIUM_PLUS = "S-1-16-8448";
+ const string SID_SECURITY_MANDATORY_HIGH = "S-1-16-12288";
+ const string SID_SECURITY_MANDATORY_SYSTEM = "S-1-16-16384";
+
+ /*
+ * http://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx
+ */
+ const string SID_NT_NFS_SUBSYSTEM = "S-1-5-88";
+ const string SID_NT_NFS_USER = "S-1-5-88-1";
+ const string SID_NT_NFS_GROUP = "S-1-5-88-2";
+ const string SID_NT_NFS_MASK = "S-1-5-88-3";
+ const string SID_NT_NFS_OTHERS = "S-1-5-88-4";
+
+ /* well-known domain RIDs */
+ const int DOMAIN_RID_LOGON = 9;
+ const int DOMAIN_RID_ENTERPRISE_READONLY_DCS = 498;
+ const int DOMAIN_RID_ADMINISTRATOR = 500;
+ const int DOMAIN_RID_GUEST = 501;
+ const int DOMAIN_RID_KRBTGT = 502;
+ const int DOMAIN_RID_ADMINS = 512;
+ const int DOMAIN_RID_USERS = 513;
+ const int DOMAIN_RID_GUESTS = 514;
+ const int DOMAIN_RID_DOMAIN_MEMBERS = 515;
+ 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;
+ const int DOMAIN_RID_POLICY_ADMINS = 520;
+ const int DOMAIN_RID_READONLY_DCS = 521;
+ const int DOMAIN_RID_CLONEABLE_CONTROLLERS = 522;
+ const int DOMAIN_RID_PROTECTED_USERS = 525;
+ const int DOMAIN_RID_KEY_ADMINS = 526;
+ const int DOMAIN_RID_ENTERPRISE_KEY_ADMINS = 527;
+ const int DOMAIN_RID_RAS_SERVERS = 553;
+ const int DOMAIN_RID_RODC_ALLOW = 571;
+ const int DOMAIN_RID_RODC_DENY = 572;
+
+ /* well-known builtin RIDs */
+ const int BUILTIN_RID_ADMINISTRATORS = 544;
+ const int BUILTIN_RID_USERS = 545;
+ const int BUILTIN_RID_GUESTS = 546;
+ const int BUILTIN_RID_POWER_USERS = 547;
+ const int BUILTIN_RID_ACCOUNT_OPERATORS = 548;
+ const int BUILTIN_RID_SERVER_OPERATORS = 549;
+ const int BUILTIN_RID_PRINT_OPERATORS = 550;
+ const int BUILTIN_RID_BACKUP_OPERATORS = 551;
+ const int BUILTIN_RID_REPLICATOR = 552;
+ const int BUILTIN_RID_RAS_SERVERS = 553;
+ const int BUILTIN_RID_PRE_2K_ACCESS = 554;
+ const int BUILTIN_RID_REMOTE_DESKTOP_USERS = 555;
+ const int BUILTIN_RID_NETWORK_CONF_OPERATORS = 556;
+ const int BUILTIN_RID_INCOMING_FOREST_TRUST = 557;
+ const int BUILTIN_RID_PERFMON_USERS = 558;
+ const int BUILTIN_RID_PERFLOG_USERS = 559;
+ const int BUILTIN_RID_AUTH_ACCESS = 560;
+ const int BUILTIN_RID_TS_LICENSE_SERVERS = 561;
+ const int BUILTIN_RID_DISTRIBUTED_COM_USERS = 562;
+ const int BUILTIN_RID_IUSERS = 568;
+ const int BUILTIN_RID_CRYPTO_OPERATORS = 569;
+ const int BUILTIN_RID_EVENT_LOG_READERS = 573;
+ const int BUILTIN_RID_CERT_SERV_DCOM_ACCESS = 574;
+ const int BUILTIN_RID_RDS_REMOTE_ACCESS_SERVERS = 575;
+ const int BUILTIN_RID_RDS_ENDPOINT_SERVERS = 576;
+ const int BUILTIN_RID_RDS_MANAGEMENT_SERVERS = 577;
+ const int BUILTIN_RID_HYPER_V_ADMINS = 578;
+ const int BUILTIN_RID_ACCESS_CONTROL_ASSISTANCE_OPS = 579;
+ const int BUILTIN_RID_REMOTE_MANAGEMENT_USERS = 580;
+
+/********************************************************************
+ This is a list of privileges reported by a WIndows 2008 R2 DC
+ just for reference purposes (and I know the LUID is not guaranteed
+ across reboots):
+
+0x00000002 SeCreateTokenPrivilege "Create a token object"
+0x00000003 SeAssignPrimaryTokenPrivilege "Replace a process level token"
+0x00000004 SeLockMemoryPrivilege "Lock pages in memory"
+0x00000005 SeIncreaseQuotaPrivilege "Adjust memory quotas for a process"
+0x00000006 SeMachineAccountPrivilege "Add workstations to domain"
+0x00000007 SeTcbPrivilege "Act as part of the operating system"
+0x00000008 SeSecurityPrivilege "Manage auditing and security log"
+0x00000009 SeTakeOwnershipPrivilege "Take ownership of files or other objects"
+0x0000000a SeLoadDriverPrivilege "Load and unload device drivers"
+0x0000000b SeSystemProfilePrivilege "Profile system performance"
+0x0000000c SeSystemtimePrivilege "Change the system time"
+0x0000000d SeProfileSingleProcessPrivilege "Profile single process"
+0x0000000e SeIncreaseBasePriorityPrivilege "Increase scheduling priority"
+0x0000000f SeCreatePagefilePrivilege "Create a pagefile"
+0x00000010 SeCreatePermanentPrivilege "Create permanent shared objects"
+0x00000011 SeBackupPrivilege "Back up files and directories"
+0x00000012 SeRestorePrivilege "Restore files and directories"
+0x00000013 SeShutdownPrivilege "Shut down the system"
+0x00000014 SeDebugPrivilege "Debug programs"
+0x00000015 SeAuditPrivilege "Generate security audits"
+0x00000016 SeSystemEnvironmentPrivilege "Modify firmware environment values"
+0x00000017 SeChangeNotifyPrivilege "Bypass traverse checking"
+0x00000018 SeRemoteShutdownPrivilege "Force shutdown from a remote system"
+0x00000019 SeUndockPrivilege "Remove computer from docking station"
+0x0000001a SeSyncAgentPrivilege "Synchronize directory service data"
+0x0000001b SeEnableDelegationPrivilege "Enable computer and user accounts to be trusted for delegation"
+0x0000001c SeManageVolumePrivilege "Perform volume maintenance tasks"
+0x0000001d SeImpersonatePrivilege "Impersonate a client after authentication"
+0x0000001e SeCreateGlobalPrivilege "Create global objects"
+0x0000001f SeTrustedCredManAccessPrivilege "Access Credential Manager as a trusted caller"
+0x00000020 SeRelabelPrivilege "Modify an object label"
+0x00000021 SeIncreaseWorkingSetPrivilege "Increase a process working set"
+0x00000022 SeTimeZonePrivilege "Change the time zone"
+0x00000023 SeCreateSymbolicLinkPrivilege "Create symbolic links"
+
+ ********************************************************************/
+
+ /* LUID values for privileges known about by Samba (bottom 32 bits of enum, top bits are 0) */
+
+ /* we have to define the LUID here due to a horrible check by printmig.exe
+ that requires the SeBackupPrivilege match what is in Windows. So match
+ those that we implement and start Samba privileges at 0x1001 */
+
+ typedef enum {
+ SEC_PRIV_INVALID = 0x0,
+ SEC_PRIV_INCREASE_QUOTA = 0x5,
+ SEC_PRIV_MACHINE_ACCOUNT = 0x6,
+ SEC_PRIV_SECURITY = 0x8,
+ SEC_PRIV_TAKE_OWNERSHIP = 0x09,
+ SEC_PRIV_LOAD_DRIVER = 0x0a,
+ SEC_PRIV_SYSTEM_PROFILE = 0x0b,
+ SEC_PRIV_SYSTEMTIME = 0x0c,
+ SEC_PRIV_PROFILE_SINGLE_PROCESS = 0x0d,
+ SEC_PRIV_INCREASE_BASE_PRIORITY = 0x0e,
+ SEC_PRIV_CREATE_PAGEFILE = 0x0f,
+ SEC_PRIV_BACKUP = 0x11,
+ SEC_PRIV_RESTORE = 0x12,
+ SEC_PRIV_SHUTDOWN = 0x13,
+ SEC_PRIV_DEBUG = 0x14,
+ SEC_PRIV_SYSTEM_ENVIRONMENT = 0x16,
+ SEC_PRIV_CHANGE_NOTIFY = 0x17,
+ SEC_PRIV_REMOTE_SHUTDOWN = 0x18,
+ SEC_PRIV_UNDOCK = 0x19,
+ SEC_PRIV_ENABLE_DELEGATION = 0x1b,
+ SEC_PRIV_MANAGE_VOLUME = 0x1c,
+ SEC_PRIV_IMPERSONATE = 0x1d,
+ SEC_PRIV_CREATE_GLOBAL = 0x1e,
+ /* Samba-specific privs */
+ SEC_PRIV_PRINT_OPERATOR = 0x1001,
+ SEC_PRIV_ADD_USERS = 0x1002,
+ SEC_PRIV_DISK_OPERATOR = 0x1003
+ } sec_privilege;
+
+
+ /* Bitmap of privilege values for internal use only. We need
+ * our own bitmap here as privilages.tdb records these values
+ * as a bitmap (privilages.ldb uses the string forms).
+ */
+ typedef [bitmap64bit] bitmap {
+ SEC_PRIV_MACHINE_ACCOUNT_BIT = 0x00000010,
+
+ /* Samba-specific privs */
+ SEC_PRIV_PRINT_OPERATOR_BIT = 0x00000020,
+ SEC_PRIV_ADD_USERS_BIT = 0x00000040,
+ SEC_PRIV_DISK_OPERATOR_BIT = 0x00000080,
+
+ SEC_PRIV_REMOTE_SHUTDOWN_BIT = 0x00000100,
+ SEC_PRIV_BACKUP_BIT = 0x00000200,
+ SEC_PRIV_RESTORE_BIT = 0x00000400,
+ SEC_PRIV_TAKE_OWNERSHIP_BIT = 0x00000800,
+ /* End of privilages implemented before merge to common code */
+
+ SEC_PRIV_INCREASE_QUOTA_BIT = 0x00001000,
+ SEC_PRIV_SECURITY_BIT = 0x00002000,
+ SEC_PRIV_LOAD_DRIVER_BIT = 0x00004000,
+ SEC_PRIV_SYSTEM_PROFILE_BIT = 0x00008000,
+ SEC_PRIV_SYSTEMTIME_BIT = 0x00010000,
+ SEC_PRIV_PROFILE_SINGLE_PROCESS_BIT = 0x00020000,
+ SEC_PRIV_INCREASE_BASE_PRIORITY_BIT = 0x00040000,
+ SEC_PRIV_CREATE_PAGEFILE_BIT = 0x00080000,
+ SEC_PRIV_SHUTDOWN_BIT = 0x00100000,
+ SEC_PRIV_DEBUG_BIT = 0x00200000,
+ SEC_PRIV_SYSTEM_ENVIRONMENT_BIT = 0x00400000,
+ SEC_PRIV_CHANGE_NOTIFY_BIT = 0x00800000,
+ SEC_PRIV_UNDOCK_BIT = 0x01000000,
+ SEC_PRIV_ENABLE_DELEGATION_BIT = 0x02000000,
+ SEC_PRIV_MANAGE_VOLUME_BIT = 0x04000000,
+ SEC_PRIV_IMPERSONATE_BIT = 0x08000000,
+ SEC_PRIV_CREATE_GLOBAL_BIT = 0x10000000
+ } se_privilege;
+
+ typedef [bitmap32bit] bitmap {
+ LSA_POLICY_MODE_INTERACTIVE = 0x00000001,
+ LSA_POLICY_MODE_NETWORK = 0x00000002,
+ LSA_POLICY_MODE_BATCH = 0x00000004,
+ LSA_POLICY_MODE_SERVICE = 0x00000010,
+ LSA_POLICY_MODE_PROXY = 0x00000020,
+ LSA_POLICY_MODE_DENY_INTERACTIVE = 0x00000040,
+ LSA_POLICY_MODE_DENY_NETWORK = 0x00000080,
+ LSA_POLICY_MODE_DENY_BATCH = 0x00000100,
+ LSA_POLICY_MODE_DENY_SERVICE = 0x00000200,
+ LSA_POLICY_MODE_REMOTE_INTERACTIVE = 0x00000400,
+ LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE = 0x00000800,
+ LSA_POLICY_MODE_ALL = 0x00000FF7,
+ LSA_POLICY_MODE_ALL_NT4 = 0x00000037
+ } lsa_SystemAccessModeFlags;
+
+ typedef [public,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 [public,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 [bitmap32bit] 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 [public,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,nopull,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,2000)] uint32 num_aces;
+ security_ace aces[num_aces];
+ } security_acl;
+
+ /* default revision for new ACLs */
+ typedef [public,enum8bit] enum {
+ SECURITY_DESCRIPTOR_REVISION_1 = 1
+ } security_descriptor_revision;
+
+ const int SD_REVISION = SECURITY_DESCRIPTOR_REVISION_1;
+
+ /* security_descriptor->type bits */
+ typedef [public,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;
+
+ /* Group attributes, used to be samr_GroupAttrs */
+ typedef [public,bitmap32bit] bitmap {
+ SE_GROUP_MANDATORY = 0x00000001,
+ SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002,
+ SE_GROUP_ENABLED = 0x00000004,
+ SE_GROUP_OWNER = 0x00000008,
+ SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010,
+ SE_GROUP_INTEGRITY = 0x00000020,
+ SE_GROUP_INTEGRITY_ENABLED = 0x00000040,
+ SE_GROUP_RESOURCE = 0x20000000,
+ SE_GROUP_LOGON_ID = 0xC0000000
+ } security_GroupAttrs;
+
+ /* This is not yet sent over the network, but is simply defined in IDL */
+ typedef [public] struct {
+ uint32 num_sids;
+ [size_is(num_sids)] dom_sid sids[*];
+ se_privilege privilege_mask;
+ lsa_SystemAccessModeFlags rights_mask;
+ } security_token;
+
+ /* This is not yet sent over the network, but is simply defined in IDL */
+ typedef [public] struct {
+ uid_t uid;
+ gid_t gid;
+ uint32 ngroups;
+ [size_is(ngroups)] gid_t groups[*];
+ } security_unix_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,
+ SECINFO_LABEL = 0x00000010,
+ SECINFO_ATTRIBUTE = 0x00000020,
+ SECINFO_SCOPE = 0x00000040,
+ SECINFO_BACKUP = 0x00010000,
+ SECINFO_UNPROTECTED_SACL = 0x10000000,
+ SECINFO_UNPROTECTED_DACL = 0x20000000,
+ SECINFO_PROTECTED_SACL = 0x40000000,
+ SECINFO_PROTECTED_DACL = 0x80000000
+ } security_secinfo;
+
+ /*
+ * a SMB server should only support the following flags
+ * and ignore all others.
+ *
+ * See AdditionalInformation in [MS-SMB2] 2.2.37 SMB2 QUERY_INFO Request
+ * and 2.2.39 SMB2 SET_INFO Request.
+ */
+ const int SMB_SUPPORTED_SECINFO_FLAGS = (
+ SECINFO_OWNER |
+ SECINFO_GROUP |
+ SECINFO_DACL |
+ SECINFO_SACL |
+ SECINFO_LABEL |
+ SECINFO_ATTRIBUTE |
+ SECINFO_SCOPE |
+ SECINFO_BACKUP |
+ 0);
+
+ /*
+ * See [MS-KILE] 2.2.5 LSAP_TOKEN_INFO_INTEGRITY
+ */
+ typedef [public,gensize,flag(NDR_PAHEX)] struct {
+ uint32 Flags;
+ uint32 TokenIL;
+ uint8 MachineId[32];
+ } LSAP_TOKEN_INFO_INTEGRITY;
+
+ /*
+ * See [MS-KILE] 2.2.6 Supported Encryption Types Bit Flags
+ */
+ typedef [public,bitmap32bit] bitmap {
+ KERB_ENCTYPE_DES_CBC_CRC = 0x00000001,
+ KERB_ENCTYPE_DES_CBC_MD5 = 0x00000002,
+ KERB_ENCTYPE_RC4_HMAC_MD5 = 0x00000004,
+ KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96 = 0x00000008,
+ KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 = 0x00000010,
+ KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96_SK = 0x00000020,
+ KERB_ENCTYPE_FAST_SUPPORTED = 0x00010000,
+ KERB_ENCTYPE_COMPOUND_IDENTITY_SUPPORTED = 0x00020000,
+ KERB_ENCTYPE_CLAIMS_SUPPORTED = 0x00040000,
+ KERB_ENCTYPE_RESOURCE_SID_COMPRESSION_DISABLED = 0x00080000
+ } kerb_EncTypes;
+
+ typedef [public,bitmap32bit] bitmap {
+ SEC_DACL_AUTO_INHERIT = 0x00000001,
+ SEC_SACL_AUTO_INHERIT = 0x00000002,
+ SEC_DEFAULT_DESCRIPTOR = 0x00000004,
+ SEC_OWNER_FROM_PARENT = 0x00000008,
+ SEC_GROUP_FROM_PARENT = 0x00000010
+ } security_autoinherit;
+
+ /***************************************************************/
+ /* Extended right guids */
+
+ const string GUID_DRS_ALLOCATE_RIDS = "1abd7cf8-0a99-11d1-adbb-00c04fd8d5cd";
+ const string GUID_DRS_CHANGE_DOMAIN_MASTER = "014bf69c-7b3b-11d1-85f6-08002be74fab";
+ const string GUID_DRS_CHANGE_INFR_MASTER = "cc17b1fb-33d9-11d2-97d4-00c04fd8d5cd";
+ const string GUID_DRS_CHANGE_PDC = "bae50096-4752-11d1-9052-00c04fc2d4cf";
+ const string GUID_DRS_CHANGE_RID_MASTER = "d58d5f36-0a98-11d1-adbb-00c04fd8d5cd";
+ const string GUID_DRS_CHANGE_SCHEMA_MASTER = "e12b56b6-0a95-11d1-adbb-00c04fd8d5cd";
+ const string GUID_DRS_GET_CHANGES = "1131f6aa-9c07-11d1-f79f-00c04fc2dcd2";
+ const string GUID_DRS_REPL_SYNCRONIZE = "1131f6ab-9c07-11d1-f79f-00c04fc2dcd2";
+ const string GUID_DRS_MANAGE_TOPOLOGY = "1131f6ac-9c07-11d1-f79f-00c04fc2dcd2";
+ const string GUID_DRS_GET_ALL_CHANGES = "1131f6ad-9c07-11d1-f79f-00c04fc2dcd2";
+ const string GUID_DRS_RO_REPL_SECRET_SYNC = "1131f6ae-9c07-11d1-f79f-00c04fc2dcd2";
+ const string GUID_DRS_GET_FILTERED_ATTRIBUTES = "89e95b76-444d-4c62-991a-0facbeda640c";
+ const string GUID_DRS_MONITOR_TOPOLOGY = "f98340fb-7c5b-4cdb-a00b-2ebdfa115a96";
+ const string GUID_DRS_USER_CHANGE_PASSWORD = "ab721a53-1e2f-11d0-9819-00aa0040529b";
+ const string GUID_DRS_FORCE_CHANGE_PASSWORD = "00299570-246d-11d0-a768-00aa006e0529";
+ const string GUID_DRS_UPDATE_PASSWORD_NOT_REQUIRED_BIT
+ = "280f369c-67c7-438e-ae98-1d46f3c6f541";
+ const string GUID_DRS_UNEXPIRE_PASSWORD = "ccc2dc7d-a6ad-4a7a-8846-c04e3cc53501";
+ const string GUID_DRS_ENABLE_PER_USER_REVERSIBLY_ENCRYPTED_PASSWORD
+ = "05c74c5e-4deb-43b4-bd9f-86664c2a7fd5";
+ const string GUID_DRS_DS_INSTALL_REPLICA = "9923a32a-3607-11d2-b9be-0000f87a36b2";
+ const string GUID_DRS_REANIMATE_TOMBSTONE = "45ec5156-db7e-47bb-b53f-dbeb2d03c40f";
+ const string GUID_DRS_ALLOWED_TO_AUTHENTICATE = "68b1d179-0d15-4D4F-ab71-46152e79a7bc";
+
+ /***************************************************************/
+ /* validated writes guids */
+ const string GUID_DRS_VALIDATE_SPN = "f3a64788-5306-11d1-a9c5-0000f80367c1";
+ const string GUID_DRS_SELF_MEMBERSHIP = "bf9679c0-0de6-11d0-a285-00aa003049e2";
+ const string GUID_DRS_DNS_HOST_NAME = "72e39547-7b18-11d1-adef-00c04fd8d5cd";
+ const string GUID_DRS_ADD_DNS_HOST_NAME = "80863791-dbe9-4eb8-837e-7f0ab55d9ac7";
+ const string GUID_DRS_BEHAVIOR_VERSION = "d31a8757-2447-4545-8081-3bb610cacbf2";
+
+ /* A type to describe the mapping of generic access rights to object
+ specific access rights. */
+
+ typedef struct {
+ uint32 generic_read;
+ uint32 generic_write;
+ uint32 generic_execute;
+ uint32 generic_all;
+ } generic_mapping;
+
+ typedef struct {
+ uint32 std_read;
+ uint32 std_write;
+ uint32 std_execute;
+ uint32 std_all;
+ } standard_mapping;
+}
diff --git a/librpc/idl/server_id.idl b/librpc/idl/server_id.idl
new file mode 100644
index 0000000..8ebffc5
--- /dev/null
+++ b/librpc/idl/server_id.idl
@@ -0,0 +1,36 @@
+[
+ pointer_default(unique)
+]
+interface server_id
+{
+
+ /*
+ * Virtual Node Numbers are identifying a node within a cluster.
+ * Ctdbd sets this, we retrieve our vnn from it.
+ */
+
+ const uint32 NONCLUSTER_VNN = 0xFFFFFFFF;
+
+ /** Don't verify this unique id */
+ const hyper SERVERID_UNIQUE_ID_NOT_TO_VERIFY = 0xFFFFFFFFFFFFFFFFULL;
+
+ /* used to look like the following, note that unique_id was not
+ * marshalled at all...
+
+ struct server_id {
+ pid_t pid;
+ #ifdef CLUSTER_SUPPORT
+ uint32 vnn;
+ #endif
+ uint64_t unique_id;
+ };
+
+ */
+
+ typedef [public] struct {
+ hyper pid;
+ uint32 task_id;
+ uint32 vnn;
+ hyper unique_id;
+ } server_id;
+}
diff --git a/librpc/idl/smb2_lease_struct.idl b/librpc/idl/smb2_lease_struct.idl
new file mode 100644
index 0000000..5ccd8a3
--- /dev/null
+++ b/librpc/idl/smb2_lease_struct.idl
@@ -0,0 +1,34 @@
+#include "idl_types.h"
+
+/*
+ miscellaneous IDL structures
+*/
+
+[
+ pointer_default(unique)
+]
+interface smb2_lease_struct
+{
+ /*
+ * SMB2 lease structure (per MS-SMB2 2.2.13)
+ */
+ typedef [public] struct {
+ hyper data[2];
+ } smb2_lease_key;
+
+ typedef [public,bitmap32bit] bitmap {
+ SMB2_LEASE_READ = 0x01,
+ SMB2_LEASE_HANDLE = 0x02,
+ SMB2_LEASE_WRITE = 0x04
+ } smb2_lease_state;
+
+ typedef [public] struct {
+ smb2_lease_key lease_key;
+ smb2_lease_state lease_state;
+ uint32 lease_flags;
+ hyper lease_duration; /* should be 0 */
+ smb2_lease_key parent_lease_key;
+ uint16 lease_version;
+ uint16 lease_epoch;
+ } smb2_lease;
+}; \ No newline at end of file
diff --git a/librpc/idl/smb_acl.idl b/librpc/idl/smb_acl.idl
new file mode 100644
index 0000000..a7a76c9
--- /dev/null
+++ b/librpc/idl/smb_acl.idl
@@ -0,0 +1,96 @@
+/*
+ Unix SMB/CIFS implementation.
+ Portable SMB ACL interface
+ Copyright (C) Jeremy Allison 2000
+ Copyright (C) Andrew Bartlett 2012
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+/*
+ * Allow the smb_acl interface to be pushed into an NDR blob and
+ * read/written in python.
+ *
+ * The exact layout of these stuctures is CRITICAL, as a SHA-256 hash is
+ * taken over these after they are pushed as NDR blobs, and stored in an
+ * xattr for ACL verification.
+ */
+[
+ pointer_default(unique)
+]
+interface smb_acl
+{
+
+ const int SMB_ACL_READ = 4;
+ const int SMB_ACL_WRITE = 2;
+ const int SMB_ACL_EXECUTE = 1;
+
+ /* Types of ACLs. */
+ typedef enum {
+ SMB_ACL_TAG_INVALID = 0,
+ SMB_ACL_USER = 1,
+ SMB_ACL_USER_OBJ = 2,
+ SMB_ACL_GROUP = 3,
+ SMB_ACL_GROUP_OBJ = 4,
+ SMB_ACL_OTHER = 5,
+ SMB_ACL_MASK = 6
+ } smb_acl_tag_t;
+
+ typedef struct {
+ uid_t uid;
+ } smb_acl_user;
+
+ typedef struct {
+ gid_t gid;
+ } smb_acl_group;
+
+ typedef [switch_type(uint16)] union {
+ [case (SMB_ACL_USER)] smb_acl_user user;
+ [case (SMB_ACL_USER_OBJ)];
+ [case (SMB_ACL_GROUP)] smb_acl_group group;
+ [case (SMB_ACL_GROUP_OBJ)];
+ [case (SMB_ACL_OTHER)];
+ [case (SMB_ACL_MASK)];
+ } smb_acl_entry_info;
+
+ typedef struct {
+ smb_acl_tag_t a_type;
+ [switch_is(a_type)] smb_acl_entry_info info;
+ mode_t a_perm;
+ } smb_acl_entry;
+
+ [public] typedef struct {
+ int count;
+ [value(0)] int next;
+ [size_is(count)] smb_acl_entry acl[*];
+ } smb_acl_t;
+
+ const int SMB_ACL_FIRST_ENTRY = 0;
+ const int SMB_ACL_NEXT_ENTRY = 1;
+
+ const int SMB_ACL_TYPE_ACCESS = 0;
+ const int SMB_ACL_TYPE_DEFAULT = 1;
+
+ /* A wrapper of all the information required to reproduce an
+ * ACL, so we can hash it for the acl_xattr and acl_tdb
+ * modules */
+ [public] typedef struct {
+ smb_acl_t *access_acl;
+ smb_acl_t *default_acl; /* NULL on files */
+ uid_t owner;
+ gid_t group;
+ mode_t mode;
+ } smb_acl_wrapper;
+}
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
new file mode 100644
index 0000000..9569af0
--- /dev/null
+++ b/librpc/idl/spoolss.idl
@@ -0,0 +1,3566 @@
+#include "idl_types.h"
+
+/*
+ spoolss interface definitions
+*/
+import "misc.idl", "security.idl", "winreg.idl";
+
+
+cpp_quote("#define spoolss_security_descriptor security_descriptor")
+
+[ uuid("12345678-1234-abcd-ef00-0123456789ab"),
+ version(1.0),
+ endpoint("ncacn_np:[\\pipe\\spoolss]", "ncalrpc:"),
+ pointer_default(unique),
+ helpstring("Spooler SubSystem"),
+ helper("../librpc/ndr/ndr_spoolss_buf.h")
+] interface spoolss
+{
+ typedef [v1_enum] enum winreg_Type winreg_Type;
+ typedef [gensize,noprint] struct {
+ uint16 year;
+ uint16 month;
+ uint16 day_of_week;
+ uint16 day;
+ uint16 hour;
+ uint16 minute;
+ uint16 second;
+ uint16 millisecond;
+ } spoolss_Time;
+
+ typedef [public] struct {
+ [value(ndr_size_spoolss_Time(time, ndr->flags))] uint32 size;
+ [unique] spoolss_Time *time;
+ } spoolss_TimeCtr;
+
+ typedef enum {
+ PROCESSOR_ARCHITECTURE_INTEL = 0x0000,
+ PROCESSOR_ARCHITECTURE_MIPS = 0x0001,
+ PROCESSOR_ARCHITECTURE_ALPHA = 0x0002,
+ PROCESSOR_ARCHITECTURE_PPC = 0x0003,
+ PROCESSOR_ARCHITECTURE_SHX = 0x0004,
+ PROCESSOR_ARCHITECTURE_ARM = 0x0005,
+ PROCESSOR_ARCHITECTURE_IA64 = 0x0006,
+ PROCESSOR_ARCHITECTURE_ALPHA64 = 0x0007,
+ PROCESSOR_ARCHITECTURE_MSIL = 0x0008,
+ PROCESSOR_ARCHITECTURE_AMD64 = 0x0009,
+ PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 0x000A, /* 10 */
+ PROCESSOR_ARCHITECTURE_NEUTRAL = 0x000B, /* 11 */
+ PROCESSOR_ARCHITECTURE_ARM64 = 0x000C, /* 12 */
+ PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 = 0x000D, /* 13 */
+ PROCESSOR_ARCHITECTURE_IA32_ON_ARM64 = 0x000E, /* 14 */
+ PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF
+ } spoolss_ProcessorArchitecture;
+
+ typedef [v1_enum] enum {
+ PROCESSOR_INTEL_386 = 0x00000182, /* 386 */
+ PROCESSOR_INTEL_486 = 0x000001E6, /* 486 */
+ PROCESSOR_INTEL_PENTIUM = 0x0000024A, /* 586 */
+ PROCESSOR_INTEL_860 = 0x0000035C, /* 860 */
+ PROCESSOR_INTEL_IA64 = 0x00000898, /* 2200 */
+ PROCESSOR_AMD_X8664 = 0x000021D8, /* 8664 */
+ PROCESSOR_MIPS_R2000 = 0x000007D0, /* 2000 */
+ PROCESSOR_MIPS_R3000 = 0x00000BB8, /* 3000 */
+ PROCESSOR_ALPHA_21064 = 0x00005248, /* 21064 */
+ PROCESSOR_PPC_601 = 0x00000259, /* 601 */
+ PROCESSOR_PPC_603 = 0x0000025B, /* 603 */
+ PROCESSOR_PPC_604 = 0x0000025C, /* 604 */
+ PROCESSOR_PPC_620 = 0x0000026C, /* 620 */
+ PROCESSOR_HITACHI_SH3 = 0x00002713, /* 10003 */
+ PROCESSOR_HITACHI_SH3E = 0x00002714, /* 10004 */
+ PROCESSOR_HITACHI_SH4 = 0x00002715, /* 10005 */
+ PROCESSOR_MOTOROLA_821 = 0x00000335, /* 821 */
+ PROCESSOR_STRONGARM = 0x00000A11, /* 2577 */
+ PROCESSOR_ARM720 = 0x00000720, /* 1824 */
+ PROCESSOR_ARM820 = 0x00000820, /* 2080 */
+ PROCESSOR_ARM920 = 0x00000920, /* 2336 */
+ PROCESSOR_ARM_7TDMI = 0x00011171, /* 70001 */
+ PROCESSOR_OPTIL = 0x0000494F /* 18767 */
+ } spoolss_ProcessorType;
+
+ typedef [v1_enum] enum {
+ /* Windows 95, Windows 98, Windows Me, Windows NT4 */
+ SPOOLSS_MAJOR_VERSION_NT4_95_98_ME = 0x00000004,
+ /* Windows 2000, Windows 2003, Windows XP */
+ SPOOLSS_MAJOR_VERSION_2000_2003_XP = 0x00000005,
+ /* Windows Vista, Windows 2008 */
+ SPOOLSS_MAJOR_VERSION_2008_VISTA = 0x00000006
+ } spoolss_MajorVersion;
+
+ typedef [v1_enum] enum {
+ /* Windows 2008, Windows Vista, Windows 2000, Windows NT4, Windows 95 */
+ SPOOLSS_MINOR_VERSION_0 = 0x00000000,
+ /* Windows XP */
+ SPOOLSS_MINOR_VERSION_XP = 0x00000001,
+ /* Windows 2003, Windows XP x64 */
+ SPOOLSS_MINOR_VERSION_2003_XP64 = 0x00000002,
+ /* Windows 98 */
+ SPOOLSS_MINOR_VERSION_98 = 0x0000000a,
+ /* Windows Me */
+ SPOOLSS_MINOR_VERSION_ME = 0x0000005a
+ } spoolss_MinorVersion;
+
+ const int PRINTER_STATUS_OK = 0x00000000;
+
+ typedef [public] bitmap {
+ PRINTER_STATUS_PAUSED = 0x00000001,
+ PRINTER_STATUS_ERROR = 0x00000002,
+ PRINTER_STATUS_PENDING_DELETION = 0x00000004,
+ PRINTER_STATUS_PAPER_JAM = 0x00000008,
+ PRINTER_STATUS_PAPER_OUT = 0x00000010,
+ PRINTER_STATUS_MANUAL_FEED = 0x00000020,
+ PRINTER_STATUS_PAPER_PROBLEM = 0x00000040,
+ PRINTER_STATUS_OFFLINE = 0x00000080,
+ PRINTER_STATUS_IO_ACTIVE = 0x00000100,
+ PRINTER_STATUS_BUSY = 0x00000200,
+ PRINTER_STATUS_PRINTING = 0x00000400,
+ PRINTER_STATUS_OUTPUT_BIN_FULL = 0x00000800,
+ PRINTER_STATUS_NOT_AVAILABLE = 0x00001000,
+ PRINTER_STATUS_WAITING = 0x00002000,
+ PRINTER_STATUS_PROCESSING = 0x00004000,
+ PRINTER_STATUS_INITIALIZING = 0x00008000,
+ PRINTER_STATUS_WARMING_UP = 0x00010000,
+ PRINTER_STATUS_TONER_LOW = 0x00020000,
+ PRINTER_STATUS_NO_TONER = 0x00040000,
+ PRINTER_STATUS_PAGE_PUNT = 0x00080000,
+ PRINTER_STATUS_USER_INTERVENTION= 0x00100000,
+ PRINTER_STATUS_OUT_OF_MEMORY = 0x00200000,
+ PRINTER_STATUS_DOOR_OPEN = 0x00400000,
+ PRINTER_STATUS_SERVER_UNKNOWN = 0x00800000,
+ PRINTER_STATUS_POWER_SAVE = 0x01000000
+ } spoolss_PrinterStatus;
+
+ /* JOB status codes. */
+
+ const int JOB_STATUS_QUEUED = 0x0000;
+
+ typedef [bitmap32bit] bitmap {
+ JOB_STATUS_PAUSED = 0x00000001,
+ JOB_STATUS_ERROR = 0x00000002,
+ JOB_STATUS_DELETING = 0x00000004,
+ JOB_STATUS_SPOOLING = 0x00000008,
+ JOB_STATUS_PRINTING = 0x00000010,
+ JOB_STATUS_OFFLINE = 0x00000020,
+ JOB_STATUS_PAPEROUT = 0x00000040,
+ JOB_STATUS_PRINTED = 0x00000080,
+ JOB_STATUS_DELETED = 0x00000100,
+ JOB_STATUS_BLOCKED_DEVQ = 0x00000200,
+ JOB_STATUS_USER_INTERVENTION = 0x00000400,
+ JOB_STATUS_RESTART = 0x00000800,
+ JOB_STATUS_COMPLETE = 0x00001000
+ } spoolss_JobStatus;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DEBUGGING_BUILD = 0x00000000,
+ SPOOLSS_RELEASE_BUILD = 0x00000001
+ } spoolss_Build;
+
+ typedef [public,gensize] struct {
+ [relative] nstring *printername;
+ [relative] nstring *servername;
+ uint32 cjobs;
+ uint32 total_jobs;
+ uint32 total_bytes;
+ spoolss_Time time;
+ uint32 global_counter;
+ uint32 total_pages;
+ uint32 version;
+ spoolss_Build free_build;
+ uint32 spooling;
+ uint32 max_spooling;
+ uint32 session_counter;
+ uint32 num_error_out_of_paper;
+ uint32 num_error_not_ready;
+ spoolss_JobStatus job_error;
+ uint32 number_of_processors;
+ spoolss_ProcessorType processor_type;
+ uint32 high_part_total_bytes;
+ uint32 change_id;
+ WERROR last_error;
+ spoolss_PrinterStatus status;
+ uint32 enumerate_network_printers;
+ uint32 c_setprinter;
+ spoolss_ProcessorArchitecture processor_architecture;
+ uint16 processor_level;
+ uint32 ref_ic;
+ uint32 reserved2;
+ uint32 reserved3;
+ } spoolss_PrinterInfo0;
+
+ /* Device Mode Extra Data */
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA = 0x554e4944, /* 0x44494e55 */
+ SPOOLSS_DM_SIGNATURE_JTEXP = 0x4a544d53, /* 0x534d544a */
+ SPOOLSS_DM_SIGNATURE_PSEXTRA = 0x50524956 /* 0x56495250 */
+ } spoolss_DM_Signature;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_LAYOUT_NUP_DISABLED = 0x00000000,
+ SPOOLSS_DM_LAYOUT_NUP_2 = 0x00000001,
+ SPOOLSS_DM_LAYOUT_NUP_4 = 0x00000002,
+ SPOOLSS_DM_LAYOUT_NUP_6 = 0x00000003,
+ SPOOLSS_DM_LAYOUT_NUP_9 = 0x00000004,
+ SPOOLSS_DM_LAYOUT_NUP_16 = 0x00000005,
+ SPOOLSS_DM_LAYOUT_BOOKLET = 0x00000006
+ } spoolss_DM_Layout;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_NUP_DIRECTION_L2R_T2B = 0x00000001,
+ SPOOLSS_DM_NUP_DIRECTION_T2B_L2R = 0x00000002,
+ SPOOLSS_DM_NUP_DIRECTION_R2L_T2B = 0x00000004,
+ SPOOLSS_DM_NUP_DIRECTION_T2B_R2L = 0x00000008
+ } spoolss_DM_NupDirection;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_NUP_BORDER_PRINT = 0x00000000,
+ SPOOLSS_DM_NUP_BORDER_NONE = 0x00000001
+ } spoolss_DM_NupBorderFlags;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_BOOKLET_LEFT_FLIP = 0x00000000,
+ SPOOLSS_DM_BOOKLET_RIGHT_FLIP = 0x00000001
+ } spoolss_DM_BookletFlags;
+
+ /* Device Mode Extra Data: PostScript */
+
+ /* NT 3.51 */
+
+ typedef [bitmap32bit] bitmap {
+ SPOOLSS_DM_PS_FLAGS_DRV_ERROR_HANDLER = 0x00000002,
+ SPOOLSS_DM_PS_FLAGS_PRINT_MIRROR = 0x00000004,
+ SPOOLSS_DM_PS_FLAGS_PRINT_NEGATIVE = 0x00000010,
+ SPOOLSS_DM_PS_FLAGS_COMPRESS_BITMAP = 0x00000040,
+ SPOOLSS_DM_PS_FLAGS_ROTATE_180 = 0x00000200,
+ SPOOLSS_DM_PS_FLAGS_GDI_METAFILE_SPOOL = 0x00002000
+ } spoolss_DMPS_Flags;
+
+ typedef struct {
+ [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature;
+ spoolss_DMPS_Flags dwFlags;
+ uint32 wchEPSFile[12];
+ [value(24)] uint16 caSize;
+ uint16 caFlags;
+ uint16 caIlluminantIndex;
+ uint16 caRedGamma;
+ uint16 caGreenGamma;
+ uint16 caBlueGamma;
+ uint16 caReferenceBlack;
+ uint16 caReferenceWhite;
+ uint16 caContrast;
+ uint16 caBrightness;
+ uint16 caColorfulness;
+ uint16 caRedGreenTint;
+ } spoolss_PSDRVEXTRA351;
+
+ /* NT 4.0 */
+
+ typedef struct {
+ [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature;
+ spoolss_DMPS_Flags dwFlags;
+ uint32 wchEPSFile[12];
+ [value(24)] uint16 caSize;
+ uint16 caFlags;
+ uint16 caIlluminantIndex;
+ uint16 caRedGamma;
+ uint16 caGreenGamma;
+ uint16 caBlueGamma;
+ uint16 caReferenceBlack;
+ uint16 caReferenceWhite;
+ uint16 caContrast;
+ uint16 caBrightness;
+ uint16 caColorfulness;
+ uint16 caRedGreenTint;
+ uint16 wChecksum;
+ uint16 wOptions;
+ uint32 aubOptions[8];
+ } spoolss_PSDRVEXTRA400;
+
+ /* 2000 & XP */
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_PS_OPTIMIZE_SPEED = 0x00000000,
+ SPOOLSS_DM_PS_OPTIMIZE_PORTABILITY = 0x00000001,
+ SPOOLSS_DM_PS_OPTIMIZE_EPS = 0x00000002,
+ SPOOLSS_DM_PS_OPTIMIZE_ARCHIVAL = 0x00000003
+ } spoolss_DMPS_Dialect;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_PS_TTDLFMT_DEFAULT = 0x00000000,
+ SPOOLSS_DM_PS_TTDLFMT_TYPE_1 = 0x00000001,
+ SPOOLSS_DM_PS_TTDLFMT_TYPE_3 = 0x00000002,
+ SPOOLSS_DM_PS_TTDLFMT_TYPE_42 = 0x00000003
+ } spoolss_DMPS_TTDLFmt;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_PS_PSLEVEL_1 = 0x00000001,
+ SPOOLSS_DM_PS_PSLEVEL_2 = 0x00000002,
+ SPOOLSS_DM_PS_PSLEVEL_3 = 0x00000003
+ } spoolss_DMPS_PSLevel;
+
+ typedef enum {
+ SPOOLSS_DM_PS_FEED_DIRECTION_LONG_EDGE_FIRST = 0x0000,
+ SPOOLSS_DM_PS_FEED_DIRECTION_SHORT_EDGE_FIRST = 0x0001,
+ SPOOLSS_DM_PS_FEED_DIRECTION_LONG_EDGE_FIRST_UPSIDEDOWN = 0x0002,
+ SPOOLSS_DM_PS_FEED_DIRECTION_SHORT_EDGE_FIRST_UPSIDEDOWN= 0x0003
+ } spoolss_DMPS_FeedDirection;
+
+ typedef struct {
+ [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature;
+ spoolss_DMPS_Flags dwFlags;
+ uint32 wchEPSFile[12];
+ [value(24)] uint16 caSize;
+ uint16 caFlags;
+ uint16 caIlluminantIndex;
+ uint16 caRedGamma;
+ uint16 caGreenGamma;
+ uint16 caBlueGamma;
+ uint16 caReferenceBlack;
+ uint16 caReferenceWhite;
+ uint16 caContrast;
+ uint16 caBrightness;
+ uint16 caColorfulness;
+ uint16 caRedGreenTint;
+ uint16 wReserved1;
+ uint16 wSize;
+ uint32 fxScrFreq;
+ uint32 fxScrAngle;
+ spoolss_DMPS_Dialect iDialect;
+ spoolss_DMPS_TTDLFmt iTTDLFmt;
+ boolean32 bReversePrint;
+ spoolss_DM_Layout iLayout;
+ spoolss_DMPS_PSLevel iPSLevel;
+ uint32 dwReserved2;
+ uint16 wOEMExtra;
+ [value(0x0010)] uint16 wVer;
+ uint32 dwX;
+ uint32 dwY;
+ uint32 dwWidthOffset;
+ uint32 dwHeightOffset;
+ spoolss_DMPS_FeedDirection wFeedDirection;
+ uint16 wCutSheet;
+ uint32 dwReserved3[4];
+ uint32 dwChecksum32;
+ uint32 dwOptions;
+ uint32 aOptions[128];
+ } spoolss_PSDRVEXTRA500;
+
+ /* Vista, 2008, 7 */
+
+ typedef struct {
+ [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature;
+ spoolss_DMPS_Flags dwFlags;
+ uint32 wchEPSFile[12];
+ [value(24)] uint16 caSize;
+ uint16 caFlags;
+ uint16 caIlluminantIndex;
+ uint16 caRedGamma;
+ uint16 caGreenGamma;
+ uint16 caBlueGamma;
+ uint16 caReferenceBlack;
+ uint16 caReferenceWhite;
+ uint16 caContrast;
+ uint16 caBrightness;
+ uint16 caColorfulness;
+ uint16 caRedGreenTint;
+ uint16 wCoreJTExpSize;
+ [value(ndr_size_spoolss_PSDRVEXTRA(r, ndr->flags) + wCoreJTExpSize)] uint16 wCoreFullSize;
+ uint32 fxScrFreq;
+ uint32 fxScrAngle;
+ spoolss_DMPS_Dialect iDialect;
+ spoolss_DMPS_TTDLFmt iTTDLFmt;
+ boolean32 bReversePrint;
+ spoolss_DM_Layout iLayout;
+ spoolss_DMPS_PSLevel iPSLevel;
+ uint32 dwReserved2;
+ uint16 wOEMExtra;
+ [value(0x0010)] uint16 wVer;
+ uint32 dwX;
+ uint32 dwY;
+ uint32 dwWidthOffset;
+ uint32 dwHeightOffset;
+ spoolss_DMPS_FeedDirection wFeedDirection;
+ uint16 wCutSheet;
+ uint32 dwReserved3[4];
+ uint32 dwChecksum32;
+ uint32 dwOptions;
+ uint32 aOptions[128];
+ spoolss_DM_NupDirection dwNupDirection;
+ spoolss_DM_NupBorderFlags dwNupBorderFlags;
+ spoolss_DM_BookletFlags dwBookletFlags;
+ uint32 dwPadding;
+ } spoolss_PSDRVEXTRA;
+
+ /* Device Mode Extra Data: UniDriver */
+
+ /* NT 3.5, NT 4.0 */
+
+ typedef struct {
+ uint16 wReserved[56];
+ } spoolss_UNIDRVEXTRA3_4;
+
+ /* 2000, XP */
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DM_UNI_QUALITY_BEST = 0x00000000,
+ SPOOLSS_DM_UNI_QUALITY_MEDIUM = 0x00000001,
+ SPOOLSS_DM_UNI_QUALITY_DRAFT = 0x00000002
+ } spoolss_DMUNI_Quality;
+
+ typedef [bitmap32bit] bitmap {
+ SPOOLSS_DM_UNI_FLAGS_PRINT_TEXT_AS_GRAPHICS = 0x00000002,
+ SPOOLSS_DM_UNI_FLAGS_AVOID_EMFSPOOL = 0x00000010,
+ SPOOLSS_DM_UNI_FLAGS_CUSTOM_HALFTONING = 0x00000080
+ } spoolss_DMUNI_Flags;
+
+ typedef struct {
+ [value(SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA)] spoolss_DM_Signature dwSignature;
+ [value(0x0022)] uint16 wVer;
+ uint16 sPadding;
+ uint16 wSize;
+ uint16 wOEMExtra;
+ uint32 dwChecksum32;
+ spoolss_DMUNI_Flags dwFlags;
+ boolean32 bReversePrint;
+ spoolss_DM_Layout iLayout;
+ spoolss_DMUNI_Quality iQuality;
+ uint16 wReserved[6];
+ uint32 dwOptions;
+ uint32 aOptions[128];
+ } spoolss_UNIDRVEXTRA500;
+
+ /* Vista, 2008, 7 */
+
+ typedef [public,gensize] struct {
+ [value(SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA)] spoolss_DM_Signature dwSignature;
+ [value(0x0022)] uint16 wVer;
+ uint16 wCoreJTExpSize;
+ [value(ndr_size_spoolss_UNIDRVEXTRA(r, ndr->flags) + wCoreJTExpSize)] uint16 wCoreFullSize;
+ uint16 wOEMExtra;
+ uint32 dwChecksum32;
+ spoolss_DMUNI_Flags dwFlags;
+ boolean32 bReversePrint;
+ spoolss_DM_Layout iLayout;
+ spoolss_DMUNI_Quality iQuality;
+ uint16 wReserved[6];
+ uint32 dwOptions;
+ uint32 aOptions[128];
+ spoolss_DM_NupDirection dwNupDirection;
+ spoolss_DM_NupBorderFlags dwNupBorderFlags;
+ spoolss_DM_BookletFlags dwBookletFlags;
+ } spoolss_UNIDRVEXTRA;
+
+ /* Device Mode Extra Data: JTEXP */
+
+ typedef struct {
+ uint32 dwSize;
+ [value(SPOOLSS_DM_SIGNATURE_JTEXP)] spoolss_DM_Signature dwSignature;
+ [value(0)] uint32 dwVersion;
+ [value(16)] uint16 wJTHdrSize;
+ uint16 wCoreMFOSize; /* must be sizeof the two following elements, must be dwSize - 16*/
+ nstring ModelName;
+ [flag(STR_UTF8|STR_NULLTERM|NDR_REMAINING)] string_array FeatureOptionPairs;
+ } spoolss_JTEXP;
+
+ /* Device Mode Extra Data: OEM_DMEXTRA */
+
+ typedef struct {
+ uint32 dwSize;
+ spoolss_DM_Signature dwSignature;
+ uint32 dwVersion;
+ [flag(NDR_REMAINING)] DATA_BLOB Data;
+ } spoolss_OEM_DMEXTRA;
+
+ typedef [nodiscriminant] union {
+ [case(0x0350)] spoolss_PSDRVEXTRA351 psdrvextra351;
+ [case(0x0400)] spoolss_PSDRVEXTRA400 psdrvextra400;
+ [case(0x0501)] spoolss_PSDRVEXTRA500 psdrvextra500;
+ [case(0x0600)] spoolss_PSDRVEXTRA psdrvextra;
+ [default] [flag(NDR_REMAINING)] DATA_BLOB psblob;
+ } spoolss_DeviceModeExtraDataPostScript;
+
+ typedef [nodiscriminant] union {
+ [case(0x0301)] spoolss_UNIDRVEXTRA3_4 unidrvextra3_4;
+ [case(0x0500)] spoolss_UNIDRVEXTRA500 unidrvextra500;
+ [case(0x0600)] spoolss_UNIDRVEXTRA unidrvextra;
+ [default] [flag(NDR_REMAINING)] DATA_BLOB uniblob;
+ } spoolss_DeviceModeExtraDataUniDriver;
+
+ typedef [bitmap32bit] bitmap {
+ DEVMODE_ORIENTATION = 0x00000001,
+ DEVMODE_PAPERSIZE = 0x00000002,
+ DEVMODE_PAPERLENGTH = 0x00000004,
+ DEVMODE_PAPERWIDTH = 0x00000008,
+ DEVMODE_SCALE = 0x00000010,
+ DEVMODE_POSITION = 0x00000020,
+ DEVMODE_NUP = 0x00000040,
+ DEVMODE_COPIES = 0x00000100,
+ DEVMODE_DEFAULTSOURCE = 0x00000200,
+ DEVMODE_PRINTQUALITY = 0x00000400,
+ DEVMODE_COLOR = 0x00000800,
+ DEVMODE_DUPLEX = 0x00001000,
+ DEVMODE_YRESOLUTION = 0x00002000,
+ DEVMODE_TTOPTION = 0x00004000,
+ DEVMODE_COLLATE = 0x00008000,
+ DEVMODE_FORMNAME = 0x00010000,
+ DEVMODE_LOGPIXELS = 0x00020000,
+ DEVMODE_BITSPERPEL = 0x00040000,
+ DEVMODE_PELSWIDTH = 0x00080000,
+ DEVMODE_PELSHEIGHT = 0x00100000,
+ DEVMODE_DISPLAYFLAGS = 0x00200000,
+ DEVMODE_DISPLAYFREQUENCY = 0x00400000,
+ DEVMODE_ICMMETHOD = 0x00800000,
+ DEVMODE_ICMINTENT = 0x01000000,
+ DEVMODE_MEDIATYPE = 0x02000000,
+ DEVMODE_DITHERTYPE = 0x04000000,
+ DEVMODE_PANNINGWIDTH = 0x08000000,
+ DEVMODE_PANNINGHEIGHT = 0x10000000
+ } spoolss_DeviceModeFields;
+
+ typedef [enum16bit] enum {
+ DMSPEC_NT3 = 0x320,
+ DMSPEC_WIN95_98_ME = 0x400,
+ DMSPEC_NT4_AND_ABOVE = 0x401
+ } spoolss_DeviceModeSpecVersion;
+
+ typedef [enum16bit] enum {
+ DMORIENT_PORTRAIT = 0x0001,
+ DMORIENT_LANDSCAPE = 0x0002
+ } spoolss_DeviceModeOrientation;
+
+ typedef [enum16bit] enum {
+ DMPAPER_LETTER = 0x0001, /* Letter, 8 1/2 x 11 inches */
+ DMPAPER_LETTERSMALL = 0x0002, /* Letter Small, 8 1/2 x 11 inches */
+ DMPAPER_TABLOID = 0x0003, /* Tabloid, 11 x 17 inches */
+ DMPAPER_LEDGER = 0x0004, /* Ledger, 17 x 11 inches */
+ DMPAPER_LEGAL = 0x0005, /* Legal, 8 1/2 x 14 inches */
+ DMPAPER_STATEMENT = 0x0006, /* Statement, 5 1/2 x 8 1/2 inches */
+ DMPAPER_EXECUTIVE = 0x0007, /* Executive, 7 1/4 x 10 1/2 inches */
+ DMPAPER_A3 = 0x0008, /* A3 sheet, 297 x 420 millimeters */
+ DMPAPER_A4 = 0x0009, /* A4 sheet, 210 x 297 millimeters */
+ DMPAPER_A4SMALL = 0x000A, /* A4 small sheet, 210 x 297 millimeters */
+ DMPAPER_A5 = 0x000B, /* A5 sheet, 148 x 210 millimeters */
+ DMPAPER_B4 = 0x000C, /* B4 sheet, 250 x 354 millimeters */
+ DMPAPER_B5 = 0x000D, /* B5 sheet, 182 x 257-millimeter paper */
+ DMPAPER_FOLIO = 0x000E, /* Folio, 8 1/2 x 13-inch paper */
+ DMPAPER_QUARTO = 0x000F, /* Quarto, 215 x 275 millimeter paper */
+ DMPAPER_10X14 = 0x0010, /* 10 x 14-inch sheet */
+ DMPAPER_11X17 = 0x0011, /* 11 x 17-inch sheet */
+ DMPAPER_NOTE = 0x0012, /* Note, 8 1/2 x 11-inches */
+ DMPAPER_ENV_9 = 0x0013, /* #9 Envelope, 3 7/8 x 8 7/8 inches */
+ DMPAPER_ENV_10 = 0x0014, /* #10 Envelope, 4 1/8 x 9 1/2 inches */
+ DMPAPER_ENV_11 = 0x0015, /* #11 Envelope, 4 1/2 x 10 3/8 inches */
+ DMPAPER_ENV_12 = 0x0016, /* #12 Envelope, 4 3/4 x 11 inches */
+ DMPAPER_ENV_14 = 0x0017, /* #14 Envelope, 5 x 11 1/2 inches */
+ DMPAPER_CSHEET = 0x0018, /* C Sheet, 17 x 22 inches */
+ DMPAPER_DSHEET = 0x0019, /* D Sheet, 22 x 34 inches */
+ DMPAPER_ESHEET = 0x001A, /* E Sheet, 34 x 44 inches */
+ DMPAPER_ENV_DL = 0x001B, /* DL Envelope, 110 x 220 millimeters */
+ DMPAPER_ENV_C5 = 0x001C, /* C5 Envelope, 162 x 229 millimeters */
+ DMPAPER_ENV_C3 = 0x001D, /* C3 Envelope, 324 x 458 millimeters */
+ DMPAPER_ENV_C4 = 0x001E, /* C4 Envelope, 229 x 324 millimeters */
+ DMPAPER_ENV_C6 = 0x001F, /* C6 Envelope, 114 x 162 millimeters */
+ DMPAPER_ENV_C65 = 0x0020, /* C65 Envelope, 114 x 229 millimeters */
+ DMPAPER_ENV_B4 = 0x0021, /* B4 Envelope, 250 x 353 millimeters */
+ DMPAPER_ENV_B5 = 0x0022, /* B5 Envelope, 176 x 250 millimeters */
+ DMPAPER_ENV_B6 = 0x0023, /* B6 Envelope, 176 x 125 millimeters */
+ DMPAPER_ENV_ITALY = 0x0024, /* Italy Envelope, 110 x 230 millimeters */
+ DMPAPER_ENV_MONARCH = 0x0025, /* Monarch Envelope, 3 7/8 x 7 1/2 inches */
+ DMPAPER_ENV_PERSONAL = 0x0026, /* 6 3/4 Envelope, 3 5/8 x 6 1/2 inches */
+ DMPAPER_FANFOLD_US = 0x0027, /* US Std Fanfold, 14 7/8 x 11 inches */
+ DMPAPER_FANFOLD_STD_GERMAN = 0x0028, /* German Std Fanfold, 8 1/2 x 12 inches */
+ DMPAPER_FANFOLD_LGL_GERMAN = 0x0029, /* German Legal Fanfold, 8 x 13 inches */
+ DMPAPER_DBL_JAPANESE_POSTCARD = 0x0045, /* Double Japanese Postcard, 200 x 148 millimeters */
+ DMPAPER_A6 = 0x0046, /* A6 sheet, 105 x 148 millimeters */
+ DMPAPER_JENV_KAKU2 = 0x0047, /* Japanese Envelope Kaku #2 */
+ DMPAPER_JENV_KAKU3 = 0x0048, /* Japanese Envelope Kaku #3 */
+ DMPAPER_JENV_CHOU3 = 0x0049, /* Japanese Envelope Chou #3 */
+ DMPAPER_JENV_CHOU4 = 0x004A, /* Japanese Envelope Chou #4 */
+ DMPAPER_LETTER_ROTATED = 0x004B, /* Letter Rotated, 11 by 8 1/2 inches */
+ DMPAPER_A3_ROTATED = 0x004C, /* A3 rotated sheet, 420 x 297 millimeters */
+ DMPAPER_A4_ROTATED = 0x004D, /* A4 rotated sheet, 297 x 210 millimeters */
+ DMPAPER_A5_ROTATED = 0x004E, /* A5 rotated sheet, 210 x 148 millimeters */
+ DMPAPER_B4_JIS_ROTATED = 0x004F, /* B4 (JIS) rotated sheet, 364 x 257 millimeters */
+ DMPAPER_B5_JIS_ROTATED = 0x0050, /* B5 (JIS) rotated sheet, 257 x 182 millimeters */
+ DMPAPER_JAPANESE_POSTCARD_ROTATED = 0x0051, /* Japanese Postcard Rotated, 148 x 100 millimeters */
+ DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 0x0052, /* Double Japanese Postcard Rotated, 148 x 200 millimeters */
+ DMPAPER_A6_ROTATED = 0x0053, /* A6 rotated sheet, 148 x 105 millimeters */
+ DMPAPER_JENV_KAKU2_ROTATED = 0x0054, /* Japanese Envelope Kaku #2 Rotated */
+ DMPAPER_JENV_KAKU3_ROTATED = 0x0055, /* Japanese Envelope Kaku #3 Rotated */
+ DMPAPER_JENV_CHOU3_ROTATED = 0x0056, /* Japanese Envelope Chou #3 Rotated */
+ DMPAPER_JENV_CHOU4_ROTATED = 0x0057, /* Japanese Envelope Chou #4 Rotated */
+ DMPAPER_B6_JIS = 0x0058, /* B6 (JIS) sheet, 128 x 182 millimeters */
+ DMPAPER_B6_JIS_ROTATED = 0x0059, /* B6 (JIS) rotated sheet, 182 x 128 millimeters */
+ DMPAPER_12X11 = 0x005A, /* 12 x 11-inch sheet */
+ DMPAPER_JENV_YOU4 = 0x005B, /* Japanese Envelope You #4 */
+ DMPAPER_JENV_YOU4_ROTATED = 0x005C, /* Japanese Envelope You #4 */
+ DMPAPER_P16K = 0x005D, /* PRC 16K, 146 x 215 millimeters */
+ DMPAPER_P32K = 0x005E, /* PRC 32K, 97 x 151 millimeters */
+ DMPAPER_P32KBIG = 0x005F, /* PRC 32K(Big) 97 x 151 millimeters */
+ DMPAPER_PENV_1 = 0x0060, /* PRC Envelope #1, 102 by 165 millimeters */
+ DMPAPER_PENV_2 = 0x0061, /* PRC Envelope #2, 102 x 176 millimeters */
+ DMPAPER_PENV_3 = 0x0062, /* PRC Envelope #3, 125 x 176 millimeters */
+ DMPAPER_PENV_4 = 0x0063, /* PRC Envelope #4, 110 x 208 millimeters */
+ DMPAPER_PENV_5 = 0x0064, /* PRC Envelope #5, 110 x 220 millimeters */
+ DMPAPER_PENV_6 = 0x0065, /* PRC Envelope #6, 120 x 230 millimeters */
+ DMPAPER_PENV_7 = 0x0066, /* PRC Envelope #7, 160 x 230 millimeters */
+ DMPAPER_PENV_8 = 0x0067, /* PRC Envelope #8, 120 x 309 millimeters */
+ DMPAPER_PENV_9 = 0x0068, /* PRC Envelope #9, 229 x 324 millimeters */
+ DMPAPER_PENV_10 = 0x0069, /* PRC Envelope #10, 324 x 458 millimeters */
+ DMPAPER_P16K_ROTATED = 0x006A, /* PRC 16K Rotated, 215 x 146 millimeters */
+ DMPAPER_P32K_ROTATED = 0x006B, /* PRC 32K Rotated, 151 x 97 millimeters */
+ DMPAPER_P32KBIG_ROTATED = 0x006C, /* PRC 32K(Big) Rotated, 151 x 97 millimeters */
+ DMPAPER_PENV_1_ROTATED = 0x006D, /* PRC Envelope #1 Rotated, 165 x 102 millimeters */
+ DMPAPER_PENV_2_ROTATED = 0x006E, /* PRC Envelope #2 Rotated, 176 x 102 millimeters */
+ DMPAPER_PENV_3_ROTATED = 0x006F, /* PRC Envelope #3 Rotated, 176 x 125 millimeters */
+ DMPAPER_PENV_4_ROTATED = 0x0070, /* PRC Envelope #4 Rotated, 208 x 110 millimeters */
+ DMPAPER_PENV_5_ROTATED = 0x0071, /* PRC Envelope #5 Rotated, 220 x 110 millimeters */
+ DMPAPER_PENV_6_ROTATED = 0x0072, /* PRC Envelope #6 Rotated, 230 x 120 millimeters */
+ DMPAPER_PENV_7_ROTATED = 0x0073, /* PRC Envelope #7 Rotated, 230 x 160 millimeters */
+ DMPAPER_PENV_8_ROTATED = 0x0074, /* PRC Envelope #8 Rotated, 309 x 120 millimeters */
+ DMPAPER_PENV_9_ROTATED = 0x0075, /* PRC Envelope #9 Rotated, 324 x 229 millimeters */
+ DMPAPER_PENV_10_ROTATED = 0x0076 /* PRC Envelope #10 Rotated, 458 x 324 millimeters */
+ } spoolss_DeviceModePaperSize;
+
+ typedef [enum16bit] enum {
+ DMBIN_UPPER = 0x0001,
+ DMBIN_LOWER = 0x0002,
+ DMBIN_MIDDLE = 0x0003,
+ DMBIN_MANUAL = 0x0004,
+ DMBIN_ENVELOPE = 0x0005,
+ DMBIN_ENVMANUAL = 0x0006,
+ DMBIN_AUTO = 0x0007,
+ DMBIN_TRACTOR = 0x0008,
+ DMBIN_SMALLFMT = 0x0009,
+ DMBIN_LARGEFMT = 0x000a,
+ DMBIN_LARGECAPACITY = 0x000b,
+ DMBIN_CASSETTE = 0x000e,
+ DMBIN_FORMSOURCE = 0x000f
+ } spoolss_DeviceModeDefaultSource;
+
+ typedef [enum16bit] enum {
+ DMRES_HIGH = 0xfffc,
+ DMRES_MEDIUM = 0xfffd,
+ DMRES_LOW = 0xfffe,
+ DMRES_DRAFT = 0xffff
+ } spoolss_DeviceModePrintQuality;
+
+ typedef [enum16bit] enum {
+ DMRES_MONOCHROME = 0x0001,
+ DMRES_COLOR = 0x0002
+ } spoolss_DeviceModeColor;
+
+ typedef [enum16bit] enum {
+ DMDUP_SIMPLEX = 0x0001,
+ DMDUP_VERTICAL = 0x0002,
+ DMDUP_HORIZONTAL = 0x0003
+ } spoolss_DeviceModeDuplex;
+
+ typedef [enum16bit] enum {
+ DMTT_BITMAP = 0x0001,
+ DMTT_DOWNLOAD = 0x0002,
+ DMTT_SUBDEV = 0x0003,
+ DMTT_DOWNLOAD_OUTLINE = 0x0004
+ } spoolss_DeviceModeTTOption;
+
+ typedef [enum16bit] enum {
+ DMCOLLATE_FALSE = 0x0000,
+ DMCOLLATE_TRUE = 0x0001
+ } spoolss_DeviceModeCollate;
+
+ typedef [v1_enum] enum {
+ DMNUP_SYSTEM = 0x00000001,
+ DMNUP_ONEUP = 0x00000002
+ } spoolss_DeviceModeNUp;
+
+ typedef [v1_enum] enum {
+ DMICMMETHOD_NONE = 0x00000001,
+ DMICMMETHOD_SYSTEM = 0x00000002,
+ DMICMMETHOD_DRIVER = 0x00000003,
+ DMICMMETHOD_DEVICE = 0x00000004
+ } spoolss_DeviceModeICMMethod;
+
+ typedef [v1_enum] enum {
+ DMICM_SATURATE = 0x00000001,
+ DMICM_CONTRAST = 0x00000002,
+ DMICM_COLORIMETRIC = 0x00000003,
+ DMICM_ABS_COLORIMETRIC = 0x00000004
+ } spoolss_DeviceModeICMIntent;
+
+ typedef [v1_enum] enum {
+ DMMEDIA_STANDARD = 0x00000001,
+ DMMEDIA_TRANSPARENCY = 0x00000002,
+ DMMEDIA_GLOSSY = 0x00000003
+ } spoolss_DeviceModeMediaType;
+
+ typedef [v1_enum] enum {
+ DMDITHER_NONE = 0x00000001,
+ DMDITHER_COARSE = 0x00000002,
+ DMDITHER_FINE = 0x00000003,
+ DMDITHER_LINEART = 0x00000004,
+ DMDITHER_ERRORDIFFUSION = 0x00000005,
+ DMDITHER_RESERVED6 = 0x00000006,
+ DMDITHER_RESERVED7 = 0x00000007,
+ DMDITHER_RESERVED8 = 0x00000008,
+ DMDITHER_RESERVED9 = 0x00000009,
+ DMDITHER_GRAYSCALE = 0x0000000A
+ } spoolss_DeviceModeDitherType;
+
+ const int MAXDEVICENAME = 32;
+
+ typedef [public,gensize] struct {
+ [charset(UTF16),to_null] uint16 devicename[MAXDEVICENAME];
+ spoolss_DeviceModeSpecVersion specversion;
+ uint16 driverversion;
+ uint16 size;
+ [value(r->driverextra_data.length)] uint16 __driverextra_length;
+ spoolss_DeviceModeFields fields;
+ spoolss_DeviceModeOrientation orientation;
+ spoolss_DeviceModePaperSize papersize;
+ uint16 paperlength;
+ uint16 paperwidth;
+ uint16 scale;
+ uint16 copies;
+ spoolss_DeviceModeDefaultSource defaultsource;
+ spoolss_DeviceModePrintQuality printquality;
+ spoolss_DeviceModeColor color;
+ spoolss_DeviceModeDuplex duplex;
+ uint16 yresolution;
+ spoolss_DeviceModeTTOption ttoption;
+ spoolss_DeviceModeCollate collate;
+ [charset(UTF16),to_null] uint16 formname[MAXDEVICENAME];
+ uint16 logpixels; /* reserved */
+ uint32 bitsperpel; /* reserved */
+ uint32 pelswidth; /* reserved */
+ uint32 pelsheight; /* reserved */
+ spoolss_DeviceModeNUp displayflags;
+ uint32 displayfrequency; /* reserved */
+ spoolss_DeviceModeICMMethod icmmethod;
+ spoolss_DeviceModeICMIntent icmintent;
+ spoolss_DeviceModeMediaType mediatype;
+ spoolss_DeviceModeDitherType dithertype;
+ uint32 reserved1;
+ uint32 reserved2;
+ uint32 panningwidth; /* reserved */
+ uint32 panningheight; /* reserved */
+ [subcontext_size(__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data;
+ } spoolss_DeviceMode;
+
+ typedef [public] bitmap {
+ PRINTER_ENUM_DEFAULT = 0x00000001,
+ PRINTER_ENUM_LOCAL = 0x00000002,
+ PRINTER_ENUM_CONNECTIONS = 0x00000004,
+ PRINTER_ENUM_FAVORITE = 0x00000004,
+ PRINTER_ENUM_NAME = 0x00000008,
+ PRINTER_ENUM_REMOTE = 0x00000010,
+ PRINTER_ENUM_SHARED = 0x00000020,
+ PRINTER_ENUM_NETWORK = 0x00000040,
+ PRINTER_ENUM_EXPAND = 0x00004000,
+ PRINTER_ENUM_CONTAINER = 0x00008000,
+ PRINTER_ENUM_ICON1 = 0x00010000,
+ PRINTER_ENUM_ICON2 = 0x00020000,
+ PRINTER_ENUM_ICON3 = 0x00040000,
+ PRINTER_ENUM_ICON4 = 0x00080000,
+ PRINTER_ENUM_ICON5 = 0x00100000,
+ PRINTER_ENUM_ICON6 = 0x00200000,
+ PRINTER_ENUM_ICON7 = 0x00400000,
+ PRINTER_ENUM_ICON8 = 0x00800000,
+ PRINTER_ENUM_HIDE = 0x01000000
+ } spoolss_EnumPrinterFlags;
+
+ const int PRINTER_ENUM_ICONMASK = (PRINTER_ENUM_ICON1 |
+ PRINTER_ENUM_ICON2 |
+ PRINTER_ENUM_ICON3 |
+ PRINTER_ENUM_ICON4 |
+ PRINTER_ENUM_ICON5 |
+ PRINTER_ENUM_ICON6 |
+ PRINTER_ENUM_ICON7 |
+ PRINTER_ENUM_ICON8); /* 0x00ff0000 */
+
+ typedef [public] bitmap {
+ PRINTER_ATTRIBUTE_QUEUED = 0x00000001,
+ PRINTER_ATTRIBUTE_DIRECT = 0x00000002,
+ PRINTER_ATTRIBUTE_DEFAULT = 0x00000004,
+ PRINTER_ATTRIBUTE_SHARED = 0x00000008,
+ PRINTER_ATTRIBUTE_NETWORK = 0x00000010,
+ PRINTER_ATTRIBUTE_HIDDEN = 0x00000020,
+ PRINTER_ATTRIBUTE_LOCAL = 0x00000040,
+ PRINTER_ATTRIBUTE_ENABLE_DEVQ = 0x00000080,
+ PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS = 0x00000100,
+ PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST = 0x00000200,
+ PRINTER_ATTRIBUTE_WORK_OFFLINE = 0x00000400,
+ PRINTER_ATTRIBUTE_ENABLE_BIDI = 0x00000800,
+ PRINTER_ATTRIBUTE_RAW_ONLY = 0x00001000,
+ PRINTER_ATTRIBUTE_PUBLISHED = 0x00002000,
+ PRINTER_ATTRIBUTE_FAX = 0x00004000,
+ PRINTER_ATTRIBUTE_TS = 0x00008000
+ } spoolss_PrinterAttributes;
+
+ typedef [public,gensize] struct {
+ spoolss_EnumPrinterFlags flags;
+ [relative] nstring *description;
+ [relative] nstring *name;
+ [relative] nstring *comment;
+ } spoolss_PrinterInfo1;
+
+ typedef [public,gensize,nopush] struct {
+ [relative] nstring *servername;
+ [relative] nstring *printername;
+ [relative] nstring *sharename;
+ [relative] nstring *portname;
+ [relative] nstring *drivername;
+ [relative] nstring *comment;
+ [relative] nstring *location;
+ [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode;
+ [relative] nstring *sepfile;
+ [relative] nstring *printprocessor;
+ [relative] nstring *datatype;
+ [relative] nstring *parameters;
+ [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc;
+ spoolss_PrinterAttributes attributes;
+ [range(0,99)] uint32 priority;
+ uint32 defaultpriority;
+ uint32 starttime;
+ uint32 untiltime;
+ spoolss_PrinterStatus status;
+ uint32 cjobs;
+ uint32 averageppm;
+ } spoolss_PrinterInfo2;
+
+ typedef [public,gensize] struct {
+ [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc;
+ } spoolss_PrinterInfo3;
+
+ typedef [public,gensize] struct {
+ [relative] nstring *printername;
+ [relative] nstring *servername;
+ spoolss_PrinterAttributes attributes;
+ } spoolss_PrinterInfo4;
+
+ typedef [public,gensize] struct {
+ [relative] nstring *printername;
+ [relative] nstring *portname;
+ spoolss_PrinterAttributes attributes;
+ uint32 device_not_selected_timeout;
+ uint32 transmission_retry_timeout;
+ } spoolss_PrinterInfo5;
+
+ typedef [public,gensize] struct {
+ spoolss_PrinterStatus status;
+ } spoolss_PrinterInfo6;
+
+ typedef bitmap {
+ DSPRINT_PUBLISH = 0x00000001,
+ DSPRINT_UPDATE = 0x00000002,
+ DSPRINT_UNPUBLISH = 0x00000004,
+ DSPRINT_REPUBLISH = 0x00000008,
+ DSPRINT_PENDING = 0x80000000
+ } spoolss_DsPrintAction;
+
+ typedef [public,gensize] struct {
+ [relative] nstring *guid; /* text form of printer guid */
+ spoolss_DsPrintAction action;
+ } spoolss_PrinterInfo7;
+
+ typedef struct {
+ [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode;
+ } spoolss_DeviceModeInfo;
+
+ typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(0)] spoolss_PrinterInfo0 info0;
+ [case(1)] spoolss_PrinterInfo1 info1;
+ [case(2)] spoolss_PrinterInfo2 info2;
+ [case(3)] spoolss_PrinterInfo3 info3;
+ [case(4)] spoolss_PrinterInfo4 info4;
+ [case(5)] spoolss_PrinterInfo5 info5;
+ [case(6)] spoolss_PrinterInfo6 info6;
+ [case(7)] spoolss_PrinterInfo7 info7;
+ [case(8)] spoolss_DeviceModeInfo info8;
+ [case(9)] spoolss_DeviceModeInfo info9;
+ [default];
+ } spoolss_PrinterInfo;
+
+ /******************/
+ /* Function: 0x00 */
+ /* we are using this as internal parsing code */
+ [public,noopnum,noprint] WERROR _spoolss_EnumPrinters(
+ [in] spoolss_EnumPrinterFlags flags,
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumPrinters(
+ [in] uint32 level,
+ [in] uint32 count,
+ [out,switch_is(level)] spoolss_PrinterInfo info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumPrinters(
+ [in] spoolss_EnumPrinterFlags flags,
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ /* what we have here is a subcontext containing an array of no discriminant unions
+ * and the array has no size in front
+ */
+ [out,ref] uint32 *count,
+ [out,ref,switch_is(level),size_is(,*count)] spoolss_PrinterInfo **info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x01 */
+ typedef [public] struct {
+ [value(_ndr_size_spoolss_DeviceMode(devmode, ndr->flags))] uint32 _ndr_size;
+ [subcontext(4),subcontext_size(_ndr_size)] spoolss_DeviceMode *devmode;
+ } spoolss_DevmodeContainer;
+
+ [public] WERROR spoolss_OpenPrinter(
+ [in,unique] [string,charset(UTF16)] uint16 *printername,
+ [in,unique] [string,charset(UTF16)] uint16 *datatype,
+ [in] spoolss_DevmodeContainer devmode_ctr,
+ [in] spoolss_AccessRights access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x02 */
+
+ typedef [public,gensize] struct {
+ uint32 job_id;
+ [relative] nstring *printer_name;
+ [relative] nstring *server_name;
+ [relative] nstring *user_name;
+ [relative] nstring *document_name;
+ [relative] nstring *data_type;
+ [relative] nstring *text_status;
+ spoolss_JobStatus status;
+ [range(0,99)] uint32 priority;
+ uint32 position;
+ uint32 total_pages;
+ uint32 pages_printed;
+ spoolss_Time submitted;
+ } spoolss_JobInfo1;
+
+ typedef [public,gensize] struct {
+ uint32 job_id;
+ [relative] nstring *printer_name;
+ [relative] nstring *server_name;
+ [relative] nstring *user_name;
+ [relative] nstring *document_name;
+ [relative] nstring *notify_name;
+ [relative] nstring *data_type;
+ [relative] nstring *print_processor;
+ [relative] nstring *parameters;
+ [relative] nstring *driver_name;
+ [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode;
+ [relative] nstring *text_status;
+ [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc;
+ spoolss_JobStatus status;
+ [range(0,99)] uint32 priority;
+ uint32 position;
+ uint32 start_time;
+ uint32 until_time;
+ uint32 total_pages;
+ uint32 size;
+ spoolss_Time submitted;
+ uint32 time;
+ uint32 pages_printed;
+ } spoolss_JobInfo2;
+
+ typedef [public,gensize] struct {
+ uint32 job_id;
+ uint32 next_job_id;
+ uint32 reserved;
+ } spoolss_JobInfo3;
+
+ typedef [public,gensize] struct {
+ uint32 job_id;
+ [relative] nstring *printer_name;
+ [relative] nstring *server_name;
+ [relative] nstring *user_name;
+ [relative] nstring *document_name;
+ [relative] nstring *notify_name;
+ [relative] nstring *data_type;
+ [relative] nstring *print_processor;
+ [relative] nstring *parameters;
+ [relative] nstring *driver_name;
+ [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode;
+ [relative] nstring *text_status;
+ [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc;
+ spoolss_JobStatus status;
+ [range(0,99)] uint32 priority;
+ uint32 position;
+ uint32 start_time;
+ uint32 until_time;
+ uint32 total_pages;
+ uint32 size;
+ spoolss_Time submitted;
+ uint32 time;
+ uint32 pages_printed;
+ uint32 size_high;
+ } spoolss_JobInfo4;
+
+ typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_JobInfo1 info1;
+ [case(2)] spoolss_JobInfo2 info2;
+ [case(3)] spoolss_JobInfo3 info3;
+ [case(4)] spoolss_JobInfo4 info4;
+ [default];
+ } spoolss_JobInfo;
+
+ typedef struct {
+ uint32 job_id;
+ [string,charset(UTF16)] uint16 *printer_name;
+ [string,charset(UTF16)] uint16 *server_name;
+ [string,charset(UTF16)] uint16 *user_name;
+ [string,charset(UTF16)] uint16 *document_name;
+ [string,charset(UTF16)] uint16 *data_type;
+ [string,charset(UTF16)] uint16 *text_status;
+ spoolss_JobStatus status;
+ [range(0,99)] uint32 priority;
+ uint32 position;
+ uint32 total_pages;
+ uint32 pages_printed;
+ spoolss_Time submitted;
+ } spoolss_SetJobInfo1;
+
+ typedef struct {
+ uint32 job_id;
+ [string,charset(UTF16)] uint16 *printer_name;
+ [string,charset(UTF16)] uint16 *server_name;
+ [string,charset(UTF16)] uint16 *user_name;
+ [string,charset(UTF16)] uint16 *document_name;
+ [string,charset(UTF16)] uint16 *notify_name;
+ [string,charset(UTF16)] uint16 *data_type;
+ [string,charset(UTF16)] uint16 *print_processor;
+ [string,charset(UTF16)] uint16 *parameters;
+ [string,charset(UTF16)] uint16 *driver_name;
+ uint3264 _devmode_ptr; /* ULONG_PTR */
+ [string,charset(UTF16)] uint16 *text_status;
+ uint3264 _secdesc_ptr; /* ULONG_PTR */
+ spoolss_JobStatus status;
+ [range(0,99)] uint32 priority;
+ uint32 position;
+ uint32 start_time;
+ uint32 until_time;
+ uint32 total_pages;
+ uint32 size;
+ spoolss_Time submitted;
+ uint32 time;
+ uint32 pages_printed;
+ } spoolss_SetJobInfo2;
+
+ typedef struct {
+ uint32 job_id;
+ [string,charset(UTF16)] uint16 *printer_name;
+ [string,charset(UTF16)] uint16 *server_name;
+ [string,charset(UTF16)] uint16 *user_name;
+ [string,charset(UTF16)] uint16 *document_name;
+ [string,charset(UTF16)] uint16 *notify_name;
+ [string,charset(UTF16)] uint16 *data_type;
+ [string,charset(UTF16)] uint16 *print_processor;
+ [string,charset(UTF16)] uint16 *parameters;
+ [string,charset(UTF16)] uint16 *driver_name;
+ uint3264 _devmode_ptr; /* ULONG_PTR */
+ [string,charset(UTF16)] uint16 *text_status;
+ uint3264 _secdesc_ptr; /* ULONG_PTR */
+ spoolss_JobStatus status;
+ [range(0,99)] uint32 priority;
+ uint32 position;
+ uint32 start_time;
+ uint32 until_time;
+ uint32 total_pages;
+ uint32 size;
+ spoolss_Time submitted;
+ uint32 time;
+ uint32 pages_printed;
+ uint32 size_high;
+ } spoolss_SetJobInfo4;
+
+ typedef [ms_union,public] union {
+ [case(1)] spoolss_SetJobInfo1 *info1;
+ [case(2)] spoolss_SetJobInfo2 *info2;
+ [case(3)] spoolss_JobInfo3 *info3;
+ [case(4)] spoolss_SetJobInfo4 *info4;
+ [default];
+ } spoolss_SetJobInfo;
+
+ typedef [public] struct {
+ uint32 level;
+ [switch_is(level)] spoolss_SetJobInfo info;
+ } spoolss_JobInfoContainer;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_JOB_CONTROL_NOOP = 0,
+ SPOOLSS_JOB_CONTROL_PAUSE = 1,
+ SPOOLSS_JOB_CONTROL_RESUME = 2,
+ SPOOLSS_JOB_CONTROL_CANCEL = 3,
+ SPOOLSS_JOB_CONTROL_RESTART = 4,
+ SPOOLSS_JOB_CONTROL_DELETE = 5,
+ SPOOLSS_JOB_CONTROL_SEND_TO_PRINTER = 6,
+ SPOOLSS_JOB_CONTROL_LAST_PAGE_EJECTED = 7,
+ SPOOLSS_JOB_CONTROL_RETAIN = 8,
+ SPOOLSS_JOB_CONTROL_RELEASE = 9
+ } spoolss_JobControl;
+
+ WERROR spoolss_SetJob(
+ [in,ref] policy_handle *handle,
+ [in] uint32 job_id,
+ [in,unique] spoolss_JobInfoContainer *ctr,
+ [in] spoolss_JobControl command
+ );
+
+ /******************/
+ /* Function: 0x03 */
+ WERROR spoolss_GetJob(
+ [in,ref] policy_handle *handle,
+ [in] uint32 job_id,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_JobInfo *info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x04 */
+ [public,noopnum,noprint] WERROR _spoolss_EnumJobs(
+ [in,ref] policy_handle *handle,
+ [in] uint32 firstjob,
+ [in] uint32 numjobs,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumJobs(
+ [in] uint32 level,
+ [in] uint32 count,
+ [out,switch_is(level)] spoolss_JobInfo info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumJobs(
+ [in,ref] policy_handle *handle,
+ [in] uint32 firstjob,
+ [in] uint32 numjobs,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,switch_is(level),size_is(,*count)] spoolss_JobInfo **info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x05 */
+ WERROR spoolss_AddPrinter(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,ref] spoolss_SetPrinterInfoCtr *info_ctr,
+ [in,ref] spoolss_DevmodeContainer *devmode_ctr,
+ [in,ref] sec_desc_buf *secdesc_ctr,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x06 */
+ WERROR spoolss_DeletePrinter(
+ [in] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x07 */
+ typedef [v1_enum] enum {
+ SPOOLSS_PRINTER_CONTROL_UNPAUSE = 0,
+ SPOOLSS_PRINTER_CONTROL_PAUSE = 1,
+ SPOOLSS_PRINTER_CONTROL_RESUME = 2,
+ SPOOLSS_PRINTER_CONTROL_PURGE = 3,
+ SPOOLSS_PRINTER_CONTROL_SET_STATUS = 4
+ } spoolss_PrinterControl;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *servername;
+ [string,charset(UTF16)] uint16 *printername;
+ uint32 cjobs;
+ uint32 total_jobs;
+ uint32 total_bytes;
+ spoolss_Time time;
+ uint32 global_counter;
+ uint32 total_pages;
+ uint32 version;
+ spoolss_Build free_build;
+ uint32 spooling;
+ uint32 max_spooling;
+ uint32 session_counter;
+ uint32 num_error_out_of_paper;
+ uint32 num_error_not_ready;
+ spoolss_JobStatus job_error;
+ uint32 number_of_processors;
+ spoolss_ProcessorType processor_type;
+ uint32 high_part_total_bytes;
+ uint32 change_id;
+ WERROR last_error;
+ spoolss_PrinterStatus status;
+ uint32 enumerate_network_printers;
+ uint32 c_setprinter;
+ spoolss_ProcessorArchitecture processor_architecture;
+ uint16 processor_level;
+ uint32 ref_ic;
+ uint32 reserved2;
+ uint32 reserved3;
+ } spoolss_SetPrinterInfo0;
+
+ typedef struct {
+ spoolss_PrinterAttributes flags;
+ [string,charset(UTF16)] uint16 *description;
+ [string,charset(UTF16)] uint16 *name;
+ [string,charset(UTF16)] uint16 *comment;
+ } spoolss_SetPrinterInfo1;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *servername;
+ [string,charset(UTF16)] uint16 *printername;
+ [string,charset(UTF16)] uint16 *sharename;
+ [string,charset(UTF16)] uint16 *portname;
+ [string,charset(UTF16)] uint16 *drivername;
+ [string,charset(UTF16)] uint16 *comment;
+ [string,charset(UTF16)] uint16 *location;
+ uint3264 devmode_ptr; /* ULONG_PTR */
+ [string,charset(UTF16)] uint16 *sepfile;
+ [string,charset(UTF16)] uint16 *printprocessor;
+ [string,charset(UTF16)] uint16 *datatype;
+ [string,charset(UTF16)] uint16 *parameters;
+ uint3264 secdesc_ptr; /* ULONG_PTR */
+ spoolss_PrinterAttributes attributes;
+ [range(0,99)] uint32 priority;
+ uint32 defaultpriority;
+ uint32 starttime;
+ uint32 untiltime;
+ spoolss_PrinterStatus status;
+ uint32 cjobs;
+ uint32 averageppm;
+ } spoolss_SetPrinterInfo2;
+
+ typedef struct {
+ uint3264 sec_desc_ptr; /* ULONG_PTR */
+ } spoolss_SetPrinterInfo3;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *printername;
+ [string,charset(UTF16)] uint16 *servername;
+ spoolss_PrinterAttributes attributes;
+ } spoolss_SetPrinterInfo4;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *printername;
+ [string,charset(UTF16)] uint16 *portname;
+ spoolss_PrinterAttributes attributes;
+ uint32 device_not_selected_timeout;
+ uint32 transmission_retry_timeout;
+ } spoolss_SetPrinterInfo5;
+
+ typedef struct {
+ spoolss_PrinterStatus status;
+ } spoolss_SetPrinterInfo6;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *guid; /* text form of printer guid */
+ spoolss_DsPrintAction action;
+ } spoolss_SetPrinterInfo7;
+
+ typedef struct {
+ uint3264 devmode_ptr; /* ULONG_PTR */
+ } spoolss_SetPrinterInfo8;
+
+ typedef struct {
+ uint3264 devmode_ptr; /* ULONG_PTR */
+ } spoolss_SetPrinterInfo9;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(0)] spoolss_SetPrinterInfo0 *info0;
+ [case(1)] spoolss_SetPrinterInfo1 *info1;
+ [case(2)] spoolss_SetPrinterInfo2 *info2;
+ [case(3)] spoolss_SetPrinterInfo3 *info3;
+ [case(4)] spoolss_SetPrinterInfo4 *info4;
+ [case(5)] spoolss_SetPrinterInfo5 *info5;
+ [case(6)] spoolss_SetPrinterInfo6 *info6;
+ [case(7)] spoolss_SetPrinterInfo7 *info7;
+ [case(8)] spoolss_SetPrinterInfo8 *info8;
+ [case(9)] spoolss_SetPrinterInfo9 *info9;
+ [default];
+ } spoolss_SetPrinterInfo;
+
+ typedef [public] struct {
+ uint32 level;
+ [switch_is(level)] spoolss_SetPrinterInfo info;
+ } spoolss_SetPrinterInfoCtr;
+
+ [public] WERROR spoolss_SetPrinter(
+ [in,ref] policy_handle *handle,
+ [in,ref] spoolss_SetPrinterInfoCtr *info_ctr,
+ [in,ref] spoolss_DevmodeContainer *devmode_ctr,
+ [in,ref] sec_desc_buf *secdesc_ctr,
+ [in] spoolss_PrinterControl command
+ );
+
+ /******************/
+ /* Function: 0x08 */
+ [public] WERROR spoolss_GetPrinter(
+ [in,ref] policy_handle *handle,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x09 */
+
+ typedef [public] struct {
+ [value((ndr_size_spoolss_StringArray(r, ndr->flags)-4)/2)] uint32 _ndr_size;
+ /*[subcontext(0),subcontext_size(_ndr_size*2)]*/ nstring_array string;
+ } spoolss_StringArray;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *driver_name;
+ } spoolss_AddDriverInfo1;
+
+ typedef [v1_enum,public] enum {
+ SPOOLSS_DRIVER_VERSION_9X = 0,
+ SPOOLSS_DRIVER_VERSION_NT35 = 1,
+ SPOOLSS_DRIVER_VERSION_NT4 = 2,
+ SPOOLSS_DRIVER_VERSION_200X = 3,
+ SPOOLSS_DRIVER_VERSION_2012 = 4
+ } spoolss_DriverOSVersion;
+
+ typedef struct {
+ spoolss_DriverOSVersion version;
+ [string,charset(UTF16)] uint16 *driver_name;
+ [string,charset(UTF16)] uint16 *architecture;
+ [string,charset(UTF16)] uint16 *driver_path;
+ [string,charset(UTF16)] uint16 *data_file;
+ [string,charset(UTF16)] uint16 *config_file;
+ } spoolss_AddDriverInfo2;
+
+ typedef struct {
+ spoolss_DriverOSVersion version;
+ [string,charset(UTF16)] uint16 *driver_name;
+ [string,charset(UTF16)] uint16 *architecture;
+ [string,charset(UTF16)] uint16 *driver_path;
+ [string,charset(UTF16)] uint16 *data_file;
+ [string,charset(UTF16)] uint16 *config_file;
+ [string,charset(UTF16)] uint16 *help_file;
+ [string,charset(UTF16)] uint16 *monitor_name;
+ [string,charset(UTF16)] uint16 *default_datatype;
+ [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
+ spoolss_StringArray *dependent_files;
+ } spoolss_AddDriverInfo3;
+
+ typedef struct {
+ spoolss_DriverOSVersion version;
+ [string,charset(UTF16)] uint16 *driver_name;
+ [string,charset(UTF16)] uint16 *architecture;
+ [string,charset(UTF16)] uint16 *driver_path;
+ [string,charset(UTF16)] uint16 *data_file;
+ [string,charset(UTF16)] uint16 *config_file;
+ [string,charset(UTF16)] uint16 *help_file;
+ [string,charset(UTF16)] uint16 *monitor_name;
+ [string,charset(UTF16)] uint16 *default_datatype;
+ [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
+ spoolss_StringArray *dependent_files;
+ [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
+ spoolss_StringArray *previous_names;
+ } spoolss_AddDriverInfo4;
+
+ typedef [bitmap32bit] bitmap {
+ PRINTER_DRIVER_PACKAGE_AWARE = 0x00000001,
+ PRINTER_DRIVER_XPS = 0x00000002,
+ PRINTER_DRIVER_SANDBOX_ENABLED = 0x00000004,
+ PRINTER_DRIVER_CLASS = 0x00000008,
+ PRINTER_DRIVER_DERIVED = 0x00000010,
+ PRINTER_DRIVER_NOT_SHAREABLE = 0x00000020,
+ PRINTER_DRIVER_CATEGORY_FAX = 0x00000040,
+ PRINTER_DRIVER_CATEGORY_FILE = 0x00000080,
+ PRINTER_DRIVER_CATEGORY_VIRTUAL = 0x00000100,
+ PRINTER_DRIVER_CATEGORY_SERVICE = 0x00000200,
+ PRINTER_DRIVER_SOFT_RESET_REQUIRED = 0x00000400,
+ PRINTER_DRIVER_CATEGORY_3D = 0x00001000
+ } spoolss_DriverAttributes;
+
+ typedef struct {
+ spoolss_DriverOSVersion version;
+ [string,charset(UTF16)] uint16 *driver_name;
+ [string,charset(UTF16)] uint16 *architecture;
+ [string,charset(UTF16)] uint16 *driver_path;
+ [string,charset(UTF16)] uint16 *data_file;
+ [string,charset(UTF16)] uint16 *config_file;
+ spoolss_DriverAttributes driver_attributes;
+ uint32 config_version;
+ uint32 driver_version;
+ } spoolss_AddDriverInfo5;
+
+ typedef struct {
+ spoolss_DriverOSVersion version;
+ [string,charset(UTF16)] uint16 *driver_name;
+ [string,charset(UTF16)] uint16 *architecture;
+ [string,charset(UTF16)] uint16 *driver_path;
+ [string,charset(UTF16)] uint16 *data_file;
+ [string,charset(UTF16)] uint16 *config_file;
+ [string,charset(UTF16)] uint16 *help_file;
+ [string,charset(UTF16)] uint16 *monitor_name;
+ [string,charset(UTF16)] uint16 *default_datatype;
+ [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
+ spoolss_StringArray *dependent_files;
+ [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
+ spoolss_StringArray *previous_names;
+ NTTIME driver_date;
+ hyper driver_version;
+ [string,charset(UTF16)] uint16 *manufacturer_name;
+ [string,charset(UTF16)] uint16 *manufacturer_url;
+ [string,charset(UTF16)] uint16 *hardware_id;
+ [string,charset(UTF16)] uint16 *provider;
+ } spoolss_AddDriverInfo6;
+
+ typedef struct {
+ spoolss_DriverOSVersion version;
+ [string,charset(UTF16)] uint16 *driver_name;
+ [string,charset(UTF16)] uint16 *architecture;
+ [string,charset(UTF16)] uint16 *driver_path;
+ [string,charset(UTF16)] uint16 *data_file;
+ [string,charset(UTF16)] uint16 *config_file;
+ [string,charset(UTF16)] uint16 *help_file;
+ [string,charset(UTF16)] uint16 *monitor_name;
+ [string,charset(UTF16)] uint16 *default_datatype;
+ [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
+ spoolss_StringArray *dependent_files;
+ [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
+ spoolss_StringArray *previous_names;
+ NTTIME driver_date;
+ hyper driver_version;
+ [string,charset(UTF16)] uint16 *manufacturer_name;
+ [string,charset(UTF16)] uint16 *manufacturer_url;
+ [string,charset(UTF16)] uint16 *hardware_id;
+ [string,charset(UTF16)] uint16 *provider;
+ [string,charset(UTF16)] uint16 *print_processor;
+ [string,charset(UTF16)] uint16 *vendor_setup;
+ [value(((ndr_size_spoolss_StringArray(color_profiles, ndr->flags)-4)/2))] uint32 _ndr_size_color_profiles;
+ spoolss_StringArray *color_profiles;
+ [string,charset(UTF16)] uint16 *inf_path;
+ spoolss_DriverAttributes printer_driver_attributes;
+ [value(((ndr_size_spoolss_StringArray(core_driver_dependencies, ndr->flags)-4)/2))] uint32 _ndr_size_core_driver_dependencies;
+ spoolss_StringArray *core_driver_dependencies;
+ NTTIME min_inbox_driver_ver_date;
+ hyper min_inbox_driver_ver_version;
+ } spoolss_AddDriverInfo8;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(1)] spoolss_AddDriverInfo1 *info1;
+ [case(2)] spoolss_AddDriverInfo2 *info2;
+ [case(3)] spoolss_AddDriverInfo3 *info3;
+ [case(4)] spoolss_AddDriverInfo4 *info4;
+ [case(6)] spoolss_AddDriverInfo6 *info6;
+ [case(8)] spoolss_AddDriverInfo8 *info8;
+ } spoolss_AddDriverInfo;
+
+ typedef [public] struct {
+ uint32 level;
+ [switch_is(level)] spoolss_AddDriverInfo info;
+ } spoolss_AddDriverInfoCtr;
+
+ WERROR spoolss_AddPrinterDriver(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,ref] spoolss_AddDriverInfoCtr *info_ctr
+ );
+
+ typedef [public,gensize] struct {
+ [relative] nstring *driver_name;
+ } spoolss_DriverInfo1;
+
+ typedef [public,gensize] struct {
+ spoolss_DriverOSVersion version;
+ [relative] nstring *driver_name;
+ [relative] nstring *architecture;
+ [relative] nstring *driver_path;
+ [relative] nstring *data_file;
+ [relative] nstring *config_file;
+ } spoolss_DriverInfo2;
+
+ typedef [public,gensize] struct {
+ spoolss_DriverOSVersion version;
+ [relative] nstring *driver_name;
+ [relative] nstring *architecture;
+ [relative] nstring *driver_path;
+ [relative] nstring *data_file;
+ [relative] nstring *config_file;
+ [relative] nstring *help_file;
+ [relative] nstring_array *dependent_files;
+ [relative] nstring *monitor_name;
+ [relative] nstring *default_datatype;
+ } spoolss_DriverInfo3;
+
+ typedef [public,gensize] struct {
+ spoolss_DriverOSVersion version;
+ [relative] nstring *driver_name;
+ [relative] nstring *architecture;
+ [relative] nstring *driver_path;
+ [relative] nstring *data_file;
+ [relative] nstring *config_file;
+ [relative] nstring *help_file;
+ [relative] nstring_array *dependent_files;
+ [relative] nstring *monitor_name;
+ [relative] nstring *default_datatype;
+ [relative] nstring_array *previous_names;
+ } spoolss_DriverInfo4;
+
+ typedef [public,gensize] struct {
+ spoolss_DriverOSVersion version;
+ [relative] nstring *driver_name;
+ [relative] nstring *architecture;
+ [relative] nstring *driver_path;
+ [relative] nstring *data_file;
+ [relative] nstring *config_file;
+ spoolss_DriverAttributes driver_attributes;
+ uint32 config_version;
+ uint32 driver_version;
+ } spoolss_DriverInfo5;
+
+ typedef [public,gensize] struct {
+ spoolss_DriverOSVersion version;
+ [relative] nstring *driver_name;
+ [relative] nstring *architecture;
+ [relative] nstring *driver_path;
+ [relative] nstring *data_file;
+ [relative] nstring *config_file;
+ [relative] nstring *help_file;
+ [relative] nstring_array *dependent_files;
+ [relative] nstring *monitor_name;
+ [relative] nstring *default_datatype;
+ [relative] nstring_array *previous_names;
+ NTTIME driver_date;
+ hyper driver_version;
+ [relative] nstring *manufacturer_name;
+ [relative] nstring *manufacturer_url;
+ [relative] nstring *hardware_id;
+ [relative] nstring *provider;
+ } spoolss_DriverInfo6;
+
+ typedef [public,gensize] struct {
+ uint32 size;
+ spoolss_DriverOSVersion version;
+ [relative] nstring *driver_name;
+ [relative] nstring *inf_name;
+ [relative] nstring *install_source_root;
+ } spoolss_DriverInfo7;
+
+ typedef [public,gensize] struct {
+ spoolss_DriverOSVersion version;
+ [relative] nstring *driver_name;
+ [relative] nstring *architecture;
+ [relative] nstring *driver_path;
+ [relative] nstring *data_file;
+ [relative] nstring *config_file;
+ [relative] nstring *help_file;
+ [relative] nstring_array *dependent_files;
+ [relative] nstring *monitor_name;
+ [relative] nstring *default_datatype;
+ [relative] nstring_array *previous_names;
+ NTTIME driver_date;
+ hyper driver_version;
+ [relative] nstring *manufacturer_name;
+ [relative] nstring *manufacturer_url;
+ [relative] nstring *hardware_id;
+ [relative] nstring *provider;
+ [relative] nstring *print_processor;
+ [relative] nstring *vendor_setup;
+ [relative] nstring_array *color_profiles;
+ [relative] nstring *inf_path;
+ spoolss_DriverAttributes printer_driver_attributes;
+ [relative] nstring_array *core_driver_dependencies;
+ NTTIME min_inbox_driver_ver_date;
+ hyper min_inbox_driver_ver_version;
+ } spoolss_DriverInfo8;
+
+ typedef [v1_enum] enum {
+ SPOOLSS_DRIVER_FILE_TYPE_RENDERING = 0x00000000,
+ SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION = 0x00000001,
+ SPOOLSS_DRIVER_FILE_TYPE_DATA = 0x00000002,
+ SPOOLSS_DRIVER_FILE_TYPE_HELP = 0x00000003,
+ SPOOLSS_DRIVER_FILE_TYPE_OTHER = 0x00000004
+ } spoolss_DriverFileType;
+
+ typedef [public] struct {
+ [relative] nstring *file_name;
+ spoolss_DriverFileType file_type;
+ uint32 file_version;
+ } spoolss_DriverFileInfo;
+
+ typedef [public,gensize,nopush,nopull] struct {
+ spoolss_DriverOSVersion version;
+ [relative] nstring *driver_name;
+ [relative] nstring *architecture;
+ [relative,size_is(file_count),flag(NDR_ALIGN4)] spoolss_DriverFileInfo *file_info;
+ uint32 file_count;
+ [relative] nstring *monitor_name;
+ [relative] nstring *default_datatype;
+ [relative] nstring_array *previous_names;
+ NTTIME driver_date;
+ hyper driver_version;
+ [relative] nstring *manufacturer_name;
+ [relative] nstring *manufacturer_url;
+ [relative] nstring *hardware_id;
+ [relative] nstring *provider;
+ } spoolss_DriverInfo101;
+
+ typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_DriverInfo1 info1;
+ [case(2)] spoolss_DriverInfo2 info2;
+ [case(3)] spoolss_DriverInfo3 info3;
+ [case(4)] spoolss_DriverInfo4 info4;
+ [case(5)] spoolss_DriverInfo5 info5;
+ [case(6)] spoolss_DriverInfo6 info6;
+ [case(7)] spoolss_DriverInfo7 info7;
+ [case(8)] spoolss_DriverInfo8 info8;
+ [case(101)] spoolss_DriverInfo101 info101;
+ [default];
+ } spoolss_DriverInfo;
+
+ /******************/
+ /* Function: 0x0a */
+ [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDrivers(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,unique] [string,charset(UTF16)] uint16 *environment,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumPrinterDrivers(
+ [in] uint32 level,
+ [in] uint32 count,
+ [out,switch_is(level)] spoolss_DriverInfo info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumPrinterDrivers(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,unique] [string,charset(UTF16)] uint16 *environment,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,switch_is(level),size_is(,*count)] spoolss_DriverInfo **info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x0b */
+ WERROR spoolss_GetPrinterDriver(
+ [in,ref] policy_handle *handle,
+ [in,unique] [string,charset(UTF16)] uint16 *architecture,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x0c */
+ typedef [public,gensize] struct {
+ nstring directory_name;
+ } spoolss_DriverDirectoryInfo1;
+
+ /* NOTE: it's seems that w2k3 completly ignores the level
+ in its server code
+ */
+ typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_DriverDirectoryInfo1 info1;
+ [default] spoolss_DriverDirectoryInfo1 info1;
+ } spoolss_DriverDirectoryInfo;
+
+ [public] WERROR spoolss_GetPrinterDriverDirectory(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,unique] [string,charset(UTF16)] uint16 *environment,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x0d */
+ WERROR spoolss_DeletePrinterDriver(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in] [string,charset(UTF16)] uint16 architecture[],
+ [in] [string,charset(UTF16)] uint16 driver[]
+ );
+
+ /******************/
+ /* Function: 0x0e */
+ WERROR spoolss_AddPrintProcessor(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in] [string,charset(UTF16)] uint16 architecture[],
+ [in] [string,charset(UTF16)] uint16 path_name[],
+ [in] [string,charset(UTF16)] uint16 print_processor_name[]
+ );
+
+ /******************/
+ /* Function: 0x0f */
+ typedef [public,gensize] struct {
+ [relative] nstring *print_processor_name;
+ } spoolss_PrintProcessorInfo1;
+
+ typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_PrintProcessorInfo1 info1;
+ [default];
+ } spoolss_PrintProcessorInfo;
+
+ [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessors(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,unique] [string,charset(UTF16)] uint16 *environment,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumPrintProcessors(
+ [in] uint32 level,
+ [in] uint32 count,
+ [out,switch_is(level)] spoolss_PrintProcessorInfo info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumPrintProcessors(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,unique] [string,charset(UTF16)] uint16 *environment,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,switch_is(level),size_is(,*count)] spoolss_PrintProcessorInfo **info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x10 */
+ typedef [public,gensize] struct {
+ nstring directory_name;
+ } spoolss_PrintProcessorDirectoryInfo1;
+
+ typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_PrintProcessorDirectoryInfo1 info1;
+ [default] spoolss_PrintProcessorDirectoryInfo1 info1;
+ } spoolss_PrintProcessorDirectoryInfo;
+
+ WERROR spoolss_GetPrintProcessorDirectory(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,unique] [string,charset(UTF16)] uint16 *environment,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrintProcessorDirectoryInfo *info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x11 */
+ typedef struct {
+ [string,charset(UTF16)] uint16 *document_name;
+ [string,charset(UTF16)] uint16 *output_file;
+ [string,charset(UTF16)] uint16 *datatype;
+ } spoolss_DocumentInfo1;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(1)] spoolss_DocumentInfo1 *info1;
+ [case(2)]; /* TODO */
+ [case(3)]; /* TODO */
+ [default];
+ } spoolss_DocumentInfo;
+
+ typedef [public] struct {
+ uint32 level;
+ [switch_is(level)] spoolss_DocumentInfo info;
+ } spoolss_DocumentInfoCtr;
+
+ WERROR spoolss_StartDocPrinter(
+ [in,ref] policy_handle *handle,
+ [in,ref] spoolss_DocumentInfoCtr *info_ctr,
+ [out,ref] uint32 *job_id
+ );
+
+ /******************/
+ /* Function: 0x12 */
+ WERROR spoolss_StartPagePrinter(
+ [in,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x13 */
+ WERROR spoolss_WritePrinter(
+ [in,ref] policy_handle *handle,
+ [in] DATA_BLOB data,
+ [in,value(r->in.data.length)] uint32 _data_size,
+ [out,ref] uint32 *num_written
+ );
+
+ /******************/
+ /* Function: 0x14 */
+ WERROR spoolss_EndPagePrinter(
+ [in,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x15 */
+ WERROR spoolss_AbortPrinter(
+ [in,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x16 */
+ WERROR spoolss_ReadPrinter(
+ [in,ref] policy_handle *handle,
+ [out,ref] [size_is(data_size)] uint8 *data,
+ [in] uint32 data_size,
+ [out,ref] uint32 *_data_size
+ );
+
+ /******************/
+ /* Function: 0x17 */
+ WERROR spoolss_EndDocPrinter(
+ [in,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x18 */
+ WERROR spoolss_AddJob(
+ [in,ref] policy_handle *handle,
+ [in] uint32 level,
+ [in,out,unique] [size_is(offered)] uint8 *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x19 */
+ WERROR spoolss_ScheduleJob(
+ [in,ref] policy_handle *handle,
+ [in] uint32 jobid
+ );
+
+ /******************/
+ /* Function: 0x1a */
+
+ const string SPL_ARCH_WIN40 = "WIN40";
+ const string SPL_ARCH_W32X86 = "W32X86";
+ const string SPL_ARCH_W32MIPS = "W32MIPS";
+ const string SPL_ARCH_W32ALPHA = "W32ALPHA";
+ const string SPL_ARCH_W32PPC = "W32PPC";
+ const string SPL_ARCH_IA64 = "IA64";
+ const string SPL_ARCH_X64 = "x64";
+ const string SPL_ARCH_ARM = "ARM";
+ const string SPL_ARCH_ARM64 = "ARM64";
+
+ const string SPOOLSS_ARCHITECTURE_ALL = "All";
+ const string SPOOLSS_ARCHITECTURE_ALL_CLUSTER = "AllCluster";
+ const string SPOOLSS_ARCHITECTURE_NT_X86 = "Windows NT x86";
+ const string SPOOLSS_ARCHITECTURE_IA_64 = "Windows IA64";
+ const string SPOOLSS_ARCHITECTURE_x64 = "Windows x64";
+ const string SPOOLSS_ARCHITECTURE_4_0 = "Windows 4.0";
+ const string SPOOLSS_ARCHITECTURE_W32MIPS = "Windows NT R4000";
+ const string SPOOLSS_ARCHITECTURE_W32PPC = "Windows NT PowerPC";
+ const string SPOOLSS_ARCHITECTURE_W32ALPHA = "Windows NT Alpha AXP";
+ const string SPOOLSS_ARCHITECTURE_ARM = "Windows ARM";
+ const string SPOOLSS_ARCHITECTURE_ARM64 = "Windows ARM64";
+ const string SPOOLSS_DEFAULT_SERVER_PATH = "C:\\WINDOWS\\system32\\spool";
+
+ typedef [public,gensize] struct {
+ [value(ndr_size_spoolss_OSVersion(r,ndr->flags))] uint32 _ndr_size;
+ uint32 major;
+ uint32 minor;
+ uint32 build;
+ [value(2)] uint32 platform_id;
+ [subcontext(0),subcontext_size(256)] nstring extra_string;
+ } spoolss_OSVersion;
+
+ typedef [public,gensize] struct {
+ [value(ndr_size_spoolss_OSVersionEx(r,ndr->flags))] uint32 _ndr_size;
+ uint32 major;
+ uint32 minor;
+ uint32 build;
+ [value(2)] uint32 platform_id;
+ [subcontext(0),subcontext_size(256)] nstring extra_string;
+ uint16 service_pack_major;
+ uint16 service_pack_minor;
+ uint16 suite_mask;
+ uint8 product_type;
+ uint8 reserved;
+ } spoolss_OSVersionEx;
+
+ typedef [nodiscriminant,public] union {
+ [case(REG_NONE)];
+ [case(REG_SZ)] nstring string;
+ [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
+ [case(REG_DWORD)] uint32 value;
+ [case(REG_MULTI_SZ)] nstring_array string_array;
+ [default,flag(NDR_REMAINING)] DATA_BLOB data;
+ } spoolss_PrinterData;
+
+ /* predefined registry key names for printer data */
+
+ const string SPOOL_PRINTERDATA_KEY = "PrinterDriverData";
+ const string SPOOL_DSSPOOLER_KEY = "DsSpooler";
+ const string SPOOL_DSDRIVER_KEY = "DsDriver";
+ const string SPOOL_DSUSER_KEY = "DsUser";
+ const string SPOOL_PNPDATA_KEY = "PnPData";
+ const string SPOOL_OID_KEY = "OID";
+
+ /* predefined value names for printer data */
+
+ const string SPOOL_REG_ASSETNUMBER = "assetNumber";
+ const string SPOOL_REG_BYTESPERMINUTE = "bytesPerMinute";
+ const string SPOOL_REG_DEFAULTPRIORITY = "defaultPriority";
+ const string SPOOL_REG_DESCRIPTION = "description";
+ const string SPOOL_REG_DRIVERNAME = "driverName";
+ const string SPOOL_REG_DRIVERVERSION = "driverVersion";
+ const string SPOOL_REG_FLAGS = "flags";
+ const string SPOOL_REG_LOCATION = "location";
+ const string SPOOL_REG_OPERATINGSYSTEM = "operatingSystem";
+ const string SPOOL_REG_OPERATINGSYSTEMHOTFIX = "operatingSystemHotfix";
+ const string SPOOL_REG_OPERATINGSYSTEMSERVICEPACK = "operatingSystemServicePack";
+ const string SPOOL_REG_OPERATINGSYSTEMVERSION = "operatingSystemVersion";
+ const string SPOOL_REG_PORTNAME = "portName";
+ const string SPOOL_REG_PRINTATTRIBUTES = "printAttributes";
+ const string SPOOL_REG_PRINTBINNAMES = "printBinNames";
+ const string SPOOL_REG_PRINTCOLLATE = "printCollate";
+ const string SPOOL_REG_PRINTCOLOR = "printColor";
+ const string SPOOL_REG_PRINTDUPLEXSUPPORTED = "printDuplexSupported";
+ const string SPOOL_REG_PRINTENDTIME = "printEndTime";
+ const string SPOOL_REG_PRINTERNAME = "printerName";
+ const string SPOOL_REG_PRINTFORMNAME = "printFormName";
+ const string SPOOL_REG_PRINTKEEPPRINTEDJOBS = "printKeepPrintedJobs";
+ const string SPOOL_REG_PRINTLANGUAGE = "printLanguage";
+ const string SPOOL_REG_PRINTMACADDRESS = "printMACAddress";
+ const string SPOOL_REG_PRINTMAXCOPIES = "printMaxCopies";
+ const string SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED = "printMaxResolutionSupported";
+ const string SPOOL_REG_PRINTMAXXEXTENT = "printMaxXExtent";
+ const string SPOOL_REG_PRINTMAXYEXTENT = "printMaxYExtent";
+ const string SPOOL_REG_PRINTMEDIAREADY = "printMediaReady";
+ const string SPOOL_REG_PRINTMEDIASUPPORTED = "printMediaSupported";
+ const string SPOOL_REG_PRINTMEMORY = "printMemory";
+ const string SPOOL_REG_PRINTMINXEXTENT = "printMinXExtent";
+ const string SPOOL_REG_PRINTMINYEXTENT = "printMinYExtent";
+ const string SPOOL_REG_PRINTNETWORKADDRESS = "printNetworkAddress";
+ const string SPOOL_REG_PRINTNOTIFY = "printNotify";
+ const string SPOOL_REG_PRINTNUMBERUP = "printNumberUp";
+ const string SPOOL_REG_PRINTORIENTATIONSSUPPORTED = "printOrientationsSupported";
+ const string SPOOL_REG_PRINTOWNER = "printOwner";
+ const string SPOOL_REG_PRINTPAGESPERMINUTE = "printPagesPerMinute";
+ const string SPOOL_REG_PRINTRATE = "printRate";
+ const string SPOOL_REG_PRINTRATEUNIT = "printRateUnit";
+ const string SPOOL_REG_PRINTSEPARATORFILE = "printSeparatorFile";
+ const string SPOOL_REG_PRINTSHARENAME = "printShareName";
+ const string SPOOL_REG_PRINTSPOOLING = "printSpooling";
+ const string SPOOL_REGVAL_PRINTWHILESPOOLING = "PrintWhileSpooling";
+ const string SPOOL_REGVAL_PRINTAFTERSPOOLED = "PrintAfterSpooled";
+ const string SPOOL_REGVAL_PRINTDIRECT = "PrintDirect";
+ const string SPOOL_REG_PRINTSTAPLINGSUPPORTED = "printStaplingSupported";
+ const string SPOOL_REG_PRINTSTARTTIME = "printStartTime";
+ const string SPOOL_REG_PRINTSTATUS = "printStatus";
+ const string SPOOL_REG_PRIORITY = "priority";
+ const string SPOOL_REG_SERVERNAME = "serverName";
+ const string SPOOL_REG_SHORTSERVERNAME = "shortServerName";
+ const string SPOOL_REG_UNCNAME = "uNCName";
+ const string SPOOL_REG_URL = "url";
+ const string SPOOL_REG_VERSIONNUMBER = "versionNumber";
+
+ [public] WERROR spoolss_GetPrinterData(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 value_name[],
+ [out,ref] winreg_Type *type,
+ [out,ref,size_is(offered)] uint8 *data,
+ [in] uint32 offered,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x1b */
+ WERROR spoolss_SetPrinterData(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 value_name[],
+ [in] winreg_Type type,
+ [in,ref] [size_is(offered)] uint8 *data,
+ [in] uint32 offered
+ );
+
+ /******************/
+ /* Function: 0x1c */
+ [todo] WERROR spoolss_WaitForPrinterChange(
+ );
+
+ /******************/
+ /* Function: 0x1d */
+ [public] WERROR spoolss_ClosePrinter(
+ [in,out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x1e */
+ typedef [v1_enum] enum {
+ SPOOLSS_FORM_USER = 0,
+ SPOOLSS_FORM_BUILTIN = 1,
+ SPOOLSS_FORM_PRINTER = 2
+ } spoolss_FormFlags;
+
+ typedef struct {
+ uint32 width;
+ uint32 height;
+ } spoolss_FormSize;
+
+ typedef struct {
+ uint32 left;
+ uint32 top;
+ uint32 right;
+ uint32 bottom;
+ } spoolss_FormArea;
+
+ typedef [public,gensize] struct {
+ spoolss_FormFlags flags;
+ [relative] nstring *form_name;
+ spoolss_FormSize size;
+ spoolss_FormArea area;
+ } spoolss_FormInfo1;
+
+ typedef [bitmap32bit] bitmap {
+ SPOOLSS_FORM_STRING_TYPE_NONE = 0x00000001,
+ SPOOLSS_FORM_STRING_TYPE_MUI_DLL = 0x00000002,
+ SPOOLSS_FORM_STRING_TYPE_LANG_PAIR = 0x00000004
+ } spoolss_FormStringType;
+
+ typedef [public,gensize] struct {
+ spoolss_FormFlags flags;
+ [relative] nstring *form_name;
+ spoolss_FormSize size;
+ spoolss_FormArea area;
+ [relative] astring *keyword;
+ spoolss_FormStringType string_type;
+ [relative] nstring *mui_dll;
+ uint32 ressource_id;
+ [relative] nstring *display_name;
+ uint16 lang_id;
+ uint16 unused;
+ } spoolss_FormInfo2;
+
+ typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_FormInfo1 info1;
+ [case(2)] spoolss_FormInfo2 info2;
+ [default];
+ } spoolss_FormInfo;
+
+ typedef struct {
+ spoolss_FormFlags flags;
+ [string,charset(UTF16)] uint16 *form_name;
+ spoolss_FormSize size;
+ spoolss_FormArea area;
+ } spoolss_AddFormInfo1;
+
+ typedef struct {
+ spoolss_FormFlags flags;
+ [string,charset(UTF16)] uint16 *form_name;
+ spoolss_FormSize size;
+ spoolss_FormArea area;
+ [string,charset(DOS)] uint8 *keyword;
+ spoolss_FormStringType string_type;
+ [string,charset(UTF16)] uint16 *mui_dll;
+ uint32 ressource_id;
+ [string,charset(UTF16)] uint16 *display_name;
+ uint32 lang_id;
+ } spoolss_AddFormInfo2;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(1)] spoolss_AddFormInfo1 *info1;
+ [case(2)] spoolss_AddFormInfo2 *info2;
+ } spoolss_AddFormInfo;
+
+ typedef [public] struct {
+ uint32 level;
+ [switch_is(level)] spoolss_AddFormInfo info;
+ } spoolss_AddFormInfoCtr;
+
+ WERROR spoolss_AddForm(
+ [in,ref] policy_handle *handle,
+ [in,ref] spoolss_AddFormInfoCtr *info_ctr
+ );
+
+ /******************/
+ /* Function: 0x1f */
+ WERROR spoolss_DeleteForm(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 form_name[]
+ );
+
+ /******************/
+ /* Function: 0x20 */
+ WERROR spoolss_GetForm(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 form_name[],
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x21 */
+ WERROR spoolss_SetForm(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 form_name[],
+ [in,ref] spoolss_AddFormInfoCtr *info_ctr
+ );
+
+ /******************/
+ /* Function: 0x22 */
+ [public,noopnum,noprint] WERROR _spoolss_EnumForms(
+ [in,ref] policy_handle *handle,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumForms(
+ [in] uint32 level,
+ [in] uint32 count,
+ [out,switch_is(level)] spoolss_FormInfo info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumForms(
+ [in,ref] policy_handle *handle,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,switch_is(level),size_is(,*count)] spoolss_FormInfo **info,
+ [out,ref] uint32 *needed
+ );
+
+ /*
+ * Special strings for the OpenPrinter() call. See the MSDN DDK
+ * docs on the XcvDataPort() for more details.
+ */
+
+ const string SPL_LOCAL_PORT = "Local Port";
+ const string SPL_TCPIP_PORT = "Standard TCP/IP Port";
+ const string SPL_XCV_MONITOR_LOCALMON = ",XcvMonitor Local Port";
+ const string SPL_XCV_MONITOR_TCPMON = ",XcvMonitor Standard TCP/IP Port";
+
+ typedef [public,gensize] struct {
+ [relative] nstring *port_name;
+ } spoolss_PortInfo1;
+
+ typedef bitmap {
+ SPOOLSS_PORT_TYPE_WRITE = 0x00000001,
+ SPOOLSS_PORT_TYPE_READ = 0x00000002,
+ SPOOLSS_PORT_TYPE_REDIRECTED = 0x00000004,
+ SPOOLSS_PORT_TYPE_NET_ATTACHED = 0x00000008
+ } spoolss_PortType;
+
+ typedef [public,gensize] struct {
+ [relative] nstring *port_name;
+ [relative] nstring *monitor_name;
+ [relative] nstring *description;
+ spoolss_PortType port_type;
+ uint32 reserved;
+ } spoolss_PortInfo2;
+
+ typedef [v1_enum] enum {
+ PORT_STATUS_CLEAR = 0x00000000,
+ PORT_STATUS_OFFLINE = 0x00000001,
+ PORT_STATUS_PAPER_JAM = 0x00000002,
+ PORT_STATUS_PAPER_OUT = 0x00000003,
+ PORT_STATUS_OUTPUT_BIN_FULL = 0x00000004,
+ PORT_STATUS_PAPER_PROBLEM = 0x00000005,
+ PORT_STATUS_NO_TONER = 0x00000006,
+ PORT_STATUS_DOOR_OPEN = 0x00000007,
+ PORT_STATUS_USER_INTERVENTION = 0x00000008,
+ PORT_STATUS_OUT_OF_MEMORY = 0x00000009,
+ PORT_STATUS_TONER_LOW = 0x0000000A,
+ PORT_STATUS_WARMING_UP = 0x0000000B,
+ PORT_STATUS_POWER_SAVE = 0x0000000C
+ } spoolss_PortStatus;
+
+ typedef [v1_enum] enum {
+ PORT_STATUS_TYPE_ERROR = 0x00000001,
+ PORT_STATUS_TYPE_WARNING = 0x00000002,
+ PORT_STATUS_TYPE_INFO = 0x00000003
+ } spoolss_PortSeverity;
+
+ typedef [public,gensize] struct {
+ spoolss_PortStatus status;
+ [relative] nstring *status_string;
+ spoolss_PortSeverity severity;
+ } spoolss_PortInfo3;
+
+ typedef [public,gensize] struct {
+ [relative] nstring *port_name;
+ DATA_BLOB monitor_data; /* relative ?? */
+ } spoolss_PortInfoFF;
+
+ typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_PortInfo1 info1;
+ [case(2)] spoolss_PortInfo2 info2;
+ [case(3)] spoolss_PortInfo3 info3;
+ [case(0xff)] spoolss_PortInfoFF infoFF;
+ [default];
+ } spoolss_PortInfo;
+
+ /******************/
+ /* Function: 0x23 */
+ [public,noopnum,noprint] WERROR _spoolss_EnumPorts(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumPorts(
+ [in] uint32 level,
+ [in] uint32 count,
+ [out,switch_is(level)] spoolss_PortInfo info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumPorts(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,switch_is(level),size_is(,*count)] spoolss_PortInfo **info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x24 */
+ typedef [public,gensize] struct {
+ [relative] nstring *monitor_name;
+ } spoolss_MonitorInfo1;
+
+ typedef [public,gensize] struct {
+ [relative] nstring *monitor_name;
+ [relative] nstring *environment;
+ [relative] nstring *dll_name;
+ } spoolss_MonitorInfo2;
+
+ typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_MonitorInfo1 info1;
+ [case(2)] spoolss_MonitorInfo2 info2;
+ [default];
+ } spoolss_MonitorInfo;
+
+ [public,noopnum,noprint] WERROR _spoolss_EnumMonitors(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumMonitors(
+ [in] uint32 level,
+ [in] uint32 count,
+ [out,switch_is(level)] spoolss_MonitorInfo info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumMonitors(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,switch_is(level),size_is(,*count)] spoolss_MonitorInfo **info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x25 */
+
+ typedef [public,gensize] struct {
+ [string,charset(UTF16)] uint16 *port_name;
+ } spoolss_SetPortInfo1;
+
+ typedef [public,gensize] struct {
+ [string,charset(UTF16)] uint16 *port_name;
+ [string,charset(UTF16)] uint16 *monitor_name;
+ [string,charset(UTF16)] uint16 *description;
+ spoolss_PortType port_type;
+ uint32 reserved;
+ } spoolss_SetPortInfo2;
+
+ typedef [public,gensize] struct {
+ spoolss_PortStatus status;
+ [string,charset(UTF16)] uint16 *status_string;
+ spoolss_PortSeverity severity;
+ } spoolss_SetPortInfo3;
+
+ typedef [public,gensize] struct {
+ [string,charset(UTF16)] uint16 *port_name;
+ DATA_BLOB monitor_data; /* relative ?? */
+ } spoolss_SetPortInfoFF;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(1)] spoolss_SetPortInfo1 *info1;
+ [case(2)] spoolss_SetPortInfo2 *info2;
+ [case(3)] spoolss_SetPortInfo3 *info3;
+ [case(0xff)] spoolss_SetPortInfoFF *infoFF;
+ } spoolss_SetPortInfo;
+
+ typedef [public] struct {
+ uint32 level;
+ [switch_is(level)] spoolss_SetPrinterInfo info;
+ } spoolss_SetPortInfoContainer;
+
+ WERROR spoolss_AddPort(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] uint32 unknown,
+ [in] [string,charset(UTF16)] uint16 monitor_name[]
+ );
+
+ /******************/
+ /* Function: 0x26 */
+ [todo] WERROR spoolss_ConfigurePort(
+ );
+
+ /******************/
+ /* Function: 0x27 */
+ WERROR spoolss_DeletePort(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] uint3264 ptr, /* ULONG_PTR */
+ [in,ref] [string,charset(UTF16)] uint16 *port_name
+ );
+
+ /******************/
+ /* Function: 0x28 */
+ WERROR spoolss_CreatePrinterIC(
+ [in,ref] policy_handle *handle,
+ [out,ref] policy_handle *gdi_handle,
+ [in,ref] spoolss_DevmodeContainer *devmode_ctr
+ );
+
+ /******************/
+ /* Function: 0x29 */
+
+ typedef struct {
+ uint32 Checksum;
+ uint32 Index;
+ } UNIVERSAL_FONT_ID;
+
+ typedef [public] struct {
+ uint32 count;
+ UNIVERSAL_FONT_ID fonts[count];
+ } UNIVERSAL_FONT_ID_ctr;
+
+ WERROR spoolss_PlayGDIScriptOnPrinterIC(
+ [in,ref] policy_handle *gdi_handle,
+ [in,ref] [size_is(cIn)] uint8 *pIn,
+ [in] uint32 cIn,
+ [out,ref] [size_is(cOut)] uint8 *pOut,
+ [in] uint32 cOut,
+ [in] uint32 ul
+ );
+
+ /******************/
+ /* Function: 0x2a */
+ WERROR spoolss_DeletePrinterIC(
+ [in,out,ref] policy_handle *gdi_handle
+ );
+
+ /******************/
+ /* Function: 0x2b */
+ [todo] WERROR spoolss_AddPrinterConnection(
+ );
+
+ /******************/
+ /* Function: 0x2c */
+ [todo] WERROR spoolss_DeletePrinterConnection(
+ );
+
+ /******************/
+ /* Function: 0x2d */
+ [todo] WERROR spoolss_PrinterMessageBox(
+ /* Marked as obsolete in MSDN. "Not necessary and has
+ no effect". */
+ );
+
+ /******************/
+ /* Function: 0x2e */
+
+ typedef struct {
+ [string,charset(URF16)] uint16 *monitor_name;
+ } spoolss_AddMonitorInfo1;
+
+ typedef struct {
+ [string,charset(URF16)] uint16 *monitor_name;
+ [string,charset(URF16)] uint16 *environment;
+ [string,charset(URF16)] uint16 *dll_name;
+ } spoolss_AddMonitorInfo2;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(1)] spoolss_AddMonitorInfo1 *info1;
+ [case(2)] spoolss_AddMonitorInfo2 *info2;
+ } spoolss_AddMonitorInfo;
+
+ typedef [public] struct {
+ uint32 level;
+ [switch_is(level)] spoolss_MonitorInfo info;
+ } spoolss_MonitorContainer;
+
+ [todo] WERROR spoolss_AddMonitor(
+ );
+
+ /******************/
+ /* Function: 0x2f */
+ [todo] WERROR spoolss_DeleteMonitor(
+ );
+
+ /******************/
+ /* Function: 0x30 */
+ WERROR spoolss_DeletePrintProcessor(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,unique] [string,charset(UTF16)] uint16 *architecture,
+ [in] [string,charset(UTF16)] uint16 print_processor_name[]
+ );
+
+ /******************/
+ /* Function: 0x31 */
+ [todo] WERROR spoolss_AddPrintProvidor(
+ );
+
+ /******************/
+ /* Function: 0x32 */
+ [todo] WERROR spoolss_DeletePrintProvidor(
+ );
+
+ /******************/
+ /* Function: 0x33 */
+
+ typedef [public,gensize] struct {
+ [relative] nstring *name_array;
+ } spoolss_PrintProcDataTypesInfo1;
+
+ typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union {
+ [case(1)] spoolss_PrintProcDataTypesInfo1 info1;
+ [default];
+ } spoolss_PrintProcDataTypesInfo;
+
+ [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessorDataTypes(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,unique] [string,charset(UTF16)] uint16 *print_processor_name,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumPrintProcessorDataTypes(
+ [in] uint32 level,
+ [in] uint32 count,
+ [out,switch_is(level)] spoolss_PrintProcDataTypesInfo info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumPrintProcessorDataTypes(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,unique] [string,charset(UTF16)] uint16 *print_processor_name,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,switch_is(level),size_is(,*count)] spoolss_PrintProcDataTypesInfo **info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x34 */
+ WERROR spoolss_ResetPrinter(
+ [in,ref] policy_handle *handle,
+ [in,unique] [string,charset(UTF16)] uint16 *data_type,
+ [in,ref] spoolss_DevmodeContainer *devmode_ctr
+ );
+
+ /******************/
+ /* Function: 0x35 */
+ [public] WERROR spoolss_GetPrinterDriver2(
+ [in,ref] policy_handle *handle,
+ [in,unique] [string,charset(UTF16)] uint16 *architecture,
+ [in] uint32 level,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [in] uint32 client_major_version,
+ [in] uint32 client_minor_version,
+ [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *server_major_version,
+ [out,ref] uint32 *server_minor_version
+ );
+
+ /******************/
+ /* Function: 0x36 */
+ [todo] WERROR spoolss_FindFirstPrinterChangeNotification(
+ );
+
+ /******************/
+ /* Function: 0x37 */
+ [todo] WERROR spoolss_FindNextPrinterChangeNotification(
+ );
+
+ /******************/
+ /* Function: 0x38 */
+ [public] WERROR spoolss_FindClosePrinterNotify(
+ [in,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x39 */
+ [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotificationOld(
+ );
+
+ /******************/
+ /* Function: 0x3a */
+ [public] WERROR spoolss_ReplyOpenPrinter(
+ [in,string,charset(UTF16)] uint16 server_name[],
+ [in] uint32 printer_local,
+ [in] winreg_Type type,
+ [in,range(0,512)] uint32 bufsize,
+ [in,unique,size_is(bufsize)] uint8 *buffer,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x3b */
+
+ typedef [bitmap32bit] bitmap {
+ PRINTER_CHANGE_ADD_PRINTER = 0x00000001,
+ PRINTER_CHANGE_SET_PRINTER = 0x00000002,
+ PRINTER_CHANGE_DELETE_PRINTER = 0x00000004,
+ PRINTER_CHANGE_FAILED_CONNECTION_PRINTER = 0x00000008,
+ PRINTER_CHANGE_ADD_JOB = 0x00000100,
+ PRINTER_CHANGE_SET_JOB = 0x00000200,
+ PRINTER_CHANGE_DELETE_JOB = 0x00000400,
+ PRINTER_CHANGE_WRITE_JOB = 0x00000800,
+ PRINTER_CHANGE_ADD_FORM = 0x00010000,
+ PRINTER_CHANGE_SET_FORM = 0x00020000,
+ PRINTER_CHANGE_DELETE_FORM = 0x00040000,
+ PRINTER_CHANGE_ADD_PORT = 0x00100000,
+ PRINTER_CHANGE_CONFIGURE_PORT = 0x00200000,
+ PRINTER_CHANGE_DELETE_PORT = 0x00400000,
+ PRINTER_CHANGE_ADD_PRINT_PROCESSOR = 0x01000000,
+ PRINTER_CHANGE_DELETE_PRINT_PROCESSOR = 0x04000000,
+ PRINTER_CHANGE_SERVER = 0x08000000,
+ PRINTER_CHANGE_ADD_PRINTER_DRIVER = 0x10000000,
+ PRINTER_CHANGE_SET_PRINTER_DRIVER = 0x20000000,
+ PRINTER_CHANGE_DELETE_PRINTER_DRIVER = 0x40000000,
+ PRINTER_CHANGE_TIMEOUT = 0x80000000
+ } spoolss_PrinterChangeFlags;
+
+ const int PRINTER_CHANGE_PRINTER = 0x000000FF;
+
+ const int PRINTER_CHANGE_JOB = 0x0000FF00;
+
+ const int PRINTER_CHANGE_FORM = (PRINTER_CHANGE_ADD_FORM |
+ PRINTER_CHANGE_SET_FORM |
+ PRINTER_CHANGE_DELETE_FORM); /* 0x00070000 */
+
+ const int PRINTER_CHANGE_PORT = (PRINTER_CHANGE_ADD_PORT |
+ PRINTER_CHANGE_CONFIGURE_PORT |
+ PRINTER_CHANGE_DELETE_PORT); /* 0x00700000 */
+
+ const int PRINTER_CHANGE_PRINT_PROCESSOR = 0x07000000;
+
+ const int PRINTER_CHANGE_PRINTER_DRIVER = (PRINTER_CHANGE_ADD_PRINTER_DRIVER |
+ PRINTER_CHANGE_SET_PRINTER_DRIVER |
+ PRINTER_CHANGE_DELETE_PRINTER_DRIVER); /* 0x70000000 */
+
+ const int PRINTER_CHANGE_ALL = (PRINTER_CHANGE_PRINTER |
+ PRINTER_CHANGE_JOB |
+ PRINTER_CHANGE_FORM |
+ PRINTER_CHANGE_PORT |
+ PRINTER_CHANGE_PRINT_PROCESSOR |
+ PRINTER_CHANGE_PRINTER_DRIVER); /* 0x7777FFFF */
+ WERROR spoolss_RouterReplyPrinter(
+ [in,ref] policy_handle *handle,
+ [in] spoolss_PrinterChangeFlags flags,
+ [in,range(0,512)] uint32 bufsize,
+ [in,unique,size_is(bufsize)] uint8 *buffer
+ );
+
+ /******************/
+ /* Function: 0x3c */
+ [public] WERROR spoolss_ReplyClosePrinter(
+ [in,out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x3d */
+
+ typedef [public] struct {
+ uint32 monitor_data_size;
+ [size_is(monitor_data_size),unique] uint8 *monitor_data;
+ } spoolss_PortVarContainer;
+
+ WERROR spoolss_AddPortEx(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,ref] spoolss_SetPortInfoContainer *port_ctr,
+ [in,ref] spoolss_PortVarContainer *port_var_ctr,
+ [in,unique] [string,charset(UTF16)] uint16 *monitor_name
+ );
+
+ /******************/
+ /* Function: 0x3e */
+ [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotification(
+ );
+
+ /******************/
+ /* Function: 0x3f */
+ [todo] WERROR spoolss_SpoolerInit(
+ );
+
+ /******************/
+ /* Function: 0x40 */
+ [todo] WERROR spoolss_ResetPrinterEx(
+ );
+
+ typedef [enum16bit,public] enum {
+ JOB_NOTIFY_FIELD_PRINTER_NAME = 0x00,
+ JOB_NOTIFY_FIELD_MACHINE_NAME = 0x01,
+ JOB_NOTIFY_FIELD_PORT_NAME = 0x02,
+ JOB_NOTIFY_FIELD_USER_NAME = 0x03,
+ JOB_NOTIFY_FIELD_NOTIFY_NAME = 0x04,
+ JOB_NOTIFY_FIELD_DATATYPE = 0x05,
+ JOB_NOTIFY_FIELD_PRINT_PROCESSOR = 0x06,
+ JOB_NOTIFY_FIELD_PARAMETERS = 0x07,
+ JOB_NOTIFY_FIELD_DRIVER_NAME = 0x08,
+ JOB_NOTIFY_FIELD_DEVMODE = 0x09,
+ JOB_NOTIFY_FIELD_STATUS = 0x0a,
+ JOB_NOTIFY_FIELD_STATUS_STRING = 0x0b,
+ JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR = 0x0c,
+ JOB_NOTIFY_FIELD_DOCUMENT = 0x0d,
+ JOB_NOTIFY_FIELD_PRIORITY = 0x0e,
+ JOB_NOTIFY_FIELD_POSITION = 0x0f,
+ JOB_NOTIFY_FIELD_SUBMITTED = 0x10,
+ JOB_NOTIFY_FIELD_START_TIME = 0x11,
+ JOB_NOTIFY_FIELD_UNTIL_TIME = 0x12,
+ JOB_NOTIFY_FIELD_TIME = 0x13,
+ JOB_NOTIFY_FIELD_TOTAL_PAGES = 0x14,
+ JOB_NOTIFY_FIELD_PAGES_PRINTED = 0x15,
+ JOB_NOTIFY_FIELD_TOTAL_BYTES = 0x16,
+ JOB_NOTIFY_FIELD_BYTES_PRINTED = 0x17
+ } spoolss_JobNotifyField;
+
+ typedef [enum16bit,public] enum {
+ PRINTER_NOTIFY_FIELD_SERVER_NAME = 0x00,
+ PRINTER_NOTIFY_FIELD_PRINTER_NAME = 0x01,
+ PRINTER_NOTIFY_FIELD_SHARE_NAME = 0x02,
+ PRINTER_NOTIFY_FIELD_PORT_NAME = 0x03,
+ PRINTER_NOTIFY_FIELD_DRIVER_NAME = 0x04,
+ PRINTER_NOTIFY_FIELD_COMMENT = 0x05,
+ PRINTER_NOTIFY_FIELD_LOCATION = 0x06,
+ PRINTER_NOTIFY_FIELD_DEVMODE = 0x07,
+ PRINTER_NOTIFY_FIELD_SEPFILE = 0x08,
+ PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR = 0x09,
+ PRINTER_NOTIFY_FIELD_PARAMETERS = 0x0a,
+ PRINTER_NOTIFY_FIELD_DATATYPE = 0x0b,
+ PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR = 0x0c,
+ PRINTER_NOTIFY_FIELD_ATTRIBUTES = 0x0d,
+ PRINTER_NOTIFY_FIELD_PRIORITY = 0x0e,
+ PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY = 0x0f,
+ PRINTER_NOTIFY_FIELD_START_TIME = 0x10,
+ PRINTER_NOTIFY_FIELD_UNTIL_TIME = 0x11,
+ PRINTER_NOTIFY_FIELD_STATUS = 0x12,
+ PRINTER_NOTIFY_FIELD_STATUS_STRING = 0x13,
+ PRINTER_NOTIFY_FIELD_CJOBS = 0x14,
+ PRINTER_NOTIFY_FIELD_AVERAGE_PPM = 0x15,
+ PRINTER_NOTIFY_FIELD_TOTAL_PAGES = 0x16,
+ PRINTER_NOTIFY_FIELD_PAGES_PRINTED = 0x17,
+ PRINTER_NOTIFY_FIELD_TOTAL_BYTES = 0x18,
+ PRINTER_NOTIFY_FIELD_BYTES_PRINTED = 0x19,
+ PRINTER_NOTIFY_FIELD_OBJECT_GUID = 0x1a,
+ PRINTER_NOTIFY_FIELD_FRIENDLY_NAME = 0x1b
+ } spoolss_PrintNotifyField;
+
+ typedef [enum16bit] enum {
+ PRINTER_NOTIFY_TYPE = 0x00,
+ JOB_NOTIFY_TYPE = 0x01
+ } spoolss_NotifyType;
+
+ typedef [nodiscriminant,noprint] union {
+ [case(PRINTER_NOTIFY_TYPE)] uint16 field;
+ [case(JOB_NOTIFY_TYPE)] uint16 field;
+ [default] uint16 field;
+ } spoolss_Field;
+
+ /******************/
+ /* Function: 0x41 */
+ typedef struct {
+ spoolss_NotifyType type;
+ uint16 u1;
+ uint32 u2;
+ uint32 u3;
+ uint32 count;
+ [size_is(count),switch_is(type)] spoolss_Field *fields;
+ } spoolss_NotifyOptionType;
+
+ typedef [bitmap32bit] bitmap {
+ PRINTER_NOTIFY_OPTIONS_REFRESH = 0x00000001
+ } spoolssNotifyOptionFlags;
+
+ typedef [public] struct {
+ [value(2)] uint32 version;
+ spoolssNotifyOptionFlags flags;
+ uint32 count;
+ [size_is(count)] spoolss_NotifyOptionType *types;
+ } spoolss_NotifyOption;
+
+ [public] WERROR spoolss_RemoteFindFirstPrinterChangeNotifyEx(
+ [in,ref] policy_handle *handle,
+ [in] spoolss_PrinterChangeFlags flags,
+ [in] uint32 options,
+ [in,unique] [string,charset(UTF16)] uint16 *local_machine,
+ [in] uint32 printer_local,
+ [in,unique] spoolss_NotifyOption *notify_options
+ );
+
+ /******************/
+ /* Function: 0x42 */
+
+ typedef struct {
+ uint32 size;
+ [size_is(size/2),unique,charset(UTF16)] uint16 *string;
+ } spoolss_NotifyString;
+
+ typedef [v1_enum] enum {
+ NOTIFY_TABLE_DWORD = 0x0001,
+ NOTIFY_TABLE_STRING = 0x0002,
+ NOTIFY_TABLE_DEVMODE = 0x0003,
+ NOTIFY_TABLE_TIME = 0x0004,
+ NOTIFY_TABLE_SECURITYDESCRIPTOR = 0x0005
+ } spoolss_NotifyTable;
+
+ typedef [ms_union, switch_type(uint32)] union {
+ [case(1)] uint32 integer[2];
+ [case(2)] spoolss_NotifyString string;
+ [case(3)] spoolss_DevmodeContainer devmode;
+ [case(4)] spoolss_TimeCtr time;
+ [case(5)] sec_desc_buf sd;
+ } spoolss_NotifyData;
+
+ typedef struct {
+ spoolss_NotifyType type;
+ [switch_is(type)] spoolss_Field field;
+ spoolss_NotifyTable variable_type;
+ uint32 job_id;
+ [switch_is(variable_type)] spoolss_NotifyData data;
+ } spoolss_Notify;
+
+ typedef [public] struct {
+ [value(2)] uint32 version;
+ uint32 flags;
+ uint32 count;
+ [size_is(count)] spoolss_Notify notifies[];
+ } spoolss_NotifyInfo;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(0)] spoolss_NotifyInfo *info0;
+ } spoolss_ReplyPrinterInfo;
+
+ typedef [bitmap32bit] bitmap {
+ PRINTER_NOTIFY_INFO_DISCARDED = 0x00000001,
+ PRINTER_NOTIFY_INFO_DISCARDNOTED = 0x00010000,
+ PRINTER_NOTIFY_INFO_COLOR_MISMATCH = 0x00080000
+ } spoolss_PrinterNotifyFlags;
+
+ WERROR spoolss_RouterReplyPrinterEx(
+ [in,ref] policy_handle *handle,
+ [in] uint32 color,
+ [in] spoolss_PrinterChangeFlags flags,
+ [out,ref] spoolss_PrinterNotifyFlags *reply_result,
+ [in] uint32 reply_type,
+ [in,switch_is(reply_type)] spoolss_ReplyPrinterInfo info
+ );
+
+ /******************/
+ /* Function: 0x43 */
+ [public] WERROR spoolss_RouterRefreshPrinterChangeNotify(
+ [in,ref] policy_handle *handle,
+ [in] uint32 change_low,
+ [in,unique] spoolss_NotifyOption *options,
+ [out,ref] spoolss_NotifyInfo **info
+ );
+
+ /******************/
+ /* Function: 0x44 */
+ [todo] WERROR spoolss_44(
+ );
+
+ typedef struct {
+ uint32 size;
+ [string,charset(UTF16)] uint16 *client;
+ [string,charset(UTF16)] uint16 *user;
+ uint32 build;
+ spoolss_MajorVersion major;
+ spoolss_MinorVersion minor;
+ spoolss_ProcessorArchitecture processor;
+ } spoolss_UserLevel1;
+
+ typedef struct {
+ uint32 not_used;
+ } spoolss_UserLevel2;
+
+ typedef struct {
+ uint32 size;
+ uint32 flags;
+ uint32 size2;
+ [string,charset(UTF16)] uint16 *client;
+ [string,charset(UTF16)] uint16 *user;
+ uint32 build;
+ spoolss_MajorVersion major;
+ spoolss_MinorVersion minor;
+ spoolss_ProcessorArchitecture processor;
+ udlong reserved;
+ } spoolss_UserLevel3;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(1)] spoolss_UserLevel1 *level1;
+ [case(2)] spoolss_UserLevel2 *level2;
+ [case(3)] spoolss_UserLevel3 *level3;
+ } spoolss_UserLevel;
+
+ typedef [public] struct {
+ uint32 level;
+ [switch_is(level)] spoolss_UserLevel user_info;
+ } spoolss_UserLevelCtr;
+
+ typedef bitmap {
+ SERVER_ACCESS_ADMINISTER = 0x00000001,
+ SERVER_ACCESS_ENUMERATE = 0x00000002,
+ PRINTER_ACCESS_ADMINISTER = 0x00000004,
+ PRINTER_ACCESS_USE = 0x00000008,
+ JOB_ACCESS_ADMINISTER = 0x00000010,
+ JOB_ACCESS_READ = 0x00000020
+ } spoolss_AccessRights;
+
+ /* Access rights for print servers */
+ const int SERVER_ALL_ACCESS = SEC_STD_REQUIRED |
+ SERVER_ACCESS_ADMINISTER |
+ SERVER_ACCESS_ENUMERATE;
+
+ const int SERVER_READ = SEC_STD_READ_CONTROL |
+ SERVER_ACCESS_ENUMERATE;
+
+ const int SERVER_WRITE = STANDARD_RIGHTS_WRITE_ACCESS |
+ SERVER_ACCESS_ADMINISTER |
+ SERVER_ACCESS_ENUMERATE;
+
+ const int SERVER_EXECUTE = SEC_STD_READ_CONTROL |
+ SERVER_ACCESS_ENUMERATE;
+
+ /* Access rights for printers */
+ const int PRINTER_ALL_ACCESS = SEC_STD_REQUIRED |
+ PRINTER_ACCESS_ADMINISTER |
+ PRINTER_ACCESS_USE;
+
+ const int PRINTER_READ = SEC_STD_READ_CONTROL |
+ PRINTER_ACCESS_USE;
+
+ const int PRINTER_WRITE = STANDARD_RIGHTS_WRITE_ACCESS |
+ PRINTER_ACCESS_USE;
+
+ const int PRINTER_EXECUTE = SEC_STD_READ_CONTROL |
+ PRINTER_ACCESS_USE;
+
+ /* Access rights for jobs */
+ const int JOB_ALL_ACCESS = SEC_STD_REQUIRED |
+ JOB_ACCESS_ADMINISTER;
+
+ const int JOB_READ = SEC_STD_READ_CONTROL |
+ JOB_ACCESS_ADMINISTER;
+
+ const int JOB_WRITE = STANDARD_RIGHTS_WRITE_ACCESS |
+ JOB_ACCESS_ADMINISTER;
+
+ const int JOB_EXECUTE = SEC_STD_READ_CONTROL |
+ JOB_ACCESS_ADMINISTER;
+
+ /* ACE masks for various print permissions */
+ const int PRINTER_ACE_FULL_CONTROL = SEC_GENERIC_ALL |
+ PRINTER_ALL_ACCESS;
+
+ const int PRINTER_ACE_MANAGE_DOCUMENTS = SEC_GENERIC_ALL |
+ SEC_STD_READ_CONTROL;
+
+ const int PRINTER_ACE_PRINT = SEC_GENERIC_EXECUTE |
+ SEC_STD_READ_CONTROL |
+ PRINTER_ACCESS_USE;
+
+ /******************/
+ /* Function: 0x45 */
+ [public] WERROR spoolss_OpenPrinterEx(
+ [in,unique] [string,charset(UTF16)] uint16 *printername,
+ [in,unique] [string,charset(UTF16)] uint16 *datatype,
+ [in] spoolss_DevmodeContainer devmode_ctr,
+ [in] spoolss_AccessRights access_mask,
+ [in] spoolss_UserLevelCtr userlevel_ctr,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x46 */
+ WERROR spoolss_AddPrinterEx(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,ref] spoolss_SetPrinterInfoCtr *info_ctr,
+ [in,ref] spoolss_DevmodeContainer *devmode_ctr,
+ [in,ref] sec_desc_buf *secdesc_ctr,
+ [in,ref] spoolss_UserLevelCtr *userlevel_ctr,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x47 */
+ WERROR spoolss_SetPort(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,unique] [string,charset(UTF16)] uint16 *port_name,
+ [in,ref] spoolss_SetPortInfoContainer *port_ctr
+ );
+
+ /******************/
+ /* Function: 0x48 */
+ WERROR spoolss_EnumPrinterData(
+ [in,ref] policy_handle *handle,
+ [in] uint32 enum_index,
+ [out,size_is(value_offered/2),charset(UTF16)] uint16 value_name[],
+ [in] uint32 value_offered,
+ [out,ref] uint32 *value_needed,
+ [out,ref] winreg_Type *type,
+ [out,ref,size_is(data_offered),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *data,
+ [in] uint32 data_offered,
+ [out,ref] uint32 *data_needed
+ );
+
+ /******************/
+ /* Function: 0x49 */
+ WERROR spoolss_DeletePrinterData(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 value_name[]
+ );
+
+ /******************/
+ /* Function: 0x4a */
+ [todo] WERROR spoolss_4a(
+ );
+
+ /******************/
+ /* Function: 0x4b */
+ [todo] WERROR spoolss_4b(
+ );
+
+ /******************/
+ /* Function: 0x4c */
+ [todo] WERROR spoolss_4c(
+ );
+
+ /******************/
+ /* Function: 0x4d */
+ WERROR spoolss_SetPrinterDataEx(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 key_name[],
+ [in] [string,charset(UTF16)] uint16 value_name[],
+ [in] winreg_Type type,
+ [in,ref] [size_is(offered)] uint8 *data,
+ [in] uint32 offered
+ );
+
+ /******************/
+ /* Function: 0x4e */
+ WERROR spoolss_GetPrinterDataEx(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 key_name[],
+ [in] [string,charset(UTF16)] uint16 value_name[],
+ [out,ref] winreg_Type *type,
+ [out,ref,size_is(offered)] uint8 *data,
+ [in] uint32 offered,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x4f */
+
+ typedef [relative_base,public,gensize] struct {
+ [relative] nstring *value_name;
+ [value(2*strlen_m_term(value_name))] uint32 value_name_len;
+ winreg_Type type;
+ [relative,subcontext(0),subcontext_size(data_length),flag(NDR_REMAINING|ndr_spoolss_PrinterEnumValues_align(r->type))] DATA_BLOB *data;
+ [value(data ? data->length : 0)] uint32 data_length;
+ } spoolss_PrinterEnumValues;
+
+ [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDataEx(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 key_name[],
+ [out] DATA_BLOB info,
+ [in] uint32 offered,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumPrinterDataEx(
+ [in] uint32 count,
+ [out] spoolss_PrinterEnumValues info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumPrinterDataEx(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 key_name[],
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,size_is(,*count)] spoolss_PrinterEnumValues **info,
+ [out,ref] uint32 *needed
+ );
+
+ typedef [nodiscriminant] union {
+ [case(0)];
+ [case(1)];
+ [default] nstring_array string_array;
+ } spoolss_KeyNames;
+
+ /******************/
+ /* Function: 0x50 */
+ [public] WERROR spoolss_EnumPrinterKey(
+ [in, ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 key_name[],
+ [out,ref] uint32 *_ndr_size,
+ [out,ref,subcontext(0),subcontext_size(*_ndr_size*2),switch_is(*_ndr_size)] spoolss_KeyNames *key_buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x51 */
+ WERROR spoolss_DeletePrinterDataEx(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 key_name[],
+ [in] [string,charset(UTF16)] uint16 value_name[]
+ );
+
+ /******************/
+ /* Function: 0x52 */
+ WERROR spoolss_DeletePrinterKey(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 key_name[]
+ );
+
+ /******************/
+ /* Function: 0x53 */
+ [todo] WERROR spoolss_53(
+ );
+
+ /******************/
+ /* Function: 0x54 */
+ typedef [public,bitmap32bit] bitmap {
+ DPD_DELETE_UNUSED_FILES = 0x00000001,
+ DPD_DELETE_SPECIFIC_VERSION = 0x00000002,
+ DPD_DELETE_ALL_FILES = 0x00000004
+ } spoolss_DeleteDriverFlags;
+
+ WERROR spoolss_DeletePrinterDriverEx(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in] [string,charset(UTF16)] uint16 architecture[],
+ [in] [string,charset(UTF16)] uint16 driver[],
+ [in] spoolss_DeleteDriverFlags delete_flags,
+ [in] uint32 version
+ );
+
+ /******************/
+ /* Function: 0x55 */
+ WERROR spoolss_AddPerMachineConnection(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,ref] [string,charset(UTF16)] uint16 *printername,
+ [in,ref] [string,charset(UTF16)] uint16 *printserver,
+ [in,ref] [string,charset(UTF16)] uint16 *provider
+ );
+
+ /******************/
+ /* Function: 0x56 */
+ WERROR spoolss_DeletePerMachineConnection(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,ref] [string,charset(UTF16)] uint16 *printername
+ );
+
+ /******************/
+ /* Function: 0x57 */
+ [public,noopnum,noprint] WERROR _spoolss_EnumPerMachineConnections(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,unique] DATA_BLOB *info,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *count
+ );
+ [public,noopnum,noprint] void __spoolss_EnumPerMachineConnections(
+ [in] uint32 count,
+ [out] spoolss_PrinterInfo4 info[count]
+ );
+ [nopull,nopush] WERROR spoolss_EnumPerMachineConnections(
+ [in,unique] [string,charset(UTF16)] uint16 *server,
+ [in,unique] DATA_BLOB *buffer,
+ [in] uint32 offered,
+ [out,ref] uint32 *count,
+ [out,ref,size_is(,*count)] spoolss_PrinterInfo4 **info,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x58 */
+
+ typedef [v1_enum] enum {
+ PROTOCOL_RAWTCP_TYPE = 1,
+ PROTOCOL_LPR_TYPE = 2
+ } spoolss_PortProtocol;
+
+ typedef [public,gensize] struct {
+ [charset(UTF16)] uint16 portname[64];
+ [value(0x00000001)] uint32 version;
+ spoolss_PortProtocol protocol;
+ [value(ndr_size_spoolss_PortData1(r, ndr->flags))] uint32 size;
+ uint32 reserved;
+ [charset(UTF16)] uint16 hostaddress[49];
+ [charset(UTF16)] uint16 snmpcommunity[33];
+ uint32 dblspool;
+ [charset(UTF16)] uint16 queue[33];
+ [charset(UTF16)] uint16 ip_address[16]; /* s3 had 17 */
+ [charset(UTF16)] uint16 hardware_address[13];
+ [charset(UTF16)] uint16 device_type[257];
+ uint32 port_number;
+ boolean32 snmp_enabled;
+ uint32 snmp_dev_index;
+ } spoolss_PortData1;
+
+ typedef [public,gensize] struct {
+ [charset(UTF16)] uint16 portname[64];
+ [value(0x00000002)] uint32 version;
+ spoolss_PortProtocol protocol;
+ [value(ndr_size_spoolss_PortData2(r, ndr->flags))] uint32 size;
+ uint32 reserved;
+ [charset(UTF16)] uint16 hostaddress[128];
+ [charset(UTF16)] uint16 snmpcommunity[33];
+ uint32 dblspool;
+ [charset(UTF16)] uint16 queue[33];
+ [charset(UTF16)] uint16 device_type[257];
+ uint32 port_number;
+ boolean32 snmp_enabled;
+ uint32 snmp_dev_index;
+ uint32 port_monitor_mib_index;
+ } spoolss_PortData2;
+
+ typedef [public] struct {
+ nstring dll_name;
+ } spoolss_MonitorUi;
+
+ WERROR spoolss_XcvData(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 function_name[],
+ [in] DATA_BLOB in_data,
+ [in,value(r->in.in_data.length)] uint32 _in_data_length,
+ [out,ref] [size_is(out_data_size)] uint8 *out_data,
+ [in] uint32 out_data_size,
+ [out,ref] uint32 *needed,
+ [in,out,ref] uint32 *status_code
+ );
+
+ /******************/
+ /* Function: 0x59 */
+
+ typedef [bitmap32bit] bitmap {
+ APD_STRICT_UPGRADE = 0x00000001,
+ APD_STRICT_DOWNGRADE = 0x00000002,
+ APD_COPY_ALL_FILES = 0x00000004,
+ APD_COPY_NEW_FILES = 0x00000008,
+ APD_COPY_FROM_DIRECTORY = 0x00000010,
+ APD_DONT_COPY_FILES_TO_CLUSTER = 0x00001000,
+ APD_COPY_TO_ALL_SPOOLERS = 0x00002000,
+ APD_RETURN_BLOCKING_STATUS_CODE = 0x00010000
+ } spoolss_AddPrinterDriverExFlags;
+
+ [public] WERROR spoolss_AddPrinterDriverEx(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,ref] spoolss_AddDriverInfoCtr *info_ctr,
+ [in] spoolss_AddPrinterDriverExFlags flags
+ );
+
+ /******************/
+ /* Function: 0x5a */
+ [todo] WERROR spoolss_5a(
+ );
+
+ /******************/
+ /* Function: 0x5b */
+ [todo] WERROR spoolss_5b(
+ );
+
+ /******************/
+ /* Function: 0x5c */
+ [todo] WERROR spoolss_5c(
+ );
+
+ /******************/
+ /* Function: 0x5d */
+ [todo] WERROR spoolss_5d(
+ );
+
+ /******************/
+ /* Function: 0x5e */
+ [todo] WERROR spoolss_5e(
+ );
+
+ /******************/
+ /* Function: 0x5f */
+ [todo] WERROR spoolss_5f(
+ );
+
+ /******************/
+ /* Function: 0x60 */
+ [todo] WERROR spoolss_60(
+ );
+
+ /******************/
+ /* Function: 0x61 */
+
+ const string BIDI_ACTION_ENUM_SCHEMA = "EnumSchema";
+ const string BIDI_ACTION_GET = "Get";
+ const string BIDI_ACTION_SET = "Set";
+ const string BIDI_ACTION_GET_ALL = "GetAll";
+
+ typedef enum {
+ BIDI_NULL = 0x00000000,
+ BIDI_INT = 0x00000001,
+ BIDI_FLOAT = 0x00000002,
+ BIDI_BOOL = 0x00000003,
+ BIDI_STRING = 0x00000004,
+ BIDI_TEXT = 0x00000005,
+ BIDI_ENUM = 0x00000006,
+ BIDI_BLOB = 0x00000007
+ } BIDI_TYPE;
+
+ typedef struct {
+ uint32 cbBuf;
+ [size_is(cbBuf), unique] uint8 *pszString;
+ } RPC_BINARY_CONTAINER;
+
+ typedef [ms_union,switch_type(uint32)] union {
+ [case(BIDI_NULL)] uint32 bData;
+ [case(BIDI_BOOL)] uint32 bData;
+ [case(BIDI_INT)] uint32 iData;
+ [case(BIDI_STRING)] [unique] [string,charset(UTF16)] uint16 *sData;
+ [case(BIDI_TEXT)] [unique] [string,charset(UTF16)] uint16 *sData;
+ [case(BIDI_ENUM)] [unique] [string,charset(UTF16)] uint16 *sData;
+ /*[case(BIDI_FLOAT)] float fData;*/
+ [case(BIDI_BLOB)] RPC_BINARY_CONTAINER biData;
+ } RPC_BIDI_DATA_u;
+
+ typedef struct {
+ uint32 dwBidiType;
+ [switch_is(dwBidiType)] RPC_BIDI_DATA_u u;
+ } RPC_BIDI_DATA;
+
+ typedef struct {
+ uint32 dwReqNumber;
+ [unique] [string,charset(UTF16)] uint16 *pSchema;
+ RPC_BIDI_DATA data;
+ } RPC_BIDI_REQUEST_DATA;
+
+ typedef [public] struct {
+ [value(1)] uint32 Version;
+ uint32 Flags;
+ uint32 Count;
+ [size_is(Count), unique] RPC_BIDI_REQUEST_DATA *aData[];
+ } RPC_BIDI_REQUEST_CONTAINER;
+
+ typedef struct {
+ uint32 dwResult;
+ uint32 dwReqNumber;
+ [unique] [string,charset(UTF16)] uint16 *pSchema;
+ RPC_BIDI_DATA data;
+ } RPC_BIDI_RESPONSE_DATA;
+
+ typedef [public] struct {
+ [value(1)] uint32 Version;
+ uint32 Flags;
+ uint32 Count;
+ [size_is(Count), unique] RPC_BIDI_RESPONSE_DATA *aData[];
+ } RPC_BIDI_RESPONSE_CONTAINER;
+
+ WERROR spoolss_SendRecvBidiData(
+ [in] policy_handle hPrinter,
+ [in,unique] [string,charset(UTF16)] uint16 *pAction,
+ [in] RPC_BIDI_REQUEST_CONTAINER *pReqData,
+ [out] RPC_BIDI_RESPONSE_CONTAINER **ppRespData
+ );
+
+ /******************/
+ /* Function: 0x62 */
+ [todo] WERROR spoolss_62(
+ );
+
+ /******************/
+ /* Function: 0x63 */
+ [todo] WERROR spoolss_63(
+ );
+
+ /******************/
+ /* Function: 0x64 */
+ [todo] WERROR spoolss_64(
+ );
+
+ /******************/
+ /* Function: 0x65 */
+ [todo] WERROR spoolss_65(
+ );
+
+ /******************/
+ /* Function: 0x66 */
+
+ const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_UNIDRV = "{D20EA372-DD35-4950-9ED8-A6335AFE79F0}";
+ const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PSCRIPT = "{D20EA372-DD35-4950-9ED8-A6335AFE79F1}";
+ const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PCLXL = "{D20EA372-DD35-4950-9ED8-A6335AFE79F2}";
+ const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PLOTTER = "{D20EA372-DD35-4950-9ED8-A6335AFE79F4}";
+ const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_XPSDRV = "{D20EA372-DD35-4950-9ED8-A6335AFE79F5}";
+
+ typedef [public] struct {
+ GUID core_driver_guid;
+ NTTIME driver_date;
+ hyper driver_version;
+ [charset(UTF16),to_null] uint16 szPackageID[260];
+ } spoolss_CorePrinterDriver;
+
+ [public] HRESULT spoolss_GetCorePrinterDrivers(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,ref] [string,charset(UTF16)] uint16 *architecture,
+ [in] uint32 core_driver_size,
+ [in,size_is(core_driver_size)] uint16 *core_driver_dependencies,
+ [in] uint32 core_printer_driver_count,
+ [out,size_is(core_printer_driver_count)] spoolss_CorePrinterDriver *core_printer_drivers
+ );
+
+ /******************/
+ /* Function: 0x67 */
+ [todo] WERROR spoolss_67(
+ );
+
+ /******************/
+ /* Function: 0x68 */
+ HRESULT spoolss_GetPrinterDriverPackagePath(
+ [in,unique] [string,charset(UTF16)] uint16 *servername,
+ [in,ref] [string,charset(UTF16)] uint16 *architecture,
+ [in,unique] [string,charset(UTF16)] uint16 *language,
+ [in,ref] [string,charset(UTF16)] uint16 *package_id,
+ [in,out,unique,size_is(driver_package_cab_size)] [charset(UTF16)] uint16 *driver_package_cab,
+ [in] uint32 driver_package_cab_size,
+ [out,ref] uint32 *required
+ );
+
+ /******************/
+ /* Function: 0x69 */
+ [todo] WERROR spoolss_69(
+ );
+
+ /******************/
+ /* Function: 0x6a */
+ [todo] WERROR spoolss_6a(
+ );
+
+ /******************/
+ /* Function: 0x6b */
+ [todo] WERROR spoolss_6b(
+ );
+
+ /******************/
+ /* Function: 0x6c */
+ [todo] WERROR spoolss_6c(
+ );
+
+ /******************/
+ /* Function: 0x6d */
+ [todo] WERROR spoolss_6d(
+ );
+
+ /******************/
+ /* Function: 0x6e */
+
+ const string SPLFILE_CONTENT_TYPE_PROP_NAME = "Spool File Contents";
+ const string SPLFILE_CONTENT_TYPE_XPS_MS = "TYPE_XPS_MS";
+ const string SPLFILE_CONTENT_TYPE_XPS_OPEN = "TYPE_XPS_OPEN";
+ const string SPLFILE_CONTENT_TYPE_PDL_POSTSCRIPT = "TYPE_PDL_POSTSCRIPT";
+ const string SPLFILE_CONTENT_TYPE_PDL_UNKNOWN = "TYPE_PDL_UNKNOWN";
+
+ typedef enum {
+ kRpcPropertyTypeString = 1,
+ kRpcPropertyTypeInt32 = 2,
+ kRpcPropertyTypeInt64 = 3,
+ kRpcPropertyTypeByte = 4,
+ kRpcPropertyTypeBuffer = 5
+ } spoolss_EPrintPropertyType;
+
+ typedef struct {
+ uint32 cbBuf;
+ [size_is(cbBuf)] uint8 *pBuf;
+ } propertyBlob;
+
+ typedef [ms_union,switch_type(spoolss_EPrintPropertyType)] union {
+ [case(kRpcPropertyTypeString)] [string,charset(UTF16)] uint16 *propertyString;
+ [case(kRpcPropertyTypeInt32)] uint32 propertyInt32;
+ [case(kRpcPropertyTypeInt64)] hyper propertyInt64;
+ [case(kRpcPropertyTypeByte)] uint8 propertyByte;
+ [case(kRpcPropertyTypeBuffer)] propertyBlob propertyBlob;
+ } spoolss_PrintPropertyValueUnion;
+
+ typedef [public] struct {
+ spoolss_EPrintPropertyType ePropertyType;
+ [switch_is(ePropertyType)] spoolss_PrintPropertyValueUnion value;
+ } spoolss_PrintPropertyValue;
+
+ typedef [public] struct {
+ [string,charset(UTF16)] uint16 *propertyName;
+ spoolss_PrintPropertyValue propertyValue;
+ } spoolss_PrintNamedProperty;
+
+ WERROR spoolss_GetJobNamedPropertyValue(
+ [in,ref] policy_handle *hPrinter,
+ [in] uint32 JobId,
+ [in] [string,charset(UTF16)] uint16 *pszName,
+ [out,ref] spoolss_PrintPropertyValue *pValue
+ );
+
+ /******************/
+ /* Function: 0x6f */
+ [public] WERROR spoolss_SetJobNamedProperty(
+ [in,ref] policy_handle *hPrinter,
+ [in] uint32 JobId,
+ [in,ref] spoolss_PrintNamedProperty *pProperty
+ );
+
+ /******************/
+ /* Function: 0x70 */
+ WERROR spoolss_DeleteJobNamedProperty(
+ [in,ref] policy_handle *hPrinter,
+ [in] uint32 JobId,
+ [in] [string,charset(UTF16)] uint16 *pszName
+ );
+
+ /******************/
+ /* Function: 0x71 */
+ WERROR spoolss_EnumJobNamedProperties(
+ [in,ref] policy_handle *hPrinter,
+ [in] uint32 JobId,
+ [out,ref] uint32 *pcProperties,
+ [out,ref,size_is(,*pcProperties)] spoolss_PrintNamedProperty **ppProperties
+ );
+
+ /******************/
+ /* Function: 0x72 */
+ [todo] WERROR spoolss_72(
+ );
+
+ /******************/
+ /* Function: 0x73 */
+ [todo] WERROR spoolss_73(
+ );
+
+ /******************/
+ /* Function: 0x71 */
+ typedef enum {
+ kInvalidJobState = 0,
+ kLogJobPrinted = 1,
+ kLogJobRendered = 2,
+ kLogJobError = 3,
+ kLogJobPipelineError = 4,
+ kLogOfflineFileFull = 5
+ } EBranchOfficeJobEventType;
+
+ typedef struct {
+ DWORD Status;
+ [string,charset(UTF16)] uint16 *pDocumentName;
+ [string,charset(UTF16)] uint16 *pUserName;
+ [string,charset(UTF16)] uint16 *pMachineName;
+ [string,charset(UTF16)] uint16 *pPrinterName;
+ [string,charset(UTF16)] uint16 *pPortName;
+ hyper Size;
+ DWORD TotalPages;
+ } spoolss_BranchOfficeJobDataPrinted;
+
+ typedef struct {
+ hyper Size;
+ DWORD ICMMethod;
+ short Color;
+ short PrintQuality;
+ short YResolution;
+ short Copies;
+ short TTOption;
+ } spoolss_BranchOfficeJobDataRendered;
+
+ typedef struct {
+ WERROR LastError;
+ [string,charset(UTF16)] uint16 *pDocumentName;
+ [string,charset(UTF16)] uint16 *pUserName;
+ [string,charset(UTF16)] uint16 *pPrinterName;
+ [string,charset(UTF16)] uint16 *pDataType;
+ hyper TotalSize;
+ hyper PrintedSize;
+ DWORD TotalPages;
+ DWORD PrintedPages;
+ [string,charset(UTF16)] uint16 *pMachineName;
+ [string,charset(UTF16)] uint16 *pJobError;
+ [string,charset(UTF16)] uint16 *pErrorDescription;
+ } spoolss_BranchOfficeJobDataError;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *pDocumentName;
+ [string,charset(UTF16)] uint16 *pPrinterName;
+ [string,charset(UTF16)] uint16 *pExtraErrorInfo;
+ } spoolss_BranchOfficeJobDataPipelineFailed;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *pMachineName;
+ } spoolss_BranchOfficeLogOfflineFileFull;
+
+ typedef [ms_union,switch_type(EBranchOfficeJobEventType)] union {
+ [case(kLogJobPrinted)]
+ spoolss_BranchOfficeJobDataPrinted LogJobPrinted;
+ [case(kLogJobRendered)]
+ spoolss_BranchOfficeJobDataRendered LogJobRendered;
+ [case(kLogJobError)]
+ spoolss_BranchOfficeJobDataError LogJobError;
+ [case(kLogJobPipelineError)]
+ spoolss_BranchOfficeJobDataPipelineFailed LogPipelineFailed;
+ [case(kLogOfflineFileFull)]
+ spoolss_BranchOfficeLogOfflineFileFull LogOfflineFileFull;
+ } spoolss_BranchOfficeJobInfo;
+
+ typedef struct {
+ EBranchOfficeJobEventType eEventType;
+ DWORD JobId;
+ [switch_is(eEventType)] spoolss_BranchOfficeJobInfo JobInfo;
+ } spoolss_BranchOfficeJobData;
+
+ typedef [public] struct {
+ DWORD cJobDataEntries;
+ [size_is(cJobDataEntries)] spoolss_BranchOfficeJobData JobData[];
+ } spoolss_BranchOfficeJobDataContainer;
+
+ WERROR spoolss_LogJobInfoForBranchOffice(
+ [in,ref] policy_handle *hPrinter,
+ [in,ref] spoolss_BranchOfficeJobDataContainer *pBranchOfficeJobDataContainer
+ );
+
+}
diff --git a/librpc/idl/srvsvc.idl b/librpc/idl/srvsvc.idl
new file mode 100644
index 0000000..db804e5
--- /dev/null
+++ b/librpc/idl/srvsvc.idl
@@ -0,0 +1,1569 @@
+#include "idl_types.h"
+
+/*
+ srvsvc interface definitions
+*/
+import "misc.idl", "security.idl", "svcctl.idl";
+
+[ uuid("4b324fc8-1670-01d3-1278-5a47bf6ee188"),
+ version(3.0),
+ endpoint("ncacn_np:[\\pipe\\srvsvc]", "ncacn_ip_tcp:", "ncalrpc:"),
+ pointer_default(unique),
+ helpstring("Server Service")
+] interface srvsvc
+{
+ typedef bitmap svcctl_ServerType svcctl_ServerType;
+ typedef bitmap security_secinfo security_secinfo;
+
+/**************************/
+/* srvsvc_NetCharDev */
+/**************************/
+ typedef struct {
+ [string,charset(UTF16)] uint16 *device;
+ } srvsvc_NetCharDevInfo0;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetCharDevInfo0 *array;
+ } srvsvc_NetCharDevCtr0;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *device;
+ uint32 status;
+ [string,charset(UTF16)] uint16 *user;
+ uint32 time;
+ } srvsvc_NetCharDevInfo1;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetCharDevInfo1 *array;
+ } srvsvc_NetCharDevCtr1;
+
+ typedef union {
+ [case(0)] srvsvc_NetCharDevInfo0 *info0;
+ [case(1)] srvsvc_NetCharDevInfo1 *info1;
+ [default] ;
+ } srvsvc_NetCharDevInfo;
+
+ typedef union {
+ [case(0)] srvsvc_NetCharDevCtr0 *ctr0;
+ [case(1)] srvsvc_NetCharDevCtr1 *ctr1;
+ [default] ;
+ } srvsvc_NetCharDevCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] srvsvc_NetCharDevCtr ctr;
+ } srvsvc_NetCharDevInfoCtr;
+
+ /******************/
+ /* Function: 0x00 */
+ WERROR srvsvc_NetCharDevEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,out,ref] srvsvc_NetCharDevInfoCtr *info_ctr,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /******************/
+ /* Function: 0x01 */
+ WERROR srvsvc_NetCharDevGetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 device_name[],
+ [in] uint32 level,
+ [out,ref,switch_is(level)] srvsvc_NetCharDevInfo *info
+ );
+
+ /******************/
+ /* Function: 0x02 */
+ WERROR srvsvc_NetCharDevControl(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 device_name[],
+ [in] uint32 opcode
+ );
+
+/**************************/
+/* srvsvc_NetCharDevQ */
+/**************************/
+ typedef struct {
+ [string,charset(UTF16)] uint16 *device;
+ } srvsvc_NetCharDevQInfo0;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetCharDevQInfo0 *array;
+ } srvsvc_NetCharDevQCtr0;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *device;
+ uint32 priority;
+ [string,charset(UTF16)] uint16 *devices;
+ uint32 users;
+ uint32 num_ahead;
+ } srvsvc_NetCharDevQInfo1;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetCharDevQInfo1 *array;
+ } srvsvc_NetCharDevQCtr1;
+
+ typedef union {
+ [case(0)] srvsvc_NetCharDevQInfo0 *info0;
+ [case(1)] srvsvc_NetCharDevQInfo1 *info1;
+ [default] ;
+ } srvsvc_NetCharDevQInfo;
+
+ typedef union {
+ [case(0)] srvsvc_NetCharDevQCtr0 *ctr0;
+ [case(1)] srvsvc_NetCharDevQCtr1 *ctr1;
+ [default] ;
+ } srvsvc_NetCharDevQCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] srvsvc_NetCharDevQCtr ctr;
+ } srvsvc_NetCharDevQInfoCtr;
+
+ /******************/
+ /* Function: 0x03 */
+ WERROR srvsvc_NetCharDevQEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *user,
+ [in,out,ref] srvsvc_NetCharDevQInfoCtr *info_ctr,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /******************/
+ /* Function: 0x04 */
+ WERROR srvsvc_NetCharDevQGetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 queue_name[],
+ [in] [string,charset(UTF16)] uint16 user[],
+ [in] uint32 level,
+ [out,switch_is(level),ref] srvsvc_NetCharDevQInfo *info
+ );
+
+ /******************/
+ /* Function: 0x05 */
+ WERROR srvsvc_NetCharDevQSetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 queue_name[],
+ [in] uint32 level,
+ [in,switch_is(level)] srvsvc_NetCharDevQInfo info,
+ [in,out,unique] uint32 *parm_error
+ );
+
+ /******************/
+ /* Function: 0x06 */
+ WERROR srvsvc_NetCharDevQPurge(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 queue_name[]
+ );
+
+ /******************/
+ /* Function: 0x07 */
+ WERROR srvsvc_NetCharDevQPurgeSelf(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 queue_name[],
+ [in] [string,charset(UTF16)] uint16 computer_name[]
+ );
+
+/**************************/
+/* srvsvc_NetConn */
+/**************************/
+ typedef struct {
+ uint32 conn_id;
+ } srvsvc_NetConnInfo0;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetConnInfo0 *array;
+ } srvsvc_NetConnCtr0;
+
+ typedef struct {
+ uint32 conn_id;
+ uint32 conn_type;
+ uint32 num_open;
+ uint32 num_users;
+ uint32 conn_time;
+ [string,charset(UTF16)] uint16 *user;
+ [string,charset(UTF16)] uint16 *share;
+ } srvsvc_NetConnInfo1;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetConnInfo1 *array;
+ } srvsvc_NetConnCtr1;
+
+ typedef union {
+ [case(0)] srvsvc_NetConnCtr0 *ctr0;
+ [case(1)] srvsvc_NetConnCtr1 *ctr1;
+ [default] ;
+ } srvsvc_NetConnCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] srvsvc_NetConnCtr ctr;
+ } srvsvc_NetConnInfoCtr;
+
+ /******************/
+ /* Function: 0x08 */
+ WERROR srvsvc_NetConnEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *path,
+ [in,out,ref] srvsvc_NetConnInfoCtr *info_ctr,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+/**************************/
+/* srvsvc_NetFile */
+/**************************/
+ typedef struct {
+ uint32 fid;
+ } srvsvc_NetFileInfo2;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetFileInfo2 *array;
+ } srvsvc_NetFileCtr2;
+
+ typedef struct {
+ uint32 fid;
+ uint32 permissions;
+ uint32 num_locks;
+ [string,charset(UTF16)] uint16 *path;
+ [string,charset(UTF16)] uint16 *user;
+ } srvsvc_NetFileInfo3;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetFileInfo3 *array;
+ } srvsvc_NetFileCtr3;
+
+ typedef union {
+ [case(2)] srvsvc_NetFileInfo2 *info2;
+ [case(3)] srvsvc_NetFileInfo3 *info3;
+ [default] ;
+ } srvsvc_NetFileInfo;
+
+ typedef union {
+ [case(2)] srvsvc_NetFileCtr2 *ctr2;
+ [case(3)] srvsvc_NetFileCtr3 *ctr3;
+ [default] ;
+ } srvsvc_NetFileCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] srvsvc_NetFileCtr ctr;
+ } srvsvc_NetFileInfoCtr;
+
+ /******************/
+ /* Function: 0x09 */
+ WERROR srvsvc_NetFileEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *path,
+ [in,unique] [string,charset(UTF16)] uint16 *user,
+ [in,out,ref] srvsvc_NetFileInfoCtr *info_ctr,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /******************/
+ /* Function: 0x0a */
+ WERROR srvsvc_NetFileGetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 fid,
+ [in] uint32 level,
+ [out,switch_is(level),ref] srvsvc_NetFileInfo *info
+ );
+
+ /******************/
+ /* Function: 0x0b */
+ WERROR srvsvc_NetFileClose(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 fid
+ );
+
+/**************************/
+/* srvsvc_NetSess */
+/**************************/
+ typedef struct {
+ [string,charset(UTF16)] uint16 *client;
+ } srvsvc_NetSessInfo0;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetSessInfo0 *array;
+ } srvsvc_NetSessCtr0;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *client;
+ [string,charset(UTF16)] uint16 *user;
+ uint32 num_open;
+ uint32 time;
+ uint32 idle_time;
+ uint32 user_flags;
+ } srvsvc_NetSessInfo1;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetSessInfo1 *array;
+ } srvsvc_NetSessCtr1;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *client;
+ [string,charset(UTF16)] uint16 *user;
+ uint32 num_open;
+ uint32 time;
+ uint32 idle_time;
+ uint32 user_flags;
+ [string,charset(UTF16)] uint16 *client_type;
+ } srvsvc_NetSessInfo2;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetSessInfo2 *array;
+ } srvsvc_NetSessCtr2;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *client;
+ [string,charset(UTF16)] uint16 *user;
+ uint32 time;
+ uint32 idle_time;
+ } srvsvc_NetSessInfo10;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetSessInfo10 *array;
+ } srvsvc_NetSessCtr10;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *client;
+ [string,charset(UTF16)] uint16 *user;
+ uint32 num_open;
+ uint32 time;
+ uint32 idle_time;
+ uint32 user_flags;
+ [string,charset(UTF16)] uint16 *client_type;
+ [string,charset(UTF16)] uint16 *transport;
+ } srvsvc_NetSessInfo502;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetSessInfo502 *array;
+ } srvsvc_NetSessCtr502;
+
+ typedef union {
+ [case(0)] srvsvc_NetSessCtr0 *ctr0;
+ [case(1)] srvsvc_NetSessCtr1 *ctr1;
+ [case(2)] srvsvc_NetSessCtr2 *ctr2;
+ [case(10)] srvsvc_NetSessCtr10 *ctr10;
+ [case(502)] srvsvc_NetSessCtr502 *ctr502;
+ [default] ;
+ } srvsvc_NetSessCtr;
+
+ /******************/
+ /* Function: 0x0c */
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] srvsvc_NetSessCtr ctr;
+ } srvsvc_NetSessInfoCtr;
+
+ WERROR srvsvc_NetSessEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *client,
+ [in,unique] [string,charset(UTF16)] uint16 *user,
+ [in,out,ref] srvsvc_NetSessInfoCtr *info_ctr,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /******************/
+ /* Function: 0x0d */
+ WERROR srvsvc_NetSessDel(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *client,
+ [in,unique] [string,charset(UTF16)] uint16 *user
+ );
+
+/**************************/
+/* srvsvc_NetShare */
+/**************************/
+
+ /* share types */
+ const uint32 STYPE_TEMPORARY = 0x40000000; /* share is a temporary one */
+ const uint32 STYPE_HIDDEN = 0x80000000; /* share is a hidden one */
+
+ typedef [v1_enum, flag(NDR_PAHEX)] enum {
+ STYPE_DISKTREE = 0,
+ STYPE_DISKTREE_TEMPORARY = STYPE_DISKTREE|STYPE_TEMPORARY,
+ STYPE_DISKTREE_HIDDEN = STYPE_DISKTREE|STYPE_HIDDEN,
+ STYPE_PRINTQ = 1,
+ STYPE_PRINTQ_TEMPORARY = STYPE_PRINTQ|STYPE_TEMPORARY,
+ STYPE_PRINTQ_HIDDEN = STYPE_PRINTQ|STYPE_HIDDEN,
+ STYPE_DEVICE = 2, /* Serial device */
+ STYPE_DEVICE_TEMPORARY = STYPE_DEVICE|STYPE_TEMPORARY,
+ STYPE_DEVICE_HIDDEN = STYPE_DEVICE|STYPE_HIDDEN,
+ STYPE_IPC = 3, /* Interprocess communication (IPC) */
+ STYPE_IPC_TEMPORARY = STYPE_IPC|STYPE_TEMPORARY,
+ STYPE_IPC_HIDDEN = STYPE_IPC|STYPE_HIDDEN,
+ STYPE_CLUSTER_FS = 0x02000000, /* A cluster share */
+ STYPE_CLUSTER_FS_TEMPORARY = STYPE_CLUSTER_FS|STYPE_TEMPORARY,
+ STYPE_CLUSTER_FS_HIDDEN = STYPE_CLUSTER_FS|STYPE_HIDDEN,
+ STYPE_CLUSTER_SOFS = 0x04000000, /* A Scale-Out cluster share */
+ STYPE_CLUSTER_SOFS_TEMPORARY = STYPE_CLUSTER_SOFS|STYPE_TEMPORARY,
+ STYPE_CLUSTER_SOFS_HIDDEN = STYPE_CLUSTER_SOFS|STYPE_HIDDEN,
+ STYPE_CLUSTER_DFS = 0x08000000, /* A DFS share in a cluster */
+ STYPE_CLUSTER_DFS_TEMPORARY = STYPE_CLUSTER_DFS|STYPE_TEMPORARY,
+ STYPE_CLUSTER_DFS_HIDDEN = STYPE_CLUSTER_DFS|STYPE_HIDDEN
+ } srvsvc_ShareType;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *name;
+ } srvsvc_NetShareInfo0;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo0 *array;
+ } srvsvc_NetShareCtr0;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *name;
+ srvsvc_ShareType type;
+ [string,charset(UTF16)] uint16 *comment;
+ } srvsvc_NetShareInfo1;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo1 *array;
+ } srvsvc_NetShareCtr1;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *name;
+ srvsvc_ShareType type;
+ [string,charset(UTF16)] uint16 *comment;
+ uint32 permissions;
+ uint32 max_users;
+ uint32 current_users;
+ [string,charset(UTF16)] uint16 *path;
+ [string,charset(UTF16)] uint16 *password;
+ } srvsvc_NetShareInfo2;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo2 *array;
+ } srvsvc_NetShareCtr2;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *name;
+ srvsvc_ShareType type;
+ [string,charset(UTF16)] uint16 *comment;
+ uint32 csc_policy;
+ } srvsvc_NetShareInfo501;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo501 *array;
+ } srvsvc_NetShareCtr501;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *name;
+ srvsvc_ShareType type;
+ [string,charset(UTF16)] uint16 *comment;
+ uint32 permissions;
+ uint32 max_users;
+ uint32 current_users;
+ [string,charset(UTF16)] uint16 *path;
+ [string,charset(UTF16)] uint16 *password;
+ sec_desc_buf sd_buf;
+ } srvsvc_NetShareInfo502;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo502 *array;
+ } srvsvc_NetShareCtr502;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *comment;
+ } srvsvc_NetShareInfo1004;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo1004 *array;
+ } srvsvc_NetShareCtr1004;
+
+ const uint32 SHARE_1005_CSC_CACHE_MANUAL_REINT = 0x00000000;
+
+ typedef bitmap {
+ SHARE_1005_IN_DFS = 0x00000001,
+ SHARE_1005_DFS_ROOT = 0x00000002,
+ SHARE_1005_CSC_CACHE_AUTO_REINT = 0x00000010,
+ SHARE_1005_CSC_CACHE_VDO = 0x00000020,
+ SHARE_1005_CSC_CACHE_NONE = 0x00000030,
+ SHARE_1005_RESTRICT_EXCLUSIVE_OPENS = 0x00000100,
+ SHARE_1005_FORCE_SHARED_DELETE = 0x00000200,
+ SHARE_1005_ALLOW_NAMESPACE_CACHING = 0x00000400,
+ SHARE_1005_ACCESS_BASED_DIRECTORY_ENUM = 0x00000800,
+ SHARE_1005_FORCE_LEVELII_OPLOCK = 0x00001000,
+ SHARE_1005_ENABLE_HASH = 0x00002000,
+ SHARE_1005_ENABLE_CA = 0x00004000,
+ SHARE_1005_ENCRYPT_DATA = 0x00008000
+ } NetShareInfo1005Flags;
+
+ const uint32 SHARE_1005_CSC_POLICY_MASK = 0x00000030;
+ const uint32 SHARE_1005_CSC_POLICY_SHIFT = 4;
+
+ typedef struct {
+ NetShareInfo1005Flags dfs_flags;
+ } srvsvc_NetShareInfo1005;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo1005 *array;
+ } srvsvc_NetShareCtr1005;
+
+ typedef struct {
+ uint32 max_users;
+ } srvsvc_NetShareInfo1006;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo1006 *array;
+ } srvsvc_NetShareCtr1006;
+
+ typedef struct {
+ uint32 flags;
+ [string,charset(UTF16)] uint16 *alternate_directory_name;
+ } srvsvc_NetShareInfo1007;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetShareInfo1007 *array;
+ } srvsvc_NetShareCtr1007;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] sec_desc_buf *array;
+ } srvsvc_NetShareCtr1501;
+
+ typedef union {
+ [case(0)] srvsvc_NetShareInfo0 *info0;
+ [case(1)] srvsvc_NetShareInfo1 *info1;
+ [case(2)] srvsvc_NetShareInfo2 *info2;
+ [case(501)] srvsvc_NetShareInfo501 *info501;
+ [case(502)] srvsvc_NetShareInfo502 *info502;
+ [case(1004)] srvsvc_NetShareInfo1004 *info1004;
+ [case(1005)] srvsvc_NetShareInfo1005 *info1005;
+ [case(1006)] srvsvc_NetShareInfo1006 *info1006;
+ [case(1007)] srvsvc_NetShareInfo1007 *info1007;
+ [case(1501)] sec_desc_buf *info1501;
+ [default] ;
+ } srvsvc_NetShareInfo;
+
+ typedef union {
+ [case(0)] srvsvc_NetShareCtr0 *ctr0;
+ [case(1)] srvsvc_NetShareCtr1 *ctr1;
+ [case(2)] srvsvc_NetShareCtr2 *ctr2;
+ [case(501)] srvsvc_NetShareCtr501 *ctr501;
+ [case(502)] srvsvc_NetShareCtr502 *ctr502;
+ [case(1004)] srvsvc_NetShareCtr1004 *ctr1004;
+ [case(1005)] srvsvc_NetShareCtr1005 *ctr1005;
+ [case(1006)] srvsvc_NetShareCtr1006 *ctr1006;
+ [case(1007)] srvsvc_NetShareCtr1007 *ctr1007;
+ [case(1501)] srvsvc_NetShareCtr1501 *ctr1501;
+ [default] ;
+ } srvsvc_NetShareCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] srvsvc_NetShareCtr ctr;
+ } srvsvc_NetShareInfoCtr;
+
+ /******************/
+ /* Function: 0x0e */
+ WERROR srvsvc_NetShareAdd(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] srvsvc_NetShareInfo *info,
+ [in,out,unique] uint32 *parm_error
+ );
+
+ /******************/
+ /* Function: 0x0f */
+ WERROR srvsvc_NetShareEnumAll (
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,out,ref] srvsvc_NetShareInfoCtr *info_ctr,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /******************/
+ /* Function: 0x10 */
+ WERROR srvsvc_NetShareGetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 share_name[],
+ [in] uint32 level,
+ [out,ref,switch_is(level)] srvsvc_NetShareInfo *info
+ );
+
+ /******************/
+ /* Function: 0x11 */
+ WERROR srvsvc_NetShareSetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 share_name[],
+ [in] uint32 level,
+ [in,ref,switch_is(level)] srvsvc_NetShareInfo *info,
+ [in,out,unique] uint32 *parm_error
+ );
+
+ /******************/
+ /* Function: 0x12 */
+ WERROR srvsvc_NetShareDel(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 share_name[],
+ [in] uint32 reserved
+ );
+
+ /******************/
+ /* Function: 0x13 */
+ WERROR srvsvc_NetShareDelSticky(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 share_name[],
+ [in] uint32 reserved
+ );
+
+ /******************/
+ /* Function: 0x14 */
+ WERROR srvsvc_NetShareCheck(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 device_name[],
+ [out,ref] srvsvc_ShareType *type
+ );
+
+/**************************/
+/* srvsvc_NetSrv */
+/**************************/
+ typedef [public,v1_enum] enum {
+ PLATFORM_ID_DOS = 300,
+ PLATFORM_ID_OS2 = 400,
+ PLATFORM_ID_NT = 500,
+ PLATFORM_ID_OSF = 600,
+ PLATFORM_ID_VMS = 700
+ } srvsvc_PlatformId;
+
+ typedef [public] struct {
+ srvsvc_PlatformId platform_id;
+ [string,charset(UTF16)] uint16 *server_name;
+ } srvsvc_NetSrvInfo100;
+
+ typedef [public] struct {
+ srvsvc_PlatformId platform_id;
+ [string,charset(UTF16)] uint16 *server_name;
+ uint32 version_major;
+ uint32 version_minor;
+ svcctl_ServerType server_type;
+ [string,charset(UTF16)] uint16 *comment;
+ } srvsvc_NetSrvInfo101;
+
+ typedef struct {
+ srvsvc_PlatformId platform_id;
+ [string,charset(UTF16)] uint16 *server_name;
+ uint32 version_major;
+ uint32 version_minor;
+ svcctl_ServerType server_type;
+ [string,charset(UTF16)] uint16 *comment;
+ uint32 users;
+ uint32 disc;
+ uint32 hidden;
+ uint32 announce;
+ uint32 anndelta;
+ uint32 licenses;
+ [string,charset(UTF16)] uint16 *userpath;
+ } srvsvc_NetSrvInfo102;
+
+ typedef struct {
+ uint32 ulist_mtime;
+ uint32 glist_mtime;
+ uint32 alist_mtime;
+ [string,charset(UTF16)] uint16 *alerts;
+ uint32 security;
+ uint32 numadmin;
+ uint32 lanmask;
+ [string,charset(UTF16)] uint16 *guestaccount;
+ uint32 chdevs;
+ uint32 chdevqs;
+ uint32 chdevjobs;
+ uint32 connections;
+ uint32 shares;
+ uint32 openfiles;
+ uint32 sessopen;
+ uint32 sesssvc;
+ uint32 sessreqs;
+ uint32 opensearch;
+ uint32 activelocks;
+ uint32 numreqbufs;
+ uint32 sizereqbufs;
+ uint32 numbigbufs;
+ uint32 numfiletasks;
+ uint32 alertsched;
+ uint32 erroralert;
+ uint32 logonalert;
+ uint32 accessalert;
+ uint32 diskalert;
+ uint32 netioalert;
+ uint32 maxaudits;
+ [string,charset(UTF16)] uint16 *srvheuristics;
+ } srvsvc_NetSrvInfo402;
+
+ typedef struct {
+ uint32 ulist_mtime;
+ uint32 glist_mtime;
+ uint32 alist_mtime;
+ [string,charset(UTF16)] uint16 *alerts;
+ uint32 security;
+ uint32 numadmin;
+ uint32 lanmask;
+ [string,charset(UTF16)] uint16 *guestaccount;
+ uint32 chdevs;
+ uint32 chdevqs;
+ uint32 chdevjobs;
+ uint32 connections;
+ uint32 shares;
+ uint32 openfiles;
+ uint32 sessopen;
+ uint32 sesssvc;
+ uint32 sessreqs;
+ uint32 opensearch;
+ uint32 activelocks;
+ uint32 numreqbufs;
+ uint32 sizereqbufs;
+ uint32 numbigbufs;
+ uint32 numfiletasks;
+ uint32 alertsched;
+ uint32 erroralert;
+ uint32 logonalert;
+ uint32 accessalert;
+ uint32 diskalert;
+ uint32 netioalert;
+ uint32 maxaudits;
+ [string,charset(UTF16)] uint16 *srvheuristics;
+ uint32 auditedevents;
+ uint32 auditprofile;
+ [string,charset(UTF16)] uint16 *autopath;
+ } srvsvc_NetSrvInfo403;
+
+ typedef struct {
+ uint32 sessopen;
+ uint32 sesssvc;
+ uint32 opensearch;
+ uint32 sizereqbufs;
+ uint32 initworkitems;
+ uint32 maxworkitems;
+ uint32 rawworkitems;
+ uint32 irpstacksize;
+ uint32 maxrawbuflen;
+ uint32 sessusers;
+ uint32 sessconns;
+ uint32 maxpagedmemoryusage;
+ uint32 maxnonpagedmemoryusage;
+ uint32 enablesoftcompat;
+ uint32 enableforcedlogoff;
+ uint32 timesource;
+ uint32 acceptdownlevelapis;
+ uint32 lmannounce;
+ } srvsvc_NetSrvInfo502;
+
+ typedef struct{
+ uint32 sessopen;
+ uint32 sesssvc;
+ uint32 opensearch;
+ uint32 sizereqbufs;
+ uint32 initworkitems;
+ uint32 maxworkitems;
+ uint32 rawworkitems;
+ uint32 irpstacksize;
+ uint32 maxrawbuflen;
+ uint32 sessusers;
+ uint32 sessconns;
+ uint32 maxpagedmemoryusage;
+ uint32 maxnonpagedmemoryusage;
+ uint32 enablesoftcompat;
+ uint32 enableforcedlogoff;
+ uint32 timesource;
+ uint32 acceptdownlevelapis;
+ uint32 lmannounce;
+ [string,charset(UTF16)] uint16 *domain;
+ uint32 maxcopyreadlen;
+ uint32 maxcopywritelen;
+ uint32 minkeepsearch;
+ uint32 maxkeepsearch;
+ uint32 minkeepcomplsearch;
+ uint32 maxkeepcomplsearch;
+ uint32 threadcountadd;
+ uint32 numlockthreads;
+ uint32 scavtimeout;
+ uint32 minrcvqueue;
+ uint32 minfreeworkitems;
+ uint32 xactmemsize;
+ uint32 threadpriority;
+ uint32 maxmpxct;
+ uint32 oplockbreakwait;
+ uint32 oplockbreakresponsewait;
+ uint32 enableoplocks;
+ uint32 enableoplockforceclose;
+ uint32 enablefcbopens;
+ uint32 enableraw;
+ uint32 enablesharednetdrives;
+ uint32 minfreeconnections;
+ uint32 maxfreeconnections;
+ } srvsvc_NetSrvInfo503;
+
+ typedef struct{
+ uint32 sessopen;
+ uint32 sesssvc;
+ uint32 opensearch;
+ uint32 sizereqbufs;
+ uint32 initworkitems;
+ uint32 maxworkitems;
+ uint32 rawworkitems;
+ uint32 irpstacksize;
+ uint32 maxrawbuflen;
+ uint32 sessusers;
+ uint32 sessconns;
+ uint32 maxpagedmemoryusage;
+ uint32 maxnonpagedmemoryusage;
+ uint32 enablesoftcompat;
+ uint32 enableforcedlogoff;
+ uint32 timesource;
+ uint32 acceptdownlevelapis;
+ uint32 lmannounce;
+ [string,charset(UTF16)] uint16 *domain;
+ uint32 maxcopyreadlen;
+ uint32 maxcopywritelen;
+ uint32 minkeepsearch;
+ uint32 minkeepcomplsearch;
+ uint32 maxkeepcomplsearch;
+ uint32 threadcountadd;
+ uint32 numlockthreads;
+ uint32 scavtimeout;
+ uint32 minrcvqueue;
+ uint32 minfreeworkitems;
+ uint32 xactmemsize;
+ uint32 threadpriority;
+ uint32 maxmpxct;
+ uint32 oplockbreakwait;
+ uint32 oplockbreakresponsewait;
+ uint32 enableoplocks;
+ uint32 enableoplockforceclose;
+ uint32 enablefcbopens;
+ uint32 enableraw;
+ uint32 enablesharednetdrives;
+ uint32 minfreeconnections;
+ uint32 maxfreeconnections;
+ uint32 initsesstable;
+ uint32 initconntable;
+ uint32 initfiletable;
+ uint32 initsearchtable;
+ uint32 alertsched;
+ uint32 errortreshold;
+ uint32 networkerrortreshold;
+ uint32 diskspacetreshold;
+ uint32 reserved;
+ uint32 maxlinkdelay;
+ uint32 minlinkthroughput;
+ uint32 linkinfovalidtime;
+ uint32 scavqosinfoupdatetime;
+ uint32 maxworkitemidletime;
+ } srvsvc_NetSrvInfo599;
+
+ typedef struct{
+ [string,charset(UTF16)] uint16 *comment;
+ } srvsvc_NetSrvInfo1005;
+
+ typedef struct{
+ uint32 disc;
+ } srvsvc_NetSrvInfo1010;
+
+ typedef struct{
+ uint32 hidden;
+ } srvsvc_NetSrvInfo1016;
+
+ typedef struct{
+ uint32 announce;
+ } srvsvc_NetSrvInfo1017;
+
+ typedef struct{
+ uint32 anndelta;
+ } srvsvc_NetSrvInfo1018;
+
+ typedef struct{
+ uint32 users;
+ } srvsvc_NetSrvInfo1107;
+
+ typedef struct{
+ uint32 sessopens;
+ } srvsvc_NetSrvInfo1501;
+
+ typedef struct{
+ uint32 sessvcs;
+ } srvsvc_NetSrvInfo1502;
+
+ typedef struct{
+ uint32 opensearch;
+ } srvsvc_NetSrvInfo1503;
+
+ typedef struct{
+ uint32 maxworkitems;
+ } srvsvc_NetSrvInfo1506;
+
+ typedef struct{
+ uint32 maxrawbuflen;
+ } srvsvc_NetSrvInfo1509;
+
+ typedef struct{
+ uint32 sessusers;
+ } srvsvc_NetSrvInfo1510;
+
+ typedef struct{
+ uint32 sesscons;
+ } srvsvc_NetSrvInfo1511;
+
+ typedef struct{
+ uint32 maxnonpagedmemoryusage;
+ } srvsvc_NetSrvInfo1512;
+
+ typedef struct{
+ uint32 maxpagedmemoryusage;
+ } srvsvc_NetSrvInfo1513;
+
+ typedef struct{
+ uint32 enablesoftcompat;
+ } srvsvc_NetSrvInfo1514;
+
+ typedef struct{
+ uint32 enableforcedlogoff;
+ } srvsvc_NetSrvInfo1515;
+
+ typedef struct{
+ uint32 timesource;
+ } srvsvc_NetSrvInfo1516;
+
+ typedef struct{
+ uint32 lmannounce;
+ } srvsvc_NetSrvInfo1518;
+
+ typedef struct{
+ uint32 maxcopyreadlen;
+ } srvsvc_NetSrvInfo1520;
+
+ typedef struct{
+ uint32 maxcopywritelen;
+ } srvsvc_NetSrvInfo1521;
+
+ typedef struct{
+ uint32 minkeepsearch;
+ } srvsvc_NetSrvInfo1522;
+
+ typedef struct{
+ uint32 maxkeepsearch;
+ } srvsvc_NetSrvInfo1523;
+
+ typedef struct{
+ uint32 minkeepcomplsearch;
+ } srvsvc_NetSrvInfo1524;
+
+ typedef struct{
+ uint32 maxkeepcomplsearch;
+ } srvsvc_NetSrvInfo1525;
+
+ typedef struct{
+ uint32 scavtimeout;
+ } srvsvc_NetSrvInfo1528;
+
+ typedef struct{
+ uint32 minrcvqueue;
+ } srvsvc_NetSrvInfo1529;
+
+ typedef struct{
+ uint32 minfreeworkitems;
+ } srvsvc_NetSrvInfo1530;
+
+ typedef struct{
+ uint32 maxmpxct;
+ } srvsvc_NetSrvInfo1533;
+
+ typedef struct{
+ uint32 oplockbreakwait;
+ } srvsvc_NetSrvInfo1534;
+
+ typedef struct{
+ uint32 oplockbreakresponsewait;
+ } srvsvc_NetSrvInfo1535;
+
+ typedef struct{
+ uint32 enableoplocks;
+ } srvsvc_NetSrvInfo1536;
+
+ typedef struct{
+ uint32 enableoplockforceclose;
+ } srvsvc_NetSrvInfo1537;
+
+ typedef struct{
+ uint32 enablefcbopens;
+ } srvsvc_NetSrvInfo1538;
+
+ typedef struct{
+ uint32 enableraw;
+ } srvsvc_NetSrvInfo1539;
+
+ typedef struct{
+ uint32 enablesharednetdrives;
+ } srvsvc_NetSrvInfo1540;
+
+ typedef struct{
+ uint32 minfreeconnections;
+ } srvsvc_NetSrvInfo1541;
+
+ typedef struct{
+ uint32 maxfreeconnections;
+ } srvsvc_NetSrvInfo1542;
+
+ typedef struct{
+ uint32 initsesstable;
+ } srvsvc_NetSrvInfo1543;
+
+ typedef struct{
+ uint32 initconntable;
+ } srvsvc_NetSrvInfo1544;
+
+ typedef struct{
+ uint32 initfiletable;
+ } srvsvc_NetSrvInfo1545;
+
+ typedef struct{
+ uint32 initsearchtable;
+ } srvsvc_NetSrvInfo1546;
+
+ typedef struct{
+ uint32 alertsched;
+ } srvsvc_NetSrvInfo1547;
+
+ typedef struct{
+ uint32 errortreshold;
+ } srvsvc_NetSrvInfo1548;
+
+ typedef struct{
+ uint32 networkerrortreshold;
+ } srvsvc_NetSrvInfo1549;
+
+ typedef struct{
+ uint32 diskspacetreshold;
+ } srvsvc_NetSrvInfo1550;
+
+ typedef struct{
+ uint32 maxlinkdelay;
+ } srvsvc_NetSrvInfo1552;
+
+ typedef struct{
+ uint32 minlinkthroughput;
+ } srvsvc_NetSrvInfo1553;
+
+ typedef struct{
+ uint32 linkinfovalidtime;
+ } srvsvc_NetSrvInfo1554;
+
+ typedef struct{
+ uint32 scavqosinfoupdatetime;
+ } srvsvc_NetSrvInfo1555;
+
+ typedef struct{
+ uint32 maxworkitemidletime;
+ } srvsvc_NetSrvInfo1556;
+
+
+ typedef union{
+ [case(100)] srvsvc_NetSrvInfo100 *info100;
+ [case(101)] srvsvc_NetSrvInfo101 *info101;
+ [case(102)] srvsvc_NetSrvInfo102 *info102;
+ [case(402)] srvsvc_NetSrvInfo402 *info402;
+ [case(403)] srvsvc_NetSrvInfo403 *info403;
+ [case(502)] srvsvc_NetSrvInfo502 *info502;
+ [case(503)] srvsvc_NetSrvInfo503 *info503;
+ [case(599)] srvsvc_NetSrvInfo599 *info599;
+ [case(1005)] srvsvc_NetSrvInfo1005 *info1005;
+ [case(1010)] srvsvc_NetSrvInfo1010 *info1010;
+ [case(1016)] srvsvc_NetSrvInfo1016 *info1016;
+ [case(1017)] srvsvc_NetSrvInfo1017 *info1017;
+ [case(1018)] srvsvc_NetSrvInfo1018 *info1018;
+ [case(1107)] srvsvc_NetSrvInfo1107 *info1107;
+ [case(1501)] srvsvc_NetSrvInfo1501 *info1501;
+ [case(1502)] srvsvc_NetSrvInfo1502 *info1502;
+ [case(1503)] srvsvc_NetSrvInfo1503 *info1503;
+ [case(1506)] srvsvc_NetSrvInfo1506 *info1506;
+ [case(1509)] srvsvc_NetSrvInfo1509 *info1509;
+ [case(1510)] srvsvc_NetSrvInfo1510 *info1510;
+ [case(1511)] srvsvc_NetSrvInfo1511 *info1511;
+ [case(1512)] srvsvc_NetSrvInfo1512 *info1512;
+ [case(1513)] srvsvc_NetSrvInfo1513 *info1513;
+ [case(1514)] srvsvc_NetSrvInfo1514 *info1514;
+ [case(1515)] srvsvc_NetSrvInfo1515 *info1515;
+ [case(1516)] srvsvc_NetSrvInfo1516 *info1516;
+ [case(1518)] srvsvc_NetSrvInfo1518 *info1518;
+ [case(1520)] srvsvc_NetSrvInfo1520 *info1520;
+ [case(1521)] srvsvc_NetSrvInfo1521 *info1521;
+ [case(1522)] srvsvc_NetSrvInfo1522 *info1522;
+ [case(1523)] srvsvc_NetSrvInfo1523 *info1523;
+ [case(1524)] srvsvc_NetSrvInfo1524 *info1524;
+ [case(1525)] srvsvc_NetSrvInfo1525 *info1525;
+ [case(1528)] srvsvc_NetSrvInfo1528 *info1528;
+ [case(1529)] srvsvc_NetSrvInfo1529 *info1529;
+ [case(1530)] srvsvc_NetSrvInfo1530 *info1530;
+ [case(1533)] srvsvc_NetSrvInfo1533 *info1533;
+ [case(1534)] srvsvc_NetSrvInfo1534 *info1534;
+ [case(1535)] srvsvc_NetSrvInfo1535 *info1535;
+ [case(1536)] srvsvc_NetSrvInfo1536 *info1536;
+ [case(1537)] srvsvc_NetSrvInfo1537 *info1537;
+ [case(1538)] srvsvc_NetSrvInfo1538 *info1538;
+ [case(1539)] srvsvc_NetSrvInfo1539 *info1539;
+ [case(1540)] srvsvc_NetSrvInfo1540 *info1540;
+ [case(1541)] srvsvc_NetSrvInfo1541 *info1541;
+ [case(1542)] srvsvc_NetSrvInfo1542 *info1542;
+ [case(1543)] srvsvc_NetSrvInfo1543 *info1543;
+ [case(1544)] srvsvc_NetSrvInfo1544 *info1544;
+ [case(1545)] srvsvc_NetSrvInfo1545 *info1545;
+ [case(1546)] srvsvc_NetSrvInfo1546 *info1546;
+ [case(1547)] srvsvc_NetSrvInfo1547 *info1547;
+ [case(1548)] srvsvc_NetSrvInfo1548 *info1548;
+ [case(1549)] srvsvc_NetSrvInfo1549 *info1549;
+ [case(1550)] srvsvc_NetSrvInfo1550 *info1550;
+ [case(1552)] srvsvc_NetSrvInfo1552 *info1552;
+ [case(1553)] srvsvc_NetSrvInfo1553 *info1553;
+ [case(1554)] srvsvc_NetSrvInfo1554 *info1554;
+ [case(1555)] srvsvc_NetSrvInfo1555 *info1555;
+ [case(1556)] srvsvc_NetSrvInfo1556 *info1556;
+ [default];
+ } srvsvc_NetSrvInfo;
+
+ /******************/
+ /* Function: 0x15 */
+ WERROR srvsvc_NetSrvGetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 level,
+ [out,ref,switch_is(level)] srvsvc_NetSrvInfo *info
+ );
+
+ /******************/
+ /* Function: 0x16 */
+ WERROR srvsvc_NetSrvSetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 level,
+ [in,ref,switch_is(level)] srvsvc_NetSrvInfo *info,
+ [in,out,unique] uint32 *parm_error
+ );
+
+/**************************/
+/* srvsvc_NetDisk */
+/**************************/
+ typedef struct {
+ /*
+ * In theory this should be:
+ * [charset(UTF16),string] uint16 annotation[3]
+ * But midl treats this as:
+ * [charset(UTF16),string] uint16 annotation[]
+ * and pidl doesn't support this yet
+ */
+ [value(0)] uint32 __disk_offset;
+ [value(strlen(disk)+1)] uint32 __disk_length;
+ [charset(UTF16)] uint16 disk[__disk_length];
+ } srvsvc_NetDiskInfo0;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count), length_is(count)] srvsvc_NetDiskInfo0 *disks;
+ } srvsvc_NetDiskInfo;
+
+ /******************/
+ /* Function: 0x17 */
+ WERROR srvsvc_NetDiskEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 level,
+ [in,out,ref] srvsvc_NetDiskInfo *info,
+ [in] uint32 maxlen,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+/**************************/
+/* srvsvc_NetStatistics */
+/**************************/
+ typedef struct {
+ uint32 start;
+ uint32 fopens;
+ uint32 devopens;
+ uint32 jobsqueued;
+ uint32 sopens;
+ uint32 stimeouts;
+ uint32 serrorout;
+ uint32 pwerrors;
+ uint32 permerrors;
+ uint32 syserrors;
+ uint32 bytessent_low;
+ uint32 bytessent_high;
+ uint32 bytesrcvd_low;
+ uint32 bytesrcvd_high;
+ uint32 avresponse;
+ uint32 reqbufneed;
+ uint32 bigbufneed;
+ } srvsvc_Statistics;
+
+ /******************/
+ /* Function: 0x18 */
+ WERROR srvsvc_NetServerStatisticsGet(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *service,
+ [in] uint32 level,
+ [in] uint32 options,
+ [out,ref] srvsvc_Statistics **stats
+ );
+
+/**************************/
+/* srvsvc_NetTransport */
+/**************************/
+ typedef struct {
+ uint32 vcs;
+ [string,charset(UTF16)] uint16 *name;
+ [size_is(addr_len)] uint8 *addr;
+ uint32 addr_len;
+ [string,charset(UTF16)] uint16 *net_addr;
+ } srvsvc_NetTransportInfo0;
+
+ /******************/
+ /* Function: 0x19 */
+ WERROR srvsvc_NetTransportAdd(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 level,
+ [in,switch_is(level)] srvsvc_NetTransportInfo info
+ );
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetTransportInfo0 *array;
+ } srvsvc_NetTransportCtr0;
+
+ typedef struct {
+ uint32 vcs;
+ [string,charset(UTF16)] uint16 *name;
+ [size_is(addr_len)] uint8 *addr;
+ uint32 addr_len;
+ [string,charset(UTF16)] uint16 *net_addr;
+ [string,charset(UTF16)] uint16 *domain;
+ } srvsvc_NetTransportInfo1;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetTransportInfo1 *array;
+ } srvsvc_NetTransportCtr1;
+
+ typedef struct {
+ uint32 vcs;
+ [string,charset(UTF16)] uint16 *name;
+ [size_is(addr_len)] uint8 *addr;
+ uint32 addr_len;
+ [string,charset(UTF16)] uint16 *net_addr;
+ [string,charset(UTF16)] uint16 *domain;
+ uint32 unknown;
+ } srvsvc_NetTransportInfo2;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetTransportInfo2 *array;
+ } srvsvc_NetTransportCtr2;
+
+ typedef struct {
+ uint32 vcs;
+ [string,charset(UTF16)] uint16 *name;
+ [size_is(addr_len)] uint8 *addr;
+ uint32 addr_len;
+ [string,charset(UTF16)] uint16 *net_addr;
+ [string,charset(UTF16)] uint16 *domain;
+ uint32 unknown1;
+ uint32 unknown2;
+ uint8 unknown3[256];
+ } srvsvc_NetTransportInfo3;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] srvsvc_NetTransportInfo3 *array;
+ } srvsvc_NetTransportCtr3;
+
+ typedef union {
+ [case(0)] srvsvc_NetTransportCtr0 *ctr0;
+ [case(1)] srvsvc_NetTransportCtr1 *ctr1;
+ [case(2)] srvsvc_NetTransportCtr2 *ctr2;
+ [case(3)] srvsvc_NetTransportCtr3 *ctr3;
+ [default];
+ } srvsvc_NetTransportCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] srvsvc_NetTransportCtr ctr;
+ } srvsvc_NetTransportInfoCtr;
+
+ /******************/
+ /* Function: 0x1a */
+ WERROR srvsvc_NetTransportEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,out,ref] srvsvc_NetTransportInfoCtr *transports,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /******************/
+ /* Function: 0x1b */
+ WERROR srvsvc_NetTransportDel(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 level,
+ [in] srvsvc_NetTransportInfo0 *info0
+ );
+
+/**************************/
+/* srvsvc_NetRemoteTOD */
+/**************************/
+ typedef struct {
+ uint32 elapsed; /* time(NULL) */
+ uint32 msecs; /* milliseconds till system reboot (uptime) */
+ uint32 hours;
+ uint32 mins;
+ uint32 secs;
+ uint32 hunds;
+ int32 timezone; /* in minutes */
+ uint32 tinterval; /* clock tick interval in 0.0001 second units; 310 on windows */
+ uint32 day;
+ uint32 month;
+ uint32 year;
+ uint32 weekday;
+ } srvsvc_NetRemoteTODInfo;
+
+ /******************/
+ /* Function: 0x1c */
+ WERROR srvsvc_NetRemoteTOD(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [out,ref] srvsvc_NetRemoteTODInfo **info
+ );
+
+/**************************/
+/* srvsvc_NetServiceBits */
+/**************************/
+ /******************/
+ /* Function: 0x1d */
+ WERROR srvsvc_NetSetServiceBits(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *transport,
+ [in] uint32 servicebits,
+ [in] uint32 updateimmediately
+ );
+
+/**************************/
+/* srvsvc_NetPath */
+/**************************/
+ /******************/
+ /* Function: 0x1e */
+ WERROR srvsvc_NetPathType(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 path[],
+ [in] uint32 pathflags,
+ [out,ref] uint32 *pathtype
+ );
+
+ /******************/
+ /* Function: 0x1f */
+ WERROR srvsvc_NetPathCanonicalize(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 path[],
+ [out] [size_is(maxbuf)] uint8 can_path[],
+ [in] uint32 maxbuf,
+ [in] [string,charset(UTF16)] uint16 prefix[],
+ [in,out,ref] uint32 *pathtype,
+ [in] uint32 pathflags
+ );
+
+ /******************/
+ /* Function: 0x20 */
+ WERROR srvsvc_NetPathCompare(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 path1[],
+ [in] [string,charset(UTF16)] uint16 path2[],
+ [in] uint32 pathtype,
+ [in] uint32 pathflags
+ );
+
+/**************************/
+/* srvsvc_NetName */
+/**************************/
+ /******************/
+ /* Function: 0x21 */
+ WERROR srvsvc_NetNameValidate(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 name[],
+ [in] uint32 name_type,
+ [in] uint32 flags
+ );
+
+ /******************/
+ /* Function: 0x22 */
+ [todo] WERROR srvsvc_NETRPRNAMECANONICALIZE(
+ );
+
+ /******************/
+ /* Function: 0x23 */
+ WERROR srvsvc_NetPRNameCompare(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 name1[],
+ [in] [string,charset(UTF16)] uint16 name2[],
+ [in] uint32 name_type,
+ [in] uint32 flags
+ );
+
+/**************************/
+/* srvsvc_NetShare ... */
+/**************************/
+ /******************/
+ /* Function: 0x24 */
+ /* Note, there must be some way to return entries read vs
+ total entries ... */
+ WERROR srvsvc_NetShareEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,out,ref] srvsvc_NetShareInfoCtr *info_ctr,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *totalentries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /******************/
+ /* Function: 0x25 */
+ WERROR srvsvc_NetShareDelStart(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 share[],
+ [in] uint32 reserved,
+ [out,unique] policy_handle *hnd
+ );
+
+ /******************/
+ /* Function: 0x26 */
+ WERROR srvsvc_NetShareDelCommit(
+ [in, out,unique] policy_handle *hnd
+ );
+
+ /******************/
+ /* Function: 0x27 */
+ WERROR srvsvc_NetGetFileSecurity(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *share,
+ [in] [string,charset(UTF16)] uint16 file[],
+ [in] security_secinfo securityinformation,
+ [out,ref] sec_desc_buf **sd_buf
+ );
+
+ /******************/
+ /* Function: 0x28 */
+ WERROR srvsvc_NetSetFileSecurity(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *share,
+ [in] [string,charset(UTF16)] uint16 file[],
+ [in] security_secinfo securityinformation,
+ [in,ref] sec_desc_buf *sd_buf
+ );
+
+
+
+ typedef [switch_type(uint32)] union {
+ [case(0)] srvsvc_NetTransportInfo0 info0;
+ [case(1)] srvsvc_NetTransportInfo1 info1;
+ [case(2)] srvsvc_NetTransportInfo2 info2;
+ [case(3)] srvsvc_NetTransportInfo3 info3;
+ } srvsvc_NetTransportInfo;
+
+ /******************/
+ /* Function: 0x29 */
+ WERROR srvsvc_NetServerTransportAddEx(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in] uint32 level,
+ [in,switch_is(level)] srvsvc_NetTransportInfo info
+ );
+
+ /******************/
+ /* Function: 0x2a */
+ WERROR srvsvc_NetServerSetServiceBitsEx(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *emulated_server_unc,
+ [in,unique] [string,charset(UTF16)] uint16 *transport,
+ [in] uint32 servicebitsofinterest,
+ [in] uint32 servicebits,
+ [in] uint32 updateimmediately
+ );
+
+ /******************/
+ /* Function: 0x2b */
+ [todo] WERROR srvsvc_NETRDFSGETVERSION(
+ );
+
+ /******************/
+ /* Function: 0x2c */
+ [todo] WERROR srvsvc_NETRDFSCREATELOCALPARTITION(
+ );
+
+ /******************/
+ /* Function: 0x2d */
+ [todo] WERROR srvsvc_NETRDFSDELETELOCALPARTITION(
+ );
+
+ /******************/
+ /* Function: 0x2e */
+ [todo] WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE(
+ );
+
+ /******************/
+ /* Function: 0x2f */
+ [todo] WERROR srvsvc_NETRDFSSETSERVERINFO(
+ );
+
+ /******************/
+ /* Function: 0x30 */
+ [todo] WERROR srvsvc_NETRDFSCREATEEXITPOINT(
+ );
+
+ /******************/
+ /* Function: 0x31 */
+ [todo] WERROR srvsvc_NETRDFSDELETEEXITPOINT(
+ );
+
+ /******************/
+ /* Function: 0x32 */
+ [todo] WERROR srvsvc_NETRDFSMODIFYPREFIX(
+ );
+
+ /******************/
+ /* Function: 0x33 */
+ [todo] WERROR srvsvc_NETRDFSFIXLOCALVOLUME(
+ );
+
+ /******************/
+ /* Function: 0x34 */
+ [todo] WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO(
+ );
+
+ /******************/
+ /* Function: 0x35 */
+ [todo] WERROR srvsvc_NETRSERVERTRANSPORTDELEX(
+ );
+}
diff --git a/librpc/idl/svcctl.idl b/librpc/idl/svcctl.idl
new file mode 100644
index 0000000..a9dd3de
--- /dev/null
+++ b/librpc/idl/svcctl.idl
@@ -0,0 +1,673 @@
+#include "idl_types.h"
+
+/*
+ svcctl interface definitions
+*/
+
+import "misc.idl", "security.idl";
+[ uuid("367abb81-9844-35f1-ad32-98f038001003"),
+ version(2.0),
+ pointer_default(unique),
+ endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"),
+ helper("../librpc/ndr/ndr_svcctl.h"),
+ helpstring("Service Control")
+] interface svcctl
+{
+ const int MAX_SERVICE_NAME_LENGTH = 256;
+ const short SC_MAX_DEPEND_SIZE = 4 * 1024;
+ const short SC_MAX_NAME_LENGTH = MAX_SERVICE_NAME_LENGTH + 1;
+ const short SC_MAX_PATH_LENGTH = 32 * 1024;
+ const short SC_MAX_PWD_SIZE = 514;
+ const short SC_MAX_COMPUTER_NAME_LENGTH = 1024;
+ const short SC_MAX_ACCOUNT_NAME_LENGTH = 2 * 1024;
+ const short SC_MAX_COMMENT_LENGTH = 128;
+ const short SC_MAX_ARGUMENT_LENGTH = 1024;
+ const short SC_MAX_ARGUMENTS = 1024;
+
+ typedef struct {
+ uint32 is_locked;
+ [string,charset(UTF16)] uint16 *lock_owner;
+ uint32 lock_duration;
+ } SERVICE_LOCK_STATUS;
+
+ typedef [v1_enum] enum {
+ SVCCTL_STATE_UNKNOWN = 0x00000000, /* only used internally to smbd */
+ SVCCTL_STOPPED = 0x00000001,
+ SVCCTL_START_PENDING = 0x00000002,
+ SVCCTL_STOP_PENDING = 0x00000003,
+ SVCCTL_RUNNING = 0x00000004,
+ SVCCTL_CONTINUE_PENDING = 0x00000005,
+ SVCCTL_PAUSE_PENDING = 0x00000006,
+ SVCCTL_PAUSED = 0x00000007
+ } svcctl_ServiceStatus;
+
+ const int SVCCTL_ACCEPT_NONE = 0x00000000;
+
+ typedef [bitmap32bit] bitmap {
+ SVCCTL_ACCEPT_STOP = 0x00000001,
+ SVCCTL_ACCEPT_PAUSE_CONTINUE = 0x00000002,
+ SVCCTL_ACCEPT_SHUTDOWN = 0x00000004,
+ SVCCTL_ACCEPT_PARAMCHANGE = 0x00000008,
+ SVCCTL_ACCEPT_NETBINDCHANGE = 0x00000010,
+ SVCCTL_ACCEPT_HARDWAREPROFILECHANGE = 0x00000020,
+ SVCCTL_ACCEPT_POWEREVENT = 0x00000040
+ } svcctl_ControlsAccepted;
+
+ typedef struct {
+ uint32 type;
+ svcctl_ServiceStatus state;
+ svcctl_ControlsAccepted controls_accepted;
+ WERROR win32_exit_code;
+ uint32 service_exit_code;
+ uint32 check_point;
+ uint32 wait_hint;
+ } SERVICE_STATUS;
+
+ typedef [public] struct {
+ SERVICE_STATUS status;
+ uint32 process_id;
+ uint32 service_flags;
+ } SERVICE_STATUS_PROCESS;
+
+ typedef [public,gensize] struct {
+ [relative] nstring *service_name;
+ [relative] nstring *display_name;
+ SERVICE_STATUS status;
+ } ENUM_SERVICE_STATUSW;
+
+ typedef [public,gensize] struct {
+ [relative] astring *service_name;
+ [relative] astring *display_name;
+ SERVICE_STATUS status;
+ } ENUM_SERVICE_STATUSA;
+
+ 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_TYPE_INTERACTIVE_PROCESS = 0x100;
+
+ /*****************/
+ /* Function 0x00 */
+ WERROR svcctl_CloseServiceHandle(
+ [in,out,ref] policy_handle *handle
+ );
+
+ /*****************/
+ /* Function 0x01 */
+
+ /* Service Controls */
+
+ typedef [v1_enum] enum {
+ SVCCTL_CONTROL_STOP = 0x00000001,
+ SVCCTL_CONTROL_PAUSE = 0x00000002,
+ SVCCTL_CONTROL_CONTINUE = 0x00000003,
+ SVCCTL_CONTROL_INTERROGATE = 0x00000004,
+ SVCCTL_CONTROL_SHUTDOWN = 0x00000005
+ } SERVICE_CONTROL;
+
+ WERROR svcctl_ControlService(
+ [in,ref] policy_handle *handle,
+ [in] SERVICE_CONTROL control,
+ [out,ref] SERVICE_STATUS *service_status
+ );
+
+ /*****************/
+ /* Function 0x02 */
+ WERROR svcctl_DeleteService(
+ [in,ref] policy_handle *handle
+ );
+
+ /*****************/
+ /* Function 0x03 */
+
+ WERROR svcctl_LockServiceDatabase(
+ [in,ref] policy_handle *handle,
+ [out,ref] policy_handle *lock
+ );
+
+ /*****************/
+ /* Function 0x04 */
+ WERROR svcctl_QueryServiceObjectSecurity(
+ [in] policy_handle *handle,
+ [in] security_secinfo security_flags,
+ [out,ref,size_is(offered)] uint8 *buffer,
+ [in,range(0,0x40000)] uint32 offered,
+ [out,ref,range(0,0x40000)] uint32 *needed
+ );
+
+ /*****************/
+ /* Function 0x05 */
+ WERROR svcctl_SetServiceObjectSecurity(
+ [in] policy_handle *handle,
+ [in] security_secinfo security_flags,
+ [in,ref,size_is(offered)] uint8 *buffer,
+ [in] uint32 offered
+ );
+
+ /*****************/
+ /* Function 0x06 */
+ WERROR svcctl_QueryServiceStatus(
+ [in,ref] policy_handle *handle,
+ [out,ref] SERVICE_STATUS *service_status
+ );
+
+ /*****************/
+ /* Function 0x07 */
+ [todo] WERROR svcctl_SetServiceStatus(
+ );
+
+ /*****************/
+ /* Function 0x08 */
+ WERROR svcctl_UnlockServiceDatabase(
+ [in,out,ref] policy_handle *lock
+ );
+
+ /*****************/
+ /* Function 0x09 */
+ [todo] WERROR svcctl_NotifyBootConfigStatus(
+ );
+
+ /*****************/
+ /* Function 0x0a */
+ WERROR svcctl_SCSetServiceBitsW(
+ [in,ref] policy_handle *handle,
+ [in] uint32 bits,
+ [in] boolean32 bitson,
+ [in] boolean32 immediate
+ );
+
+ /*****************/
+ /* Function 0x0b */
+
+ typedef [v1_enum] enum {
+ SVCCTL_SVC_ERROR_IGNORE = 0x00000000,
+ SVCCTL_SVC_ERROR_NORMAL = 0x00000001,
+ SVCCTL_SVC_ERROR_CRITICAL = 0x00000002,
+ SVCCTL_SVC_ERROR_SEVERE = 0x00000003
+ } svcctl_ErrorControl;
+
+ typedef [v1_enum] enum {
+ SVCCTL_BOOT_START = 0x00000000,
+ SVCCTL_SYSTEM_START = 0x00000001,
+ SVCCTL_AUTO_START = 0x00000002,
+ SVCCTL_DEMAND_START = 0x00000003,
+ SVCCTL_DISABLED = 0x00000004
+ } svcctl_StartType;
+
+ [public] WERROR svcctl_ChangeServiceConfigW(
+ [in,ref] policy_handle *handle,
+ [in] uint32 type,
+ [in] svcctl_StartType start_type,
+ [in] svcctl_ErrorControl error_control,
+ [in,unique] [string,charset(UTF16)] uint16 *binary_path,
+ [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
+ [in,out,unique] uint32 *tag_id,
+ [in,unique,size_is(dwDependSize)] [string,charset(UTF16)] uint16 *dependencies,
+ [in,range(0, SC_MAX_DEPEND_SIZE)] uint32 dwDependSize,
+ [in,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] [string,charset(UTF16)] uint16 *service_start_name,
+ [in,unique,size_is(dwPwSize)] [string,charset(UTF16)] uint16 *password,
+ [in,range(0, SC_MAX_PWD_SIZE)] uint32 dwPwSize,
+ [in,unique,range(0, SC_MAX_NAME_LENGTH)] [string,charset(UTF16)] uint16 *display_name
+ );
+
+ /*****************/
+ /* Function 0x0c */
+ WERROR svcctl_CreateServiceW(
+ [in,ref] policy_handle *scmanager_handle,
+ [in] [string,charset(UTF16)] uint16 ServiceName[],
+ [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
+ [in] uint32 desired_access,
+ [in] uint32 type,
+ [in] svcctl_StartType start_type,
+ [in] svcctl_ErrorControl error_control,
+ [in] [string,charset(UTF16)] uint16 binary_path[],
+ [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
+ [in,out,unique] uint32 *TagId,
+ [in,unique,size_is(dependencies_size)] uint8 *dependencies,
+ [in] uint32 dependencies_size,
+ [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
+ [in,unique,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] svcctl_ServiceState state,
+ [out,ref,size_is(offered)] uint8 *service_status,
+ [in,range(0,0x40000)] uint32 offered,
+ [out,ref,range(0,0x40000)] uint32 *needed,
+ [out,ref,range(0,0x40000)] uint32 *services_returned
+ );
+
+ /*****************/
+ /* Function 0x0e */
+
+ typedef [v1_enum] enum {
+ SERVICE_STATE_ACTIVE = 0x00000001,
+ SERVICE_STATE_INACTIVE = 0x00000002,
+ SERVICE_STATE_ALL = ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE )
+ } svcctl_ServiceState;
+
+ WERROR svcctl_EnumServicesStatusW(
+ [in,ref] policy_handle *handle,
+ [in] uint32 type,
+ [in] svcctl_ServiceState state,
+ [out,ref,size_is(offered)] uint8 *service,
+ [in] [range(0,0x40000)] uint32 offered,
+ [out,ref] [range(0,0x40000)] uint32 *needed,
+ [out,ref] [range(0,0x40000)] uint32 *services_returned,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /*****************/
+ /* Function 0x0f */
+
+ /* Service Control Manager Bits */
+
+ typedef [bitmap32bit] bitmap {
+ SC_RIGHT_MGR_CONNECT = 0x0001,
+ SC_RIGHT_MGR_CREATE_SERVICE = 0x0002,
+ SC_RIGHT_MGR_ENUMERATE_SERVICE = 0x0004,
+ SC_RIGHT_MGR_LOCK = 0x0008,
+ SC_RIGHT_MGR_QUERY_LOCK_STATUS = 0x0010,
+ SC_RIGHT_MGR_MODIFY_BOOT_CONFIG = 0x0020
+ } svcctl_MgrAccessMask;
+
+ const int SC_MANAGER_READ_ACCESS =
+ (SEC_STD_READ_CONTROL |
+ SC_RIGHT_MGR_CONNECT |
+ SC_RIGHT_MGR_ENUMERATE_SERVICE |
+ SC_RIGHT_MGR_QUERY_LOCK_STATUS);
+
+ const int SC_MANAGER_EXECUTE_ACCESS = SC_MANAGER_READ_ACCESS;
+
+ const int SC_MANAGER_WRITE_ACCESS =
+ (SEC_STD_REQUIRED |
+ SC_MANAGER_READ_ACCESS |
+ SC_RIGHT_MGR_CREATE_SERVICE |
+ SC_RIGHT_MGR_LOCK |
+ SC_RIGHT_MGR_MODIFY_BOOT_CONFIG);
+
+ const int SC_MANAGER_ALL_ACCESS = SC_MANAGER_WRITE_ACCESS;
+
+ WERROR svcctl_OpenSCManagerW(
+ [in,unique] [string,charset(UTF16)] uint16 *MachineName,
+ [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
+ [in] svcctl_MgrAccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /*****************/
+ /* Function 0x10 */
+
+ /* Service Object Bits */
+
+ typedef [bitmap32bit] bitmap {
+ SC_RIGHT_SVC_QUERY_CONFIG = 0x0001,
+ SC_RIGHT_SVC_CHANGE_CONFIG = 0x0002,
+ SC_RIGHT_SVC_QUERY_STATUS = 0x0004,
+ SC_RIGHT_SVC_ENUMERATE_DEPENDENTS = 0x0008,
+ SC_RIGHT_SVC_START = 0x0010,
+ SC_RIGHT_SVC_STOP = 0x0020,
+ SC_RIGHT_SVC_PAUSE_CONTINUE = 0x0040,
+ SC_RIGHT_SVC_INTERROGATE = 0x0080,
+ SC_RIGHT_SVC_USER_DEFINED_CONTROL = 0x0100
+ } svcctl_ServiceAccessMask;
+
+ const int SERVICE_READ_ACCESS =
+ (SEC_STD_READ_CONTROL |
+ SC_RIGHT_SVC_ENUMERATE_DEPENDENTS |
+ SC_RIGHT_SVC_INTERROGATE |
+ SC_RIGHT_SVC_QUERY_CONFIG |
+ SC_RIGHT_SVC_QUERY_STATUS |
+ SC_RIGHT_SVC_USER_DEFINED_CONTROL);
+
+ const int SERVICE_EXECUTE_ACCESS =
+ (SERVICE_READ_ACCESS |
+ SC_RIGHT_SVC_START |
+ SC_RIGHT_SVC_STOP |
+ SC_RIGHT_SVC_PAUSE_CONTINUE);
+
+ const int SERVICE_WRITE_ACCESS =
+ (SEC_STD_REQUIRED |
+ SERVICE_READ_ACCESS |
+ SERVICE_EXECUTE_ACCESS |
+ SC_RIGHT_SVC_CHANGE_CONFIG);
+
+ const int SERVICE_ALL_ACCESS = SERVICE_WRITE_ACCESS;
+
+ WERROR svcctl_OpenServiceW(
+ [in,ref] policy_handle *scmanager_handle,
+ [in] [string,charset(UTF16)] uint16 ServiceName[],
+ [in] svcctl_ServiceAccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /*****************/
+ /* Function 0x11 */
+
+ typedef [public,gensize] struct {
+ uint32 service_type;
+ svcctl_StartType start_type;
+ svcctl_ErrorControl error_control;
+ [string,charset(UTF16)] [range(0,8192)] uint16 *executablepath;
+ [string,charset(UTF16)] [range(0,8192)] uint16 *loadordergroup;
+ uint32 tag_id;
+ [string,charset(UTF16)] [range(0,8192)] uint16 *dependencies;
+ [string,charset(UTF16)] [range(0,8192)] uint16 *startname;
+ [string,charset(UTF16)] [range(0,8192)] uint16 *displayname;
+ } QUERY_SERVICE_CONFIG;
+
+ WERROR svcctl_QueryServiceConfigW(
+ [in,ref] policy_handle *handle,
+ [out] QUERY_SERVICE_CONFIG *query,
+ [in] [range(0,8192)] uint32 offered,
+ [out,ref] [range(0,8192)] uint32 *needed
+ );
+
+ /*****************/
+ /* Function 0x12 */
+ WERROR svcctl_QueryServiceLockStatusW(
+ [in,ref] policy_handle *handle,
+ [in] uint32 offered,
+ [out,ref] SERVICE_LOCK_STATUS *lock_status,
+ [out,ref] uint32 *needed
+ );
+
+ /*****************/
+ /* Function 0x13 */
+
+ const int SC_MAX_ARGUMENT_LENGTH = 1024;
+ const int SC_MAX_ARGUMENTS = 1024;
+
+ typedef struct {
+ [string,charset(UTF16),range(0,SC_MAX_ARGUMENT_LENGTH)] uint16 *string;
+ } svcctl_ArgumentString;
+
+ WERROR svcctl_StartServiceW(
+ [in,ref] policy_handle *handle,
+ [in,range(0,SC_MAX_ARGUMENTS)] uint32 NumArgs,
+ [in,unique,size_is(NumArgs)] svcctl_ArgumentString *Arguments
+ );
+
+ /*****************/
+ /* Function 0x14 */
+ WERROR svcctl_GetServiceDisplayNameW(
+ [in,ref] policy_handle *handle,
+ [in,unique] [string,charset(UTF16)] uint16 *service_name,
+ [out,ref] [string,charset(UTF16)] uint16 **display_name,
+ [in,out,unique] uint32 *display_name_length
+ );
+
+ /*****************/
+ /* Function 0x15 */
+ WERROR svcctl_GetServiceKeyNameW(
+ [in,ref] policy_handle *handle,
+ [in,unique] [string,charset(UTF16)] uint16 *service_name,
+ [out,ref] [string,charset(UTF16)] uint16 **key_name,
+ [in,out,unique] 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] svcctl_StartType start_type,
+ [in] svcctl_ErrorControl error_control,
+ [in,unique] [string,charset(UTF16)] uint16 *binary_path,
+ [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
+ [out,ref] uint32 *tag_id,
+ [in,unique] [string,charset(UTF16)] uint16 *dependencies,
+ [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
+ [in,unique] [string,charset(UTF16)] uint16 *password,
+ [in,unique] [string,charset(UTF16)] uint16 *display_name
+ );
+
+ /*****************/
+ /* Function 0x18 */
+ WERROR svcctl_CreateServiceA(
+ [in,ref] policy_handle *handle,
+ [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
+ [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
+ [in] uint32 desired_access,
+ [in] uint32 type,
+ [in] svcctl_StartType start_type,
+ [in] svcctl_ErrorControl error_control,
+ [in,unique] [string,charset(UTF16)] uint16 *binary_path,
+ [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
+ [out,unique] uint32 *TagId,
+ [in,unique] [string,charset(UTF16)] uint16 *dependencies,
+ [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
+ [in,unique] [string,charset(UTF16)] uint16 *password
+ );
+
+ /*****************/
+ /* Function 0x19 */
+ WERROR svcctl_EnumDependentServicesA(
+ [in,ref] policy_handle *service,
+ [in] svcctl_ServiceState state,
+ [out,unique] ENUM_SERVICE_STATUSA *service_status,
+ [in] uint32 offered,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *services_returned
+ );
+
+ /*****************/
+ /* Function 0x1a */
+ WERROR svcctl_EnumServicesStatusA(
+ [in,ref] policy_handle *handle,
+ [in] uint32 type,
+ [in] svcctl_ServiceState state,
+ [in] uint32 offered,
+ [out,size_is(offered)] uint8 service[*],
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *services_returned,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /*****************/
+ /* Function 0x1b */
+ WERROR svcctl_OpenSCManagerA(
+ [in,unique] [string,charset(UTF16)] uint16 *MachineName,
+ [in,unique] [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,unique] [string,charset(UTF16)] uint16 *ServiceName,
+ [in] uint32 access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /*****************/
+ /* Function 0x1d */
+ WERROR svcctl_QueryServiceConfigA(
+ [in,ref] policy_handle *handle,
+ [out] uint8 query[offered], /*QUERYU_SERVICE_CONFIG */
+ [in] uint32 offered,
+ [out,ref] uint32 *needed
+ );
+
+ /*****************/
+ /* Function 0x1e */
+ WERROR svcctl_QueryServiceLockStatusA(
+ [in,ref] policy_handle *handle,
+ [in] uint32 offered,
+ [out,ref] SERVICE_LOCK_STATUS *lock_status,
+ [out,ref] uint32 *needed
+ );
+
+ /*****************/
+ /* Function 0x1f */
+ WERROR svcctl_StartServiceA(
+ [in,ref] policy_handle *handle,
+ [in] uint32 NumArgs,
+ [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
+ );
+
+ /*****************/
+ /* Function 0x20 */
+ WERROR svcctl_GetServiceDisplayNameA(
+ [in,ref] policy_handle *handle,
+ [in,unique] [string,charset(UTF16)] uint16 *service_name,
+ [out,ref] [string,charset(UTF16)] uint16 **display_name,
+ [in,out,unique] uint32 *display_name_length
+ );
+
+ /*****************/
+ /* Function 0x21 */
+ WERROR svcctl_GetServiceKeyNameA(
+ [in,ref] policy_handle *handle,
+ [in,unique] [string,charset(UTF16)] uint16 *service_name,
+ [out,ref] [string,charset(UTF16)] uint16 **key_name,
+ [in,out,unique] uint32 *display_name_length
+ );
+
+ /*****************/
+ /* Function 0x22 */
+ [todo] WERROR svcctl_GetCurrentGroupeStateW(
+ );
+
+ /*****************/
+ /* Function 0x23 */
+ [todo] WERROR svcctl_EnumServiceGroupW(
+ );
+
+ /*****************/
+ /* Function 0x24 */
+ WERROR svcctl_ChangeServiceConfig2A(
+ [in,ref] policy_handle *handle,
+ [in] uint32 info_level,
+ [in,unique] uint8 *info
+ );
+
+ /*****************/
+ /* Function 0x25 */
+ WERROR svcctl_ChangeServiceConfig2W(
+ [in,ref] policy_handle *handle,
+ [in] uint32 info_level,
+ [in,unique] uint8 *info
+ );
+
+ /*****************/
+ /* Function 0x26 */
+
+ typedef [v1_enum] enum {
+ SERVICE_CONFIG_DESCRIPTION = 0x00000001,
+ SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002
+ } svcctl_ConfigLevel;
+
+ typedef [gensize,public] struct {
+ [relative] nstring *description;
+ } SERVICE_DESCRIPTION;
+
+ typedef [v1_enum] enum {
+ SC_ACTION_NONE = 0,
+ SC_ACTION_RESTART = 1,
+ SC_ACTION_REBOOT = 2,
+ SC_ACTION_RUN_COMMAND = 3
+ } SC_ACTION_TYPE;
+
+ typedef struct {
+ SC_ACTION_TYPE type;
+ uint32 delay;
+ } SC_ACTION;
+
+ typedef [public,gensize] struct {
+ uint32 reset_period;
+ [relative] nstring *rebootmsg;
+ [relative] nstring *command;
+ [range(0,1024)] uint32 num_actions;
+ [relative] [size_is(num_actions)] SC_ACTION *actions;
+ } SERVICE_FAILURE_ACTIONS;
+
+ WERROR svcctl_QueryServiceConfig2A(
+ [in,ref] policy_handle *handle,
+ [in] svcctl_ConfigLevel info_level,
+ [out] uint8 buffer[offered],
+ [in] uint32 offered,
+ [out,ref] uint32 *needed
+ );
+
+ /*****************/
+ /* Function 0x27 */
+ WERROR svcctl_QueryServiceConfig2W(
+ [in,ref] policy_handle *handle,
+ [in] svcctl_ConfigLevel info_level,
+ [out,ref,size_is(offered)] uint8 *buffer,
+ [in] [range(0,8192)] uint32 offered,
+ [out,ref] [range(0,8192)] uint32 *needed
+ );
+
+ /*****************/
+ /* Function 0x28 */
+
+ typedef [v1_enum] enum {
+ SVC_STATUS_PROCESS_INFO = 0x00000000
+ } svcctl_StatusLevel;
+
+ WERROR svcctl_QueryServiceStatusEx(
+ [in,ref] policy_handle *handle,
+ [in] svcctl_StatusLevel info_level,
+ [out,ref,size_is(offered)] uint8 *buffer,
+ [in] [range(0,8192)] uint32 offered,
+ [out,ref] [range(0,8192)] uint32 *needed
+ );
+
+ /*****************/
+ /* Function 0x29 */
+ WERROR EnumServicesStatusExA(
+ [in,ref] policy_handle *scmanager,
+ [in] uint32 info_level,
+ [in] uint32 type,
+ [in] svcctl_ServiceState state,
+ [out] uint8 services[offered],
+ [in] uint32 offered,
+ [out,ref] uint32 *needed,
+ [out,ref] uint32 *service_returned,
+ [in,out,unique] uint32 *resume_handle,
+ [out,ref] [string,charset(UTF16)] uint16 **group_name
+ );
+
+ /*****************/
+ /* Function 0x2a */
+ WERROR EnumServicesStatusExW(
+ [in,ref] policy_handle *scmanager,
+ [in] uint32 info_level,
+ [in] uint32 type,
+ [in] svcctl_ServiceState state,
+ [out,ref,size_is(offered)] uint8 *services,
+ [in] [range(0,0x40000)] uint32 offered,
+ [out,ref] [range(0,0x40000)] uint32 *needed,
+ [out,ref] [range(0,0x40000)] uint32 *service_returned,
+ [in,out,unique] [range(0,0x40000)] uint32 *resume_handle,
+ [in,unique] [string,charset(UTF16)] uint16 *group_name
+ );
+
+ /*****************/
+ /* Function 0x2b */
+ [todo] WERROR svcctl_SCSendTSMessage(
+ );
+}
diff --git a/librpc/idl/trkwks.idl b/librpc/idl/trkwks.idl
new file mode 100644
index 0000000..7f11af1
--- /dev/null
+++ b/librpc/idl/trkwks.idl
@@ -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();
+}
diff --git a/librpc/idl/unixinfo.idl b/librpc/idl/unixinfo.idl
new file mode 100644
index 0000000..6929e86
--- /dev/null
+++ b/librpc/idl/unixinfo.idl
@@ -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;
+ [charset(UTF8),string] uint8 homedir[];
+ [charset(UTF8),string] uint8 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[*]
+ );
+}
diff --git a/librpc/idl/w32time.idl b/librpc/idl/w32time.idl
new file mode 100644
index 0000000..4839899
--- /dev/null
+++ b/librpc/idl/w32time.idl
@@ -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 */
+ [todo] WERROR w32time_SyncTime();
+
+ [todo] WERROR w32time_GetNetLogonServiceBits();
+ [todo] WERROR w32time_QueryProviderStatus();
+}
diff --git a/librpc/idl/winbind.idl b/librpc/idl/winbind.idl
new file mode 100644
index 0000000..2adfc85
--- /dev/null
+++ b/librpc/idl/winbind.idl
@@ -0,0 +1,316 @@
+#include "idl_types.h"
+import "lsa.idl", "netlogon.idl", "samr.idl", "misc.idl", "security.idl", "idmap.idl";
+
+[
+ uuid("bf09192c-ed60-4928-9dff-d0d7bcb03ed8"),
+ endpoint("ncalrpc:"),
+ pointer_default(unique),
+ version(1.0),
+ helpstring("winbind parent-child protocol"),
+ no_srv_register
+]
+interface winbind
+{
+ /* Private methods */
+
+ NTSTATUS wbint_Ping(
+ [in] uint32 in_data,
+ [out] uint32 *out_data
+ );
+
+ NTSTATUS wbint_LookupSid(
+ [in] dom_sid *sid,
+ [out] lsa_SidType *type,
+ [out,string,charset(UTF8)] char **domain,
+ [out,string,charset(UTF8)] char **name
+ );
+
+ NTSTATUS wbint_LookupSids(
+ [in] lsa_SidArray *sids,
+ [out,ref] lsa_RefDomainList *domains,
+ [out,ref] lsa_TransNameArray *names
+ );
+
+ NTSTATUS wbint_LookupName(
+ [in,string,charset(UTF8)] char *domain,
+ [in,string,charset(UTF8)] char *name,
+ [in] uint32 flags,
+ [out] lsa_SidType *type,
+ [out] dom_sid *sid
+ );
+
+ typedef struct {
+ id_type type_hint;
+ uint32 domain_index;
+ uint32 rid;
+ unixid xid;
+ } wbint_TransID;
+
+ typedef struct {
+ uint32 num_ids;
+ [size_is(num_ids)] wbint_TransID ids[];
+ } wbint_TransIDArray;
+
+ NTSTATUS wbint_Sids2UnixIDs(
+ [in] lsa_RefDomainList *domains,
+ [in,out] wbint_TransIDArray *ids
+ );
+
+ NTSTATUS wbint_UnixIDs2Sids(
+ [in,string,charset(UTF8)] char *domain_name,
+ [in] dom_sid domain_sid,
+ [in] uint32 num_ids,
+ [in,out] unixid xids[num_ids],
+ [out] dom_sid sids[num_ids]
+ );
+
+ NTSTATUS wbint_AllocateUid(
+ [out] hyper *uid
+ );
+
+ NTSTATUS wbint_AllocateGid(
+ [out] hyper *gid
+ );
+
+ typedef [public] struct {
+ [string,charset(UTF8)] char *domain_name;
+ [string,charset(UTF8)] char *acct_name;
+ [string,charset(UTF8)] char *full_name;
+ [string,charset(UTF8)] char *homedir;
+ [string,charset(UTF8)] char *shell;
+ hyper uid;
+ hyper primary_gid;
+ [string,charset(UTF8)] char *primary_group_name;
+ dom_sid user_sid;
+ dom_sid group_sid;
+ } wbint_userinfo;
+
+ NTSTATUS wbint_GetNssInfo(
+ [in,out] wbint_userinfo *info
+ );
+
+ typedef [public] struct {
+ uint32 num_sids;
+ [size_is(num_sids)] dom_sid sids[];
+ } wbint_SidArray;
+
+ typedef [public] struct {
+ uint32 num_rids;
+ [size_is(num_rids)] uint32 rids[];
+ } wbint_RidArray;
+
+ NTSTATUS wbint_LookupUserAliases(
+ [in] wbint_SidArray *sids,
+ [out] wbint_RidArray *rids
+ );
+
+ NTSTATUS wbint_LookupUserGroups(
+ [in] dom_sid *sid,
+ [out] wbint_SidArray *sids
+ );
+
+ NTSTATUS wbint_QuerySequenceNumber(
+ [out] uint32 *sequence
+ );
+
+ typedef [public] struct {
+ dom_sid sid;
+ lsa_SidType type;
+ [string,charset(UTF8)] char *name;
+ } wbint_Principal;
+
+ typedef [public] struct {
+ uint32 num_principals;
+ [size_is(num_principals)] wbint_Principal principals[];
+ } wbint_Principals;
+
+ NTSTATUS wbint_LookupGroupMembers(
+ [in] dom_sid *sid,
+ [in] lsa_SidType type,
+ [out] wbint_Principals *members
+ );
+
+ typedef [public] struct {
+ uint32 num_userinfos;
+ [size_is(num_userinfos)] wbint_userinfo userinfos[];
+ } wbint_userinfos;
+
+ NTSTATUS wbint_QueryGroupList(
+ [out] wbint_Principals *groups
+ );
+
+ NTSTATUS wbint_QueryUserRidList(
+ [out] wbint_RidArray *rids
+ );
+
+ NTSTATUS wbint_DsGetDcName(
+ [in,string,charset(UTF8)] char *domain_name,
+ [in,unique] GUID *domain_guid,
+ [in,string,unique,charset(UTF8)] char *site_name,
+ [in] uint32 flags,
+ [out] netr_DsRGetDCNameInfo **dc_info
+ );
+
+ NTSTATUS wbint_LookupRids(
+ [in] dom_sid *domain_sid,
+ [in] wbint_RidArray *rids,
+ [out,string,charset(UTF8)] char **domain_name,
+ [out] wbint_Principals *names
+ );
+
+ NTSTATUS wbint_CheckMachineAccount(
+ );
+
+ NTSTATUS wbint_ChangeMachineAccount(
+ );
+
+ NTSTATUS wbint_PingDc(
+ [out,string,charset(UTF8)] char **dcname
+ );
+
+ NTSTATUS wbint_ListTrustedDomains(
+ [in,string,charset(UTF8)] char *client_name,
+ [in] hyper client_pid,
+ [out,ref] netr_DomainTrustList *domains
+ );
+
+ typedef [public] struct {
+ uint16 level;
+ [switch_is(level)] netr_Validation *validation;
+ [string,charset(UTF8)] char *krb5ccname;
+ } wbint_Validation;
+
+ typedef [public] struct {
+ [string,charset(UTF8)] char *username;
+ [string,charset(UTF8),flag(NDR_SECRET)] char *password;
+ [string,charset(UTF8)] char *krb5_cc_type;
+ hyper uid;
+ } wbint_AuthUserInfo;
+
+ NTSTATUS wbint_PamAuth(
+ [in,string,charset(UTF8)] char *client_name,
+ [in] hyper client_pid,
+ [in] uint32 flags,
+ [in] wbint_AuthUserInfo *info,
+ [in] wbint_SidArray *require_membership_of_sid,
+ [out,ref] wbint_Validation *validation
+ );
+
+ typedef [public] struct {
+ uint16 level;
+ [switch_is(level)] netr_Validation *validation;
+ } wbint_PamAuthCrapValidation;
+
+ NTSTATUS wbint_PamAuthCrap(
+ [in,string,charset(UTF8)] char *client_name,
+ [in] hyper client_pid,
+ [in] uint32 flags,
+ [in, string,charset(UTF8)] char *user,
+ [in, string,charset(UTF8)] char *domain,
+ [in, string,charset(UTF8)] char *workstation,
+ [in,flag(NDR_SECRET)] DATA_BLOB lm_resp,
+ [in,flag(NDR_SECRET)] DATA_BLOB nt_resp,
+ [in,flag(NDR_SECRET)] DATA_BLOB chal,
+ [in] uint32 logon_parameters,
+ [in] wbint_SidArray *require_membership_of_sid,
+ [out,ref] uint8 *authoritative,
+ [out,ref] wbint_PamAuthCrapValidation *validation
+ );
+
+ NTSTATUS wbint_PamLogOff(
+ [in,string,charset(UTF8)] char *client_name,
+ [in] hyper client_pid,
+ [in] uint32 flags,
+ [in,string,charset(UTF8)] char *user,
+ [in,string,charset(UTF8)] char *krb5ccname,
+ [in] hyper uid
+ );
+
+ NTSTATUS wbint_PamAuthCrapChangePassword(
+ [in,string,charset(UTF8)] char *client_name,
+ [in] hyper client_pid,
+ [in,string,charset(UTF8)] char *user,
+ [in,string,charset(UTF8)] char *domain,
+ [in,flag(NDR_SECRET)] DATA_BLOB new_nt_pswd,
+ [in,flag(NDR_SECRET)] DATA_BLOB old_nt_hash_enc,
+ [in,flag(NDR_SECRET)] DATA_BLOB new_lm_pswd,
+ [in,flag(NDR_SECRET)] DATA_BLOB old_lm_hash_enc
+ );
+
+ NTSTATUS wbint_PamAuthChangePassword(
+ [in,string,charset(UTF8)] char *client_name,
+ [in] hyper client_pid,
+ [in] uint32 flags,
+ [in,string,charset(UTF8)] char *user,
+ [in,string,charset(UTF8),flag(NDR_SECRET)] char *old_password,
+ [in,string,charset(UTF8),flag(NDR_SECRET)] char *new_password,
+ [out,ref] samr_DomInfo1 **dominfo,
+ [out,ref] samPwdChangeReason *reject_reason
+ );
+
+ typedef [enum16bit] enum {
+ WB_DOMINFO_DOMAIN_UNKNOWN = 0x0000,
+ WB_DOMINFO_DOMAIN_NATIVE = 0x0001,
+ WB_DOMINFO_DOMAIN_AD = 0x0002,
+ WB_DOMINFO_DOMAIN_PRIMARY = 0x0004,
+ WB_DOMINFO_DOMAIN_OFFLINE = 0x0008
+ } DomainInfoFlags;
+
+ NTSTATUS wbint_InitConnection(
+ [in,string,charset(UTF8)] char *dcname,
+ [out,string,charset(UTF8)] char **name,
+ [out,string,charset(UTF8)] char **alt_name,
+ [out,ref] dom_sid *sid,
+ [out,ref] DomainInfoFlags *flags
+ );
+
+ /* Public methods available via IRPC */
+
+ typedef [switch_type(uint16)] union netr_LogonLevel netr_LogonLevel;
+ typedef [switch_type(uint16)] union netr_Validation netr_Validation;
+
+ /*
+ * 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
+ );
+
+ NTSTATUS winbind_DsrUpdateReadOnlyServerDnsRecords(
+ [in,unique] [string,charset(UTF16)] uint16 *site_name,
+ [in] uint32 dns_ttl,
+ [in,out,ref] NL_DNS_NAME_INFO_ARRAY *dns_names
+ );
+
+ /*
+ * do a netr_LogonControl2Ex() against the right DC
+ */
+ typedef [v1_enum] enum netr_LogonControlCode netr_LogonControlCode;
+ typedef [switch_type(netr_LogonControlCode)] union netr_CONTROL_DATA_INFORMATION netr_CONTROL_DATA_INFORMATION;
+ typedef [switch_type(uint32)] union netr_CONTROL_QUERY_INFORMATION netr_CONTROL_QUERY_INFORMATION;
+
+ WERROR winbind_LogonControl(
+ [in] netr_LogonControlCode function_code,
+ [in] uint32 level,
+ [in,ref][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION *data,
+ [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query
+ );
+
+ /*
+ * do a netr_GetForestTrustInformation() against the right DC
+ */
+ WERROR winbind_GetForestTrustInformation(
+ [in,unique] [string,charset(UTF16)] uint16 *trusted_domain_name,
+ [in] uint32 flags,
+ [out,ref] lsa_ForestTrustInformation **forest_trust_info
+ );
+
+ NTSTATUS winbind_SendToSam(
+ [in] netr_SendToSamBase message
+ );
+
+}
diff --git a/librpc/idl/windows_event_ids.idl b/librpc/idl/windows_event_ids.idl
new file mode 100644
index 0000000..240ad9e
--- /dev/null
+++ b/librpc/idl/windows_event_ids.idl
@@ -0,0 +1,42 @@
+/*
+ IDL constants for windows event codes.
+*/
+
+[
+ pointer_default(unique)
+]
+interface windows_events
+{
+
+ typedef [v1_enum,public] enum {
+ EVT_ID_NONE = 0,
+ EVT_ID_SUCCESSFUL_LOGON = 4624,
+ EVT_ID_UNSUCCESSFUL_LOGON = 4625,
+ EVT_ID_PASSWORD_CHANGE = 4723,
+ EVT_ID_PASSWORD_RESET = 4724,
+ EVT_ID_USER_ADDED_TO_GLOBAL_SEC_GROUP = 4728,
+ EVT_ID_USER_REMOVED_FROM_GLOBAL_SEC_GROUP = 4729,
+ EVT_ID_USER_ADDED_TO_LOCAL_SEC_GROUP = 4732,
+ EVT_ID_USER_REMOVED_FROM_LOCAL_SEC_GROUP = 4733,
+ EVT_ID_USER_ADDED_TO_LOCAL_GROUP = 4746,
+ EVT_ID_USER_REMOVED_FROM_LOCAL_GROUP = 4747,
+ EVT_ID_USER_ADDED_TO_GLOBAL_GROUP = 4751,
+ EVT_ID_USER_REMOVED_FROM_GLOBAL_GROUP = 4752,
+ EVT_ID_USER_ADDED_TO_UNIVERSAL_SEC_GROUP = 4756,
+ EVT_ID_USER_REMOVED_FROM_UNIVERSAL_SEC_GROUP = 4757,
+ EVT_ID_USER_ADDED_TO_UNIVERSAL_GROUP = 4761,
+ EVT_ID_USER_REMOVED_FROM_UNIVERSAL_GROUP = 4762
+ } event_id_type;
+
+ typedef [v1_enum,public] enum {
+ EVT_LOGON_INTERACTIVE = 2,
+ EVT_LOGON_NETWORK = 3,
+ EVT_LOGON_BATCH = 4,
+ EVT_LOGON_SERVICE = 5,
+ EVT_LOGON_UNLOCK = 7,
+ EVT_LOGON_NETWORK_CLEAR_TEXT = 8,
+ EVT_LOGON_NEW_CREDENTIALS = 9,
+ EVT_LOGON_REMOTE_INTERACTIVE = 10,
+ EVT_LOGON_CACHED_INTERACTIVE = 11
+ } event_logon_type;
+}
diff --git a/librpc/idl/winreg.cnf b/librpc/idl/winreg.cnf
new file mode 100644
index 0000000..e5a146c
--- /dev/null
+++ b/librpc/idl/winreg.cnf
@@ -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
diff --git a/librpc/idl/winreg.idl b/librpc/idl/winreg.idl
new file mode 100644
index 0000000..edbcc30
--- /dev/null
+++ b/librpc/idl/winreg.idl
@@ -0,0 +1,459 @@
+/*
+ winreg interface definition
+*/
+
+import "lsa.idl", "security.idl", "misc.idl";
+
+[
+ uuid("338cd001-2244-31f1-aaaa-900038001003"),
+ version(1.0),
+ endpoint("ncacn_np:[\\pipe\\winreg]","ncacn_ip_tcp:","ncalrpc:"),
+ pointer_default(unique),
+ helpstring("Remote Registry Service")
+] interface winreg
+{
+ typedef bitmap security_secinfo security_secinfo;
+
+ /*
+ * Access Bits for registry ACLS
+ */
+
+ typedef [public,bitmap32bit] bitmap {
+ KEY_QUERY_VALUE = 0x00001,
+ KEY_SET_VALUE = 0x00002,
+ KEY_CREATE_SUB_KEY = 0x00004,
+ KEY_ENUMERATE_SUB_KEYS = 0x00008,
+ KEY_NOTIFY = 0x00010,
+ KEY_CREATE_LINK = 0x00020,
+ KEY_WOW64_64KEY = 0x00100,
+ KEY_WOW64_32KEY = 0x00200
+ } winreg_AccessMask;
+
+ const int REG_KEY_READ = ( STANDARD_RIGHTS_READ_ACCESS |
+ KEY_QUERY_VALUE |
+ KEY_ENUMERATE_SUB_KEYS |
+ KEY_NOTIFY);
+
+ const int REG_KEY_EXECUTE = REG_KEY_READ;
+
+ const int REG_KEY_WRITE = ( STANDARD_RIGHTS_WRITE_ACCESS |
+ KEY_SET_VALUE |
+ KEY_CREATE_SUB_KEY);
+
+ const int REG_KEY_ALL = ( STANDARD_RIGHTS_REQUIRED_ACCESS |
+ REG_KEY_READ |
+ REG_KEY_WRITE |
+ KEY_CREATE_LINK);
+
+ typedef [public] 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,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x01 */
+ WERROR winreg_OpenHKCU(
+ [in,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x02 */
+ [public] WERROR winreg_OpenHKLM(
+ [in,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x03 */
+ WERROR winreg_OpenHKPD(
+ [in,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x04 */
+ WERROR winreg_OpenHKU(
+ [in,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x05 */
+ [public] 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;
+
+ const int REG_OPTION_NON_VOLATILE = 0x00000000;
+
+ typedef [bitmap32bit] bitmap {
+ REG_OPTION_VOLATILE = 0x00000001,
+ REG_OPTION_CREATE_LINK = 0x00000002,
+ REG_OPTION_BACKUP_RESTORE = 0x00000004,
+ REG_OPTION_OPEN_LINK = 0x00000008
+ } winreg_KeyOptions;
+
+ typedef [v1_enum] enum {
+ REG_ACTION_NONE = 0, /* used by caller */
+ REG_CREATED_NEW_KEY = 1,
+ REG_OPENED_EXISTING_KEY = 2
+ } winreg_CreateAction;
+
+ [public] WERROR winreg_CreateKey(
+ [in,ref] policy_handle *handle,
+ [in] winreg_String name,
+ [in] winreg_String keyclass,
+ [in] winreg_KeyOptions 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 */
+ [public] 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_null(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;
+
+ /******************/
+ /* Function: 0x09 */
+ [public] 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
+ );
+
+ 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_ValNameBuf;
+
+ /******************/
+ /* Function: 0x0a */
+
+ [public] WERROR winreg_EnumValue(
+ [in,ref] policy_handle *handle,
+ [in] uint32 enum_index,
+ [in,out,ref] winreg_ValNameBuf *name,
+ [in,out,unique] winreg_Type *type,
+ [in,out,unique,size_is(size ? *size : 0),length_is(length ? *length : 0),range(0,0x4000000)] uint8 *value,
+ [in,out,unique] uint32 *size,
+ [in,out,unique] uint32 *length
+ );
+
+ /******************/
+ /* Function: 0x0b */
+ [public] WERROR winreg_FlushKey(
+ [in,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x0c */
+ [public] 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,unique] winreg_String *keyname,
+ [in,unique] winreg_String *filename
+ );
+
+ /******************/
+ /* Function: 0x0e */
+ typedef [public,bitmap32bit] bitmap {
+ REG_NOTIFY_CHANGE_NAME = 0x00000001,
+ REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002,
+ REG_NOTIFY_CHANGE_LAST_SET = 0x00000004,
+ REG_NOTIFY_CHANGE_SECURITY = 0x00000008
+ } winreg_NotifyChangeType;
+
+ [public] WERROR winreg_NotifyChangeKeyValue(
+ [in,ref] policy_handle *handle,
+ [in] boolean8 watch_subtree,
+ [in] winreg_NotifyChangeType notify_filter,
+ [in] uint32 unknown,
+ [in] winreg_String string1,
+ [in] winreg_String string2,
+ [in] uint32 unknown2
+ );
+
+ /******************/
+ /* Function: 0x0f */
+ [public] WERROR winreg_OpenKey(
+ [in,ref] policy_handle *parent_handle,
+ [in] winreg_String keyname,
+ [in] winreg_KeyOptions options,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x10 */
+ [public] WERROR winreg_QueryInfoKey(
+ [in,ref] policy_handle *handle,
+ [in,out,ref] winreg_String *classname,
+ [out,ref] uint32 *num_subkeys,
+ [out,ref] uint32 *max_subkeylen,
+ [out,ref] uint32 *max_classlen,
+ [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 */
+ [public] WERROR winreg_QueryValue(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *value_name,
+ [in,out,unique] winreg_Type *type,
+ [in,out,unique,size_is(data_size ? *data_size : 0),length_is(data_length ? *data_length : 0),range(0,0x4000000)] uint8 *data,
+ [in,out,unique] uint32 *data_size,
+ [in,out,unique] uint32 *data_length
+ );
+
+ /******************/
+ /* Function: 0x12 */
+ WERROR winreg_ReplaceKey(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *subkey,
+ [in,ref] winreg_String *new_file,
+ [in,ref] winreg_String *old_file
+ );
+
+ /******************/
+ /* Function: 0x13 */
+
+ typedef [public,bitmap32bit] bitmap {
+ REG_WHOLE_HIVE_VOLATILE = 0x00000001,
+ REG_REFRESH_HIVE = 0x00000002,
+ REG_NO_LAZY_FLUSH = 0x00000004,
+ REG_FORCE_RESTORE = 0x00000008
+ } winreg_RestoreKeyFlags;
+
+ WERROR winreg_RestoreKey(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *filename,
+ [in] winreg_RestoreKeyFlags flags
+ );
+
+ /******************/
+ /* Function: 0x14 */
+
+ typedef struct {
+ uint32 data_size;
+ KeySecurityData sec_data;
+ uint8 inherit;
+ } KeySecurityAttribute;
+
+ WERROR winreg_SaveKey(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *filename,
+ [in,unique] KeySecurityAttribute *sec_attrib
+ );
+
+ /******************/
+ /* Function: 0x15 */
+ WERROR winreg_SetKeySecurity(
+ [in,ref] policy_handle *handle,
+ [in] security_secinfo sec_info,
+ [in,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(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *subkey
+ );
+
+ /******************/
+ /* Function: 0x18 */
+ WERROR winreg_InitiateSystemShutdown(
+ [in,unique] uint16 *hostname,
+ /*
+ * Note: lsa_String and winreg_String both result
+ * in WERR_INVALID_PARAMETER
+ */
+ [in,unique] lsa_StringLarge *message,
+ [in] uint32 timeout,
+ [in] uint8 force_apps,
+ [in] uint8 do_reboot
+ );
+
+ /******************/
+ /* Function: 0x19 */
+ WERROR winreg_AbortSystemShutdown(
+ [in,unique] uint16 *server
+ );
+
+ /******************/
+ /* Function: 0x1a */
+ [public] WERROR winreg_GetVersion(
+ [in,ref] policy_handle *handle,
+ [out,ref] uint32 *version
+ );
+
+ /******************/
+ /* Function: 0x1b */
+ WERROR winreg_OpenHKCC(
+ [in,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x1c */
+ WERROR winreg_OpenHKDD(
+ [in,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ typedef struct {
+ winreg_ValNameBuf *ve_valuename;
+ uint32 ve_valuelen;
+ uint32 ve_valueptr;
+ winreg_Type ve_type;
+ } QueryMultipleValue;
+
+ /******************/
+ /* Function: 0x1d */
+ [public] WERROR winreg_QueryMultipleValues(
+ [in,ref] policy_handle *key_handle,
+ [in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in,
+ [out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out,
+ [in] uint32 num_values,
+ [in,out,unique,size_is(*buffer_size),length_is(*buffer_size)] uint8 *buffer,
+ [in,out,ref] uint32 *buffer_size
+ );
+
+ /******************/
+ /* Function: 0x1e */
+ WERROR winreg_InitiateSystemShutdownEx(
+ [in,unique] uint16 *hostname,
+ /*
+ * Note: lsa_String and winreg_String both result
+ * in WERR_INVALID_PARAMETER
+ */
+ [in,unique] lsa_StringLarge *message,
+ [in] uint32 timeout,
+ [in] uint8 force_apps,
+ [in] uint8 do_reboot,
+ [in] uint32 reason
+ );
+
+ /******************/
+ /* Function: 0x1f */
+ WERROR winreg_SaveKeyEx(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *filename,
+ [in,unique] KeySecurityAttribute *sec_attrib,
+ [in] uint32 flags
+ );
+
+ /******************/
+ /* Function: 0x20 */
+ WERROR winreg_OpenHKPT(
+ [in,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x21 */
+ WERROR winreg_OpenHKPN(
+ [in,unique] uint16 *system_name,
+ [in] winreg_AccessMask access_mask,
+ [out,ref] policy_handle *handle
+ );
+
+ /******************/
+ /* Function: 0x22 */
+ [public] WERROR winreg_QueryMultipleValues2(
+ [in,ref] policy_handle *key_handle,
+ [in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in,
+ [out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out,
+ [in] uint32 num_values,
+ [in,out,unique,size_is(*offered),length_is(*offered)] uint8 *buffer,
+ [in,ref] uint32 *offered,
+ [out,ref] uint32 *needed
+ );
+
+ /******************/
+ /* Function: 0x23 */
+ WERROR winreg_DeleteKeyEx(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *key,
+ [in] winreg_AccessMask access_mask,
+ [in] uint32 reserved
+ );
+}
diff --git a/librpc/idl/winspool.idl b/librpc/idl/winspool.idl
new file mode 100644
index 0000000..5497a67
--- /dev/null
+++ b/librpc/idl/winspool.idl
@@ -0,0 +1,878 @@
+#include "idl_types.h"
+
+/*
+ * IRemoteWinspool interface definitions
+ *
+ * This IDL defines the "Print System Asynchronous Remote Protocol" MS-PAR
+ * interface.
+ *
+ * Currently only eight functions in this interface have no matching functions
+ * in the "spoolss" interface. All other functions have a 1-to-1 match but
+ * different opcodes than the spoolss interface.
+ *
+ * Every request on this interface requires a object uuid of
+ * "9940CA8E-512F-4C58-88A9-61098D6896BD" to be sent along with the DCE/RPC
+ * header.
+ *
+ * On Windows, this interface uses [ncacn_ip_tcp] transport and requires
+ * DCERPC_AUTH_TYPE_SPNEGO and at least DCERPC_AUTH_LEVEL_PACKET authentication.
+ *
+ *
+ */
+
+import "misc.idl", "security.idl", "winreg.idl", "spoolss.idl";
+
+[
+ uuid("76f03f96-cdfd-44fc-a22c-64950A001209"),
+ version(1.0),
+ endpoint("ncacn_ip_tcp:"),
+ pointer_default(unique),
+ helpstring("IRemoteWinspool SubSystem")
+]
+ interface iremotewinspool
+{
+#if 0
+ /*
+ * pidl does not yet have a real [context_handle] implementation, so we
+ * just use some defines here.
+ */
+
+ typedef [context_handle] void *GDI_HANDLE;
+ typedef [context_handle] void *PRINTER_HANDLE;
+ typedef [context_handle] void *RMTNTFY_HANDLE;
+#else
+#define GDI_HANDLE policy_handle
+#define PRINTER_HANDLE policy_handle
+#define RMTNTFY_HANDLE policy_handle
+#endif
+
+ const string IREMOTEWINSPOOL_OBJECT_GUID = "9940CA8E-512F-4C58-88A9-61098D6896BD";
+
+ /******************/
+ /* Function: 0x00 */
+
+ typedef struct {
+ spoolss_NotifyInfo *pInfo;
+ } winspool_NOTIFY_REPLY_CONTAINER;
+
+ typedef struct {
+ spoolss_NotifyOption *pOptions;
+ } winspool_NOTIFY_OPTIONS_CONTAINER;
+
+ [public] WERROR winspool_AsyncOpenPrinter(
+ [in,unique] [string,charset(UTF16)] uint16 *pPrinterName,
+ [out] PRINTER_HANDLE *pHandle,
+ [in,unique] [string,charset(UTF16)] uint16 *pDatatype,
+ [in] spoolss_DevmodeContainer *pDevModeContainer,
+ [in] uint32 AccessRequired,
+ [in] spoolss_UserLevelCtr *pClientInfo
+ );
+
+ /******************/
+ /* Function: 0x01 */
+
+ WERROR winspool_AsyncAddPrinter(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] spoolss_SetPrinterInfoCtr *pPrinterContainer,
+ [in] spoolss_DevmodeContainer *pDevModeContainer,
+ [in] sec_desc_buf *pSecurityContainer,
+ [in] spoolss_UserLevelCtr *pClientInfo,
+ [out] PRINTER_HANDLE *pHandle
+ );
+
+ /******************/
+ /* Function: 0x02 */
+
+ WERROR winspool_AsyncSetJob(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 JobId,
+ [in, unique] spoolss_JobInfoContainer *pJobContainer,
+ [in] uint32 Command
+ );
+
+ /******************/
+ /* Function: 0x03 */
+
+ WERROR winspool_AsyncGetJob(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 JobId,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pJob,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded
+ );
+
+ /******************/
+ /* Function: 0x04 */
+
+ WERROR winspool_AsyncEnumJobs(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 FirstJob,
+ [in] uint32 NoJobs,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pJob,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x05 */
+
+ WERROR winspool_AsyncAddJob(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pAddJob,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded
+ );
+
+ /******************/
+ /* Function: 0x06 */
+
+ WERROR winspool_AsyncScheduleJob(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 JobId
+ );
+
+ /******************/
+ /* Function: 0x07 */
+
+ WERROR winspool_AsyncDeletePrinter(
+ [in] PRINTER_HANDLE hPrinter
+ );
+
+ /******************/
+ /* Function: 0x08 */
+
+ [public] WERROR winspool_AsyncSetPrinter(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] spoolss_SetPrinterInfoCtr *pPrinterContainer,
+ [in] spoolss_DevmodeContainer *pDevModeContainer,
+ [in] sec_desc_buf *pSecurityContainer,
+ [in] uint32 Command
+ );
+
+ /******************/
+ /* Function: 0x09 */
+
+ [public] WERROR winspool_AsyncGetPrinter(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pPrinter,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded
+ );
+
+ /******************/
+ /* Function: 0x0a */
+
+ WERROR winspool_AsyncStartDocPrinter(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] spoolss_DocumentInfoCtr *pDocInfoContainer,
+ [out] uint32 *pJobId
+ );
+
+ /******************/
+ /* Function: 0x0b */
+
+ WERROR winspool_AsyncStartPagePrinter(
+ [in] PRINTER_HANDLE hPrinter
+ );
+
+ /******************/
+ /* Function: 0x0c */
+
+ WERROR winspool_AsyncWritePrinter(
+ [in] PRINTER_HANDLE hPrinter,
+ [in, size_is(cbBuf)] uint8 *pBuf,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcWritten
+ );
+
+ /******************/
+ /* Function: 0x0d */
+
+ WERROR winspool_AsyncEndPagePrinter(
+ [in] PRINTER_HANDLE hPrinter
+ );
+
+ /******************/
+ /* Function: 0x0e */
+
+ WERROR winspool_AsyncEndDocPrinter(
+ [in] PRINTER_HANDLE hPrinter
+ );
+
+ /******************/
+ /* Function: 0x0f */
+
+ WERROR winspool_AsyncAbortPrinter(
+ [in] PRINTER_HANDLE hPrinter
+ );
+
+ /******************/
+ /* Function: 0x10 */
+
+ [public] WERROR winspool_AsyncGetPrinterData(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pValueName,
+ [out] uint32 *pType,
+ [out, size_is(nSize)] uint8 *pData,
+ [in] uint32 nSize,
+ [out] uint32 *pcbNeeded
+ );
+
+ /******************/
+ /* Function: 0x11 */
+
+ WERROR winspool_AsyncGetPrinterDataEx(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pKeyName,
+ [in] [string,charset(UTF16)] uint16 *pValueName,
+ [out] uint32 *pType,
+ [out, size_is(nSize)] uint8 *pData,
+ [in] uint32 nSize,
+ [out] uint32 *pcbNeeded
+ );
+
+ /******************/
+ /* Function: 0x12 */
+
+ WERROR winspool_AsyncSetPrinterData(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pValueName,
+ [in] uint32 Type,
+ [in, size_is(cbData)] uint8 *pData,
+ [in] uint32 cbData
+ );
+
+ /******************/
+ /* Function: 0x13 */
+
+ WERROR winspool_AsyncSetPrinterDataEx(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pKeyName,
+ [in] [string,charset(UTF16)] uint16 *pValueName,
+ [in] uint32 Type,
+ [in, size_is(cbData)] uint8 *pData,
+ [in] uint32 cbData
+ );
+
+ /******************/
+ /* Function: 0x14 */
+
+ [public] WERROR winspool_AsyncClosePrinter(
+ [in, out] PRINTER_HANDLE *phPrinter
+ );
+
+ /******************/
+ /* Function: 0x15 */
+
+ WERROR winspool_AsyncAddForm(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] spoolss_AddFormInfoCtr *pFormInfoContainer
+ );
+
+ /******************/
+ /* Function: 0x16 */
+
+ WERROR winspool_AsyncDeleteForm(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pFormName
+ );
+
+ /******************/
+ /* Function: 0x17 */
+
+ WERROR winspool_AsyncGetForm(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pFormName,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pForm,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded
+ );
+
+ /******************/
+ /* Function: 0x18 */
+
+ WERROR winspool_AsyncSetForm(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pFormName,
+ [in] spoolss_AddFormInfoCtr *pFormInfoContainer
+ );
+
+ /******************/
+ /* Function: 0x19 */
+
+ [public] WERROR winspool_AsyncEnumForms(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pForm,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x1a */
+
+ [public] WERROR winspool_AsyncGetPrinterDriver(
+ [in] PRINTER_HANDLE hPrinter,
+ [in,unique] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pDriver,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [in] uint32 dwClientMajorVersion,
+ [in] uint32 dwClientMinorVersion,
+ [out] uint32 *pdwServerMaxVersion,
+ [out] uint32 *pdwServerMinVersion
+ );
+
+ /******************/
+ /* Function: 0x1b */
+
+ WERROR winspool_AsyncEnumPrinterData(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 dwIndex,
+ [out, size_is(cbValueName/2)] uint16 *pValueName,
+ [in] uint32 cbValueName,
+ [out] uint32 *pcbValueName,
+ [out] uint32 *pType,
+ [out, size_is(cbData)] uint8 *pData,
+ [in] uint32 cbData,
+ [out] uint32 *pcbData
+ );
+
+ /******************/
+ /* Function: 0x1c */
+
+ [public] WERROR winspool_AsyncEnumPrinterDataEx(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pKeyName,
+ [out, size_is(cbEnumValues)] uint8 *pEnumValues,
+ [in] uint32 cbEnumValues,
+ [out] uint32 *pcbEnumValues,
+ [out] uint32 *pnEnumValues
+ );
+
+ /******************/
+ /* Function: 0x1d */
+
+ [public] WERROR winspool_AsyncEnumPrinterKey(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pKeyName,
+ [out, size_is(cbSubkey/2)] uint16 *pSubkey,
+ [in] uint32 cbSubkey,
+ [out] uint32 *pcbSubkey
+ );
+
+ /******************/
+ /* Function: 0x1e */
+
+ WERROR winspool_AsyncDeletePrinterData(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pValueName
+ );
+
+ /******************/
+ /* Function: 0x1f */
+
+ WERROR winspool_AsyncDeletePrinterDataEx(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pKeyName,
+ [in] [string,charset(UTF16)] uint16 *pValueName
+ );
+
+ /******************/
+ /* Function: 0x20 */
+
+ WERROR winspool_AsyncDeletePrinterKey(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] [string,charset(UTF16)] uint16 *pKeyName
+ );
+
+ /******************/
+ /* Function: 0x21 */
+
+ WERROR winspool_AsyncXcvData(
+ [in] PRINTER_HANDLE hXcv,
+ [in] [string,charset(UTF16)] uint16 *pszDataName,
+ [in, size_is(cbInputData)] uint8 *pInputData,
+ [in] uint32 cbInputData,
+ [out, size_is(cbOutputData)] uint8 *pOutputData,
+ [in] uint32 cbOutputData,
+ [out] uint32 *pcbOutputNeeded,
+ [in, out] uint32 *pdwStatus
+ );
+
+ /******************/
+ /* Function: 0x22 */
+
+ WERROR winspool_AsyncSendRecvBidiData (
+ [in] PRINTER_HANDLE hPrinter,
+ [in,unique] [string,charset(UTF16)] uint16 *pAction,
+ [in] RPC_BIDI_REQUEST_CONTAINER* pReqData,
+ [out] RPC_BIDI_RESPONSE_CONTAINER** ppRespData
+ );
+
+ /******************/
+ /* Function: 0x23 */
+
+ WERROR winspool_AsyncCreatePrinterIC(
+ [in] PRINTER_HANDLE hPrinter,
+ [out] GDI_HANDLE *pHandle,
+ [in] spoolss_DevmodeContainer *pDevModeContainer
+ );
+
+ /******************/
+ /* Function: 0x24 */
+
+ WERROR winspool_AsyncPlayGdiScriptOnPrinterIC(
+ [in] GDI_HANDLE hPrinterIC,
+ [in, size_is(cIn)] uint8 *pIn,
+ [in] uint32 cIn,
+ [out, size_is(cOut)] uint8 *pOut,
+ [in] uint32 cOut,
+ [in] uint32 ul
+ );
+
+ /******************/
+ /* Function: 0x25 */
+
+ WERROR winspool_AsyncDeletePrinterIC(
+ [in, out] GDI_HANDLE *phPrinterIC
+ );
+
+ /******************/
+ /* Function: 0x26 */
+
+ WERROR winspool_AsyncEnumPrinters(
+ [in] uint32 Flags,
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pPrinterEnum,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x27 */
+
+ [public] WERROR winspool_AsyncAddPrinterDriver(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] spoolss_AddDriverInfoCtr *pDriverContainer,
+ [in] uint32 dwFileCopyFlags
+ );
+
+ /******************/
+ /* Function: 0x28 */
+
+ WERROR winspool_AsyncEnumPrinterDrivers(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in,unique] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pDrivers,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x29 */
+
+ [public] WERROR winspool_AsyncGetPrinterDriverDirectory(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in,unique] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pDriverDirectory,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded
+ );
+
+ /******************/
+ /* Function: 0x2a */
+
+ WERROR winspool_AsyncDeletePrinterDriver(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] [string,charset(UTF16)] uint16 *pDriverName
+ );
+
+ /******************/
+ /* Function: 0x2b */
+
+ WERROR winspool_AsyncDeletePrinterDriverEx(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] [string,charset(UTF16)] uint16 *pDriverName,
+ [in] uint32 dwDeleteFlag,
+ [in] uint32 dwVersionNum
+ );
+
+ /******************/
+ /* Function: 0x2c */
+
+ WERROR winspool_AsyncAddPrintProcessor(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] [string,charset(UTF16)] uint16 *pPathName,
+ [in] [string,charset(UTF16)] uint16 *pPrintProcessorName
+ );
+
+ /******************/
+ /* Function: 0x2d */
+
+ WERROR winspool_AsyncEnumPrintProcessors(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in,unique] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pPrintProcessorInfo,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x2e */
+
+ WERROR winspool_AsyncGetPrintProcessorDirectory(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in,unique] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pPrintProcessorDirectory,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded
+ );
+
+ /******************/
+ /* Function: 0x2f */
+
+ WERROR winspool_AsyncEnumPorts(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pPort,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x30 */
+
+ WERROR winspool_AsyncEnumMonitors(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pMonitor,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x31 */
+
+ WERROR winspool_AsyncAddPort(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in] spoolss_SetPortInfoContainer *pPortContainer,
+ [in] spoolss_PortVarContainer *pPortVarContainer,
+ [in] [string,charset(UTF16)] uint16 *pMonitorName
+ );
+
+ /******************/
+ /* Function: 0x32 */
+
+ WERROR winspool_AsyncSetPort(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in,unique] [string,charset(UTF16)] uint16 *pPortName,
+ [in] spoolss_SetPortInfoContainer *pPortContainer
+ );
+
+ /******************/
+ /* Function: 0x33 */
+
+ WERROR winspool_AsyncAddMonitor(
+ [in,unique] [string,charset(UTF16)] uint16 *Name,
+ [in] spoolss_MonitorContainer *pMonitorContainer
+ );
+
+ /******************/
+ /* Function: 0x34 */
+
+ WERROR winspool_AsyncDeleteMonitor(
+ [in,unique] [string,charset(UTF16)] uint16 *Name,
+ [in,unique] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] [string,charset(UTF16)] uint16 *pMonitorName
+ );
+
+ /******************/
+ /* Function: 0x35 */
+
+ WERROR winspool_AsyncDeletePrintProcessor(
+ [in,unique] [string,charset(UTF16)] uint16 *Name,
+ [in,unique] [string,charset(UTF16)] uint16 *pEnvironment,
+ [in] [string,charset(UTF16)] uint16 *pPrintProcessorName
+ );
+
+ /******************/
+ /* Function: 0x36 */
+
+ WERROR winspool_AsyncEnumPrintProcessorDatatypes(
+ [in,unique] [string,charset(UTF16)] uint16 *pName,
+ [in,unique] [string,charset(UTF16)] uint16 *pPrintProcessorName,
+ [in] uint32 Level,
+ [in, out, unique, size_is(cbBuf)] uint8 *pDatatypes,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x37 */
+
+ WERROR winspool_AsyncAddPerMachineConnection(
+ [in,unique] [string,charset(UTF16)] uint16 *pServer,
+ [in] [string,charset(UTF16)] uint16 *pPrinterName,
+ [in] [string,charset(UTF16)] uint16 *pPrintServer,
+ [in] [string,charset(UTF16)] uint16 *pProvider
+ );
+
+ /******************/
+ /* Function: 0x38 */
+
+ WERROR winspool_AsyncDeletePerMachineConnection(
+ [in,unique] [string,charset(UTF16)] uint16 *pServer,
+ [in] [string,charset(UTF16)] uint16 *pPrinterName
+ );
+
+ /******************/
+ /* Function: 0x39 */
+
+ WERROR winspool_AsyncEnumPerMachineConnections(
+ [in,unique] [string,charset(UTF16)] uint16 *pServer,
+ [in, out, unique, size_is(cbBuf)] uint8 *pPrinterEnum,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcbNeeded,
+ [out] uint32 *pcReturned
+ );
+
+ /******************/
+ /* Function: 0x3a */
+
+ typedef enum {
+ winspool_PropertyTypeString = 1,
+ winspool_PropertyTypeInt32 = 2,
+ winspool_PropertyTypeInt64 = 3,
+ winspool_PropertyTypeByte = 4,
+ winspool_PropertyTypeTime = 5,
+ winspool_PropertyTypeDevMode = 6,
+ winspool_PropertyTypeSD = 7,
+ winspool_PropertyTypeNotificationReply = 8,
+ winspool_PropertyTypeNotificationOptions = 9
+ } winspool_PrintPropertyType;
+
+ typedef [ms_union,switch_type(winspool_PrintPropertyType)] union {
+ [case(winspool_PropertyTypeString)] [string,charset(UTF16)] uint16 *propertyString;
+ [case(winspool_PropertyTypeInt32)] uint32 propertyInt32;
+ [case(winspool_PropertyTypeInt64)] hyper propertyInt64;
+ [case(winspool_PropertyTypeByte)] uint8 propertyByte;
+ [case(winspool_PropertyTypeTime)] spoolss_TimeCtr propertyTimeContainer;
+ [case(winspool_PropertyTypeDevMode)] spoolss_DevmodeContainer propertyDevModeContainer;
+ [case(winspool_PropertyTypeSD)] sec_desc_buf propertySDContainer;
+ [case(winspool_PropertyTypeNotificationReply)] winspool_NOTIFY_REPLY_CONTAINER propertyReplyContainer;
+ [case(winspool_PropertyTypeNotificationOptions)] winspool_NOTIFY_OPTIONS_CONTAINER propertyOptionsContainer;
+ } winspool_PrintPropertyValueUnion;
+
+ typedef struct {
+ winspool_PrintPropertyType PropertyType;
+ [switch_is(PropertyType)] winspool_PrintPropertyValueUnion value;
+ } winspool_PrintPropertyValue;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *propertyName;
+ winspool_PrintPropertyValue propertyValue;
+ } winspool_PrintNamedProperty;
+
+ typedef struct {
+ [range(0,50)] uint32 numberOfProperties;
+ [size_is(numberOfProperties), unique] winspool_PrintNamedProperty *propertiesCollection;
+ } winspool_PrintPropertiesCollection;
+
+ [public] HRESULT winspool_SyncRegisterForRemoteNotifications(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] winspool_PrintPropertiesCollection *pNotifyFilter,
+ [out] RMTNTFY_HANDLE *phRpcHandle
+ );
+
+ /******************/
+ /* Function: 0x3b */
+
+ HRESULT winspool_SyncUnRegisterForRemoteNotifications(
+ [in, out] RMTNTFY_HANDLE *phRpcHandle
+ );
+
+ /******************/
+ /* Function: 0x3c */
+
+ HRESULT winspool_SyncRefreshRemoteNotifications(
+ [in] RMTNTFY_HANDLE hRpcHandle,
+ [in] winspool_PrintPropertiesCollection *pNotifyFilter,
+ [out] winspool_PrintPropertiesCollection **ppNotifyData
+ );
+
+ /******************/
+ /* Function: 0x3d */
+
+ HRESULT winspool_AsyncGetRemoteNotifications(
+ [in] RMTNTFY_HANDLE hRpcHandle,
+ [out] winspool_PrintPropertiesCollection **ppNotifyData
+ );
+
+ /******************/
+ /* Function: 0x3e */
+
+ typedef [bitmap32bit] bitmap {
+ IPDFP_FLAG_NONE = 0x00000000,
+ IPDFP_COPY_ALL_FILES = 0x00000001
+ } winspool_InstallPrinterDriverFromPackageFlags;
+
+ HRESULT winspool_AsyncInstallPrinterDriverFromPackage(
+ [in,unique] [string,charset(UTF16)] uint16 *pszServer,
+ [in,unique] [string,charset(UTF16)] uint16 *pszInfPath,
+ [in] [string,charset(UTF16)] uint16 *pszDriverName,
+ [in] [string,charset(UTF16)] uint16 *pszEnvironment,
+ [in] winspool_InstallPrinterDriverFromPackageFlags dwFlags
+ );
+
+ /******************/
+ /* Function: 0x3f */
+
+ typedef [bitmap32bit] bitmap {
+ UPDP_FLAG_NONE = 0x00000000,
+ UPDP_UPLOAD_ALWAYS = 0x00000002,
+ UPDP_CHECK_DRIVERSTORE = 0x00000004
+ } winspool_UploadPrinterDriverPackageFlags;
+
+ HRESULT winspool_AsyncUploadPrinterDriverPackage(
+ [in,unique] [string,charset(UTF16)] uint16 *pszServer,
+ [in] [string,charset(UTF16)] uint16 *pszInfPath,
+ [in] [string,charset(UTF16)] uint16 *pszEnvironment,
+ [in] winspool_UploadPrinterDriverPackageFlags dwFlags,
+ [in, out, unique, size_is(*pcchDestInfPath)] [charset(UTF16)] uint16 *pszDestInfPath,
+ [in, out] uint32 *pcchDestInfPath
+ );
+
+ /******************/
+ /* Function: 0x40 */
+
+ [public] HRESULT winspool_AsyncGetCorePrinterDrivers(
+ [in,unique] [string,charset(UTF16)] uint16 *pszServer,
+ [in] [string,charset(UTF16)] uint16 *pszEnvironment,
+ [in] uint32 cchCoreDrivers,
+ [in, size_is(cchCoreDrivers)] uint16 *pszzCoreDriverDependencies,
+ [in] uint32 cCorePrinterDrivers,
+ [out, size_is(cCorePrinterDrivers)] spoolss_CorePrinterDriver *pCorePrinterDrivers
+ );
+
+ /******************/
+ /* Function: 0x41 */
+
+ HRESULT winspool_AsyncCorePrinterDriverInstalled(
+ [in,unique] [string,charset(UTF16)] uint16 *pszServer,
+ [in] [string,charset(UTF16)] uint16 *pszEnvironment,
+ [in] GUID CoreDriverGUID,
+ [in] NTTIME ftDriverDate,
+ [in] hyper dwlDriverVersion,
+ [out] int *pbDriverInstalled
+ );
+
+ /******************/
+ /* Function: 0x42 */
+
+ HRESULT winspool_AsyncGetPrinterDriverPackagePath(
+ [in,unique] [string,charset(UTF16)] uint16 *pszServer,
+ [in] [string,charset(UTF16)] uint16 *pszEnvironment,
+ [in,unique] [string,charset(UTF16)] uint16 *pszLanguage,
+ [in] [string,charset(UTF16)] uint16 *pszPackageID,
+ [in, out, unique, size_is(cchDriverPackageCab)] uint16 *pszDriverPackageCab,
+ [in] uint32 cchDriverPackageCab,
+ [out] uint32 *pcchRequiredSize
+ );
+
+ /******************/
+ /* Function: 0x43 */
+
+ HRESULT winspool_AsyncDeletePrinterDriverPackage(
+ [in,unique] [string,charset(UTF16)] uint16 *pszServer,
+ [in] [string,charset(UTF16)] uint16 *pszInfPath,
+ [in] [string,charset(UTF16)] uint16 *pszEnvironment
+ );
+
+ /******************/
+ /* Function: 0x44 */
+
+ WERROR winspool_AsyncReadPrinter(
+ [in] PRINTER_HANDLE hPrinter,
+ [out, size_is(cbBuf)] uint8 *pBuf,
+ [in] uint32 cbBuf,
+ [out] uint32 *pcNoBytesRead
+ );
+
+ /******************/
+ /* Function: 0x45 */
+
+ WERROR winspool_AsyncResetPrinter(
+ [in] PRINTER_HANDLE hPrinter,
+ [in,unique] [string,charset(UTF16)] uint16 *pDatatype,
+ [in] spoolss_DevmodeContainer *pDevModeContainer
+ );
+
+ /******************/
+ /* Function: 0x46 */
+
+ WERROR winspool_AsyncGetJobNamedPropertyValue(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 JobId,
+ [in] [string,charset(UTF16)] uint16 *pszName,
+ [out] spoolss_PrintPropertyValue *pValue
+ );
+
+ /******************/
+ /* Function: 0x47 */
+
+ [public] WERROR winspool_AsyncSetJobNamedProperty(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 JobId,
+ [in] spoolss_PrintNamedProperty *pProperty
+ );
+
+ /******************/
+ /* Function: 0x48 */
+
+ WERROR winspool_AsyncDeleteJobNamedProperty(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 JobId,
+ [in] [string,charset(UTF16)] uint16 *pszName
+ );
+
+ /******************/
+ /* Function: 0x49 */
+
+ WERROR winspool_AsyncEnumJobNamedProperties(
+ [in] PRINTER_HANDLE hPrinter,
+ [in] uint32 JobId,
+ [out] uint32 *pcProperties,
+ [out, size_is(,*pcProperties)] spoolss_PrintNamedProperty **ppProperties
+ );
+
+ /******************/
+ /* Function: 0x4a */
+
+ WERROR winspool_AsyncLogJobInfoForBranchOffice(
+ [in] PRINTER_HANDLE hPrinter,
+ [in,ref] spoolss_BranchOfficeJobDataContainer *pBranchOfficeJobDataContainer
+ );
+}
diff --git a/librpc/idl/winstation.idl b/librpc/idl/winstation.idl
new file mode 100644
index 0000000..fb02fa7
--- /dev/null
+++ b/librpc/idl/winstation.idl
@@ -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();
+}
diff --git a/librpc/idl/witness.idl b/librpc/idl/witness.idl
new file mode 100644
index 0000000..652c0e9
--- /dev/null
+++ b/librpc/idl/witness.idl
@@ -0,0 +1,152 @@
+#include "idl_types.h"
+
+import "misc.idl";
+
+[
+ uuid("ccd8c074-d0e5-4a40-92b4-d074faa6ba28"),
+ version(1.1),
+ pointer_default(unique),
+ helpstring("SMB Witness Service"),
+ helper("../librpc/ndr/ndr_witness.h"),
+ endpoint("ncacn_ip_tcp:")
+]
+interface witness
+{
+ typedef [v1_enum] enum {
+ WITNESS_V1 = 0x00010001,
+ WITNESS_V2 = 0x00020000,
+ WITNESS_UNSPECIFIED_VERSION = 0xFFFFFFFF
+ } witness_version;
+
+ /*****************/
+ /* Function 0x00 */
+
+ typedef [enum16bit] enum {
+ WITNESS_STATE_UNKNOWN = 0x00,
+ WITNESS_STATE_AVAILABLE = 0x01,
+ WITNESS_STATE_UNAVAILABLE = 0xff
+ } witness_interfaceInfo_state;
+
+ typedef [bitmap32bit] bitmap {
+ WITNESS_INFO_IPv4_VALID = 0x01,
+ WITNESS_INFO_IPv6_VALID = 0x02,
+ WITNESS_INFO_WITNESS_IF = 0x04
+ } witness_interfaceInfo_flags;
+
+ typedef struct {
+ [charset(UTF16),to_null] uint16 group_name[260];
+ witness_version version;
+ witness_interfaceInfo_state state;
+ [flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
+ [flag(NDR_BIG_ENDIAN)] ipv6address ipv6;
+ witness_interfaceInfo_flags flags;
+ } witness_interfaceInfo;
+
+ typedef struct {
+ uint32 num_interfaces;
+ [size_is(num_interfaces)] witness_interfaceInfo *interfaces;
+ } witness_interfaceList;
+
+ [public] WERROR witness_GetInterfaceList(
+ [out] witness_interfaceList **interface_list
+ );
+
+ /*****************/
+ /* Function 0x01 */
+
+ [public] WERROR witness_Register(
+ [out,ref] policy_handle *context_handle,
+ [in] witness_version version,
+ [in,unique,string,charset(UTF16)] uint16 *net_name,
+ [in,unique,string,charset(UTF16)] uint16 *ip_address,
+ [in,unique,string,charset(UTF16)] uint16 *client_computer_name
+ );
+
+ /*****************/
+ /* Function 0x02 */
+
+ [public] WERROR witness_UnRegister(
+ [in] policy_handle context_handle
+ );
+
+ /*****************/
+ /* Function 0x03 */
+
+ typedef [v1_enum,public] enum {
+ WITNESS_NOTIFY_RESOURCE_CHANGE = 1,
+ WITNESS_NOTIFY_CLIENT_MOVE = 2,
+ WITNESS_NOTIFY_SHARE_MOVE = 3,
+ WITNESS_NOTIFY_IP_CHANGE = 4
+ } witness_notifyResponse_type;
+
+ typedef [v1_enum] enum {
+ WITNESS_RESOURCE_STATE_UNKNOWN = 0x00,
+ WITNESS_RESOURCE_STATE_AVAILABLE = 0x01,
+ WITNESS_RESOURCE_STATE_UNAVAILABLE = 0xff
+ } witness_ResourceChange_type;
+
+ typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize,public] struct {
+ [value(ndr_size_witness_ResourceChange(r,ndr->flags))] uint32 length;
+ witness_ResourceChange_type type;
+ nstring name;
+ } witness_ResourceChange;
+
+ typedef [bitmap32bit] bitmap {
+ WITNESS_IPADDR_V4 = 0x01,
+ WITNESS_IPADDR_V6 = 0x02,
+ WITNESS_IPADDR_ONLINE = 0x08,
+ WITNESS_IPADDR_OFFLINE = 0x10
+ } witness_IPaddrInfo_flags;
+
+ typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
+ witness_IPaddrInfo_flags flags;
+ [flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
+ [flag(NDR_BIG_ENDIAN)] ipv6address ipv6;
+ } witness_IPaddrInfo;
+
+ typedef [public,flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize] struct {
+ [value(ndr_size_witness_IPaddrInfoList(r, ndr->flags))] uint32 length;
+ [value(0)] uint32 reserved;
+ uint32 num;
+ witness_IPaddrInfo addr[num];
+ } witness_IPaddrInfoList;
+
+ typedef [public,switch_type(witness_notifyResponse_type),nodiscriminant, flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] union {
+ [case(WITNESS_NOTIFY_RESOURCE_CHANGE)] witness_ResourceChange resource_change;
+ [case(WITNESS_NOTIFY_CLIENT_MOVE)] witness_IPaddrInfoList client_move;
+ [case(WITNESS_NOTIFY_SHARE_MOVE)] witness_IPaddrInfoList share_move;
+ [case(WITNESS_NOTIFY_IP_CHANGE)] witness_IPaddrInfoList ip_change;
+ [default,flag(NDR_REMAINING)] DATA_BLOB data;
+ } witness_notifyResponse_message;
+
+ typedef [flag(NDR_PAHEX),gensize,public,nopush,nopull] struct {
+ witness_notifyResponse_type type;
+ [value(ndr_size_witness_notifyResponse(r, ndr->flags)-20)] uint32 length;
+ uint32 num;
+ [subcontext(4), subcontext_size(length), flag(NDR_REMAINING), switch_is(type), size_is(num)] witness_notifyResponse_message *messages;
+ } witness_notifyResponse;
+
+ [public] WERROR witness_AsyncNotify(
+ [in] policy_handle context_handle,
+ [out] witness_notifyResponse **response
+ );
+
+ /*****************/
+ /* Function 0x04 */
+
+ typedef [bitmap32bit] bitmap {
+ WITNESS_REGISTER_NONE = 0x00,
+ WITNESS_REGISTER_IP_NOTIFICATION = 0x01
+ } witness_RegisterEx_flags;
+
+ WERROR witness_RegisterEx(
+ [out,ref] policy_handle *context_handle,
+ [in] witness_version version,
+ [in,unique,string,charset(UTF16)] uint16 *net_name,
+ [in,unique,string,charset(UTF16)] uint16 *share_name,
+ [in,unique,string,charset(UTF16)] uint16 *ip_address,
+ [in,unique,string,charset(UTF16)] uint16 *client_computer_name,
+ [in] witness_RegisterEx_flags flags,
+ [in] uint32 timeout
+ );
+}
diff --git a/librpc/idl/wkssvc.idl b/librpc/idl/wkssvc.idl
new file mode 100644
index 0000000..9e92ed7
--- /dev/null
+++ b/librpc/idl/wkssvc.idl
@@ -0,0 +1,796 @@
+#include "idl_types.h"
+
+/*
+ wkssvc interface definitions
+*/
+
+import "srvsvc.idl", "lsa.idl";
+
+[ uuid("6bffd098-a112-3610-9833-46c3f87e345a"),
+ version(1.0),
+ pointer_default(unique),
+ helpstring("Workstation Service"),
+ endpoint("ncacn_np:[\\pipe\\wkssvc]","ncacn_ip_tcp:","ncalrpc:")
+] interface wkssvc
+{
+ typedef [v1_enum] enum srvsvc_PlatformId 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;
+
+ /* FIXME: 302, 402 */
+
+ 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;
+
+ /* downlevel */
+ typedef struct {
+ uint32 print_buf_time;
+ } wkssvc_NetWkstaInfo1028;
+
+ /* downlevel */
+ typedef struct {
+ uint32 wrk_heuristics;
+ } wkssvc_NetWkstaInfo1032;
+
+ typedef struct {
+ uint32 max_threads;
+ } wkssvc_NetWkstaInfo1033;
+
+ typedef struct {
+ uint32 lock_quota;
+ } wkssvc_NetWkstaInfo1041;
+
+ typedef struct {
+ uint32 lock_increment;
+ } wkssvc_NetWkstaInfo1042;
+
+ typedef struct {
+ uint32 lock_maximum;
+ } wkssvc_NetWkstaInfo1043;
+
+ typedef struct {
+ uint32 pipe_increment;
+ } wkssvc_NetWkstaInfo1044;
+
+ typedef struct {
+ uint32 pipe_maximum;
+ } wkssvc_NetWkstaInfo1045;
+
+ typedef struct {
+ uint32 dormant_file_limit;
+ } wkssvc_NetWkstaInfo1046;
+
+ typedef struct {
+ uint32 cache_file_timeout;
+ } wkssvc_NetWkstaInfo1047;
+
+ typedef struct {
+ uint32 use_opportunistic_locking;
+ } wkssvc_NetWkstaInfo1048;
+
+ typedef struct {
+ uint32 use_unlock_behind;
+ } wkssvc_NetWkstaInfo1049;
+
+ typedef struct {
+ uint32 use_close_behind;
+ } wkssvc_NetWkstaInfo1050;
+
+ typedef struct {
+ uint32 buf_named_pipes;
+ } wkssvc_NetWkstaInfo1051;
+
+ typedef struct {
+ uint32 use_lock_read_unlock;
+ } wkssvc_NetWkstaInfo1052;
+
+ typedef struct {
+ uint32 utilize_nt_caching;
+ } wkssvc_NetWkstaInfo1053;
+
+ typedef struct {
+ uint32 use_raw_read;
+ } wkssvc_NetWkstaInfo1054;
+
+ typedef struct {
+ uint32 use_raw_write;
+ } wkssvc_NetWkstaInfo1055;
+
+ typedef struct {
+ uint32 use_write_raw_data;
+ } wkssvc_NetWkstaInfo1056;
+
+ typedef struct {
+ uint32 use_encryption;
+ } wkssvc_NetWkstaInfo1057;
+
+ typedef struct {
+ uint32 buf_files_deny_write;
+ } wkssvc_NetWkstaInfo1058;
+
+ typedef struct {
+ uint32 buf_read_only_files;
+ } wkssvc_NetWkstaInfo1059;
+
+ typedef struct {
+ uint32 force_core_create_mode;
+ } wkssvc_NetWkstaInfo1060;
+
+ typedef struct {
+ uint32 use_512_byte_max_transfer;
+ } wkssvc_NetWkstaInfo1061;
+
+ typedef struct {
+ uint32 read_ahead_throughput;
+ } wkssvc_NetWkstaInfo1062;
+
+ 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(1028)] wkssvc_NetWkstaInfo1028 *info1028;
+ [case(1032)] wkssvc_NetWkstaInfo1032 *info1032;
+ [case(1033)] wkssvc_NetWkstaInfo1033 *info1033;
+ [case(1041)] wkssvc_NetWkstaInfo1041 *info1041;
+ [case(1042)] wkssvc_NetWkstaInfo1042 *info1042;
+ [case(1043)] wkssvc_NetWkstaInfo1043 *info1043;
+ [case(1044)] wkssvc_NetWkstaInfo1044 *info1044;
+ [case(1045)] wkssvc_NetWkstaInfo1045 *info1045;
+ [case(1046)] wkssvc_NetWkstaInfo1046 *info1046;
+ [case(1047)] wkssvc_NetWkstaInfo1047 *info1047;
+ [case(1048)] wkssvc_NetWkstaInfo1048 *info1048;
+ [case(1049)] wkssvc_NetWkstaInfo1049 *info1049;
+ [case(1050)] wkssvc_NetWkstaInfo1050 *info1050;
+ [case(1051)] wkssvc_NetWkstaInfo1051 *info1051;
+ [case(1052)] wkssvc_NetWkstaInfo1052 *info1052;
+ [case(1053)] wkssvc_NetWkstaInfo1053 *info1053;
+ [case(1054)] wkssvc_NetWkstaInfo1054 *info1054;
+ [case(1055)] wkssvc_NetWkstaInfo1055 *info1055;
+ [case(1056)] wkssvc_NetWkstaInfo1056 *info1056;
+ [case(1057)] wkssvc_NetWkstaInfo1057 *info1057;
+ [case(1058)] wkssvc_NetWkstaInfo1058 *info1058;
+ [case(1059)] wkssvc_NetWkstaInfo1059 *info1059;
+ [case(1060)] wkssvc_NetWkstaInfo1060 *info1060;
+ [case(1061)] wkssvc_NetWkstaInfo1061 *info1061;
+ [case(1062)] wkssvc_NetWkstaInfo1062 *info1062;
+ [default] ;
+ } wkssvc_NetWkstaInfo;
+
+ WERROR wkssvc_NetWkstaGetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] uint32 level,
+ [out,switch_is(level),ref] wkssvc_NetWkstaInfo *info
+ );
+
+
+ /******************/
+ /* Function: 0x01 */
+ WERROR wkssvc_NetWkstaSetInfo(
+ [in,unique] [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_name;
+ } wkssvc_NetrWkstaUserInfo0;
+
+ typedef struct {
+ uint32 entries_read;
+ [size_is(entries_read)] wkssvc_NetrWkstaUserInfo0 *user0;
+ } wkssvc_NetWkstaEnumUsersCtr0;
+
+ 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;
+ } wkssvc_NetrWkstaUserInfo1;
+
+ typedef struct {
+ uint32 entries_read;
+ [size_is(entries_read)] wkssvc_NetrWkstaUserInfo1 *user1;
+ } wkssvc_NetWkstaEnumUsersCtr1;
+
+ typedef [switch_type(uint32)] union {
+ [case(0)] wkssvc_NetWkstaEnumUsersCtr0 *user0;
+ [case(1)] wkssvc_NetWkstaEnumUsersCtr1 *user1;
+ } wkssvc_NetWkstaEnumUsersCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] wkssvc_NetWkstaEnumUsersCtr ctr;
+ } wkssvc_NetWkstaEnumUsersInfo;
+
+ WERROR wkssvc_NetWkstaEnumUsers(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,out,ref] wkssvc_NetWkstaEnumUsersInfo *info,
+ [in] uint32 prefmaxlen,
+ [out,ref] uint32 *entries_read,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /*****************************/
+ /* Function 0x03 */
+ typedef struct {
+ [string,charset(UTF16)] uint16 *other_domains;
+ } wkssvc_NetrWkstaUserInfo1101;
+
+ typedef [switch_type(uint32)] union {
+ [case(0)] wkssvc_NetrWkstaUserInfo0 *info0;
+ [case(1)] wkssvc_NetrWkstaUserInfo1 *info1;
+ [case(1101)] wkssvc_NetrWkstaUserInfo1101 *info1101;
+ } wkssvc_NetrWkstaUserInfo;
+
+ WERROR wkssvc_NetrWkstaUserGetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *unknown,
+ [in] uint32 level,
+ [out,ref] [switch_is(level)] wkssvc_NetrWkstaUserInfo *info
+ );
+
+ /*****************************/
+ /* Function 0x04 */
+ WERROR wkssvc_NetrWkstaUserSetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *unknown,
+ [in] uint32 level,
+ [in,ref] [switch_is(level)] wkssvc_NetrWkstaUserInfo *info,
+ [in,out,unique] uint32 *parm_err
+ );
+
+ /*****************************/
+ /* 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;
+ } wkssvc_NetWkstaTransportCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] wkssvc_NetWkstaTransportCtr ctr;
+ } wkssvc_NetWkstaTransportInfo;
+
+ WERROR wkssvc_NetWkstaTransportEnum (
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,out,ref] wkssvc_NetWkstaTransportInfo *info,
+ [in] uint32 max_buffer,
+ [out,ref] uint32 *total_entries,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /*****************************/
+ /* Function 0x06 */
+ /* only supported on NT */
+ WERROR wkssvc_NetrWkstaTransportAdd(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] uint32 level, /* must be 0 */
+ [in,ref] wkssvc_NetWkstaTransportInfo0 *info0,
+ [in,out,unique] uint32 *parm_err
+ );
+
+ /*****************************/
+ /* Function 0x07 */
+ /* only supported on NT */
+ WERROR wkssvc_NetrWkstaTransportDel(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *transport_name,
+ [in] uint32 unknown3
+ );
+
+ /*****************************/
+ /* Function 0x08 */
+ typedef struct {
+ [string,charset(UTF16)] uint16 *unknown1;
+ [string,charset(UTF16)] uint16 *unknown2;
+ } wkssvc_NetrUseInfo3;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *local;
+ [string,charset(UTF16)] uint16 *remote;
+ [string,charset(UTF16)] uint16 *password;
+ uint32 status;
+ uint32 asg_type;
+ uint32 ref_count;
+ uint32 use_count;
+ [string,charset(UTF16)] uint16 *user_name;
+ [string,charset(UTF16)] uint16 *domain_name;
+ } wkssvc_NetrUseInfo2;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *local;
+ [string,charset(UTF16)] uint16 *remote;
+ [string,charset(UTF16)] uint16 *password;
+ uint32 status;
+ uint32 asg_type;
+ uint32 ref_count;
+ uint32 use_count;
+ } wkssvc_NetrUseInfo1;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *local;
+ [string,charset(UTF16)] uint16 *remote;
+ } wkssvc_NetrUseInfo0;
+
+ typedef [switch_type(uint32)] union {
+ [case(0)] wkssvc_NetrUseInfo0 *info0;
+ [case(1)] wkssvc_NetrUseInfo1 *info1;
+ [case(2)] wkssvc_NetrUseInfo2 *info2;
+ [case(3)] wkssvc_NetrUseInfo3 *info3;
+ } wkssvc_NetrUseGetInfoCtr;
+
+ WERROR wkssvc_NetrUseAdd(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] uint32 level,
+ [in,ref] [switch_is(level)] wkssvc_NetrUseGetInfoCtr *ctr,
+ [in,out,unique] uint32 *parm_err
+ );
+
+ /*****************************/
+ /* Function 0x09 */
+ WERROR wkssvc_NetrUseGetInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *use_name,
+ [in] uint32 level,
+ [out,ref] [switch_is(level)] wkssvc_NetrUseGetInfoCtr *ctr
+ );
+
+ /*****************************/
+ /* Function 0x0a */
+ WERROR wkssvc_NetrUseDel(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *use_name,
+ [in] uint32 force_cond
+ );
+
+ /*****************************/
+ /* Function 0x0b */
+ typedef struct {
+ uint32 count;
+ [size_is(count)] wkssvc_NetrUseInfo2 *array;
+ } wkssvc_NetrUseEnumCtr2;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] wkssvc_NetrUseInfo1 *array;
+ } wkssvc_NetrUseEnumCtr1;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] wkssvc_NetrUseInfo0 *array;
+ } wkssvc_NetrUseEnumCtr0;
+
+ typedef [switch_type(uint32)] union {
+ [case(0)] wkssvc_NetrUseEnumCtr0 *ctr0;
+ [case(1)] wkssvc_NetrUseEnumCtr1 *ctr1;
+ [case(2)] wkssvc_NetrUseEnumCtr2 *ctr2;
+ } wkssvc_NetrUseEnumCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] wkssvc_NetrUseEnumCtr ctr;
+ } wkssvc_NetrUseEnumInfo;
+
+ WERROR wkssvc_NetrUseEnum(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,out,ref] wkssvc_NetrUseEnumInfo *info,
+ [in] uint32 prefmaxlen,
+ [out,ref] uint32 *entries_read,
+ [in,out,unique] uint32 *resume_handle
+ );
+
+ /*****************************/
+ /* Function 0x0c */
+ WERROR wkssvc_NetrMessageBufferSend(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *message_name,
+ [in,unique] [string,charset(UTF16)] uint16 *message_sender_name,
+ [in,ref] [size_is(message_size)] uint8 *message_buffer,
+ [in] uint32 message_size
+ );
+
+ /*****************************/
+ /* Function 0x0d */
+ typedef struct {
+ hyper unknown1;
+ hyper unknown2;
+ hyper unknown3;
+ hyper unknown4;
+ hyper unknown5;
+ hyper unknown6;
+ hyper unknown7;
+ hyper unknown8;
+ hyper unknown9;
+ hyper unknown10;
+ hyper unknown11;
+ hyper unknown12;
+ hyper unknown13;
+ uint32 unknown14;
+ uint32 unknown15;
+ uint32 unknown16;
+ uint32 unknown17;
+ uint32 unknown18;
+ uint32 unknown19;
+ uint32 unknown20;
+ uint32 unknown21;
+ uint32 unknown22;
+ uint32 unknown23;
+ uint32 unknown24;
+ uint32 unknown25;
+ uint32 unknown26;
+ uint32 unknown27;
+ uint32 unknown28;
+ uint32 unknown29;
+ uint32 unknown30;
+ uint32 unknown31;
+ uint32 unknown32;
+ uint32 unknown33;
+ uint32 unknown34;
+ uint32 unknown35;
+ uint32 unknown36;
+ uint32 unknown37;
+ uint32 unknown38;
+ uint32 unknown39;
+ uint32 unknown40;
+ } wkssvc_NetrWorkstationStatistics;
+
+ WERROR wkssvc_NetrWorkstationStatisticsGet(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *unknown2,
+ [in] uint32 unknown3,
+ [in] uint32 unknown4,
+ [out,ref] wkssvc_NetrWorkstationStatistics **info
+ );
+
+ /*****************************/
+ /* Function 0x0e */
+ WERROR wkssvc_NetrLogonDomainNameAdd(
+ [in,ref] [string,charset(UTF16)] uint16 *domain_name
+ );
+
+ /*****************************/
+ /* Function 0x0f */
+ WERROR wkssvc_NetrLogonDomainNameDel(
+ [in,ref] [string,charset(UTF16)] uint16 *domain_name
+ );
+
+ /*****************************/
+ /* Function 0x10 */
+ WERROR wkssvc_NetrJoinDomain(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *domain_name,
+ [in,unique] [string,charset(UTF16)] uint16 *account_ou,
+ [in,unique] [string,charset(UTF16)] uint16 *Account,
+ [in,unique] [string,charset(UTF16)] uint16 *password,
+ [in] wkssvc_joinflags join_flags
+ );
+
+ /*****************************/
+ /* Function 0x11 */
+ WERROR wkssvc_NetrUnjoinDomain(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *Account,
+ [in,unique] [string,charset(UTF16)] uint16 *password,
+ [in] wkssvc_joinflags unjoin_flags
+ );
+
+ /*****************************/
+ /* Function 0x12 */
+ typedef [bitmap32bit] bitmap {
+ /* TRUE: create the account in the domain */
+ WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE = 0x00000002
+ } wkssvc_renameflags;
+
+ WERROR wkssvc_NetrRenameMachineInDomain(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *NewMachineName,
+ [in,unique] [string,charset(UTF16)] uint16 *Account,
+ [in,unique] [string,charset(UTF16)] uint16 *password,
+ [in] wkssvc_renameflags RenameOptions
+ );
+
+ /*****************************/
+ /* Function 0x13 */
+ typedef enum {
+ NetSetupUnknown = 0,
+ NetSetupMachine = 1,
+ NetSetupWorkgroup = 2,
+ NetSetupDomain = 3,
+ NetSetupNonExistentDomain = 4,
+ NetSetupDnsMachine = 5
+ } wkssvc_NetValidateNameType;
+
+ WERROR wkssvc_NetrValidateName(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *name,
+ [in,unique] [string,charset(UTF16)] uint16 *Account,
+ [in,unique] [string,charset(UTF16)] uint16 *Password,
+ [in] wkssvc_NetValidateNameType name_type
+ );
+
+ /*****************************/
+ /* Function 0x14 */
+ typedef enum {
+ NET_SETUP_UNKNOWN_STATUS = 0,
+ NET_SETUP_UNJOINED = 1,
+ NET_SETUP_WORKGROUP_NAME = 2,
+ NET_SETUP_DOMAIN_NAME = 3
+ } wkssvc_NetJoinStatus;
+
+ WERROR wkssvc_NetrGetJoinInformation(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,out,ref] [string,charset(UTF16)] uint16 **name_buffer,
+ [out,ref] wkssvc_NetJoinStatus *name_type
+ );
+
+ /*****************************/
+ /* Function 0x15 */
+ WERROR wkssvc_NetrGetJoinableOus(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *domain_name,
+ [in,unique] [string,charset(UTF16)] uint16 *Account,
+ [in,unique] [string,charset(UTF16)] uint16 *unknown,
+ [in,out,ref] uint32 *num_ous,
+ /*
+ * this is a [ref] pointer to a [unique] pointer to an
+ * array of [unique] pointers to a string array
+ */
+ [out,ref] [size_is(,*num_ous)] [string,charset(UTF16)] uint16 ***ous
+ );
+
+ typedef [flag(NDR_PAHEX)] struct {
+ uint8 data[524];
+ } wkssvc_PasswordBuffer;
+
+ typedef [bitmap32bit] bitmap {
+ WKSSVC_JOIN_FLAGS_IGNORE_UNSUPPORTED_FLAGS = 0x10000000,
+ WKSSVC_JOIN_FLAGS_JOIN_WITH_NEW_NAME = 0x00000400,
+ WKSSVC_JOIN_FLAGS_JOIN_DC_ACCOUNT = 0x00000200,
+ /* 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,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *domain_name,
+ [in,unique] [string,charset(UTF16)] uint16 *account_ou,
+ [in,unique] [string,charset(UTF16)] uint16 *admin_account,
+ [in,unique] 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
+ );
+
+ /*****************************/
+ /* 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(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *name,
+ [in,unique] [string,charset(UTF16)] uint16 *Account,
+ [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
+ [in] wkssvc_NetValidateNameType name_type
+ );
+
+ /*****************************/
+ /* Function 0x1a */
+ WERROR wkssvc_NetrGetJoinableOus2(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *domain_name,
+ [in,unique] [string,charset(UTF16)] uint16 *Account,
+ [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
+ [in,out,ref] uint32 *num_ous,
+ /*
+ * this is a [ref] pointer to a [unique] pointer to an
+ * array of [unique] pointers to a string array
+ */
+ [out,ref] [size_is(,*num_ous)] [string,charset(UTF16)] uint16 ***ous
+ );
+
+ /*****************************/
+ /* 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(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *primary_name,
+ [in,unique] [string,charset(UTF16)] uint16 *Account,
+ [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
+ [in] uint32 Reserved
+ );
+
+ /*****************************/
+ /* Function 0x1e */
+ typedef enum {
+ NetPrimaryComputerName = 0,
+ NetAlternateComputerNames = 1,
+ NetAllComputerNames = 2,
+ NetComputerNameTypeMax = 3
+ } wkssvc_ComputerNameType;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] lsa_String *computer_name;
+ } wkssvc_ComputerNamesCtr;
+
+ WERROR wkssvc_NetrEnumerateComputerNames(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in] wkssvc_ComputerNameType name_type,
+ [in] uint32 Reserved,
+ [out,ref] wkssvc_ComputerNamesCtr **ctr
+ );
+}
diff --git a/librpc/idl/wmi.idl b/librpc/idl/wmi.idl
new file mode 100644
index 0000000..43b7408
--- /dev/null
+++ b/librpc/idl/wmi.idl
@@ -0,0 +1,715 @@
+/*
+ * WMI IDL.
+ * See http://en.wikipedia.org/wiki/Windows_Management_Instrumentation for more information.
+ */
+#include "idl_types.h"
+
+import "dcom.idl";
+import "misc.idl";
+
+[
+ uuid("8BC3F05E-D86B-11d0-A075-00C04FB68820")
+] coclass WbemLevel1Login
+{
+ interface IWbemLevel1Login;
+
+};
+
+[
+ local,
+ object,
+ uuid("dc12a681-737f-11cf-884d-00aa004b2e24")
+]
+interface IWbemClassObject : IUnknown
+{
+
+ typedef [noprint] struct {
+ [value(0x72657355)] uint32 flags;
+ [string, charset(UTF16)] uint16 data[];
+ } BSTR;
+
+ WERROR Delete(
+ [in, string, charset(UTF16)] uint16 *wszName
+ );
+
+};
+
+[
+ uuid("9A653086-174F-11d2-B5F9-00104B703EFD")
+]
+coclass WbemClassObject
+{
+ interface IWbemClassObject;
+};
+
+
+[
+ 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] bitmap
+ {
+ WBEM_FLAG_RETURN_WBEM_COMPLETE = 0,
+ WBEM_FLAG_BIDIRECTIONAL = 0,
+ WBEM_FLAG_RETURN_IMMEDIATELY = 0x000010,
+ WBEM_FLAG_FORWARD_ONLY = 0x000020,
+ WBEM_FLAG_NO_ERROR_OBJECT = 0x000040,
+ WBEM_FLAG_SEND_STATUS = 0x000080,
+ WBEM_FLAG_ENSURE_LOCATABLE = 0x000100,
+ WBEM_FLAG_DIRECT_READ = 0x000200,
+ WBEM_FLAG_USE_AMENDED_QUALIFIERS = 0x020000,
+ WBEM_FLAG_STRONG_VALIDATION = 0x100000,
+ WBEM_FLAG_RETURN_ERROR_OBJECT = 0,
+ WBEM_FLAG_DONT_SEND_STATUS = 0,
+ WBEM_FLAG_SEND_ONLY_SELECTED = 0,
+
+ WBEM_RETURN_WHEN_COMPLETE = 0,
+ WBEM_RETURN_IMMEDIATELY = WBEM_FLAG_RETURN_IMMEDIATELY,
+
+ WBEM_MASK_RESERVED_FLAGS = 0x001F000
+ } WBEM_GENERIC_FLAG_TYPE;
+
+ typedef [public,v1_enum] enum tag_WBEM_TIMEOUT_TYPE
+ {
+ WBEM_NO_WAIT = 0,
+ WBEM_INFINITE = 0xFFFFFFFF
+ } WBEM_TIMEOUT_TYPE;
+
+ typedef [public,v1_enum] enum
+ {
+ CIM_EMPTY = 0,
+ CIM_SINT16 = 2,
+ CIM_SINT32 = 3,
+ CIM_REAL32 = 4,
+ CIM_REAL64 = 5,
+ CIM_STRING = 8,
+
+ CIM_BOOLEAN = 11,
+ CIM_OBJECT = 13,
+ CIM_SINT8 = 16,
+ CIM_UINT8 = 17,
+ CIM_UINT16 = 18,
+ CIM_UINT32 = 19,
+ CIM_SINT64 = 20,
+ CIM_UINT64 = 21,
+ CIM_DATETIME = 101,
+ CIM_REFERENCE = 102,
+ CIM_CHAR16 = 103,
+
+ CIM_FLAG_ARRAY = 0x2000,
+ CIM_ILLEGAL = 0x0fff,
+ CIM_TYPEMASK = 0x2fff,
+
+ 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
+
+ } CIMTYPE_ENUMERATION;
+
+ 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 struct
+ {
+ uint32 count;
+ [ref,charset(UTF16)] uint16 *item[count];
+ } CIMSTRINGS;
+
+ typedef [public,bitmap8bit] bitmap {
+ DEFAULT_FLAG_EMPTY = 1,
+ DEFAULT_FLAG_INHERITED = 2
+ } DEFAULT_FLAGS;
+
+ WERROR OpenNamespace(
+ [in] BSTR strNamespace,
+ [in] long lFlags,
+ [in] IWbemContext* pCtx,
+ [out, in, unique] IWbemServices** ppWorkingNamespace,
+ [out, in, unique] IWbemCallResult** ppResult
+ );
+
+ WERROR CancelAsyncCall(
+ [in] IWbemObjectSink* pSink
+ );
+
+ WERROR QueryObjectSink(
+ [in] long lFlags,
+ [out] IWbemObjectSink** ppResponseHandler
+ );
+
+ WERROR GetObject(
+ [in] BSTR strObjectPath,
+ [in] long lFlags,
+ [in] IWbemContext* pCtx,
+ [out, in, unique] IWbemClassObject** ppObject,
+ [out, in, 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, in, unique] 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, in, unique] 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, in, unique] 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, in, unique] 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 strSuperClass,
+ [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
+ );
+
+ 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] uint32 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] uint32 uCount,
+ [in] IWbemObjectSink* pSink
+ );
+
+ WERROR IEnumWbemClassObject_Clone(
+ [out] IEnumWbemClassObject** ppEnum
+ );
+
+ WERROR Skip(
+ [in] int32 lTimeout,
+ [in] uint32 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, charset(UTF16)] uint16* wszLocaleList,
+ [in] DWORD dwNumLocales,
+ [out] DWORD* reserved
+ );
+ WERROR RequestChallenge(
+ [in, unique, string, charset(UTF16)] uint16* wszNetworkResource,
+ [in, unique, string, charset(UTF16)] uint16* wszUser,
+ [out, size_is(16), length_is(16)] uint8 * Nonce
+ );
+ WERROR WBEMLogin(
+ [in, unique, string, charset(UTF16)] uint16* wszPreferredLocale,
+ [in, size_is(16), length_is(16), unique] uint8 * 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,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] IWbemClassObject** ppEnum);
+}
+
+[
+ object,
+ /* restricted, */
+ uuid("44aca675-e8fc-11d0-a07c-00c04fb68820")
+] interface IWbemCallResult : IUnknown
+{
+ WERROR GetResultObject(
+ [in] long lTimeout,
+ [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
+ );
+}
+
+
+[
+ object,
+ restricted,
+ uuid("7c857801-7381-11cf-884d-00aa004b2e24")
+]
+interface IWbemObjectSink : IUnknown
+{
+ WERROR SetStatus(
+ [in] long lFlags,
+ [in] WERROR hResult,
+ [in] BSTR strParam,
+ [in] IWbemClassObject* pObjParam
+ );
+ WERROR Indicate(
+ [in] long lObjectCount,
+ [in, size_is(lObjectCount)] IWbemClassObject** apObjArray
+ );
+};
+
diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build
new file mode 100644
index 0000000..1e53eec
--- /dev/null
+++ b/librpc/idl/wscript_build
@@ -0,0 +1,177 @@
+#!/usr/bin/env python
+
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''drsuapi.idl epmapper.idl
+ eventlog.idl
+ browser.idl dssetup.idl frsapi.idl
+ spoolss.idl
+ dnsserver.idl
+ samr.idl srvsvc.idl winreg.idl
+ mgmt.idl netlogon.idl
+ svcctl.idl wkssvc.idl eventlog6.idl backupkey.idl
+ witness.idl clusapi.idl
+ mdssvc.idl''',
+ options='--header --ndr-parser --server-compat --server --client --python',
+ output_dir='../gen_ndr')
+
+# The interface names here are not the same as the IDL name, so the
+# auto-genration of the fuzzer fails to link
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''echo.idl
+ fsrvp.idl
+ lsa.idl
+ winspool.idl''',
+ options='--header --ndr-parser --server-compat --server --client --python',
+ output_dir='../gen_ndr',
+ generate_fuzzers=False)
+
+# Services that we only have a client for
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''atsvc.idl''',
+ options='--header --ndr-parser --client --python',
+ output_dir='../gen_ndr')
+
+# Services that we only have a server in the source3 style
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''initshutdown.idl ntsvcs.idl''',
+ options='--header --ndr-parser --client --python --server-compat',
+ output_dir='../gen_ndr')
+
+# The interface names here are not the same as the IDL name, so the
+# auto-genration of the fuzzer fails to link
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''dfs.idl''',
+ options='--header --ndr-parser --client --python --server-compat',
+ output_dir='../gen_ndr',
+ generate_fuzzers=False)
+
+# Services that we only have a server in the source4 style.
+
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''unixinfo.idl''',
+ options='--header --ndr-parser --client --python --server',
+ output_dir='../gen_ndr')
+
+# DCOM stuff
+
+# The interface names here are not the same as the IDL name, so the
+# auto-genration of the fuzzer fails to link
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''oxidresolver.idl remact.idl''',
+ options='--header --ndr-parser --client',
+ output_dir='../gen_ndr',
+ generate_fuzzers=False)
+
+# The interface names here are not the same as the IDL name, so the
+# auto-genration of the fuzzer fails to link
+bld.SAMBA_PIDL_LIST('PIDL',
+ 'wmi.idl dcom.idl',
+ options='--header --ndr-parser --server --client --dcom-proxy --com-header',
+ output_dir='../gen_ndr',
+ generate_fuzzers=False)
+
+# DCE/RPC protocols which Samba does not implement a client or server
+# for. We don't generate a fuzzer for these as they are unreachable
+#
+# Do not include IDL with public structures in this list as we want to
+# fuzz those
+
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''
+ audiosrv.idl
+ dbgidl.idl
+ dsbackup.idl
+ efs.idl
+ frstrans.idl
+ frsrpc.idl
+ keysvc.idl
+ msgsvc.idl
+ orpc.idl
+ policyagent.idl
+ rot.idl
+ scerpc.idl
+ trkwks.idl
+ w32time.idl
+ winstation.idl
+ wzcsvc.idl
+ ''',
+ options='--header --ndr-parser',
+ generate_fuzzers=False,
+ output_dir='../gen_ndr')
+
+# Non-DCE/RPC protocols encoded in IDL for Samba or helper IDLs for
+# DCE/RPC protocols (eg defining constands or structures but not
+# functions)
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''
+ bkupblobs.idl
+ cab.idl
+ file_id.idl
+ fscc.idl
+ fsrvp_state.idl
+ named_pipe_auth.idl
+ negoex.idl
+ notify.idl
+ ntprinting.idl
+ ODJ.idl
+ printcap.idl
+ rap.idl
+ schannel.idl
+ smb2_lease_struct.idl
+ ''',
+ options='--header --ndr-parser',
+ output_dir='../gen_ndr')
+
+# The interface names here are not the same as the IDL name, so the
+# auto-genration of the fuzzer fails to link
+
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''
+ ioctl.idl
+ nfs4acl.idl
+ quota.idl
+ ''',
+ options='--header --ndr-parser',
+ output_dir='../gen_ndr',
+ generate_fuzzers=False)
+
+# Non-DCE/RPC protocls with Python bindings
+# (for structures or constants)
+
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''
+ auth.idl
+ dcerpc.idl
+ dfsblobs.idl
+ dns.idl
+ dnsp.idl
+ drsblobs.idl
+ idmap.idl
+ krb5pac.idl
+ krb5ccache.idl
+ messaging.idl
+ misc.idl
+ nbt.idl
+ ntlmssp.idl
+ preg.idl
+ security.idl
+ server_id.idl
+ smb_acl.idl
+ xattr.idl
+ ''',
+ options='--header --ndr-parser --python',
+ output_dir='../gen_ndr')
+
+bld.SAMBA_PIDL_LIST('PIDL',
+ '''
+ windows_event_ids.idl
+ ''',
+ options='--header --ndr-parser --python',
+ output_dir='../gen_ndr',
+ generate_tables=False)
+
+bld.SAMBA_PIDL_LIST('PIDL',
+ 'winbind.idl',
+ options='--header --ndr-parser --server-compat --client --python',
+ output_dir='../gen_ndr')
+
diff --git a/librpc/idl/wzcsvc.idl b/librpc/idl/wzcsvc.idl
new file mode 100644
index 0000000..b403c07
--- /dev/null
+++ b/librpc/idl/wzcsvc.idl
@@ -0,0 +1,31 @@
+/*
+ wireless configuration service
+*/
+
+[
+ uuid("621dff68-3c39-4c6c-aae3-e68e2c6503ad"),
+ 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();
+}
diff --git a/librpc/idl/xattr.idl b/librpc/idl/xattr.idl
new file mode 100644
index 0000000..82d4ec5
--- /dev/null
+++ b/librpc/idl/xattr.idl
@@ -0,0 +1,234 @@
+#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";
+
+[
+ version(0.0),
+ helper("../librpc/ndr/ndr_xattr.h"),
+ pyhelper("librpc/ndr/py_xattr.c"),
+ pointer_default(unique)
+]
+interface xattr
+{
+ const char *XATTR_DOSATTRIB_NAME = "user.DosAttrib";
+ const char *XATTR_DOSATTRIB_NAME_S3 = "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 */
+
+ /*
+ * the FFFF level is never really used,
+ * it's used to pass the information from
+ * the old hex string attrib information
+ * we have a handwritten parser which converts
+ * the hex string to the xattr_DosInfoFFFFCompat strucure
+ */
+
+ typedef struct {
+ uint32 attrib;
+ } xattr_DosInfoFFFFCompat;
+
+ typedef struct {
+ uint32 attrib;
+ uint32 ea_size;
+ udlong size;
+ udlong alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+ } xattr_DosInfo1;
+
+/*
+ We use xattrDosInfo1 again when we store values.
+ Because the sticky write time is now stored in the opendb
+ and xattr_DosInfo2Old is only present to parse existing
+ values from disk.
+
+ 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_DosInfo2Old;
+
+ typedef [bitmap32bit] bitmap {
+ XATTR_DOSINFO_ATTRIB = 0x00000001,
+ XATTR_DOSINFO_EA_SIZE = 0x00000002,
+ XATTR_DOSINFO_SIZE = 0x00000004,
+ XATTR_DOSINFO_ALLOC_SIZE = 0x00000008,
+ XATTR_DOSINFO_CREATE_TIME = 0x00000010,
+ XATTR_DOSINFO_CHANGE_TIME = 0x00000020,
+ XATTR_DOSINFO_ITIME = 0x00000040
+ } xattr_DosInfoValidFlags;
+
+ typedef struct {
+ xattr_DosInfoValidFlags valid_flags;
+ uint32 attrib;
+ uint32 ea_size;
+ udlong size;
+ udlong alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+ } xattr_DosInfo3;
+
+ typedef struct {
+ xattr_DosInfoValidFlags valid_flags;
+ uint32 attrib;
+ NTTIME itime;
+ NTTIME create_time;
+ } xattr_DosInfo4;
+
+ typedef struct {
+ xattr_DosInfoValidFlags valid_flags;
+ uint32 attrib;
+ NTTIME create_time;
+ } xattr_DosInfo5;
+
+ typedef [public,switch_type(uint16)] union {
+ [case(0xFFFF)] xattr_DosInfoFFFFCompat compatinfoFFFF;
+ [case(1)] xattr_DosInfo1 info1;
+ [case(2)] xattr_DosInfo2Old oldinfo2;
+ [case(3)] xattr_DosInfo3 info3;
+ [case(4)] xattr_DosInfo4 info4;
+ [case(5)] xattr_DosInfo5 info5;
+ } xattr_DosInfo;
+
+ typedef [public] struct {
+ uint16 version;
+ [switch_is(version)] xattr_DosInfo info;
+ } xattr_DosAttrib;
+
+ typedef [public,nopush,nopull,noprint] struct {
+ astring attrib_hex;
+ 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;
+
+ /* Slightly different version, used by the vfs_xattr_tdb module */
+ typedef [public] struct {
+ uint32 num_eas;
+ xattr_EA eas[num_eas];
+ } tdb_xattrs;
+
+ /* 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;
+ const int XATTR_MAX_STREAM_SIZE_TDB = 0x100000;
+
+ 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
+
+ stored in "security.NTACL"
+
+ Version 1. raw SD stored as Samba4 does it.
+ Version 2. raw SD + last changed hash so we
+ can discard if this doesn't match the underlying ACL hash.
+ */
+
+ const char *XATTR_NTACL_NAME = "security.NTACL";
+
+ const int XATTR_SD_HASH_SIZE = 64;
+ const int XATTR_SD_HASH_TYPE_NONE = 0x0;
+ const int XATTR_SD_HASH_TYPE_SHA256 = 0x1;
+
+ typedef [public] struct {
+ security_descriptor *sd;
+ uint8 hash[16];
+ } security_descriptor_hash_v2; /* Hash never used in this version. */
+
+ typedef [public] struct {
+ security_descriptor *sd;
+ uint16 hash_type;
+ uint8 hash[64]; /* 64 bytes hash. */
+ } security_descriptor_hash_v3;
+
+ typedef [public] struct {
+ security_descriptor *sd;
+ uint16 hash_type;
+ uint8 hash[64]; /* 64 bytes hash. */
+ utf8string description; /* description of what created
+ * this hash (to allow
+ * forensics later, if we have
+ * a bug in one codepath */
+ NTTIME time;
+ uint8 sys_acl_hash[64]; /* 64 bytes hash. */
+ } security_descriptor_hash_v4;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] security_descriptor *sd;
+ [case(2)] security_descriptor_hash_v2 *sd_hs2;
+ [case(3)] security_descriptor_hash_v3 *sd_hs3;
+ [case(4)] security_descriptor_hash_v4 *sd_hs4;
+ } xattr_NTACL_Info;
+
+ typedef [public] struct {
+ uint16 version;
+ [switch_is(version)] xattr_NTACL_Info info;
+ } xattr_NTACL;
+
+ /*
+ * A wrapper of the common information required to be in the
+ * hash of the ACL, for the acl_xattr and acl_tdb modules.
+ */
+ [public] typedef struct {
+ DATA_BLOB acl_as_blob;
+ uid_t owner;
+ gid_t group;
+ mode_t mode;
+ } xattr_sys_acl_hash_wrapper;
+
+}
diff --git a/librpc/ndr.pc.in b/librpc/ndr.pc.in
new file mode 100644
index 0000000..6828ac0
--- /dev/null
+++ b/librpc/ndr.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: ndr
+Description: Network Data Representation Core Library
+Requires: samba-util talloc
+Version: @PACKAGE_VERSION@
+Libs: @LIB_RPATH@ -L${libdir} -lndr
+Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
new file mode 100644
index 0000000..98f8ff8
--- /dev/null
+++ b/librpc/ndr/libndr.h
@@ -0,0 +1,857 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* This is a public header file that is installed as part of Samba.
+ * If you remove any functions or change their signature, update
+ * the so version number. */
+
+#ifndef __LIBNDR_H__
+#define __LIBNDR_H__
+
+#include <talloc.h>
+#include "../lib/util/discard.h" /* for discard_const */
+#include "../lib/util/data_blob.h"
+#include "../lib/util/time.h"
+#include "../lib/util/charset/charset.h"
+
+/*
+ this provides definitions for the libcli/rpc/ MSRPC library
+*/
+
+
+/*
+ We store the token mapping in an array that is resized as necessary.
+*/
+struct ndr_token;
+
+struct ndr_token_list {
+ struct ndr_token *tokens;
+ uint32_t count;
+};
+
+struct ndr_compression_state;
+
+/* 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_highest_offset;
+ uint32_t relative_base_offset;
+ uint32_t relative_rap_convert;
+ 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;
+
+ struct ndr_compression_state *cstate;
+
+ TALLOC_CTX *current_mem_ctx;
+
+ /* this is used to ensure we generate unique reference IDs
+ between request and reply */
+ uint32_t ptr_count;
+ uint32_t recursion_depth;
+ /*
+ * The global maximum depth for recursion. When set it overrides the
+ * value supplied by the max_recursion idl attribute. This is needed
+ * for fuzzing as ASAN uses a low threshold for stack depth to check
+ * for stack overflow.
+ */
+ uint32_t global_max_recursion;
+};
+
+/* 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;
+ bool fixed_buf_size;
+
+ uint32_t relative_base_offset;
+ uint32_t relative_end_offset;
+ struct ndr_token_list relative_base_list;
+
+ struct ndr_token_list switch_list;
+ struct ndr_token_list relative_list;
+ struct ndr_token_list relative_begin_list;
+ struct ndr_token_list nbt_string_list;
+ struct ndr_token_list dns_string_list;
+ struct ndr_token_list full_ptr_list;
+
+ struct ndr_compression_state *cstate;
+
+ /* this is used to ensure we generate unique reference IDs */
+ uint32_t ptr_count;
+};
+
+/* 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;
+ bool no_newline;
+ bool print_secrets;
+};
+
+#define LIBNDR_FLAG_BIGENDIAN (1U<<0)
+#define LIBNDR_FLAG_NOALIGN (1U<<1)
+
+#define LIBNDR_FLAG_STR_ASCII (1U<<2)
+#define LIBNDR_FLAG_STR_LEN4 (1U<<3)
+#define LIBNDR_FLAG_STR_SIZE4 (1U<<4)
+#define LIBNDR_FLAG_STR_NOTERM (1U<<5)
+#define LIBNDR_FLAG_STR_NULLTERM (1U<<6)
+#define LIBNDR_FLAG_STR_SIZE2 (1U<<7)
+#define LIBNDR_FLAG_STR_BYTESIZE (1U<<8)
+#define LIBNDR_FLAG_STR_CONFORMANT (1U<<10)
+#define LIBNDR_FLAG_STR_CHARLEN (1U<<11)
+#define LIBNDR_FLAG_STR_UTF8 (1U<<12)
+#define LIBNDR_FLAG_STR_RAW8 (1U<<13)
+#define LIBNDR_STRING_FLAGS (0U | \
+ LIBNDR_FLAG_STR_ASCII | \
+ LIBNDR_FLAG_STR_LEN4 | \
+ LIBNDR_FLAG_STR_SIZE4 | \
+ LIBNDR_FLAG_STR_NOTERM | \
+ LIBNDR_FLAG_STR_NULLTERM | \
+ LIBNDR_FLAG_STR_SIZE2 | \
+ LIBNDR_FLAG_STR_BYTESIZE | \
+ LIBNDR_FLAG_STR_CONFORMANT | \
+ LIBNDR_FLAG_STR_CHARLEN | \
+ LIBNDR_FLAG_STR_UTF8 | \
+ LIBNDR_FLAG_STR_RAW8 | \
+ 0)
+
+/*
+ * Mark an element as SECRET, it won't be printed by
+ * via ndr_print* unless NDR_PRINT_SECRETS is specified.
+ */
+#define LIBNDR_FLAG_IS_SECRET (1U<<14)
+
+/* Disable string token compression */
+#define LIBNDR_FLAG_NO_COMPRESSION (1U<<15)
+
+/*
+ * don't debug NDR_ERR_BUFSIZE failures,
+ * as the available buffer might be incomplete.
+ *
+ * return NDR_ERR_INCOMPLETE_BUFFER instead.
+ */
+#define LIBNDR_FLAG_INCOMPLETE_BUFFER (1U<<16)
+
+/*
+ * This lets ndr_pull_subcontext_end() return
+ * NDR_ERR_UNREAD_BYTES.
+ */
+#define LIBNDR_FLAG_SUBCONTEXT_NO_UNREAD_BYTES (1U<<17)
+
+/* set if relative pointers should *not* be marshalled in reverse order */
+#define LIBNDR_FLAG_NO_RELATIVE_REVERSE (1U<<18)
+
+/* set if relative pointers are marshalled in reverse order */
+#define LIBNDR_FLAG_RELATIVE_REVERSE (1U<<19)
+
+#define LIBNDR_FLAG_REF_ALLOC (1U<<20)
+#define LIBNDR_FLAG_REMAINING (1U<<21)
+#define LIBNDR_FLAG_ALIGN2 (1U<<22)
+#define LIBNDR_FLAG_ALIGN4 (1U<<23)
+#define LIBNDR_FLAG_ALIGN8 (1U<<24)
+
+#define LIBNDR_ALIGN_FLAGS ( 0 | \
+ LIBNDR_FLAG_NOALIGN | \
+ LIBNDR_FLAG_REMAINING | \
+ LIBNDR_FLAG_ALIGN2 | \
+ LIBNDR_FLAG_ALIGN4 | \
+ LIBNDR_FLAG_ALIGN8 | \
+ 0)
+
+#define LIBNDR_PRINT_ARRAY_HEX (1U<<25)
+#define LIBNDR_PRINT_SET_VALUES (1U<<26)
+
+/* used to force a section of IDL to be little-endian */
+#define LIBNDR_FLAG_LITTLE_ENDIAN (1U<<27)
+
+/* used to check if alignment padding is zero */
+#define LIBNDR_FLAG_PAD_CHECK (1U<<28)
+
+#define LIBNDR_FLAG_NDR64 (1U<<29)
+
+/* set if an object uuid will be present */
+#define LIBNDR_FLAG_OBJECT_PRESENT (1U<<30)
+
+/* set to avoid recursion in ndr_size_*() calculation */
+#define LIBNDR_FLAG_NO_NDR_SIZE (1U<<31)
+
+/* useful macro for debugging */
+#define NDR_PRINT_DEBUG(type, p) (void)ndr_print_debug(1, (ndr_print_fn_t)ndr_print_ ##type, #p, p, __location__, __func__)
+#define NDR_PRINT_DEBUGC(dbgc_class, type, p) ndr_print_debugc(dbgc_class, (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)
+
+/**
+ * @brief Prints NDR structure.
+ *
+ * Like NDR_PRINT_DEBUG, but takes a debug level parameter.
+ *
+ * @param[in] l The debug level.
+ * @param[in] type ndr_print_#type is the function that will be called.
+ * @param[in] p Pointer to the struct.
+ *
+ * @code
+ * NDR_PRINT_DEBUG_LEVEL(DBGLVL_DEBUG, wbint_userinfo, state->info);
+ * @endcode
+ *
+ * @return void.
+ */
+#define NDR_PRINT_DEBUG_LEVEL(l, type, p) \
+ (void) ( CHECK_DEBUGLVL(l) \
+ && ndr_print_debug(l, (ndr_print_fn_t)ndr_print_ ##type, #p, p, __location__, __func__) )
+
+/* useful macro for debugging in strings */
+#define NDR_PRINT_STRUCT_STRING(ctx, type, p) ndr_print_struct_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, p)
+#define NDR_PRINT_UNION_STRING(ctx, type, level, p) ndr_print_union_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
+#define NDR_PRINT_FUNCTION_STRING(ctx, type, flags, p) ndr_print_function_string(ctx, (ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
+#define NDR_PRINT_BOTH_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_BOTH, p)
+#define NDR_PRINT_OUT_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_OUT, p)
+#define NDR_PRINT_IN_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_IN | NDR_SET_VALUES, p)
+
+#define NDR_HIDE_SECRET(ndr) \
+ (unlikely(((ndr)->flags & LIBNDR_FLAG_IS_SECRET) && !(ndr)->print_secrets))
+
+#define NDR_BE(ndr) (unlikely(((ndr)->flags & (LIBNDR_FLAG_BIGENDIAN|LIBNDR_FLAG_LITTLE_ENDIAN)) == LIBNDR_FLAG_BIGENDIAN))
+
+enum ndr_err_code {
+ NDR_ERR_SUCCESS = 0,
+ 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,
+ NDR_ERR_IPV6ADDRESS,
+ NDR_ERR_INVALID_POINTER,
+ NDR_ERR_UNREAD_BYTES,
+ NDR_ERR_NDR64,
+ NDR_ERR_FLAGS,
+ NDR_ERR_INCOMPLETE_BUFFER,
+ NDR_ERR_MAX_RECURSION_EXCEEDED,
+ NDR_ERR_UNDERFLOW
+};
+
+#define NDR_ERR_CODE_IS_SUCCESS(x) (x == NDR_ERR_SUCCESS)
+
+#define NDR_ERR_HAVE_NO_MEMORY(x) do { \
+ if (NULL == (x)) { \
+ return NDR_ERR_ALLOC; \
+ } \
+} while (0)
+
+enum ndr_compression_alg {
+ NDR_COMPRESSION_MSZIP_CAB = 1,
+ NDR_COMPRESSION_MSZIP = 2,
+ NDR_COMPRESSION_XPRESS = 3
+};
+
+/*
+ flags passed to control parse flow
+ These are deliberately in a different range to the NDR_IN/NDR_OUT
+ flags to catch mixups
+*/
+#define NDR_SCALARS 0x100
+#define NDR_BUFFERS 0x200
+
+/*
+ flags passed to ndr_print_*() and ndr pull/push for functions
+ These are deliberately in a different range to the NDR_SCALARS/NDR_BUFFERS
+ flags to catch mixups
+*/
+#define NDR_IN 0x10
+#define NDR_OUT 0x20
+#define NDR_BOTH 0x30
+#define NDR_SET_VALUES 0x40
+
+
+#define NDR_PULL_CHECK_FLAGS(ndr, ndr_flags) do { \
+ if ((ndr_flags) & ~(NDR_SCALARS|NDR_BUFFERS)) { \
+ return ndr_pull_error(ndr, NDR_ERR_FLAGS, "Invalid pull struct ndr_flags 0x%x", ndr_flags); \
+ } \
+} while (0)
+
+#define NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags) do { \
+ if ((ndr_flags) & ~(NDR_SCALARS|NDR_BUFFERS)) \
+ return ndr_push_error(ndr, NDR_ERR_FLAGS, "Invalid push struct ndr_flags 0x%x", ndr_flags); \
+} while (0)
+
+#define NDR_PULL_CHECK_FN_FLAGS(ndr, flags) do { \
+ if ((flags) & ~(NDR_BOTH|NDR_SET_VALUES)) { \
+ return ndr_pull_error(ndr, NDR_ERR_FLAGS, "Invalid fn pull flags 0x%x", flags); \
+ } \
+} while (0)
+
+#define NDR_PUSH_CHECK_FN_FLAGS(ndr, flags) do { \
+ if ((flags) & ~(NDR_BOTH|NDR_SET_VALUES)) \
+ return ndr_push_error(ndr, NDR_ERR_FLAGS, "Invalid fn push flags 0x%x", flags); \
+} while (0)
+
+#define NDR_PULL_NEED_BYTES(ndr, n) do { \
+ if (unlikely(\
+ (n) > ndr->data_size || \
+ ndr->offset + (n) > ndr->data_size || \
+ ndr->offset + (n) < ndr->offset)) { \
+ if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { \
+ uint32_t _available = ndr->data_size - ndr->offset; \
+ uint32_t _missing = n - _available; \
+ ndr->relative_highest_offset = _missing; \
+ } \
+ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull bytes %u (%s)", (unsigned)n, __location__); \
+ } \
+} 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 (unlikely(!(ndr->flags & LIBNDR_FLAG_NOALIGN))) { \
+ if (unlikely(ndr->flags & LIBNDR_FLAG_PAD_CHECK)) { \
+ ndr_check_padding(ndr, n); \
+ } \
+ if(unlikely( \
+ ((ndr->offset + (n-1)) & (~(n-1))) < ndr->offset)) {\
+ return ndr_pull_error( \
+ ndr, \
+ NDR_ERR_BUFSIZE, \
+ "Pull align (overflow) %u", (unsigned)n); \
+ } \
+ ndr->offset = (ndr->offset + (n-1)) & ~(n-1); \
+ } \
+ if (unlikely(ndr->offset > ndr->data_size)) { \
+ if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { \
+ uint32_t _missing = ndr->offset - ndr->data_size; \
+ ndr->relative_highest_offset = _missing; \
+ } \
+ 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, n))
+
+#define NDR_PUSH_ALIGN(ndr, n) do { \
+ if (likely(!(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_RECURSION_CHECK(ndr, d) do { \
+ uint32_t _ndr_min_ = (d); \
+ if (ndr->global_max_recursion && ndr->global_max_recursion < (d)) { \
+ _ndr_min_ = ndr->global_max_recursion; \
+ } \
+ ndr->recursion_depth++; \
+ if (unlikely(ndr->recursion_depth > _ndr_min_)) { \
+ return ndr_pull_error( \
+ ndr, \
+ NDR_ERR_MAX_RECURSION_EXCEEDED, \
+ "Depth of recursion exceeds (%u)", \
+ (unsigned) d); \
+ } \
+} while (0)
+
+#define NDR_RECURSION_UNWIND(ndr) do { \
+ if (unlikely(ndr->recursion_depth == 0)) { \
+ return ndr_pull_error( \
+ ndr, \
+ NDR_ERR_UNDERFLOW, \
+ "ndr_pull.recursion_depth is 0"); \
+ } \
+ ndr->recursion_depth--; \
+} while (0)
+
+/* 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 { \
+ enum ndr_err_code _status; \
+ _status = call; \
+ if (unlikely(!NDR_ERR_CODE_IS_SUCCESS(_status))) { \
+ return _status; \
+ } \
+} while (0)
+
+/* if the call fails then free the ndr pointer */
+#define NDR_CHECK_FREE(call) do { \
+ enum ndr_err_code _status; \
+ _status = call; \
+ if (unlikely(!NDR_ERR_CODE_IS_SUCCESS(_status))) { \
+ talloc_free(ndr); \
+ return _status; \
+ } \
+} while (0)
+
+#define NDR_PULL_GET_MEM_CTX(ndr) (ndr->current_mem_ctx)
+
+#define NDR_PULL_SET_MEM_CTX(ndr, mem_ctx, flgs) do {\
+ if ( (flgs == 0) || (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 (unlikely(!(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 (unlikely(!(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_array(ndr, uint8_t, size); \
+ if (unlikely(!(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 (unlikely(!(s))) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %s failed: %s\n", # s, __location__); \
+} while (0)
+
+#define NDR_ZERO_STRUCT(x) ndr_zero_memory(&(x), sizeof(x))
+#define NDR_ZERO_STRUCTP(x) do { \
+ if ((x) != NULL) { \
+ ndr_zero_memory((x), sizeof(*(x))); \
+ } \
+} while(0)
+
+/* these are used when generic fn pointers are needed for ndr push/pull fns */
+typedef enum ndr_err_code (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *);
+typedef enum ndr_err_code (*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 *);
+
+#include "../libcli/util/error.h"
+#include "librpc/gen_ndr/misc.h"
+
+extern const struct ndr_syntax_id ndr_transfer_syntax_ndr;
+extern const struct ndr_syntax_id ndr_transfer_syntax_ndr64;
+extern const struct ndr_syntax_id ndr_syntax_id_null;
+
+struct ndr_interface_call_pipe {
+ const char *name;
+ const char *chunk_struct_name;
+ size_t chunk_struct_size;
+ ndr_push_flags_fn_t ndr_push;
+ ndr_pull_flags_fn_t ndr_pull;
+ ndr_print_fn_t ndr_print;
+};
+
+struct ndr_interface_call_pipes {
+ uint32_t num_pipes;
+ const struct ndr_interface_call_pipe *pipes;
+};
+
+struct ndr_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;
+ struct ndr_interface_call_pipes in_pipes;
+ struct ndr_interface_call_pipes out_pipes;
+};
+
+struct ndr_interface_public_struct {
+ 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;
+};
+
+struct ndr_interface_string_array {
+ uint32_t count;
+ const char * const *names;
+};
+
+struct ndr_interface_table {
+ const char *name;
+ struct ndr_syntax_id syntax_id;
+ const char *helpstring;
+ uint32_t num_calls;
+ const struct ndr_interface_call *calls;
+ uint32_t num_public_structs;
+ const struct ndr_interface_public_struct *public_structs;
+ const struct ndr_interface_string_array *endpoints;
+ const struct ndr_interface_string_array *authservices;
+};
+
+struct ndr_interface_list {
+ struct ndr_interface_list *prev, *next;
+ const struct ndr_interface_table *table;
+};
+
+struct sockaddr_storage;
+
+/*********************************************************************
+ Map an NT error code from a NDR error code.
+*********************************************************************/
+NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err);
+int ndr_map_error2errno(enum ndr_err_code ndr_err);
+const char *ndr_map_error2string(enum ndr_err_code ndr_err);
+#define ndr_errstr ndr_map_error2string
+
+/* FIXME: Use represent_as instead */
+struct dom_sid;
+enum ndr_err_code ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
+enum ndr_err_code 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);
+enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
+enum ndr_err_code 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);
+enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
+enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
+void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags);
+void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
+void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
+void ndr_zero_memory(void *ptr, size_t len);
+bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2);
+
+struct ndr_syntax_id_buf { char buf[39 /*GUID*/ + 3 /* "/0x" */ + 8]; };
+char *ndr_syntax_id_buf_string(
+ const struct ndr_syntax_id *id, struct ndr_syntax_id_buf *buf);
+char *ndr_syntax_id_to_string(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *id);
+
+bool ndr_syntax_id_from_string(const char *s, struct ndr_syntax_id *id);
+enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn);
+enum ndr_err_code ndr_push_struct_into_fixed_blob(DATA_BLOB *blob,
+ const void *p,
+ ndr_push_flags_fn_t fn);
+enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn);
+size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push);
+size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push);
+uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr);
+void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset);
+enum ndr_err_code ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset);
+enum ndr_err_code ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_short_relative_ptr1(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_relative_ptr2_start(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_short_relative_ptr2(struct ndr_push *ndr, const void *p);
+uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr);
+void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset);
+enum ndr_err_code ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset);
+enum ndr_err_code ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p);
+enum ndr_err_code ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset);
+enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p);
+enum ndr_err_code ndr_pull_relative_ptr_short(struct ndr_pull *ndr, uint16_t *v);
+size_t ndr_align_size(uint32_t offset, size_t n);
+struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
+enum ndr_err_code ndr_pull_append(struct ndr_pull *ndr, DATA_BLOB *blob);
+enum ndr_err_code ndr_pull_pop(struct ndr_pull *ndr);
+enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size);
+struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx);
+DATA_BLOB ndr_push_blob(struct ndr_push *ndr);
+enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size);
+void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+void ndr_print_debugc_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+bool ndr_print_debug(int level, ndr_print_fn_t fn, const char *name, void *ptr, const char *location, const char *function);
+void ndr_print_debugc(int dbgc_class, ndr_print_fn_t fn, const char *name, void *ptr);
+void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr);
+void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr);
+char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr);
+char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr);
+char *ndr_print_function_string(TALLOC_CTX *mem_ctx,
+ ndr_print_function_t fn, const char *name,
+ int flags, void *ptr);
+void ndr_set_flags(uint32_t *pflags, uint32_t new_flags);
+enum ndr_err_code _ndr_pull_error(struct ndr_pull *ndr,
+ enum ndr_err_code ndr_err,
+ const char *function,
+ const char *location,
+ const char *format, ...) PRINTF_ATTRIBUTE(5,6);
+#define ndr_pull_error(ndr, ndr_err, ...) \
+ _ndr_pull_error(ndr, \
+ ndr_err, \
+ __FUNCTION__, \
+ __location__, \
+ __VA_ARGS__)
+enum ndr_err_code _ndr_push_error(struct ndr_push *ndr,
+ enum ndr_err_code ndr_err,
+ const char *function,
+ const char *location,
+ const char *format, ...) PRINTF_ATTRIBUTE(5,6);
+#define ndr_push_error(ndr, ndr_err, ...) \
+ _ndr_push_error(ndr, \
+ ndr_err, \
+ __FUNCTION__, \
+ __location__, \
+ __VA_ARGS__)
+enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
+ struct ndr_pull **_subndr,
+ size_t header_size,
+ ssize_t size_is);
+enum ndr_err_code ndr_pull_subcontext_end(struct ndr_pull *ndr,
+ struct ndr_pull *subndr,
+ size_t header_size,
+ ssize_t size_is);
+enum ndr_err_code ndr_push_subcontext_start(struct ndr_push *ndr,
+ struct ndr_push **_subndr,
+ size_t header_size,
+ ssize_t size_is);
+enum ndr_err_code ndr_push_subcontext_end(struct ndr_push *ndr,
+ struct ndr_push *subndr,
+ size_t header_size,
+ ssize_t size_is);
+enum ndr_err_code ndr_token_store(TALLOC_CTX *mem_ctx,
+ struct ndr_token_list *list,
+ const void *key,
+ uint32_t value);
+enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list *list, const void *key, uint32_t *v,
+ int(*_cmp_fn)(const void*,const void*), bool erase);
+enum ndr_err_code ndr_token_retrieve(struct ndr_token_list *list, const void *key, uint32_t *v);
+enum ndr_err_code ndr_token_peek(struct ndr_token_list *list, const void *key, uint32_t *v);
+enum ndr_err_code ndr_pull_array_size(struct ndr_pull *ndr, const void *p);
+enum ndr_err_code ndr_get_array_size(struct ndr_pull *ndr, const void *p, uint32_t *size);
+enum ndr_err_code ndr_steal_array_size(struct ndr_pull *ndr, const void *p, uint32_t *size);
+enum ndr_err_code ndr_check_array_size(struct ndr_pull *ndr, const void *p, uint32_t size);
+enum ndr_err_code ndr_check_steal_array_size(struct ndr_pull *ndr, const void *p, uint32_t size);
+enum ndr_err_code ndr_pull_array_length(struct ndr_pull *ndr, const void *p);
+enum ndr_err_code ndr_get_array_length(struct ndr_pull *ndr, const void *p, uint32_t *length);
+enum ndr_err_code ndr_steal_array_length(struct ndr_pull *ndr, const void *p, uint32_t *length);
+enum ndr_err_code ndr_check_array_length(struct ndr_pull *ndr, const void *p, uint32_t length);
+enum ndr_err_code ndr_check_steal_array_length(struct ndr_pull *ndr, const void *p, uint32_t length);
+enum ndr_err_code ndr_push_pipe_chunk_trailer(struct ndr_push *ndr, int ndr_flags, uint32_t count);
+enum ndr_err_code ndr_check_pipe_chunk_trailer(struct ndr_pull *ndr, int ndr_flags, uint32_t count);
+enum ndr_err_code ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val);
+enum ndr_err_code ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val);
+enum ndr_err_code ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val);
+/* retrieve a switch value (for push) and remove it from the list */
+enum ndr_err_code ndr_push_steal_switch_value(struct ndr_push *ndr,
+ const void *p,
+ uint32_t *v);
+/* retrieve a switch value and remove it from the list */
+uint32_t ndr_print_steal_switch_value(struct ndr_print *ndr, const void *p);
+/* retrieve a switch value and remove it from the list */
+enum ndr_err_code ndr_pull_steal_switch_value(struct ndr_pull *ndr,
+ const void *p,
+ uint32_t *v);
+enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn);
+enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn);
+enum ndr_err_code ndr_pull_struct_blob_all_noalloc(const DATA_BLOB *blob,
+ void *p, ndr_pull_flags_fn_t fn);
+enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_pull_flags_fn_t fn);
+enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_pull_flags_fn_t fn);
+
+/* from libndr_basic.h */
+#define NDR_SCALAR_PROTO(name, type) \
+enum ndr_err_code ndr_push_ ## name(struct ndr_push *ndr, int ndr_flags, type v); \
+enum ndr_err_code ndr_pull_ ## name(struct ndr_pull *ndr, int ndr_flags, type *v); \
+void ndr_print_ ## name(struct ndr_print *ndr, const char *var_name, type v);
+
+#define NDR_SCALAR_PTR_PROTO(name, type) \
+enum ndr_err_code ndr_push_ ## name(struct ndr_push *ndr, int ndr_flags, const type *v); \
+enum ndr_err_code ndr_pull_ ## name(struct ndr_pull *ndr, int ndr_flags, type **v); \
+void ndr_print_ ## name(struct ndr_print *ndr, const char *var_name, const type *v);
+
+#define NDR_BUFFER_PROTO(name, type) \
+enum ndr_err_code ndr_push_ ## name(struct ndr_push *ndr, int ndr_flags, const type *v); \
+enum ndr_err_code ndr_pull_ ## name(struct ndr_pull *ndr, int ndr_flags, type *v); \
+void ndr_print_ ## name(struct ndr_print *ndr, const char *var_name, const type *v);
+
+NDR_SCALAR_PROTO(uint8, uint8_t)
+NDR_SCALAR_PROTO(int8, int8_t)
+NDR_SCALAR_PROTO(uint16, uint16_t)
+NDR_SCALAR_PROTO(int16, int16_t)
+NDR_SCALAR_PROTO(uint1632, uint16_t)
+NDR_SCALAR_PROTO(uint32, uint32_t)
+NDR_SCALAR_PROTO(uint3264, uint32_t)
+NDR_SCALAR_PROTO(int32, int32_t)
+NDR_SCALAR_PROTO(int3264, int32_t)
+NDR_SCALAR_PROTO(udlong, uint64_t)
+NDR_SCALAR_PROTO(udlongr, uint64_t)
+NDR_SCALAR_PROTO(dlong, int64_t)
+NDR_SCALAR_PROTO(hyper, uint64_t)
+NDR_SCALAR_PROTO(pointer, void *)
+NDR_SCALAR_PROTO(time_t, time_t)
+NDR_SCALAR_PROTO(uid_t, uid_t)
+NDR_SCALAR_PROTO(gid_t, gid_t)
+NDR_SCALAR_PROTO(NTSTATUS, NTSTATUS)
+NDR_SCALAR_PROTO(WERROR, WERROR)
+NDR_SCALAR_PROTO(HRESULT, HRESULT)
+NDR_SCALAR_PROTO(NTTIME, NTTIME)
+NDR_SCALAR_PROTO(NTTIME_1sec, NTTIME)
+NDR_SCALAR_PROTO(NTTIME_hyper, NTTIME)
+NDR_SCALAR_PROTO(DATA_BLOB, DATA_BLOB)
+NDR_SCALAR_PROTO(ipv4address, const char *)
+NDR_SCALAR_PROTO(ipv6address, const char *)
+NDR_SCALAR_PROTO(string, const char *)
+NDR_SCALAR_PROTO(double, double)
+
+enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r);
+enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r);
+void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r);
+bool ndr_policy_handle_empty(const struct policy_handle *h);
+#define is_valid_policy_hnd(hnd) (!ndr_policy_handle_empty(hnd))
+bool ndr_policy_handle_equal(const struct policy_handle *hnd1,
+ const struct policy_handle *hnd2);
+
+void ndr_check_padding(struct ndr_pull *ndr, size_t n);
+enum ndr_err_code ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v);
+enum ndr_err_code ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v);
+enum ndr_err_code ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n);
+enum ndr_err_code ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n);
+enum ndr_err_code ndr_push_align(struct ndr_push *ndr, size_t size);
+enum ndr_err_code ndr_pull_align(struct ndr_pull *ndr, size_t size);
+enum ndr_err_code ndr_push_union_align(struct ndr_push *ndr, size_t size);
+enum ndr_err_code ndr_pull_union_align(struct ndr_pull *ndr, size_t size);
+enum ndr_err_code ndr_push_trailer_align(struct ndr_push *ndr, size_t size);
+enum ndr_err_code ndr_pull_trailer_align(struct ndr_pull *ndr, size_t size);
+enum ndr_err_code ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n);
+enum ndr_err_code ndr_push_zero(struct ndr_push *ndr, uint32_t n);
+enum ndr_err_code ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n);
+enum ndr_err_code ndr_push_unique_ptr(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_full_ptr(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_ref_ptr(struct ndr_push *ndr);
+void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type);
+void ndr_print_null(struct ndr_print *ndr);
+void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type, const char *val, uint32_t value);
+void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value);
+void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value);
+void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p);
+void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type);
+void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level);
+void ndr_print_array_uint8(struct ndr_print *ndr, const char *name, const uint8_t *data, uint32_t count);
+uint32_t ndr_size_DATA_BLOB(int ret, const DATA_BLOB *data, int flags);
+
+/* strings */
+uint32_t ndr_charset_length(const void *var, charset_t chset);
+size_t ndr_string_array_size(struct ndr_push *ndr, const char *s);
+uint32_t ndr_size_string(int ret, const char * const* string, int flags);
+enum ndr_err_code ndr_pull_string_array(struct ndr_pull *ndr, int ndr_flags, const char ***_a);
+enum ndr_err_code ndr_push_string_array(struct ndr_push *ndr, int ndr_flags, const char **a);
+void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a);
+size_t ndr_size_string_array(const char **a, uint32_t count, int flags);
+uint32_t ndr_string_length(const void *_var, uint32_t element_size);
+enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size);
+enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset);
+enum ndr_err_code ndr_pull_charset_to_null(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset);
+enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset);
+enum ndr_err_code ndr_push_charset_to_null(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset);
+
+/* GUIDs */
+bool GUID_equal(const struct GUID *u1, const struct GUID *u2);
+struct GUID_ndr_buf { uint8_t buf[16]; };
+NTSTATUS GUID_to_ndr_buf(const struct GUID *guid, struct GUID_ndr_buf *buf);
+NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b);
+NTSTATUS GUID_from_ndr_blob(const DATA_BLOB *b, struct GUID *guid);
+NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid);
+NTSTATUS GUID_from_string(const char *s, struct GUID *guid);
+struct GUID GUID_zero(void);
+bool GUID_all_zero(const struct GUID *u);
+int GUID_compare(const struct GUID *u1, const struct GUID *u2);
+char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid);
+char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid);
+char *GUID_hexstring(TALLOC_CTX *mem_ctx, const struct GUID *guid);
+struct GUID GUID_random(void);
+
+/* Format is "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" */
+ /* 32 chars + 4 ' ' + \0 + 2 for adding {} */
+struct GUID_txt_buf { char buf[39]; };
+_PUBLIC_ char* GUID_buf_string(const struct GUID *guid,
+ struct GUID_txt_buf *dst);
+
+_PUBLIC_ enum ndr_err_code ndr_pull_enum_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v);
+_PUBLIC_ enum ndr_err_code ndr_pull_enum_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v);
+_PUBLIC_ enum ndr_err_code ndr_pull_enum_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v);
+_PUBLIC_ enum ndr_err_code ndr_pull_enum_uint1632(struct ndr_pull *ndr, int ndr_flags, uint16_t *v);
+_PUBLIC_ enum ndr_err_code ndr_push_enum_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v);
+_PUBLIC_ enum ndr_err_code ndr_push_enum_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v);
+_PUBLIC_ enum ndr_err_code ndr_push_enum_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v);
+_PUBLIC_ enum ndr_err_code ndr_push_enum_uint1632(struct ndr_push *ndr, int ndr_flags, uint16_t v);
+
+_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
+
+_PUBLIC_ enum ndr_err_code ndr_push_timespec(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct timespec *t);
+_PUBLIC_ enum ndr_err_code ndr_pull_timespec(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct timespec *t);
+_PUBLIC_ void ndr_print_timespec(struct ndr_print *ndr, const char *name,
+ const struct timespec *t);
+
+_PUBLIC_ enum ndr_err_code ndr_push_timeval(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct timeval *t);
+_PUBLIC_ enum ndr_err_code ndr_pull_timeval(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct timeval *t);
+_PUBLIC_ void ndr_print_timeval(struct ndr_print *ndr, const char *name,
+ const struct timeval *t);
+
+
+
+#endif /* __LIBNDR_H__ */
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
new file mode 100644
index 0000000..2576588
--- /dev/null
+++ b/librpc/ndr/ndr.c
@@ -0,0 +1,2005 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ libndr interface
+
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Jelmer Vernooij 2005-2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ this provides the core routines for NDR parsing functions
+
+ see http://www.opengroup.org/onlinepubs/9629399/chap14.htm for details
+ of NDR encoding rules
+*/
+
+#include "includes.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_private.h"
+#include "../lib/util/dlinklist.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_RPC_PARSE
+
+#define NDR_BASE_MARSHALL_SIZE 1024
+
+/*
+ * This value is arbitrary, but designed to reduce the memory a client
+ * can allocate and the work the client can force in processing a
+ * malicious packet.
+ *
+ * In an ideal world this would be controlled by range() restrictions
+ * on array sizes and careful IDL construction to avoid arbitary
+ * linked lists, but this is a backstop for now.
+ */
+#define NDR_TOKEN_MAX_LIST_SIZE 65535
+
+size_t ndr_token_max_list_size(void) {
+ return NDR_TOKEN_MAX_LIST_SIZE;
+};
+
+/* this guid indicates NDR encoding in a protocol tower */
+const struct ndr_syntax_id ndr_transfer_syntax_ndr = {
+ { 0x8a885d04, 0x1ceb, 0x11c9, {0x9f, 0xe8}, {0x08,0x00,0x2b,0x10,0x48,0x60} },
+ 2
+};
+
+const struct ndr_syntax_id ndr_transfer_syntax_ndr64 = {
+ { 0x71710533, 0xbeba, 0x4937, {0x83, 0x19}, {0xb5,0xdb,0xef,0x9c,0xcc,0x36} },
+ 1
+};
+
+const struct ndr_syntax_id ndr_syntax_id_null = {
+ { 0, 0, 0, { 0, 0 }, { 0, 0, 0, 0, 0, 0 } },
+ 0
+};
+
+/*
+ work out the number of bytes needed to align on a n byte boundary
+*/
+_PUBLIC_ size_t ndr_align_size(uint32_t offset, size_t n)
+{
+ if ((offset & (n-1)) == 0) return 0;
+ return n - (offset & (n-1));
+}
+
+/*
+ initialise a ndr parse structure from a data blob
+*/
+_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
+{
+ struct ndr_pull *ndr;
+
+ ndr = talloc_zero(mem_ctx, struct ndr_pull);
+ if (!ndr) return NULL;
+ ndr->current_mem_ctx = mem_ctx;
+
+ ndr->data = blob->data;
+ ndr->data_size = blob->length;
+
+ return ndr;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_append(struct ndr_pull *ndr, DATA_BLOB *blob)
+{
+ enum ndr_err_code ndr_err;
+ DATA_BLOB b;
+ uint32_t append = 0;
+ bool ok;
+
+ if (blob->length == 0) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ ndr_err = ndr_token_retrieve(&ndr->array_size_list, ndr, &append);
+ if (ndr_err == NDR_ERR_TOKEN) {
+ append = 0;
+ ndr_err = NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_err);
+
+ if (ndr->data_size == 0) {
+ ndr->data = NULL;
+ append = UINT32_MAX;
+ }
+
+ if (append == UINT32_MAX) {
+ /*
+ * append == UINT32_MAX means that
+ * ndr->data is either NULL or a valid
+ * talloc child of ndr, which means
+ * we can use data_blob_append() without
+ * data_blob_talloc() of the existing callers data
+ */
+ b = data_blob_const(ndr->data, ndr->data_size);
+ } else {
+ b = data_blob_talloc(ndr, ndr->data, ndr->data_size);
+ if (b.data == NULL) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__);
+ }
+ }
+
+ ok = data_blob_append(ndr, &b, blob->data, blob->length);
+ if (!ok) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__);
+ }
+
+ ndr->data = b.data;
+ ndr->data_size = b.length;
+
+ return ndr_token_store(ndr, &ndr->array_size_list, ndr, UINT32_MAX);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_pop(struct ndr_pull *ndr)
+{
+ uint32_t skip = 0;
+ uint32_t append = 0;
+ enum ndr_err_code ndr_err;
+
+ if (ndr->relative_base_offset != 0) {
+ return ndr_pull_error(ndr, NDR_ERR_RELATIVE,
+ "%s", __location__);
+ }
+ if (ndr->relative_highest_offset != 0) {
+ return ndr_pull_error(ndr, NDR_ERR_RELATIVE,
+ "%s", __location__);
+ }
+ if (ndr->relative_list.count != 0) {
+ return ndr_pull_error(ndr, NDR_ERR_RELATIVE,
+ "%s", __location__);
+ }
+ if (ndr->relative_base_list.count != 0) {
+ return ndr_pull_error(ndr, NDR_ERR_RELATIVE,
+ "%s", __location__);
+ }
+
+ /*
+ * we need to keep up to 7 bytes
+ * in order to get the aligment right.
+ */
+ skip = ndr->offset & 0xFFFFFFF8;
+
+ if (skip == 0) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ ndr->offset -= skip;
+ ndr->data_size -= skip;
+
+ ndr_err = ndr_token_peek(&ndr->array_size_list, ndr, &append);
+ if (ndr_err == NDR_ERR_TOKEN) {
+ /*
+ * here we assume, that ndr->data is not a
+ * talloc child of ndr.
+ */
+ ndr->data += skip;
+ return NDR_ERR_SUCCESS;
+ }
+
+ memmove(ndr->data, ndr->data + skip, ndr->data_size);
+
+ ndr->data = talloc_realloc(ndr, ndr->data, uint8_t, ndr->data_size);
+ if (ndr->data_size != 0 && ndr->data == NULL) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ advance by 'size' bytes
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size)
+{
+ NDR_PULL_NEED_BYTES(ndr, size);
+ ndr->offset += size;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ set the parse offset to 'ofs'
+*/
+static enum ndr_err_code ndr_pull_set_offset(struct ndr_pull *ndr, uint32_t ofs)
+{
+ ndr->offset = ofs;
+ if (ndr->offset > ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_pull_set_offset %u failed",
+ ofs);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/* create a ndr_push structure, ready for some marshalling */
+_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx)
+{
+ struct ndr_push *ndr;
+
+ ndr = talloc_zero(mem_ctx, struct ndr_push);
+ if (!ndr) {
+ return NULL;
+ }
+
+ ndr->flags = 0;
+ ndr->alloc_size = NDR_BASE_MARSHALL_SIZE;
+ ndr->data = talloc_array(ndr, uint8_t, ndr->alloc_size);
+ if (!ndr->data) {
+ talloc_free(ndr);
+ return NULL;
+ }
+
+ return ndr;
+}
+
+/* return a DATA_BLOB structure for the current ndr_push marshalled data */
+_PUBLIC_ DATA_BLOB ndr_push_blob(struct ndr_push *ndr)
+{
+ DATA_BLOB blob;
+ blob = data_blob_const(ndr->data, ndr->offset);
+ if (ndr->alloc_size > ndr->offset) {
+ ndr->data[ndr->offset] = 0;
+ }
+ return blob;
+}
+
+
+/*
+ expand the available space in the buffer to ndr->offset + extra_size
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size)
+{
+ uint32_t size = extra_size + ndr->offset;
+
+ if (size < ndr->offset) {
+ /* extra_size overflowed the offset */
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE, "Overflow in push_expand to %u",
+ size);
+ }
+
+ if (ndr->fixed_buf_size) {
+ if (ndr->alloc_size >= size) {
+ return NDR_ERR_SUCCESS;
+ }
+ return ndr_push_error(ndr,
+ NDR_ERR_BUFSIZE,
+ "Overflow of fixed buffer in "
+ "push_expand to %u",
+ size);
+ }
+
+ if (ndr->alloc_size > size) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ ndr->alloc_size += NDR_BASE_MARSHALL_SIZE;
+ if (size+1 > ndr->alloc_size) {
+ ndr->alloc_size = size+1;
+ }
+ ndr->data = talloc_realloc(ndr, ndr->data, uint8_t, ndr->alloc_size);
+ if (!ndr->data) {
+ return ndr_push_error(ndr, NDR_ERR_ALLOC, "Failed to push_expand to %u",
+ ndr->alloc_size);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_debugc_helper(struct ndr_print *ndr, const char *format, ...)
+{
+ va_list ap;
+ char *s = NULL;
+ uint32_t i;
+ int ret;
+ int dbgc_class;
+
+ va_start(ap, format);
+ ret = vasprintf(&s, format, ap);
+ va_end(ap);
+
+ if (ret == -1) {
+ return;
+ }
+
+ dbgc_class = *(int *)ndr->private_data;
+
+ if (ndr->no_newline) {
+ DEBUGADDC(dbgc_class, 1,("%s", s));
+ free(s);
+ return;
+ }
+
+ for (i=0;i<ndr->depth;i++) {
+ DEBUGADDC(dbgc_class, 1,(" "));
+ }
+
+ DEBUGADDC(dbgc_class, 1,("%s\n", s));
+ free(s);
+}
+
+_PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...)
+{
+ va_list ap;
+ char *s = NULL;
+ uint32_t i;
+ int ret;
+
+ va_start(ap, format);
+ ret = vasprintf(&s, format, ap);
+ va_end(ap);
+
+ if (ret == -1) {
+ return;
+ }
+
+ if (ndr->no_newline) {
+ DEBUGADD(1,("%s", s));
+ free(s);
+ return;
+ }
+
+ for (i=0;i<ndr->depth;i++) {
+ DEBUGADD(1,(" "));
+ }
+
+ DEBUGADD(1,("%s\n", s));
+ free(s);
+}
+
+_PUBLIC_ void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...)
+{
+ va_list ap;
+ uint32_t i;
+
+ if (!ndr->no_newline) {
+ for (i=0;i<ndr->depth;i++) {
+ printf(" ");
+ }
+ }
+
+ va_start(ap, format);
+ vprintf(format, ap);
+ va_end(ap);
+ if (!ndr->no_newline) {
+ printf("\n");
+ }
+}
+
+_PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...)
+{
+ va_list ap;
+ uint32_t i;
+
+ if (!ndr->no_newline) {
+ for (i=0;i<ndr->depth;i++) {
+ ndr->private_data = talloc_asprintf_append_buffer(
+ (char *)ndr->private_data, " ");
+ }
+ }
+
+ va_start(ap, format);
+ ndr->private_data = talloc_vasprintf_append_buffer((char *)ndr->private_data,
+ format, ap);
+ va_end(ap);
+ if (!ndr->no_newline) {
+ ndr->private_data = talloc_asprintf_append_buffer((char *)ndr->private_data,
+ "\n");
+ }
+}
+
+/*
+ a useful helper function for printing idl structures via DEBUGC()
+*/
+_PUBLIC_ void ndr_print_debugc(int dbgc_class, ndr_print_fn_t fn, const char *name, void *ptr)
+{
+ struct ndr_print *ndr;
+
+ DEBUGC(dbgc_class, 1,(" "));
+
+ ndr = talloc_zero(NULL, struct ndr_print);
+ if (!ndr) return;
+ ndr->private_data = &dbgc_class;
+ ndr->print = ndr_print_debugc_helper;
+ ndr->depth = 1;
+ ndr->flags = 0;
+#ifdef DEBUG_PASSWORD
+ if (CHECK_DEBUGLVL(100)) {
+ ndr->print_secrets = true;
+ }
+#endif
+
+ fn(ndr, name, ptr);
+ talloc_free(ndr);
+}
+
+/*
+ a useful helper function for printing idl structures via DEBUG()
+*/
+_PUBLIC_ bool ndr_print_debug(int level,
+ ndr_print_fn_t fn,
+ const char *name,
+ void *ptr,
+ const char *location,
+ const char *function)
+{
+ struct ndr_print *ndr;
+
+ DEBUGLF(level, (" "), location, function);
+
+ ndr = talloc_zero(NULL, struct ndr_print);
+ if (!ndr) return false;
+ ndr->print = ndr_print_debug_helper;
+ ndr->depth = 1;
+ ndr->flags = 0;
+#ifdef DEBUG_PASSWORD
+ if (CHECK_DEBUGLVL(100)) {
+ ndr->print_secrets = true;
+ }
+#endif
+
+ fn(ndr, name, ptr);
+ talloc_free(ndr);
+ return true;
+}
+
+/*
+ a useful helper function for printing idl unions via DEBUG()
+*/
+_PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr)
+{
+ struct ndr_print *ndr;
+
+ DEBUG(1,(" "));
+
+ ndr = talloc_zero(NULL, struct ndr_print);
+ if (!ndr) return;
+ ndr->print = ndr_print_debug_helper;
+ ndr->depth = 1;
+ ndr->flags = 0;
+#ifdef DEBUG_PASSWORD
+ if (CHECK_DEBUGLVL(100)) {
+ ndr->print_secrets = true;
+ }
+#endif
+
+ ndr_print_set_switch_value(ndr, ptr, level);
+ fn(ndr, name, ptr);
+ talloc_free(ndr);
+}
+
+/*
+ a useful helper function for printing idl function calls via DEBUG()
+*/
+_PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr)
+{
+ struct ndr_print *ndr;
+
+ DEBUG(1,(" "));
+
+ ndr = talloc_zero(NULL, struct ndr_print);
+ if (!ndr) return;
+ ndr->print = ndr_print_debug_helper;
+ ndr->depth = 1;
+ ndr->flags = 0;
+#ifdef DEBUG_PASSWORD
+ if (CHECK_DEBUGLVL(100)) {
+ ndr->print_secrets = true;
+ }
+#endif
+
+ fn(ndr, name, flags, ptr);
+ talloc_free(ndr);
+}
+
+/*
+ a useful helper function for printing idl structures to a string
+*/
+_PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr)
+{
+ struct ndr_print *ndr;
+ char *ret = NULL;
+
+ ndr = talloc_zero(mem_ctx, struct ndr_print);
+ if (!ndr) return NULL;
+ ndr->private_data = talloc_strdup(ndr, "");
+ if (!ndr->private_data) {
+ goto failed;
+ }
+ ndr->print = ndr_print_string_helper;
+ ndr->depth = 1;
+ ndr->flags = 0;
+
+ fn(ndr, name, ptr);
+ ret = talloc_steal(mem_ctx, (char *)ndr->private_data);
+failed:
+ talloc_free(ndr);
+ return ret;
+}
+
+/*
+ a useful helper function for printing idl unions to a string
+*/
+_PUBLIC_ char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr)
+{
+ struct ndr_print *ndr;
+ char *ret = NULL;
+
+ ndr = talloc_zero(mem_ctx, struct ndr_print);
+ if (!ndr) return NULL;
+ ndr->private_data = talloc_strdup(ndr, "");
+ if (!ndr->private_data) {
+ goto failed;
+ }
+ ndr->print = ndr_print_string_helper;
+ ndr->depth = 1;
+ ndr->flags = 0;
+ ndr_print_set_switch_value(ndr, ptr, level);
+ fn(ndr, name, ptr);
+ ret = talloc_steal(mem_ctx, (char *)ndr->private_data);
+failed:
+ talloc_free(ndr);
+ return ret;
+}
+
+/*
+ a useful helper function for printing idl function calls to a string
+*/
+_PUBLIC_ char *ndr_print_function_string(TALLOC_CTX *mem_ctx,
+ ndr_print_function_t fn, const char *name,
+ int flags, void *ptr)
+{
+ struct ndr_print *ndr;
+ char *ret = NULL;
+
+ ndr = talloc_zero(mem_ctx, struct ndr_print);
+ if (!ndr) return NULL;
+ ndr->private_data = talloc_strdup(ndr, "");
+ if (!ndr->private_data) {
+ goto failed;
+ }
+ ndr->print = ndr_print_string_helper;
+ ndr->depth = 1;
+ ndr->flags = 0;
+ fn(ndr, name, flags, ptr);
+ ret = talloc_steal(mem_ctx, (char *)ndr->private_data);
+failed:
+ talloc_free(ndr);
+ return ret;
+}
+
+_PUBLIC_ void ndr_set_flags(uint32_t *pflags, uint32_t new_flags)
+{
+ /* the big/little endian flags are inter-dependent */
+ if (new_flags & LIBNDR_FLAG_LITTLE_ENDIAN) {
+ (*pflags) &= ~LIBNDR_FLAG_BIGENDIAN;
+ (*pflags) &= ~LIBNDR_FLAG_NDR64;
+ }
+ if (new_flags & LIBNDR_FLAG_BIGENDIAN) {
+ (*pflags) &= ~LIBNDR_FLAG_LITTLE_ENDIAN;
+ (*pflags) &= ~LIBNDR_FLAG_NDR64;
+ }
+ if (new_flags & LIBNDR_ALIGN_FLAGS) {
+ /* Ensure we only have the passed-in
+ align flag set in the new_flags,
+ remove any old align flag. */
+ (*pflags) &= ~LIBNDR_ALIGN_FLAGS;
+ }
+ if (new_flags & LIBNDR_FLAG_NO_RELATIVE_REVERSE) {
+ (*pflags) &= ~LIBNDR_FLAG_RELATIVE_REVERSE;
+ }
+ (*pflags) |= new_flags;
+}
+
+/*
+ return and possibly log an NDR error
+*/
+_PUBLIC_ enum ndr_err_code _ndr_pull_error(struct ndr_pull *ndr,
+ enum ndr_err_code ndr_err,
+ const char *function,
+ const char *location,
+ const char *format, ...)
+{
+ char *s=NULL;
+ va_list ap;
+ int ret;
+
+ if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) {
+ switch (ndr_err) {
+ case NDR_ERR_BUFSIZE:
+ return NDR_ERR_INCOMPLETE_BUFFER;
+ default:
+ break;
+ }
+ }
+
+ va_start(ap, format);
+ ret = vasprintf(&s, format, ap);
+ va_end(ap);
+
+ if (ret == -1) {
+ return NDR_ERR_ALLOC;
+ }
+
+ D_WARNING("%s: ndr_pull_error(%s): %s at %s\n",
+ function,
+ ndr_map_error2string(ndr_err),
+ s,
+ location);
+
+ free(s);
+
+ return ndr_err;
+}
+
+/*
+ return and possibly log an NDR error
+*/
+_PUBLIC_ enum ndr_err_code _ndr_push_error(struct ndr_push *ndr,
+ enum ndr_err_code ndr_err,
+ const char *function,
+ const char *location,
+ const char *format, ...)
+{
+ char *s=NULL;
+ va_list ap;
+ int ret;
+
+ va_start(ap, format);
+ ret = vasprintf(&s, format, ap);
+ va_end(ap);
+
+ if (ret == -1) {
+ return NDR_ERR_ALLOC;
+ }
+
+ D_WARNING("%s: ndr_push_error(%s): %s at %s\n",
+ function,
+ ndr_map_error2string(ndr_err),
+ s,
+ location);
+
+ free(s);
+
+ return ndr_err;
+}
+
+/*
+ handle subcontext buffers, which in midl land are user-marshalled, but
+ we use magic in pidl to make them easier to cope with
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
+ struct ndr_pull **_subndr,
+ size_t header_size,
+ ssize_t size_is)
+{
+ struct ndr_pull *subndr;
+ uint32_t r_content_size;
+ bool force_le = false;
+ bool force_be = false;
+
+ switch (header_size) {
+ case 0: {
+ uint32_t content_size = ndr->data_size - ndr->offset;
+ if (size_is >= 0) {
+ content_size = size_is;
+ }
+ r_content_size = content_size;
+ break;
+ }
+
+ case 2: {
+ uint16_t content_size;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &content_size));
+ if (size_is >= 0 && size_is != content_size) {
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) (0x%04x) mismatch content_size %d (0x%04x)",
+ (int)size_is, (int)size_is,
+ (int)content_size,
+ (int)content_size);
+ }
+ r_content_size = content_size;
+ break;
+ }
+
+ case 4: {
+ uint32_t content_size;
+ NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, &content_size));
+ if (size_is >= 0 && size_is != content_size) {
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) (0x%08x) mismatch content_size %d (0x%08x)",
+ (int)size_is, (int)size_is,
+ (int)content_size,
+ (int)content_size);
+ }
+ r_content_size = content_size;
+ break;
+ }
+ case 0xFFFFFC01: {
+ /*
+ * Common Type Header for the Serialization Stream
+ * See [MS-RPCE] 2.2.6 Type Serialization Version 1
+ */
+ uint8_t version;
+ uint8_t drep;
+ uint16_t hdrlen;
+ uint32_t filler;
+ uint32_t content_size;
+ uint32_t reserved;
+
+ /* version */
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &version));
+
+ if (version != 1) {
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT,
+ "Bad subcontext (PULL) Common Type Header version %d != 1",
+ (int)version);
+ }
+
+ /*
+ * 0x10 little endian
+ * 0x00 big endian
+ */
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &drep));
+ if (drep == 0x10) {
+ force_le = true;
+ } else if (drep == 0x00) {
+ force_be = true;
+ } else {
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT,
+ "Bad subcontext (PULL) Common Type Header invalid drep 0x%02X",
+ (unsigned int)drep);
+ }
+
+ /* length of the "Private Header for Constructed Type" */
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &hdrlen));
+ if (hdrlen != 8) {
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT,
+ "Bad subcontext (PULL) Common Type Header length %d != 8",
+ (int)hdrlen);
+ }
+
+ /* filler should be ignored */
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &filler));
+
+ /*
+ * Private Header for Constructed Type
+ */
+ /* length - will be updated latter */
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &content_size));
+ if (size_is >= 0 && size_is != content_size) {
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) mismatch content_size %d",
+ (int)size_is, (int)content_size);
+ }
+ /* the content size must be a multiple of 8 */
+ if ((content_size % 8) != 0) {
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT,
+ "Bad subcontext (PULL) size_is(%d) not padded to 8 content_size %d",
+ (int)size_is, (int)content_size);
+ }
+ r_content_size = content_size;
+
+ /* reserved */
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &reserved));
+ break;
+ }
+ case 0xFFFFFFFF:
+ /*
+ * a shallow copy like subcontext
+ * useful for DCERPC pipe chunks.
+ */
+ subndr = talloc_zero(ndr, struct ndr_pull);
+ NDR_ERR_HAVE_NO_MEMORY(subndr);
+
+ subndr->flags = ndr->flags;
+ subndr->current_mem_ctx = ndr->current_mem_ctx;
+ subndr->data = ndr->data;
+ subndr->offset = ndr->offset;
+ subndr->data_size = ndr->data_size;
+
+ *_subndr = subndr;
+ return NDR_ERR_SUCCESS;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) header_size %d",
+ (int)header_size);
+ }
+
+ NDR_PULL_NEED_BYTES(ndr, r_content_size);
+
+ subndr = talloc_zero(ndr, struct ndr_pull);
+ NDR_ERR_HAVE_NO_MEMORY(subndr);
+ subndr->flags = ndr->flags & ~LIBNDR_FLAG_NDR64;
+ subndr->current_mem_ctx = ndr->current_mem_ctx;
+
+ subndr->data = ndr->data + ndr->offset;
+ subndr->offset = 0;
+ subndr->data_size = r_content_size;
+
+ if (force_le) {
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
+ } else if (force_be) {
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+ }
+
+ *_subndr = subndr;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_subcontext_end(struct ndr_pull *ndr,
+ struct ndr_pull *subndr,
+ size_t header_size,
+ ssize_t size_is)
+{
+ uint32_t advance;
+ uint32_t highest_ofs;
+
+ if (header_size == 0xFFFFFFFF) {
+ advance = subndr->offset - ndr->offset;
+ } else if (size_is >= 0) {
+ advance = size_is;
+ } else if (header_size > 0) {
+ advance = subndr->data_size;
+ } else {
+ advance = subndr->offset;
+ }
+
+ if (subndr->offset > ndr->relative_highest_offset) {
+ highest_ofs = subndr->offset;
+ } else {
+ highest_ofs = subndr->relative_highest_offset;
+ }
+ if (!(subndr->flags & LIBNDR_FLAG_SUBCONTEXT_NO_UNREAD_BYTES)) {
+ /*
+ * avoid an error unless SUBCONTEXT_NO_UNREAD_BYTES is specified
+ */
+ highest_ofs = advance;
+ }
+ if (highest_ofs < advance) {
+ return ndr_pull_error(subndr, NDR_ERR_UNREAD_BYTES,
+ "not all bytes consumed ofs[%u] advance[%u]",
+ highest_ofs, advance);
+ }
+
+ NDR_CHECK(ndr_pull_advance(ndr, advance));
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_subcontext_start(struct ndr_push *ndr,
+ struct ndr_push **_subndr,
+ size_t header_size,
+ ssize_t size_is)
+{
+ struct ndr_push *subndr;
+
+ subndr = ndr_push_init_ctx(ndr);
+ NDR_ERR_HAVE_NO_MEMORY(subndr);
+ subndr->flags = ndr->flags & ~LIBNDR_FLAG_NDR64;
+
+ if (size_is > 0) {
+ NDR_CHECK(ndr_push_zero(subndr, size_is));
+ subndr->offset = 0;
+ subndr->relative_end_offset = size_is;
+ }
+
+ *_subndr = subndr;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a subcontext header
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_subcontext_end(struct ndr_push *ndr,
+ struct ndr_push *subndr,
+ size_t header_size,
+ ssize_t size_is)
+{
+ ssize_t padding_len;
+
+ if (size_is >= 0) {
+ padding_len = size_is - subndr->offset;
+ if (padding_len < 0) {
+ return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PUSH) content_size %d is larger than size_is(%d)",
+ (int)subndr->offset, (int)size_is);
+ }
+ subndr->offset = size_is;
+ }
+
+ switch (header_size) {
+ case 0:
+ break;
+
+ case 2:
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, subndr->offset));
+ break;
+
+ case 4:
+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, subndr->offset));
+ break;
+
+ case 0xFFFFFC01:
+ /*
+ * Common Type Header for the Serialization Stream
+ * See [MS-RPCE] 2.2.6 Type Serialization Version 1
+ */
+ padding_len = NDR_ROUND(subndr->offset, 8) - subndr->offset;
+ if (padding_len > 0) {
+ NDR_CHECK(ndr_push_zero(subndr, padding_len));
+ }
+
+ /* version */
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 1));
+
+ /*
+ * 0x10 little endian
+ * 0x00 big endian
+ */
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, NDR_BE(ndr)?0x00:0x10));
+
+ /* length of the "Private Header for Constructed Type" */
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 8));
+
+ /* filler */
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0xCCCCCCCC));
+
+ /*
+ * Private Header for Constructed Type
+ */
+ /* length - will be updated latter */
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, subndr->offset));
+
+ /* reserved */
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext header size %d",
+ (int)header_size);
+ }
+
+ NDR_CHECK(ndr_push_bytes(ndr, subndr->data, subndr->offset));
+ return NDR_ERR_SUCCESS;
+}
+
+
+struct ndr_token {
+ const void *key;
+ uint32_t value;
+};
+
+/*
+ store a token in the ndr context, for later retrieval
+*/
+_PUBLIC_ enum ndr_err_code ndr_token_store(TALLOC_CTX *mem_ctx,
+ struct ndr_token_list *list,
+ const void *key,
+ uint32_t value)
+{
+ if (list->tokens == NULL) {
+ list->tokens = talloc_array(mem_ctx, struct ndr_token, 10);
+ if (list->tokens == NULL) {
+ NDR_ERR_HAVE_NO_MEMORY(list->tokens);
+ }
+ } else {
+ struct ndr_token *new_tokens = NULL;
+ uint32_t alloc_count = talloc_array_length(list->tokens);
+
+ /*
+ * Check every time we have not allocated too many
+ * tokens. This ensures developer sanity when
+ * debugging the boundary condition
+ */
+ if (list->count >= NDR_TOKEN_MAX_LIST_SIZE) {
+ return NDR_ERR_RANGE;
+ }
+ if (list->count == alloc_count) {
+ unsigned new_alloc;
+ /*
+ * Double the list, until we start in chunks
+ * of 1000
+ */
+ unsigned increment = MIN(list->count, 1000);
+ new_alloc = alloc_count + increment;
+ if (new_alloc < alloc_count) {
+ return NDR_ERR_RANGE;
+ }
+ new_tokens = talloc_realloc(mem_ctx, list->tokens,
+ struct ndr_token, new_alloc);
+ NDR_ERR_HAVE_NO_MEMORY(new_tokens);
+ list->tokens = new_tokens;
+ }
+ }
+ list->tokens[list->count].key = key;
+ list->tokens[list->count].value = value;
+ list->count++;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ retrieve a token from a ndr context, using cmp_fn to match the tokens
+*/
+_PUBLIC_ enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list *list,
+ const void *key, uint32_t *v,
+ comparison_fn_t _cmp_fn,
+ bool erase)
+{
+ struct ndr_token *tokens = list->tokens;
+ unsigned i;
+ if (_cmp_fn) {
+ for (i = list->count - 1; i < list->count; i--) {
+ if (_cmp_fn(tokens[i].key, key) == 0) {
+ goto found;
+ }
+ }
+ } else {
+ for (i = list->count - 1; i < list->count; i--) {
+ if (tokens[i].key == key) {
+ goto found;
+ }
+ }
+ }
+ return NDR_ERR_TOKEN;
+found:
+ *v = tokens[i].value;
+ if (erase) {
+ if (i != list->count - 1) {
+ tokens[i] = tokens[list->count - 1];
+ }
+ list->count--;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ retrieve a token from a ndr context
+*/
+_PUBLIC_ enum ndr_err_code ndr_token_retrieve(struct ndr_token_list *list,
+ const void *key, uint32_t *v)
+{
+ return ndr_token_retrieve_cmp_fn(list, key, v, NULL, true);
+}
+
+/*
+ peek at but don't removed a token from a ndr context
+*/
+_PUBLIC_ enum ndr_err_code ndr_token_peek(struct ndr_token_list *list,
+ const void *key, uint32_t *v)
+{
+ return ndr_token_retrieve_cmp_fn(list, key, v, NULL, false);
+}
+
+/*
+ pull an array size field and add it to the array_size_list token list
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_array_size(struct ndr_pull *ndr, const void *p)
+{
+ enum ndr_err_code ret;
+ uint32_t size;
+ NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, &size));
+ ret = ndr_token_store(ndr, &ndr->array_size_list, p, size);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_pull_error(ndr, ret,
+ "More than %d NDR tokens stored for array_size",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ return ret;
+}
+
+/*
+ get the stored array size field
+*/
+_PUBLIC_ enum ndr_err_code ndr_get_array_size(struct ndr_pull *ndr, const void *p, uint32_t *size)
+{
+ return ndr_token_peek(&ndr->array_size_list, p, size);
+}
+
+/*
+ get and remove from the stored list the stored array size field
+*/
+_PUBLIC_ enum ndr_err_code ndr_steal_array_size(struct ndr_pull *ndr, const void *p, uint32_t *size)
+{
+ return ndr_token_retrieve(&ndr->array_size_list, p, size);
+}
+
+/*
+ * check the stored array size field and remove from the stored list
+ * (the array_size NDR token list). We try to remove when possible to
+ * avoid the list growing towards the bounds check
+ */
+_PUBLIC_ enum ndr_err_code ndr_check_steal_array_size(struct ndr_pull *ndr, const void *p, uint32_t size)
+{
+ uint32_t stored;
+ NDR_CHECK(ndr_steal_array_size(ndr, p, &stored));
+ if (stored != size) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
+ "Bad array size - got %u expected %u\n",
+ stored, size);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ * check the stored array size field (leaving it on the array_size
+ * token list)
+ */
+_PUBLIC_ enum ndr_err_code ndr_check_array_size(struct ndr_pull *ndr, const void *p, uint32_t size)
+{
+ uint32_t stored;
+ NDR_CHECK(ndr_get_array_size(ndr, p, &stored));
+ if (stored != size) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
+ "Bad array size - got %u expected %u\n",
+ stored, size);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull an array length field and add it to the array_length_list token list
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_array_length(struct ndr_pull *ndr, const void *p)
+{
+ enum ndr_err_code ret;
+ uint32_t length, offset;
+ NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, &offset));
+ if (offset != 0) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
+ "non-zero array offset %u\n", offset);
+ }
+ NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, &length));
+ ret = ndr_token_store(ndr, &ndr->array_length_list, p, length);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_pull_error(ndr, ret,
+ "More than %d NDR tokens stored for array_length_list",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ return ret;
+}
+
+/*
+ get the stored array length field
+*/
+_PUBLIC_ enum ndr_err_code ndr_get_array_length(struct ndr_pull *ndr, const void *p, uint32_t *length)
+{
+ return ndr_token_peek(&ndr->array_length_list, p, length);
+}
+
+/*
+ * check the stored array length field and remove from the stored list
+ * (the array_size NDR token list). We try to remove when possible to
+ * avoid the list growing towards the bounds check
+ */
+_PUBLIC_ enum ndr_err_code ndr_steal_array_length(struct ndr_pull *ndr, const void *p, uint32_t *length)
+{
+ return ndr_token_retrieve(&ndr->array_length_list, p, length);
+}
+/*
+ check the stored array length field, removing it from the list
+*/
+_PUBLIC_ enum ndr_err_code ndr_check_steal_array_length(struct ndr_pull *ndr, const void *p, uint32_t length)
+{
+ uint32_t stored;
+ NDR_CHECK(ndr_steal_array_length(ndr, p, &stored));
+ if (stored != length) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
+ "Bad array length - got %u expected %u\n",
+ stored, length);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_pipe_chunk_trailer(struct ndr_push *ndr, int ndr_flags, uint32_t count)
+{
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ int64_t tmp = 0 - (int64_t)count;
+ uint64_t ncount = tmp;
+
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, ncount));
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_check_pipe_chunk_trailer(struct ndr_pull *ndr, int ndr_flags, uint32_t count)
+{
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ int64_t tmp = 0 - (int64_t)count;
+ uint64_t ncount1 = tmp;
+ uint64_t ncount2;
+
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &ncount2));
+ if (ncount1 == ncount2) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
+ "Bad pipe trailer[%lld should be %lld] size was %lu\"",
+ (unsigned long long)ncount2,
+ (unsigned long long)ncount1,
+ (unsigned long)count);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ store a switch value
+ */
+_PUBLIC_ enum ndr_err_code ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val)
+{
+ enum ndr_err_code ret =
+ ndr_token_store(ndr, &ndr->switch_list, p, val);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_push_error(ndr, ret,
+ "More than %d NDR tokens stored for switch_list",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ return ret;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val)
+{
+
+ enum ndr_err_code ret =
+ ndr_token_store(ndr, &ndr->switch_list, p, val);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_pull_error(ndr, ret,
+ "More than %d NDR tokens stored for switch_list",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ return ret;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val)
+{
+ return ndr_token_store(ndr, &ndr->switch_list, p, val);
+}
+
+/* retrieve a switch value (for push) and remove it from the list */
+_PUBLIC_ enum ndr_err_code ndr_push_steal_switch_value(struct ndr_push *ndr,
+ const void *p,
+ uint32_t *v)
+{
+ return ndr_token_retrieve(&ndr->switch_list, p, v);
+}
+
+/* retrieve a switch value and remove it from the list */
+_PUBLIC_ uint32_t ndr_print_steal_switch_value(struct ndr_print *ndr, const void *p)
+{
+ enum ndr_err_code status;
+ uint32_t v;
+
+ status = ndr_token_retrieve(&ndr->switch_list, p, &v);
+ if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
+ return 0;
+ }
+
+ return v;
+}
+
+/* retrieve a switch value and remove it from the list */
+_PUBLIC_ enum ndr_err_code ndr_pull_steal_switch_value(struct ndr_pull *ndr,
+ const void *p,
+ uint32_t *v)
+{
+ return ndr_token_retrieve(&ndr->switch_list, p, v);
+}
+
+/*
+ pull a struct from a blob using NDR
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
+ ndr_pull_flags_fn_t fn)
+{
+ struct ndr_pull *ndr;
+ ndr = ndr_pull_init_blob(blob, mem_ctx);
+ NDR_ERR_HAVE_NO_MEMORY(ndr);
+ NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
+ talloc_free(ndr);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a struct from a blob using NDR - failing if all bytes are not consumed
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+ void *p, ndr_pull_flags_fn_t fn)
+{
+ struct ndr_pull *ndr;
+ uint32_t highest_ofs;
+ ndr = ndr_pull_init_blob(blob, mem_ctx);
+ NDR_ERR_HAVE_NO_MEMORY(ndr);
+ NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
+ if (ndr->offset > ndr->relative_highest_offset) {
+ highest_ofs = ndr->offset;
+ } else {
+ highest_ofs = ndr->relative_highest_offset;
+ }
+ if (highest_ofs < ndr->data_size) {
+ enum ndr_err_code ret;
+ ret = ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
+ "not all bytes consumed ofs[%u] size[%u]",
+ highest_ofs, ndr->data_size);
+ talloc_free(ndr);
+ return ret;
+ }
+ talloc_free(ndr);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a struct from a blob using NDR - failing if all bytes are not consumed
+
+ This only works for structures with NO allocated memory, like
+ objectSID and GUID. This helps because we parse these a lot.
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all_noalloc(const DATA_BLOB *blob,
+ void *p, ndr_pull_flags_fn_t fn)
+{
+ /*
+ * We init this structure on the stack here, to avoid a
+ * talloc() as otherwise this call to the fn() is assured not
+ * to be doing any allocation, eg SIDs and GUIDs.
+ *
+ * This allows us to keep the safety of the PIDL-generated
+ * code without the talloc() overhead.
+ */
+ struct ndr_pull ndr = {
+ .data = blob->data,
+ .data_size = blob->length,
+ .current_mem_ctx = (void *)-1
+ };
+ uint32_t highest_ofs;
+ NDR_CHECK(fn(&ndr, NDR_SCALARS|NDR_BUFFERS, p));
+ highest_ofs = MAX(ndr.offset, ndr.relative_highest_offset);
+ if (highest_ofs < ndr.data_size) {
+ enum ndr_err_code ret;
+ ret = ndr_pull_error(
+ &ndr,
+ NDR_ERR_UNREAD_BYTES,
+ "not all bytes consumed ofs[%"PRIu32"] "
+ "size[%"PRIu32"]",
+ highest_ofs,
+ ndr.data_size);
+ return ret;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a union from a blob using NDR, given the union discriminator
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+ void *p,
+ uint32_t level, ndr_pull_flags_fn_t fn)
+{
+ struct ndr_pull *ndr;
+ ndr = ndr_pull_init_blob(blob, mem_ctx);
+ NDR_ERR_HAVE_NO_MEMORY(ndr);
+ NDR_CHECK_FREE(ndr_pull_set_switch_value(ndr, p, level));
+ NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
+ talloc_free(ndr);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a union from a blob using NDR, given the union discriminator,
+ failing if all bytes are not consumed
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+ void *p,
+ uint32_t level, ndr_pull_flags_fn_t fn)
+{
+ struct ndr_pull *ndr;
+ uint32_t highest_ofs;
+ ndr = ndr_pull_init_blob(blob, mem_ctx);
+ NDR_ERR_HAVE_NO_MEMORY(ndr);
+ NDR_CHECK_FREE(ndr_pull_set_switch_value(ndr, p, level));
+ NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
+ if (ndr->offset > ndr->relative_highest_offset) {
+ highest_ofs = ndr->offset;
+ } else {
+ highest_ofs = ndr->relative_highest_offset;
+ }
+ if (highest_ofs < ndr->data_size) {
+ enum ndr_err_code ret;
+ ret = ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
+ "not all bytes consumed ofs[%u] size[%u]",
+ highest_ofs, ndr->data_size);
+ talloc_free(ndr);
+ return ret;
+ }
+ talloc_free(ndr);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a struct to a blob using NDR
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn)
+{
+ struct ndr_push *ndr;
+ ndr = ndr_push_init_ctx(mem_ctx);
+ NDR_ERR_HAVE_NO_MEMORY(ndr);
+
+ NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
+
+ *blob = ndr_push_blob(ndr);
+ talloc_steal(mem_ctx, blob->data);
+ talloc_free(ndr);
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a struct into a provided blob using NDR.
+
+ We error because we want to have the performance issue (extra
+ talloc() calls) show up as an error, not just slower code. This is
+ used for things like GUIDs, which we expect to be a fixed size, and
+ SIDs that we can pre-calculate the size for.
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_struct_into_fixed_blob(
+ DATA_BLOB *blob, const void *p, ndr_push_flags_fn_t fn)
+{
+ struct ndr_push ndr = {
+ .data = blob->data,
+ .alloc_size = blob->length,
+ .fixed_buf_size = true
+ };
+
+ NDR_CHECK(fn(&ndr, NDR_SCALARS|NDR_BUFFERS, p));
+
+ if (ndr.offset != blob->length) {
+ return ndr_push_error(&ndr, NDR_ERR_BUFSIZE,
+ "buffer was either to large or small "
+ "ofs[%u] size[%zu]",
+ ndr.offset, blob->length);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a union to a blob using NDR
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
+ uint32_t level, ndr_push_flags_fn_t fn)
+{
+ struct ndr_push *ndr;
+ ndr = ndr_push_init_ctx(mem_ctx);
+ NDR_ERR_HAVE_NO_MEMORY(ndr);
+
+ NDR_CHECK(ndr_push_set_switch_value(ndr, p, level));
+ NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
+
+ *blob = ndr_push_blob(ndr);
+ talloc_steal(mem_ctx, blob->data);
+ talloc_free(ndr);
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ generic ndr_size_*() handler for structures
+*/
+_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push)
+{
+ struct ndr_push *ndr;
+ enum ndr_err_code status;
+ size_t ret;
+
+ /* avoid recursion */
+ if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
+
+ /* Avoid following a NULL pointer */
+ if (p == NULL) {
+ return 0;
+ }
+
+ ndr = ndr_push_init_ctx(NULL);
+ if (!ndr) return 0;
+ ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
+ status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
+ if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
+ talloc_free(ndr);
+ return 0;
+ }
+ ret = ndr->offset;
+ talloc_free(ndr);
+ return ret;
+}
+
+/*
+ generic ndr_size_*() handler for unions
+*/
+_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push)
+{
+ struct ndr_push *ndr;
+ enum ndr_err_code status;
+ size_t ret;
+
+ /* avoid recursion */
+ if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
+
+ /* Avoid following a NULL pointer */
+ if (p == NULL) {
+ return 0;
+ }
+
+ ndr = ndr_push_init_ctx(NULL);
+ if (!ndr) return 0;
+ ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
+
+ status = ndr_push_set_switch_value(ndr, p, level);
+ if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
+ talloc_free(ndr);
+ return 0;
+ }
+ status = push(ndr, NDR_SCALARS|NDR_BUFFERS, p);
+ if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
+ talloc_free(ndr);
+ return 0;
+ }
+ ret = ndr->offset;
+ talloc_free(ndr);
+ return ret;
+}
+
+/*
+ get the current base for relative pointers for the push
+*/
+_PUBLIC_ uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr)
+{
+ return ndr->relative_base_offset;
+}
+
+/*
+ restore the old base for relative pointers for the push
+*/
+_PUBLIC_ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset)
+{
+ ndr->relative_base_offset = offset;
+}
+
+/*
+ setup the current base for relative pointers for the push
+ called in the NDR_SCALAR stage
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset)
+{
+ enum ndr_err_code ret;
+ ndr->relative_base_offset = offset;
+ ret = ndr_token_store(ndr, &ndr->relative_base_list, p, offset);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_push_error(ndr, ret,
+ "More than %d NDR tokens stored for relative_base_list",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ return ret;
+}
+
+/*
+ setup the current base for relative pointers for the push
+ called in the NDR_BUFFERS stage
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p)
+{
+ return ndr_token_retrieve(&ndr->relative_base_list, p, &ndr->relative_base_offset);
+}
+
+/*
+ push a relative object - stage1
+ this is called during SCALARS processing
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p)
+{
+ enum ndr_err_code ret;
+ if (p == NULL) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ ret = ndr_token_store(ndr, &ndr->relative_list, p, ndr->offset);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_push_error(ndr, ret,
+ "More than %d NDR tokens stored for relative_list",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ NDR_CHECK(ret);
+ return ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF);
+}
+
+/*
+ push a short relative object - stage1
+ this is called during SCALARS processing
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_short_relative_ptr1(struct ndr_push *ndr, const void *p)
+{
+ enum ndr_err_code ret;
+ if (p == NULL) {
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 0));
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_push_align(ndr, 2));
+ ret = ndr_token_store(ndr, &ndr->relative_list, p, ndr->offset);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_push_error(ndr, ret,
+ "More than %d NDR tokens stored for relative_list",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ NDR_CHECK(ret);
+ return ndr_push_uint16(ndr, NDR_SCALARS, 0xFFFF);
+}
+/*
+ push a relative object - stage2
+ this is called during buffers processing
+*/
+static enum ndr_err_code ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p)
+{
+ uint32_t save_offset;
+ uint32_t ptr_offset = 0xFFFFFFFF;
+ if (p == NULL) {
+ return NDR_ERR_SUCCESS;
+ }
+ save_offset = ndr->offset;
+ NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ptr_offset));
+ if (ptr_offset > ndr->offset) {
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_push_relative_ptr2 ptr_offset(%u) > ndr->offset(%u)",
+ ptr_offset, ndr->offset);
+ }
+ ndr->offset = ptr_offset;
+ if (save_offset < ndr->relative_base_offset) {
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_push_relative_ptr2 save_offset(%u) < ndr->relative_base_offset(%u)",
+ save_offset, ndr->relative_base_offset);
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save_offset - ndr->relative_base_offset));
+ ndr->offset = save_offset;
+ return NDR_ERR_SUCCESS;
+}
+/*
+ push a short relative object - stage2
+ this is called during buffers processing
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_short_relative_ptr2(struct ndr_push *ndr, const void *p)
+{
+ uint32_t save_offset;
+ uint32_t ptr_offset = 0xFFFF;
+ uint32_t relative_offset;
+ size_t pad;
+ size_t align = 1;
+
+ if (p == NULL) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (ndr->offset < ndr->relative_base_offset) {
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_push_relative_ptr2 ndr->offset(%u) < ndr->relative_base_offset(%u)",
+ ndr->offset, ndr->relative_base_offset);
+ }
+
+ relative_offset = ndr->offset - ndr->relative_base_offset;
+
+ if (ndr->flags & LIBNDR_FLAG_NOALIGN) {
+ align = 1;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
+ align = 2;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
+ align = 4;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
+ align = 8;
+ }
+
+ pad = ndr_align_size(relative_offset, align);
+ if (pad != 0) {
+ NDR_CHECK(ndr_push_zero(ndr, pad));
+ }
+
+ relative_offset = ndr->offset - ndr->relative_base_offset;
+ if (relative_offset > UINT16_MAX) {
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_push_relative_ptr2 relative_offset(%u) > UINT16_MAX",
+ relative_offset);
+ }
+
+ save_offset = ndr->offset;
+ NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ptr_offset));
+ if (ptr_offset > ndr->offset) {
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_push_short_relative_ptr2 ptr_offset(%u) > ndr->offset(%u)",
+ ptr_offset, ndr->offset);
+ }
+ ndr->offset = ptr_offset;
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, relative_offset));
+ ndr->offset = save_offset;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a relative object - stage2 start
+ this is called during buffers processing
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_start(struct ndr_push *ndr, const void *p)
+{
+ enum ndr_err_code ret;
+ if (p == NULL) {
+ return NDR_ERR_SUCCESS;
+ }
+ if (!(ndr->flags & LIBNDR_FLAG_RELATIVE_REVERSE)) {
+ uint32_t relative_offset;
+ size_t pad;
+ size_t align = 1;
+
+ if (ndr->offset < ndr->relative_base_offset) {
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_push_relative_ptr2_start ndr->offset(%u) < ndr->relative_base_offset(%u)",
+ ndr->offset, ndr->relative_base_offset);
+ }
+
+ relative_offset = ndr->offset - ndr->relative_base_offset;
+
+ if (ndr->flags & LIBNDR_FLAG_NOALIGN) {
+ align = 1;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
+ align = 2;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
+ align = 4;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
+ align = 8;
+ }
+
+ pad = ndr_align_size(relative_offset, align);
+ if (pad) {
+ NDR_CHECK(ndr_push_zero(ndr, pad));
+ }
+
+ return ndr_push_relative_ptr2(ndr, p);
+ }
+ if (ndr->relative_end_offset == -1) {
+ return ndr_push_error(ndr, NDR_ERR_RELATIVE,
+ "ndr_push_relative_ptr2_start RELATIVE_REVERSE flag set and relative_end_offset %d",
+ ndr->relative_end_offset);
+ }
+ ret = ndr_token_store(ndr,
+ &ndr->relative_begin_list,
+ p,
+ ndr->offset);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_push_error(ndr, ret,
+ "More than %d NDR tokens stored for array_size",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ return ret;
+}
+
+/*
+ push a relative object - stage2 end
+ this is called during buffers processing
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, const void *p)
+{
+ uint32_t begin_offset = 0xFFFFFFFF;
+ ssize_t len;
+ uint32_t correct_offset = 0;
+ uint32_t align = 1;
+ uint32_t pad = 0;
+
+ if (p == NULL) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (!(ndr->flags & LIBNDR_FLAG_RELATIVE_REVERSE)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (ndr->flags & LIBNDR_FLAG_NO_NDR_SIZE) {
+ /* better say more than calculation a too small buffer */
+ NDR_PUSH_ALIGN(ndr, 8);
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (ndr->relative_end_offset < ndr->offset) {
+ return ndr_push_error(ndr, NDR_ERR_RELATIVE,
+ "ndr_push_relative_ptr2_end:"
+ "relative_end_offset %u < offset %u",
+ ndr->relative_end_offset, ndr->offset);
+ }
+
+ NDR_CHECK(ndr_token_retrieve(&ndr->relative_begin_list, p, &begin_offset));
+
+ /* we have marshalled a buffer, see how long it was */
+ len = ndr->offset - begin_offset;
+
+ if (len < 0) {
+ return ndr_push_error(ndr, NDR_ERR_RELATIVE,
+ "ndr_push_relative_ptr2_end:"
+ "offset %u - begin_offset %u < 0",
+ ndr->offset, begin_offset);
+ }
+
+ if (ndr->relative_end_offset < len) {
+ return ndr_push_error(ndr, NDR_ERR_RELATIVE,
+ "ndr_push_relative_ptr2_end:"
+ "relative_end_offset %u < len %lld",
+ ndr->offset, (long long)len);
+ }
+
+ /* the reversed offset is at the end of the main buffer */
+ correct_offset = ndr->relative_end_offset - len;
+
+ if (ndr->flags & LIBNDR_FLAG_NOALIGN) {
+ align = 1;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
+ align = 2;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
+ align = 4;
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
+ align = 8;
+ }
+
+ pad = ndr_align_size(correct_offset, align);
+ if (pad) {
+ correct_offset += pad;
+ correct_offset -= align;
+ }
+
+ if (correct_offset < begin_offset) {
+ return ndr_push_error(ndr, NDR_ERR_RELATIVE,
+ "ndr_push_relative_ptr2_end: "
+ "correct_offset %u < begin_offset %u",
+ correct_offset, begin_offset);
+ }
+
+ if (len > 0) {
+ uint32_t clear_size = correct_offset - begin_offset;
+
+ clear_size = MIN(clear_size, len);
+
+ /* now move the marshalled buffer to the end of the main buffer */
+ memmove(ndr->data + correct_offset, ndr->data + begin_offset, len);
+
+ if (clear_size) {
+ /* and wipe out old buffer within the main buffer */
+ memset(ndr->data + begin_offset, '\0', clear_size);
+ }
+ }
+
+ /* and set the end offset for the next buffer */
+ ndr->relative_end_offset = correct_offset;
+
+ /* finally write the offset to the main buffer */
+ ndr->offset = correct_offset;
+ NDR_CHECK(ndr_push_relative_ptr2(ndr, p));
+
+ /* restore to where we were in the main buffer */
+ ndr->offset = begin_offset;
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ get the current base for relative pointers for the pull
+*/
+_PUBLIC_ uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr)
+{
+ return ndr->relative_base_offset;
+}
+
+/*
+ restore the old base for relative pointers for the pull
+*/
+_PUBLIC_ void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset)
+{
+ ndr->relative_base_offset = offset;
+}
+
+/*
+ setup the current base for relative pointers for the pull
+ called in the NDR_SCALAR stage
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset)
+{
+ enum ndr_err_code ret;
+ ndr->relative_base_offset = offset;
+ ret = ndr_token_store(ndr, &ndr->relative_base_list, p, offset);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_pull_error(ndr, ret,
+ "More than %d NDR tokens stored for relative_base_list",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ return ret;
+}
+
+/*
+ setup the current base for relative pointers for the pull
+ called in the NDR_BUFFERS stage
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p)
+{
+ return ndr_token_retrieve(&ndr->relative_base_list, p, &ndr->relative_base_offset);
+}
+
+/*
+ pull a relative object - stage1
+ called during SCALARS processing
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset)
+{
+ enum ndr_err_code ret;
+ rel_offset += ndr->relative_base_offset;
+ if (rel_offset > ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_pull_relative_ptr1 rel_offset(%u) > ndr->data_size(%u)",
+ rel_offset, ndr->data_size);
+ }
+ ret = ndr_token_store(ndr, &ndr->relative_list, p, rel_offset);
+ if (ret == NDR_ERR_RANGE) {
+ return ndr_pull_error(ndr, ret,
+ "More than %d NDR tokens stored for relative_list",
+ NDR_TOKEN_MAX_LIST_SIZE);
+ }
+ return ret;
+}
+
+/*
+ pull a relative object - stage2
+ called during BUFFERS processing
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p)
+{
+ uint32_t rel_offset;
+ NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &rel_offset));
+ return ndr_pull_set_offset(ndr, rel_offset);
+}
+
+static const struct {
+ enum ndr_err_code err;
+ const char *string;
+} ndr_err_code_strings[] = {
+ { NDR_ERR_SUCCESS, "Success" },
+ { NDR_ERR_ARRAY_SIZE, "Bad Array Size" },
+ { NDR_ERR_BAD_SWITCH, "Bad Switch" },
+ { NDR_ERR_OFFSET, "Offset Error" },
+ { NDR_ERR_RELATIVE, "Relative Pointer Error" },
+ { NDR_ERR_CHARCNV, "Character Conversion Error" },
+ { NDR_ERR_LENGTH, "Length Error" },
+ { NDR_ERR_SUBCONTEXT, "Subcontext Error" },
+ { NDR_ERR_COMPRESSION, "Compression Error" },
+ { NDR_ERR_STRING, "String Error" },
+ { NDR_ERR_VALIDATE, "Validate Error" },
+ { NDR_ERR_BUFSIZE, "Buffer Size Error" },
+ { NDR_ERR_ALLOC, "Allocation Error" },
+ { NDR_ERR_RANGE, "Range Error" },
+ { NDR_ERR_TOKEN, "Token Error" },
+ { NDR_ERR_IPV4ADDRESS, "IPv4 Address Error" },
+ { NDR_ERR_INVALID_POINTER, "Invalid Pointer" },
+ { NDR_ERR_UNREAD_BYTES, "Unread Bytes" },
+ { NDR_ERR_NDR64, "NDR64 assertion error" },
+ { NDR_ERR_INCOMPLETE_BUFFER, "Incomplete Buffer" },
+ { NDR_ERR_MAX_RECURSION_EXCEEDED, "Maximum Recursion Exceeded" },
+ { NDR_ERR_UNDERFLOW, "Underflow" },
+ { 0, NULL }
+};
+
+_PUBLIC_ const char *ndr_map_error2string(enum ndr_err_code ndr_err)
+{
+ int i;
+ for (i = 0; ndr_err_code_strings[i].string != NULL; i++) {
+ if (ndr_err_code_strings[i].err == ndr_err)
+ return ndr_err_code_strings[i].string;
+ }
+ return "Unknown error";
+}
diff --git a/librpc/ndr/ndr_ODJ.c b/librpc/ndr/ndr_ODJ.c
new file mode 100644
index 0000000..86630b8
--- /dev/null
+++ b/librpc/ndr/ndr_ODJ.c
@@ -0,0 +1,65 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special ODJ structures
+
+ Copyright (C) Guenther Deschner 2021
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../librpc/gen_ndr/ndr_ODJ.h"
+#include "../librpc/ndr/ndr_ODJ.h"
+
+uint32_t odj_switch_level_from_guid(const struct GUID *r)
+{
+ struct {
+ uint16_t level;
+ const char *guid;
+ } levels[] = {
+ {
+ .level = 1,
+ .guid = ODJ_GUID_JOIN_PROVIDER
+ },{
+ .level = 2,
+ .guid = ODJ_GUID_JOIN_PROVIDER2
+ },{
+ .level = 3,
+ .guid = ODJ_GUID_JOIN_PROVIDER3
+ },{
+ .level = 4,
+ .guid = ODJ_GUID_CERT_PROVIDER
+ },{
+ .level = 5,
+ .guid = ODJ_GUID_POLICY_PROVIDER
+ }
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(levels); i++) {
+ struct GUID guid;
+ NTSTATUS status;
+
+ status = GUID_from_string(levels[i].guid, &guid);
+ if (!NT_STATUS_IS_OK(status)) {
+ return 0;
+ }
+ if (GUID_equal(&guid, r)) {
+ return levels[i].level;
+ }
+ }
+
+ return 0;
+}
diff --git a/librpc/ndr/ndr_ODJ.h b/librpc/ndr/ndr_ODJ.h
new file mode 100644
index 0000000..f57f2d7
--- /dev/null
+++ b/librpc/ndr/ndr_ODJ.h
@@ -0,0 +1,22 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special ODJ structures
+
+ Copyright (C) Guenther Deschner 2021
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+uint32_t odj_switch_level_from_guid(const struct GUID *r);
diff --git a/librpc/ndr/ndr_auth.c b/librpc/ndr/ndr_auth.c
new file mode 100644
index 0000000..5252d80
--- /dev/null
+++ b/librpc/ndr/ndr_auth.c
@@ -0,0 +1,44 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Helper routines for marshalling the internal 'auth.idl'
+
+ Copyright (C) Andrew Bartlett 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/ndr/ndr_auth.h"
+#include "librpc/ndr/libndr.h"
+
+_PUBLIC_ void ndr_print_cli_credentials(struct ndr_print *ndr, const char *name, struct cli_credentials *v)
+{
+ ndr->print(ndr, "%-25s: NULL", name);
+}
+
+/*
+ cli_credentials does not have a network representation, just pull/push a NULL pointer
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_cli_credentials(struct ndr_pull *ndr, int ndr_flags, struct cli_credentials *v)
+{
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_cli_credentials(struct ndr_push *ndr, int ndr_flags, struct cli_credentials *v)
+{
+ return ndr_push_pointer(ndr, ndr_flags, NULL);
+}
+
+
diff --git a/librpc/ndr/ndr_auth.h b/librpc/ndr/ndr_auth.h
new file mode 100644
index 0000000..57f6535
--- /dev/null
+++ b/librpc/ndr/ndr_auth.h
@@ -0,0 +1,32 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Helper routines for marshalling the internal 'auth.idl'
+
+ Copyright (C) Andrew Bartlett 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ cli_credentials does not have a network representation, just pull/push a NULL pointer
+*/
+
+#include "librpc/gen_ndr/ndr_auth.h"
+
+struct cli_credentials;
+_PUBLIC_ enum ndr_err_code ndr_pull_cli_credentials(struct ndr_pull *ndr, int ndr_flags, struct cli_credentials *v);
+_PUBLIC_ enum ndr_err_code ndr_push_cli_credentials(struct ndr_push *ndr, int ndr_flags, struct cli_credentials *v);
+
+_PUBLIC_ void ndr_print_cli_credentials(struct ndr_print *ndr, const char *name, struct cli_credentials *v);
diff --git a/librpc/ndr/ndr_backupkey.c b/librpc/ndr/ndr_backupkey.c
new file mode 100644
index 0000000..adb6e39
--- /dev/null
+++ b/librpc/ndr/ndr_backupkey.c
@@ -0,0 +1,222 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for top backup key protocol marshalling/unmarshalling
+
+ Copyright (C) Matthieu Patou 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/gen_ndr/ndr_backupkey.h"
+#include "librpc/gen_ndr/ndr_security.h"
+
+static uint32_t backupkeyguid_to_uint(const struct GUID *guid)
+{
+ struct GUID tmp;
+ NTSTATUS status;
+ bool match;
+
+ status = GUID_from_string(BACKUPKEY_RESTORE_GUID, &tmp);
+ if (NT_STATUS_IS_OK(status)) {
+ match = GUID_equal(guid, &tmp);
+ if (match) {
+ return BACKUPKEY_RESTORE_GUID_INTEGER;
+ }
+ }
+
+ status = GUID_from_string(BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID, &tmp);
+ if (NT_STATUS_IS_OK(status)) {
+ match = GUID_equal(guid, &tmp);
+ if (match) {
+ return BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER;
+ }
+ }
+
+ return BACKUPKEY_INVALID_GUID_INTEGER;
+}
+
+_PUBLIC_ void ndr_print_bkrp_BackupKey(struct ndr_print *ndr, const char *name, int flags, const struct bkrp_BackupKey *r)
+{
+ ndr_print_struct(ndr, name, "bkrp_BackupKey");
+ if (r == NULL) { ndr_print_null(ndr); return; }
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ union bkrp_data_in_blob inblob = {
+ .empty._empty_ = '\0',
+ };
+ DATA_BLOB blob;
+ uint32_t level;
+ enum ndr_err_code ndr_err;
+
+ ndr_print_struct(ndr, "in", "bkrp_BackupKey");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "guidActionAgent", r->in.guidActionAgent);
+ ndr->depth++;
+ ndr_print_GUID(ndr, "guidActionAgent", r->in.guidActionAgent);
+ ndr->depth--;
+
+ level = backupkeyguid_to_uint(r->in.guidActionAgent);
+ ndr_err = ndr_print_set_switch_value(ndr, &inblob, level);
+ if (unlikely(!NDR_ERR_CODE_IS_SUCCESS(ndr_err))) { \
+ DEBUG(0,("ERROR: ndr_print_bkrp_BackupKey ndr_print_set_switch_value failed: %d\n", ndr_err));
+ return;
+ }
+ blob.data = r->in.data_in;
+ blob.length = r->in.data_in_len;
+ ndr_err = ndr_pull_union_blob(&blob, ndr, &inblob, level,
+ (ndr_pull_flags_fn_t)ndr_pull_bkrp_data_in_blob);
+
+ ndr_print_ptr(ndr, "data_in", r->in.data_in);
+ ndr->depth++;
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ ndr_print_bkrp_data_in_blob(ndr, "data_in", &inblob);
+ } else {
+ ndr_print_array_uint8(ndr, "data_in", r->in.data_in, r->in.data_in_len);
+ }
+ ndr->depth--;
+
+ ndr_print_uint32(ndr, "data_in_len", r->in.data_in_len);
+ ndr_print_uint32(ndr, "param", r->in.param);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "bkrp_BackupKey");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "data_out", r->out.data_out);
+ ndr->depth++;
+ ndr_print_ptr(ndr, "data_out", *r->out.data_out);
+ ndr->depth++;
+
+ if (*r->out.data_out) {
+ ndr_print_array_uint8(ndr, "data_out", *r->out.data_out, *r->out.data_out_len);
+ }
+ ndr->depth--;
+ ndr->depth--;
+ ndr_print_ptr(ndr, "data_out_len", r->out.data_out_len);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "data_out_len", *r->out.data_out_len);
+ ndr->depth--;
+ ndr_print_WERROR(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+/* We have manual push/pull because we didn't manage to do the alignment
+ * purely in PIDL as the padding is sized so that the whole access_check_v3
+ * struct size is a multiple of 8 (as specified in 2.2.2.3 of ms-bkrp.pdf)
+ */
+_PUBLIC_ enum ndr_err_code ndr_push_bkrp_access_check_v2(struct ndr_push *ndr, int ndr_flags, const struct bkrp_access_check_v2 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ size_t ofs;
+ size_t pad;
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x00000001));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nonce_len));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->nonce, r->nonce_len));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->sid));
+ /* We articially increment the offset of 20 bytes (size of hash
+ * comming after the pad) so that ndr_align can determine easily
+ * the correct pad size to make the whole struct 8 bytes aligned
+ */
+ ofs = ndr->offset + 20;
+ pad = ndr_align_size(ofs, 8);
+ NDR_CHECK(ndr_push_zero(ndr, pad));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->hash, 20));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_bkrp_access_check_v2(struct ndr_pull *ndr, int ndr_flags, struct bkrp_access_check_v2 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ size_t ofs;
+ size_t pad;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->magic));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nonce_len));
+ NDR_PULL_ALLOC_N(ndr, r->nonce, r->nonce_len);
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->nonce, r->nonce_len));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->sid));
+ ofs = ndr->offset + 20;
+ pad = ndr_align_size(ofs, 8);
+ NDR_CHECK(ndr_pull_advance(ndr, pad));
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->hash, 20));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/* We have manual push/pull because we didn't manage to do the alignment
+ * purely in PIDL as the padding is sized so that the whole access_check_v3
+ * struct size is a multiple of 16 (as specified in 2.2.2.4 of ms-bkrp.pdf)
+ */
+_PUBLIC_ enum ndr_err_code ndr_push_bkrp_access_check_v3(struct ndr_push *ndr, int ndr_flags, const struct bkrp_access_check_v3 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ size_t ofs;
+ size_t pad;
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x00000001));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nonce_len));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->nonce, r->nonce_len));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->sid));
+ /* We articially increment the offset of 64 bytes (size of hash
+ * comming after the pad) so that ndr_align can determine easily
+ * the correct pad size to make the whole struct 16 bytes aligned
+ */
+ ofs = ndr->offset + 64;
+ pad = ndr_align_size(ofs, 16);
+ NDR_CHECK(ndr_push_zero(ndr, pad));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->hash, 64));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_bkrp_access_check_v3(struct ndr_pull *ndr, int ndr_flags, struct bkrp_access_check_v3 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ size_t ofs;
+ size_t pad;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->magic));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nonce_len));
+ NDR_PULL_ALLOC_N(ndr, r->nonce, r->nonce_len);
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->nonce, r->nonce_len));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->sid));
+ ofs = ndr->offset + 64;
+ pad = ndr_align_size(ofs, 16);
+ NDR_CHECK(ndr_pull_advance(ndr, pad));
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->hash, 64));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_backupkey.h b/librpc/ndr/ndr_backupkey.h
new file mode 100644
index 0000000..4e82f62
--- /dev/null
+++ b/librpc/ndr/ndr_backupkey.h
@@ -0,0 +1,23 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for top backup key protocol marshalling/unmarshalling
+
+ Copyright (C) Matthieu Patou 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+_PUBLIC_ enum ndr_err_code ndr_push_bkrp_access_check_v2(struct ndr_push *ndr, int ndr_flags, const struct bkrp_access_check_v2 *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_bkrp_access_check_v2(struct ndr_pull *ndr, int ndr_flags, struct bkrp_access_check_v2 *r);
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
new file mode 100644
index 0000000..e239cfb
--- /dev/null
+++ b/librpc/ndr/ndr_basic.c
@@ -0,0 +1,1538 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "system/network.h"
+#include "librpc/ndr/libndr.h"
+#include "lib/util/util_net.h"
+#include "lib/util/debug.h"
+#include "lib/util/util.h"
+#include "lib/util/bytearray.h"
+
+#define NDR_PULL_U16(ndr, ofs) \
+ (NDR_BE(ndr) ? PULL_BE_U16(ndr->data,ofs) : PULL_LE_U16(ndr->data,ofs))
+
+#define NDR_PULL_U32(ndr, ofs) \
+ (NDR_BE(ndr) ? PULL_BE_U32(ndr->data,ofs) : PULL_LE_U32(ndr->data,ofs))
+
+#define NDR_PULL_I32(ndr, ofs) \
+ (int32_t)(NDR_BE(ndr) ? PULL_BE_U32(ndr->data,ofs) : PULL_LE_U32(ndr->data,ofs))
+
+#define NDR_PUSH_U16(ndr, ofs, v) \
+ do { \
+ if (NDR_BE(ndr)) { \
+ PUSH_BE_U16(ndr->data, ofs, v); \
+ } else { \
+ PUSH_LE_U16(ndr->data, ofs, v); \
+ } \
+ } while (0)
+
+#define NDR_PUSH_U32(ndr, ofs, v) \
+ do { \
+ if (NDR_BE(ndr)) { \
+ PUSH_BE_U32(ndr->data, ofs, v); \
+ } else { \
+ PUSH_LE_U32(ndr->data, ofs, v); \
+ } \
+ } while (0)
+
+#define NDR_PUSH_I32(ndr, ofs, v) \
+ do { \
+ if (NDR_BE(ndr)) { \
+ PUSH_BE_U32(ndr->data, ofs, v); \
+ } else { \
+ PUSH_LE_U32(ndr->data, ofs, v); \
+ } \
+ } while (0)
+
+static void ndr_dump_data(struct ndr_print *ndr, const uint8_t *buf, int len);
+
+/*
+ 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);
+ size_t 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_ enum ndr_err_code ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_NEED_BYTES(ndr, 1);
+ *v = (int8_t)PULL_BE_U8(ndr->data, ndr->offset);
+ ndr->offset += 1;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a uint8_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_NEED_BYTES(ndr, 1);
+ *v = PULL_BE_U8(ndr->data, ndr->offset);
+ ndr->offset += 1;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a int16_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_ALIGN(ndr, 2);
+ NDR_PULL_NEED_BYTES(ndr, 2);
+ *v = (uint16_t)NDR_PULL_U16(ndr, ndr->offset);
+ ndr->offset += 2;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a uint16_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_ALIGN(ndr, 2);
+ NDR_PULL_NEED_BYTES(ndr, 2);
+ *v = NDR_PULL_U16(ndr, ndr->offset);
+ ndr->offset += 2;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a uint1632_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_uint1632(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (unlikely(ndr->flags & LIBNDR_FLAG_NDR64)) {
+ uint32_t v32 = 0;
+ enum ndr_err_code err = ndr_pull_uint32(ndr, ndr_flags, &v32);
+ *v = v32;
+ if (unlikely(v32 != *v)) {
+ DEBUG(0,(__location__ ": non-zero upper 16 bits 0x%08x\n", (unsigned)v32));
+ return NDR_ERR_NDR64;
+ }
+ return err;
+ }
+ return ndr_pull_uint16(ndr, ndr_flags, v);
+}
+
+/*
+ parse a int32_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_ALIGN(ndr, 4);
+ NDR_PULL_NEED_BYTES(ndr, 4);
+ *v = NDR_PULL_I32(ndr, ndr->offset);
+ ndr->offset += 4;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a uint32_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_ALIGN(ndr, 4);
+ NDR_PULL_NEED_BYTES(ndr, 4);
+ *v = NDR_PULL_U32(ndr, ndr->offset);
+ ndr->offset += 4;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a arch dependent uint32/uint64
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_uint3264(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
+{
+ uint64_t v64 = 0;
+ enum ndr_err_code err;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (likely(!(ndr->flags & LIBNDR_FLAG_NDR64))) {
+ return ndr_pull_uint32(ndr, ndr_flags, v);
+ }
+ err = ndr_pull_hyper(ndr, ndr_flags, &v64);
+ if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
+ return err;
+ }
+ *v = (uint32_t)v64;
+ if (unlikely(v64 != *v)) {
+ DEBUG(0,(__location__ ": non-zero upper 32 bits 0x%016llx\n",
+ (unsigned long long)v64));
+ return ndr_pull_error(ndr, NDR_ERR_NDR64, __location__ ": non-zero upper 32 bits 0x%016llx\n",
+ (unsigned long long)v64);
+ }
+ return err;
+}
+
+/*
+ parse a double
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_double(struct ndr_pull *ndr, int ndr_flags, double *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_ALIGN(ndr, 8);
+ NDR_PULL_NEED_BYTES(ndr, 8);
+ memcpy(v, ndr->data+ndr->offset, 8);
+ ndr->offset += 8;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a pointer referent identifier stored in 2 bytes
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr_short(struct ndr_pull *ndr, uint16_t *v)
+{
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, v));
+ if (*v != 0) {
+ ndr->ptr_count++;
+ }
+ *(v) -= ndr->relative_rap_convert;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a pointer referent identifier
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v)
+{
+ NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, v));
+ if (*v != 0) {
+ ndr->ptr_count++;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a ref pointer referent identifier
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v)
+{
+ NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, v));
+ /* ref pointers always point to data */
+ *v = 1;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a udlong
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_ALIGN(ndr, 4);
+ NDR_PULL_NEED_BYTES(ndr, 8);
+ *v = NDR_PULL_U32(ndr, ndr->offset);
+ *v |= (uint64_t)(NDR_PULL_U32(ndr, ndr->offset+4)) << 32;
+ ndr->offset += 8;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a udlongr
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PULL_ALIGN(ndr, 4);
+ NDR_PULL_NEED_BYTES(ndr, 8);
+ *v = ((uint64_t)NDR_PULL_U32(ndr, ndr->offset)) << 32;
+ *v |= NDR_PULL_U32(ndr, ndr->offset+4);
+ ndr->offset += 8;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a dlong
+*/
+_PUBLIC_ enum ndr_err_code 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_ enum ndr_err_code ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
+{
+ NDR_PULL_ALIGN(ndr, 8);
+ if (NDR_BE(ndr)) {
+ return ndr_pull_udlongr(ndr, ndr_flags, v);
+ }
+ return ndr_pull_udlong(ndr, ndr_flags, v);
+}
+
+/*
+ parse a pointer
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v)
+{
+ uintptr_t h;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ 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 NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a NTSTATUS
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status)
+{
+ uint32_t v;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *status = NT_STATUS(v);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a NTSTATUS
+*/
+_PUBLIC_ enum ndr_err_code 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_ enum ndr_err_code ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status)
+{
+ uint32_t v;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *status = W_ERROR(v);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a HRESULT
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_HRESULT(struct ndr_pull *ndr, int ndr_flags, HRESULT *status)
+{
+ uint32_t v;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *status = HRES_ERROR(v);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a uint8_t enum
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_enum_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v)
+{
+ return ndr_pull_uint8(ndr, ndr_flags, v);
+}
+
+/*
+ parse a uint16_t enum
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_enum_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
+{
+ return ndr_pull_uint16(ndr, ndr_flags, v);
+}
+
+/*
+ parse a uint1632_t enum (uint32_t on NDR64)
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_enum_uint1632(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
+{
+ if (unlikely(ndr->flags & LIBNDR_FLAG_NDR64)) {
+ uint32_t v32;
+ NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &v32));
+ *v = v32;
+ if (v32 != *v) {
+ DEBUG(0,(__location__ ": non-zero upper 16 bits 0x%08x\n", (unsigned)v32));
+ return NDR_ERR_NDR64;
+ }
+ return NDR_ERR_SUCCESS;
+ }
+ return ndr_pull_uint16(ndr, ndr_flags, v);
+}
+
+/*
+ parse a uint32_t enum
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_enum_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
+{
+ return ndr_pull_uint32(ndr, ndr_flags, v);
+}
+
+/*
+ push a uint8_t enum
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_enum_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v)
+{
+ return ndr_push_uint8(ndr, ndr_flags, v);
+}
+
+/*
+ push a uint16_t enum
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_enum_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v)
+{
+ return ndr_push_uint16(ndr, ndr_flags, v);
+}
+
+/*
+ push a uint32_t enum
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_enum_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v)
+{
+ return ndr_push_uint32(ndr, ndr_flags, v);
+}
+
+/*
+ push a uint1632_t enum
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_enum_uint1632(struct ndr_push *ndr, int ndr_flags, uint16_t v)
+{
+ if (unlikely(ndr->flags & LIBNDR_FLAG_NDR64)) {
+ return ndr_push_uint32(ndr, ndr_flags, v);
+ }
+ return ndr_push_uint16(ndr, ndr_flags, v);
+}
+
+/*
+ push a WERROR
+*/
+_PUBLIC_ enum ndr_err_code 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));
+}
+
+/*
+ push a HRESULT
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_HRESULT(struct ndr_push *ndr, int ndr_flags, HRESULT status)
+{
+ return ndr_push_uint32(ndr, NDR_SCALARS, HRES_ERROR_V(status));
+}
+
+_PUBLIC_ void ndr_print_HRESULT(struct ndr_print *ndr, const char *name, HRESULT r)
+{
+ ndr->print(ndr, "%-25s: %s", name, hresult_errstr(r));
+}
+
+
+/*
+ parse a set of bytes
+*/
+_PUBLIC_ enum ndr_err_code 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 NDR_ERR_SUCCESS;
+}
+
+/*
+ pull an array of uint8
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+ return ndr_pull_bytes(ndr, data, n);
+}
+
+/*
+ push a int8_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_NEED_BYTES(ndr, 1);
+ PUSH_BE_U8(ndr->data, ndr->offset, (uint8_t)v);
+ ndr->offset += 1;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a uint8_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_NEED_BYTES(ndr, 1);
+ PUSH_BE_U8(ndr->data, ndr->offset, v);
+ ndr->offset += 1;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a int16_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_ALIGN(ndr, 2);
+ NDR_PUSH_NEED_BYTES(ndr, 2);
+ NDR_PUSH_U16(ndr, ndr->offset, (uint16_t)v);
+ ndr->offset += 2;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a uint16_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_ALIGN(ndr, 2);
+ NDR_PUSH_NEED_BYTES(ndr, 2);
+ NDR_PUSH_U16(ndr, ndr->offset, v);
+ ndr->offset += 2;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a uint1632
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_uint1632(struct ndr_push *ndr, int ndr_flags, uint16_t v)
+{
+ if (unlikely(ndr->flags & LIBNDR_FLAG_NDR64)) {
+ return ndr_push_uint32(ndr, ndr_flags, v);
+ }
+ return ndr_push_uint16(ndr, ndr_flags, v);
+}
+
+/*
+ push a int32_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_ALIGN(ndr, 4);
+ NDR_PUSH_NEED_BYTES(ndr, 4);
+ NDR_PUSH_I32(ndr, ndr->offset, v);
+ ndr->offset += 4;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a uint32_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_ALIGN(ndr, 4);
+ NDR_PUSH_NEED_BYTES(ndr, 4);
+ NDR_PUSH_U32(ndr, ndr->offset, v);
+ ndr->offset += 4;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a uint3264
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_uint3264(struct ndr_push *ndr, int ndr_flags, uint32_t v)
+{
+ if (unlikely(ndr->flags & LIBNDR_FLAG_NDR64)) {
+ return ndr_push_hyper(ndr, ndr_flags, v);
+ }
+ return ndr_push_uint32(ndr, ndr_flags, v);
+}
+
+/*
+ push a udlong
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_ALIGN(ndr, 4);
+ NDR_PUSH_NEED_BYTES(ndr, 8);
+ NDR_PUSH_U32(ndr, ndr->offset, (v & 0xFFFFFFFF));
+ NDR_PUSH_U32(ndr, ndr->offset+4, (v>>32));
+ ndr->offset += 8;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a udlongr
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_ALIGN(ndr, 4);
+ NDR_PUSH_NEED_BYTES(ndr, 8);
+ NDR_PUSH_U32(ndr, ndr->offset, (v>>32));
+ NDR_PUSH_U32(ndr, ndr->offset+4, (v & 0xFFFFFFFF));
+ ndr->offset += 8;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a dlong
+*/
+_PUBLIC_ enum ndr_err_code 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_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v)
+{
+ NDR_PUSH_ALIGN(ndr, 8);
+ if (NDR_BE(ndr)) {
+ return ndr_push_udlongr(ndr, NDR_SCALARS, v);
+ }
+ return ndr_push_udlong(ndr, NDR_SCALARS, v);
+}
+
+/*
+ push a double
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_double(struct ndr_push *ndr, int ndr_flags, double v)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_PUSH_ALIGN(ndr, 8);
+ NDR_PUSH_NEED_BYTES(ndr, 8);
+ memcpy(ndr->data+ndr->offset, &v, 8);
+ ndr->offset += 8;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a pointer
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
+{
+ uintptr_t h = (intptr_t)v;
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ 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 NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_align(struct ndr_push *ndr, size_t size)
+{
+ /* this is a nasty hack to make pidl work with NDR64 */
+ if (size == 5) {
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ size = 8;
+ } else {
+ size = 4;
+ }
+ } else if (size == 3) {
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ size = 4;
+ } else {
+ size = 2;
+ }
+ }
+ NDR_PUSH_ALIGN(ndr, size);
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_align(struct ndr_pull *ndr, size_t size)
+{
+ /* this is a nasty hack to make pidl work with NDR64 */
+ if (size == 5) {
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ size = 8;
+ } else {
+ size = 4;
+ }
+ } else if (size == 3) {
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ size = 4;
+ } else {
+ size = 2;
+ }
+ }
+ NDR_PULL_ALIGN(ndr, size);
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_union_align(struct ndr_push *ndr, size_t size)
+{
+ /* MS-RPCE section 2.2.5.3.4.4 */
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ return ndr_push_align(ndr, size);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_union_align(struct ndr_pull *ndr, size_t size)
+{
+ /* MS-RPCE section 2.2.5.3.4.4 */
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ return ndr_pull_align(ndr, size);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_trailer_align(struct ndr_push *ndr, size_t size)
+{
+ /* MS-RPCE section 2.2.5.3.4.1 */
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ return ndr_push_align(ndr, size);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_trailer_align(struct ndr_pull *ndr, size_t size)
+{
+ /* MS-RPCE section 2.2.5.3.4.1 */
+ if (ndr->flags & LIBNDR_FLAG_NDR64) {
+ return ndr_pull_align(ndr, size);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push some bytes
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n)
+{
+ if (unlikely(n == 0)) {
+ return NDR_ERR_SUCCESS;
+ }
+ if (unlikely(data == NULL)) {
+ return NDR_ERR_INVALID_POINTER;
+ }
+ NDR_PUSH_NEED_BYTES(ndr, n);
+ memcpy(ndr->data + ndr->offset, data, n);
+ ndr->offset += n;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push some zero bytes
+*/
+_PUBLIC_ enum ndr_err_code 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 NDR_ERR_SUCCESS;
+}
+
+/*
+ push an array of uint8
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+ return ndr_push_bytes(ndr, data, n);
+}
+
+/*
+ push a unique non-zero value if a pointer is non-NULL, otherwise 0
+*/
+_PUBLIC_ enum ndr_err_code 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_uint3264(ndr, NDR_SCALARS, ptr);
+}
+
+/*
+ push a 'simple' full non-zero value if a pointer is non-NULL, otherwise 0
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_full_ptr(struct ndr_push *ndr, const void *p)
+{
+ enum ndr_err_code ret = NDR_ERR_SUCCESS;
+ uint32_t ptr = 0;
+ if (p) {
+ /* Check if the pointer already exists and has an id */
+ ret = ndr_token_peek(&ndr->full_ptr_list, p, &ptr);
+ if (ret == NDR_ERR_TOKEN) {
+ ndr->ptr_count++;
+ ptr = ndr->ptr_count;
+ ret = ndr_token_store(ndr, &ndr->full_ptr_list, p, ptr);
+ if (ret != NDR_ERR_SUCCESS) {
+ return ret;
+ }
+ } else if (ret != NDR_ERR_SUCCESS) {
+ return ret;
+ }
+ }
+ return ndr_push_uint3264(ndr, NDR_SCALARS, ptr);
+}
+
+/*
+ push always a 0, if a pointer is NULL it's a fatal error
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_ref_ptr(struct ndr_push *ndr)
+{
+ return ndr_push_uint3264(ndr, NDR_SCALARS, 0xAEF1AEF1);
+}
+
+
+/*
+ push a NTTIME
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, t));
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a NTTIME
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, t));
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a NTTIME_1sec
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ t /= 10000000;
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a NTTIME_1sec
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
+ (*t) *= 10000000;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ pull a NTTIME_hyper
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a NTTIME_hyper
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a time_t
+*/
+_PUBLIC_ enum ndr_err_code 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_ enum ndr_err_code 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 NDR_ERR_SUCCESS;
+}
+
+
+/*
+ push a uid_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_uid_t(struct ndr_push *ndr, int ndr_flags, uid_t u)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ return ndr_push_hyper(ndr, NDR_SCALARS, (uint64_t)u);
+}
+
+/*
+ pull a uid_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_uid_t(struct ndr_pull *ndr, int ndr_flags, uid_t *u)
+{
+ uint64_t uu = 0;
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &uu));
+ *u = (uid_t)uu;
+ if (unlikely(uu != *u)) {
+ DEBUG(0,(__location__ ": uid_t pull doesn't fit 0x%016llx\n",
+ (unsigned long long)uu));
+ return NDR_ERR_NDR64;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+
+/*
+ push a gid_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_gid_t(struct ndr_push *ndr, int ndr_flags, gid_t g)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ return ndr_push_hyper(ndr, NDR_SCALARS, (uint64_t)g);
+}
+
+/*
+ pull a gid_t
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_gid_t(struct ndr_pull *ndr, int ndr_flags, gid_t *g)
+{
+ uint64_t gg = 0;
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &gg));
+ *g = (gid_t)gg;
+ if (unlikely(gg != *g)) {
+ DEBUG(0,(__location__ ": gid_t pull doesn't fit 0x%016llx\n",
+ (unsigned long long)gg));
+ return NDR_ERR_NDR64;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+
+/*
+ pull a ipv4address
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address)
+{
+ uint32_t addr;
+ struct in_addr in;
+ NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &addr));
+ in.s_addr = htonl(addr);
+ *address = talloc_strdup(ndr->current_mem_ctx, inet_ntoa(in));
+ NDR_ERR_HAVE_NO_MEMORY(*address);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a ipv4address
+*/
+_PUBLIC_ enum ndr_err_code 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 NDR_ERR_SUCCESS;
+}
+
+/*
+ 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);
+}
+
+/*
+ pull a ipv6address
+*/
+#define IPV6_BYTES 16
+#define IPV6_ADDR_STR_LEN 39
+_PUBLIC_ enum ndr_err_code ndr_pull_ipv6address(struct ndr_pull *ndr, int ndr_flags, const char **address)
+{
+ uint8_t addr[IPV6_BYTES];
+ char *addr_str = talloc_strdup(ndr->current_mem_ctx, "");
+ int i;
+ NDR_CHECK(ndr_pull_array_uint8(ndr, ndr_flags, addr, IPV6_BYTES));
+ for (i = 0; i < IPV6_BYTES; ++i) {
+ addr_str = talloc_asprintf_append(addr_str, "%02x", addr[i]);
+ /* We need a ':' every second byte but the last one */
+ if (i%2 == 1 && i != (IPV6_BYTES - 1)) {
+ addr_str = talloc_strdup_append(addr_str, ":");
+ }
+ }
+ *address = addr_str;
+ NDR_ERR_HAVE_NO_MEMORY(*address);
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a ipv6address
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_ipv6address(struct ndr_push *ndr, int ndr_flags, const char *address)
+{
+#ifdef AF_INET6
+ uint8_t addr[IPV6_BYTES];
+ int ret;
+
+ if (!is_ipaddress(address)) {
+ return ndr_push_error(ndr, NDR_ERR_IPV6ADDRESS,
+ "Invalid IPv6 address: '%s'",
+ address);
+ }
+ ret = inet_pton(AF_INET6, address, addr);
+ if (ret <= 0) {
+ return NDR_ERR_IPV6ADDRESS;
+ }
+
+ NDR_CHECK(ndr_push_array_uint8(ndr, ndr_flags, addr, IPV6_BYTES));
+
+ return NDR_ERR_SUCCESS;
+#else
+ return NDR_ERR_IPV6ADDRESS;
+#endif
+}
+
+/*
+ print a ipv6address
+*/
+_PUBLIC_ void ndr_print_ipv6address(struct ndr_print *ndr, const char *name,
+ const char *address)
+{
+ ndr->print(ndr, "%-25s: %s", name, address);
+}
+#undef IPV6_BYTES
+
+_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_null(struct ndr_print *ndr)
+{
+ ndr->print(ndr, "UNEXPECTED NULL POINTER");
+}
+
+_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)
+{
+ if (flag == 0) {
+ return;
+ }
+
+ /* 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)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ ndr->print(ndr, "%-25s: %d", name, v);
+}
+
+_PUBLIC_ void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ 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)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ ndr->print(ndr, "%-25s: %d", name, v);
+}
+
+_PUBLIC_ void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t v)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ 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)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ ndr->print(ndr, "%-25s: %d", name, v);
+}
+
+_PUBLIC_ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t v)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
+}
+
+_PUBLIC_ void ndr_print_int3264(struct ndr_print *ndr, const char *name, int32_t v)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ ndr->print(ndr, "%-25s: %d", name, v);
+}
+
+_PUBLIC_ void ndr_print_uint3264(struct ndr_print *ndr, const char *name, uint32_t v)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ 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)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ ndr->print(ndr, "%-25s: 0x%016llx (%lld)", name, (unsigned long long)v, (long long)v);
+}
+
+_PUBLIC_ void ndr_print_double(struct ndr_print *ndr, const char *name, double v)
+{
+ ndr->print(ndr, "%-25s: %f", name, 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_uid_t(struct ndr_print *ndr, const char *name, uid_t u)
+{
+ ndr_print_dlong(ndr, name, u);
+}
+
+_PUBLIC_ void ndr_print_gid_t(struct ndr_print *ndr, const char *name, gid_t g)
+{
+ ndr_print_dlong(ndr, name, g);
+}
+
+_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;
+#define _ONELINE_LIMIT 32
+
+ if (data == NULL) {
+ ndr->print(ndr, "%s: ARRAY(%d) : NULL", name, count);
+ return;
+ }
+
+ if (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%s: ARRAY(%d): <REDACTED SECRET VALUES>", name, count);
+ return;
+ }
+
+ if (count <= _ONELINE_LIMIT && (ndr->flags & LIBNDR_PRINT_ARRAY_HEX)) {
+ char s[(_ONELINE_LIMIT + 1) * 2];
+ 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);
+ if (count > _ONELINE_LIMIT && (ndr->flags & LIBNDR_PRINT_ARRAY_HEX)) {
+ ndr_dump_data(ndr, data, count);
+ return;
+ }
+
+ ndr->depth++;
+ for (i=0;i<count;i++) {
+ char *idx=NULL;
+ if (asprintf(&idx, "[%d]", i) != -1) {
+ ndr_print_uint8(ndr, idx, data[i]);
+ free(idx);
+ }
+ }
+ ndr->depth--;
+#undef _ONELINE_LIMIT
+}
+
+static void ndr_print_dump_data_cb(const char *buf, void *private_data)
+{
+ struct ndr_print *ndr = (struct ndr_print *)private_data;
+
+ ndr->print(ndr, "%s", buf);
+}
+
+/*
+ ndr_print version of dump_data()
+ */
+static void ndr_dump_data(struct ndr_print *ndr, const uint8_t *buf, int len)
+{
+ if (NDR_HIDE_SECRET(ndr)) {
+ return;
+ }
+ ndr->no_newline = true;
+ dump_data_cb(buf, len, true, ndr_print_dump_data_cb, ndr);
+ ndr->no_newline = false;
+}
+
+
+_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) {
+ ndr_dump_data(ndr, r.data, r.length);
+ }
+}
+
+
+/*
+ * Push a DATA_BLOB onto the wire.
+ * 1) When called with LIBNDR_FLAG_ALIGN* alignment flags set, push padding
+ * bytes _only_. The length is determined by the alignment required and the
+ * current ndr offset.
+ * 2) When called with the LIBNDR_FLAG_REMAINING flag, push the byte array to
+ * the ndr buffer.
+ * 3) Otherwise, push a uint3264 length _and_ a corresponding byte array to the
+ * ndr buffer.
+ */
+_PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob)
+{
+ if (ndr->flags & LIBNDR_FLAG_REMAINING) {
+ /* nothing to do */
+ } else if (ndr->flags & (LIBNDR_ALIGN_FLAGS & ~LIBNDR_FLAG_NOALIGN)) {
+ 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 {
+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, blob.length));
+ }
+ NDR_CHECK(ndr_push_bytes(ndr, blob.data, blob.length));
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ * Pull a DATA_BLOB from the wire.
+ * 1) when called with LIBNDR_FLAG_ALIGN* alignment flags set, pull padding
+ * bytes _only_. The length is determined by the alignment required and the
+ * current ndr offset.
+ * 2) When called with the LIBNDR_FLAG_REMAINING flag, pull all remaining bytes
+ * from the ndr buffer.
+ * 3) Otherwise, pull a uint3264 length _and_ a corresponding byte array from the
+ * ndr buffer.
+ */
+_PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob)
+{
+ uint32_t length = 0;
+
+ if (ndr->flags & LIBNDR_FLAG_REMAINING) {
+ length = ndr->data_size - ndr->offset;
+ } else if (ndr->flags & (LIBNDR_ALIGN_FLAGS & ~LIBNDR_FLAG_NOALIGN)) {
+ 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 {
+ NDR_CHECK(ndr_pull_uint3264(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 NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ uint32_t ndr_size_DATA_BLOB(int ret, const DATA_BLOB *data, int flags)
+{
+ if (!data) return ret;
+ return ret + data->length;
+}
+
+_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b)
+{
+ ndr->print(ndr, "%-25s: %s", name, b?"true":"false");
+}
+
+_PUBLIC_ NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
+{
+ switch (ndr_err) {
+ case NDR_ERR_SUCCESS:
+ return NT_STATUS_OK;
+ case NDR_ERR_BUFSIZE:
+ return NT_STATUS_BUFFER_TOO_SMALL;
+ case NDR_ERR_TOKEN:
+ return NT_STATUS_INTERNAL_ERROR;
+ case NDR_ERR_ALLOC:
+ return NT_STATUS_NO_MEMORY;
+ case NDR_ERR_ARRAY_SIZE:
+ return NT_STATUS_ARRAY_BOUNDS_EXCEEDED;
+ case NDR_ERR_INVALID_POINTER:
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ case NDR_ERR_UNREAD_BYTES:
+ return NT_STATUS_PORT_MESSAGE_TOO_LONG;
+ default:
+ break;
+ }
+
+ /* we should map all error codes to different status codes */
+ return NT_STATUS_INVALID_PARAMETER;
+}
+
+_PUBLIC_ int ndr_map_error2errno(enum ndr_err_code ndr_err)
+{
+ switch (ndr_err) {
+ case NDR_ERR_SUCCESS:
+ return 0;
+ case NDR_ERR_BUFSIZE:
+ return ENOSPC;
+ case NDR_ERR_TOKEN:
+ return EINVAL;
+ case NDR_ERR_ALLOC:
+ return ENOMEM;
+ case NDR_ERR_ARRAY_SIZE:
+ return EMSGSIZE;
+ case NDR_ERR_INVALID_POINTER:
+ return EINVAL;
+ case NDR_ERR_UNREAD_BYTES:
+ return EOVERFLOW;
+ default:
+ break;
+ }
+
+ /* we should map all error codes to different status codes */
+ return EINVAL;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_timespec(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct timespec *t)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t->tv_sec));
+ NDR_CHECK(ndr_push_uint32(ndr, ndr_flags, t->tv_nsec));
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_timespec(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct timespec *t)
+{
+ uint64_t secs = 0;
+ uint32_t nsecs = 0;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &secs));
+ NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &nsecs));
+ t->tv_sec = secs;
+ t->tv_nsec = nsecs;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_timespec(struct ndr_print *ndr, const char *name,
+ const struct timespec *t)
+{
+ char *str = timestring(ndr, t->tv_sec);
+ ndr->print(ndr, "%-25s: %s.%ld", name, str, t->tv_nsec);
+ TALLOC_FREE(str);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_timeval(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct timeval *t)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t->tv_sec));
+ NDR_CHECK(ndr_push_uint32(ndr, ndr_flags, t->tv_usec));
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_timeval(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct timeval *t)
+{
+ uint64_t secs = 0;
+ uint32_t usecs = 0;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &secs));
+ NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &usecs));
+ t->tv_sec = secs;
+ t->tv_usec = usecs;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_timeval(struct ndr_print *ndr, const char *name,
+ const struct timeval *t)
+{
+ ndr->print(ndr, "%-25s: %s.%ld", name, timestring(ndr, t->tv_sec),
+ (long)t->tv_usec);
+}
diff --git a/librpc/ndr/ndr_bkupblobs.c b/librpc/ndr/ndr_bkupblobs.c
new file mode 100644
index 0000000..9335664
--- /dev/null
+++ b/librpc/ndr/ndr_bkupblobs.c
@@ -0,0 +1,82 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ helper routines for BKUP Blobs marshalling
+
+ Copyright (C) Matthieu Patou <mat@matws.net> 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_bkupblobs.h"
+
+
+_PUBLIC_ enum ndr_err_code ndr_push_bkup_NTBackupFile(struct ndr_push *ndr, int ndr_flags, const struct bkup_NTBackupFile *r)
+{
+ uint32_t cntr_streams_0;
+ {
+ 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, 2));
+ for (cntr_streams_0 = 0; cntr_streams_0 < r->num_stream; cntr_streams_0++) {
+ NDR_CHECK(ndr_push_bkup_Win32StreamId(ndr, NDR_SCALARS, &r->streams[cntr_streams_0]));
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 8));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+#define _TMP_PULL_REALLOC_N(ndr, s, t, n) do { \
+ _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
+ (s) = talloc_realloc(ndr->current_mem_ctx, (s), t, n); \
+ if (!(s)) { \
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, \
+ "Alloc %u * %s failed: %s\n", \
+ (unsigned)n, # s, __location__); \
+ } \
+} while (0)
+
+_PUBLIC_ enum ndr_err_code ndr_pull_bkup_NTBackupFile(struct ndr_pull *ndr, int ndr_flags, struct bkup_NTBackupFile *r)
+{
+ uint32_t cntr_streams_0;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t remaining = ndr->data_size - ndr->offset;
+ r->num_stream = 0;
+ r->streams = NULL;
+ for (cntr_streams_0 = 0; remaining > 0; cntr_streams_0++) {
+ r->num_stream += 1;
+ _TMP_PULL_REALLOC_N(ndr, r->streams,
+ struct bkup_Win32StreamId,
+ r->num_stream);
+ NDR_CHECK(ndr_pull_bkup_Win32StreamId(ndr,
+ NDR_SCALARS,
+ &r->streams[cntr_streams_0]));
+ remaining = ndr->data_size - ndr->offset;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_cab.c b/librpc/ndr/ndr_cab.c
new file mode 100644
index 0000000..476e21c
--- /dev/null
+++ b/librpc/ndr/ndr_cab.c
@@ -0,0 +1,437 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling cab structures
+
+ Copyright (C) Guenther Deschner 2016
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_cab.h"
+#include "librpc/ndr/ndr_compression.h"
+
+#define OFFSET_OF_FOLDER_COFFCABSTART(folder) (36 /* cfheader size */ + (size_t)(folder)*8)
+
+_PUBLIC_ void ndr_print_cf_time(struct ndr_print *ndr, const char *name, const struct cf_time *r)
+{
+ uint8_t hour = 0, minute = 0, seconds = 0;
+ char *s;
+ if (r == NULL) { ndr_print_null(ndr); return; }
+ hour = r->time >> 11;
+ minute = (r->time >> 5) & 0x3f;
+ seconds = (r->time << 1) & 0x3e;
+ s = talloc_asprintf(ndr, "%02d:%02d:%02d", hour, minute, seconds);
+ if (s == NULL) { return; }
+ ndr_print_string(ndr, "time", s);
+ talloc_free(s);
+}
+
+_PUBLIC_ void ndr_print_cf_date(struct ndr_print *ndr, const char *name, const struct cf_date *r)
+{
+ uint16_t year = 0;
+ uint8_t month = 0, day = 0;
+ char *s;
+ if (r == NULL) { ndr_print_null(ndr); return; }
+ year = (r->date >> 9);
+ year += 1980;
+ month = (r->date >> 5 & 0xf);
+ day = (r->date & 0x1f);
+ s = talloc_asprintf(ndr, "%02d/%02d/%04d", day, month, year);
+ if (s == NULL) { return; }
+ ndr_print_string(ndr, "date", s);
+ talloc_free(s);
+}
+
+uint32_t ndr_count_cfdata(const struct cab_file *r)
+{
+ uint32_t count = 0, i;
+
+ for (i = 0; i < r->cfheader.cFolders; i++) {
+ if (count + r->cffolders[i].cCFData < count) {
+ /* Integer wrap. */
+ return 0;
+ }
+ count += r->cffolders[i].cCFData;
+ }
+
+ return count;
+}
+
+static uint32_t ndr_cab_compute_checksum(uint8_t *data, uint32_t length, uint32_t seed)
+{
+ int num_ulong;
+ uint32_t checksum;
+ uint8_t *pb;
+ uint32_t ul;
+
+ num_ulong = length / 4;
+ checksum = seed;
+ pb = data;
+
+ while (num_ulong-- > 0) {
+ ul = (uint32_t)(*pb++);
+ ul |= (((uint32_t)(*pb++)) << 8);
+ ul |= (((uint32_t)(*pb++)) << 16);
+ ul |= (((uint32_t)(*pb++)) << 24);
+
+ checksum ^= ul;
+ }
+
+ ul = 0;
+
+ switch (length % 4) {
+ case 3:
+ ul |= (((uint32_t)(*pb++)) << 16);
+ FALL_THROUGH;
+ case 2:
+ ul |= (((uint32_t)(*pb++)) << 8);
+ FALL_THROUGH;
+ case 1:
+ ul |= (uint32_t)(*pb++);
+ FALL_THROUGH;
+ default:
+ break;
+ }
+
+ checksum ^= ul;
+
+ return checksum;
+}
+
+/* Push all CFDATA of a folder.
+ *
+ * This works on a folder level because compression type is set per
+ * folder, and a compression state can be shared between CFDATA of the
+ * same folder.
+ *
+ * This is not a regular NDR func as we pass the compression type and
+ * the number of CFDATA as extra arguments
+ */
+static enum ndr_err_code ndr_push_folder_cfdata(struct ndr_push *ndr,
+ const struct CFDATA *r,
+ enum cf_compress_type cab_ctype,
+ size_t num_cfdata)
+{
+ size_t i;
+ enum ndr_compression_alg ndr_ctype = 0;
+
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NOALIGN);
+
+ if (cab_ctype == CF_COMPRESS_MSZIP) {
+ ndr_ctype = NDR_COMPRESSION_MSZIP_CAB;
+ NDR_CHECK(ndr_push_compression_state_init(ndr, ndr_ctype, &ndr->cstate));
+ }
+
+ for (i = 0; i < num_cfdata; i++, r++) {
+ uint32_t compressed_length = 0;
+ uint32_t csum, csumPartial;
+ size_t compressed_offset, csum_offset, data_offset;
+
+ if (!r->ab.data) {
+ return ndr_push_error(ndr, NDR_ERR_LENGTH,
+ "NULL uncompressed data blob");
+ }
+ if (r->ab.length != r->cbUncomp) {
+ return ndr_push_error(ndr, NDR_ERR_LENGTH,
+ "Uncompressed data blob size != uncompressed data size field");
+ }
+
+ /*
+ * checksum is a function of the size fields
+ * and the potentially compressed data bytes,
+ * which haven't been compressed yet so
+ * remember offset, write zeroes, fill out
+ * later
+ */
+ csum_offset = ndr->offset;
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+
+ /*
+ * similarly, we don't know the compressed
+ * size yet, remember offset, write zeros,
+ * fill out later
+ */
+ compressed_offset = ndr->offset;
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->cbUncomp));
+
+ data_offset = ndr->offset;
+
+ switch (cab_ctype) {
+ case CF_COMPRESS_NONE:
+ /* just copy the data */
+ NDR_PUSH_NEED_BYTES(ndr, r->ab.length);
+ NDR_CHECK(ndr_push_bytes(ndr, r->ab.data, r->ab.length));
+ compressed_length = r->ab.length;
+ break;
+ case CF_COMPRESS_LZX:
+ /*
+ * we have not yet worked out the details of LZX
+ * compression
+ */
+ return NDR_ERR_COMPRESSION;
+
+ case CF_COMPRESS_MSZIP: {
+ struct ndr_push *push_sub, *push_compress;
+
+ /* compress via subcontext */
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &push_sub, 0, -1));
+ push_sub->cstate = ndr->cstate;
+ NDR_CHECK(ndr_push_compression_start(push_sub, &push_compress, ndr_ctype, -1));
+ ndr_set_flags(&push_compress->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_push_DATA_BLOB(push_compress, NDR_SCALARS, r->ab));
+ NDR_CHECK(ndr_push_compression_end(push_sub, push_compress, ndr_ctype, -1));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, push_sub, 0, -1));
+ compressed_length = push_sub->offset;
+
+ break;
+ }
+ default:
+ return NDR_ERR_BAD_SWITCH;
+ }
+
+ /* we can now write the compressed size and the checksum */
+ SSVAL(ndr->data, compressed_offset, compressed_length);
+
+ /*
+ * Create checksum over compressed data.
+ *
+ * The 8 bytes are the header size.
+ *
+ * We have already have written the checksum and set it to zero,
+ * earlier. So we know that after the checksum end the value
+ * for the compressed length comes the blob data.
+ *
+ * NDR already did all the checks for integer wraps.
+ */
+ csumPartial = ndr_cab_compute_checksum(&ndr->data[data_offset],
+ compressed_length, 0);
+
+ /*
+ * Checksum over header (compressed and uncompressed length).
+ *
+ * The first 4 bytes are the checksum size.
+ * The second 4 bytes are the size of the compressed and
+ * uncompressed length fields.
+ *
+ * NDR already did all the checks for integer wraps.
+ */
+ csum = ndr_cab_compute_checksum(&ndr->data[compressed_offset],
+ data_offset - compressed_offset,
+ csumPartial);
+
+ SIVAL(ndr->data, csum_offset, csum);
+ }
+
+ ndr_push_compression_state_free(ndr->cstate);
+ ndr->cstate = NULL;
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_cab_file(struct ndr_push *ndr, int ndr_flags, const struct cab_file *r)
+{
+ uint32_t cntr_cffolders_0;
+ uint32_t cntr_cffiles_0;
+ size_t processed_cfdata = 0;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NOALIGN);
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t i;
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_CFHEADER(ndr, NDR_SCALARS, &r->cfheader));
+ for (cntr_cffolders_0 = 0; cntr_cffolders_0 < (r->cfheader.cFolders); cntr_cffolders_0++) {
+ NDR_CHECK(ndr_push_CFFOLDER(ndr, NDR_SCALARS, &r->cffolders[cntr_cffolders_0]));
+ }
+ for (cntr_cffiles_0 = 0; cntr_cffiles_0 < (r->cfheader.cFiles); cntr_cffiles_0++) {
+ NDR_CHECK(ndr_push_CFFILE(ndr, NDR_SCALARS, &r->cffiles[cntr_cffiles_0]));
+ }
+#if 0
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_count_cfdata(r)));
+#endif
+
+ /* write in the folder header the offset of its first data block */
+ for (i = 0; i < r->cfheader.cFolders; i++) {
+ size_t off = OFFSET_OF_FOLDER_COFFCABSTART(i);
+ /* check that the offset we want to
+ * write to is always inside our
+ * current push buffer
+ */
+ if (off >= ndr->offset) {
+ return ndr_push_error(ndr, NDR_ERR_OFFSET,
+ "trying to write past current push buffer size");
+ }
+ SIVAL(ndr->data, off, ndr->offset);
+ NDR_CHECK(ndr_push_folder_cfdata(ndr, r->cfdata + processed_cfdata, r->cffolders[i].typeCompress, r->cffolders[i].cCFData));
+ processed_cfdata += r->cffolders[i].cCFData;
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+
+
+ /* write total file size in header */
+ SIVAL(ndr->data, 8, ndr->offset);
+
+ return NDR_ERR_SUCCESS;
+}
+
+
+/* Pull all CFDATA of a folder.
+ *
+ * This works on a folder level because compression type is set per
+ * folder, and a compression state can be shared between CFDATA of the
+ * same folder.
+ *
+ * This is not a regular NDR func as we pass the compression type and
+ * the number of CFDATA as extra arguments
+ */
+static enum ndr_err_code ndr_pull_folder_cfdata(struct ndr_pull *ndr,
+ struct CFDATA *r,
+ enum cf_compress_type cab_ctype,
+ size_t num_cfdata)
+{
+ size_t i;
+ enum ndr_compression_alg ndr_ctype = 0;
+
+ if (cab_ctype == CF_COMPRESS_MSZIP) {
+ ndr_ctype = NDR_COMPRESSION_MSZIP_CAB;
+ NDR_CHECK(ndr_pull_compression_state_init(ndr, NDR_COMPRESSION_MSZIP_CAB, &ndr->cstate));
+ }
+
+ for (i = 0; i < num_cfdata; i++, r++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->csum));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->cbData));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->cbUncomp));
+
+ switch (cab_ctype) {
+ case CF_COMPRESS_NONE:
+ /* just copy the data */
+ NDR_PULL_NEED_BYTES(ndr, r->cbUncomp);
+ r->ab = data_blob_talloc(ndr->current_mem_ctx,
+ ndr->data+ndr->offset,
+ r->cbUncomp);
+ if (r->ab.data == NULL) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC,
+ "failed to allocate buffer for uncompressed CFDATA block");
+ }
+ ndr->offset += r->cbUncomp;
+ break;
+
+ case CF_COMPRESS_LZX:
+ /* just copy the data (LZX decompression not implemented yet) */
+ NDR_PULL_NEED_BYTES(ndr, r->cbData);
+ r->ab = data_blob_talloc(ndr->current_mem_ctx,
+ ndr->data+ndr->offset,
+ r->cbData);
+ if (r->ab.data == NULL) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC,
+ "failed to allocate buffer for LZX-compressed CFDATA block");
+ }
+ ndr->offset += r->cbData;
+ break;
+
+ case CF_COMPRESS_MSZIP: {
+ struct ndr_pull *pull_sub, *pull_compress;
+ NDR_PULL_NEED_BYTES(ndr, r->cbData);
+ /* decompress via subcontext */
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &pull_sub, 0, r->cbData));
+ pull_sub->cstate = ndr->cstate;
+ NDR_CHECK(ndr_pull_compression_start(pull_sub, &pull_compress,
+ ndr_ctype, r->cbUncomp, r->cbData));
+ ndr_set_flags(&pull_compress->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_pull_DATA_BLOB(pull_compress, NDR_SCALARS, &r->ab));
+ NDR_CHECK(ndr_pull_compression_end(pull_sub, pull_compress, ndr_ctype, r->cbUncomp));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, pull_sub, 0, r->cbData));
+
+ break;
+ }
+ default:
+ return NDR_ERR_BAD_SWITCH;
+ }
+ }
+
+ ndr_pull_compression_state_free(ndr->cstate);
+ ndr->cstate = NULL;
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_cab_file(struct ndr_pull *ndr, int ndr_flags, struct cab_file *r)
+{
+ uint32_t size_cffolders_0 = 0;
+ uint32_t cntr_cffolders_0;
+ TALLOC_CTX *_mem_save_cffolders_0 = NULL;
+ uint32_t size_cffiles_0 = 0;
+ uint32_t cntr_cffiles_0;
+ TALLOC_CTX *_mem_save_cffiles_0 = NULL;
+ uint32_t size_cfdata_0 = 0;
+ size_t processed_cfdata = 0;
+ TALLOC_CTX *_mem_save_cfdata_0 = NULL;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NOALIGN);
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_CFHEADER(ndr, NDR_SCALARS, &r->cfheader));
+ size_cffolders_0 = r->cfheader.cFolders;
+ NDR_PULL_ALLOC_N(ndr, r->cffolders, size_cffolders_0);
+ _mem_save_cffolders_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->cffolders, 0);
+ for (cntr_cffolders_0 = 0; cntr_cffolders_0 < (size_cffolders_0); cntr_cffolders_0++) {
+ NDR_CHECK(ndr_pull_CFFOLDER(ndr, NDR_SCALARS, &r->cffolders[cntr_cffolders_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_cffolders_0, 0);
+ size_cffiles_0 = r->cfheader.cFiles;
+ NDR_PULL_ALLOC_N(ndr, r->cffiles, size_cffiles_0);
+ _mem_save_cffiles_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->cffiles, 0);
+ for (cntr_cffiles_0 = 0; cntr_cffiles_0 < (size_cffiles_0); cntr_cffiles_0++) {
+ NDR_CHECK(ndr_pull_CFFILE(ndr, NDR_SCALARS, &r->cffiles[cntr_cffiles_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_cffiles_0, 0);
+#if 0
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->cfdata_count));
+#else
+ r->cfdata_count = ndr_count_cfdata(r);
+#endif
+ size_cfdata_0 = r->cfdata_count;
+ NDR_PULL_ALLOC_N(ndr, r->cfdata, size_cfdata_0);
+ _mem_save_cfdata_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->cfdata, 0);
+ for (cntr_cffolders_0 = 0; cntr_cffolders_0 < (size_cffolders_0); cntr_cffolders_0++) {
+ NDR_CHECK(ndr_pull_folder_cfdata(ndr,
+ r->cfdata + processed_cfdata,
+ r->cffolders[cntr_cffolders_0].typeCompress,
+ r->cffolders[cntr_cffolders_0].cCFData));
+ processed_cfdata += r->cffolders[cntr_cffolders_0].cCFData;
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_cfdata_0, 0);
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_cab.h b/librpc/ndr/ndr_cab.h
new file mode 100644
index 0000000..39b6bc9
--- /dev/null
+++ b/librpc/ndr/ndr_cab.h
@@ -0,0 +1,22 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling cab structures
+
+ Copyright (C) Guenther Deschner 2016
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+uint32_t ndr_count_cfdata(const struct cab_file *r);
diff --git a/librpc/ndr/ndr_compression.c b/librpc/ndr/ndr_compression.c
new file mode 100644
index 0000000..8838c2f
--- /dev/null
+++ b/librpc/ndr/ndr_compression.c
@@ -0,0 +1,941 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ libndr compression support
+
+ Copyright (C) Stefan Metzmacher 2005
+ Copyright (C) Matthieu Suiche 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../lib/compression/lzxpress.h"
+#include "librpc/ndr/libndr.h"
+#include "../librpc/ndr/ndr_compression.h"
+#include <zlib.h>
+
+struct ndr_compression_state {
+ enum ndr_compression_alg type;
+ union {
+ struct {
+ struct z_stream_s *z;
+ uint8_t *dict;
+ size_t dict_size;
+ } mszip;
+ } alg;
+};
+
+static voidpf ndr_zlib_alloc(voidpf opaque, uInt items, uInt size)
+{
+ return talloc_zero_size(opaque, items * size);
+}
+
+static void ndr_zlib_free(voidpf opaque, voidpf address)
+{
+ talloc_free(address);
+}
+
+static enum ndr_err_code ndr_pull_compression_mszip_cab_chunk(struct ndr_pull *ndrpull,
+ struct ndr_push *ndrpush,
+ struct ndr_compression_state *state,
+ ssize_t decompressed_len,
+ ssize_t compressed_len)
+{
+ 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;
+ z_stream *z = state->alg.mszip.z;
+ int z_ret;
+
+ plain_chunk_size = decompressed_len;
+
+ if (plain_chunk_size > 0x00008000) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad MSZIP CAB plain chunk size %08X > 0x00008000 (PULL)",
+ plain_chunk_size);
+ }
+
+
+ comp_chunk_size = compressed_len;
+
+ DEBUG(9,("MSZIP CAB 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;
+
+ if (comp_chunk.length < 2) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad MSZIP CAB comp chunk size %u < 2 (PULL)",
+ (unsigned int)comp_chunk.length);
+ }
+ /* CK = Chris Kirmse, official Microsoft purloiner */
+ if (comp_chunk.data[0] != 'C' ||
+ comp_chunk.data[1] != 'K') {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad MSZIP CAB invalid prefix [%c%c] != [CK]",
+ comp_chunk.data[0], comp_chunk.data[1]);
+ }
+
+ /*
+ * This is a MSZIP block. It is actually using the deflate
+ * algorithm which can be decompressed by zlib. zlib will try
+ * to decompress as much as it can in each run. If we provide
+ * all the input and enough room for the uncompressed output,
+ * one call is enough. It will loop over all the sub-blocks
+ * that make up a deflate block.
+ *
+ * See corresponding push function for more info.
+ */
+
+ z->next_in = comp_chunk.data + 2;
+ z->avail_in = comp_chunk.length - 2;
+ z->next_out = plain_chunk.data;
+ z->avail_out = plain_chunk.length;
+
+ /*
+ * Each MSZIP CDATA contains a complete deflate stream
+ * i.e. the stream starts and ends in the CFDATA but the
+ * _dictionary_ is shared between all CFDATA of a CFFOLDER.
+ *
+ * When decompressing, the initial dictionary of the first
+ * CDATA is empty. All other CFDATA use the previous CFDATA
+ * uncompressed output as dictionary.
+ */
+
+ if (state->alg.mszip.dict_size) {
+ z_ret = inflateSetDictionary(z, state->alg.mszip.dict, state->alg.mszip.dict_size);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "zlib inflateSetDictionary error %s (%d) %s (PULL)",
+ zError(z_ret), z_ret, z->msg);
+ }
+ }
+
+ z_ret = inflate(z, Z_FINISH);
+ if (z_ret == Z_OK) {
+ /*
+ * Z_OK here means there was no error but the stream
+ * hasn't been fully decompressed because there was
+ * not enough room for the output, which should not
+ * happen
+ */
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "zlib inflate error not enough space for output (PULL)");
+ }
+ if (z_ret != Z_STREAM_END) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "zlib inflate error %s (%d) %s (PULL)", zError(z_ret), z_ret, z->msg);
+ }
+
+ if (z->total_out < plain_chunk.length) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "zlib uncompressed output is smaller than expected (%lu < %zu) (PULL)",
+ z->total_out, plain_chunk.length);
+ }
+
+ /*
+ * Keep a copy of the output to set as dictionary for the
+ * next decompression call.
+ *
+ * The input pointer seems to be still valid between calls, so
+ * we can just store that instead of copying the memory over
+ * the dict temp buffer.
+ */
+ state->alg.mszip.dict = plain_chunk.data;
+ state->alg.mszip.dict_size = plain_chunk.length;
+
+ z_ret = inflateReset(z);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "zlib inflateReset error %s (%d) %s (PULL)",
+ zError(z_ret), z_ret, z->msg);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_push_compression_mszip_cab_chunk(struct ndr_push *ndrpush,
+ struct ndr_pull *ndrpull,
+ struct ndr_compression_state *state)
+{
+ DATA_BLOB comp_chunk;
+ uint32_t comp_chunk_size;
+ DATA_BLOB plain_chunk;
+ uint32_t plain_chunk_size;
+ uint32_t plain_chunk_offset;
+ uint32_t max_plain_size = 0x00008000;
+ /*
+ * The maximum compressed size of each MSZIP block is 32k + 12 bytes
+ * header size.
+ */
+ uint32_t max_comp_size = 0x00008000 + 12;
+ int z_ret;
+ z_stream *z;
+
+ if (ndrpull->data_size <= ndrpull->offset) {
+ return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION,
+ "strange NDR pull size and offset (integer overflow?)");
+
+ }
+
+ plain_chunk_size = MIN(max_plain_size, ndrpull->data_size - ndrpull->offset);
+ plain_chunk_offset = ndrpull->offset;
+ NDR_CHECK(ndr_pull_advance(ndrpull, plain_chunk_size));
+
+ plain_chunk.data = ndrpull->data + plain_chunk_offset;
+ plain_chunk.length = plain_chunk_size;
+
+ NDR_CHECK(ndr_push_expand(ndrpush, max_comp_size));
+
+ comp_chunk.data = ndrpush->data + ndrpush->offset;
+ comp_chunk.length = max_comp_size;
+
+ /* CK = Chris Kirmse, official Microsoft purloiner */
+ comp_chunk.data[0] = 'C';
+ comp_chunk.data[1] = 'K';
+
+ z = state->alg.mszip.z;
+ z->next_in = plain_chunk.data;
+ z->avail_in = plain_chunk.length;
+ z->total_in = 0;
+
+ z->next_out = comp_chunk.data + 2;
+ z->avail_out = comp_chunk.length;
+ z->total_out = 0;
+
+ /*
+ * See pull function for explanations of the MSZIP format.
+ *
+ * The CFDATA block contains a full deflate stream. Each stream
+ * uses the uncompressed input of the previous CFDATA in the
+ * same CFFOLDER as a dictionary for the compression.
+ */
+
+ if (state->alg.mszip.dict_size) {
+ z_ret = deflateSetDictionary(z, state->alg.mszip.dict, state->alg.mszip.dict_size);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "zlib deflateSetDictionary error %s (%d) %s (PUSH)",
+ zError(z_ret), z_ret, z->msg);
+ }
+ }
+
+ /*
+ * Z_FINISH should make deflate process all of the input in
+ * one call. If the stream is not finished there was an error
+ * e.g. not enough room to store the compressed output.
+ */
+ z_ret = deflate(z, Z_FINISH);
+ if (z_ret != Z_STREAM_END) {
+ return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION,
+ "zlib deflate error %s (%d) %s (PUSH)",
+ zError(z_ret), z_ret, z->msg);
+ }
+
+ if (z->avail_in) {
+ return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION,
+ "MSZIP not all avail_in[%u] bytes consumed (PUSH)",
+ z->avail_in);
+ }
+
+ comp_chunk_size = 2 + z->total_out;
+ if (comp_chunk_size < z->total_out) {
+ return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION,
+ "strange NDR push compressed size (integer overflow?)");
+ }
+
+ z_ret = deflateReset(z);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "zlib deflateReset error %s (%d) %s (PUSH)",
+ zError(z_ret), z_ret, z->msg);
+ }
+
+ if (plain_chunk.length > talloc_array_length(state->alg.mszip.dict)) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "zlib dict buffer is too big (PUSH)");
+ }
+
+ /*
+ * Keep a copy of the input to set as dictionary for the next
+ * compression call.
+ *
+ * Ideally we would just store the input pointer and length
+ * without copying but the memory gets invalidated between the
+ * calls, so we just copy to a dedicated buffer we now is
+ * still going to been valid for the lifetime of the
+ * compressions state object.
+ */
+ memcpy(state->alg.mszip.dict, plain_chunk.data, plain_chunk.length);
+ state->alg.mszip.dict_size = plain_chunk.length;
+
+ DEBUG(9,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+ (unsigned int)plain_chunk.length,
+ (unsigned int)plain_chunk.length,
+ comp_chunk_size, comp_chunk_size));
+
+ ndrpush->offset += comp_chunk_size;
+ return NDR_ERR_SUCCESS;
+}
+
+
+static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpull,
+ struct ndr_push *ndrpush,
+ z_stream *z,
+ bool *last)
+{
+ 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 z_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(9,("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;
+
+ if (comp_chunk.length < 2) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad MSZIP comp chunk size %u < 2 (PULL)",
+ (unsigned int)comp_chunk.length);
+ }
+ /* CK = Chris Kirmse, official Microsoft purloiner */
+ if (comp_chunk.data[0] != 'C' ||
+ comp_chunk.data[1] != 'K') {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad MSZIP invalid prefix [%c%c] != [CK]",
+ comp_chunk.data[0], comp_chunk.data[1]);
+ }
+
+ z->next_in = comp_chunk.data + 2;
+ z->avail_in = comp_chunk.length -2;
+ z->total_in = 0;
+
+ z->next_out = plain_chunk.data;
+ z->avail_out = plain_chunk.length;
+ z->total_out = 0;
+
+ if (!z->opaque) {
+ /* the first time we need to intialize completely */
+ z->zalloc = ndr_zlib_alloc;
+ z->zfree = ndr_zlib_free;
+ z->opaque = ndrpull;
+
+ z_ret = inflateInit2(z, -MAX_WBITS);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad inflateInit2 error %s(%d) (PULL)",
+ zError(z_ret), z_ret);
+
+ }
+ }
+
+ /* call inflate untill we get Z_STREAM_END or an error */
+ while (true) {
+ z_ret = inflate(z, Z_BLOCK);
+ if (z_ret != Z_OK) break;
+ }
+
+ if (z_ret != Z_STREAM_END) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad inflate(Z_BLOCK) error %s(%d) (PULL)",
+ zError(z_ret), z_ret);
+ }
+
+ if (z->avail_in) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "MSZIP not all avail_in[%u] bytes consumed (PULL)",
+ z->avail_in);
+ }
+
+ if (z->avail_out) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "MSZIP not all avail_out[%u] bytes consumed (PULL)",
+ z->avail_out);
+ }
+
+ if ((plain_chunk_size < 0x00008000) || (ndrpull->offset+4 >= ndrpull->data_size)) {
+ /* this is the last chunk */
+ *last = true;
+ }
+
+ z_ret = inflateReset(z);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad inflateReset error %s(%d) (PULL)",
+ zError(z_ret), z_ret);
+ }
+
+ z_ret = inflateSetDictionary(z, plain_chunk.data, plain_chunk.length);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad inflateSetDictionary error %s(%d) (PULL)",
+ zError(z_ret), z_ret);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpush,
+ struct ndr_pull *ndrpull,
+ z_stream *z,
+ bool *last)
+{
+ DATA_BLOB comp_chunk;
+ uint32_t comp_chunk_size;
+ uint32_t comp_chunk_size_offset;
+ DATA_BLOB plain_chunk;
+ uint32_t plain_chunk_size;
+ uint32_t plain_chunk_offset;
+ uint32_t max_plain_size = 0x00008000;
+ /*
+ * The maximum compressed size of each MSZIP block is 32k + 12 bytes
+ * header size.
+ */
+ uint32_t max_comp_size = 0x00008000 + 12;
+ uint32_t tmp_offset;
+ int z_ret;
+
+ plain_chunk_size = MIN(max_plain_size, ndrpull->data_size - ndrpull->offset);
+ plain_chunk_offset = ndrpull->offset;
+ NDR_CHECK(ndr_pull_advance(ndrpull, plain_chunk_size));
+
+ plain_chunk.data = ndrpull->data + plain_chunk_offset;
+ plain_chunk.length = plain_chunk_size;
+
+ if (plain_chunk_size < max_plain_size) {
+ *last = true;
+ }
+
+ NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, plain_chunk_size));
+ comp_chunk_size_offset = ndrpush->offset;
+ NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, 0xFEFEFEFE));
+
+ NDR_CHECK(ndr_push_expand(ndrpush, max_comp_size));
+
+ comp_chunk.data = ndrpush->data + ndrpush->offset;
+ comp_chunk.length = max_comp_size;
+
+ /* CK = Chris Kirmse, official Microsoft purloiner */
+ comp_chunk.data[0] = 'C';
+ comp_chunk.data[1] = 'K';
+
+ z->next_in = plain_chunk.data;
+ z->avail_in = plain_chunk.length;
+ z->total_in = 0;
+
+ z->next_out = comp_chunk.data + 2;
+ z->avail_out = comp_chunk.length;
+ z->total_out = 0;
+
+ if (!z->opaque) {
+ /* the first time we need to intialize completely */
+ z->zalloc = ndr_zlib_alloc;
+ z->zfree = ndr_zlib_free;
+ z->opaque = ndrpull;
+
+ /* TODO: find how to trigger the same parameters windows uses */
+ z_ret = deflateInit2(z,
+ Z_DEFAULT_COMPRESSION,
+ Z_DEFLATED,
+ -MAX_WBITS,
+ 8, /* memLevel */
+ Z_DEFAULT_STRATEGY);
+ if (z_ret != Z_OK) {
+ return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION,
+ "Bad deflateInit2 error %s(%d) (PUSH)",
+ zError(z_ret), z_ret);
+
+ }
+ }
+
+ /* call deflate untill we get Z_STREAM_END or an error */
+ while (true) {
+ z_ret = deflate(z, Z_FINISH);
+ if (z_ret != Z_OK) break;
+ }
+ if (z_ret != Z_STREAM_END) {
+ return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION,
+ "Bad delate(Z_BLOCK) error %s(%d) (PUSH)",
+ zError(z_ret), z_ret);
+ }
+
+ if (z->avail_in) {
+ return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION,
+ "MSZIP not all avail_in[%u] bytes consumed (PUSH)",
+ z->avail_in);
+ }
+
+ comp_chunk_size = 2 + z->total_out;
+
+ z_ret = deflateReset(z);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad deflateReset error %s(%d) (PULL)",
+ zError(z_ret), z_ret);
+ }
+
+ z_ret = deflateSetDictionary(z, plain_chunk.data, plain_chunk.length);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "Bad deflateSetDictionary error %s(%d) (PULL)",
+ zError(z_ret), z_ret);
+ }
+
+ tmp_offset = ndrpush->offset;
+ ndrpush->offset = comp_chunk_size_offset;
+ NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, comp_chunk_size));
+ ndrpush->offset = tmp_offset;
+
+ DEBUG(9,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+ (unsigned int)plain_chunk.length,
+ (unsigned int)plain_chunk.length,
+ comp_chunk_size, comp_chunk_size));
+
+ ndrpush->offset += comp_chunk_size;
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_compression_xpress_chunk(struct ndr_pull *ndrpull,
+ struct ndr_push *ndrpush,
+ bool *last)
+{
+ DATA_BLOB comp_chunk;
+ DATA_BLOB plain_chunk;
+ uint32_t comp_chunk_offset;
+ uint32_t plain_chunk_offset;
+ uint32_t comp_chunk_size;
+ uint32_t plain_chunk_size;
+ ssize_t ret;
+
+ 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));
+
+ 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;
+
+ DEBUG(9,("XPRESS plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+ plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
+
+ /* Uncompressing the buffer using LZ Xpress algorithm */
+ ret = lzxpress_decompress(comp_chunk.data,
+ comp_chunk.length,
+ plain_chunk.data,
+ plain_chunk.length);
+ if (ret < 0) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "XPRESS lzxpress_decompress() returned %d\n",
+ (int)ret);
+ }
+ plain_chunk.length = ret;
+
+ if ((plain_chunk_size < 0x00010000) || (ndrpull->offset+4 >= ndrpull->data_size)) {
+ /* this is the last chunk */
+ *last = true;
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_push_compression_xpress_chunk(struct ndr_push *ndrpush,
+ struct ndr_pull *ndrpull,
+ bool *last)
+{
+ DATA_BLOB comp_chunk;
+ uint32_t comp_chunk_size_offset;
+ DATA_BLOB plain_chunk;
+ uint32_t plain_chunk_size;
+ uint32_t plain_chunk_offset;
+ uint32_t max_plain_size = 0x00010000;
+ uint32_t max_comp_size = 0x00020000 + 2; /* TODO: use the correct value here */
+ uint32_t tmp_offset;
+ ssize_t ret;
+
+ plain_chunk_size = MIN(max_plain_size, ndrpull->data_size - ndrpull->offset);
+ plain_chunk_offset = ndrpull->offset;
+ NDR_CHECK(ndr_pull_advance(ndrpull, plain_chunk_size));
+
+ plain_chunk.data = ndrpull->data + plain_chunk_offset;
+ plain_chunk.length = plain_chunk_size;
+
+ if (plain_chunk_size < max_plain_size) {
+ *last = true;
+ }
+
+ NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, plain_chunk_size));
+ comp_chunk_size_offset = ndrpush->offset;
+ NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, 0xFEFEFEFE));
+
+ NDR_CHECK(ndr_push_expand(ndrpush, max_comp_size));
+
+ comp_chunk.data = ndrpush->data + ndrpush->offset;
+ comp_chunk.length = max_comp_size;
+
+ /* Compressing the buffer using LZ Xpress algorithm */
+ ret = lzxpress_compress(plain_chunk.data,
+ plain_chunk.length,
+ comp_chunk.data,
+ comp_chunk.length);
+ if (ret < 0) {
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+ "XPRESS lzxpress_compress() returned %d\n",
+ (int)ret);
+ }
+ comp_chunk.length = ret;
+
+ tmp_offset = ndrpush->offset;
+ ndrpush->offset = comp_chunk_size_offset;
+ NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, comp_chunk.length));
+ ndrpush->offset = tmp_offset;
+
+ ndrpush->offset += comp_chunk.length;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ handle compressed subcontext buffers, which in midl land are user-marshalled, but
+ we use magic in pidl to make them easier to cope with
+*/
+enum ndr_err_code ndr_pull_compression_start(struct ndr_pull *subndr,
+ struct ndr_pull **_comndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len,
+ ssize_t compressed_len)
+{
+ struct ndr_push *ndrpush;
+ struct ndr_pull *comndr;
+ DATA_BLOB uncompressed;
+ bool last = false;
+ z_stream z;
+
+ ndrpush = ndr_push_init_ctx(subndr);
+ NDR_ERR_HAVE_NO_MEMORY(ndrpush);
+
+ switch (compression_alg) {
+ case NDR_COMPRESSION_MSZIP_CAB:
+ NDR_CHECK(ndr_pull_compression_mszip_cab_chunk(subndr, ndrpush,
+ subndr->cstate,
+ decompressed_len,
+ compressed_len));
+ break;
+ case NDR_COMPRESSION_MSZIP:
+ ZERO_STRUCT(z);
+ while (!last) {
+ NDR_CHECK(ndr_pull_compression_mszip_chunk(subndr, ndrpush, &z, &last));
+ }
+ break;
+
+ case NDR_COMPRESSION_XPRESS:
+ while (!last) {
+ NDR_CHECK(ndr_pull_compression_xpress_chunk(subndr, ndrpush, &last));
+ }
+ break;
+
+ default:
+ return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad compression algorithm %d (PULL)",
+ compression_alg);
+ }
+
+ uncompressed = ndr_push_blob(ndrpush);
+ if (uncompressed.length != decompressed_len) {
+ return ndr_pull_error(subndr, NDR_ERR_COMPRESSION,
+ "Bad uncompressed_len [%u] != [%u](0x%08X) (PULL)",
+ (int)uncompressed.length,
+ (int)decompressed_len,
+ (int)decompressed_len);
+ }
+
+ comndr = talloc_zero(subndr, struct ndr_pull);
+ NDR_ERR_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 NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_compression_end(struct ndr_pull *subndr,
+ struct ndr_pull *comndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len)
+{
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a compressed subcontext
+*/
+enum ndr_err_code ndr_push_compression_start(struct ndr_push *subndr,
+ struct ndr_push **_uncomndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len)
+{
+ struct ndr_push *uncomndr;
+
+ switch (compression_alg) {
+ case NDR_COMPRESSION_MSZIP_CAB:
+ case NDR_COMPRESSION_MSZIP:
+ case NDR_COMPRESSION_XPRESS:
+ break;
+ default:
+ return ndr_push_error(subndr, NDR_ERR_COMPRESSION,
+ "Bad compression algorithm %d (PUSH)",
+ compression_alg);
+ }
+
+ uncomndr = ndr_push_init_ctx(subndr);
+ NDR_ERR_HAVE_NO_MEMORY(uncomndr);
+ uncomndr->flags = subndr->flags;
+
+ *_uncomndr = uncomndr;
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a compressed subcontext
+*/
+enum ndr_err_code ndr_push_compression_end(struct ndr_push *subndr,
+ struct ndr_push *uncomndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len)
+{
+ struct ndr_pull *ndrpull;
+ bool last = false;
+ z_stream z;
+
+ ndrpull = talloc_zero(uncomndr, struct ndr_pull);
+ NDR_ERR_HAVE_NO_MEMORY(ndrpull);
+ ndrpull->flags = uncomndr->flags;
+ ndrpull->data = uncomndr->data;
+ ndrpull->data_size = uncomndr->offset;
+ ndrpull->offset = 0;
+
+ switch (compression_alg) {
+ case NDR_COMPRESSION_MSZIP_CAB:
+ NDR_CHECK(ndr_push_compression_mszip_cab_chunk(subndr, ndrpull, subndr->cstate));
+ break;
+
+ case NDR_COMPRESSION_MSZIP:
+ ZERO_STRUCT(z);
+ while (!last) {
+ NDR_CHECK(ndr_push_compression_mszip_chunk(subndr, ndrpull, &z, &last));
+ }
+ break;
+
+ case NDR_COMPRESSION_XPRESS:
+ while (!last) {
+ NDR_CHECK(ndr_push_compression_xpress_chunk(subndr, ndrpull, &last));
+ }
+ break;
+
+ default:
+ return ndr_push_error(subndr, NDR_ERR_COMPRESSION, "Bad compression algorithm %d (PUSH)",
+ compression_alg);
+ }
+
+ talloc_free(uncomndr);
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code generic_mszip_init(TALLOC_CTX *mem_ctx,
+ struct ndr_compression_state *state)
+{
+ z_stream *z = talloc_zero(mem_ctx, z_stream);
+ NDR_ERR_HAVE_NO_MEMORY(z);
+
+ z->zalloc = ndr_zlib_alloc;
+ z->zfree = ndr_zlib_free;
+ z->opaque = mem_ctx;
+
+ state->alg.mszip.z = z;
+ state->alg.mszip.dict_size = 0;
+ /* pre-alloc dictionary */
+ state->alg.mszip.dict = talloc_array(mem_ctx, uint8_t, 0x8000);
+ NDR_ERR_HAVE_NO_MEMORY(state->alg.mszip.dict);
+
+ return NDR_ERR_SUCCESS;
+}
+
+static void generic_mszip_free(struct ndr_compression_state *state)
+{
+ if (state == NULL) {
+ return;
+ }
+
+ TALLOC_FREE(state->alg.mszip.z);
+ TALLOC_FREE(state->alg.mszip.dict);
+}
+
+
+enum ndr_err_code ndr_pull_compression_state_init(struct ndr_pull *ndr,
+ enum ndr_compression_alg compression_alg,
+ struct ndr_compression_state **state)
+{
+ struct ndr_compression_state *s;
+ int z_ret;
+
+ s = talloc_zero(ndr, struct ndr_compression_state);
+ NDR_ERR_HAVE_NO_MEMORY(s);
+ s->type = compression_alg;
+
+ switch (compression_alg) {
+ case NDR_COMPRESSION_MSZIP:
+ case NDR_COMPRESSION_XPRESS:
+ break;
+ case NDR_COMPRESSION_MSZIP_CAB:
+ NDR_CHECK(generic_mszip_init(ndr, s));
+ z_ret = inflateInit2(s->alg.mszip.z, -MAX_WBITS);
+ if (z_ret != Z_OK) {
+ return ndr_pull_error(ndr, NDR_ERR_COMPRESSION,
+ "zlib inflateinit2 error %s (%d) %s (PULL)",
+ zError(z_ret), z_ret, s->alg.mszip.z->msg);
+ }
+ break;
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_COMPRESSION,
+ "Bad compression algorithm %d (PULL)",
+ compression_alg);
+ break;
+ }
+
+ *state = s;
+
+ return NDR_ERR_SUCCESS;
+}
+
+void ndr_pull_compression_state_free(struct ndr_compression_state *state)
+{
+ if (state == NULL) {
+ return;
+ }
+
+ switch (state->type) {
+ case NDR_COMPRESSION_MSZIP:
+ case NDR_COMPRESSION_XPRESS:
+ break;
+ case NDR_COMPRESSION_MSZIP_CAB:
+ generic_mszip_free(state);
+ break;
+ default:
+ break;
+ }
+ TALLOC_FREE(state);
+}
+
+enum ndr_err_code ndr_push_compression_state_init(struct ndr_push *ndr,
+ enum ndr_compression_alg compression_alg,
+ struct ndr_compression_state **state)
+{
+ struct ndr_compression_state *s;
+ int z_ret;
+
+ s = talloc_zero(ndr, struct ndr_compression_state);
+ NDR_ERR_HAVE_NO_MEMORY(s);
+ s->type = compression_alg;
+
+ switch (compression_alg) {
+ case NDR_COMPRESSION_XPRESS:
+ case NDR_COMPRESSION_MSZIP:
+ break;
+ case NDR_COMPRESSION_MSZIP_CAB:
+ NDR_CHECK(generic_mszip_init(ndr, s));
+ z_ret = deflateInit2(s->alg.mszip.z,
+ Z_DEFAULT_COMPRESSION,
+ Z_DEFLATED,
+ -MAX_WBITS,
+ 8, /* memLevel */
+ Z_DEFAULT_STRATEGY);
+ if (z_ret != Z_OK) {
+ return ndr_push_error(ndr, NDR_ERR_COMPRESSION,
+ "zlib inflateinit2 error %s (%d) %s (PUSH)",
+ zError(z_ret), z_ret, s->alg.mszip.z->msg);
+ }
+ break;
+ default:
+ return ndr_push_error(ndr, NDR_ERR_COMPRESSION,
+ "Bad compression algorithm %d (PUSH)",
+ compression_alg);
+ break;
+ }
+
+ *state = s;
+
+ return NDR_ERR_SUCCESS;
+}
+
+void ndr_push_compression_state_free(struct ndr_compression_state *state)
+{
+ if (state == NULL) {
+ return;
+ }
+
+ switch (state->type) {
+ case NDR_COMPRESSION_MSZIP:
+ case NDR_COMPRESSION_XPRESS:
+ break;
+ case NDR_COMPRESSION_MSZIP_CAB:
+ generic_mszip_free(state);
+ break;
+ default:
+ break;
+ }
+ TALLOC_FREE(state);
+}
diff --git a/librpc/ndr/ndr_compression.h b/librpc/ndr/ndr_compression.h
new file mode 100644
index 0000000..a67a73e
--- /dev/null
+++ b/librpc/ndr/ndr_compression.h
@@ -0,0 +1,68 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ libndr compression support
+
+ Copyright (C) Stefan Metzmacher 2005
+ Copyright (C) Matthieu Suiche 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __LIBRPC_NDR_NDR_COMPRESSION_H__
+#define __LIBRPC_NDR_NDR_COMPRESSION_H__
+
+#undef _PRINTF_ATTRIBUTE
+#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
+/* This file was automatically generated by mkproto.pl. DO NOT EDIT */
+
+/* this file contains prototypes for functions that are private
+ * to this subsystem or library. These functions should not be
+ * used outside this particular subsystem! */
+
+
+/* The following definitions come from librpc/ndr/ndr_compression.c */
+
+enum ndr_err_code ndr_pull_compression_start(struct ndr_pull *subndr,
+ struct ndr_pull **_comndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len,
+ ssize_t compressed_len);
+enum ndr_err_code ndr_pull_compression_end(struct ndr_pull *subndr,
+ struct ndr_pull *comndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len);
+enum ndr_err_code ndr_push_compression_start(struct ndr_push *subndr,
+ struct ndr_push **_uncomndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len);
+enum ndr_err_code ndr_push_compression_end(struct ndr_push *subndr,
+ struct ndr_push *uncomndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len);
+
+enum ndr_err_code ndr_pull_compression_state_init(struct ndr_pull *ndr,
+ enum ndr_compression_alg compression_alg,
+ struct ndr_compression_state **state);
+void ndr_pull_compression_state_free(struct ndr_compression_state *state);
+enum ndr_err_code ndr_push_compression_state_init(struct ndr_push *ndr,
+ enum ndr_compression_alg compression_alg,
+ struct ndr_compression_state **state);
+void ndr_push_compression_state_free(struct ndr_compression_state *state);
+
+#undef _PRINTF_ATTRIBUTE
+#define _PRINTF_ATTRIBUTE(a1, a2)
+
+#endif /* __LIBRPC_NDR_NDR_COMPRESSION_H__ */
+
diff --git a/librpc/ndr/ndr_dcerpc.c b/librpc/ndr/ndr_dcerpc.c
new file mode 100644
index 0000000..ccb3af5
--- /dev/null
+++ b/librpc/ndr/ndr_dcerpc.c
@@ -0,0 +1,316 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures found in the DCERPC protocol
+
+ Copyright (C) Stefan Metzmacher 2014
+ Copyright (C) Gregor Beck 2014
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+
+_PUBLIC_ enum ndr_err_code ndr_push_ncacn_packet(struct ndr_push *ndr, int ndr_flags, const struct ncacn_packet *r)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->rpc_vers));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->rpc_vers_minor));
+ NDR_CHECK(ndr_push_dcerpc_pkt_type(ndr, NDR_SCALARS, r->ptype));
+ NDR_CHECK(ndr_push_dcerpc_pfc_flags(ndr, NDR_SCALARS, r->pfc_flags));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->drep, 4));
+ if (r->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
+ }
+ if (!(r->drep[0] & DCERPC_DREP_LE)) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->frag_length));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->auth_length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->call_id));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->ptype));
+ NDR_CHECK(ndr_push_dcerpc_payload(ndr, NDR_SCALARS, &r->u));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_ncacn_packet(struct ndr_pull *ndr, int ndr_flags, struct ncacn_packet *r)
+{
+ uint32_t size_drep_0 = 0;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->rpc_vers));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->rpc_vers_minor));
+ NDR_CHECK(ndr_pull_dcerpc_pkt_type(ndr, NDR_SCALARS, &r->ptype));
+ NDR_CHECK(ndr_pull_dcerpc_pfc_flags(ndr, NDR_SCALARS, &r->pfc_flags));
+ size_drep_0 = 4;
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->drep, size_drep_0));
+ if (r->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
+ }
+ if (!(r->drep[0] & DCERPC_DREP_LE)) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->frag_length));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->auth_length));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->call_id));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->ptype));
+ NDR_CHECK(ndr_pull_dcerpc_payload(ndr, NDR_SCALARS, &r->u));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ncacn_packet(struct ndr_print *ndr, const char *name, const struct ncacn_packet *r)
+{
+ ndr_print_struct(ndr, name, "ncacn_packet");
+ if (r == NULL) { ndr_print_null(ndr); return; }
+ ndr->depth++;
+ ndr_print_uint8(ndr, "rpc_vers", r->rpc_vers);
+ ndr_print_uint8(ndr, "rpc_vers_minor", r->rpc_vers_minor);
+ ndr_print_dcerpc_pkt_type(ndr, "ptype", r->ptype);
+ ndr_print_dcerpc_pfc_flags(ndr, "pfc_flags", r->pfc_flags);
+ ndr_print_array_uint8(ndr, "drep", r->drep, 4);
+ if (r->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
+ }
+ if (!(r->drep[0] & DCERPC_DREP_LE)) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+ ndr_print_uint16(ndr, "frag_length", r->frag_length);
+ ndr_print_uint16(ndr, "auth_length", r->auth_length);
+ ndr_print_uint32(ndr, "call_id", r->call_id);
+ ndr_print_set_switch_value(ndr, &r->u, r->ptype);
+ ndr_print_dcerpc_payload(ndr, "u", &r->u);
+ ndr->depth--;
+}
+
+/*
+ * This function was generated by pidl and
+ * has been extended by the (_available == 0) check.
+ *
+ * That's why we ignore the 80 char per line limit.
+ */
+enum ndr_err_code ndr_pull_dcerpc_bind_nak(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_bind_nak *r)
+{
+ uint32_t size_versions_0 = 0;
+ uint32_t cntr_versions_0;
+ TALLOC_CTX *_mem_save_versions_0 = NULL;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t _available;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_dcerpc_bind_nak_reason(ndr, NDR_SCALARS, &r->reject_reason));
+ _available = ndr->data_size - ndr->offset;
+ if (_available == 0) {
+ /*
+ * This works around a bug in older
+ * Samba (<= 4.1) releases.
+ *
+ * See bug #11327.
+ */
+ r->num_versions = 0;
+ } else {
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_versions));
+ }
+ size_versions_0 = r->num_versions;
+ NDR_PULL_ALLOC_N(ndr, r->versions, size_versions_0);
+ _mem_save_versions_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->versions, 0);
+ for (cntr_versions_0 = 0; cntr_versions_0 < (size_versions_0); cntr_versions_0++) {
+ NDR_CHECK(ndr_pull_dcerpc_bind_nak_version(ndr, NDR_SCALARS, &r->versions[cntr_versions_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_versions_0, 0);
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+const uint8_t DCERPC_SEC_VT_MAGIC[] = {0x8a,0xe3,0x13,0x71,0x02,0xf4,0x36,0x71};
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_sec_vt_count(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_sec_vt_count *r)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ /* nothing */
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_sec_vt_count(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_sec_vt_count *r)
+{
+ uint32_t _saved_ofs = ndr->offset;
+
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ r->count = 0;
+
+ while (true) {
+ uint16_t command;
+ uint16_t length;
+
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &command));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &length));
+ NDR_CHECK(ndr_pull_advance(ndr, length));
+
+ r->count += 1;
+
+ if (command & DCERPC_SEC_VT_COMMAND_END) {
+ break;
+ }
+ }
+
+ ndr->offset = _saved_ofs;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pop_dcerpc_sec_verification_trailer(
+ struct ndr_pull *ndr, TALLOC_CTX *mem_ctx,
+ struct dcerpc_sec_verification_trailer **_r)
+{
+ enum ndr_err_code ndr_err;
+ uint32_t ofs;
+ uint32_t min_ofs = 0;
+ struct dcerpc_sec_verification_trailer *r;
+ DATA_BLOB sub_blob = data_blob_null;
+ struct ndr_pull *sub_ndr = NULL;
+ uint32_t remaining;
+
+ *_r = NULL;
+
+ r = talloc_zero(mem_ctx, struct dcerpc_sec_verification_trailer);
+ if (r == NULL) {
+ return NDR_ERR_ALLOC;
+ }
+
+ if (ndr->data_size < sizeof(DCERPC_SEC_VT_MAGIC)) {
+ /*
+ * we return with r->count = 0
+ */
+ *_r = r;
+ return NDR_ERR_SUCCESS;
+ }
+
+ ofs = ndr->data_size - sizeof(DCERPC_SEC_VT_MAGIC);
+ /* the magic is 4 byte aligned */
+ ofs &= ~3;
+
+ if (ofs > DCERPC_SEC_VT_MAX_SIZE) {
+ /*
+ * We just scan the last 1024 bytes.
+ */
+ min_ofs = ofs - DCERPC_SEC_VT_MAX_SIZE;
+ } else {
+ min_ofs = 0;
+ }
+
+ while (true) {
+ int ret;
+
+ ret = memcmp(&ndr->data[ofs],
+ DCERPC_SEC_VT_MAGIC,
+ sizeof(DCERPC_SEC_VT_MAGIC));
+ if (ret == 0) {
+ sub_blob = data_blob_const(&ndr->data[ofs],
+ ndr->data_size - ofs);
+ break;
+ }
+
+ if (ofs <= min_ofs) {
+ break;
+ }
+
+ ofs -= 4;
+ }
+
+ if (sub_blob.length == 0) {
+ /*
+ * we return with r->count = 0
+ */
+ *_r = r;
+ return NDR_ERR_SUCCESS;
+ }
+
+ sub_ndr = ndr_pull_init_blob(&sub_blob, r);
+ if (sub_ndr == NULL) {
+ TALLOC_FREE(r);
+ return NDR_ERR_ALLOC;
+ }
+
+ ndr_err = ndr_pull_dcerpc_sec_verification_trailer(sub_ndr,
+ NDR_SCALARS | NDR_BUFFERS,
+ r);
+ if (ndr_err == NDR_ERR_ALLOC) {
+ TALLOC_FREE(r);
+ return NDR_ERR_ALLOC;
+ }
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ goto ignore_error;
+ }
+
+ remaining = sub_ndr->data_size - sub_ndr->offset;
+ if (remaining > 16) {
+ /*
+ * we expect not more than 16 byte of additional
+ * padding after the verification trailer.
+ */
+ goto ignore_error;
+ }
+
+ /*
+ * We assume that we got a real verification trailer.
+ *
+ * We remove it from the available stub data.
+ */
+ ndr->data_size = ofs;
+
+ TALLOC_FREE(sub_ndr);
+
+ *_r = r;
+ return NDR_ERR_SUCCESS;
+
+ignore_error:
+ TALLOC_FREE(sub_ndr);
+ /*
+ * just ignore the error, it's likely
+ * that the magic we found belongs to
+ * the stub data.
+ *
+ * we return with r->count = 0
+ */
+ ZERO_STRUCTP(r);
+ *_r = r;
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_dcerpc.h b/librpc/ndr/ndr_dcerpc.h
new file mode 100644
index 0000000..1a7c3bd
--- /dev/null
+++ b/librpc/ndr/ndr_dcerpc.h
@@ -0,0 +1,29 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures found in the DCERPC protocol
+
+ Copyright (C) Stefan Metzmacher 2014
+ Copyright (C) Gregor Beck 2014
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+enum ndr_err_code ndr_pop_dcerpc_sec_verification_trailer(
+ struct ndr_pull *ndr, TALLOC_CTX *mem_ctx,
+ struct dcerpc_sec_verification_trailer **_r);
+
+#ifndef NDR_DCERPC_REQUEST_OBJECT_PRESENT
+#define NDR_DCERPC_REQUEST_OBJECT_PRESENT (ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT)
+#endif /* NDR_DCERPC_REQUEST_OBJECT_PRESENT */
diff --git a/librpc/ndr/ndr_dns.c b/librpc/ndr/ndr_dns.c
new file mode 100644
index 0000000..966e0b5
--- /dev/null
+++ b/librpc/ndr/ndr_dns.c
@@ -0,0 +1,327 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ manipulate dns name structures
+
+ Copyright (C) 2010 Kai Blin <kai@samba.org>
+
+ Heavily based on nbtname.c which is:
+
+ Copyright (C) Andrew Tridgell 2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ see rfc1002 for the detailed format of compressed names
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_dns.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/gen_ndr/ndr_dnsp.h"
+#include "system/locale.h"
+#include "lib/util/util_net.h"
+#include "ndr_dns_utils.h"
+
+/* don't allow an unlimited number of name components */
+#define MAX_COMPONENTS 128
+
+/**
+ print a dns string
+*/
+_PUBLIC_ void ndr_print_dns_string(struct ndr_print *ndr,
+ const char *name,
+ const char *s)
+{
+ ndr_print_string(ndr, name, s);
+}
+
+/*
+ pull one component of a dns_string
+*/
+static enum ndr_err_code ndr_pull_component(struct ndr_pull *ndr,
+ uint8_t **component,
+ uint32_t *offset,
+ uint32_t *max_offset)
+{
+ uint8_t len;
+ unsigned int loops = 0;
+ while (loops < 5) {
+ if (*offset >= ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD DNS NAME component, bad offset");
+ }
+ len = ndr->data[*offset];
+ if (len == 0) {
+ *offset += 1;
+ *max_offset = MAX(*max_offset, *offset);
+ *component = NULL;
+ return NDR_ERR_SUCCESS;
+ }
+ if ((len & 0xC0) == 0xC0) {
+ /* its a label pointer */
+ if (1 + *offset >= ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD DNS NAME component, " \
+ "bad label offset");
+ }
+ *max_offset = MAX(*max_offset, *offset + 2);
+ *offset = ((len&0x3F)<<8) | ndr->data[1 + *offset];
+ *max_offset = MAX(*max_offset, *offset);
+ loops++;
+ continue;
+ }
+ if ((len & 0xC0) != 0) {
+ /* its a reserved length field */
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD DNS NAME component, " \
+ "reserved length field: 0x%02x",
+ (len &0xC));
+ }
+ if (*offset + len + 1 > ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD DNS NAME component, "\
+ "length too long");
+ }
+ *component = (uint8_t*)talloc_strndup(ndr,
+ (const char *)&ndr->data[1 + *offset], len);
+ NDR_ERR_HAVE_NO_MEMORY(*component);
+ *offset += len + 1;
+ *max_offset = MAX(*max_offset, *offset);
+ return NDR_ERR_SUCCESS;
+ }
+
+ /* too many pointers */
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD DNS NAME component, too many pointers");
+}
+
+/**
+ pull a dns_string from the wire
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_dns_string(struct ndr_pull *ndr,
+ int ndr_flags,
+ const char **s)
+{
+ uint32_t offset = ndr->offset;
+ uint32_t max_offset = offset;
+ unsigned num_components;
+ char *name;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ name = talloc_strdup(ndr->current_mem_ctx, "");
+
+ /* break up name into a list of components */
+ for (num_components=0; num_components<MAX_COMPONENTS;
+ num_components++) {
+ uint8_t *component = NULL;
+ NDR_CHECK(ndr_pull_component(ndr, &component, &offset,
+ &max_offset));
+ if (component == NULL) break;
+ if (num_components > 0) {
+ name = talloc_asprintf_append_buffer(name, ".%s",
+ component);
+ } else {
+ name = talloc_asprintf_append_buffer(name, "%s",
+ component);
+ }
+ NDR_ERR_HAVE_NO_MEMORY(name);
+ }
+ if (num_components == MAX_COMPONENTS) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD DNS NAME too many components");
+ }
+
+ (*s) = name;
+ ndr->offset = max_offset;
+
+ return NDR_ERR_SUCCESS;
+}
+
+/**
+ push a dns string to the wire
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_dns_string(struct ndr_push *ndr,
+ int ndr_flags,
+ const char *s)
+{
+ return ndr_push_dns_string_list(ndr,
+ &ndr->dns_string_list,
+ ndr_flags,
+ s,
+ false);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dns_txt_record(struct ndr_pull *ndr, int ndr_flags, struct dns_txt_record *r)
+{
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ enum ndr_err_code ndr_err;
+ uint32_t data_size = ndr->data_size;
+ uint32_t record_size = 0;
+ ndr_err = ndr_token_retrieve(&ndr->array_size_list, r,
+ &record_size);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NDR_PULL_NEED_BYTES(ndr, record_size);
+ ndr->data_size = ndr->offset + record_size;
+ }
+ NDR_CHECK(ndr_pull_align(ndr, 1));
+ NDR_CHECK(ndr_pull_dnsp_string_list(ndr, NDR_SCALARS, &r->txt));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 1));
+ ndr->data_size = data_size;
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dns_res_rec(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct dns_res_rec *r)
+{
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ uint32_t _saved_offset1, _saved_offset2;
+ uint16_t length;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX |
+ LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t _flags_save_name = ndr->flags;
+
+ NDR_CHECK(ndr_push_align(ndr, 4));
+
+ switch (r->rr_type) {
+ case DNS_QTYPE_TKEY:
+ case DNS_QTYPE_TSIG:
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NO_COMPRESSION);
+ break;
+ default:
+ break;
+ }
+ NDR_CHECK(ndr_push_dns_string(ndr, NDR_SCALARS, r->name));
+ ndr->flags = _flags_save_name;
+
+ NDR_CHECK(ndr_push_dns_qtype(ndr, NDR_SCALARS, r->rr_type));
+ NDR_CHECK(ndr_push_dns_qclass(ndr, NDR_SCALARS, r->rr_class));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ttl));
+ _saved_offset1 = ndr->offset;
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 0));
+ if (r->length > 0) {
+ uint32_t _saved_offset3;
+
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->rdata,
+ r->rr_type));
+ _saved_offset3 = ndr->offset;
+ NDR_CHECK(ndr_push_dns_rdata(ndr, NDR_SCALARS,
+ &r->rdata));
+ if ((ndr->offset != _saved_offset3) &&
+ (r->unexpected.length > 0)) {
+ /*
+ * ndr_push_dns_rdata pushed a known
+ * record, but we have something
+ * unexpected. That's invalid.
+ */
+ return ndr_push_error(ndr,
+ NDR_ERR_LENGTH,
+ "Invalid...Unexpected " \
+ "blob length is too " \
+ "large");
+ }
+ }
+ if (r->unexpected.length > UINT16_MAX) {
+ return ndr_push_error(ndr, NDR_ERR_LENGTH,
+ "Unexpected blob length "\
+ "is too large");
+ }
+
+ NDR_CHECK(ndr_push_bytes(ndr, r->unexpected.data,
+ r->unexpected.length));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ length = ndr->offset - (_saved_offset1 + 2);
+ _saved_offset2 = ndr->offset;
+ ndr->offset = _saved_offset1;
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, length));
+ ndr->offset = _saved_offset2;
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_dns_rdata(ndr, NDR_BUFFERS,
+ &r->rdata));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dns_res_rec(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct dns_res_rec *r)
+{
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ uint32_t _saved_offset1;
+ uint32_t pad, length;
+
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX |
+ LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_dns_string(ndr, NDR_SCALARS, &r->name));
+ NDR_CHECK(ndr_pull_dns_qtype(ndr, NDR_SCALARS, &r->rr_type));
+ NDR_CHECK(ndr_pull_dns_qclass(ndr, NDR_SCALARS, &r->rr_class));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ttl));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
+ _saved_offset1 = ndr->offset;
+ if (r->length > 0) {
+ NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list,
+ &r->rdata,
+ r->length));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->rdata,
+ r->rr_type));
+ NDR_CHECK(ndr_pull_dns_rdata(ndr, NDR_SCALARS,
+ &r->rdata));
+ } else {
+ ZERO_STRUCT(r->rdata);
+ }
+ length = ndr->offset - _saved_offset1;
+ if (length > r->length) {
+ return ndr_pull_error(ndr, NDR_ERR_LENGTH, "TODO");
+ }
+
+ r->unexpected = data_blob_null;
+ pad = r->length - length;
+ if (pad > 0) {
+ NDR_PULL_NEED_BYTES(ndr, pad);
+ r->unexpected = data_blob_talloc(ndr->current_mem_ctx,
+ ndr->data +
+ ndr->offset,
+ pad);
+ if (r->unexpected.data == NULL) {
+ return ndr_pull_error(ndr,
+ NDR_ERR_ALLOC,
+ "Failed to allocate a " \
+ "data blob");
+ }
+ ndr->offset += pad;
+ }
+
+
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_dns_rdata(ndr, NDR_BUFFERS, &r->rdata));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_dns.h b/librpc/ndr/ndr_dns.h
new file mode 100644
index 0000000..16bf11b
--- /dev/null
+++ b/librpc/ndr/ndr_dns.h
@@ -0,0 +1,40 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ manipulate dns name structures
+
+ Copyright (C) 2010 Kai Blin <kai@samba.org>
+
+ Heavily based on nbtname.c which is:
+
+ Copyright (C) Andrew Tridgell 2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+void ndr_print_dns_string(struct ndr_print *ndr,
+ const char *name,
+ const char *s);
+enum ndr_err_code ndr_pull_dns_string(struct ndr_pull *ndr,
+ int ndr_flags,
+ const char **s);
+enum ndr_err_code ndr_push_dns_string(struct ndr_push *ndr,
+ int ndr_flags,
+ const char *s);
+enum ndr_err_code ndr_push_dns_res_rec(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct dns_res_rec *r);
+enum ndr_err_code ndr_pull_dns_res_rec(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct dns_res_rec *r);
diff --git a/librpc/ndr/ndr_dns_utils.c b/librpc/ndr/ndr_dns_utils.c
new file mode 100644
index 0000000..325d9c6
--- /dev/null
+++ b/librpc/ndr/ndr_dns_utils.c
@@ -0,0 +1,134 @@
+#include "includes.h"
+#include "../librpc/ndr/libndr.h"
+#include "ndr_dns_utils.h"
+
+
+/**
+ push a dns/nbt string list to the wire
+*/
+enum ndr_err_code ndr_push_dns_string_list(struct ndr_push *ndr,
+ struct ndr_token_list *string_list,
+ int ndr_flags,
+ const char *s,
+ bool is_nbt)
+{
+ const char *start = s;
+ bool use_compression;
+ size_t max_length;
+ if (is_nbt) {
+ use_compression = true;
+ /*
+ * Max length is longer in NBT/Wins, because Windows counts
+ * the semi-decompressed size of the netbios name (16 bytes)
+ * rather than the wire size of 32, which is what you'd expect
+ * if it followed RFC1002 (it uses the short form in
+ * [MS-WINSRA]). In other words the maximum size of the
+ * "scope" is 237, not 221.
+ *
+ * We make the size limit slightly larger than 255 + 16,
+ * because the 237 scope limit is already enforced in the
+ * winsserver code with a specific return value; bailing out
+ * here would muck with that.
+ */
+ max_length = 274;
+ } else {
+ use_compression = !(ndr->flags & LIBNDR_FLAG_NO_COMPRESSION);
+ max_length = 255;
+ }
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ while (s && *s) {
+ enum ndr_err_code ndr_err;
+ char *compname;
+ size_t complen;
+ uint32_t offset;
+
+ if (use_compression) {
+ /* see if we have pushed the remaining string already,
+ * if so we use a label pointer to this string
+ */
+ ndr_err = ndr_token_retrieve_cmp_fn(string_list, s,
+ &offset,
+ (comparison_fn_t)strcmp,
+ false);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ uint8_t b[2];
+
+ if (offset > 0x3FFF) {
+ return ndr_push_error(ndr, NDR_ERR_STRING,
+ "offset for dns string " \
+ "label pointer " \
+ "%u[%08X] > 0x00003FFF",
+ offset, offset);
+ }
+
+ b[0] = 0xC0 | (offset>>8);
+ b[1] = (offset & 0xFF);
+
+ return ndr_push_bytes(ndr, b, 2);
+ }
+ }
+
+ complen = strcspn(s, ".");
+
+ /* the length must fit into 6 bits (i.e. <= 63) */
+ if (complen > 0x3F) {
+ return ndr_push_error(ndr, NDR_ERR_STRING,
+ "component length %u[%08X] > " \
+ "0x0000003F",
+ (unsigned)complen,
+ (unsigned)complen);
+ }
+
+ if (complen == 0 && s[complen] == '.') {
+ return ndr_push_error(ndr, NDR_ERR_STRING,
+ "component length is 0 "
+ "(consecutive dots)");
+ }
+
+ if (is_nbt && s[complen] == '.' && s[complen + 1] == '\0') {
+ /* nbt names are sometimes usernames, and we need to
+ * keep a trailing dot to ensure it is byte-identical,
+ * (not just semantically identical given DNS
+ * semantics). */
+ complen++;
+ }
+
+ compname = talloc_asprintf(ndr, "%c%*.*s",
+ (unsigned char)complen,
+ (unsigned char)complen,
+ (unsigned char)complen, s);
+ NDR_ERR_HAVE_NO_MEMORY(compname);
+
+ /* remember the current component + the rest of the string
+ * so it can be reused later
+ */
+ if (use_compression) {
+ NDR_CHECK(ndr_token_store(ndr, string_list, s,
+ ndr->offset));
+ }
+
+ /* push just this component into the blob */
+ NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)compname,
+ complen+1));
+ talloc_free(compname);
+
+ s += complen;
+ if (*s == '.') {
+ s++;
+ }
+ if (s - start > max_length) {
+ return ndr_push_error(ndr, NDR_ERR_STRING,
+ "name > %zu character long",
+ max_length);
+ }
+ }
+
+ /* if we reach the end of the string and have pushed the last component
+ * without using a label pointer, we need to terminate the string
+ */
+ return ndr_push_bytes(ndr, (const uint8_t *)"", 1);
+}
diff --git a/librpc/ndr/ndr_dns_utils.h b/librpc/ndr/ndr_dns_utils.h
new file mode 100644
index 0000000..71a6543
--- /dev/null
+++ b/librpc/ndr/ndr_dns_utils.h
@@ -0,0 +1,6 @@
+
+enum ndr_err_code ndr_push_dns_string_list(struct ndr_push *ndr,
+ struct ndr_token_list *string_list,
+ int ndr_flags,
+ const char *s,
+ bool is_nbt);
diff --git a/librpc/ndr/ndr_dnsp.c b/librpc/ndr/ndr_dnsp.c
new file mode 100644
index 0000000..d75c58f
--- /dev/null
+++ b/librpc/ndr/ndr_dnsp.c
@@ -0,0 +1,263 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures found in DNSP
+
+ Copyright (C) Andrew Tridgell 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_dnsp.h"
+
+/*
+ print a dnsp_name
+*/
+_PUBLIC_ void ndr_print_dnsp_name(struct ndr_print *ndr, const char *name,
+ const char *dns_name)
+{
+ ndr->print(ndr, "%-25s: %s", name, dns_name);
+}
+
+/*
+ pull a dnsp_name
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_dnsp_name(struct ndr_pull *ndr, int ndr_flags, const char **name)
+{
+ uint8_t len, count, termination;
+ int i;
+ uint32_t total_len, raw_offset;
+ char *ret;
+
+ NDR_CHECK(ndr_pull_uint8(ndr, ndr_flags, &len));
+ NDR_CHECK(ndr_pull_uint8(ndr, ndr_flags, &count));
+
+ raw_offset = ndr->offset;
+
+ ret = talloc_strdup(ndr->current_mem_ctx, "");
+ if (!ret) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_name");
+ }
+ total_len = 1;
+
+ for (i=0; i<count; i++) {
+ uint8_t sublen, newlen;
+ NDR_CHECK(ndr_pull_uint8(ndr, ndr_flags, &sublen));
+ newlen = total_len + sublen;
+ if (newlen < total_len) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE,
+ "Failed to pull dnsp_name");
+ }
+ if (i != count-1) {
+ if (newlen == UINT8_MAX) {
+ return ndr_pull_error(
+ ndr, NDR_ERR_RANGE,
+ "Failed to pull dnsp_name");
+ }
+ newlen++; /* for the '.' */
+ }
+ ret = talloc_realloc(ndr->current_mem_ctx, ret, char, newlen);
+ if (!ret) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_name");
+ }
+ NDR_CHECK(ndr_pull_bytes(ndr, (uint8_t *)&ret[total_len-1], sublen));
+ if (i != count-1) {
+ ret[newlen-2] = '.';
+ }
+ ret[newlen-1] = 0;
+ total_len = newlen;
+ }
+ NDR_CHECK(ndr_pull_uint8(ndr, ndr_flags, &termination));
+ if (termination != 0) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_name - not NUL terminated");
+ }
+ if (ndr->offset > raw_offset + len) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_name - overrun by %u bytes",
+ ndr->offset - (raw_offset + len));
+ }
+ /* there could be additional pad bytes */
+ while (ndr->offset < raw_offset + len) {
+ uint8_t pad;
+ NDR_CHECK(ndr_pull_uint8(ndr, ndr_flags, &pad));
+ }
+ (*name) = ret;
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_dnsp_name(struct ndr_push *ndr, int ndr_flags, const char *name)
+{
+ int count, total_len, i;
+
+ /* count the dots */
+ for (count=i=0; name[i]; i++) {
+ if (name[i] == '.') count++;
+ }
+ total_len = strlen(name) + 1;
+
+ /*
+ * cope with names ending in '.'
+ */
+ if (name[0] == '\0') {
+ /*
+ * Don't access name[-1] for the "" input, which has
+ * the same meaning as a lone '.'.
+ *
+ * This allows a round-trip of a dnsRecord from
+ * Windows of a MX record of '.'
+ */
+ } else if (name[strlen(name)-1] != '.') {
+ total_len++;
+ count++;
+ }
+ if (total_len > 255 || count > 255) {
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
+ "dns_name of length %d larger than 255", total_len);
+ }
+ NDR_CHECK(ndr_push_uint8(ndr, ndr_flags, (uint8_t)total_len));
+ NDR_CHECK(ndr_push_uint8(ndr, ndr_flags, (uint8_t)count));
+ for (i=0; i<count; i++) {
+ const char *p = strchr(name, '.');
+ size_t sublen = p?(p-name):strlen(name);
+ NDR_CHECK(ndr_push_uint8(ndr, ndr_flags, (uint8_t)sublen));
+ NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)name, sublen));
+ name += sublen + 1;
+ }
+ NDR_CHECK(ndr_push_uint8(ndr, ndr_flags, 0));
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ print a dnsp_string
+*/
+_PUBLIC_ void ndr_print_dnsp_string(struct ndr_print *ndr, const char *name,
+ const char *dns_string)
+{
+ ndr->print(ndr, "%-25s: %s", name, dns_string);
+}
+
+/*
+ pull a dnsp_string
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_dnsp_string(struct ndr_pull *ndr, int ndr_flags, const char **string)
+{
+ uint8_t len;
+ char *ret;
+
+ NDR_CHECK(ndr_pull_uint8(ndr, ndr_flags, &len));
+
+ ret = talloc_zero_array(ndr->current_mem_ctx, char, len + 1);
+ if (!ret) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_string");
+ }
+ NDR_CHECK(ndr_pull_bytes(ndr, (uint8_t *)ret, len));
+
+ (*string) = ret;
+ NDR_PULL_ALIGN(ndr, 1);
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_dnsp_string(struct ndr_push *ndr, int ndr_flags, const char *string)
+{
+ int total_len;
+ total_len = strlen(string);
+ if (total_len > 255) {
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
+ "dns_name of length %d larger than 255", total_len);
+ }
+ NDR_CHECK(ndr_push_uint8(ndr, ndr_flags, (uint8_t)total_len));
+ NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)string, total_len));
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ * print a dnsp_string_list
+ */
+_PUBLIC_ void ndr_print_dnsp_string_list(struct ndr_print *ndr, const char *name,
+ const struct dnsp_string_list *list)
+{
+ uint32_t i;
+
+ ndr->no_newline = true;
+ for (i=0; i<ndr->depth; i++) {
+ ndr->print(ndr, " ");
+ }
+ ndr->print(ndr, "%-25s:", name);
+ for (i=0; i<list->count; i++) {
+ ndr->print(ndr, " \"%s\"", list->str[i]);
+ }
+ ndr->print(ndr, "\n");
+ ndr->no_newline = false;
+}
+
+/*
+ * pull a dnsp_string_list
+ */
+_PUBLIC_ enum ndr_err_code ndr_pull_dnsp_string_list(struct ndr_pull *ndr, int ndr_flags, struct dnsp_string_list *list)
+{
+ list->count = 0;
+ list->str = talloc_array(ndr->current_mem_ctx, const char *,
+ list->count);
+ if (! list->str) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_string_list");
+ }
+
+ while (ndr->offset < ndr->data_size) {
+ list->str = talloc_realloc(ndr->current_mem_ctx, list->str,
+ const char *, list->count+1);
+ if (! list->str) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_string_list");
+ }
+ NDR_CHECK(ndr_pull_dnsp_string(ndr, ndr_flags, &list->str[list->count]));
+ list->count++;
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_dnsp_string_list(struct ndr_push *ndr, int ndr_flags, const struct dnsp_string_list *list)
+{
+ uint8_t i;
+
+ for (i=0; i<list->count; i++) {
+ NDR_CHECK(ndr_push_dnsp_string(ndr, ndr_flags, list->str[i]));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_dnsp_string_list_copy(TALLOC_CTX *mem_ctx,
+ const struct dnsp_string_list *src,
+ struct dnsp_string_list *dst)
+{
+ size_t i;
+
+ dst->count = 0;
+ dst->str = talloc_zero_array(mem_ctx, const char *, src->count);
+ if (dst->str == NULL) {
+ return NDR_ERR_ALLOC;
+ }
+
+ for (i = 0; i < src->count; i++) {
+ dst->str[i] = talloc_strdup(dst->str, src->str[i]);
+ if (dst->str[i] == NULL) {
+ TALLOC_FREE(dst->str);
+ return NDR_ERR_ALLOC;
+ }
+ }
+
+ dst->count = src->count;
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_dnsp.h b/librpc/ndr/ndr_dnsp.h
new file mode 100644
index 0000000..0d56633
--- /dev/null
+++ b/librpc/ndr/ndr_dnsp.h
@@ -0,0 +1,33 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures found in the DNSP IDL
+
+ Copyright (C) Andrew Tridgell 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+void ndr_print_dnsp_name(struct ndr_print *ndr, const char *name,
+ const char *dns_name);
+enum ndr_err_code ndr_pull_dnsp_name(struct ndr_pull *ndr, int ndr_flags, const char **name);
+enum ndr_err_code ndr_push_dnsp_name(struct ndr_push *ndr, int ndr_flags, const char *name);
+void ndr_print_dnsp_string(struct ndr_print *ndr, const char *name,
+ const char *dns_string);
+enum ndr_err_code ndr_pull_dnsp_string(struct ndr_pull *ndr, int ndr_flags, const char **string);
+enum ndr_err_code ndr_push_dnsp_string(struct ndr_push *ndr, int ndr_flags, const char *string);
+
+enum ndr_err_code ndr_dnsp_string_list_copy(TALLOC_CTX *mem_ctx,
+ const struct dnsp_string_list *src,
+ struct dnsp_string_list *dst);
diff --git a/librpc/ndr/ndr_dnsserver.c b/librpc/ndr/ndr_dnsserver.c
new file mode 100644
index 0000000..3201f04
--- /dev/null
+++ b/librpc/ndr/ndr_dnsserver.c
@@ -0,0 +1,100 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures for DNSSERVER
+
+ Copyright (C) Amitay Isaacs 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_dnsp.h"
+#include "librpc/gen_ndr/ndr_dnsserver.h"
+
+/*
+ * parsing DNS_RPC_RECORDS_ARRAY
+ */
+
+enum ndr_err_code ndr_pull_DNS_RPC_RECORDS_ARRAY(struct ndr_pull *ndr,
+ int ndr_flags, struct DNS_RPC_RECORDS_ARRAY *rec)
+{
+ rec->count = 0;
+ rec->rec = talloc_array(ndr->current_mem_ctx, struct DNS_RPC_RECORDS, rec->count);
+ if (! rec->rec) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull DNS_RPC_RECORDS_ARRAY");
+ }
+
+ while (ndr->offset < ndr->data_size) {
+ rec->rec = talloc_realloc(ndr->current_mem_ctx, rec->rec, struct DNS_RPC_RECORDS, rec->count+1);
+ if (! rec->rec) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull DNS_RPC_RECORDS_ARRAY");
+ }
+ NDR_CHECK(ndr_pull_DNS_RPC_RECORDS(ndr, ndr_flags, &rec->rec[rec->count]));
+ NDR_PULL_ALIGN(ndr, 4);
+ rec->count++;
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_DNS_RPC_RECORDS_ARRAY(struct ndr_push *ndr,
+ int ndr_flags, const struct DNS_RPC_RECORDS_ARRAY *rec)
+{
+ int i;
+
+ for (i=0; i<rec->count; i++) {
+ NDR_CHECK(ndr_push_DNS_RPC_RECORDS(ndr, ndr_flags, &rec->rec[i]));
+ NDR_PUSH_ALIGN(ndr, 4);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ * Parsing of DNS_RPC_RECORD_STRING
+ */
+
+enum ndr_err_code ndr_pull_DNS_RPC_RECORD_STRING(struct ndr_pull *ndr,
+ int ndr_flags, struct DNS_RPC_RECORD_STRING *rec)
+{
+ rec->count = 0;
+ rec->str = talloc_array(ndr->current_mem_ctx, struct DNS_RPC_NAME, rec->count);
+ if (! rec->str) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull DNS_RPC_RECORD_STRING");
+ }
+
+ while (ndr->offset < ndr->data_size) {
+ rec->str = talloc_realloc(ndr->current_mem_ctx, rec->str, struct DNS_RPC_NAME, rec->count+1);
+ if (! rec->str) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull DNS_RPC_RECORD_STRING");
+ }
+ NDR_CHECK(ndr_pull_DNS_RPC_NAME(ndr, ndr_flags, &rec->str[rec->count]));
+ rec->count++;
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_DNS_RPC_RECORD_STRING(struct ndr_push *ndr,
+ int ndr_flags, const struct DNS_RPC_RECORD_STRING *rec)
+{
+ int i;
+
+ for (i=0; i<rec->count; i++) {
+ NDR_CHECK(ndr_push_DNS_RPC_NAME(ndr, ndr_flags, &rec->str[i]));
+ }
+
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_dnsserver.h b/librpc/ndr/ndr_dnsserver.h
new file mode 100644
index 0000000..68eb863
--- /dev/null
+++ b/librpc/ndr/ndr_dnsserver.h
@@ -0,0 +1,25 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures for DNSSERVER
+
+ Copyright (C) Amitay Isaacs 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+enum ndr_err_code ndr_pull_DNS_RPC_RECORDS_ARRAY(struct ndr_pull *ndr,
+ int ndr_flags, struct DNS_RPC_RECORDS_ARRAY *rec);
+enum ndr_err_code ndr_push_DNS_RPC_RECORDS_ARRAY(struct ndr_push *ndr,
+ int ndr_flags, const struct DNS_RPC_RECORDS_ARRAY *rec);
diff --git a/librpc/ndr/ndr_drsblobs.c b/librpc/ndr/ndr_drsblobs.c
new file mode 100644
index 0000000..b0d3f50
--- /dev/null
+++ b/librpc/ndr/ndr_drsblobs.c
@@ -0,0 +1,220 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures found in the DRS protocol
+
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
+ Copyright (C) Guenther Deschner <gd@samba.org> 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "../lib/util/asn1.h"
+
+_PUBLIC_ enum ndr_err_code ndr_push_AuthenticationInformationArray(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformationArray *r)
+{
+ uint32_t cntr_array_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ for (cntr_array_0 = 0; cntr_array_0 < r->count; cntr_array_0++) {
+ NDR_CHECK(ndr_push_AuthenticationInformation(ndr, NDR_SCALARS, &r->array[cntr_array_0]));
+ }
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_AuthenticationInformationArray(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformationArray *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ r->count = 0;
+ NDR_PULL_ALLOC_N(ndr, r->array, r->count);
+ /* entry is at least 16 bytes large */
+ while (ndr->offset + 16 <= ndr->data_size) {
+ r->array = talloc_realloc(ndr, r->array, struct AuthenticationInformation, r->count + 1);
+ NDR_ERR_HAVE_NO_MEMORY(r->array);
+ NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_SCALARS, &r->array[r->count]));
+ r->count++;
+ }
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_trustAuthInOutBlob(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutBlob *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (r->count > 0)?12:0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, 0):0));
+ {
+ struct ndr_push *_ndr_current;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_current, 0, ((r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, 0):0) - ((r->count > 0)?12:0)));
+ NDR_CHECK(ndr_push_AuthenticationInformationArray(_ndr_current, NDR_SCALARS, &r->current));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_current, 0, ((r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, 0):0) - ((r->count > 0)?12:0)));
+ }
+ {
+ uint32_t _flags_save_AuthenticationInformationArray = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ {
+ struct ndr_push *_ndr_previous;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_previous, 0, -1));
+ NDR_CHECK(ndr_push_AuthenticationInformationArray(_ndr_previous, NDR_SCALARS, &r->previous));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_previous, 0, -1));
+ }
+ ndr->flags = _flags_save_AuthenticationInformationArray;
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+
+_PUBLIC_ enum ndr_err_code ndr_pull_trustDomainPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustDomainPasswords *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t offset;
+ NDR_PULL_ALIGN(ndr, 4);
+ NDR_PULL_NEED_BYTES(ndr, 8);
+
+ offset = ndr->offset;
+ ndr->offset = ndr->data_size - 8;
+
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->outgoing_size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->incoming_size));
+
+ ndr->offset = offset;
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->confounder, 512));
+ {
+ struct ndr_pull *_ndr_outgoing;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_outgoing, 0, r->outgoing_size));
+ NDR_CHECK(ndr_pull_trustAuthInOutBlob(_ndr_outgoing, NDR_SCALARS|NDR_BUFFERS, &r->outgoing));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_outgoing, 0, r->outgoing_size));
+ }
+ {
+ struct ndr_pull *_ndr_incoming;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_incoming, 0, r->incoming_size));
+ NDR_CHECK(ndr_pull_trustAuthInOutBlob(_ndr_incoming, NDR_SCALARS|NDR_BUFFERS, &r->incoming));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_incoming, 0, r->incoming_size));
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->outgoing_size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->incoming_size));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_drsuapi_MSPrefixMap_Entry(struct ndr_print *ndr, const char *name, const struct drsuapi_MSPrefixMap_Entry *r)
+{
+ ndr_print_struct(ndr, name, "drsuapi_MSPrefixMap_Entry");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ ndr->depth++;
+ ndr_print_uint16(ndr, "entryID", r->entryID);
+ ndr->print(ndr, "%-25s: length=%u", "oid", r->length);
+ if (r->binary_oid) {
+ char *partial_oid = NULL;
+ DATA_BLOB oid_blob = data_blob_const(r->binary_oid, r->length);
+ char *hex_str = data_blob_hex_string_upper(ndr, &oid_blob);
+ ber_read_partial_OID_String(ndr, oid_blob, &partial_oid);
+ ndr->depth++;
+ ndr->print(ndr, "%-25s: 0x%s (%s)", "binary_oid", hex_str, partial_oid);
+ ndr->depth--;
+ talloc_free(hex_str);
+ talloc_free(partial_oid);
+ }
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_supplementalCredentialsSubBlob(struct ndr_push *ndr, int ndr_flags, const struct supplementalCredentialsSubBlob *r)
+{
+ uint32_t cntr_packages_0;
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ if ((r->signature != SUPPLEMENTAL_CREDENTIALS_SIGNATURE)
+ && (r->num_packages == 0)) {
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_push_align(ndr, 3));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, SUPPLEMENTAL_CREDENTIALS_PREFIX, 0x30, sizeof(uint16_t), CH_UTF16));
+ NDR_CHECK(ndr_push_supplementalCredentialsSignature(ndr, NDR_SCALARS, SUPPLEMENTAL_CREDENTIALS_SIGNATURE));
+ if (r->num_packages > 0) {
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_packages));
+ }
+ for (cntr_packages_0 = 0; cntr_packages_0 < (r->num_packages); cntr_packages_0++) {
+ NDR_CHECK(ndr_push_supplementalCredentialsPackage(ndr, NDR_SCALARS, &r->packages[cntr_packages_0]));
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 3));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_supplementalCredentialsSubBlob(struct ndr_pull *ndr, int ndr_flags, struct supplementalCredentialsSubBlob *r)
+{
+ uint32_t size_prefix_0 = 0;
+ uint32_t size_packages_0 = 0;
+ uint32_t cntr_packages_0;
+ TALLOC_CTX *_mem_save_packages_0 = NULL;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t remaining = 0;
+ NDR_CHECK(ndr_pull_align(ndr, 3));
+ size_prefix_0 = 0x30;
+ remaining = ndr->data_size - ndr->offset;
+ if (remaining >= size_prefix_0) {
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->prefix, size_prefix_0, sizeof(uint16_t), CH_UTF16));
+ } else {
+ r->prefix = NULL;
+ }
+ remaining = ndr->data_size - ndr->offset;
+ if (remaining >= 2) {
+ NDR_CHECK(ndr_pull_supplementalCredentialsSignature(ndr, NDR_SCALARS, &r->signature));
+ } else {
+ r->signature = 0;
+ }
+ remaining = ndr->data_size - ndr->offset;
+ if (remaining > 0) {
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_packages));
+ } else {
+ r->num_packages = 0;
+ }
+ size_packages_0 = r->num_packages;
+ NDR_PULL_ALLOC_N(ndr, r->packages, size_packages_0);
+ _mem_save_packages_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->packages, 0);
+ for (cntr_packages_0 = 0; cntr_packages_0 < (size_packages_0); cntr_packages_0++) {
+ NDR_CHECK(ndr_pull_supplementalCredentialsPackage(ndr, NDR_SCALARS, &r->packages[cntr_packages_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_packages_0, 0);
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 3));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_drsblobs.h b/librpc/ndr/ndr_drsblobs.h
new file mode 100644
index 0000000..eb7993c
--- /dev/null
+++ b/librpc/ndr/ndr_drsblobs.h
@@ -0,0 +1,23 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures found in the DRS protocol
+
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+_PUBLIC_ enum ndr_err_code ndr_pull_trustDomainPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustDomainPasswords *r);
+_PUBLIC_ void ndr_print_drsuapi_MSPrefixMap_Entry(struct ndr_print *ndr, const char *name, const struct drsuapi_MSPrefixMap_Entry *r);
diff --git a/librpc/ndr/ndr_drsuapi.c b/librpc/ndr/ndr_drsuapi.c
new file mode 100644
index 0000000..cda2e2c
--- /dev/null
+++ b/librpc/ndr/ndr_drsuapi.c
@@ -0,0 +1,569 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for printing some linked list structs in DRSUAPI
+
+ Copyright (C) Stefan (metze) Metzmacher 2005
+ Copyright (C) Matthieu Patou 2013
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_drsuapi.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "../lib/util/asn1.h"
+#include "librpc/ndr/ndr_compression.h"
+/* We don't need multibyte if we're just comparing to 'ff' */
+#undef strncasecmp
+
+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, "is_nc_prefix", r->is_nc_prefix);
+ 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);
+ }
+}
+
+_PUBLIC_ void ndr_print_drsuapi_DsReplicaOID(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaOID *r)
+{
+ ndr_print_struct(ndr, name, "drsuapi_DsReplicaOID");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "length", r->length);
+ ndr->print(ndr, "%-25s: length=%u", "oid", r->length);
+ if (r->binary_oid) {
+ char *partial_oid = NULL;
+ DATA_BLOB oid_blob = data_blob_const(r->binary_oid, r->length);
+ char *hex_str = data_blob_hex_string_upper(ndr, &oid_blob);
+ ber_read_partial_OID_String(ndr, oid_blob, &partial_oid);
+ ndr->depth++;
+ ndr->print(ndr, "%-25s: 0x%s (%s)", "binary_oid", hex_str, partial_oid);
+ ndr->depth--;
+ talloc_free(hex_str);
+ talloc_free(partial_oid);
+ }
+ ndr->depth--;
+}
+
+static void _print_drsuapi_DsAttributeValue_attid(struct ndr_print *ndr, const char *name,
+ const struct drsuapi_DsAttributeValue *r)
+{
+ uint32_t v;
+
+ ndr_print_struct(ndr, name, "drsuapi_DsAttributeValue");
+ ndr->depth++;
+ if (r->blob == NULL || r->blob->data == NULL) {
+ ndr_print_string(ndr, "attid", "NULL");
+ } else if (r->blob->length < 4) {
+ ndr_print_DATA_BLOB(ndr, "attid", *r->blob);
+ } else {
+ v = IVAL(r->blob->data, 0);
+ ndr_print_uint32(ndr, "attid", v);
+ }
+ ndr->depth--;
+}
+
+static void _print_drsuapi_DsAttributeValue_str(struct ndr_print *ndr, const char *name,
+ const struct drsuapi_DsAttributeValue *r)
+{
+ void *p;
+ size_t converted_size = 0;
+
+ ndr_print_struct(ndr, name, "drsuapi_DsAttributeValue");
+ ndr->depth++;
+ if (r->blob == NULL || r->blob->data == NULL) {
+ ndr_print_string(ndr, "string", "NULL");
+ } else if (!convert_string_talloc(ndr,
+ CH_UTF16, CH_UNIX,
+ r->blob->data,
+ r->blob->length,
+ &p, &converted_size)) {
+ ndr_print_DATA_BLOB(ndr, "string (INVALID CONVERSION)",
+ *r->blob);
+ } else {
+ char *str = (char *)p;
+ ndr_print_string(ndr, "string", str);
+ talloc_free(str);
+ }
+ ndr->depth--;
+}
+
+static void _print_drsuapi_DsAttributeValueCtr(struct ndr_print *ndr,
+ const char *name,
+ const struct drsuapi_DsAttributeValueCtr *r,
+ void (*print_val_fn)(struct ndr_print *ndr, const char *name, const struct drsuapi_DsAttributeValue *r))
+{
+ uint32_t cntr_values_1;
+ ndr_print_struct(ndr, name, "drsuapi_DsAttributeValueCtr");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "num_values", r->num_values);
+ ndr_print_ptr(ndr, "values", r->values);
+ ndr->depth++;
+ if (r->values) {
+ ndr->print(ndr, "%s: ARRAY(%d)", "values", (int)r->num_values);
+ ndr->depth++;
+ for (cntr_values_1=0;cntr_values_1<r->num_values;cntr_values_1++) {
+ char *idx_1=NULL;
+ if (asprintf(&idx_1, "[%d]", cntr_values_1) != -1) {
+ //ndr_print_drsuapi_DsAttributeValue(ndr, "values", &r->values[cntr_values_1]);
+ print_val_fn(ndr, "values", &r->values[cntr_values_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+_PUBLIC_ void ndr_print_drsuapi_DsReplicaAttribute(struct ndr_print *ndr,
+ const char *name,
+ const struct drsuapi_DsReplicaAttribute *r)
+{
+ ndr_print_struct(ndr, name, "drsuapi_DsReplicaAttribute");
+ ndr->depth++;
+ ndr_print_drsuapi_DsAttributeId(ndr, "attid", r->attid);
+ switch (r->attid) {
+ case DRSUAPI_ATTID_objectClass:
+ case DRSUAPI_ATTID_possSuperiors:
+ case DRSUAPI_ATTID_subClassOf:
+ case DRSUAPI_ATTID_governsID:
+ case DRSUAPI_ATTID_mustContain:
+ case DRSUAPI_ATTID_mayContain:
+ case DRSUAPI_ATTID_rDNAttId:
+ case DRSUAPI_ATTID_attributeID:
+ case DRSUAPI_ATTID_attributeSyntax:
+ case DRSUAPI_ATTID_auxiliaryClass:
+ case DRSUAPI_ATTID_systemPossSuperiors:
+ case DRSUAPI_ATTID_systemMayContain:
+ case DRSUAPI_ATTID_systemMustContain:
+ case DRSUAPI_ATTID_systemAuxiliaryClass:
+ case DRSUAPI_ATTID_transportAddressAttribute:
+ /* ATTIDs for classSchema and attributeSchema */
+ _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
+ _print_drsuapi_DsAttributeValue_attid);
+ break;
+ case DRSUAPI_ATTID_cn:
+ case DRSUAPI_ATTID_ou:
+ case DRSUAPI_ATTID_description:
+ case DRSUAPI_ATTID_displayName:
+ case DRSUAPI_ATTID_dMDLocation:
+ case DRSUAPI_ATTID_adminDisplayName:
+ case DRSUAPI_ATTID_adminDescription:
+ case DRSUAPI_ATTID_lDAPDisplayName:
+ case DRSUAPI_ATTID_name:
+ _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
+ _print_drsuapi_DsAttributeValue_str);
+ break;
+ default:
+ _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
+ ndr_print_drsuapi_DsAttributeValue);
+ break;
+ }
+ ndr->depth--;
+}
+
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t decompressed_length = 0;
+ uint32_t compressed_length = 0;
+ if (r->ts) {
+ {
+ struct ndr_push *_ndr_ts;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
+ {
+ struct ndr_push *_ndr_ts_compressed;
+ NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ decompressed_length = _ndr_ts_compressed->offset;
+ NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
+ }
+ compressed_length = _ndr_ts->offset;
+ talloc_free(_ndr_ts);
+ }
+ }
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->ts) {
+ {
+ struct ndr_push *_ndr_ts;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
+ {
+ struct ndr_push *_ndr_ts_compressed;
+ NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
+ }
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t decompressed_length = 0;
+ uint32_t compressed_length = 0;
+ if (r->ts) {
+ {
+ struct ndr_push *_ndr_ts;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
+ {
+ struct ndr_push *_ndr_ts_compressed;
+ NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ decompressed_length = _ndr_ts_compressed->offset;
+ NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
+ }
+ compressed_length = _ndr_ts->offset;
+ talloc_free(_ndr_ts);
+ }
+ }
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->ts) {
+ {
+ struct ndr_push *_ndr_ts;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
+ {
+ struct ndr_push *_ndr_ts_compressed;
+ NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
+ }
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr1 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t decompressed_length = 0;
+ uint32_t compressed_length = 0;
+ if (r->ts) {
+ {
+ struct ndr_push *_ndr_ts;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
+ {
+ struct ndr_push *_ndr_ts_compressed;
+ NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ decompressed_length = _ndr_ts_compressed->offset;
+ NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
+ }
+ compressed_length = _ndr_ts->offset;
+ talloc_free(_ndr_ts);
+ }
+ }
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->ts) {
+ {
+ struct ndr_push *_ndr_ts;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
+ {
+ struct ndr_push *_ndr_ts_compressed;
+ NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
+ }
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr6 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t decompressed_length = 0;
+ uint32_t compressed_length = 0;
+ if (r->ts) {
+ {
+ struct ndr_push *_ndr_ts;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
+ {
+ struct ndr_push *_ndr_ts_compressed;
+ NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ decompressed_length = _ndr_ts_compressed->offset;
+ NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
+ }
+ compressed_length = _ndr_ts->offset;
+ talloc_free(_ndr_ts);
+ }
+ }
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->ts) {
+ {
+ struct ndr_push *_ndr_ts;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
+ {
+ struct ndr_push *_ndr_ts_compressed;
+ NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
+ }
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ size_t ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(const struct drsuapi_DsReplicaObjectIdentifier3Binary *r, int flags)
+{
+ return ndr_size_struct((const struct drsuapi_DsReplicaObjectIdentifier3 *)r, flags, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+}
+
+_PUBLIC_ void ndr_print_drsuapi_SecBufferType(struct ndr_print *ndr, const char *name, enum drsuapi_SecBufferType r)
+{
+ const char *val = NULL;
+
+ switch (r & 0x00000007) {
+ case DRSUAPI_SECBUFFER_EMPTY: val = "DRSUAPI_SECBUFFER_EMPTY"; break;
+ case DRSUAPI_SECBUFFER_DATA: val = "DRSUAPI_SECBUFFER_DATA"; break;
+ case DRSUAPI_SECBUFFER_TOKEN: val = "DRSUAPI_SECBUFFER_TOKEN"; break;
+ case DRSUAPI_SECBUFFER_PKG_PARAMS: val = "DRSUAPI_SECBUFFER_PKG_PARAMS"; break;
+ case DRSUAPI_SECBUFFER_MISSING: val = "DRSUAPI_SECBUFFER_MISSING"; break;
+ case DRSUAPI_SECBUFFER_EXTRA: val = "DRSUAPI_SECBUFFER_EXTRA"; break;
+ case DRSUAPI_SECBUFFER_STREAM_TRAILER: val = "DRSUAPI_SECBUFFER_STREAM_TRAILER"; break;
+ case DRSUAPI_SECBUFFER_STREAM_HEADER: val = "DRSUAPI_SECBUFFER_STREAM_HEADER"; break;
+ }
+
+ if (r & DRSUAPI_SECBUFFER_READONLY) {
+ char *v = talloc_asprintf(ndr, "DRSUAPI_SECBUFFER_READONLY | %s", val);
+ ndr_print_enum(ndr, name, "ENUM", v, r);
+ } else {
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+ }
+}
+
+_PUBLIC_ void ndr_print_drsuapi_DsAddEntry_AttrErrListItem_V1(struct ndr_print *ndr, const char *name, const struct drsuapi_DsAddEntry_AttrErrListItem_V1 *r)
+{
+ ndr_print_struct(ndr, name, "drsuapi_DsAddEntry_AttrErrListItem_V1");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "next", r->next);
+ ndr_print_drsuapi_DsAddEntry_AttrErr_V1(ndr, "err_data", &r->err_data);
+ ndr->depth--;
+ if (r->next) {
+ ndr_print_drsuapi_DsAddEntry_AttrErrListItem_V1(ndr, "next", r->next);
+ }
+}
+
+enum ndr_err_code ndr_push_drsuapi_DsBindInfo(struct ndr_push *ndr, int ndr_flags, const union drsuapi_DsBindInfo *r)
+{
+ uint32_t _flags_save = ndr->flags;
+ ndr->flags = ndr->flags & ~LIBNDR_FLAG_NDR64;
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t level;
+ NDR_CHECK(ndr_push_steal_switch_value(ndr, r, &level));
+ NDR_CHECK(ndr_push_union_align(ndr, 4));
+ switch (level) {
+ case 24: {
+ {
+ struct ndr_push *_ndr_info24;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info24, 0, 24));
+ NDR_CHECK(ndr_push_drsuapi_DsBindInfo24(_ndr_info24, NDR_SCALARS, &r->info24));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info24, 0, 24));
+ }
+ break; }
+
+ case 28: {
+ {
+ struct ndr_push *_ndr_info28;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info28, 0, 28));
+ NDR_CHECK(ndr_push_drsuapi_DsBindInfo28(_ndr_info28, NDR_SCALARS, &r->info28));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info28, 0, 28));
+ }
+ break; }
+
+ case 48: {
+ {
+ struct ndr_push *_ndr_info48;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info48, 0, 48));
+ NDR_CHECK(ndr_push_drsuapi_DsBindInfo48(_ndr_info48, NDR_SCALARS, &r->info48));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info48, 0, 48));
+ }
+ break; }
+
+ case 52: {
+ {
+ struct ndr_push *_ndr_info52;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info52, 0, 52));
+ NDR_CHECK(ndr_push_drsuapi_DsBindInfo52(_ndr_info52, NDR_SCALARS, &r->info52));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info52, 0, 52));
+ }
+ break; }
+
+ default: {
+ {
+ struct ndr_push *_ndr_Fallback;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_Fallback, 0, level));
+ NDR_CHECK(ndr_push_drsuapi_DsBindInfoFallBack(_ndr_Fallback, NDR_SCALARS, &r->Fallback));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_Fallback, 0, level));
+ }
+ break; }
+
+ }
+ }
+ ndr->flags = _flags_save;
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_drsuapi_DsBindInfo(struct ndr_pull *ndr, int ndr_flags, union drsuapi_DsBindInfo *r)
+{
+ uint32_t _flags_save = ndr->flags;
+ ndr->flags = ndr->flags & ~LIBNDR_FLAG_NDR64;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t level;
+ NDR_CHECK(ndr_pull_steal_switch_value(ndr, r, &level));
+ NDR_CHECK(ndr_pull_union_align(ndr, 4));
+ switch (level) {
+ case 24: {
+ {
+ struct ndr_pull *_ndr_info24;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info24, 0, 24));
+ NDR_CHECK(ndr_pull_drsuapi_DsBindInfo24(_ndr_info24, NDR_SCALARS, &r->info24));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info24, 0, 24));
+ }
+ break; }
+
+ case 28: {
+ {
+ struct ndr_pull *_ndr_info28;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info28, 0, 28));
+ NDR_CHECK(ndr_pull_drsuapi_DsBindInfo28(_ndr_info28, NDR_SCALARS, &r->info28));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info28, 0, 28));
+ }
+ break; }
+
+ case 48: {
+ {
+ struct ndr_pull *_ndr_info48;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info48, 0, 48));
+ NDR_CHECK(ndr_pull_drsuapi_DsBindInfo48(_ndr_info48, NDR_SCALARS, &r->info48));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info48, 0, 48));
+ }
+ break; }
+
+ case 52: {
+ {
+ struct ndr_pull *_ndr_info52;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info52, 0, 52));
+ NDR_CHECK(ndr_pull_drsuapi_DsBindInfo52(_ndr_info52, NDR_SCALARS, &r->info52));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info52, 0, 52));
+ }
+ break; }
+
+ default: {
+ {
+ struct ndr_pull *_ndr_Fallback;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_Fallback, 0, level));
+ NDR_CHECK(ndr_pull_drsuapi_DsBindInfoFallBack(_ndr_Fallback, NDR_SCALARS, &r->Fallback));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_Fallback, 0, level));
+ }
+ break; }
+
+ }
+ }
+ ndr->flags = _flags_save;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_drsuapi_DsBindInfo(struct ndr_print *ndr, const char *name, const union drsuapi_DsBindInfo *r)
+{
+ uint32_t level;
+ level = ndr_print_steal_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "drsuapi_DsBindInfo");
+ switch (level) {
+ case 24:
+ ndr_print_drsuapi_DsBindInfo24(ndr, "info24", &r->info24);
+ break;
+
+ case 28:
+ ndr_print_drsuapi_DsBindInfo28(ndr, "info28", &r->info28);
+ break;
+
+ case 48:
+ ndr_print_drsuapi_DsBindInfo48(ndr, "info48", &r->info48);
+ break;
+
+ case 52:
+ ndr_print_drsuapi_DsBindInfo52(ndr, "info52", &r->info52);
+ break;
+
+ default:
+ ndr_print_drsuapi_DsBindInfoFallBack(ndr, "Fallback", &r->Fallback);
+ break;
+
+ }
+}
diff --git a/librpc/ndr/ndr_drsuapi.h b/librpc/ndr/ndr_drsuapi.h
new file mode 100644
index 0000000..9d1d371
--- /dev/null
+++ b/librpc/ndr/ndr_drsuapi.h
@@ -0,0 +1,34 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for printing some linked list structs in DRSUAPI
+
+ Copyright (C) Stefan (metze) Metzmacher 2005-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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _LIBRPC_NDR_NDR_DRSUAPI_H
+#define _LIBRPC_NDR_NDR_DRSUAPI_H
+
+void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
+ const struct drsuapi_DsReplicaObjectListItem *r);
+
+void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name,
+ const struct drsuapi_DsReplicaObjectListItemEx *r);
+
+size_t ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(const struct drsuapi_DsReplicaObjectIdentifier3Binary *r, int flags);
+
+
+#endif /* _LIBRPC_NDR_NDR_DRSUAPI_H */
diff --git a/librpc/ndr/ndr_frsrpc.c b/librpc/ndr/ndr_frsrpc.c
new file mode 100644
index 0000000..96d3468
--- /dev/null
+++ b/librpc/ndr/ndr_frsrpc.c
@@ -0,0 +1,92 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ helper routines for FRSRPC marshalling
+
+ Copyright (C) Stefan (metze) Metzmacher 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_frsrpc.h"
+
+enum ndr_err_code ndr_push_frsrpc_CommPktChunkCtr(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct frsrpc_CommPktChunkCtr *r)
+{
+ uint32_t cntr_chunks_0;
+ {
+ 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, 2));
+ for (cntr_chunks_0 = 0; cntr_chunks_0 < r->num_chunks; cntr_chunks_0++) {
+ NDR_CHECK(ndr_push_frsrpc_CommPktChunk(ndr, NDR_SCALARS, &r->chunks[cntr_chunks_0]));
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+#define _TMP_PULL_REALLOC_N(ndr, s, t, n) do { \
+ _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
+ (s) = talloc_realloc(ndr->current_mem_ctx, (s), t, n); \
+ if (!(s)) { \
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, \
+ "Alloc %u * %s failed: %s\n", \
+ (unsigned)n, # s, __location__); \
+ } \
+} while (0)
+
+enum ndr_err_code ndr_pull_frsrpc_CommPktChunkCtr(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct frsrpc_CommPktChunkCtr *r)
+{
+ uint32_t cntr_chunks_0;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t remaining = ndr->data_size - ndr->offset;
+ r->num_chunks = 0;
+ r->chunks = NULL;
+ for (cntr_chunks_0 = 0; remaining > 0; cntr_chunks_0++) {
+ r->num_chunks += 1;
+ _TMP_PULL_REALLOC_N(ndr, r->chunks,
+ struct frsrpc_CommPktChunk,
+ r->num_chunks);
+ NDR_CHECK(ndr_pull_frsrpc_CommPktChunk(ndr,
+ NDR_SCALARS,
+ &r->chunks[cntr_chunks_0]));
+ remaining = ndr->data_size - ndr->offset;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+size_t ndr_size_frsrpc_CommPktChunkCtr(const struct frsrpc_CommPktChunkCtr *r,
+ int flags)
+{
+ flags |= LIBNDR_FLAG_NOALIGN;
+ return ndr_size_struct(r, flags,
+ (ndr_push_flags_fn_t)ndr_push_frsrpc_CommPktChunkCtr);
+}
diff --git a/librpc/ndr/ndr_frsrpc.h b/librpc/ndr/ndr_frsrpc.h
new file mode 100644
index 0000000..9e5ac92
--- /dev/null
+++ b/librpc/ndr/ndr_frsrpc.h
@@ -0,0 +1,34 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ helper routines for FRSRPC marshalling
+
+ Copyright (C) Stefan (metze) Metzmacher 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _LIBRPC_NDR_NDR_FRSRPC_H
+#define _LIBRPC_NDR_NDR_FRSRPC_H
+
+enum ndr_err_code ndr_push_frsrpc_CommPktChunkCtr(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct frsrpc_CommPktChunkCtr *r);
+enum ndr_err_code ndr_pull_frsrpc_CommPktChunkCtr(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct frsrpc_CommPktChunkCtr *r);
+size_t ndr_size_frsrpc_CommPktChunkCtr(const struct frsrpc_CommPktChunkCtr *r,
+ int flags);
+
+#endif /* _LIBRPC_NDR_NDR_FRSRPC_H */
diff --git a/librpc/ndr/ndr_ioctl.c b/librpc/ndr/ndr_ioctl.c
new file mode 100644
index 0000000..7e76abc
--- /dev/null
+++ b/librpc/ndr/ndr_ioctl.c
@@ -0,0 +1,40 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures for IOCTL/FSCTL
+
+ Copyright (C) Stefan Metzmacher 2014
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_ioctl.h"
+
+_PUBLIC_ void ndr_print_fsctl_net_iface_info(struct ndr_print *ndr, const char *name, const struct fsctl_net_iface_info *r)
+{
+ ndr_print_struct(ndr, name, "fsctl_net_iface_info");
+ if (r == NULL) { ndr_print_null(ndr); return; }
+ ndr->depth++;
+ ndr_print_ptr(ndr, "next", r->next);
+ ndr_print_uint32(ndr, "ifindex", r->ifindex);
+ ndr_print_fsctl_net_iface_capability(ndr, "capability", r->capability);
+ ndr_print_uint32(ndr, "reserved", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
+ ndr_print_hyper(ndr, "linkspeed", r->linkspeed);
+ ndr_print_fsctl_sockaddr_storage(ndr, "sockaddr", &r->sockaddr);
+ ndr->depth--;
+ if (r->next) {
+ ndr_print_fsctl_net_iface_info(ndr, "next", r->next);
+ }
+}
diff --git a/librpc/ndr/ndr_krb5pac.c b/librpc/ndr/ndr_krb5pac.c
new file mode 100644
index 0000000..57b28df
--- /dev/null
+++ b/librpc/ndr/ndr_krb5pac.c
@@ -0,0 +1,130 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_krb5pac.h"
+
+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);
+ case PAC_TYPE_UPN_DNS_INFO:
+ return NDR_ROUND(s,8);
+ default:
+ return s;
+ }
+}
+
+enum ndr_err_code 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,LIBNDR_FLAG_ALIGN8)));
+ {
+ 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_start(ndr, r->info));
+ {
+ struct ndr_push *_ndr_info_pad;
+ struct ndr_push *_ndr_info;
+ size_t _ndr_size = _ndr_size_PAC_INFO(r->info, r->type, LIBNDR_FLAG_ALIGN8);
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info_pad, 0, NDR_ROUND(_ndr_size, 8)));
+ NDR_CHECK(ndr_push_subcontext_start(_ndr_info_pad, &_ndr_info, 0, _ndr_size));
+ 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_info_pad, _ndr_info, 0, _ndr_size));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info_pad, 0, NDR_ROUND(_ndr_size, 8)));
+ }
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->info));
+ }
+ ndr->flags = _flags_save_PAC_INFO;
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code 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) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ 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_pad;
+ struct ndr_pull *_ndr_info;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info_pad, 0, NDR_ROUND(r->_ndr_size, 8)));
+ NDR_CHECK(ndr_pull_subcontext_start(_ndr_info_pad, &_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_info_pad, _ndr_info, 0, r->_ndr_size));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info_pad, 0, NDR_ROUND(r->_ndr_size, 8)));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_PAC_INFO;
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_krb5pac.h b/librpc/ndr/ndr_krb5pac.h
new file mode 100644
index 0000000..f539161
--- /dev/null
+++ b/librpc/ndr/ndr_krb5pac.h
@@ -0,0 +1,26 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "librpc/gen_ndr/ndr_krb5pac.h"
+
+size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags);
+
diff --git a/librpc/ndr/ndr_misc.c b/librpc/ndr/ndr_misc.c
new file mode 100644
index 0000000..d7ebb06
--- /dev/null
+++ b/librpc/ndr/ndr_misc.c
@@ -0,0 +1,77 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "system/network.h"
+#include "librpc/ndr/libndr.h"
+#include "libcli/util/ntstatus.h"
+#include "lib/util/util_str_hex.h"
+
+_PUBLIC_ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid)
+{
+ struct GUID_txt_buf buf;
+ ndr->print(ndr, "%-25s: %s", name, GUID_buf_string(guid, &buf));
+}
+
+bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1,
+ const struct ndr_syntax_id *i2)
+{
+ return GUID_equal(&i1->uuid, &i2->uuid)
+ && (i1->if_version == i2->if_version);
+}
+
+char *ndr_syntax_id_buf_string(
+ const struct ndr_syntax_id *id, struct ndr_syntax_id_buf *dst)
+{
+ struct GUID_txt_buf guid_buf;
+
+ snprintf(dst->buf,
+ sizeof(dst->buf),
+ "%s/0x%08x",
+ GUID_buf_string(&id->uuid, &guid_buf),
+ (unsigned int)id->if_version);
+
+ return dst->buf;
+}
+
+_PUBLIC_ char *ndr_syntax_id_to_string(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *id)
+{
+ struct ndr_syntax_id_buf buf;
+ return talloc_strdup(mem_ctx, ndr_syntax_id_buf_string(id, &buf));
+}
+
+_PUBLIC_ bool ndr_syntax_id_from_string(const char *s, struct ndr_syntax_id *id)
+{
+ bool ok;
+
+ ok = parse_guid_string(s, &id->uuid);
+ if (!ok) {
+ return false;
+ }
+
+ if (strncmp(s + 36, "/0x", 3) != 0) {
+ return false;
+ }
+
+ ok = hex_uint32(s+39, &id->if_version);
+ return ok;
+}
diff --git a/librpc/ndr/ndr_nbt.c b/librpc/ndr/ndr_nbt.c
new file mode 100644
index 0000000..8ed9f0a
--- /dev/null
+++ b/librpc/ndr/ndr_nbt.c
@@ -0,0 +1,406 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ CLDAP server structures
+
+ Copyright (C) Andrew Tridgell 2005
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* parser auto-generated by pidl, then hand-modified by abartlet */
+
+#include "includes.h"
+#include "../libcli/nbt/libnbt.h"
+#include "../libcli/netlogon/netlogon.h"
+#include "ndr_dns_utils.h"
+
+
+/* don't allow an unlimited number of name components */
+#define MAX_COMPONENTS 128
+
+/**
+ print a nbt string
+*/
+_PUBLIC_ void ndr_print_nbt_string(struct ndr_print *ndr, const char *name, const char *s)
+{
+ ndr_print_string(ndr, name, s);
+}
+
+/*
+ pull one component of a nbt_string
+*/
+static enum ndr_err_code ndr_pull_component(struct ndr_pull *ndr,
+ uint8_t **component,
+ uint32_t *offset,
+ uint32_t *max_offset)
+{
+ uint8_t len;
+ unsigned int loops = 0;
+ while (loops < 5) {
+ if (*offset >= ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD NBT NAME component");
+ }
+ len = ndr->data[*offset];
+ if (len == 0) {
+ *offset += 1;
+ *max_offset = MAX(*max_offset, *offset);
+ *component = NULL;
+ return NDR_ERR_SUCCESS;
+ }
+ if ((len & 0xC0) == 0xC0) {
+ /* its a label pointer */
+ if (1 + *offset >= ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD NBT NAME component");
+ }
+ *max_offset = MAX(*max_offset, *offset + 2);
+ *offset = ((len&0x3F)<<8) | ndr->data[1 + *offset];
+ *max_offset = MAX(*max_offset, *offset);
+ loops++;
+ continue;
+ }
+ if ((len & 0xC0) != 0) {
+ /* its a reserved length field */
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD NBT NAME component");
+ }
+ if (*offset + len + 1 > ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD NBT NAME component");
+ }
+ *component = (uint8_t*)talloc_strndup(
+ ndr->current_mem_ctx,
+ (const char *)&ndr->data[1 + *offset], len);
+ NDR_ERR_HAVE_NO_MEMORY(*component);
+ *offset += len + 1;
+ *max_offset = MAX(*max_offset, *offset);
+ return NDR_ERR_SUCCESS;
+ }
+
+ /* too many pointers */
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "BAD NBT NAME component");
+}
+
+/**
+ pull a nbt_string from the wire
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
+{
+ uint32_t offset = ndr->offset;
+ uint32_t max_offset = offset;
+ unsigned num_components;
+ char *name;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ name = NULL;
+
+ /* break up name into a list of components */
+ for (num_components=0;num_components<MAX_COMPONENTS;num_components++) {
+ uint8_t *component = NULL;
+ NDR_CHECK(ndr_pull_component(ndr, &component, &offset, &max_offset));
+ if (component == NULL) break;
+ if (name) {
+ name = talloc_asprintf_append_buffer(name, ".%s", component);
+ NDR_ERR_HAVE_NO_MEMORY(name);
+ } else {
+ name = (char *)component;
+ }
+ }
+ if (num_components == MAX_COMPONENTS) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING,
+ "BAD NBT NAME too many components");
+ }
+ if (num_components == 0) {
+ name = talloc_strdup(ndr->current_mem_ctx, "");
+ NDR_ERR_HAVE_NO_MEMORY(name);
+ }
+
+ (*s) = name;
+ ndr->offset = max_offset;
+
+ return NDR_ERR_SUCCESS;
+}
+
+/**
+ push a nbt string to the wire
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s)
+{
+ return ndr_push_dns_string_list(ndr,
+ &ndr->dns_string_list,
+ ndr_flags,
+ s,
+ true);
+}
+
+
+/* Manually modified to handle the dom_sid being optional based on if it is present or all zero */
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_REQUEST(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_REQUEST *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->request_count));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->acct_control));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ if (ndr_size_dom_sid0(&r->sid, ndr->flags)) {
+ struct ndr_push *_ndr_sid;
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ }
+ NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/* Manually modified to handle the dom_sid being optional based on if it is present (size is non-zero) or not */
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_REQUEST(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_REQUEST *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->request_count));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->acct_control));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
+ if (r->sid_size) {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ struct ndr_pull *_ndr_sid;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sid, 0, r->sid_size));
+ NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size));
+ } else {
+ ZERO_STRUCT(r->sid);
+ }
+ NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/* Manually modified to only push some parts of the structure if certain flags are set */
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r)
+{
+ {
+ 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_netlogon_command(ndr, NDR_SCALARS, r->command));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz));
+ NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain_name));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
+ if (r->nt_version & NETLOGON_NT_VERSION_5EX_WITH_IP) {
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
+ {
+ struct ndr_push *_ndr_sockaddr;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
+ NDR_CHECK(ndr_push_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS|NDR_BUFFERS, &r->sockaddr));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
+ }
+ }
+ if (r->nt_version & NETLOGON_NT_VERSION_WITH_CLOSEST_SITE) {
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->next_closest_site));
+ }
+ NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->domain_uuid));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/* Manually modified to only pull some parts of the structure if certain flags provided */
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_EX *r,
+ uint32_t nt_version_flags)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ZERO_STRUCTP(r);
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->sbz));
+ NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain_name));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
+ if (nt_version_flags & NETLOGON_NT_VERSION_5EX_WITH_IP) {
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->sockaddr_size));
+ {
+ struct ndr_pull *_ndr_sockaddr;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sockaddr, 0, r->sockaddr_size));
+ NDR_CHECK(ndr_pull_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS|NDR_BUFFERS, &r->sockaddr));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sockaddr, 0, r->sockaddr_size));
+ }
+ }
+ if (nt_version_flags & NETLOGON_NT_VERSION_WITH_CLOSEST_SITE) {
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->next_closest_site));
+ }
+ NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
+ if (r->nt_version != nt_version_flags) {
+ return NDR_ERR_VALIDATE;
+ }
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->domain_uuid));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_netlogon_samlogon_response(struct ndr_push *ndr, int ndr_flags, const struct netlogon_samlogon_response *r)
+{
+ if (r->ntver == NETLOGON_NT_VERSION_1) {
+ NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_RESPONSE_NT40(
+ ndr, ndr_flags, &r->data.nt4));
+ } else if (r->ntver & NETLOGON_NT_VERSION_5EX) {
+ NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(
+ ndr, ndr_flags, &r->data.nt5_ex));
+ } else if (r->ntver & NETLOGON_NT_VERSION_5) {
+ NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_RESPONSE(
+ ndr, ndr_flags, &r->data.nt5));
+ } else {
+ return NDR_ERR_BAD_SWITCH;
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_netlogon_samlogon_response(struct ndr_pull *ndr, int ndr_flags, struct netlogon_samlogon_response *r)
+{
+ if (ndr->data_size < 8) {
+ return NDR_ERR_BUFSIZE;
+ }
+
+ /* lmnttoken */
+ if (SVAL(ndr->data, ndr->data_size - 4) != 0xffff) {
+ return NDR_ERR_TOKEN;
+ }
+ /* lm20token */
+ if (SVAL(ndr->data, ndr->data_size - 2) != 0xffff) {
+ return NDR_ERR_TOKEN;
+ }
+
+ r->ntver = IVAL(ndr->data, ndr->data_size - 8);
+
+ if (r->ntver == NETLOGON_NT_VERSION_1) {
+ NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_NT40(
+ ndr, ndr_flags, &r->data.nt4));
+ } else if (r->ntver & NETLOGON_NT_VERSION_5EX) {
+ NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(
+ ndr, ndr_flags, &r->data.nt5_ex, r->ntver));
+ if (ndr->offset < ndr->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
+ "not all bytes consumed ofs[%u] size[%u]",
+ ndr->offset, ndr->data_size);
+ }
+ } else if (r->ntver & NETLOGON_NT_VERSION_5) {
+ NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_RESPONSE(
+ ndr, ndr_flags, &r->data.nt5));
+ } else {
+ return NDR_ERR_BAD_SWITCH;
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netlogon_samlogon_response(struct ndr_print *ndr, const char *name, struct netlogon_samlogon_response *r)
+{
+ ndr_print_struct(ndr, name, "netlogon_samlogon_response");
+ if (r == NULL) { ndr_print_null(ndr); return; }
+ if (r->ntver == NETLOGON_NT_VERSION_1) {
+ ndr_print_NETLOGON_SAM_LOGON_RESPONSE_NT40(ndr, "data.nt4", &r->data.nt4);
+ } else if (r->ntver & NETLOGON_NT_VERSION_5EX) {
+ ndr_print_NETLOGON_SAM_LOGON_RESPONSE_EX(ndr, "data.nt5_ex", &r->data.nt5_ex);
+ } else if (r->ntver & NETLOGON_NT_VERSION_5) {
+ ndr_print_NETLOGON_SAM_LOGON_RESPONSE(ndr, "data.nt5", &r->data.nt5);
+ }
+}
diff --git a/librpc/ndr/ndr_nbt.h b/librpc/ndr/ndr_nbt.h
new file mode 100644
index 0000000..7c06301
--- /dev/null
+++ b/librpc/ndr/ndr_nbt.h
@@ -0,0 +1,42 @@
+#/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special netlogon types
+
+ Copyright (C) Andrew Tridgell 2005
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
+ Copyright (C) Guenther Deschner 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* The following definitions come from ../librpc/ndr/ndr_nbt.c */
+
+#ifndef _LIBRPC_NDR_NDR_NBT_H
+#define _LIBRPC_NDR_NDR_NBT_H
+
+#include "librpc/gen_ndr/nbt.h"
+
+NDR_SCALAR_PROTO(nbt_string, const char *)
+
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_REQUEST(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_REQUEST *r);
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_REQUEST(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_REQUEST *r);
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r);
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_EX *r,
+ uint32_t nt_version_flags);
+enum ndr_err_code ndr_push_netlogon_samlogon_response(struct ndr_push *ndr, int ndr_flags, const struct netlogon_samlogon_response *r);
+enum ndr_err_code ndr_pull_netlogon_samlogon_response(struct ndr_pull *ndr, int ndr_flags, struct netlogon_samlogon_response *r);
+void ndr_print_netlogon_samlogon_response(struct ndr_print *ndr, const char *name, struct netlogon_samlogon_response *r);
+
+#endif /* _LIBRPC_NDR_NDR_NBT_H */
diff --git a/librpc/ndr/ndr_negoex.c b/librpc/ndr/ndr_negoex.c
new file mode 100644
index 0000000..72c8774
--- /dev/null
+++ b/librpc/ndr/ndr_negoex.c
@@ -0,0 +1,521 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special NEGOEX structures
+
+ Copyright (C) Stefan Metzmacher 2015
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_negoex.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/ndr/ndr_negoex.h"
+
+void ndr_print_negoex_BYTE_VECTOR(struct ndr_print *ndr, const char *name, const struct negoex_BYTE_VECTOR *r)
+{
+ ndr_print_struct(ndr, name, "negoex_BYTE_VECTOR");
+ if (r == NULL) { ndr_print_null(ndr); return; }
+ ndr->depth++;
+ ndr_print_DATA_BLOB(ndr, "blob", r->blob);
+ ndr->depth--;
+}
+
+enum ndr_err_code ndr_push_negoex_BYTE_VECTOR(struct ndr_push *ndr, int ndr_flags, const struct negoex_BYTE_VECTOR *r)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 5));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->blob.data));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->blob.length));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->blob.data) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->blob.data));
+#if 0
+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->blob.length));
+#endif
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->blob.data, r->blob.length));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->blob.data));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_negoex_BYTE_VECTOR(struct ndr_pull *ndr, int ndr_flags, struct negoex_BYTE_VECTOR *r)
+{
+ uint32_t _ptr_data;
+ uint32_t size_data_1 = 0;
+ TALLOC_CTX *_mem_save_data_0 = NULL;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ r->_dummy = NULL;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 5));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
+ if (_ptr_data) {
+ NDR_PULL_ALLOC(ndr, r->blob.data);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->blob.data, _ptr_data));
+ } else {
+ r->blob.data = NULL;
+ }
+ r->blob.length = 0;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &size_data_1));
+ r->_length = size_data_1;
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->blob.data) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->blob.data));
+ _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->blob.data, 0);
+#if 0
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->blob.data));
+ size_data_1 = ndr_get_array_size(ndr, &r->blob.data);
+#else
+ size_data_1 = r->_length;
+#endif
+ NDR_PULL_ALLOC_N(ndr, r->blob.data, size_data_1);
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->blob.data, size_data_1));
+ r->blob.length = size_data_1;
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+#if 0
+ if (r->blob.data) {
+ NDR_CHECK(ndr_check_steal_array_size(ndr, (void*)&r->blob.data, r->blob.length));
+ }
+#endif
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_negoex_AUTH_SCHEME_VECTOR(struct ndr_push *ndr, int ndr_flags, const struct negoex_AUTH_SCHEME_VECTOR *r)
+{
+ uint32_t cntr_array_1;
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 5));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->array));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->array) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->array));
+#if 0
+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->count));
+#endif
+ for (cntr_array_1 = 0; cntr_array_1 < (r->count); cntr_array_1++) {
+ NDR_CHECK(ndr_push_negoex_AUTH_SCHEME(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
+ }
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->array));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_negoex_AUTH_SCHEME_VECTOR(struct ndr_pull *ndr, int ndr_flags, struct negoex_AUTH_SCHEME_VECTOR *r)
+{
+ uint32_t _ptr_array;
+ uint32_t size_array_1 = 0;
+ uint32_t cntr_array_1;
+ TALLOC_CTX *_mem_save_array_0 = NULL;
+ TALLOC_CTX *_mem_save_array_1 = NULL;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 5));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_array));
+ if (_ptr_array) {
+ NDR_PULL_ALLOC(ndr, r->array);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->array, _ptr_array));
+ } else {
+ r->array = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->array) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->array));
+ _mem_save_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
+#if 0
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->array));
+ size_array_1 = ndr_get_array_size(ndr, &r->array);
+#else
+ size_array_1 = r->count;
+#endif
+ NDR_PULL_ALLOC_N(ndr, r->array, size_array_1);
+ _mem_save_array_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
+ for (cntr_array_1 = 0; cntr_array_1 < (size_array_1); cntr_array_1++) {
+ NDR_CHECK(ndr_pull_negoex_AUTH_SCHEME(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+#if 0
+ if (r->array) {
+ NDR_CHECK(ndr_check_steal_array_size(ndr, (void*)&r->array, r->count));
+ }
+#endif
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_negoex_EXTENSION_VECTOR(struct ndr_push *ndr, int ndr_flags, const struct negoex_EXTENSION_VECTOR *r)
+{
+ uint32_t cntr_array_1;
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 5));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->array));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->array) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->array));
+#if 0
+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->count));
+#endif
+ for (cntr_array_1 = 0; cntr_array_1 < (r->count); cntr_array_1++) {
+ NDR_CHECK(ndr_push_negoex_EXTENSION(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
+ }
+ for (cntr_array_1 = 0; cntr_array_1 < (r->count); cntr_array_1++) {
+ NDR_CHECK(ndr_push_negoex_EXTENSION(ndr, NDR_BUFFERS, &r->array[cntr_array_1]));
+ }
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->array));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_negoex_EXTENSION_VECTOR(struct ndr_pull *ndr, int ndr_flags, struct negoex_EXTENSION_VECTOR *r)
+{
+ uint32_t _ptr_array;
+ uint32_t size_array_1 = 0;
+ uint32_t cntr_array_1;
+ TALLOC_CTX *_mem_save_array_0 = NULL;
+ TALLOC_CTX *_mem_save_array_1 = NULL;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 5));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_array));
+ if (_ptr_array) {
+ NDR_PULL_ALLOC(ndr, r->array);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->array, _ptr_array));
+ } else {
+ r->array = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->array) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->array));
+ _mem_save_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
+#if 0
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->array));
+ size_array_1 = ndr_get_array_size(ndr, &r->array);
+#else
+ size_array_1 = r->count;
+#endif
+ NDR_PULL_ALLOC_N(ndr, r->array, size_array_1);
+ _mem_save_array_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
+ for (cntr_array_1 = 0; cntr_array_1 < (size_array_1); cntr_array_1++) {
+ NDR_CHECK(ndr_pull_negoex_EXTENSION(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
+ }
+ for (cntr_array_1 = 0; cntr_array_1 < (size_array_1); cntr_array_1++) {
+ NDR_CHECK(ndr_pull_negoex_EXTENSION(ndr, NDR_BUFFERS, &r->array[cntr_array_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+#if 0
+ if (r->array) {
+ NDR_CHECK(ndr_check_steal_array_size(ndr, (void*)&r->array, r->count));
+ }
+#endif
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_negoex_ALERT_VECTOR(struct ndr_push *ndr, int ndr_flags, const struct negoex_ALERT_VECTOR *r)
+{
+ uint32_t cntr_array_1;
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 5));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->array));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->array) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->array));
+#if 0
+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->count));
+#endif
+ for (cntr_array_1 = 0; cntr_array_1 < (r->count); cntr_array_1++) {
+ NDR_CHECK(ndr_push_negoex_ALERT(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
+ }
+ for (cntr_array_1 = 0; cntr_array_1 < (r->count); cntr_array_1++) {
+ NDR_CHECK(ndr_push_negoex_ALERT(ndr, NDR_BUFFERS, &r->array[cntr_array_1]));
+ }
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->array));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_negoex_ALERT_VECTOR(struct ndr_pull *ndr, int ndr_flags, struct negoex_ALERT_VECTOR *r)
+{
+ uint32_t _ptr_array;
+ uint32_t size_array_1 = 0;
+ uint32_t cntr_array_1;
+ TALLOC_CTX *_mem_save_array_0 = NULL;
+ TALLOC_CTX *_mem_save_array_1 = NULL;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 5));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_array));
+ if (_ptr_array) {
+ NDR_PULL_ALLOC(ndr, r->array);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->array, _ptr_array));
+ } else {
+ r->array = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->array) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->array));
+ _mem_save_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
+#if 0
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->array));
+ size_array_1 = ndr_get_array_size(ndr, &r->array);
+#else
+ size_array_1 = r->count;
+#endif
+ NDR_PULL_ALLOC_N(ndr, r->array, size_array_1);
+ _mem_save_array_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
+ for (cntr_array_1 = 0; cntr_array_1 < (size_array_1); cntr_array_1++) {
+ NDR_CHECK(ndr_pull_negoex_ALERT(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
+ }
+ for (cntr_array_1 = 0; cntr_array_1 < (size_array_1); cntr_array_1++) {
+ NDR_CHECK(ndr_pull_negoex_ALERT(ndr, NDR_BUFFERS, &r->array[cntr_array_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+#if 0
+ if (r->array) {
+ NDR_CHECK(ndr_check_steal_array_size(ndr, (void*)&r->array, r->count));
+ }
+#endif
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+size_t ndr_negoex_MESSAGE_header_length(const struct negoex_MESSAGE *r)
+{
+ size_t size = 0;
+
+ size += 8; /* signature */
+ size += 4; /* type */
+ size += 4; /* sequence_number */
+ size += 4; /* header_length */
+ size += 4; /* message_length */
+ size += 16; /* conversation_id */
+
+ switch (r->type) {
+ case NEGOEX_MESSAGE_TYPE_INITIATOR_NEGO:
+ case NEGOEX_MESSAGE_TYPE_ACCEPTOR_NEGO:
+ size += 32; /* random */
+ size += 8; /* protocol_version */
+ size += 8; /* auth_schemes */
+ size += 8; /* extensions */
+ break;
+
+ case NEGOEX_MESSAGE_TYPE_INITIATOR_META_DATA:
+ case NEGOEX_MESSAGE_TYPE_ACCEPTOR_META_DATA:
+ case NEGOEX_MESSAGE_TYPE_CHALLENGE:
+ case NEGOEX_MESSAGE_TYPE_AP_REQUEST:
+ size += 16; /* auth_scheme */
+ size += 8; /* exchange */
+ break;
+
+ case NEGOEX_MESSAGE_TYPE_VERIFY:
+ size += 16; /* auth_scheme */
+ size += 4; /* checksum.header_length */
+ size += 4; /* checksum.scheme */
+ size += 4; /* checksum.type */
+ size += 8; /* checksum.value */
+ break;
+
+ case NEGOEX_MESSAGE_TYPE_ALERT:
+ size += 16; /* auth_scheme */
+ size += 4; /* status */
+ size += 8; /* alerts */
+ break;
+ }
+
+ return size;
+}
+
+enum ndr_err_code ndr_pull_negoex_MESSAGE(struct ndr_pull *ndr, int ndr_flags, struct negoex_MESSAGE *r)
+{
+ uint32_t _save_relative_base_offset = ndr_pull_get_relative_base_offset(ndr);
+ uint32_t size_signature_0 = 0;
+ uint32_t start_data_size = ndr->data_size;
+ uint32_t saved_offset = 0;
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 5));
+ NDR_CHECK(ndr_pull_setup_relative_base_offset1(ndr, r, ndr->offset));
+ size_signature_0 = 8;
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->signature, size_signature_0, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_pull_negoex_MESSAGE_TYPE(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sequence_number));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->header_length));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->message_length));
+ saved_offset = ndr->offset;
+ ndr->offset = ndr->relative_base_offset;
+ NDR_PULL_NEED_BYTES(ndr, r->message_length);
+ ndr->data_size = ndr->offset + r->message_length;
+ ndr->offset = saved_offset;
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->conversation_id));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->p, r->type));
+ NDR_CHECK(ndr_pull_negoex_PAYLOAD(ndr, NDR_SCALARS, &r->p));
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
+ ndr->offset = ndr->data_size;
+ ndr->data_size = start_data_size;
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_setup_relative_base_offset2(ndr, r));
+ saved_offset = ndr->offset;
+ ndr->offset = ndr->relative_base_offset;
+ NDR_PULL_NEED_BYTES(ndr, r->message_length);
+ ndr->data_size = ndr->offset + r->message_length;
+ ndr->offset = saved_offset;
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->p, r->type));
+ NDR_CHECK(ndr_pull_negoex_PAYLOAD(ndr, NDR_BUFFERS, &r->p));
+ ndr->offset = ndr->data_size;
+ ndr->data_size = start_data_size;
+ }
+ ndr_pull_restore_relative_base_offset(ndr, _save_relative_base_offset);
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_negoex_MESSAGE_ARRAY(struct ndr_push *ndr, int ndr_flags, const struct negoex_MESSAGE_ARRAY *r)
+{
+ uint32_t cntr_messages_0;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 5));
+ for (cntr_messages_0 = 0; cntr_messages_0 < (r->count); cntr_messages_0++) {
+ NDR_CHECK(ndr_push_negoex_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->messages[cntr_messages_0]));
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 5));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_negoex_MESSAGE_ARRAY(struct ndr_pull *ndr, int ndr_flags, struct negoex_MESSAGE_ARRAY *r)
+{
+ uint32_t size_messages_0 = 0;
+ uint32_t cntr_messages_0;
+ TALLOC_CTX *_mem_save_messages_0 = NULL;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t saved_offset = ndr->offset;
+ uint32_t available = 0;
+ NDR_CHECK(ndr_pull_align(ndr, 5));
+ r->count = 0;
+ available = ndr->data_size - ndr->offset;
+ while (available > 0) {
+ uint32_t length;
+
+ /*
+ * The common header is 40 bytes
+ * and message_length is at offset 20
+ */
+ NDR_PULL_NEED_BYTES(ndr, 40);
+ ndr->offset += 20;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
+ ndr->offset -= 24;
+ if (length < 40) {
+ /*
+ * let the pull function catch the error
+ */
+ length = 40;
+ }
+ NDR_PULL_NEED_BYTES(ndr, length);
+ ndr->offset += length;
+ available -= length;
+ r->count++;
+ }
+ ndr->offset = saved_offset;
+ size_messages_0 = r->count;
+ NDR_PULL_ALLOC_N(ndr, r->messages, size_messages_0);
+ _mem_save_messages_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->messages, 0);
+ for (cntr_messages_0 = 0; cntr_messages_0 < (size_messages_0); cntr_messages_0++) {
+ NDR_CHECK(ndr_pull_negoex_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->messages[cntr_messages_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_messages_0, 0);
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_negoex.h b/librpc/ndr/ndr_negoex.h
new file mode 100644
index 0000000..d3c39b2
--- /dev/null
+++ b/librpc/ndr/ndr_negoex.h
@@ -0,0 +1,37 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special NEGOEX structures
+
+ Copyright (C) Stefan Metzmacher 2015
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/negoex.h"
+
+_PUBLIC_ void ndr_print_negoex_BYTE_VECTOR(struct ndr_print *ndr, const char *name, const struct negoex_BYTE_VECTOR *r);
+_PUBLIC_ enum ndr_err_code ndr_push_negoex_BYTE_VECTOR(struct ndr_push *ndr, int ndr_flags, const struct negoex_BYTE_VECTOR *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_negoex_BYTE_VECTOR(struct ndr_pull *ndr, int ndr_flags, struct negoex_BYTE_VECTOR *r);
+_PUBLIC_ enum ndr_err_code ndr_push_negoex_AUTH_SCHEME_VECTOR(struct ndr_push *ndr, int ndr_flags, const struct negoex_AUTH_SCHEME_VECTOR *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_negoex_AUTH_SCHEME_VECTOR(struct ndr_pull *ndr, int ndr_flags, struct negoex_AUTH_SCHEME_VECTOR *r);
+_PUBLIC_ enum ndr_err_code ndr_push_negoex_EXTENSION_VECTOR(struct ndr_push *ndr, int ndr_flags, const struct negoex_EXTENSION_VECTOR *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_negoex_EXTENSION_VECTOR(struct ndr_pull *ndr, int ndr_flags, struct negoex_EXTENSION_VECTOR *r);
+_PUBLIC_ enum ndr_err_code ndr_push_negoex_ALERT_VECTOR(struct ndr_push *ndr, int ndr_flags, const struct negoex_ALERT_VECTOR *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_negoex_ALERT_VECTOR(struct ndr_pull *ndr, int ndr_flags, struct negoex_ALERT_VECTOR *r);
+_PUBLIC_ size_t ndr_negoex_MESSAGE_header_length(const struct negoex_MESSAGE *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_negoex_MESSAGE(struct ndr_pull *ndr, int ndr_flags, struct negoex_MESSAGE *r);
+_PUBLIC_ enum ndr_err_code ndr_push_negoex_MESSAGE_ARRAY(struct ndr_push *ndr, int ndr_flags, const struct negoex_MESSAGE_ARRAY *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_negoex_MESSAGE_ARRAY(struct ndr_pull *ndr, int ndr_flags, struct negoex_MESSAGE_ARRAY *r);
diff --git a/librpc/ndr/ndr_netlogon.c b/librpc/ndr/ndr_netlogon.c
new file mode 100644
index 0000000..411f3b9
--- /dev/null
+++ b/librpc/ndr/ndr_netlogon.c
@@ -0,0 +1,65 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special netlogon types
+
+ Copyright (C) Guenther Deschner 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_netlogon.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/gen_ndr/ndr_samr.h"
+
+_PUBLIC_ enum ndr_err_code ndr_push_netr_SamDatabaseID8Bit(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID8Bit r)
+{
+ if (r > 0xff) return NDR_ERR_BUFSIZE;
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamDatabaseID8Bit(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID8Bit *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_SamDatabaseID8Bit(struct ndr_print *ndr, const char *name, enum netr_SamDatabaseID8Bit r)
+{
+ ndr_print_netr_SamDatabaseID(ndr, name, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_netr_DeltaEnum8Bit(struct ndr_push *ndr, int ndr_flags, enum netr_DeltaEnum8Bit r)
+{
+ if (r > 0xff) return NDR_ERR_BUFSIZE;
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_netr_DeltaEnum8Bit(struct ndr_pull *ndr, int ndr_flags, enum netr_DeltaEnum8Bit *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_DeltaEnum8Bit(struct ndr_print *ndr, const char *name, enum netr_DeltaEnum8Bit r)
+{
+ ndr_print_netr_DeltaEnum(ndr, name, r);
+}
diff --git a/librpc/ndr/ndr_netlogon.h b/librpc/ndr/ndr_netlogon.h
new file mode 100644
index 0000000..0e6bd6a
--- /dev/null
+++ b/librpc/ndr/ndr_netlogon.h
@@ -0,0 +1,28 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special netlogon types
+
+ Copyright (C) Guenther Deschner 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+_PUBLIC_ enum ndr_err_code ndr_push_netr_SamDatabaseID8Bit(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID8Bit r);
+_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamDatabaseID8Bit(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID8Bit *r);
+_PUBLIC_ void ndr_print_netr_SamDatabaseID8Bit(struct ndr_print *ndr, const char *name, enum netr_SamDatabaseID8Bit r);
+
+_PUBLIC_ enum ndr_err_code ndr_push_netr_DeltaEnum8Bit(struct ndr_push *ndr, int ndr_flags, enum netr_DeltaEnum8Bit r);
+_PUBLIC_ enum ndr_err_code ndr_pull_netr_DeltaEnum8Bit(struct ndr_pull *ndr, int ndr_flags, enum netr_DeltaEnum8Bit *r);
+_PUBLIC_ void ndr_print_netr_DeltaEnum8Bit(struct ndr_print *ndr, const char *name, enum netr_DeltaEnum8Bit r);
diff --git a/librpc/ndr/ndr_ntlmssp.c b/librpc/ndr/ndr_ntlmssp.c
new file mode 100644
index 0000000..021bc40
--- /dev/null
+++ b/librpc/ndr/ndr_ntlmssp.c
@@ -0,0 +1,195 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special ntlmssp structures
+
+ Copyright (C) Guenther Deschner 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../librpc/gen_ndr/ndr_ntlmssp.h"
+
+_PUBLIC_ size_t ndr_ntlmssp_string_length(uint32_t negotiate_flags, const char *s)
+{
+ if (!s) {
+ return 0;
+ }
+
+ if (negotiate_flags & NTLMSSP_NEGOTIATE_UNICODE) {
+ return strlen(s) * 2;
+ }
+
+ return strlen(s);
+}
+
+_PUBLIC_ uint32_t ndr_ntlmssp_negotiated_string_flags(uint32_t negotiate_flags)
+{
+ uint32_t flags = LIBNDR_FLAG_STR_NOTERM |
+ LIBNDR_FLAG_STR_CHARLEN |
+ LIBNDR_FLAG_REMAINING;
+
+ if (!(negotiate_flags & NTLMSSP_NEGOTIATE_UNICODE)) {
+ flags |= LIBNDR_FLAG_STR_ASCII;
+ }
+
+ return flags;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_AV_PAIR_LIST(struct ndr_push *ndr, int ndr_flags, const struct AV_PAIR_LIST *r)
+{
+ uint32_t cntr_pair_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ for (cntr_pair_0 = 0; cntr_pair_0 < r->count; cntr_pair_0++) {
+ NDR_CHECK(ndr_push_AV_PAIR(ndr, NDR_SCALARS, &r->pair[cntr_pair_0]));
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ for (cntr_pair_0 = 0; cntr_pair_0 < r->count; cntr_pair_0++) {
+ NDR_CHECK(ndr_push_AV_PAIR(ndr, NDR_BUFFERS, &r->pair[cntr_pair_0]));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_AV_PAIR_LIST(struct ndr_pull *ndr, int ndr_flags, struct AV_PAIR_LIST *r)
+{
+ uint32_t cntr_pair_0;
+ TALLOC_CTX *_mem_save_pair_0;
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t offset = 0;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ r->count = 0;
+ if (ndr->data_size > 0) {
+ NDR_PULL_NEED_BYTES(ndr, 4);
+ }
+ while (offset + 4 <= ndr->data_size) {
+ uint16_t length;
+ uint16_t type;
+ type = SVAL(ndr->data + offset, 0);
+ if (type == MsvAvEOL) {
+ r->count++;
+ break;
+ }
+ length = SVAL(ndr->data + offset, 2);
+ offset += length + 4;
+ r->count++;
+ }
+ NDR_PULL_ALLOC_N(ndr, r->pair, r->count);
+ _mem_save_pair_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->pair, 0);
+ for (cntr_pair_0 = 0; cntr_pair_0 < r->count; cntr_pair_0++) {
+ NDR_CHECK(ndr_pull_AV_PAIR(ndr, NDR_SCALARS, &r->pair[cntr_pair_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pair_0, 0);
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ _mem_save_pair_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->pair, 0);
+ for (cntr_pair_0 = 0; cntr_pair_0 < r->count; cntr_pair_0++) {
+ NDR_CHECK(ndr_pull_AV_PAIR(ndr, NDR_BUFFERS, &r->pair[cntr_pair_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pair_0, 0);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ntlmssp_nt_response(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *nt_response,
+ bool ntlmv2)
+{
+ enum ndr_err_code ndr_err;
+
+ if (ntlmv2) {
+ struct NTLMv2_RESPONSE nt;
+ if (nt_response->length > 24) {
+ ndr_err = ndr_pull_struct_blob(nt_response, mem_ctx, &nt,
+ (ndr_pull_flags_fn_t)ndr_pull_NTLMv2_RESPONSE);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NDR_PRINT_DEBUG(NTLMv2_RESPONSE, &nt);
+ }
+ }
+ } else {
+ struct NTLM_RESPONSE nt;
+ if (nt_response->length == 24) {
+ ndr_err = ndr_pull_struct_blob(nt_response, mem_ctx, &nt,
+ (ndr_pull_flags_fn_t)ndr_pull_NTLM_RESPONSE);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NDR_PRINT_DEBUG(NTLM_RESPONSE, &nt);
+ }
+ }
+ }
+}
+
+_PUBLIC_ void ndr_print_ntlmssp_lm_response(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *lm_response,
+ bool ntlmv2)
+{
+ enum ndr_err_code ndr_err;
+
+ if (ntlmv2) {
+ struct LMv2_RESPONSE lm;
+ if (lm_response->length == 24) {
+ ndr_err = ndr_pull_struct_blob(lm_response, mem_ctx, &lm,
+ (ndr_pull_flags_fn_t)ndr_pull_LMv2_RESPONSE);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NDR_PRINT_DEBUG(LMv2_RESPONSE, &lm);
+ }
+ }
+ } else {
+ struct LM_RESPONSE lm;
+ if (lm_response->length == 24) {
+ ndr_err = ndr_pull_struct_blob(lm_response, mem_ctx, &lm,
+ (ndr_pull_flags_fn_t)ndr_pull_LM_RESPONSE);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NDR_PRINT_DEBUG(LM_RESPONSE, &lm);
+ }
+ }
+ }
+}
+
+_PUBLIC_ void ndr_print_ntlmssp_Version(struct ndr_print *ndr, const char *name, const union ntlmssp_Version *r)
+{
+ int level;
+ level = ndr_print_steal_switch_value(ndr, r);
+ switch (level) {
+ case NTLMSSP_NEGOTIATE_VERSION:
+ ndr_print_ntlmssp_VERSION(ndr, name, &r->version);
+ break;
+
+ default:
+ break;
+
+ }
+}
+
+_PUBLIC_ struct AV_PAIR *ndr_ntlmssp_find_av(const struct AV_PAIR_LIST *av_list,
+ enum ntlmssp_AvId AvId)
+{
+ struct AV_PAIR *res = NULL;
+ uint32_t i = 0;
+
+ for (i = 0; i < av_list->count; i++) {
+ if (av_list->pair[i].AvId != AvId) {
+ continue;
+ }
+
+ res = discard_const_p(struct AV_PAIR, &av_list->pair[i]);
+ break;
+ }
+
+ return res;
+}
diff --git a/librpc/ndr/ndr_ntlmssp.h b/librpc/ndr/ndr_ntlmssp.h
new file mode 100644
index 0000000..5c979ff
--- /dev/null
+++ b/librpc/ndr/ndr_ntlmssp.h
@@ -0,0 +1,35 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special ntlmssp structures
+
+ Copyright (C) Guenther Deschner 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+_PUBLIC_ size_t ndr_ntlmssp_string_length(uint32_t negotiate_flags, const char *s);
+_PUBLIC_ uint32_t ndr_ntlmssp_negotiated_string_flags(uint32_t negotiate_flags);
+_PUBLIC_ enum ndr_err_code ndr_push_AV_PAIR_LIST(struct ndr_push *ndr, int ndr_flags, const struct AV_PAIR_LIST *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_AV_PAIR_LIST(struct ndr_pull *ndr, int ndr_flags, struct AV_PAIR_LIST *r);
+_PUBLIC_ void ndr_print_ntlmssp_nt_response(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *nt_response,
+ bool ntlmv2);
+_PUBLIC_ void ndr_print_ntlmssp_lm_response(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *lm_response,
+ bool ntlmv2);
+_PUBLIC_ void ndr_print_ntlmssp_Version(struct ndr_print *ndr, const char *name, const union ntlmssp_Version *r);
+
+_PUBLIC_ struct AV_PAIR *ndr_ntlmssp_find_av(const struct AV_PAIR_LIST *av_list,
+ enum ntlmssp_AvId AvId);
diff --git a/librpc/ndr/ndr_ntprinting.c b/librpc/ndr/ndr_ntprinting.c
new file mode 100644
index 0000000..e4f47bb
--- /dev/null
+++ b/librpc/ndr/ndr_ntprinting.c
@@ -0,0 +1,87 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special ntprinting structures
+
+ Copyright (C) Guenther Deschner 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../librpc/gen_ndr/ndr_ntprinting.h"
+
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags)
+{
+ uint32_t flags = LIBNDR_FLAG_STR_NULLTERM;
+
+ if (string_flags & LIBNDR_FLAG_STR_ASCII) {
+ flags |= LIBNDR_FLAG_STR_ASCII;
+ } else if (string_flags & LIBNDR_FLAG_STR_RAW8) {
+ flags |= LIBNDR_FLAG_STR_RAW8;
+ } else {
+ flags |= LIBNDR_FLAG_STR_UTF8;
+ }
+
+ return flags;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r)
+{
+ uint32_t _ptr_devmode;
+ TALLOC_CTX *_mem_save_devmode_0;
+ {
+ 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, 5));
+ NDR_CHECK(ndr_pull_ntprinting_printer_info(ndr, NDR_SCALARS, &r->info));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_devmode));
+ if (_ptr_devmode) {
+ NDR_PULL_ALLOC(ndr, r->devmode);
+ } else {
+ r->devmode = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->devmode) {
+ _mem_save_devmode_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->devmode, 0);
+ r->devmode->string_flags = r->info.string_flags;
+ NDR_CHECK(ndr_pull_ntprinting_devicemode(ndr, NDR_SCALARS|NDR_BUFFERS, r->devmode));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devmode_0, 0);
+ }
+ }
+ if (ndr_flags & NDR_SCALARS) {
+ r->count = 0;
+ NDR_PULL_ALLOC_N(ndr, r->printer_data, r->count);
+ while (ndr->offset + 4 <= ndr->data_size) {
+ uint32_t ptr = 0;
+ ptr = IVAL(ndr->data, ndr->offset);
+ if (ptr == 0) {
+ ndr->offset = ndr->offset + 4;
+ break;
+ }
+ r->printer_data = talloc_realloc(ndr, r->printer_data, struct ntprinting_printer_data, r->count + 1);
+ NDR_ERR_HAVE_NO_MEMORY(r->printer_data);
+ r->printer_data[r->count].string_flags = r->info.string_flags;
+ NDR_CHECK(ndr_pull_ntprinting_printer_data(ndr, NDR_SCALARS, &r->printer_data[r->count]));
+ r->count++;
+ }
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_ntprinting.h b/librpc/ndr/ndr_ntprinting.h
new file mode 100644
index 0000000..3b6ee01
--- /dev/null
+++ b/librpc/ndr/ndr_ntprinting.h
@@ -0,0 +1,27 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special ntprinting structures
+
+ Copyright (C) Guenther Deschner 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../librpc/gen_ndr/ndr_ntprinting.h"
+
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags);
+
+_PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r);
diff --git a/librpc/ndr/ndr_orpc.c b/librpc/ndr/ndr_orpc.c
new file mode 100644
index 0000000..01ba885
--- /dev/null
+++ b/librpc/ndr/ndr_orpc.c
@@ -0,0 +1,163 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling DCOM string arrays
+
+ Copyright (C) Jelmer Vernooij 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_orpc.h"
+
+enum ndr_err_code ndr_pull_DUALSTRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct DUALSTRINGARRAY *ar)
+{
+ uint16_t num_entries, security_offset;
+ uint16_t towerid;
+ uint32_t towernum = 0, conformant_size;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &conformant_size));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &security_offset));
+
+ ar->stringbindings = talloc_array(ndr, struct STRINGBINDING *, 1);
+ ar->stringbindings[0] = NULL;
+
+ do {
+ /* 'Peek' */
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
+
+ if (towerid > 0) {
+ ndr->offset -= 2;
+ ar->stringbindings = talloc_realloc(ndr, ar->stringbindings, struct STRINGBINDING *, towernum+2);
+ ar->stringbindings[towernum] = talloc(ndr, struct STRINGBINDING);
+ NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
+ towernum++;
+ }
+ } while (towerid != 0);
+
+ ar->stringbindings[towernum] = NULL;
+ towernum = 0;
+
+ ar->securitybindings = talloc_array(ndr, struct SECURITYBINDING *, 1);
+ ar->securitybindings[0] = NULL;
+
+ do {
+ /* 'Peek' */
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
+
+ if (towerid > 0) {
+ ndr->offset -= 2;
+ ar->securitybindings = talloc_realloc(ndr, ar->securitybindings, struct SECURITYBINDING *, towernum+2);
+ ar->securitybindings[towernum] = talloc(ndr, struct SECURITYBINDING);
+ NDR_CHECK(ndr_pull_SECURITYBINDING(ndr, ndr_flags, ar->securitybindings[towernum]));
+ towernum++;
+ }
+ } while (towerid != 0);
+
+ ar->securitybindings[towernum] = NULL;
+
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_DUALSTRINGARRAY(struct ndr_push *ndr, int ndr_flags, const struct DUALSTRINGARRAY *ar)
+{
+ return ndr_push_error(ndr, NDR_ERR_STRING, "ndr_push_DUALSTRINGARRAY not implemented");
+}
+
+/*
+ print a dom_sid
+*/
+void ndr_print_DUALSTRINGARRAY(struct ndr_print *ndr, const char *name, const struct DUALSTRINGARRAY *ar)
+{
+ int i;
+ ndr->print(ndr, "%-25s: DUALSTRINGARRAY", name);
+ ndr->depth++;
+ ndr->print(ndr, "STRING BINDINGS");
+ ndr->depth++;
+ for (i=0;ar->stringbindings[i];i++) {
+ char idx[13]; /* 2^32 has 10 digits */
+ snprintf(idx, sizeof(idx), "[%d]", i);
+ ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
+ }
+ ndr->depth--;
+ ndr->print(ndr, "SECURITY BINDINGS");
+ ndr->depth++;
+ for (i=0;ar->securitybindings[i];i++) {
+ char idx[13]; /* 2^32 has 10 digits */
+ snprintf(idx, sizeof(idx), "[%d]", i);
+ ndr_print_SECURITYBINDING(ndr, idx, ar->securitybindings[i]);
+ }
+ ndr->depth--;
+}
+
+enum ndr_err_code ndr_pull_STRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct STRINGARRAY *ar)
+{
+ uint16_t towerid;
+ uint32_t towernum = 0;
+ uint16_t num_entries;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
+
+ ar->stringbindings = talloc_array(ndr, struct STRINGBINDING *, 1);
+ ar->stringbindings[0] = NULL;
+
+ do {
+ /* 'Peek' */
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
+
+ if (towerid > 0) {
+ ndr->offset -= 2;
+ ar->stringbindings = talloc_realloc(ndr, ar->stringbindings, struct STRINGBINDING *, towernum+2);
+ ar->stringbindings[towernum] = talloc(ndr, struct STRINGBINDING);
+ NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
+ towernum++;
+ }
+ } while (towerid != 0);
+
+ ar->stringbindings[towernum] = NULL;
+
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_STRINGARRAY(struct ndr_push *ndr, int ndr_flags, const struct STRINGARRAY *ar)
+{
+ return ndr_push_error(ndr, NDR_ERR_STRING, "ndr_push_STRINGARRAY not implemented");
+}
+
+/*
+ print a dom_sid
+*/
+void ndr_print_STRINGARRAY(struct ndr_print *ndr, const char *name, const struct STRINGARRAY *ar)
+{
+ int i;
+ ndr->print(ndr, "%-25s: STRINGARRAY", name);
+ ndr->depth++;
+ for (i=0;ar->stringbindings[i];i++) {
+ char idx[13]; /* 2^32 has 10 digits */
+ snprintf(idx, sizeof(idx), "[%d]", i);
+ ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
+ }
+ ndr->depth--;
+}
diff --git a/librpc/ndr/ndr_preg.c b/librpc/ndr/ndr_preg.c
new file mode 100644
index 0000000..2c684e2
--- /dev/null
+++ b/librpc/ndr/ndr_preg.c
@@ -0,0 +1,69 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling preg structures
+
+ Copyright (C) Guenther Deschner 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_preg.h"
+
+_PUBLIC_ enum ndr_err_code ndr_push_preg_file(struct ndr_push *ndr, int ndr_flags, const struct preg_file *r)
+{
+ uint32_t cntr_entries_0;
+ {
+ 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_preg_header(ndr, NDR_SCALARS, &r->header));
+ for (cntr_entries_0 = 0; cntr_entries_0 < r->num_entries; cntr_entries_0++) {
+ NDR_CHECK(ndr_push_preg_entry(ndr, NDR_SCALARS, &r->entries[cntr_entries_0]));
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_preg_file(struct ndr_pull *ndr, int ndr_flags, struct preg_file *r)
+{
+ {
+ 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_preg_header(ndr, NDR_SCALARS, &r->header));
+ r->num_entries = 0;
+ NDR_PULL_ALLOC_N(ndr, r->entries, r->num_entries);
+ while (ndr->offset + 12 <= ndr->data_size) {
+ r->entries = talloc_realloc(ndr, r->entries, struct preg_entry, r->num_entries + 1);
+ NDR_ERR_HAVE_NO_MEMORY(r->entries);
+ NDR_CHECK(ndr_pull_preg_entry(ndr, NDR_SCALARS, &r->entries[r->num_entries]));
+ r->num_entries++;
+ }
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_preg.h b/librpc/ndr/ndr_preg.h
new file mode 100644
index 0000000..d781e13
--- /dev/null
+++ b/librpc/ndr/ndr_preg.h
@@ -0,0 +1,23 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling preg structures
+
+ Copyright (C) Guenther Deschner 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+_PUBLIC_ enum ndr_err_code ndr_push_preg_file(struct ndr_push *ndr, int ndr_flags, const struct preg_file *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_preg_file(struct ndr_pull *ndr, int ndr_flags, struct preg_file *r);
diff --git a/librpc/ndr/ndr_private.h b/librpc/ndr/ndr_private.h
new file mode 100644
index 0000000..08521be
--- /dev/null
+++ b/librpc/ndr/ndr_private.h
@@ -0,0 +1,32 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* This is not a public header file that is installed as part of Samba.
+ *
+ * Instead, this is to allow our python layer to get to the
+ * NDR_TOKEN_MAX_LIST_SIZE
+*/
+
+#ifndef __NDR_PRIVATE_H__
+#define __NDR_PRIVATE_H__
+
+size_t ndr_token_max_list_size(void);
+
+#endif
diff --git a/librpc/ndr/ndr_rap.c b/librpc/ndr/ndr_rap.c
new file mode 100644
index 0000000..ea18a08
--- /dev/null
+++ b/librpc/ndr/ndr_rap.c
@@ -0,0 +1,28 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special rap types
+
+ Copyright (C) Guenther Deschner 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_rap.h"
+
+_PUBLIC_ void ndr_print_rap_status(struct ndr_print *ndr, const char *name, enum rap_status r)
+{
+ ndr_print_WERROR(ndr, name, W_ERROR(r));
+}
diff --git a/librpc/ndr/ndr_rap.h b/librpc/ndr/ndr_rap.h
new file mode 100644
index 0000000..35a03b1
--- /dev/null
+++ b/librpc/ndr/ndr_rap.h
@@ -0,0 +1,22 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special rap types
+
+ Copyright (C) Guenther Deschner 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+_PUBLIC_ void ndr_print_rap_status(struct ndr_print *ndr, const char *name, enum rap_status r);
diff --git a/librpc/ndr/ndr_schannel.c b/librpc/ndr/ndr_schannel.c
new file mode 100644
index 0000000..6b08a79
--- /dev/null
+++ b/librpc/ndr/ndr_schannel.c
@@ -0,0 +1,107 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special schannel structures
+
+ Copyright (C) Guenther Deschner 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../librpc/gen_ndr/ndr_schannel.h"
+#include "../librpc/ndr/ndr_schannel.h"
+#include "../libcli/nbt/libnbt.h"
+
+_PUBLIC_ void ndr_print_NL_AUTH_MESSAGE_BUFFER(struct ndr_print *ndr, const char *name, const union NL_AUTH_MESSAGE_BUFFER *r)
+{
+ int level;
+ level = ndr_print_steal_switch_value(ndr, r);
+ switch (level) {
+ case NL_FLAG_OEM_NETBIOS_DOMAIN_NAME:
+ ndr_print_string(ndr, name, r->a);
+ break;
+
+ case NL_FLAG_OEM_NETBIOS_COMPUTER_NAME:
+ ndr_print_string(ndr, name, r->a);
+ break;
+
+ case NL_FLAG_UTF8_DNS_DOMAIN_NAME:
+ ndr_print_nbt_string(ndr, name, r->u);
+ break;
+
+ case NL_FLAG_UTF8_DNS_HOST_NAME:
+ ndr_print_nbt_string(ndr, name, r->u);
+ break;
+
+ case NL_FLAG_UTF8_NETBIOS_COMPUTER_NAME:
+ ndr_print_nbt_string(ndr, name, r->u);
+ break;
+
+ default:
+ break;
+
+ }
+}
+
+_PUBLIC_ void ndr_print_NL_AUTH_MESSAGE_BUFFER_REPLY(struct ndr_print *ndr, const char *name, const union NL_AUTH_MESSAGE_BUFFER_REPLY *r)
+{
+ int level;
+ level = ndr_print_steal_switch_value(ndr, r);
+ switch (level) {
+ case NL_NEGOTIATE_RESPONSE:
+ ndr_print_uint32(ndr, name, r->dummy);
+ break;
+
+ default:
+ break;
+
+ }
+}
+
+void dump_NL_AUTH_SIGNATURE(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *blob)
+{
+ enum ndr_err_code ndr_err;
+ uint16_t signature_algorithm;
+
+ if (blob->length < 2) {
+ return;
+ }
+
+ signature_algorithm = SVAL(blob->data, 0);
+
+ switch (signature_algorithm) {
+ case NL_SIGN_HMAC_MD5: {
+ struct NL_AUTH_SIGNATURE r;
+ ndr_err = ndr_pull_struct_blob(blob, mem_ctx, &r,
+ (ndr_pull_flags_fn_t)ndr_pull_NL_AUTH_SIGNATURE);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NDR_PRINT_DEBUG(NL_AUTH_SIGNATURE, &r);
+ }
+ break;
+ }
+ case NL_SIGN_HMAC_SHA256: {
+ struct NL_AUTH_SHA2_SIGNATURE r;
+ ndr_err = ndr_pull_struct_blob(blob, mem_ctx, &r,
+ (ndr_pull_flags_fn_t)ndr_pull_NL_AUTH_SHA2_SIGNATURE);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NDR_PRINT_DEBUG(NL_AUTH_SHA2_SIGNATURE, &r);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+}
diff --git a/librpc/ndr/ndr_schannel.h b/librpc/ndr/ndr_schannel.h
new file mode 100644
index 0000000..d57278c
--- /dev/null
+++ b/librpc/ndr/ndr_schannel.h
@@ -0,0 +1,25 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special schannel structures
+
+ Copyright (C) Guenther Deschner 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+void ndr_print_NL_AUTH_MESSAGE_BUFFER(struct ndr_print *ndr, const char *name, const union NL_AUTH_MESSAGE_BUFFER *r);
+void ndr_print_NL_AUTH_MESSAGE_BUFFER_REPLY(struct ndr_print *ndr, const char *name, const union NL_AUTH_MESSAGE_BUFFER_REPLY *r);
+void dump_NL_AUTH_SIGNATURE(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *blob);
diff --git a/librpc/ndr/ndr_sec_helper.c b/librpc/ndr/ndr_sec_helper.c
new file mode 100644
index 0000000..3adb46f
--- /dev/null
+++ b/librpc/ndr/ndr_sec_helper.c
@@ -0,0 +1,338 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ fast routines for getting the wire size of security objects
+
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Stefan Metzmacher 2006-2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_security.h"
+#include "../libcli/security/security.h"
+
+/*
+ return the wire size of a security_ace
+*/
+size_t ndr_size_security_ace(const struct security_ace *ace, int flags)
+{
+ size_t ret;
+
+ if (!ace) return 0;
+
+ ret = 8 + ndr_size_dom_sid(&ace->trustee, flags);
+
+ switch (ace->type) {
+ case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+ case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+ case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+ case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+ ret += 4; /* uint32 bitmap ace->object.object.flags */
+ if (ace->object.object.flags & SEC_ACE_OBJECT_TYPE_PRESENT) {
+ ret += 16; /* GUID ace->object.object.type.type */
+ }
+ if (ace->object.object.flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT) {
+ ret += 16; /* GUID ace->object.object.inherited_typeinherited_type */
+ }
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t start_ofs = ndr->offset;
+ uint32_t size = 0;
+ uint32_t pad = 0;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type));
+ NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee));
+ size = ndr->offset - start_ofs;
+ if (r->size < size) {
+ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_pull_security_ace: r->size %u < size %u",
+ (unsigned)r->size, size);
+ }
+ pad = r->size - size;
+ NDR_PULL_NEED_BYTES(ndr, pad);
+ ndr->offset += pad;
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type));
+ NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ return the wire size of a security_acl
+*/
+size_t ndr_size_security_acl(const struct security_acl *theacl, int flags)
+{
+ size_t ret;
+ int i;
+ if (!theacl) return 0;
+ ret = 8;
+ for (i=0;i<theacl->num_aces;i++) {
+ ret += ndr_size_security_ace(&theacl->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;
+}
+
+/*
+ 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)
+{
+ if (!sid) return 0;
+
+ if (all_zero((const uint8_t *)sid, sizeof(struct dom_sid))) {
+ return 0;
+ }
+
+ return 8 + 4*sid->num_auths;
+}
+
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags)
+{
+ return ndr_size_dom_sid28(sid, flags);
+}
+
+/*
+ print a dom_sid
+*/
+void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+ struct dom_sid_buf buf;
+ ndr->print(ndr, "%-25s: %s", name, dom_sid_str_buf(sid, &buf));
+}
+
+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);
+}
+
+void ndr_print_dom_sid0(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
+*/
+enum ndr_err_code 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 NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_pull_uint3264(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 NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field
+*/
+enum ndr_err_code ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
+{
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_push_uint3264(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 up to 5 sub_auth
+*/
+enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
+{
+ enum ndr_err_code status;
+ struct ndr_pull *subndr;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ subndr = talloc_zero(ndr, struct ndr_pull);
+ NDR_ERR_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 (!NDR_ERR_CODE_IS_SUCCESS(status)) {
+ /* handle a w2k bug which send random data in the buffer */
+ ZERO_STRUCTP(sid);
+ } else if (sid->num_auths == 0) {
+ ZERO_STRUCT(sid->sub_auths);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a dom_sid28 - this is a dom_sid in a 28 byte fixed buffer
+*/
+enum ndr_err_code 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 NDR_ERR_SUCCESS;
+ }
+
+ if (sid->num_auths > 5) {
+ return ndr_push_error(ndr, NDR_ERR_RANGE,
+ "dom_sid28 allows only up to 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 NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
+{
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (ndr->data_size == ndr->offset) {
+ ZERO_STRUCTP(sid);
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_pull_dom_sid(ndr, ndr_flags, sid);
+}
+
+/*
+ push a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
+{
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (!sid) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (all_zero((const uint8_t *)sid, sizeof(struct dom_sid))) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_push_dom_sid(ndr, ndr_flags, sid);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *r)
+{
+ uint32_t cntr_sub_auths_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->sid_rev_num));
+ NDR_CHECK(ndr_push_int8(ndr, NDR_SCALARS, r->num_auths));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->id_auth, 6));
+ if (r->num_auths < 0 || r->num_auths > ARRAY_SIZE(r->sub_auths)) {
+ return ndr_push_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ for (cntr_sub_auths_0 = 0; cntr_sub_auths_0 < r->num_auths; cntr_sub_auths_0++) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sub_auths[cntr_sub_auths_0]));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dom_sid(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *r)
+{
+ uint32_t cntr_sub_auths_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->sid_rev_num));
+ NDR_CHECK(ndr_pull_int8(ndr, NDR_SCALARS, &r->num_auths));
+ if (r->num_auths < 0 || r->num_auths > ARRAY_SIZE(r->sub_auths)) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->id_auth, 6));
+ ZERO_STRUCT(r->sub_auths);
+ for (cntr_sub_auths_0 = 0; cntr_sub_auths_0 < r->num_auths; cntr_sub_auths_0++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sub_auths[cntr_sub_auths_0]));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c
new file mode 100644
index 0000000..c5fa82c
--- /dev/null
+++ b/librpc/ndr/ndr_spoolss_buf.c
@@ -0,0 +1,1615 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling spoolss subcontext buffer structures
+
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Tim Potter 2003
+ Copyright (C) Guenther Deschner 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_spoolss.h"
+#include "librpc/gen_ndr/ndr_security.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.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_IN_LEVEL(fn) do { \
+ _r.in.level = r->in.level;\
+ NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
+} while(0)
+
+#define NDR_SPOOLSS_PUSH_ENUM_OUT_LEVEL(fn) do { \
+ DATA_BLOB _data_blob_info = data_blob_null;\
+ struct ndr_push *_ndr_info = NULL;\
+ _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->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) {\
+ _ndr_info = ndr_push_init_ctx(ndr);\
+ NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
+ _ndr_info->flags= ndr->flags;\
+ if (r->out.info) {\
+ struct ndr_push *_subndr_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_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
+ NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
+ NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
+ }\
+ 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_OUT(fn) do { \
+ DATA_BLOB _data_blob_info = data_blob_null;\
+ struct ndr_push *_ndr_info = NULL;\
+ _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->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) {\
+ _ndr_info = ndr_push_init_ctx(ndr);\
+ NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
+ _ndr_info->flags= ndr->flags;\
+ if (r->out.info) {\
+ struct ndr_push *_subndr_info;\
+ struct __##fn __r;\
+ __r.in.count = *r->out.count;\
+ __r.out.info = *r->out.info;\
+ NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
+ NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
+ NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
+ }\
+ 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_LEVEL(fn,in,out) do { \
+ struct _##fn _r;\
+ if (flags & NDR_IN) {\
+ in;\
+ NDR_SPOOLSS_PUSH_ENUM_IN_LEVEL(fn);\
+ }\
+ if (flags & NDR_OUT) {\
+ out;\
+ NDR_SPOOLSS_PUSH_ENUM_OUT_LEVEL(fn);\
+ }\
+} 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_COMMON(fn) do { \
+ ZERO_STRUCT(r->out);\
+ r->in.buffer = _r.in.buffer;\
+ r->in.offered = _r.in.offered;\
+ r->out.needed = _r.out.needed;\
+ r->out.count = _r.out.count;\
+ 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);\
+ }\
+ NDR_PULL_ALLOC(ndr, r->out.info);\
+ ZERO_STRUCTP(r->out.info);\
+} while(0)
+
+#define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
+ NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
+ NDR_SPOOLSS_PULL_ENUM_IN_COMMON(fn); \
+} while(0)
+
+#define NDR_SPOOLSS_PULL_ENUM_IN_LEVEL(fn) do { \
+ NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
+ r->in.level = _r.in.level;\
+ NDR_SPOOLSS_PULL_ENUM_IN_COMMON(fn); \
+} while(0)
+
+#define NDR_SPOOLSS_PULL_ENUM_OUT_LEVEL(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;\
+ _r.out.count = r->out.count;\
+ NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
+ NDR_PULL_ALLOC(ndr, r->out.info);\
+ }\
+ *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_ALLOC(ndr, *r->out.info);\
+ _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info);\
+ NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
+ _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_OUT(fn) do { \
+ _r.in.buffer = r->in.buffer;\
+ _r.in.offered = r->in.offered;\
+ _r.out.needed = r->out.needed;\
+ _r.out.count = r->out.count;\
+ NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
+ NDR_PULL_ALLOC(ndr, r->out.info);\
+ }\
+ *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_ALLOC(ndr, *r->out.info);\
+ _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info);\
+ NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
+ _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.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_LEVEL(fn,in,out) do { \
+ struct _##fn _r;\
+ if (flags & NDR_IN) {\
+ out;\
+ NDR_SPOOLSS_PULL_ENUM_IN_LEVEL(fn);\
+ in;\
+ }\
+ if (flags & NDR_OUT) {\
+ out;\
+ NDR_SPOOLSS_PULL_ENUM_OUT_LEVEL(fn);\
+ }\
+} 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 {\
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = call; \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
+ return 0; \
+ }\
+} while (0)
+
+/* TODO: set _ndr_info->flags correct */
+#define NDR_SPOOLSS_SIZE_ENUM_LEVEL(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|=LIBNDR_FLAG_NO_NDR_SIZE;\
+ __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)
+
+/* 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|=LIBNDR_FLAG_NO_NDR_SIZE;\
+ __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
+*/
+enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM_LEVEL(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 NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
+{
+ NDR_SPOOLSS_PULL_ENUM_LEVEL(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 NDR_ERR_SUCCESS;
+}
+
+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_LEVEL(spoolss_EnumPrinters);
+}
+
+/*
+ spoolss_EnumJobs
+*/
+enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM_LEVEL(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 NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
+{
+ NDR_SPOOLSS_PULL_ENUM_LEVEL(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 NDR_ERR_SUCCESS;
+}
+
+uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
+{
+ NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
+}
+
+/*
+ spoolss_EnumPrinterDrivers
+*/
+enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM_LEVEL(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 NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
+{
+ NDR_SPOOLSS_PULL_ENUM_LEVEL(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 NDR_ERR_SUCCESS;
+}
+
+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_LEVEL(spoolss_EnumPrinterDrivers);
+}
+
+/*
+ spoolss_EnumForms
+*/
+enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumForms,{
+ _r.in.handle = r->in.handle;
+ },{
+ _r.in.handle = r->in.handle;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
+{
+ NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumForms,{
+ r->in.handle = _r.in.handle;
+ },{
+ _r.in.handle = r->in.handle;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+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_LEVEL(spoolss_EnumForms);
+}
+
+/*
+ spoolss_EnumPorts
+*/
+enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPorts,{
+ _r.in.servername= r->in.servername;
+ },{
+ _r.in.servername= r->in.servername;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
+{
+ NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPorts,{
+ r->in.servername= _r.in.servername;
+ },{
+ _r.in.servername= r->in.servername;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+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_LEVEL(spoolss_EnumPorts);
+}
+
+/*
+ spoolss_EnumMonitors
+*/
+enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumMonitors,{
+ _r.in.servername= r->in.servername;
+ },{
+ _r.in.servername= r->in.servername;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
+{
+ NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumMonitors,{
+ r->in.servername= _r.in.servername;
+ },{
+ _r.in.servername= r->in.servername;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+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_LEVEL(spoolss_EnumMonitors);
+}
+
+/*
+ spoolss_EnumPrintProcessors
+*/
+enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM_LEVEL(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 NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
+{
+ NDR_SPOOLSS_PULL_ENUM_LEVEL(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 NDR_ERR_SUCCESS;
+}
+
+uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx,
+ uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
+{
+ NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors);
+}
+
+/*
+ spoolss_EnumPrintProcessors
+*/
+enum ndr_err_code ndr_push_spoolss_EnumPrintProcessorDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessorDataTypes *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes,{
+ _r.in.servername = r->in.servername;
+ _r.in.print_processor_name = r->in.print_processor_name;
+ },{
+ _r.in.servername = r->in.servername;
+ _r.in.print_processor_name = r->in.print_processor_name;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessorDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessorDataTypes *r)
+{
+ NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes,{
+ r->in.servername = _r.in.servername;
+ r->in.print_processor_name = _r.in.print_processor_name;
+ },{
+ _r.in.servername = r->in.servername;
+ _r.in.print_processor_name = r->in.print_processor_name;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+uint32_t ndr_size_spoolss_EnumPrintProcessorDataTypes_info(TALLOC_CTX *mem_ctx,
+ uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info)
+{
+ NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes);
+}
+
+/*
+ spoolss_EnumPerMachineConnections
+*/
+enum ndr_err_code ndr_push_spoolss_EnumPerMachineConnections(struct ndr_push *ndr, int flags, const struct spoolss_EnumPerMachineConnections *r)
+{
+ NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPerMachineConnections,{
+ _r.in.server = r->in.server;
+ },{
+ _r.in.server = r->in.server;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumPerMachineConnections(struct ndr_pull *ndr, int flags, struct spoolss_EnumPerMachineConnections *r)
+{
+ NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPerMachineConnections,{
+ r->in.server = _r.in.server;
+ },{
+ _r.in.server = r->in.server;
+ });
+ return NDR_ERR_SUCCESS;
+}
+
+uint32_t ndr_size_spoolss_EnumPerMachineConnections_info(TALLOC_CTX *mem_ctx, uint32_t count, struct spoolss_PrinterInfo4 *info)
+{
+ NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPerMachineConnections);
+}
+
+/*
+ spoolss_EnumPrinterDataEx
+*/
+
+enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
+{
+ struct _spoolss_EnumPrinterDataEx _r;
+ if (flags & NDR_IN) {
+ _r.in.handle = r->in.handle;
+ _r.in.key_name = r->in.key_name;
+ _r.in.offered = r->in.offered;
+ NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
+ }
+ if (flags & NDR_OUT) {
+ struct ndr_push *_ndr_info;
+ _r.in.handle = r->in.handle;
+ _r.in.key_name = r->in.key_name;
+ _r.in.offered = r->in.offered;
+ _r.out.count = r->out.count;
+ _r.out.needed = r->out.needed;
+ _r.out.result = r->out.result;
+ _r.out.info = data_blob(NULL, 0);
+ if (r->in.offered >= *r->out.needed) {
+ struct ndr_push *_subndr_info;
+ struct __spoolss_EnumPrinterDataEx __r;
+ _ndr_info = ndr_push_init_ctx(ndr);
+ NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
+ _ndr_info->flags= ndr->flags;
+ __r.in.count = *r->out.count;
+ __r.out.info = *r->out.info;
+ NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));
+ NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_subndr_info, flags, &__r));
+ NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));
+ 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.info = ndr_push_blob(_ndr_info);
+ }
+ NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
+{
+ struct _spoolss_EnumPrinterDataEx _r;
+ if (flags & NDR_IN) {
+ _r.in.handle = r->in.handle;
+ _r.in.key_name = r->in.key_name;
+ ZERO_STRUCT(r->out);
+ NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
+ r->in.handle = _r.in.handle;
+ r->in.key_name = _r.in.key_name;
+ r->in.offered = _r.in.offered;
+ r->out.needed = _r.out.needed;
+ r->out.count = _r.out.count;
+ NDR_PULL_ALLOC(ndr, r->out.info);
+ ZERO_STRUCTP(r->out.info);
+ }
+ if (flags & NDR_OUT) {
+ _r.in.handle = r->in.handle;
+ _r.in.key_name = r->in.key_name;
+ _r.in.offered = r->in.offered;
+ _r.out.count = r->out.count;
+ _r.out.needed = r->out.needed;
+ NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.info);
+ }
+ *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.length) {
+ struct ndr_pull *_ndr_info;
+ NDR_PULL_ALLOC(ndr, *r->out.info);
+ _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info);
+ NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
+ _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 __spoolss_EnumPrinterDataEx __r;
+ __r.in.count = *r->out.count;
+ __r.out.info = NULL;
+ NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
+ *r->out.info = __r.out.info;
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx,
+ uint32_t count, struct spoolss_PrinterEnumValues *info)
+{
+ NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx);
+}
+
+uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, uint32_t flags)
+{
+ if (!devmode) return 0;
+ return ndr_size_spoolss_DeviceMode(devmode, flags);
+}
+
+_PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, int flags)
+{
+ if (!r) {
+ return 4;
+ }
+
+ return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray);
+}
+
+/* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
+ * structs */
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
+{
+ uint32_t cntr_file_info_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 8));
+ NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr, NDR_SCALARS, r->version));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->architecture));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->monitor_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->default_datatype));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string_array = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
+ ndr->flags = _flags_save_string_array;
+ }
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_url));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->hardware_id));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->provider));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 8));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->driver_name) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->driver_name));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->driver_name));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->architecture) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->architecture));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->architecture));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ if (r->file_info) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->file_info));
+#if 0
+ NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->file_count));
+#endif
+ for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
+ NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
+ }
+ for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
+ NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
+ }
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->file_info));
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->monitor_name) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->monitor_name));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->monitor_name));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->default_datatype) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->default_datatype));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->default_datatype));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string_array = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->previous_names) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->previous_names));
+ NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->previous_names));
+ }
+ ndr->flags = _flags_save_string_array;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->manufacturer_name) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_name));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_name));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->manufacturer_url) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_url));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_url));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->hardware_id) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->hardware_id));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->hardware_id));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->provider) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->provider));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->provider));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
+{
+ uint32_t _ptr_driver_name;
+ TALLOC_CTX *_mem_save_driver_name_0;
+ uint32_t _ptr_architecture;
+ TALLOC_CTX *_mem_save_architecture_0;
+ uint32_t _ptr_file_info;
+ uint32_t cntr_file_info_1;
+ TALLOC_CTX *_mem_save_file_info_0;
+ TALLOC_CTX *_mem_save_file_info_1;
+ uint32_t _ptr_monitor_name;
+ TALLOC_CTX *_mem_save_monitor_name_0;
+ uint32_t _ptr_default_datatype;
+ TALLOC_CTX *_mem_save_default_datatype_0;
+ uint32_t _ptr_previous_names;
+ TALLOC_CTX *_mem_save_previous_names_0;
+ uint32_t _ptr_manufacturer_name;
+ TALLOC_CTX *_mem_save_manufacturer_name_0;
+ uint32_t _ptr_manufacturer_url;
+ TALLOC_CTX *_mem_save_manufacturer_url_0;
+ uint32_t _ptr_hardware_id;
+ TALLOC_CTX *_mem_save_hardware_id_0;
+ uint32_t _ptr_provider;
+ TALLOC_CTX *_mem_save_provider_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 8));
+ NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
+ if (_ptr_driver_name) {
+ NDR_PULL_ALLOC(ndr, r->driver_name);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
+ } else {
+ r->driver_name = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
+ if (_ptr_architecture) {
+ NDR_PULL_ALLOC(ndr, r->architecture);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
+ } else {
+ r->architecture = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
+ if (_ptr_file_info) {
+ NDR_PULL_ALLOC(ndr, r->file_info);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
+ } else {
+ r->file_info = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
+ if (_ptr_monitor_name) {
+ NDR_PULL_ALLOC(ndr, r->monitor_name);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
+ } else {
+ r->monitor_name = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_datatype));
+ if (_ptr_default_datatype) {
+ NDR_PULL_ALLOC(ndr, r->default_datatype);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
+ } else {
+ r->default_datatype = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string_array = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
+ if (_ptr_previous_names) {
+ NDR_PULL_ALLOC(ndr, r->previous_names);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
+ } else {
+ r->previous_names = NULL;
+ }
+ ndr->flags = _flags_save_string_array;
+ }
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
+ if (_ptr_manufacturer_name) {
+ NDR_PULL_ALLOC(ndr, r->manufacturer_name);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
+ } else {
+ r->manufacturer_name = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_url));
+ if (_ptr_manufacturer_url) {
+ NDR_PULL_ALLOC(ndr, r->manufacturer_url);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
+ } else {
+ r->manufacturer_url = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hardware_id));
+ if (_ptr_hardware_id) {
+ NDR_PULL_ALLOC(ndr, r->hardware_id);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
+ } else {
+ r->hardware_id = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_provider));
+ if (_ptr_provider) {
+ NDR_PULL_ALLOC(ndr, r->provider);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
+ } else {
+ r->provider = NULL;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 8));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->driver_name) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
+ _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->architecture) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
+ _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ if (r->file_info) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
+ _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
+#if 0
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
+#else
+ NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
+#endif
+ NDR_PULL_ALLOC_N(ndr, r->file_info, r->file_count);
+ _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
+ for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
+ NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
+ }
+ for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
+ NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->monitor_name) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
+ _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->default_datatype) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
+ _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string_array = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->previous_names) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
+ _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
+ NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string_array;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->manufacturer_name) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
+ _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->manufacturer_url) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
+ _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->hardware_id) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
+ _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->provider) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
+ _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
+ if (ndr->offset > ndr->relative_highest_offset) {
+ ndr->relative_highest_offset = ndr->offset;
+ }
+ ndr->offset = _relative_save_offset;
+ }
+ ndr->flags = _flags_save_string;
+ }
+ if (r->file_info) {
+ NDR_CHECK(ndr_check_steal_array_size(ndr, (void*)&r->file_info, r->file_count));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r)
+{
+ int level;
+ level = ndr_print_steal_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "spoolss_Field");
+ switch (level) {
+ case PRINTER_NOTIFY_TYPE:
+ ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field);
+ break;
+
+ case JOB_NOTIFY_TYPE:
+ ndr_print_spoolss_JobNotifyField(ndr, "field", r->field);
+ break;
+
+ default:
+ ndr_print_uint16(ndr, "field", r->field);
+ break;
+
+ }
+}
+
+_PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, int flags)
+{
+ if (!r) {
+ return 0;
+ }
+ return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData);
+}
+
+void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
+{
+ ndr_print_security_descriptor(ndr, name, r);
+}
+
+enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
+{
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NO_RELATIVE_REVERSE);
+ NDR_CHECK(ndr_pull_security_descriptor(ndr, ndr_flags, r));
+ ndr->flags = _flags_save_STRUCT;
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NO_RELATIVE_REVERSE);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 5));
+ NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
+ NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->sacl) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sacl));
+ NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sacl));
+ }
+ if (r->dacl) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->dacl));
+ NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->dacl));
+ }
+ if (r->owner_sid) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->owner_sid));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->owner_sid));
+ }
+ if (r->group_sid) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->group_sid));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->group_sid));
+ }
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_PrinterInfo2 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 5));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->servername));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printername));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sharename));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->portname));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->drivername));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->comment));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->location));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->devmode));
+ ndr->flags = _flags_save_spoolss_DeviceMode;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sepfile));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printprocessor));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->datatype));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->parameters));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->secdesc));
+ ndr->flags = _flags_save_spoolss_security_descriptor;
+ }
+ NDR_CHECK(ndr_push_spoolss_PrinterAttributes(ndr, NDR_SCALARS, r->attributes));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->defaultpriority));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->starttime));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->untiltime));
+ NDR_CHECK(ndr_push_spoolss_PrinterStatus(ndr, NDR_SCALARS, r->status));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->cjobs));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->averageppm));
+ NDR_CHECK(ndr_push_trailer_align(ndr, 5));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->servername) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->servername));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->servername));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->servername));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->printername) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printername));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printername));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printername));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->sharename) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sharename));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sharename));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sharename));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->portname) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->portname));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->portname));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->portname));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->drivername) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->drivername));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->drivername));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->drivername));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->comment) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->comment));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->comment));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->comment));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->location) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->location));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->location));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->location));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->sepfile) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sepfile));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sepfile));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sepfile));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->printprocessor) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printprocessor));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printprocessor));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printprocessor));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->datatype) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->datatype));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->datatype));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->datatype));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ if (r->parameters) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->parameters));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->parameters));
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->parameters));
+ }
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+ if (r->devmode) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->devmode));
+ {
+ struct ndr_push *_ndr_devmode;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_devmode, 0, -1));
+ NDR_CHECK(ndr_push_spoolss_DeviceMode(_ndr_devmode, NDR_SCALARS, r->devmode));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_devmode, 0, -1));
+ }
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->devmode));
+ }
+ ndr->flags = _flags_save_spoolss_DeviceMode;
+ }
+ {
+ uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+ if (r->secdesc) {
+ NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->secdesc));
+ {
+ struct ndr_push *_ndr_secdesc;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_secdesc, 0, -1));
+ NDR_CHECK(ndr_push_spoolss_security_descriptor(_ndr_secdesc, NDR_SCALARS|NDR_BUFFERS, r->secdesc));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_secdesc, 0, -1));
+ }
+ NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->secdesc));
+ }
+ ndr->flags = _flags_save_spoolss_security_descriptor;
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r)
+{
+ struct tm tm;
+ time_t t;
+ char *str;
+
+ tm.tm_sec = r->second;
+ tm.tm_min = r->minute;
+ tm.tm_hour = r->hour;
+ tm.tm_mday = r->day;
+ tm.tm_mon = r->month - 1;
+ tm.tm_year = r->year - 1900;
+ tm.tm_wday = r->day_of_week;
+ tm.tm_yday = 0;
+ tm.tm_isdst = -1;
+
+ t = mktime(&tm);
+
+ str = timestring(ndr, t);
+
+ ndr_print_struct(ndr, name, "spoolss_Time");
+ ndr->depth++;
+ ndr_print_string(ndr, "", str);
+ ndr->depth--;
+ talloc_free(str);
+}
+
+_PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type)
+{
+ switch(type) {
+ case REG_NONE:
+ return 0;
+ case REG_SZ:
+ return LIBNDR_FLAG_ALIGN2;
+ case REG_EXPAND_SZ:
+ return LIBNDR_FLAG_ALIGN2;
+ case REG_BINARY:
+ return 0;
+ case REG_DWORD:
+ return LIBNDR_FLAG_ALIGN4;
+ case REG_DWORD_BIG_ENDIAN:
+ return LIBNDR_FLAG_ALIGN4;
+ case REG_LINK:
+ return 0;
+ case REG_MULTI_SZ:
+ return LIBNDR_FLAG_ALIGN2;
+ case REG_RESOURCE_LIST:
+ return LIBNDR_FLAG_ALIGN2;
+ case REG_FULL_RESOURCE_DESCRIPTOR:
+ return LIBNDR_FLAG_ALIGN4;
+ case REG_RESOURCE_REQUIREMENTS_LIST:
+ return LIBNDR_FLAG_ALIGN2;
+ case REG_QWORD:
+ return LIBNDR_FLAG_ALIGN8;
+ }
+
+ return 0;
+}
diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h
new file mode 100644
index 0000000..2ede07a
--- /dev/null
+++ b/librpc/ndr/ndr_spoolss_buf.h
@@ -0,0 +1,85 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling spoolss subcontext buffer structures
+
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Tim Potter 2003
+ Copyright (C) Guenther Deschner 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef ___SPACE_SRC_SAMBA_SOURCES_SAMBA_GIT_SOURCE3____SOURCE4_LIBRPC_NDR_NDR_SPOOLSS_BUF_H__
+#define ___SPACE_SRC_SAMBA_SOURCES_SAMBA_GIT_SOURCE3____SOURCE4_LIBRPC_NDR_NDR_SPOOLSS_BUF_H__
+
+#undef _PRINTF_ATTRIBUTE
+#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
+/* This file was automatically generated by mkproto.pl. DO NOT EDIT */
+
+/* this file contains prototypes for functions that are private
+ * to this subsystem or library. These functions should not be
+ * used outside this particular subsystem! */
+
+
+/* The following definitions come from /space/src/samba/SOURCES/samba.git/source3/../source4/librpc/ndr/ndr_spoolss_buf.c */
+
+enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r);
+enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r);
+uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info);
+enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r);
+enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r);
+uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_JobInfo *info);
+enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r);
+enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r);
+uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_DriverInfo *info);
+enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r);
+enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r);
+uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_FormInfo *info);
+enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r);
+enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r);
+uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PortInfo *info);
+enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r);
+enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r);
+uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info);
+enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r);
+enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r);
+uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx,
+ uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info);
+enum ndr_err_code ndr_push_spoolss_EnumPrintProcessorDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessorDataTypes *r);
+enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessorDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessorDataTypes *r);
+uint32_t ndr_size_spoolss_EnumPrintProcessorDataTypes_info(TALLOC_CTX *mem_ctx,
+ uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info);
+enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r);
+enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r);
+uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx,
+ uint32_t count, struct spoolss_PrinterEnumValues *info);
+uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, uint32_t flags);
+size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, int flags);
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r);
+void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r);
+size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, int flags);
+void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r);
+enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r);
+enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r);
+_PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r);
+_PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type);
+
+uint32_t ndr_size_spoolss_EnumPerMachineConnections_info(TALLOC_CTX *mem_ctx, uint32_t count, struct spoolss_PrinterInfo4 *info);
+#undef _PRINTF_ATTRIBUTE
+#define _PRINTF_ATTRIBUTE(a1, a2)
+
+#endif /* ___SPACE_SRC_SAMBA_SOURCES_SAMBA_GIT_SOURCE3____SOURCE4_LIBRPC_NDR_NDR_SPOOLSS_BUF_H__ */
+
diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c
new file mode 100644
index 0000000..95b0366
--- /dev/null
+++ b/librpc/ndr/ndr_string.c
@@ -0,0 +1,815 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/ndr/libndr.h"
+
+/**
+ pull a general string from the wire
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
+{
+ char *as=NULL;
+ uint32_t len1, ofs, len2;
+ uint16_t len3;
+ size_t conv_src_len = 0, converted_size;
+ int do_convert = 1, chset = CH_UTF16;
+ unsigned byte_mul = 2;
+ unsigned flags = ndr->flags;
+ unsigned c_len_term = 0;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ 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;
+ }
+
+ if (flags & LIBNDR_FLAG_STR_RAW8) {
+ do_convert = 0;
+ byte_mul = 1;
+ flags &= ~LIBNDR_FLAG_STR_RAW8;
+ }
+
+ flags &= ~LIBNDR_FLAG_STR_CONFORMANT;
+ if (flags & LIBNDR_FLAG_STR_CHARLEN) {
+ c_len_term = 1;
+ 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);
+ } else if (len1 != len2) {
+ DEBUG(6,("len1[%u] != len2[%u] '%s'\n", len1, len2, as));
+ }
+ conv_src_len = len2 + c_len_term;
+ break;
+
+ case LIBNDR_FLAG_STR_SIZE4:
+ case LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1));
+ conv_src_len = len1 + c_len_term;
+ 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));
+ conv_src_len = len1 + c_len_term;
+ break;
+
+ case LIBNDR_FLAG_STR_SIZE2:
+ case LIBNDR_FLAG_STR_SIZE2|LIBNDR_FLAG_STR_NOTERM:
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &len3));
+ conv_src_len = len3 + c_len_term;
+ break;
+
+ case LIBNDR_FLAG_STR_SIZE2|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_STR_BYTESIZE:
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &len3));
+ conv_src_len = len3;
+ byte_mul = 1; /* the length is now absolute */
+ break;
+
+ case LIBNDR_FLAG_STR_NULLTERM:
+ /*
+ * We ensure that conv_str_len cannot return 0 by
+ * requring that there be enough bytes for at least
+ * the NULL terminator
+ */
+ if (byte_mul == 1) {
+ NDR_PULL_NEED_BYTES(ndr, 1);
+ conv_src_len = ascii_len_n((const char *)(ndr->data+ndr->offset), ndr->data_size - ndr->offset);
+ } else {
+ NDR_PULL_NEED_BYTES(ndr, 2);
+ conv_src_len = utf16_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset);
+ }
+ byte_mul = 1; /* the length is now absolute */
+ break;
+
+ case LIBNDR_FLAG_STR_NOTERM:
+ if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x (missing NDR_REMAINING)\n",
+ ndr->flags & LIBNDR_STRING_FLAGS);
+ }
+ conv_src_len = ndr->data_size - ndr->offset;
+ byte_mul = 1; /* the length is now absolute */
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ ndr->flags & LIBNDR_STRING_FLAGS);
+ }
+
+ NDR_PULL_NEED_BYTES(ndr, conv_src_len * byte_mul);
+ if (conv_src_len == 0) {
+ as = talloc_strdup(ndr->current_mem_ctx, "");
+ converted_size = 0;
+ } else {
+ if (!do_convert) {
+ as = talloc_strndup(ndr->current_mem_ctx,
+ (char *)ndr->data + ndr->offset,
+ conv_src_len);
+ if (!as) {
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC,
+ "Failed to talloc_strndup() in RAW8 ndr_string_pull()");
+ }
+ converted_size = MIN(strlen(as)+1, conv_src_len);
+ } else if (!convert_string_talloc(ndr->current_mem_ctx, chset,
+ CH_UNIX, ndr->data + ndr->offset,
+ conv_src_len * byte_mul,
+ (void **)(void *)&as,
+ &converted_size)) {
+ return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion with flags 0x%x", flags);
+ }
+ }
+
+ /* this is a way of detecting if a string is sent with the wrong
+ termination */
+ if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) {
+ if (as && converted_size > 0 && as[converted_size-1] == '\0') {
+ DEBUG(6,("short string '%s', sent with NULL termination despite NOTERM flag in IDL\n", as));
+ }
+ } else {
+ if (as && converted_size > 0 && as[converted_size-1] != '\0') {
+ DEBUG(6,("long string '%s', send without NULL termination (which was expected)\n", as));
+ }
+ }
+
+ NDR_CHECK(ndr_pull_advance(ndr, conv_src_len * byte_mul));
+ *s = as;
+
+ return NDR_ERR_SUCCESS;
+}
+
+
+/**
+ push a general string onto the wire
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
+{
+ ssize_t s_len, c_len;
+ size_t d_len;
+ int do_convert = 1, chset = CH_UTF16;
+ unsigned flags = ndr->flags;
+ unsigned byte_mul = 2;
+ uint8_t *dest = NULL;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ 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;
+ }
+
+ if (flags & LIBNDR_FLAG_STR_RAW8) {
+ do_convert = 0;
+ byte_mul = 1;
+ flags &= ~LIBNDR_FLAG_STR_RAW8;
+ }
+
+ flags &= ~LIBNDR_FLAG_STR_CONFORMANT;
+
+ if (!(flags & LIBNDR_FLAG_STR_NOTERM)) {
+ s_len++;
+ }
+
+ if (s_len == 0) {
+ d_len = 0;
+ dest = (uint8_t *)talloc_strdup(ndr, "");
+ } else if (!do_convert) {
+ d_len = s_len;
+ dest = (uint8_t *)talloc_strndup(ndr, s, s_len);
+ } else if (!convert_string_talloc(ndr, CH_UNIX, chset, s, s_len,
+ (void **)(void *)&dest, &d_len))
+ {
+ return ndr_push_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character push conversion with flags 0x%x", flags);
+ }
+
+ 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;
+
+ default:
+ if (ndr->flags & LIBNDR_FLAG_REMAINING) {
+ NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
+ break;
+ }
+
+ return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ ndr->flags & LIBNDR_STRING_FLAGS);
+ }
+
+ talloc_free(dest);
+
+ return NDR_ERR_SUCCESS;
+}
+
+/**
+ 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_RAW8) {
+ c_len = s?strlen(s):0;
+ } else {
+ c_len = s?strlen_m(s):0;
+ }
+
+ if (flags & (LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_RAW8|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 (NDR_HIDE_SECRET(ndr)) {
+ ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
+ return;
+ }
+ 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;
+}
+
+static uint32_t guess_string_array_size(struct ndr_pull *ndr, int ndr_flags)
+{
+ /*
+ * Here we could do something clever like count the number of zeros in
+ * the ndr data, but it is probably sufficient to pick a lowish number
+ * (compared to the overhead of the talloc header) and let the
+ * expontential resizing deal with longer arrays.
+ */
+ return 5;
+}
+
+static enum ndr_err_code extend_string_array(struct ndr_pull *ndr,
+ const char ***_a,
+ uint32_t *count)
+{
+ const char **a = *_a;
+ uint32_t inc = *count / 4 + 3;
+ uint32_t alloc_size = *count + inc;
+
+ if (alloc_size < *count) {
+ /* overflow ! */
+ return NDR_ERR_ALLOC;
+ }
+ /*
+ * We allocate and zero two more bytes than we report back, so that
+ * the string array will always be NULL terminated.
+ */
+ a = talloc_realloc(ndr->current_mem_ctx, a,
+ const char *,
+ alloc_size);
+ NDR_ERR_HAVE_NO_MEMORY(a);
+
+ memset(a + *count, 0, inc * sizeof(a[0]));
+ *_a = a;
+ *count = alloc_size - 2;
+ return NDR_ERR_SUCCESS;
+}
+
+/**
+ pull a general string array from the wire
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_string_array(struct ndr_pull *ndr, int ndr_flags, const char ***_a)
+{
+ const char **a = NULL;
+ uint32_t count;
+ unsigned flags = ndr->flags;
+ unsigned saved_flags = ndr->flags;
+ uint32_t alloc_size;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ alloc_size = guess_string_array_size(ndr, ndr_flags);
+ a = talloc_zero_array(ndr->current_mem_ctx, const char *, alloc_size + 2);
+ NDR_ERR_HAVE_NO_MEMORY(a);
+
+ switch (flags & (LIBNDR_FLAG_STR_NULLTERM|LIBNDR_FLAG_STR_NOTERM)) {
+ case LIBNDR_FLAG_STR_NULLTERM:
+ /*
+ * here the strings are null terminated
+ * but also the array is null terminated if LIBNDR_FLAG_REMAINING
+ * is specified
+ */
+ for (count = 0;; count++) {
+ TALLOC_CTX *tmp_ctx;
+ const char *s = NULL;
+ if (count == alloc_size) {
+ NDR_CHECK(extend_string_array(ndr,
+ &a,
+ &alloc_size));
+ }
+
+ 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 ((ndr->data_size - ndr->offset) == 0 && ndr->flags & LIBNDR_FLAG_REMAINING)
+ {
+ a[count] = s;
+ break;
+ }
+ if (strcmp("", s)==0) {
+ a[count] = NULL;
+ break;
+ } else {
+ a[count] = s;
+ }
+ }
+
+ *_a =a;
+ break;
+
+ case LIBNDR_FLAG_STR_NOTERM:
+ if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x (missing NDR_REMAINING)\n",
+ ndr->flags & LIBNDR_STRING_FLAGS);
+ }
+ /*
+ * here the strings are not null terminated
+ * but separated by a null terminator
+ *
+ * which means the same as:
+ * Every string is null terminated exept the last
+ * string is terminated by the end of the buffer
+ *
+ * as LIBNDR_FLAG_STR_NULLTERM also end at the end
+ * of the buffer, we can pull each string with this flag
+ *
+ * The big difference with the case LIBNDR_FLAG_STR_NOTERM +
+ * LIBNDR_FLAG_REMAINING is that the last string will not be null terminated
+ */
+ ndr->flags &= ~(LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING);
+ ndr->flags |= LIBNDR_FLAG_STR_NULLTERM;
+
+ for (count = 0; ((ndr->data_size - ndr->offset) > 0); count++) {
+ TALLOC_CTX *tmp_ctx;
+ const char *s = NULL;
+ if (count == alloc_size) {
+ NDR_CHECK(extend_string_array(ndr,
+ &a,
+ &alloc_size));
+ }
+
+ 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;
+ a[count] = s;
+ }
+
+ a = talloc_realloc(ndr->current_mem_ctx, a, const char *, count + 1);
+ NDR_ERR_HAVE_NO_MEMORY(a);
+ *_a = a;
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ ndr->flags & LIBNDR_STRING_FLAGS);
+ }
+
+ ndr->flags = saved_flags;
+ return NDR_ERR_SUCCESS;
+}
+
+/**
+ push a general string array onto the wire
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_string_array(struct ndr_push *ndr, int ndr_flags, const char **a)
+{
+ uint32_t count;
+ unsigned flags = ndr->flags;
+ unsigned saved_flags = ndr->flags;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ switch (flags & LIBNDR_STRING_FLAGS) {
+ case LIBNDR_FLAG_STR_NULLTERM:
+ for (count = 0; a && a[count]; count++) {
+ NDR_CHECK(ndr_push_string(ndr, ndr_flags, a[count]));
+ }
+ /* If LIBNDR_FLAG_REMAINING then we do not add a null terminator to the array */
+ if (!(flags & LIBNDR_FLAG_REMAINING))
+ {
+ NDR_CHECK(ndr_push_string(ndr, ndr_flags, ""));
+ }
+ break;
+
+ case LIBNDR_FLAG_STR_NOTERM:
+ if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
+ return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x (missing NDR_REMAINING)\n",
+ ndr->flags & LIBNDR_STRING_FLAGS);
+ }
+
+ for (count = 0; a && a[count]; count++) {
+ if (count > 0) {
+ ndr->flags &= ~(LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING);
+ ndr->flags |= LIBNDR_FLAG_STR_NULLTERM;
+ NDR_CHECK(ndr_push_string(ndr, ndr_flags, ""));
+ ndr->flags = saved_flags;
+ }
+ NDR_CHECK(ndr_push_string(ndr, ndr_flags, a[count]));
+ }
+
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ ndr->flags & LIBNDR_STRING_FLAGS);
+ }
+
+ ndr->flags = saved_flags;
+ return NDR_ERR_SUCCESS;
+}
+
+_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;
+ if (asprintf(&idx, "[%d]", i) != -1) {
+ ndr_print_string(ndr, idx, a[i]);
+ free(idx);
+ }
+ }
+ ndr->depth--;
+}
+
+_PUBLIC_ size_t ndr_size_string_array(const char **a, uint32_t count, int flags)
+{
+ uint32_t i;
+ size_t size = 0;
+ int rawbytes = 0;
+
+ if (flags & LIBNDR_FLAG_STR_RAW8) {
+ rawbytes = 1;
+ flags &= ~LIBNDR_FLAG_STR_RAW8;
+ }
+
+ switch (flags & LIBNDR_STRING_FLAGS) {
+ case LIBNDR_FLAG_STR_NULLTERM:
+ for (i = 0; i < count; i++) {
+ size += rawbytes?strlen(a[i]) + 1:strlen_m_term(a[i]);
+ }
+ break;
+ case LIBNDR_FLAG_STR_NOTERM:
+ for (i = 0; i < count; i++) {
+ size += rawbytes?strlen(a[i]):strlen_m(a[i]);
+ }
+ break;
+ default:
+ return 0;
+ }
+
+ return size;
+}
+
+/**
+ * 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 = (const char *)_var;
+
+ for (i = 0; memcmp(var+i*element_size,zero,element_size) != 0; i++);
+
+ return i+1;
+}
+
+/**
+ * @brief Get the string length including the null terminator if available.
+ *
+ * This checks the string length based on the elements. The returned number
+ * includes the terminating null byte(s) if found.
+ *
+ * @param[in] _var The string the calculate the length for.
+ *
+ * @param[in] length The length of the buffer passed by _var.
+ *
+ * @param[in] element_size The element_size of a string char in bytes.
+ *
+ * @return The length of the strings or 0.
+ */
+static uint32_t ndr_string_n_length(const void *_var,
+ size_t length,
+ uint32_t element_size)
+{
+ size_t i = 0;
+ uint8_t zero[4] = {0,0,0,0};
+ const char *var = (const char *)_var;
+ int cmp;
+
+ if (element_size > 4) {
+ return 0;
+ }
+
+ for (i = 0; i < length; i++, var += element_size) {
+ cmp = memcmp(var, zero, element_size);
+ if (cmp == 0) {
+ break;
+ }
+ }
+
+ if (i == length) {
+ return length;
+ }
+
+ return i + 1;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size)
+{
+ uint32_t i;
+ uint32_t save_offset;
+
+ save_offset = ndr->offset;
+ NDR_CHECK(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->offset = save_offset;
+
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "String terminator not present or outside string boundaries");
+ }
+ }
+
+ ndr->offset = save_offset;
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset)
+{
+ size_t converted_size;
+
+ if (length == 0) {
+ *var = talloc_strdup(ndr->current_mem_ctx, "");
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (NDR_BE(ndr) && chset == CH_UTF16) {
+ chset = CH_UTF16BE;
+ }
+
+ if ((byte_mul != 0) && (length > UINT32_MAX/byte_mul)) {
+ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "length overflow");
+ }
+ NDR_PULL_NEED_BYTES(ndr, length*byte_mul);
+
+ if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX,
+ ndr->data+ndr->offset, length*byte_mul,
+ discard_const_p(void *, var),
+ &converted_size))
+ {
+ return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion");
+ }
+ NDR_CHECK(ndr_pull_advance(ndr, length*byte_mul));
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_charset_to_null(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset)
+{
+ size_t converted_size;
+ uint32_t str_len;
+
+ if (length == 0) {
+ *var = talloc_strdup(ndr->current_mem_ctx, "");
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (NDR_BE(ndr) && chset == CH_UTF16) {
+ chset = CH_UTF16BE;
+ }
+
+ NDR_PULL_NEED_BYTES(ndr, length*byte_mul);
+
+ str_len = ndr_string_n_length(ndr->data+ndr->offset, length, byte_mul);
+ if (str_len == 0) {
+ return ndr_pull_error(ndr, NDR_ERR_LENGTH,
+ "Invalid length");
+ }
+
+ if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX,
+ ndr->data+ndr->offset, str_len*byte_mul,
+ discard_const_p(void *, var),
+ &converted_size))
+ {
+ return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion");
+ }
+ NDR_CHECK(ndr_pull_advance(ndr, length*byte_mul));
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset)
+{
+ size_t required;
+
+ if (NDR_BE(ndr) && chset == CH_UTF16) {
+ chset = CH_UTF16BE;
+ }
+
+ if ((byte_mul != 0) && (length > SIZE_MAX/byte_mul)) {
+ return ndr_push_error(ndr, NDR_ERR_LENGTH, "length overflow");
+ }
+ required = byte_mul * length;
+
+ NDR_PUSH_NEED_BYTES(ndr, required);
+
+ if (required) {
+ size_t size = 0;
+
+ if (var == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+
+ if (!convert_string(CH_UNIX, chset,
+ var, strlen(var),
+ ndr->data+ndr->offset, required, &size)) {
+ return ndr_push_error(ndr, NDR_ERR_CHARCNV,
+ "Bad character conversion");
+ }
+
+ /* Make sure the remaining part of the string is filled with zeroes */
+ if (size < required) {
+ memset(ndr->data+ndr->offset+size, 0, required-size);
+ }
+ }
+
+ ndr->offset += required;
+
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_charset_to_null(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset)
+{
+ const char *str = var;
+
+ if (str == NULL) {
+ str = "\0"; /* i.e. two zero bytes, for UTF16 null word. */
+ length = 1;
+ }
+
+ return ndr_push_charset(ndr, ndr_flags, str, length, byte_mul, chset);
+}
+
+/* Return number of elements in a string in the specified charset */
+_PUBLIC_ uint32_t ndr_charset_length(const void *var, charset_t chset)
+{
+ switch (chset) {
+ /* case CH_UTF16: this has the same value as CH_UTF16LE */
+ case CH_UTF16LE:
+ case CH_UTF16BE:
+ case CH_UTF16MUNGED:
+ case CH_UTF8:
+ return strlen_m_ext_term((const char *)var, CH_UNIX, chset);
+ case CH_DOS:
+ case CH_UNIX:
+ return strlen((const char *)var)+1;
+ }
+
+ /* Fallback, this should never happen */
+ return strlen((const char *)var)+1;
+}
diff --git a/librpc/ndr/ndr_svcctl.c b/librpc/ndr/ndr_svcctl.c
new file mode 100644
index 0000000..83e581b
--- /dev/null
+++ b/librpc/ndr/ndr_svcctl.c
@@ -0,0 +1,52 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special svcctl types
+
+ Copyright (C) Guenther Deschner 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_svcctl.h"
+
+_PUBLIC_ enum ndr_err_code ndr_push_ENUM_SERVICE_STATUSW_array(struct ndr_push *ndr, uint32_t count, struct ENUM_SERVICE_STATUSW *r)
+{
+ uint32_t cntr_array_1;
+
+ for (cntr_array_1 = 0; cntr_array_1 < count; cntr_array_1++) {
+ NDR_CHECK(ndr_push_ENUM_SERVICE_STATUSW(ndr, NDR_SCALARS, &r[cntr_array_1]));
+ }
+ for (cntr_array_1 = 0; cntr_array_1 < count; cntr_array_1++) {
+ NDR_CHECK(ndr_push_ENUM_SERVICE_STATUSW(ndr, NDR_BUFFERS, &r[cntr_array_1]));
+ }
+
+ return NDR_ERR_SUCCESS;
+
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_ENUM_SERVICE_STATUSW_array(struct ndr_pull *ndr, uint32_t count, struct ENUM_SERVICE_STATUSW *r)
+{
+ uint32_t cntr_array_1;
+
+ for (cntr_array_1 = 0; cntr_array_1 < count; cntr_array_1++) {
+ NDR_CHECK(ndr_pull_ENUM_SERVICE_STATUSW(ndr, NDR_SCALARS, &r[cntr_array_1]));
+ }
+ for (cntr_array_1 = 0; cntr_array_1 < count; cntr_array_1++) {
+ NDR_CHECK(ndr_pull_ENUM_SERVICE_STATUSW(ndr, NDR_BUFFERS, &r[cntr_array_1]));
+ }
+
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_svcctl.h b/librpc/ndr/ndr_svcctl.h
new file mode 100644
index 0000000..e11ff69
--- /dev/null
+++ b/librpc/ndr/ndr_svcctl.h
@@ -0,0 +1,24 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling special svcctl types
+
+ Copyright (C) Guenther Deschner 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+_PUBLIC_ enum ndr_err_code ndr_push_ENUM_SERVICE_STATUSW_array(struct ndr_push *ndr, uint32_t count, struct ENUM_SERVICE_STATUSW *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_ENUM_SERVICE_STATUSW_array(struct ndr_pull *ndr, uint32_t count, struct ENUM_SERVICE_STATUSW *r);
+
diff --git a/librpc/ndr/ndr_table.c b/librpc/ndr/ndr_table.c
new file mode 100644
index 0000000..bc44fd3
--- /dev/null
+++ b/librpc/ndr/ndr_table.c
@@ -0,0 +1,182 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ dcerpc utility functions
+
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Jelmer Vernooij 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../lib/util/dlinklist.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_table.h"
+#undef strcasecmp
+
+static struct ndr_interface_list *ndr_interfaces;
+
+/*
+ register a ndr interface table
+*/
+NTSTATUS ndr_table_register(const struct ndr_interface_table *table)
+{
+ struct ndr_interface_list *l;
+
+ for (l = ndr_interfaces; l; l = l->next) {
+ /*
+ * If no GUID is supplied, use the name to determine
+ * uniquness.
+ */
+ if (GUID_all_zero(&table->syntax_id.uuid)) {
+ if (strcmp(table->name,
+ l->table->name) != 0) {
+ continue;
+ }
+ DBG_ERR("Attempt to register interface %s which has the "
+ "same name as already registered interface\n",
+ table->name);
+ } else {
+ if (!GUID_equal(&table->syntax_id.uuid,
+ &l->table->syntax_id.uuid)) {
+ continue;
+ }
+ DBG_ERR("Attempt to register interface %s which has the "
+ "same UUID as already registered interface %s\n",
+ table->name, l->table->name);
+ }
+ return NT_STATUS_OBJECT_NAME_COLLISION;
+ }
+
+ /*
+ * This is a singleton instance guarenteed
+ * by the above check to be only added once
+ * into the list so we can allocate off the NULL
+ * context. We never want this to be freed
+ * until process shutdown. If needed we could
+ * add a deregister function that walks and
+ * frees the list.
+ */
+
+ l = talloc(NULL, struct ndr_interface_list);
+ l->table = table;
+
+ DLIST_ADD(ndr_interfaces, l);
+
+ return NT_STATUS_OK;
+}
+
+/*
+ find the pipe name for a local IDL interface
+*/
+const char *ndr_interface_name(const struct GUID *uuid, uint32_t if_version)
+{
+ const struct ndr_interface_list *l;
+ for (l=ndr_table_list();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 ndr_interface_num_calls(const struct GUID *uuid, uint32_t if_version)
+{
+ const struct ndr_interface_list *l;
+ for (l=ndr_table_list();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 ndr_interface_table *ndr_table_by_name(const char *name)
+{
+ const struct ndr_interface_list *l;
+ for (l=ndr_table_list();l;l=l->next) {
+ if (strcasecmp(l->table->name, name) == 0) {
+ return l->table;
+ }
+ }
+ return NULL;
+}
+
+/*
+ find a dcerpc interface by syntax
+*/
+const struct ndr_interface_table *ndr_table_by_syntax(const struct ndr_syntax_id *syntax)
+{
+ const struct ndr_interface_list *l;
+ if (GUID_all_zero(&syntax->uuid)) {
+ /* These are not unique */
+ return NULL;
+ }
+ for (l=ndr_table_list();l;l=l->next) {
+ if (ndr_syntax_id_equal(&l->table->syntax_id, syntax)) {
+ return l->table;
+ }
+ }
+ return NULL;
+}
+
+/*
+ find a dcerpc interface by uuid
+*/
+const struct ndr_interface_table *ndr_table_by_uuid(const struct GUID *uuid)
+{
+ const struct ndr_interface_list *l;
+ if (GUID_all_zero(uuid)) {
+ /* These are not unique */
+ return NULL;
+ }
+ for (l=ndr_table_list();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 ndr_interface_list *ndr_table_list(void)
+{
+ ndr_table_init();
+ return ndr_interfaces;
+}
+
+
+NTSTATUS ndr_table_init(void)
+{
+ static bool initialized = false;
+
+ if (initialized) return NT_STATUS_OK;
+ initialized = true;
+
+ ndr_table_register_builtin_tables();
+
+ return NT_STATUS_OK;
+}
diff --git a/librpc/ndr/ndr_table.h b/librpc/ndr/ndr_table.h
new file mode 100644
index 0000000..1f6858a
--- /dev/null
+++ b/librpc/ndr/ndr_table.h
@@ -0,0 +1,37 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ dcerpc utility functions
+
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Jelmer Vernooij 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _NDR_TABLE_PROTO_H_
+#define _NDR_TABLE_PROTO_H_
+
+NTSTATUS ndr_table_register(const struct ndr_interface_table *table);
+const char *ndr_interface_name(const struct GUID *uuid, uint32_t if_version);
+int ndr_interface_num_calls(const struct GUID *uuid, uint32_t if_version);
+const struct ndr_interface_table *ndr_table_by_name(const char *name);
+const struct ndr_interface_table *ndr_table_by_syntax(const struct ndr_syntax_id *syntax);
+const struct ndr_interface_table *ndr_table_by_uuid(const struct GUID *uuid);
+const struct ndr_interface_list *ndr_table_list(void);
+NTSTATUS ndr_table_init(void);
+NTSTATUS ndr_table_register_builtin_tables(void);
+
+#endif /* _NDR_TABLE_PROTO_H_ */
+
diff --git a/librpc/ndr/ndr_witness.c b/librpc/ndr/ndr_witness.c
new file mode 100644
index 0000000..288e640
--- /dev/null
+++ b/librpc/ndr/ndr_witness.c
@@ -0,0 +1,110 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling witness structures
+
+ Copyright (C) Guenther Deschner 2015
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_witness.h"
+
+_PUBLIC_ enum ndr_err_code ndr_push_witness_notifyResponse(struct ndr_push *ndr, int ndr_flags, const struct witness_notifyResponse *r)
+{
+ uint32_t cntr_messages_0;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_witness_notifyResponse_type(ndr, NDR_SCALARS, r->type));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_witness_notifyResponse(r, ndr->flags) - 20));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->messages));
+ if (r->messages) {
+ uint32_t _flags_save_witness_notifyResponse_message = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ {
+ struct ndr_push *_ndr_messages;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_messages, 4, ndr_size_witness_notifyResponse(r, ndr->flags) - 20));
+ for (cntr_messages_0 = 0; cntr_messages_0 < (r->num); cntr_messages_0++) {
+ NDR_CHECK(ndr_push_set_switch_value(_ndr_messages, &r->messages[cntr_messages_0], r->type));
+ NDR_CHECK(ndr_push_witness_notifyResponse_message(_ndr_messages, NDR_SCALARS, &r->messages[cntr_messages_0]));
+ }
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_messages, 4, ndr_size_witness_notifyResponse(r, ndr->flags) - 20));
+ }
+ ndr->flags = _flags_save_witness_notifyResponse_message;
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_witness_notifyResponse(struct ndr_pull *ndr, int ndr_flags, struct witness_notifyResponse *r)
+{
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_witness_notifyResponse_type(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num));
+ {
+ uint32_t _flags_save_witness_notifyResponse_message = ndr->flags;
+ uint32_t _ptr_messages;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_messages));
+ if (_ptr_messages) {
+ NDR_PULL_ALLOC(ndr, r->messages);
+ } else {
+ r->messages = NULL;
+ }
+ if (r->messages) {
+ uint32_t size_messages_0 = 0;
+ uint32_t cntr_messages_0;
+ TALLOC_CTX *_mem_save_messages_0;
+
+ size_messages_0 = r->num;
+ NDR_PULL_ALLOC_N(ndr, r->messages, size_messages_0);
+ _mem_save_messages_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->messages, 0);
+ {
+ struct ndr_pull *_ndr_messages;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_messages, 4, r->length));
+ for (cntr_messages_0 = 0; cntr_messages_0 < (size_messages_0); cntr_messages_0++) {
+ NDR_CHECK(ndr_pull_set_switch_value(_ndr_messages, &r->messages[cntr_messages_0], r->type));
+ NDR_CHECK(ndr_pull_witness_notifyResponse_message(_ndr_messages, NDR_SCALARS, &r->messages[cntr_messages_0]));
+ }
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_messages, 4, r->length));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_messages_0, 0);
+ }
+ ndr->flags = _flags_save_witness_notifyResponse_message;
+ }
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_witness.h b/librpc/ndr/ndr_witness.h
new file mode 100644
index 0000000..e4dd3df
--- /dev/null
+++ b/librpc/ndr/ndr_witness.h
@@ -0,0 +1,23 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling witness structures
+
+ Copyright (C) Guenther Deschner 2015
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+_PUBLIC_ enum ndr_err_code ndr_push_witness_notifyResponse(struct ndr_push *ndr, int ndr_flags, const struct witness_notifyResponse *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_witness_notifyResponse(struct ndr_pull *ndr, int ndr_flags, struct witness_notifyResponse *r);
diff --git a/librpc/ndr/ndr_wmi.c b/librpc/ndr/ndr_wmi.c
new file mode 100644
index 0000000..4748888
--- /dev/null
+++ b/librpc/ndr/ndr_wmi.c
@@ -0,0 +1,60 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling DCOM string arrays
+
+ Copyright (C) Jelmer Vernooij 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+//#define NDR_CHECK_DEBUG
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_dcom.h"
+#include "librpc/gen_ndr/ndr_wmi.h"
+#include "librpc/ndr/ndr_wmi.h"
+
+// Just for debugging
+int NDR_CHECK_depth = 0;
+int NDR_CHECK_shift = 0x18;
+
+enum ndr_err_code ndr_push_BSTR(struct ndr_push *ndr, int ndr_flags, const struct BSTR *r)
+{
+ uint32_t len;
+ uint32_t flags;
+ enum ndr_err_code status;
+ len = strlen(r->data);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ 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->data);
+ ndr->flags = flags;
+ return status;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_BSTR(struct ndr_pull *ndr, int ndr_flags, struct BSTR *r)
+{
+ return NDR_ERR_BAD_SWITCH;
+}
+
+void ndr_print_BSTR(struct ndr_print *ndr, const char *name, const struct BSTR *r)
+{
+ ndr->print(ndr, "%-25s: BSTR(\"%s\")", name, r->data);
+}
diff --git a/librpc/ndr/ndr_wmi.h b/librpc/ndr/ndr_wmi.h
new file mode 100644
index 0000000..62d2c53
--- /dev/null
+++ b/librpc/ndr/ndr_wmi.h
@@ -0,0 +1,24 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ routines for marshalling/unmarshalling DCOM string arrays
+
+ Copyright (C) Jelmer Vernooij 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+enum ndr_err_code ndr_push_BSTR(struct ndr_push *ndr, int ndr_flags, const struct BSTR *r);
+enum ndr_err_code ndr_pull_BSTR(struct ndr_pull *ndr, int ndr_flags, struct BSTR *r);
diff --git a/librpc/ndr/ndr_xattr.c b/librpc/ndr/ndr_xattr.c
new file mode 100644
index 0000000..930f510
--- /dev/null
+++ b/librpc/ndr/ndr_xattr.c
@@ -0,0 +1,148 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ helper routines for XATTR marshalling
+
+ Copyright (C) Stefan (metze) Metzmacher 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_xattr.h"
+
+static char *ndr_compat_xattr_attrib_hex(TALLOC_CTX *mem_ctx,
+ const struct xattr_DOSATTRIB *r)
+{
+ char *attrib_hex = NULL;
+
+ switch (r->version) {
+ case 0xFFFF:
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ r->info.compatinfoFFFF.attrib);
+ break;
+ case 1:
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ r->info.info1.attrib);
+ break;
+ case 2:
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ r->info.oldinfo2.attrib);
+ break;
+ case 3:
+ if (!(r->info.info3.valid_flags & XATTR_DOSINFO_ATTRIB)) {
+ attrib_hex = talloc_strdup(mem_ctx, "");
+ break;
+ }
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ r->info.info3.attrib);
+ break;
+ default:
+ attrib_hex = talloc_strdup(mem_ctx, "");
+ break;
+ }
+
+ return attrib_hex;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DOSATTRIB(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct xattr_DOSATTRIB *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ char *attrib_hex = NULL;
+
+ attrib_hex = ndr_compat_xattr_attrib_hex(ndr, r);
+ NDR_ERR_HAVE_NO_MEMORY(attrib_hex);
+
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, attrib_hex));
+ ndr->flags = _flags_save_string;
+ }
+ if (r->version == 0xFFFF) {
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->info, r->version));
+ NDR_CHECK(ndr_push_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DOSATTRIB(struct ndr_pull *ndr, int ndr_flags, struct xattr_DOSATTRIB *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->attrib_hex));
+ ndr->flags = _flags_save_string;
+ }
+ if (ndr->offset >= ndr->data_size) {
+ unsigned int dosattr;
+ int ret;
+
+ if (r->attrib_hex[0] != '0') {
+
+ }
+ if (r->attrib_hex[1] != 'x') {
+
+ }
+ ret = sscanf(r->attrib_hex, "%x", &dosattr);
+ if (ret != 1) {
+ }
+ r->version = 0xFFFF;
+ r->info.compatinfoFFFF.attrib = dosattr;
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version));
+ if (r->version == 0xFFFF) {
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH,
+ "ndr_pull_xattr_DOSATTRIB: "
+ "invalid level 0x%02X",
+ r->version);
+ }
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
+ NDR_CHECK(ndr_pull_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DOSATTRIB(struct ndr_print *ndr, const char *name, const struct xattr_DOSATTRIB *r)
+{
+ char *attrib_hex;
+
+ ndr_print_struct(ndr, name, "xattr_DOSATTRIB");
+ ndr->depth++;
+
+ if (ndr->flags & LIBNDR_PRINT_SET_VALUES) {
+ attrib_hex = ndr_compat_xattr_attrib_hex(ndr, r);
+ } else {
+ attrib_hex = talloc_strdup(ndr, r->attrib_hex);
+ }
+ ndr_print_string(ndr, "attrib_hex", attrib_hex);
+
+ ndr_print_uint16(ndr, "version", r->version);
+ ndr_print_set_switch_value(ndr, &r->info, r->version);
+ ndr_print_xattr_DosInfo(ndr, "info", &r->info);
+ ndr->depth--;
+}
diff --git a/librpc/ndr/ndr_xattr.h b/librpc/ndr/ndr_xattr.h
new file mode 100644
index 0000000..bdc530a
--- /dev/null
+++ b/librpc/ndr/ndr_xattr.h
@@ -0,0 +1,37 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ helper routines for XATTR marshalling
+
+ Copyright (C) Stefan (metze) Metzmacher 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _LIBRPC_NDR_NDR_XATTR_H
+#define _LIBRPC_NDR_NDR_XATTR_H
+
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DOSATTRIB(struct ndr_push *ndr,
+ int ndr_flags,
+ const struct xattr_DOSATTRIB *r);
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DOSATTRIB(struct ndr_pull *ndr,
+ int ndr_flags,
+ struct xattr_DOSATTRIB *r);
+
+_PUBLIC_ void ndr_print_xattr_DOSATTRIB(struct ndr_print *ndr,
+ const char *name,
+ const struct xattr_DOSATTRIB *r);
+
+#endif /* _LIBRPC_NDR_NDR_XATTR_H */
diff --git a/librpc/ndr/util.c b/librpc/ndr/util.c
new file mode 100644
index 0000000..0eb7eba
--- /dev/null
+++ b/librpc/ndr/util.c
@@ -0,0 +1,36 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ libndr interface
+
+ Copyright (C) Andrew Tridgell 2003
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../librpc/ndr/libndr.h"
+#include "system/network.h"
+#include "lib/util/util_net.h"
+
+_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss)
+{
+ char addr[INET6_ADDRSTRLEN];
+ ndr->print(ndr, "%-25s: %s", name, print_sockaddr(addr, sizeof(addr), ss));
+}
+
+_PUBLIC_ void ndr_zero_memory(void *ptr, size_t len)
+{
+ memset_s(ptr, len, 0, len);
+}
diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c
new file mode 100644
index 0000000..6a8d31e
--- /dev/null
+++ b/librpc/ndr/uuid.c
@@ -0,0 +1,258 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "lib/util/samba_util.h"
+#include "lib/util/genrand.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "lib/util/util_str_hex.h"
+
+_PUBLIC_ NTSTATUS GUID_to_ndr_buf(
+ const struct GUID *guid, struct GUID_ndr_buf *buf)
+{
+ DATA_BLOB b = { .data = buf->buf, .length = sizeof(buf->buf), };
+ enum ndr_err_code ndr_err;
+
+ ndr_err = ndr_push_struct_into_fixed_blob(
+ &b, guid, (ndr_push_flags_fn_t)ndr_push_GUID);
+ return ndr_map_error2ntstatus(ndr_err);
+}
+
+/**
+ build a NDR blob from a GUID
+*/
+_PUBLIC_ NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b)
+{
+ struct GUID_ndr_buf buf = { .buf = {0}, };
+ NTSTATUS status;
+
+ status = GUID_to_ndr_buf(guid, &buf);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ *b = data_blob_talloc(mem_ctx, buf.buf, sizeof(buf.buf));
+ if (b->data == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ return NT_STATUS_OK;
+}
+
+
+/**
+ build a GUID from a NDR data blob
+*/
+_PUBLIC_ NTSTATUS GUID_from_ndr_blob(const DATA_BLOB *b, struct GUID *guid)
+{
+ enum ndr_err_code ndr_err =
+ ndr_pull_struct_blob_all_noalloc(b, guid,
+ (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ return ndr_map_error2ntstatus(ndr_err);
+}
+
+
+/**
+ build a GUID from a string
+*/
+_PUBLIC_ NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid)
+{
+ bool ok;
+
+ if (s->data == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if (s->length == 36) {
+ ok = parse_guid_string((char *)s->data, guid);
+ return ok ? NT_STATUS_OK : NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if (s->length == 38) {
+ if (s->data[0] != '{' || s->data[37] != '}') {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ ok = parse_guid_string((char *)s->data + 1, guid);
+ return ok ? NT_STATUS_OK : NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if (s->length == 32) {
+ uint8_t buf16[16] = {0};
+ DATA_BLOB blob16 = { .data = buf16, .length = sizeof(buf16) };
+ size_t rlen = strhex_to_str((char *)blob16.data, blob16.length,
+ (const char *)s->data, s->length);
+ if (rlen != blob16.length) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ return GUID_from_ndr_blob(&blob16, guid);
+ }
+
+ if (s->length == 16) {
+ return GUID_from_ndr_blob(s, guid);
+ }
+
+ return NT_STATUS_INVALID_PARAMETER;
+}
+
+/**
+ build a GUID from a string
+*/
+_PUBLIC_ NTSTATUS GUID_from_string(const char *s, struct GUID *guid)
+{
+ DATA_BLOB blob = data_blob_string_const(s);
+ return GUID_from_data_blob(&blob, guid);
+}
+
+/**
+ * generate a random GUID
+ */
+_PUBLIC_ 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)
+{
+ return (struct GUID) { .time_low = 0 };
+}
+
+_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)
+{
+ return (GUID_compare(u1, u2) == 0);
+}
+
+_PUBLIC_ int GUID_compare(const struct GUID *u1, const struct GUID *u2)
+{
+ if (u1->time_low != u2->time_low) {
+ return u1->time_low > u2->time_low ? 1 : -1;
+ }
+
+ if (u1->time_mid != u2->time_mid) {
+ return u1->time_mid > u2->time_mid ? 1 : -1;
+ }
+
+ if (u1->time_hi_and_version != u2->time_hi_and_version) {
+ return u1->time_hi_and_version > u2->time_hi_and_version ? 1 : -1;
+ }
+
+ if (u1->clock_seq[0] != u2->clock_seq[0]) {
+ return u1->clock_seq[0] > u2->clock_seq[0] ? 1 : -1;
+ }
+
+ if (u1->clock_seq[1] != u2->clock_seq[1]) {
+ return u1->clock_seq[1] > u2->clock_seq[1] ? 1 : -1;
+ }
+
+ return memcmp(u1->node, u2->node, 6);
+}
+
+/**
+ its useful to be able to display these in debugging messages
+*/
+_PUBLIC_ char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid)
+{
+ struct GUID_txt_buf buf;
+ return talloc_strdup(mem_ctx, GUID_buf_string(guid, &buf));
+}
+
+/**
+ * Does the same without allocating memory, using the structure buffer.
+ * Useful for debug messages, so that you do not have to talloc_free the result
+ */
+_PUBLIC_ char* GUID_buf_string(const struct GUID *guid,
+ struct GUID_txt_buf *dst)
+{
+ if (!guid) {
+ return NULL;
+ }
+ snprintf(dst->buf, sizeof(dst->buf),
+ "%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]);
+ return dst->buf;
+}
+
+_PUBLIC_ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid)
+{
+ struct GUID_txt_buf buf;
+ char *ret = talloc_asprintf(
+ mem_ctx, "{%s}", GUID_buf_string(guid, &buf));
+ return ret;
+}
+
+_PUBLIC_ char *GUID_hexstring(TALLOC_CTX *mem_ctx, const struct GUID *guid)
+{
+ char *ret = NULL;
+ DATA_BLOB guid_blob = { .data = NULL };
+ NTSTATUS status;
+
+ status = GUID_to_ndr_blob(guid, mem_ctx, &guid_blob);
+ if (NT_STATUS_IS_OK(status)) {
+ ret = data_blob_hex_string_upper(mem_ctx, &guid_blob);
+ }
+ TALLOC_FREE(guid_blob.data);
+ return ret;
+}
+
+_PUBLIC_ bool ndr_policy_handle_empty(const struct policy_handle *h)
+{
+ return (h->handle_type == 0 && GUID_all_zero(&h->uuid));
+}
+
+_PUBLIC_ bool ndr_policy_handle_equal(const struct policy_handle *hnd1,
+ const struct policy_handle *hnd2)
+{
+ if (!hnd1 || !hnd2) {
+ return false;
+ }
+
+ return (memcmp(hnd1, hnd2, sizeof(*hnd1)) == 0);
+}
diff --git a/librpc/ndr_krb5pac.pc.in b/librpc/ndr_krb5pac.pc.in
new file mode 100644
index 0000000..581b7e5
--- /dev/null
+++ b/librpc/ndr_krb5pac.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: ndr-krb5pac
+Description: NDR marshallers for the KRB5 PAC formats
+Requires: ndr ndr_standard
+Version: @PACKAGE_VERSION@
+Libs: @LIB_RPATH@ -L${libdir} -lndr-krb5pac
+Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1
diff --git a/librpc/ndr_nbt.pc.in b/librpc/ndr_nbt.pc.in
new file mode 100644
index 0000000..2083e2d
--- /dev/null
+++ b/librpc/ndr_nbt.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: ndr-nbt
+Description: NDR marshallers for nbt formats
+Requires: ndr
+Version: @PACKAGE_VERSION@
+Libs: @LIB_RPATH@ -L${libdir} -lndr-nbt
+Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1
diff --git a/librpc/ndr_standard.pc.in b/librpc/ndr_standard.pc.in
new file mode 100644
index 0000000..97687ba
--- /dev/null
+++ b/librpc/ndr_standard.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: ndr-standard
+Description: NDR marshallers for the standard set of DCE/RPC interfaces
+Requires: ndr
+Version: @PACKAGE_VERSION@
+Libs: @LIB_RPATH@ -L${libdir} -lndr-standard
+Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
new file mode 100644
index 0000000..3e2a446
--- /dev/null
+++ b/librpc/rpc/binding.c
@@ -0,0 +1,1459 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ dcerpc utility functions
+
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Jelmer Vernooij 2004
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
+ Copyright (C) Rafal Szczesniak 2006
+ Copyright (C) Stefan Metzmacher 2014
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../../lib/util/util_net.h"
+#include "librpc/gen_ndr/ndr_epmapper.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
+
+#undef strcasecmp
+#undef strncasecmp
+
+#define MAX_PROTSEQ 10
+
+struct dcerpc_binding {
+ enum dcerpc_transport_t transport;
+ struct GUID object;
+ const char *object_string;
+ const char *host;
+ const char *target_hostname;
+ const char *target_principal;
+ const char *endpoint;
+ const char **options;
+ uint32_t flags;
+ uint32_t assoc_group_id;
+ char assoc_group_string[11]; /* 0x3456789a + '\0' */
+};
+
+static const struct {
+ const char *name;
+ enum dcerpc_transport_t transport;
+ int num_protocols;
+ enum epm_protocol protseq[MAX_PROTSEQ];
+} transports[] = {
+ { "ncacn_np", NCACN_NP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }},
+ { "ncacn_ip_tcp", NCACN_IP_TCP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } },
+ { "ncacn_http", NCACN_HTTP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } },
+ { "ncadg_ip_udp", NCACN_IP_UDP, 3,
+ { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } },
+ { "ncalrpc", NCALRPC, 2,
+ { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_NAMED_PIPE } },
+ { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } },
+ { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2,
+ { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } },
+ { "ncacn_at_dsp", NCACN_AT_DSP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } },
+ { "ncadg_at_ddp", NCADG_AT_DDP, 3,
+ { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } },
+ { "ncacn_vns_ssp", NCACN_VNS_SPP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } },
+ { "ncacn_vns_ipc", NCACN_VNS_IPC, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, },
+ { "ncadg_ipx", NCADG_IPX, 2,
+ { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX },
+ },
+ { "ncacn_spx", NCACN_SPX, 3,
+ /* I guess some MS programmer confused the identifier for
+ * EPM_PROTOCOL_UUID (0x0D or 13) with the one for
+ * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID },
+ },
+};
+
+static const struct ncacn_option {
+ const char *name;
+ uint32_t flag;
+} ncacn_options[] = {
+ {"sign", DCERPC_SIGN},
+ {"seal", DCERPC_SEAL},
+ {"connect", DCERPC_CONNECT},
+ {"spnego", DCERPC_AUTH_SPNEGO},
+ {"ntlm", DCERPC_AUTH_NTLM},
+ {"krb5", DCERPC_AUTH_KRB5},
+ {"schannel", DCERPC_SCHANNEL | DCERPC_SCHANNEL_AUTO},
+ {"validate", DCERPC_DEBUG_VALIDATE_BOTH},
+ {"print", DCERPC_DEBUG_PRINT_BOTH},
+ {"padcheck", DCERPC_DEBUG_PAD_CHECK},
+ {"bigendian", DCERPC_PUSH_BIGENDIAN},
+ {"smb1", DCERPC_SMB1},
+ {"smb2", DCERPC_SMB2},
+ {"ndr64", DCERPC_NDR64},
+ {"packet", DCERPC_PACKET},
+};
+
+static const struct ncacn_option *ncacn_option_by_name(const char *name)
+{
+ size_t i;
+
+ for (i=0; i<ARRAY_SIZE(ncacn_options); i++) {
+ int ret;
+
+ ret = strcasecmp(ncacn_options[i].name, name);
+ if (ret != 0) {
+ continue;
+ }
+
+ return &ncacn_options[i];
+ }
+
+ return NULL;
+}
+
+const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
+{
+ struct ndr_syntax_id syntax;
+ NTSTATUS status;
+
+ switch(epm_floor->lhs.protocol) {
+ case EPM_PROTOCOL_UUID:
+ status = dcerpc_floor_get_lhs_data(epm_floor, &syntax);
+ if (NT_STATUS_IS_OK(status)) {
+ /* lhs is used: UUID */
+ struct GUID_txt_buf buf;
+
+ if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax_ndr.uuid)) {
+ return "NDR";
+ }
+
+ if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax_ndr64.uuid)) {
+ return "NDR64";
+ }
+
+ return talloc_asprintf(
+ mem_ctx,
+ " uuid %s/0x%02x",
+ GUID_buf_string(&syntax.uuid, &buf),
+ syntax.if_version);
+ } else { /* IPX */
+ return talloc_asprintf(mem_ctx, "IPX:%s",
+ data_blob_hex_string_upper(mem_ctx, &epm_floor->rhs.uuid.unknown));
+ }
+
+ case EPM_PROTOCOL_NCACN:
+ return "RPC-C";
+
+ case EPM_PROTOCOL_NCADG:
+ return "RPC";
+
+ case EPM_PROTOCOL_NCALRPC:
+ return "NCALRPC";
+
+ case EPM_PROTOCOL_DNET_NSP:
+ return "DNET/NSP";
+
+ case EPM_PROTOCOL_IP:
+ return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr);
+
+ case EPM_PROTOCOL_NAMED_PIPE:
+ return talloc_asprintf(mem_ctx, "NAMED-PIPE:%s", epm_floor->rhs.named_pipe.path);
+
+ case EPM_PROTOCOL_SMB:
+ return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc);
+
+ case EPM_PROTOCOL_UNIX_DS:
+ return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path);
+
+ case EPM_PROTOCOL_NETBIOS:
+ return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name);
+
+ case EPM_PROTOCOL_NETBEUI:
+ return "NETBeui";
+
+ case EPM_PROTOCOL_SPX:
+ return "SPX";
+
+ case EPM_PROTOCOL_NB_IPX:
+ return "NB_IPX";
+
+ case EPM_PROTOCOL_HTTP:
+ return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port);
+
+ case EPM_PROTOCOL_TCP:
+ return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port);
+
+ case EPM_PROTOCOL_UDP:
+ return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port);
+
+ default:
+ return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol);
+ }
+}
+
+
+/*
+ form a binding string from a binding structure
+*/
+_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b)
+{
+ char *s = NULL;
+ size_t i;
+ const char *t_name = NULL;
+ bool option_section = false;
+ const char *target_hostname = NULL;
+
+ if (b->transport != NCA_UNKNOWN) {
+ t_name = derpc_transport_string_by_transport(b->transport);
+ if (!t_name) {
+ return NULL;
+ }
+ }
+
+ s = talloc_strdup(mem_ctx, "");
+
+ if (!GUID_all_zero(&b->object)) {
+ struct GUID_txt_buf buf;
+ talloc_asprintf_addbuf(
+ &s, "%s@", GUID_buf_string(&b->object, &buf));
+ }
+
+ if (t_name != NULL) {
+ talloc_asprintf_addbuf(&s, "%s:", t_name);
+ }
+
+ if (b->host) {
+ talloc_asprintf_addbuf(&s, "%s", b->host);
+ }
+
+ target_hostname = b->target_hostname;
+ if (target_hostname != NULL && b->host != NULL) {
+ if (strcmp(target_hostname, b->host) == 0) {
+ target_hostname = NULL;
+ }
+ }
+
+ option_section =
+ (b->endpoint != NULL) ||
+ (target_hostname != NULL) ||
+ (b->target_principal != NULL) ||
+ (b->assoc_group_id != 0) ||
+ (b->options != NULL) ||
+ (b->flags != 0);
+
+ if (!option_section) {
+ return s;
+ }
+
+ talloc_asprintf_addbuf(&s, "[");
+
+ if (b->endpoint) {
+ talloc_asprintf_addbuf(&s, "%s", b->endpoint);
+ }
+
+ for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
+ if (!(b->flags & ncacn_options[i].flag)) {
+ continue;
+ }
+
+ talloc_asprintf_addbuf(&s, ",%s", ncacn_options[i].name);
+ }
+
+ if (target_hostname) {
+ talloc_asprintf_addbuf(
+ &s, ",target_hostname=%s", b->target_hostname);
+ }
+
+ if (b->target_principal) {
+ talloc_asprintf_addbuf(
+ &s, ",target_principal=%s", b->target_principal);
+ }
+
+ if (b->assoc_group_id != 0) {
+ talloc_asprintf_addbuf(
+ &s, ",assoc_group_id=0x%08x", b->assoc_group_id);
+ }
+
+ for (i=0;b->options && b->options[i];i++) {
+ talloc_asprintf_addbuf(&s, ",%s", b->options[i]);
+ }
+
+ talloc_asprintf_addbuf(&s, "]");
+
+ return s;
+}
+
+/*
+ parse a binding string into a dcerpc_binding structure
+*/
+_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *_s, struct dcerpc_binding **b_out)
+{
+ char *_t;
+ struct dcerpc_binding *b;
+ char *s;
+ char *options = NULL;
+ char *p;
+ size_t i;
+ NTSTATUS status;
+
+ b = talloc_zero(mem_ctx, struct dcerpc_binding);
+ if (!b) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ _t = talloc_strdup(b, _s);
+ if (_t == NULL) {
+ talloc_free(b);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ s = _t;
+
+ p = strchr(s, '[');
+ if (p) {
+ char *q = p + strlen(p) - 1;
+ if (*q != ']') {
+ talloc_free(b);
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+ *p = '\0';
+ *q = '\0';
+ options = p + 1;
+ }
+
+ p = strchr(s, '@');
+
+ if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
+ *p = '\0';
+
+ status = dcerpc_binding_set_string_option(b, "object", s);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+
+ s = p + 1;
+ }
+
+ p = strchr(s, ':');
+
+ if (p == NULL) {
+ b->transport = NCA_UNKNOWN;
+ } else if (is_ipaddress_v6(s)) {
+ b->transport = NCA_UNKNOWN;
+ } else {
+ *p = '\0';
+
+ status = dcerpc_binding_set_string_option(b, "transport", s);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+
+ s = p + 1;
+ }
+
+ if (strlen(s) > 0) {
+ status = dcerpc_binding_set_string_option(b, "host", s);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+
+ b->target_hostname = talloc_strdup(b, b->host);
+ if (b->target_hostname == NULL) {
+ talloc_free(b);
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
+
+ for (i=0; options != NULL; i++) {
+ const char *name = options;
+ const char *value = NULL;
+
+ p = strchr(options, ',');
+ if (p != NULL) {
+ *p = '\0';
+ options = p+1;
+ } else {
+ options = NULL;
+ }
+
+ p = strchr(name, '=');
+ if (p != NULL) {
+ *p = '\0';
+ value = p + 1;
+ }
+
+ if (value == NULL) {
+ /*
+ * If it's not a key=value pair
+ * it might be a ncacn_option
+ * or if it's the first option
+ * it's the endpoint.
+ */
+ const struct ncacn_option *no = NULL;
+
+ value = name;
+
+ no = ncacn_option_by_name(name);
+ if (no == NULL) {
+ if (i > 0) {
+ /*
+ * we don't allow unknown options
+ */
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+
+ /*
+ * This is the endpoint
+ */
+ name = "endpoint";
+ if (strlen(value) == 0) {
+ value = NULL;
+ }
+ }
+ }
+
+ status = dcerpc_binding_set_string_option(b, name, value);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+ }
+
+ talloc_free(_t);
+ *b_out = b;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ struct GUID dcerpc_binding_get_object(const struct dcerpc_binding *b)
+{
+ return b->object;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_set_object(struct dcerpc_binding *b,
+ struct GUID object)
+{
+ char *tmp = discard_const_p(char, b->object_string);
+
+ if (GUID_all_zero(&object)) {
+ talloc_free(tmp);
+ b->object_string = NULL;
+ ZERO_STRUCT(b->object);
+ return NT_STATUS_OK;
+ }
+
+ b->object_string = GUID_string(b, &object);
+ if (b->object_string == NULL) {
+ b->object_string = tmp;
+ return NT_STATUS_NO_MEMORY;
+ }
+ talloc_free(tmp);
+
+ b->object = object;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ enum dcerpc_transport_t dcerpc_binding_get_transport(const struct dcerpc_binding *b)
+{
+ return b->transport;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_set_transport(struct dcerpc_binding *b,
+ enum dcerpc_transport_t transport)
+{
+ NTSTATUS status;
+
+ /*
+ * TODO: we may want to check the transport value is
+ * wellknown.
+ */
+ if (b->transport == transport) {
+ return NT_STATUS_OK;
+ }
+
+ /*
+ * This implicitly resets the endpoint
+ * as the endpoint is transport specific.
+ *
+ * It also resets the assoc group as it's
+ * also endpoint specific.
+ *
+ * TODO: in future we may reset more options
+ * here.
+ */
+ status = dcerpc_binding_set_string_option(b, "endpoint", NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ b->assoc_group_id = 0;
+
+ b->transport = transport;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ void dcerpc_binding_get_auth_info(const struct dcerpc_binding *b,
+ enum dcerpc_AuthType *_auth_type,
+ enum dcerpc_AuthLevel *_auth_level)
+{
+ enum dcerpc_AuthType auth_type;
+ enum dcerpc_AuthLevel auth_level;
+
+ if (b->flags & DCERPC_AUTH_SPNEGO) {
+ auth_type = DCERPC_AUTH_TYPE_SPNEGO;
+ } else if (b->flags & DCERPC_AUTH_KRB5) {
+ auth_type = DCERPC_AUTH_TYPE_KRB5;
+ } else if (b->flags & DCERPC_SCHANNEL) {
+ auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
+ } else if (b->flags & DCERPC_AUTH_NTLM) {
+ auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
+ } else {
+ auth_type = DCERPC_AUTH_TYPE_NONE;
+ }
+
+ if (b->flags & DCERPC_SEAL) {
+ auth_level = DCERPC_AUTH_LEVEL_PRIVACY;
+ } else if (b->flags & DCERPC_SIGN) {
+ auth_level = DCERPC_AUTH_LEVEL_INTEGRITY;
+ } else if (b->flags & DCERPC_CONNECT) {
+ auth_level = DCERPC_AUTH_LEVEL_CONNECT;
+ } else if (b->flags & DCERPC_PACKET) {
+ auth_level = DCERPC_AUTH_LEVEL_PACKET;
+ } else if (auth_type != DCERPC_AUTH_TYPE_NONE) {
+ auth_level = DCERPC_AUTH_LEVEL_INTEGRITY;
+ } else {
+ auth_level = DCERPC_AUTH_LEVEL_NONE;
+ }
+
+ if (_auth_type != NULL) {
+ *_auth_type = auth_type;
+ }
+
+ if (_auth_level != NULL) {
+ *_auth_level = auth_level;
+ }
+}
+
+_PUBLIC_ uint32_t dcerpc_binding_get_assoc_group_id(const struct dcerpc_binding *b)
+{
+ return b->assoc_group_id;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_set_assoc_group_id(struct dcerpc_binding *b,
+ uint32_t assoc_group_id)
+{
+ b->assoc_group_id = assoc_group_id;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ struct ndr_syntax_id dcerpc_binding_get_abstract_syntax(const struct dcerpc_binding *b)
+{
+ const char *s = dcerpc_binding_get_string_option(b, "abstract_syntax");
+ bool ok;
+ struct ndr_syntax_id id;
+
+ if (s == NULL) {
+ return ndr_syntax_id_null;
+ }
+
+ ok = ndr_syntax_id_from_string(s, &id);
+ if (!ok) {
+ return ndr_syntax_id_null;
+ }
+
+ return id;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_set_abstract_syntax(struct dcerpc_binding *b,
+ const struct ndr_syntax_id *syntax)
+{
+ NTSTATUS status;
+ struct ndr_syntax_id_buf buf;
+
+ if (syntax == NULL) {
+ status = dcerpc_binding_set_string_option(b, "abstract_syntax", NULL);
+ return status;
+ }
+
+ if (ndr_syntax_id_equal(&ndr_syntax_id_null, syntax)) {
+ status = dcerpc_binding_set_string_option(b, "abstract_syntax", NULL);
+ return status;
+ }
+
+ status = dcerpc_binding_set_string_option(
+ b, "abstract_syntax", ndr_syntax_id_buf_string(syntax, &buf));
+ return status;
+}
+
+_PUBLIC_ const char *dcerpc_binding_get_string_option(const struct dcerpc_binding *b,
+ const char *name)
+{
+ struct {
+ const char *name;
+ const char *value;
+#define _SPECIAL(x) { .name = #x, .value = b->x, }
+ } specials[] = {
+ { .name = "object", .value = b->object_string, },
+ _SPECIAL(host),
+ _SPECIAL(endpoint),
+ _SPECIAL(target_hostname),
+ _SPECIAL(target_principal),
+#undef _SPECIAL
+ };
+ const struct ncacn_option *no = NULL;
+ size_t name_len = strlen(name);
+ size_t i;
+ int ret;
+
+ ret = strcmp(name, "transport");
+ if (ret == 0) {
+ return derpc_transport_string_by_transport(b->transport);
+ }
+
+ ret = strcmp(name, "assoc_group_id");
+ if (ret == 0) {
+ char *tmp = discard_const_p(char, b->assoc_group_string);
+
+ if (b->assoc_group_id == 0) {
+ return NULL;
+ }
+
+ snprintf(tmp, sizeof(b->assoc_group_string),
+ "0x%08x", b->assoc_group_id);
+ return (const char *)b->assoc_group_string;
+ }
+
+ for (i=0; i < ARRAY_SIZE(specials); i++) {
+ ret = strcmp(specials[i].name, name);
+ if (ret != 0) {
+ continue;
+ }
+
+ return specials[i].value;
+ }
+
+ no = ncacn_option_by_name(name);
+ if (no != NULL) {
+ if (b->flags & no->flag) {
+ return no->name;
+ }
+
+ return NULL;
+ }
+
+ if (b->options == NULL) {
+ return NULL;
+ }
+
+ for (i=0; b->options[i]; i++) {
+ const char *o = b->options[i];
+ const char *vs = NULL;
+
+ ret = strncmp(name, o, name_len);
+ if (ret != 0) {
+ continue;
+ }
+
+ if (o[name_len] != '=') {
+ continue;
+ }
+
+ vs = &o[name_len + 1];
+
+ return vs;
+ }
+
+ return NULL;
+}
+
+_PUBLIC_ char *dcerpc_binding_copy_string_option(TALLOC_CTX *mem_ctx,
+ const struct dcerpc_binding *b,
+ const char *name)
+{
+ const char *c = dcerpc_binding_get_string_option(b, name);
+ char *v;
+
+ if (c == NULL) {
+ errno = ENOENT;
+ return NULL;
+ }
+
+ v = talloc_strdup(mem_ctx, c);
+ if (v == NULL) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ return v;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b,
+ const char *name,
+ const char *value)
+{
+ struct {
+ const char *name;
+ const char **ptr;
+#define _SPECIAL(x) { .name = #x, .ptr = &b->x, }
+ } specials[] = {
+ _SPECIAL(host),
+ _SPECIAL(endpoint),
+ _SPECIAL(target_hostname),
+ _SPECIAL(target_principal),
+#undef _SPECIAL
+ };
+ const struct ncacn_option *no = NULL;
+ size_t name_len = strlen(name);
+ const char *opt = NULL;
+ char *tmp;
+ size_t i;
+ int ret;
+
+ /*
+ * Note: value == NULL, means delete it.
+ * value != NULL means add or reset.
+ */
+
+ ret = strcmp(name, "transport");
+ if (ret == 0) {
+ enum dcerpc_transport_t t = dcerpc_transport_by_name(value);
+
+ if (t == NCA_UNKNOWN && value != NULL) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+
+ return dcerpc_binding_set_transport(b, t);
+ }
+
+ ret = strcmp(name, "object");
+ if (ret == 0) {
+ NTSTATUS status;
+ struct GUID uuid = GUID_zero();
+
+ if (value != NULL) {
+ DATA_BLOB blob;
+ blob = data_blob_string_const(value);
+ if (blob.length != 36) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+
+ status = GUID_from_data_blob(&blob, &uuid);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+
+ return dcerpc_binding_set_object(b, uuid);
+ }
+
+ ret = strcmp(name, "assoc_group_id");
+ if (ret == 0) {
+ uint32_t assoc_group_id = 0;
+
+ if (value != NULL) {
+ char c;
+
+ ret = sscanf(value, "0x%08x%c", &assoc_group_id, &c);
+ if (ret != 1) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+ }
+
+ return dcerpc_binding_set_assoc_group_id(b, assoc_group_id);
+ }
+
+ for (i=0; i < ARRAY_SIZE(specials); i++) {
+ ret = strcmp(specials[i].name, name);
+ if (ret != 0) {
+ continue;
+ }
+
+ tmp = discard_const_p(char, *specials[i].ptr);
+
+ if (value == NULL) {
+ talloc_free(tmp);
+ *specials[i].ptr = NULL;
+ return NT_STATUS_OK;
+ }
+
+ if (value[0] == '\0') {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+
+ *specials[i].ptr = talloc_strdup(b, value);
+ if (*specials[i].ptr == NULL) {
+ *specials[i].ptr = tmp;
+ return NT_STATUS_NO_MEMORY;
+ }
+ talloc_free(tmp);
+
+ return NT_STATUS_OK;
+ }
+
+ no = ncacn_option_by_name(name);
+ if (no != NULL) {
+ if (value == NULL) {
+ b->flags &= ~no->flag;
+ return NT_STATUS_OK;
+ }
+
+ ret = strcasecmp(no->name, value);
+ if (ret != 0) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+
+ b->flags |= no->flag;
+ return NT_STATUS_OK;
+ }
+
+ for (i=0; b->options && b->options[i]; i++) {
+ const char *o = b->options[i];
+
+ ret = strncmp(name, o, name_len);
+ if (ret != 0) {
+ continue;
+ }
+
+ if (o[name_len] != '=') {
+ continue;
+ }
+
+ opt = o;
+ break;
+ }
+
+ if (opt == NULL) {
+ const char **n;
+
+ if (value == NULL) {
+ return NT_STATUS_OK;
+ }
+
+ n = talloc_realloc(b, b->options, const char *, i + 2);
+ if (n == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ n[i] = NULL;
+ n[i + 1] = NULL;
+ b->options = n;
+ }
+
+ tmp = discard_const_p(char, opt);
+
+ if (value == NULL) {
+ for (;b->options[i];i++) {
+ b->options[i] = b->options[i+1];
+ }
+ talloc_free(tmp);
+ return NT_STATUS_OK;
+ }
+
+ b->options[i] = talloc_asprintf(b->options, "%s=%s",
+ name, value);
+ if (b->options[i] == NULL) {
+ b->options[i] = tmp;
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ uint32_t dcerpc_binding_get_flags(const struct dcerpc_binding *b)
+{
+ return b->flags;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_set_flags(struct dcerpc_binding *b,
+ uint32_t additional,
+ uint32_t clear)
+{
+ /*
+ * TODO: in future we may want to reject invalid combinations
+ */
+ b->flags &= ~clear;
+ b->flags |= additional;
+
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,
+ struct ndr_syntax_id *syntax)
+{
+ TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
+ struct ndr_pull *ndr;
+ enum ndr_err_code ndr_err;
+ uint16_t if_version=0;
+
+ ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
+ if (ndr == NULL) {
+ talloc_free(mem_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
+ ndr->flags |= LIBNDR_FLAG_NOALIGN;
+
+ ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(mem_ctx);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(mem_ctx);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ syntax->if_version = if_version;
+
+ talloc_free(mem_ctx);
+
+ return NT_STATUS_OK;
+}
+
+static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
+{
+ DATA_BLOB blob;
+ enum ndr_err_code ndr_err;
+ struct ndr_push *ndr;
+
+ ndr = ndr_push_init_ctx(mem_ctx);
+ if (ndr == NULL) {
+ return data_blob_null;
+ }
+
+ ndr->flags |= LIBNDR_FLAG_NOALIGN;
+
+ ndr_err = ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return data_blob_null;
+ }
+ ndr_err = ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return data_blob_null;
+ }
+
+ blob = ndr_push_blob(ndr);
+ talloc_steal(mem_ctx, blob.data);
+ talloc_free(ndr);
+ return blob;
+}
+
+static bool dcerpc_floor_pack_rhs_if_version_data(
+ TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax,
+ DATA_BLOB *pblob)
+{
+ DATA_BLOB blob;
+ struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
+ enum ndr_err_code ndr_err;
+
+ if (ndr == NULL) {
+ return false;
+ }
+
+ ndr->flags |= LIBNDR_FLAG_NOALIGN;
+
+ ndr_err = ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version >> 16);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return false;
+ }
+
+ blob = ndr_push_blob(ndr);
+ talloc_steal(mem_ctx, blob.data);
+ talloc_free(ndr);
+ *pblob = blob;
+ return true;
+}
+
+char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
+{
+ switch (epm_floor->lhs.protocol) {
+ case EPM_PROTOCOL_TCP:
+ if (epm_floor->rhs.tcp.port == 0) return NULL;
+ return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port);
+
+ case EPM_PROTOCOL_UDP:
+ if (epm_floor->rhs.udp.port == 0) return NULL;
+ return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port);
+
+ case EPM_PROTOCOL_HTTP:
+ if (epm_floor->rhs.http.port == 0) return NULL;
+ return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port);
+
+ case EPM_PROTOCOL_IP:
+ return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr);
+
+ case EPM_PROTOCOL_NCACN:
+ return NULL;
+
+ case EPM_PROTOCOL_NCADG:
+ return NULL;
+
+ case EPM_PROTOCOL_SMB:
+ if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL;
+ return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc);
+
+ case EPM_PROTOCOL_NAMED_PIPE:
+ if (strlen(epm_floor->rhs.named_pipe.path) == 0) return NULL;
+ return talloc_strdup(mem_ctx, epm_floor->rhs.named_pipe.path);
+
+ case EPM_PROTOCOL_NETBIOS:
+ if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL;
+ return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name);
+
+ case EPM_PROTOCOL_NCALRPC:
+ return NULL;
+
+ case EPM_PROTOCOL_VINES_SPP:
+ return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port);
+
+ case EPM_PROTOCOL_VINES_IPC:
+ return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port);
+
+ case EPM_PROTOCOL_STREETTALK:
+ return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk);
+
+ case EPM_PROTOCOL_UNIX_DS:
+ if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL;
+ return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path);
+
+ case EPM_PROTOCOL_NULL:
+ return NULL;
+
+ default:
+ DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
+ break;
+ }
+
+ return NULL;
+}
+
+static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx,
+ struct epm_floor *epm_floor,
+ const char *data)
+{
+ if (data == NULL) {
+ data = "";
+ }
+
+ switch (epm_floor->lhs.protocol) {
+ case EPM_PROTOCOL_TCP:
+ epm_floor->rhs.tcp.port = atoi(data);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_UDP:
+ epm_floor->rhs.udp.port = atoi(data);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_HTTP:
+ epm_floor->rhs.http.port = atoi(data);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_IP:
+ if (!is_ipaddress_v4(data)) {
+ data = "0.0.0.0";
+ }
+ epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data);
+ NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_NCACN:
+ epm_floor->rhs.ncacn.minor_version = 0;
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_NCADG:
+ epm_floor->rhs.ncadg.minor_version = 0;
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_SMB:
+ epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data);
+ NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_NAMED_PIPE:
+ epm_floor->rhs.named_pipe.path = talloc_strdup(mem_ctx, data);
+ NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.named_pipe.path);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_NETBIOS:
+ epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data);
+ NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_NCALRPC:
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_VINES_SPP:
+ epm_floor->rhs.vines_spp.port = atoi(data);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_VINES_IPC:
+ epm_floor->rhs.vines_ipc.port = atoi(data);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_STREETTALK:
+ epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data);
+ NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_UNIX_DS:
+ epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data);
+ NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path);
+ return NT_STATUS_OK;
+
+ case EPM_PROTOCOL_NULL:
+ return NT_STATUS_OK;
+
+ default:
+ DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
+ break;
+ }
+
+ return NT_STATUS_NOT_SUPPORTED;
+}
+
+enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot)
+{
+ size_t i;
+
+ /* Find a transport that has 'prot' as 4th protocol */
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ if (transports[i].num_protocols >= 2 &&
+ transports[i].protseq[1] == prot) {
+ return transports[i].transport;
+ }
+ }
+
+ /* Unknown transport */
+ return (unsigned int)-1;
+}
+
+_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower)
+{
+ size_t i;
+
+ /* Find a transport that matches this tower */
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ int j;
+ if (transports[i].num_protocols != tower->num_floors - 2) {
+ continue;
+ }
+
+ for (j = 0; j < transports[i].num_protocols && j < MAX_PROTSEQ; j++) {
+ if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) {
+ break;
+ }
+ }
+
+ if (j == transports[i].num_protocols) {
+ return transports[i].transport;
+ }
+ }
+
+ /* Unknown transport */
+ return (unsigned int)-1;
+}
+
+_PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t)
+{
+ size_t i;
+
+ for (i=0; i<ARRAY_SIZE(transports); i++) {
+ if (t == transports[i].transport) {
+ return transports[i].name;
+ }
+ }
+ return NULL;
+}
+
+_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_name(const char *name)
+{
+ size_t i;
+
+ if (name == NULL) {
+ return NCA_UNKNOWN;
+ }
+
+ for (i=0; i<ARRAY_SIZE(transports);i++) {
+ if (strcasecmp(name, transports[i].name) == 0) {
+ return transports[i].transport;
+ }
+ }
+
+ return NCA_UNKNOWN;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
+ struct epm_tower *tower,
+ struct dcerpc_binding **b_out)
+{
+ NTSTATUS status;
+ struct dcerpc_binding *b;
+ enum dcerpc_transport_t transport;
+ struct ndr_syntax_id abstract_syntax;
+ char *endpoint = NULL;
+ char *host = NULL;
+
+ /*
+ * A tower needs to have at least 4 floors to carry useful
+ * information. Floor 3 is the transport identifier which defines
+ * how many floors are required at least.
+ */
+ if (tower->num_floors < 4) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ status = dcerpc_parse_binding(mem_ctx, "", &b);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ transport = dcerpc_transport_by_tower(tower);
+ if (transport == NCA_UNKNOWN) {
+ talloc_free(b);
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+
+ status = dcerpc_binding_set_transport(b, transport);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+
+ /* Set abstract syntax */
+ status = dcerpc_floor_get_lhs_data(&tower->floors[0], &abstract_syntax);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+
+ status = dcerpc_binding_set_abstract_syntax(b, &abstract_syntax);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+
+ /* Ignore floor 1, it contains the NDR version info */
+
+ /* Set endpoint */
+ errno = 0;
+ if (tower->num_floors >= 4) {
+ endpoint = dcerpc_floor_get_rhs_data(b, &tower->floors[3]);
+ }
+ if (errno != 0) {
+ int saved_errno = errno;
+ talloc_free(b);
+ return map_nt_error_from_unix_common(saved_errno);
+ }
+
+ status = dcerpc_binding_set_string_option(b, "endpoint", endpoint);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+ TALLOC_FREE(endpoint);
+
+ /* Set network address */
+ errno = 0;
+ if (tower->num_floors >= 5) {
+ host = dcerpc_floor_get_rhs_data(b, &tower->floors[4]);
+ }
+ if (errno != 0) {
+ int saved_errno = errno;
+ talloc_free(b);
+ return map_nt_error_from_unix_common(saved_errno);
+ }
+
+ status = dcerpc_binding_set_string_option(b, "host", host);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+ status = dcerpc_binding_set_string_option(b, "target_hostname", host);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(b);
+ return status;
+ }
+ TALLOC_FREE(host);
+
+ *b_out = b;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ struct dcerpc_binding *dcerpc_binding_dup(TALLOC_CTX *mem_ctx,
+ const struct dcerpc_binding *b)
+{
+ struct dcerpc_binding *n;
+ uint32_t count;
+
+ n = talloc_zero(mem_ctx, struct dcerpc_binding);
+ if (n == NULL) {
+ return NULL;
+ }
+
+ n->transport = b->transport;
+ n->object = b->object;
+ n->flags = b->flags;
+ n->assoc_group_id = b->assoc_group_id;
+
+ if (b->object_string != NULL) {
+ n->object_string = talloc_strdup(n, b->object_string);
+ if (n->object_string == NULL) {
+ goto nomem;
+ }
+ }
+ if (b->host != NULL) {
+ n->host = talloc_strdup(n, b->host);
+ if (n->host == NULL) {
+ goto nomem;
+ }
+ }
+
+ if (b->target_hostname != NULL) {
+ n->target_hostname = talloc_strdup(n, b->target_hostname);
+ if (n->target_hostname == NULL) {
+ goto nomem;
+ }
+ }
+
+ if (b->target_principal != NULL) {
+ n->target_principal = talloc_strdup(n, b->target_principal);
+ if (n->target_principal == NULL) {
+ goto nomem;
+ }
+ }
+
+ if (b->endpoint != NULL) {
+ n->endpoint = talloc_strdup(n, b->endpoint);
+ if (n->endpoint == NULL) {
+ goto nomem;
+ }
+ }
+
+ for (count = 0; b->options && b->options[count]; count++);
+
+ if (count > 0) {
+ uint32_t i;
+
+ n->options = talloc_array(n, const char *, count + 1);
+ if (n->options == NULL) {
+ goto nomem;
+ }
+
+ for (i = 0; i < count; i++) {
+ n->options[i] = talloc_strdup(n->options, b->options[i]);
+ if (n->options[i] == NULL) {
+ goto nomem;
+ }
+ }
+ n->options[count] = NULL;
+ }
+
+ return n;
+nomem:
+ TALLOC_FREE(n);
+ return NULL;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
+ const struct dcerpc_binding *binding,
+ struct epm_tower *tower)
+{
+ const enum epm_protocol *protseq = NULL;
+ size_t i, num_protocols = 0;
+ struct ndr_syntax_id abstract_syntax;
+ NTSTATUS status;
+
+ /* Find transport */
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ if (transports[i].transport == binding->transport) {
+ protseq = transports[i].protseq;
+ num_protocols = transports[i].num_protocols;
+ break;
+ }
+ }
+
+ if (i == ARRAY_SIZE(transports)) {
+ DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ tower->num_floors = 2 + num_protocols;
+ tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors);
+ if (tower->floors == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /* Floor 0 */
+ tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
+
+ abstract_syntax = dcerpc_binding_get_abstract_syntax(binding);
+ tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(tower->floors,
+ &abstract_syntax);
+
+ if (!dcerpc_floor_pack_rhs_if_version_data(
+ tower->floors, &abstract_syntax,
+ &tower->floors[0].rhs.uuid.unknown)) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /* Floor 1 */
+ tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
+
+ tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(tower->floors,
+ &ndr_transfer_syntax_ndr);
+
+ tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(tower->floors, 2);
+
+ /* Floor 2 to num_protocols */
+ for (i = 0; i < num_protocols; i++) {
+ tower->floors[2 + i].lhs.protocol = protseq[i];
+ tower->floors[2 + i].lhs.lhs_data = data_blob_null;
+ ZERO_STRUCT(tower->floors[2 + i].rhs);
+ status = dcerpc_floor_set_rhs_data(tower->floors,
+ &tower->floors[2 + i],
+ NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+
+ /* The 4th floor contains the endpoint */
+ if (num_protocols >= 2 && binding->endpoint) {
+ status = dcerpc_floor_set_rhs_data(tower->floors,
+ &tower->floors[3],
+ binding->endpoint);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+
+ /* The 5th contains the network address */
+ if (num_protocols >= 3 && binding->host) {
+ status = dcerpc_floor_set_rhs_data(tower->floors,
+ &tower->floors[4],
+ binding->host);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
diff --git a/librpc/rpc/binding_handle.c b/librpc/rpc/binding_handle.c
new file mode 100644
index 0000000..41675e1
--- /dev/null
+++ b/librpc/rpc/binding_handle.c
@@ -0,0 +1,568 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ dcerpc binding handle functions
+
+ Copyright (C) Stefan Metzmacher 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include <tevent.h>
+#include "../lib/util/tevent_ntstatus.h"
+#include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
+
+struct dcerpc_binding_handle {
+ void *private_data;
+ const struct dcerpc_binding_handle_ops *ops;
+ const char *location;
+ const struct GUID *object;
+ const struct ndr_interface_table *table;
+ struct tevent_context *sync_ev;
+};
+
+static int dcerpc_binding_handle_destructor(struct dcerpc_binding_handle *b)
+{
+ return 0;
+}
+
+struct dcerpc_binding_handle *_dcerpc_binding_handle_create(TALLOC_CTX *mem_ctx,
+ const struct dcerpc_binding_handle_ops *ops,
+ const struct GUID *object,
+ const struct ndr_interface_table *table,
+ void *pstate,
+ size_t psize,
+ const char *type,
+ const char *location)
+{
+ struct dcerpc_binding_handle *h;
+ void **ppstate = (void **)pstate;
+ void *state;
+
+ h = talloc_zero(mem_ctx, struct dcerpc_binding_handle);
+ if (h == NULL) {
+ return NULL;
+ }
+ h->ops = ops;
+ h->location = location;
+ h->object = object;
+ h->table = table;
+
+ state = talloc_zero_size(h, psize);
+ if (state == NULL) {
+ talloc_free(h);
+ return NULL;
+ }
+ talloc_set_name_const(state, type);
+
+ h->private_data = state;
+
+ talloc_set_destructor(h, dcerpc_binding_handle_destructor);
+
+ *ppstate = state;
+ return h;
+}
+
+void *_dcerpc_binding_handle_data(struct dcerpc_binding_handle *h)
+{
+ return h->private_data;
+}
+
+void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle *h,
+ struct tevent_context *ev)
+{
+ h->sync_ev = ev;
+}
+
+bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h)
+{
+ return h->ops->is_connected(h);
+}
+
+uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
+ uint32_t timeout)
+{
+ return h->ops->set_timeout(h, timeout);
+}
+
+void dcerpc_binding_handle_auth_info(struct dcerpc_binding_handle *h,
+ enum dcerpc_AuthType *auth_type,
+ enum dcerpc_AuthLevel *auth_level)
+{
+ enum dcerpc_AuthType _auth_type;
+ enum dcerpc_AuthLevel _auth_level;
+
+ if (auth_type == NULL) {
+ auth_type = &_auth_type;
+ }
+
+ if (auth_level == NULL) {
+ auth_level = &_auth_level;
+ }
+
+ *auth_type = DCERPC_AUTH_TYPE_NONE;
+ *auth_level = DCERPC_AUTH_LEVEL_NONE;
+
+ if (h->ops->auth_info == NULL) {
+ return;
+ }
+
+ h->ops->auth_info(h, auth_type, auth_level);
+}
+
+struct dcerpc_binding_handle_raw_call_state {
+ const struct dcerpc_binding_handle_ops *ops;
+ uint8_t *out_data;
+ size_t out_length;
+ uint32_t out_flags;
+};
+
+static void dcerpc_binding_handle_raw_call_done(struct tevent_req *subreq);
+
+struct tevent_req *dcerpc_binding_handle_raw_call_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ uint32_t opnum,
+ uint32_t in_flags,
+ const uint8_t *in_data,
+ size_t in_length)
+{
+ struct tevent_req *req;
+ struct dcerpc_binding_handle_raw_call_state *state;
+ struct tevent_req *subreq;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct dcerpc_binding_handle_raw_call_state);
+ if (req == NULL) {
+ return NULL;
+ }
+ state->ops = h->ops;
+ state->out_data = NULL;
+ state->out_length = 0;
+ state->out_flags = 0;
+
+ if (h->object != NULL) {
+ /*
+ * If an object is set on the binding handle,
+ * per request object passing is not allowed.
+ */
+ if (object != NULL) {
+ tevent_req_nterror(req, NT_STATUS_INVALID_HANDLE);
+ return tevent_req_post(req, ev);
+ }
+
+ /*
+ * We use the object from the binding handle
+ */
+ object = h->object;
+ }
+
+ subreq = state->ops->raw_call_send(state, ev, h,
+ object, opnum,
+ in_flags, in_data, in_length);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, dcerpc_binding_handle_raw_call_done, req);
+
+ return req;
+}
+
+static void dcerpc_binding_handle_raw_call_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(subreq,
+ struct tevent_req);
+ struct dcerpc_binding_handle_raw_call_state *state =
+ tevent_req_data(req,
+ struct dcerpc_binding_handle_raw_call_state);
+ NTSTATUS error;
+
+ error = state->ops->raw_call_recv(subreq, state,
+ &state->out_data,
+ &state->out_length,
+ &state->out_flags);
+ TALLOC_FREE(subreq);
+ if (tevent_req_nterror(req, error)) {
+ return;
+ }
+
+ tevent_req_done(req);
+}
+
+NTSTATUS dcerpc_binding_handle_raw_call_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **out_data,
+ size_t *out_length,
+ uint32_t *out_flags)
+{
+ struct dcerpc_binding_handle_raw_call_state *state =
+ tevent_req_data(req,
+ struct dcerpc_binding_handle_raw_call_state);
+ NTSTATUS error;
+
+ if (tevent_req_is_nterror(req, &error)) {
+ tevent_req_received(req);
+ return error;
+ }
+
+ *out_data = talloc_move(mem_ctx, &state->out_data);
+ *out_length = state->out_length;
+ *out_flags = state->out_flags;
+ tevent_req_received(req);
+ return NT_STATUS_OK;
+}
+
+NTSTATUS dcerpc_binding_handle_raw_call(struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ uint32_t opnum,
+ uint32_t in_flags,
+ const uint8_t *in_data,
+ size_t in_length,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **out_data,
+ size_t *out_length,
+ uint32_t *out_flags)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct tevent_context *ev;
+ struct tevent_req *subreq;
+ NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+ /*
+ * TODO: allow only one sync call
+ */
+
+ if (h->sync_ev) {
+ ev = h->sync_ev;
+ } else {
+ ev = samba_tevent_context_init(frame);
+ }
+ if (ev == NULL) {
+ goto fail;
+ }
+
+ subreq = dcerpc_binding_handle_raw_call_send(frame, ev,
+ h, object, opnum,
+ in_flags,
+ in_data,
+ in_length);
+ if (subreq == NULL) {
+ goto fail;
+ }
+
+ if (!tevent_req_poll_ntstatus(subreq, ev, &status)) {
+ goto fail;
+ }
+
+ status = dcerpc_binding_handle_raw_call_recv(subreq,
+ mem_ctx,
+ out_data,
+ out_length,
+ out_flags);
+fail:
+ TALLOC_FREE(frame);
+ return status;
+}
+
+struct dcerpc_binding_handle_disconnect_state {
+ const struct dcerpc_binding_handle_ops *ops;
+};
+
+static void dcerpc_binding_handle_disconnect_done(struct tevent_req *subreq);
+
+struct tevent_req *dcerpc_binding_handle_disconnect_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h)
+{
+ struct tevent_req *req;
+ struct dcerpc_binding_handle_disconnect_state *state;
+ struct tevent_req *subreq;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct dcerpc_binding_handle_disconnect_state);
+ if (req == NULL) {
+ return NULL;
+ }
+
+ state->ops = h->ops;
+
+ subreq = state->ops->disconnect_send(state, ev, h);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, dcerpc_binding_handle_disconnect_done, req);
+
+ return req;
+}
+
+static void dcerpc_binding_handle_disconnect_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(subreq,
+ struct tevent_req);
+ struct dcerpc_binding_handle_disconnect_state *state =
+ tevent_req_data(req,
+ struct dcerpc_binding_handle_disconnect_state);
+ NTSTATUS error;
+
+ error = state->ops->disconnect_recv(subreq);
+ TALLOC_FREE(subreq);
+ if (tevent_req_nterror(req, error)) {
+ return;
+ }
+
+ tevent_req_done(req);
+}
+
+NTSTATUS dcerpc_binding_handle_disconnect_recv(struct tevent_req *req)
+{
+ NTSTATUS error;
+
+ if (tevent_req_is_nterror(req, &error)) {
+ tevent_req_received(req);
+ return error;
+ }
+
+ tevent_req_received(req);
+ return NT_STATUS_OK;
+}
+
+struct dcerpc_binding_handle_call_state {
+ struct dcerpc_binding_handle *h;
+ const struct ndr_interface_call *call;
+ TALLOC_CTX *r_mem;
+ void *r_ptr;
+ struct ndr_push *push;
+ DATA_BLOB request;
+ DATA_BLOB response;
+ struct ndr_pull *pull;
+};
+
+static void dcerpc_binding_handle_call_done(struct tevent_req *subreq);
+
+struct tevent_req *dcerpc_binding_handle_call_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ const struct ndr_interface_table *table,
+ uint32_t opnum,
+ TALLOC_CTX *r_mem,
+ void *r_ptr)
+{
+ struct tevent_req *req;
+ struct dcerpc_binding_handle_call_state *state;
+ struct tevent_req *subreq;
+ enum ndr_err_code ndr_err;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct dcerpc_binding_handle_call_state);
+ if (req == NULL) {
+ return NULL;
+ }
+
+ if (table != h->table) {
+ tevent_req_nterror(req, NT_STATUS_INVALID_HANDLE);
+ return tevent_req_post(req, ev);
+ }
+
+ if (opnum >= table->num_calls) {
+ tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+ return tevent_req_post(req, ev);
+ }
+
+ state->h = h;
+ state->call = &table->calls[opnum];
+
+ state->r_mem = r_mem;
+ state->r_ptr = r_ptr;
+
+ /* setup for a ndr_push_* call */
+ state->push = ndr_push_init_ctx(state);
+ if (tevent_req_nomem(state->push, req)) {
+ return tevent_req_post(req, ev);
+ }
+
+ if (h->ops->ref_alloc && h->ops->ref_alloc(h)) {
+ state->push->flags |= LIBNDR_FLAG_REF_ALLOC;
+ }
+
+ if (h->ops->push_bigendian && h->ops->push_bigendian(h)) {
+ state->push->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+
+ if (h->ops->use_ndr64 && h->ops->use_ndr64(h)) {
+ state->push->flags |= LIBNDR_FLAG_NDR64;
+ }
+
+ if (h->ops->do_ndr_print) {
+ h->ops->do_ndr_print(h, NDR_IN | NDR_SET_VALUES,
+ state->r_ptr, state->call);
+ }
+
+ /* push the structure into a blob */
+ ndr_err = state->call->ndr_push(state->push, NDR_IN, state->r_ptr);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS error;
+ error = ndr_map_error2ntstatus(ndr_err);
+ if (h->ops->ndr_push_failed) {
+ h->ops->ndr_push_failed(h, error,
+ state->r_ptr,
+ state->call);
+ }
+ tevent_req_nterror(req, error);
+ return tevent_req_post(req, ev);
+ }
+
+ /* retrieve the blob */
+ state->request = ndr_push_blob(state->push);
+
+ if (h->ops->ndr_validate_in) {
+ NTSTATUS error;
+ error = h->ops->ndr_validate_in(h, state,
+ &state->request,
+ state->call);
+ if (!NT_STATUS_IS_OK(error)) {
+ tevent_req_nterror(req, error);
+ return tevent_req_post(req, ev);
+ }
+ }
+
+ subreq = dcerpc_binding_handle_raw_call_send(state, ev,
+ h, object, opnum,
+ state->push->flags,
+ state->request.data,
+ state->request.length);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, dcerpc_binding_handle_call_done, req);
+
+ return req;
+}
+
+static void dcerpc_binding_handle_call_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(subreq,
+ struct tevent_req);
+ struct dcerpc_binding_handle_call_state *state =
+ tevent_req_data(req,
+ struct dcerpc_binding_handle_call_state);
+ struct dcerpc_binding_handle *h = state->h;
+ NTSTATUS error;
+ uint32_t out_flags = 0;
+ enum ndr_err_code ndr_err;
+
+ error = dcerpc_binding_handle_raw_call_recv(subreq, state,
+ &state->response.data,
+ &state->response.length,
+ &out_flags);
+ TALLOC_FREE(subreq);
+ if (tevent_req_nterror(req, error)) {
+ return;
+ }
+
+ state->pull = ndr_pull_init_blob(&state->response, state);
+ if (tevent_req_nomem(state->pull, req)) {
+ return;
+ }
+ state->pull->flags = state->push->flags;
+
+ if (out_flags & LIBNDR_FLAG_BIGENDIAN) {
+ state->pull->flags |= LIBNDR_FLAG_BIGENDIAN;
+ } else {
+ state->pull->flags &= ~LIBNDR_FLAG_BIGENDIAN;
+ }
+
+ state->pull->current_mem_ctx = state->r_mem;
+
+ /* pull the structure from the blob */
+ ndr_err = state->call->ndr_pull(state->pull, NDR_OUT, state->r_ptr);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ error = ndr_map_error2ntstatus(ndr_err);
+ if (h->ops->ndr_pull_failed) {
+ h->ops->ndr_pull_failed(h, error,
+ &state->response,
+ state->call);
+ }
+ tevent_req_nterror(req, error);
+ return;
+ }
+
+ if (h->ops->do_ndr_print) {
+ h->ops->do_ndr_print(h, NDR_OUT,
+ state->r_ptr, state->call);
+ }
+
+ if (h->ops->ndr_validate_out) {
+ error = h->ops->ndr_validate_out(h,
+ state->pull,
+ state->r_ptr,
+ state->call);
+ if (!NT_STATUS_IS_OK(error)) {
+ tevent_req_nterror(req, error);
+ return;
+ }
+ }
+
+ tevent_req_done(req);
+}
+
+NTSTATUS dcerpc_binding_handle_call_recv(struct tevent_req *req)
+{
+ return tevent_req_simple_recv_ntstatus(req);
+}
+
+NTSTATUS dcerpc_binding_handle_call(struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ const struct ndr_interface_table *table,
+ uint32_t opnum,
+ TALLOC_CTX *r_mem,
+ void *r_ptr)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct tevent_context *ev;
+ struct tevent_req *subreq;
+ NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+ /*
+ * TODO: allow only one sync call
+ */
+
+ if (h->sync_ev) {
+ ev = h->sync_ev;
+ } else {
+ ev = samba_tevent_context_init(frame);
+ }
+ if (ev == NULL) {
+ goto fail;
+ }
+
+ subreq = dcerpc_binding_handle_call_send(frame, ev,
+ h, object, table,
+ opnum, r_mem, r_ptr);
+ if (subreq == NULL) {
+ goto fail;
+ }
+
+ if (!tevent_req_poll_ntstatus(subreq, ev, &status)) {
+ goto fail;
+ }
+
+ status = dcerpc_binding_handle_call_recv(subreq);
+fail:
+ TALLOC_FREE(frame);
+ return status;
+}
diff --git a/librpc/rpc/dcerpc_error.c b/librpc/rpc/dcerpc_error.c
new file mode 100644
index 0000000..d5b5b66
--- /dev/null
+++ b/librpc/rpc/dcerpc_error.c
@@ -0,0 +1,153 @@
+/*
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
+
+struct dcerpc_fault_table {
+ const char *errstr;
+ uint32_t faultcode;
+ NTSTATUS nt_status;
+};
+
+static const struct dcerpc_fault_table dcerpc_faults[] =
+{
+#define _FAULT_STR(x, s) { .errstr = #x , .faultcode = x, .nt_status = s }
+#define _FAULT_STR_NO_NT_MAPPING(x) _FAULT_STR(x, NT_STATUS_RPC_NOT_RPC_ERROR)
+ _FAULT_STR(DCERPC_NCA_S_COMM_FAILURE, NT_STATUS_RPC_COMM_FAILURE),
+ _FAULT_STR(DCERPC_NCA_S_OP_RNG_ERROR, NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE),
+ _FAULT_STR(DCERPC_NCA_S_UNKNOWN_IF, NT_STATUS_RPC_UNKNOWN_IF),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_WRONG_BOOT_TIME),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_YOU_CRASHED),
+ _FAULT_STR(DCERPC_NCA_S_PROTO_ERROR, NT_STATUS_RPC_PROTOCOL_ERROR),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_OUT_ARGS_TOO_BIG),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_SERVER_TOO_BUSY),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_STRING_TOO_LARGE),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_UNSUPPORTED_TYPE),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_ADDR_ERROR),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_FP_DIV_BY_ZERO, NT_STATUS_RPC_FP_DIV_ZERO),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_FP_UNDERFLOW, NT_STATUS_RPC_FP_UNDERFLOW),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_FP_OVERRFLOW, NT_STATUS_RPC_FP_OVERFLOW),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_INT_DIV_BY_ZERO, NT_STATUS_RPC_FP_DIV_ZERO),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_INT_OVERFLOW, NT_STATUS_RPC_FP_OVERFLOW),
+ /*
+ * Our callers expect NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE
+ * instead of NT_STATUS_RPC_INVALID_TAG.
+ */
+ _FAULT_STR(DCERPC_NCA_S_FAULT_INVALID_TAG, NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_INVALID_TAG, NT_STATUS_RPC_INVALID_TAG),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_INVALID_BOUND, NT_STATUS_RPC_INVALID_BOUND),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_RPC_VERSION_MISMATCH, NT_STATUS_RPC_PROTOCOL_ERROR),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_UNSPEC_REJECT),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_BAD_ACTID),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_WHO_ARE_YOU_FAILED),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_MANAGER_NOT_ENTERED),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_CANCEL, NT_STATUS_RPC_CALL_CANCELLED),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_ILL_INST),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_FP_ERROR),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_UNUSED_1C000011),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_UNSPEC),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_REMOTE_COMM_FAILURE),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_PIPE_EMPTY),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_PIPE_CLOSED, NT_STATUS_RPC_PIPE_CLOSED),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_PIPE_ORDER),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_PIPE_DISCIPLINE, NT_STATUS_RPC_PIPE_DISCIPLINE_ERROR),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_PIPE_COMM_ERROR),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_PIPE_MEMORY),
+ _FAULT_STR(DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH, NT_STATUS_RPC_SS_CONTEXT_MISMATCH),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_INVALID_PRES_CONTEXT_ID),
+ _FAULT_STR(DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL, NT_STATUS_RPC_UNSUPPORTED_AUTHN_LEVEL),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_UNUSED_1C00001E),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_INVALID_CHECKSUM),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_INVALID_CRC),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_USER_DEFINED),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_TX_OPEN_FAILED),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND),
+ _FAULT_STR_NO_NT_MAPPING(DCERPC_NCA_S_FAULT_NO_CLIENT_STUB),
+ _FAULT_STR(DCERPC_FAULT_OTHER, NT_STATUS_RPC_CALL_FAILED),
+ _FAULT_STR(DCERPC_FAULT_ACCESS_DENIED, NT_STATUS_ACCESS_DENIED),
+ _FAULT_STR(DCERPC_FAULT_SERVER_UNAVAILABLE, NT_STATUS_RPC_SERVER_UNAVAILABLE),
+ _FAULT_STR(DCERPC_FAULT_NO_CALL_ACTIVE, NT_STATUS_RPC_NO_CALL_ACTIVE),
+ _FAULT_STR(DCERPC_FAULT_CANT_PERFORM, NT_STATUS_EPT_CANT_PERFORM_OP),
+ _FAULT_STR(DCERPC_FAULT_OUT_OF_RESOURCES, NT_STATUS_RPC_OUT_OF_RESOURCES),
+ _FAULT_STR(DCERPC_FAULT_BAD_STUB_DATA, NT_STATUS_RPC_BAD_STUB_DATA),
+ _FAULT_STR(DCERPC_FAULT_SEC_PKG_ERROR, NT_STATUS_RPC_SEC_PKG_ERROR),
+ { .faultcode = 0 }
+#undef _FAULT_STR
+};
+
+_PUBLIC_ const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code)
+{
+ int idx = 0;
+ WERROR werr = W_ERROR(fault_code);
+
+ while (dcerpc_faults[idx].errstr != NULL) {
+ if (dcerpc_faults[idx].faultcode == fault_code) {
+ return dcerpc_faults[idx].errstr;
+ }
+ idx++;
+ }
+
+ return win_errstr(werr);
+}
+
+_PUBLIC_ NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code)
+{
+ int idx = 0;
+ WERROR werr = W_ERROR(fault_code);
+
+ if (fault_code == 0) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ while (dcerpc_faults[idx].errstr != NULL) {
+ if (dcerpc_faults[idx].faultcode == fault_code) {
+ return dcerpc_faults[idx].nt_status;
+ }
+ idx++;
+ }
+
+ return werror_to_ntstatus(werr);
+}
+
+_PUBLIC_ uint32_t dcerpc_fault_from_nt_status(NTSTATUS nt_status)
+{
+ int idx = 0;
+ WERROR werr;
+
+ if (NT_STATUS_IS_OK(nt_status)) {
+ return DCERPC_NCA_S_PROTO_ERROR;
+ }
+
+ while (dcerpc_faults[idx].errstr != NULL) {
+ if (NT_STATUS_EQUAL(dcerpc_faults[idx].nt_status, nt_status)) {
+ return dcerpc_faults[idx].faultcode;
+ }
+ idx++;
+ }
+
+ werr = ntstatus_to_werror(nt_status);
+
+ return W_ERROR_V(werr);
+}
diff --git a/librpc/rpc/dcerpc_helper.c b/librpc/rpc/dcerpc_helper.c
new file mode 100644
index 0000000..e1589f9
--- /dev/null
+++ b/librpc/rpc/dcerpc_helper.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2020 Andreas Schneider <asn@samba.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include "librpc/gen_ndr/security.h"
+#include "librpc/gen_ndr/auth.h"
+#include "lib/crypto/gnutls_helpers.h"
+#include "libcli/security/dom_sid.h"
+#include "libcli/security/security_token.h"
+#include "libcli/smb/smb2_constants.h"
+
+#include "dcerpc_helper.h"
+
+static bool smb3_sid_parse(const struct dom_sid *sid,
+ uint16_t *pdialect,
+ uint16_t *pencrypt,
+ uint16_t *pcipher)
+{
+ uint16_t dialect;
+ uint16_t encrypt;
+ uint16_t cipher;
+
+ if (sid->sub_auths[0] != global_sid_Samba_SMB3.sub_auths[0]) {
+ return false;
+ }
+
+ dialect = sid->sub_auths[1];
+ if (dialect > 0x03ff) {
+ return false;
+ }
+
+ encrypt = sid->sub_auths[2];
+ if (encrypt > 0x0002) {
+ return false;
+ }
+
+ cipher = sid->sub_auths[3];
+ if (cipher > 256) {
+ /*
+ * It is unlikely that we
+ * ever have more then 256
+ * encryption algorithms
+ */
+ return false;
+ }
+
+ if (pdialect != NULL) {
+ *pdialect = dialect;
+ }
+
+ if (pencrypt != NULL) {
+ *pencrypt = encrypt;
+ }
+
+ if (pcipher != NULL) {
+ *pcipher = cipher;
+ }
+
+ return true;
+}
+
+bool dcerpc_is_transport_encrypted(struct auth_session_info *session_info)
+{
+ struct security_token *token = session_info->security_token;
+ struct dom_sid smb3_dom_sid = global_sid_Samba_SMB3;
+ const struct dom_sid *smb3_sid = NULL;
+ uint16_t dialect = 0;
+ uint16_t encrypt = 0;
+ uint16_t cipher = 0;
+ size_t num_smb3_sids;
+ bool ok;
+
+ num_smb3_sids = security_token_count_flag_sids(token,
+ &smb3_dom_sid,
+ 3,
+ &smb3_sid);
+ if (num_smb3_sids > 1) {
+ DBG_ERR("ERROR: The SMB3 SID has been detected %zu times\n",
+ num_smb3_sids);
+ return false;
+ }
+
+ if (smb3_sid == NULL) {
+ return false;
+ }
+
+ ok = smb3_sid_parse(smb3_sid, &dialect, &encrypt, &cipher);
+ if (!ok) {
+ DBG_ERR("Failed to parse SMB3 SID!\n");
+ return false;
+ }
+
+ DBG_DEBUG("SMB SID - dialect: %#04x, encrypt: %#04x, cipher: %#04x\n",
+ dialect,
+ encrypt,
+ cipher);
+
+ if (dialect < SMB3_DIALECT_REVISION_300) {
+ DBG_DEBUG("Invalid SMB3 dialect!\n");
+ return false;
+ }
+
+ if (encrypt != DCERPC_SMB_ENCRYPTION_REQUIRED) {
+ DBG_DEBUG("Invalid SMB3 encryption!\n");
+ return false;
+ }
+
+ switch (cipher) {
+ case SMB2_ENCRYPTION_AES128_CCM:
+ case SMB2_ENCRYPTION_AES128_GCM:
+ break;
+ default:
+ DBG_DEBUG("Invalid SMB3 cipher!\n");
+ return false;
+ }
+
+ return true;
+}
diff --git a/librpc/rpc/dcerpc_helper.h b/librpc/rpc/dcerpc_helper.h
new file mode 100644
index 0000000..c0f09ee
--- /dev/null
+++ b/librpc/rpc/dcerpc_helper.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2020 Andreas Schneider <asn@samba.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _DCERPC_HELPER_H
+#define _DCERPC_HELPER_H
+
+#define DCERPC_SMB_ENCRYPTION_OFF 0x0000
+#define DCERPC_SMB_ENCRYPTION_REQUIRED 0x0002
+
+bool dcerpc_is_transport_encrypted(struct auth_session_info *session_info);
+
+#endif /* _DCERPC_HELPER_H */
diff --git a/librpc/rpc/dcerpc_pkt_auth.c b/librpc/rpc/dcerpc_pkt_auth.c
new file mode 100644
index 0000000..1cb1914
--- /dev/null
+++ b/librpc/rpc/dcerpc_pkt_auth.c
@@ -0,0 +1,500 @@
+/*
+ Unix SMB/CIFS implementation.
+ raw dcerpc operations
+
+ Copyright (C) Andrew Tridgell 2003-2005
+ Copyright (C) Jelmer Vernooij 2004-2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "system/network.h"
+#include <tevent.h>
+#include "lib/util/talloc_stack.h"
+#include "lib/util/debug.h"
+#include "lib/util/byteorder.h"
+#include "lib/util/samba_util.h"
+#include "librpc/rpc/dcerpc.h"
+#include "librpc/rpc/dcerpc_util.h"
+#include "librpc/rpc/dcerpc_pkt_auth.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "rpc_common.h"
+#include "lib/util/bitmap.h"
+#include "auth/gensec/gensec.h"
+#include "lib/util/mkdir_p.h"
+#include "lib/crypto/gnutls_helpers.h"
+#include <gnutls/crypto.h>
+
+NTSTATUS dcerpc_ncacn_pull_pkt_auth(const struct dcerpc_auth *auth_state,
+ struct gensec_security *gensec,
+ bool check_pkt_auth_fields,
+ TALLOC_CTX *mem_ctx,
+ enum dcerpc_pkt_type ptype,
+ uint8_t required_flags,
+ uint8_t optional_flags,
+ uint8_t payload_offset,
+ DATA_BLOB *payload_and_verifier,
+ DATA_BLOB *raw_packet,
+ const struct ncacn_packet *pkt)
+{
+ NTSTATUS status;
+ struct dcerpc_auth auth;
+ uint32_t auth_length;
+
+ if (auth_state == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ status = dcerpc_verify_ncacn_packet_header(pkt, ptype,
+ payload_and_verifier->length,
+ required_flags, optional_flags);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ switch (auth_state->auth_level) {
+ case DCERPC_AUTH_LEVEL_PRIVACY:
+ case DCERPC_AUTH_LEVEL_INTEGRITY:
+ case DCERPC_AUTH_LEVEL_PACKET:
+ break;
+
+ case DCERPC_AUTH_LEVEL_CONNECT:
+ if (pkt->auth_length != 0) {
+ break;
+ }
+ return NT_STATUS_OK;
+ case DCERPC_AUTH_LEVEL_NONE:
+ if (pkt->auth_length != 0) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ return NT_STATUS_OK;
+
+ default:
+ return NT_STATUS_RPC_UNSUPPORTED_AUTHN_LEVEL;
+ }
+
+ if (pkt->auth_length == 0) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (gensec == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ status = dcerpc_pull_auth_trailer(pkt, mem_ctx,
+ payload_and_verifier,
+ &auth, &auth_length, false);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (payload_and_verifier->length < auth_length) {
+ /*
+ * should be checked in dcerpc_pull_auth_trailer()
+ */
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ payload_and_verifier->length -= auth_length;
+
+ if (payload_and_verifier->length < auth.auth_pad_length) {
+ /*
+ * should be checked in dcerpc_pull_auth_trailer()
+ */
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ if (check_pkt_auth_fields) {
+ if (auth.auth_type != auth_state->auth_type) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ if (auth.auth_level != auth_state->auth_level) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ if (auth.auth_context_id != auth_state->auth_context_id) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ }
+
+ /* check signature or unseal the packet */
+ switch (auth_state->auth_level) {
+ case DCERPC_AUTH_LEVEL_PRIVACY:
+ status = gensec_unseal_packet(gensec,
+ raw_packet->data + payload_offset,
+ payload_and_verifier->length,
+ raw_packet->data,
+ raw_packet->length -
+ auth.credentials.length,
+ &auth.credentials);
+ if (!NT_STATUS_IS_OK(status)) {
+ return NT_STATUS_RPC_SEC_PKG_ERROR;
+ }
+ memcpy(payload_and_verifier->data,
+ raw_packet->data + payload_offset,
+ payload_and_verifier->length);
+ break;
+
+ case DCERPC_AUTH_LEVEL_INTEGRITY:
+ case DCERPC_AUTH_LEVEL_PACKET:
+ status = gensec_check_packet(gensec,
+ payload_and_verifier->data,
+ payload_and_verifier->length,
+ raw_packet->data,
+ raw_packet->length -
+ auth.credentials.length,
+ &auth.credentials);
+ if (!NT_STATUS_IS_OK(status)) {
+ return NT_STATUS_RPC_SEC_PKG_ERROR;
+ }
+ break;
+
+ case DCERPC_AUTH_LEVEL_CONNECT:
+ /* for now we ignore possible signatures here */
+ break;
+
+ default:
+ return NT_STATUS_RPC_UNSUPPORTED_AUTHN_LEVEL;
+ }
+
+ /*
+ * remove the indicated amount of padding
+ *
+ * A possible overflow is checked above.
+ */
+ payload_and_verifier->length -= auth.auth_pad_length;
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS dcerpc_ncacn_push_pkt_auth(const struct dcerpc_auth *auth_state,
+ struct gensec_security *gensec,
+ TALLOC_CTX *mem_ctx,
+ DATA_BLOB *raw_packet,
+ size_t sig_size,
+ uint8_t payload_offset,
+ const DATA_BLOB *payload,
+ const struct ncacn_packet *pkt)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ NTSTATUS status;
+ enum ndr_err_code ndr_err;
+ struct ndr_push *ndr = NULL;
+ uint32_t payload_length;
+ uint32_t whole_length;
+ DATA_BLOB blob = data_blob_null;
+ DATA_BLOB sig = data_blob_null;
+ struct dcerpc_auth _out_auth_info;
+ struct dcerpc_auth *out_auth_info = NULL;
+
+ *raw_packet = data_blob_null;
+
+ if (auth_state == NULL) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ switch (auth_state->auth_level) {
+ case DCERPC_AUTH_LEVEL_PRIVACY:
+ case DCERPC_AUTH_LEVEL_INTEGRITY:
+ case DCERPC_AUTH_LEVEL_PACKET:
+ if (sig_size == 0) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ if (gensec == NULL) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ _out_auth_info = (struct dcerpc_auth) {
+ .auth_type = auth_state->auth_type,
+ .auth_level = auth_state->auth_level,
+ .auth_context_id = auth_state->auth_context_id,
+ };
+ out_auth_info = &_out_auth_info;
+ break;
+
+ case DCERPC_AUTH_LEVEL_CONNECT:
+ /*
+ * TODO: let the gensec mech decide if it wants to generate a
+ * signature that might be needed for schannel...
+ */
+ if (sig_size != 0) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ if (gensec == NULL) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ break;
+
+ case DCERPC_AUTH_LEVEL_NONE:
+ if (sig_size != 0) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ break;
+
+ default:
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ ndr = ndr_push_init_ctx(frame);
+ if (ndr == NULL) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ndr_err = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ TALLOC_FREE(frame);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ if (out_auth_info != NULL) {
+ /*
+ * pad to 16 byte multiple in the payload portion of the
+ * packet. This matches what w2k3 does. Note that we can't use
+ * ndr_push_align() as that is relative to the start of the
+ * whole packet, whereas w2k8 wants it relative to the start
+ * of the stub.
+ */
+ out_auth_info->auth_pad_length =
+ DCERPC_AUTH_PAD_LENGTH(payload->length);
+ ndr_err = ndr_push_zero(ndr, out_auth_info->auth_pad_length);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ TALLOC_FREE(frame);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ payload_length = payload->length +
+ out_auth_info->auth_pad_length;
+
+ ndr_err = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS,
+ out_auth_info);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ TALLOC_FREE(frame);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ whole_length = ndr->offset;
+
+ ndr_err = ndr_push_zero(ndr, sig_size);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ TALLOC_FREE(frame);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+ } else {
+ payload_length = payload->length;
+ whole_length = ndr->offset;
+ }
+
+ /* extract the whole packet as a blob */
+ blob = ndr_push_blob(ndr);
+
+ /*
+ * Setup the frag and auth length in the packet buffer.
+ * This is needed if the GENSEC mech does AEAD signing
+ * of the packet headers. The signature itself will be
+ * appended later.
+ */
+ dcerpc_set_frag_length(&blob, blob.length);
+ dcerpc_set_auth_length(&blob, sig_size);
+
+ /* sign or seal the packet */
+ switch (auth_state->auth_level) {
+ case DCERPC_AUTH_LEVEL_PRIVACY:
+ status = gensec_seal_packet(gensec,
+ frame,
+ blob.data + payload_offset,
+ payload_length,
+ blob.data,
+ whole_length,
+ &sig);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return status;
+ }
+ break;
+
+ case DCERPC_AUTH_LEVEL_INTEGRITY:
+ case DCERPC_AUTH_LEVEL_PACKET:
+ status = gensec_sign_packet(gensec,
+ frame,
+ blob.data + payload_offset,
+ payload_length,
+ blob.data,
+ whole_length,
+ &sig);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return status;
+ }
+ break;
+
+ case DCERPC_AUTH_LEVEL_CONNECT:
+ case DCERPC_AUTH_LEVEL_NONE:
+ break;
+
+ default:
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ if (sig.length != sig_size) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_RPC_SEC_PKG_ERROR;
+ }
+
+ if (sig_size != 0) {
+ memcpy(blob.data + whole_length, sig.data, sig_size);
+ }
+
+ *raw_packet = blob;
+ talloc_steal(mem_ctx, raw_packet->data);
+ TALLOC_FREE(frame);
+ return NT_STATUS_OK;
+}
+
+#ifdef DEVELOPER
+
+/*
+ * Save valid, well-formed DCE/RPC stubs to use as a seed for
+ * ndr_fuzz_X
+ */
+void dcerpc_save_ndr_fuzz_seed(TALLOC_CTX *mem_ctx,
+ DATA_BLOB raw_blob,
+ const char *dump_dir,
+ const char *iface_name,
+ int flags,
+ int opnum,
+ bool ndr64)
+{
+ char *fname = NULL;
+ const char *sub_dir = NULL;
+ TALLOC_CTX *temp_ctx = talloc_new(mem_ctx);
+ DATA_BLOB blob;
+ int ret, rc;
+ uint8_t digest[20];
+ DATA_BLOB digest_blob;
+ char *digest_hex;
+ uint16_t fuzz_flags = 0;
+
+ /*
+ * We want to save the 'stub' in a per-pipe subdirectory, with
+ * the ndr_fuzz_X header 4 byte header. For the sake of
+ * convenience (this is a developer only function), we mkdir
+ * -p the sub-directories when they are needed.
+ */
+
+ if (dump_dir == NULL) {
+ return;
+ }
+
+ temp_ctx = talloc_stackframe();
+
+ sub_dir = talloc_asprintf(temp_ctx, "%s/%s",
+ dump_dir,
+ iface_name);
+ if (sub_dir == NULL) {
+ talloc_free(temp_ctx);
+ return;
+ }
+ ret = mkdir_p(sub_dir, 0755);
+ if (ret && errno != EEXIST) {
+ DBG_ERR("could not create %s\n", sub_dir);
+ talloc_free(temp_ctx);
+ return;
+ }
+
+ blob.length = raw_blob.length + 4;
+ blob.data = talloc_array(sub_dir,
+ uint8_t,
+ blob.length);
+ if (blob.data == NULL) {
+ DBG_ERR("could not allocate for fuzz seeds! (%s)\n",
+ iface_name);
+ talloc_free(temp_ctx);
+ return;
+ }
+
+ if (ndr64) {
+ fuzz_flags = 4;
+ }
+ if (flags & NDR_IN) {
+ fuzz_flags |= 1;
+ } else if (flags & NDR_OUT) {
+ fuzz_flags |= 2;
+ }
+
+ SSVAL(blob.data, 0, fuzz_flags);
+ SSVAL(blob.data, 2, opnum);
+
+ memcpy(&blob.data[4],
+ raw_blob.data,
+ raw_blob.length);
+
+ /*
+ * This matches how oss-fuzz names the corpus input files, due
+ * to a preference from libFuzzer
+ */
+ rc = gnutls_hash_fast(GNUTLS_DIG_SHA1,
+ blob.data,
+ blob.length,
+ digest);
+ if (rc < 0) {
+ /*
+ * This prints a better error message, eg if SHA1 is
+ * disabled
+ */
+ NTSTATUS status = gnutls_error_to_ntstatus(rc,
+ NT_STATUS_HASH_NOT_SUPPORTED);
+ DBG_ERR("Failed to generate SHA1 to save fuzz seed: %s",
+ nt_errstr(status));
+ talloc_free(temp_ctx);
+ return;
+ }
+
+ digest_blob.data = digest;
+ digest_blob.length = sizeof(digest);
+ digest_hex = data_blob_hex_string_lower(temp_ctx, &digest_blob);
+
+ fname = talloc_asprintf(temp_ctx, "%s/%s",
+ sub_dir,
+ digest_hex);
+ if (fname == NULL) {
+ talloc_free(temp_ctx);
+ return;
+ }
+
+ /*
+ * If this fails, it is most likely because that file already
+ * exists. This is fine, it means we already have this
+ * sample
+ */
+ file_save(fname,
+ blob.data,
+ blob.length);
+
+ talloc_free(temp_ctx);
+}
+
+#endif /*if DEVELOPER, enveloping _dcesrv_save_ndr_fuzz_seed() */
diff --git a/librpc/rpc/dcerpc_pkt_auth.h b/librpc/rpc/dcerpc_pkt_auth.h
new file mode 100644
index 0000000..1dcee12
--- /dev/null
+++ b/librpc/rpc/dcerpc_pkt_auth.h
@@ -0,0 +1,59 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Copyright (C) Stefan Metzmacher 2010-2011
+ Copyright (C) Andrew Tridgell 2010-2011
+ Copyright (C) Simo Sorce 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __LIBRPC_RPC_DCERPC_PKT_AUTH_H__
+#define __LIBRPC_RPC_DCERPC_PKT_AUTH_H__
+
+#include "replace.h"
+#include <talloc.h>
+#include "lib/util/data_blob.h"
+#include "libcli/util/ntstatus.h"
+#include "librpc/rpc/rpc_common.h"
+#include "librpc/gen_ndr/dcerpc.h"
+
+NTSTATUS dcerpc_ncacn_pull_pkt_auth(const struct dcerpc_auth *auth_state,
+ struct gensec_security *gensec,
+ bool check_pkt_auth_fields,
+ TALLOC_CTX *mem_ctx,
+ enum dcerpc_pkt_type ptype,
+ uint8_t required_flags,
+ uint8_t optional_flags,
+ uint8_t payload_offset,
+ DATA_BLOB *payload_and_verifier,
+ DATA_BLOB *raw_packet,
+ const struct ncacn_packet *pkt);
+NTSTATUS dcerpc_ncacn_push_pkt_auth(const struct dcerpc_auth *auth_state,
+ struct gensec_security *gensec,
+ TALLOC_CTX *mem_ctx,
+ DATA_BLOB *raw_packet,
+ size_t sig_size,
+ uint8_t payload_offset,
+ const DATA_BLOB *payload,
+ const struct ncacn_packet *pkt);
+struct tevent_req *dcerpc_read_ncacn_packet_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tstream_context *stream);
+NTSTATUS dcerpc_read_ncacn_packet_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ struct ncacn_packet **pkt,
+ DATA_BLOB *buffer);
+
+#endif
diff --git a/librpc/rpc/dcerpc_samr.h b/librpc/rpc/dcerpc_samr.h
new file mode 100644
index 0000000..dac89a9
--- /dev/null
+++ b/librpc/rpc/dcerpc_samr.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2022 Andreas Schneider <asn@samba.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _DCERPC_SAMR_H
+#define _DCERPC_SAMR_H
+
+#include <util/discard.h>
+#include "lib/util/data_blob.h"
+
+#define SAMR_AES256_ENC_KEY_STRING \
+ "Microsoft SAM encryption key AEAD-AES-256-CBC-HMAC-SHA512 16"
+#define SAMR_AES256_ENC_KEY_STRING_LEN 61 /* Including terminating null byte */
+
+#define SAMR_AES256_MAC_KEY_STRING \
+ "Microsoft SAM MAC key AEAD-AES-256-CBC-HMAC-SHA512 16"
+#define SAMR_AES256_MAC_KEY_STRING_LEN 54 /* Including terminating null byte */
+
+static const DATA_BLOB samr_aes256_enc_key_salt = {
+ .data = discard_const_p(uint8_t, SAMR_AES256_ENC_KEY_STRING),
+ .length = SAMR_AES256_ENC_KEY_STRING_LEN,
+};
+
+static const DATA_BLOB samr_aes256_mac_key_salt = {
+ .data = discard_const_p(uint8_t, SAMR_AES256_MAC_KEY_STRING),
+ .length = SAMR_AES256_MAC_KEY_STRING_LEN,
+};
+
+#endif /* _DCERPC_SAMR_H */
diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
new file mode 100644
index 0000000..e3c81b6
--- /dev/null
+++ b/librpc/rpc/dcerpc_util.c
@@ -0,0 +1,1140 @@
+/*
+ Unix SMB/CIFS implementation.
+ raw dcerpc operations
+
+ Copyright (C) Andrew Tridgell 2003-2005
+ Copyright (C) Jelmer Vernooij 2004-2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "system/network.h"
+#include <tevent.h>
+#include "lib/tsocket/tsocket.h"
+#include "lib/util/tevent_ntstatus.h"
+#include "librpc/rpc/dcerpc.h"
+#include "librpc/rpc/dcerpc_util.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "rpc_common.h"
+#include "lib/util/bitmap.h"
+
+#undef strncasecmp
+
+/* we need to be able to get/set the fragment length without doing a full
+ decode */
+void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v)
+{
+ SMB_ASSERT(blob->length >= DCERPC_NCACN_PAYLOAD_OFFSET);
+
+ if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
+ SSVAL(blob->data, DCERPC_FRAG_LEN_OFFSET, v);
+ } else {
+ RSSVAL(blob->data, DCERPC_FRAG_LEN_OFFSET, v);
+ }
+}
+
+uint16_t dcerpc_get_frag_length(const DATA_BLOB *blob)
+{
+ SMB_ASSERT(blob->length >= DCERPC_NCACN_PAYLOAD_OFFSET);
+
+ if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
+ return SVAL(blob->data, DCERPC_FRAG_LEN_OFFSET);
+ } else {
+ return RSVAL(blob->data, DCERPC_FRAG_LEN_OFFSET);
+ }
+}
+
+void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v)
+{
+ SMB_ASSERT(blob->length >= DCERPC_NCACN_PAYLOAD_OFFSET);
+
+ if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
+ SSVAL(blob->data, DCERPC_AUTH_LEN_OFFSET, v);
+ } else {
+ RSSVAL(blob->data, DCERPC_AUTH_LEN_OFFSET, v);
+ }
+}
+
+uint16_t dcerpc_get_auth_length(const DATA_BLOB *blob)
+{
+ SMB_ASSERT(blob->length >= DCERPC_NCACN_PAYLOAD_OFFSET);
+
+ if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
+ return SVAL(blob->data, DCERPC_AUTH_LEN_OFFSET);
+ } else {
+ return RSVAL(blob->data, DCERPC_AUTH_LEN_OFFSET);
+ }
+}
+
+uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob)
+{
+ SMB_ASSERT(blob->length >= DCERPC_NCACN_PAYLOAD_OFFSET);
+
+ return blob->data[DCERPC_DREP_OFFSET];
+}
+
+static uint16_t dcerpc_get_auth_context_offset(const DATA_BLOB *blob)
+{
+ uint16_t frag_len = dcerpc_get_frag_length(blob);
+ uint16_t auth_len = dcerpc_get_auth_length(blob);
+ uint16_t min_offset;
+ uint16_t offset;
+
+ if (auth_len == 0) {
+ return 0;
+ }
+
+ if (frag_len > blob->length) {
+ return 0;
+ }
+
+ if (auth_len > frag_len) {
+ return 0;
+ }
+
+ min_offset = DCERPC_NCACN_PAYLOAD_OFFSET + DCERPC_AUTH_TRAILER_LENGTH;
+ offset = frag_len - auth_len;
+ if (offset < min_offset) {
+ return 0;
+ }
+ offset -= DCERPC_AUTH_TRAILER_LENGTH;
+
+ return offset;
+}
+
+uint8_t dcerpc_get_auth_type(const DATA_BLOB *blob)
+{
+ uint16_t offset;
+
+ offset = dcerpc_get_auth_context_offset(blob);
+ if (offset == 0) {
+ return 0;
+ }
+
+ /*
+ * auth_typw is in the 1st byte
+ * of the auth trailer
+ */
+ offset += 0;
+
+ return blob->data[offset];
+}
+
+uint8_t dcerpc_get_auth_level(const DATA_BLOB *blob)
+{
+ uint16_t offset;
+
+ offset = dcerpc_get_auth_context_offset(blob);
+ if (offset == 0) {
+ return 0;
+ }
+
+ /*
+ * auth_level is in 2nd byte
+ * of the auth trailer
+ */
+ offset += 1;
+
+ return blob->data[offset];
+}
+
+uint32_t dcerpc_get_auth_context_id(const DATA_BLOB *blob)
+{
+ uint16_t offset;
+
+ offset = dcerpc_get_auth_context_offset(blob);
+ if (offset == 0) {
+ return 0;
+ }
+
+ /*
+ * auth_context_id is in the last 4 byte
+ * of the auth trailer
+ */
+ offset += 4;
+
+ if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
+ return IVAL(blob->data, offset);
+ } else {
+ return RIVAL(blob->data, offset);
+ }
+}
+
+/**
+* @brief Decodes a ncacn_packet
+*
+* @param mem_ctx The memory context on which to allocate the packet
+* elements
+* @param blob The blob of data to decode
+* @param r An empty ncacn_packet, must not be NULL
+*
+* @return a NTSTATUS error code
+*/
+NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *blob,
+ struct ncacn_packet *r)
+{
+ enum ndr_err_code ndr_err;
+ struct ndr_pull *ndr;
+
+ ndr = ndr_pull_init_blob(blob, mem_ctx);
+ if (!ndr) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ndr_err = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, r);
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(ndr);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+ talloc_free(ndr);
+
+ if (r->frag_length != blob->length) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/**
+* @brief Pull a dcerpc_auth structure, taking account of any auth
+* padding in the blob. For request/response packets we pass
+* the whole data blob, so auth_data_only must be set to false
+* as the blob contains data+pad+auth and no just pad+auth.
+*
+* @param pkt - The ncacn_packet strcuture
+* @param mem_ctx - The mem_ctx used to allocate dcerpc_auth elements
+* @param pkt_trailer - The packet trailer data, usually the trailing
+* auth_info blob, but in the request/response case
+* this is the stub_and_verifier blob.
+* @param auth - A preallocated dcerpc_auth *empty* structure
+* @param auth_length - The length of the auth trail, sum of auth header
+* lenght and pkt->auth_length
+* @param auth_data_only - Whether the pkt_trailer includes only the auth_blob
+* (+ padding) or also other data.
+*
+* @return - A NTSTATUS error code.
+*/
+NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
+ TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *pkt_trailer,
+ struct dcerpc_auth *auth,
+ uint32_t *_auth_length,
+ bool auth_data_only)
+{
+ struct ndr_pull *ndr;
+ enum ndr_err_code ndr_err;
+ uint16_t data_and_pad;
+ uint16_t auth_length;
+ uint32_t tmp_length;
+ uint32_t max_pad_len = 0;
+
+ ZERO_STRUCTP(auth);
+ if (_auth_length != NULL) {
+ *_auth_length = 0;
+
+ if (auth_data_only) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ } else {
+ if (!auth_data_only) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ }
+
+ /* Paranoia checks for auth_length. The caller should check this... */
+ if (pkt->auth_length == 0) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ /* Paranoia checks for auth_length. The caller should check this... */
+ if (pkt->auth_length > pkt->frag_length) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ tmp_length = DCERPC_NCACN_PAYLOAD_OFFSET;
+ tmp_length += DCERPC_AUTH_TRAILER_LENGTH;
+ tmp_length += pkt->auth_length;
+ if (tmp_length > pkt->frag_length) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ if (pkt_trailer->length > UINT16_MAX) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ auth_length = DCERPC_AUTH_TRAILER_LENGTH + pkt->auth_length;
+ if (pkt_trailer->length < auth_length) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ data_and_pad = pkt_trailer->length - auth_length;
+
+ ndr = ndr_pull_init_blob(pkt_trailer, mem_ctx);
+ if (!ndr) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if (!(pkt->drep[0] & DCERPC_DREP_LE)) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+
+ ndr_err = ndr_pull_advance(ndr, data_and_pad);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(ndr);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ ndr_err = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(ndr);
+ ZERO_STRUCTP(auth);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ /*
+ * Make sure the padding would not exceed
+ * the frag_length.
+ *
+ * Here we assume at least 24 bytes for the
+ * payload specific header the value of
+ * DCERPC_{REQUEST,RESPONSE}_LENGTH.
+ *
+ * We use this also for BIND_*, ALTER_* and AUTH3 pdus.
+ *
+ * We need this check before we ignore possible
+ * invalid values. See also bug #11982.
+ *
+ * This check is mainly used to generate the correct
+ * error for BIND_*, ALTER_* and AUTH3 pdus.
+ *
+ * We always have the 'if (data_and_pad < auth->auth_pad_length)'
+ * protection for REQUEST and RESPONSE pdus, where the
+ * auth_pad_length field is actually used by the caller.
+ */
+ tmp_length = DCERPC_REQUEST_LENGTH;
+ tmp_length += DCERPC_AUTH_TRAILER_LENGTH;
+ tmp_length += pkt->auth_length;
+ if (tmp_length < pkt->frag_length) {
+ max_pad_len = pkt->frag_length - tmp_length;
+ }
+ if (max_pad_len < auth->auth_pad_length) {
+ DEBUG(1, (__location__ ": ERROR: pad length to large. "
+ "max %u got %u\n",
+ (unsigned)max_pad_len,
+ (unsigned)auth->auth_pad_length));
+ talloc_free(ndr);
+ ZERO_STRUCTP(auth);
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ /*
+ * This is a workarround for a bug in old
+ * Samba releases. For BIND_ACK <= 3.5.x
+ * and for ALTER_RESP <= 4.2.x (see bug #11061)
+ *
+ * See also bug #11982.
+ */
+ if (auth_data_only && data_and_pad == 0 &&
+ auth->auth_pad_length > 0) {
+ /*
+ * we need to ignore invalid auth_pad_length
+ * values for BIND_*, ALTER_* and AUTH3 pdus.
+ */
+ auth->auth_pad_length = 0;
+ }
+
+ if (data_and_pad < auth->auth_pad_length) {
+ DBG_WARNING(__location__ ": ERROR: pad length too long. "
+ "Calculated %u (pkt_trailer->length=%u - auth_length=%u) "
+ "was less than auth_pad_length=%u\n",
+ (unsigned)data_and_pad,
+ (unsigned)pkt_trailer->length,
+ (unsigned)auth_length,
+ (unsigned)auth->auth_pad_length);
+ talloc_free(ndr);
+ ZERO_STRUCTP(auth);
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (auth_data_only && data_and_pad > auth->auth_pad_length) {
+ DBG_WARNING(__location__ ": ERROR: auth_data_only pad length mismatch. "
+ "Client sent a longer BIND packet than expected by %u bytes "
+ "(pkt_trailer->length=%u - auth_length=%u) "
+ "= %u auth_pad_length=%u\n",
+ (unsigned)data_and_pad - (unsigned)auth->auth_pad_length,
+ (unsigned)pkt_trailer->length,
+ (unsigned)auth_length,
+ (unsigned)data_and_pad,
+ (unsigned)auth->auth_pad_length);
+ talloc_free(ndr);
+ ZERO_STRUCTP(auth);
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (auth_data_only && data_and_pad != auth->auth_pad_length) {
+ DBG_WARNING(__location__ ": ERROR: auth_data_only pad length mismatch. "
+ "Calculated %u (pkt_trailer->length=%u - auth_length=%u) "
+ "but auth_pad_length=%u\n",
+ (unsigned)data_and_pad,
+ (unsigned)pkt_trailer->length,
+ (unsigned)auth_length,
+ (unsigned)auth->auth_pad_length);
+ talloc_free(ndr);
+ ZERO_STRUCTP(auth);
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ DBG_DEBUG("auth_pad_length %u\n",
+ (unsigned)auth->auth_pad_length);
+
+ talloc_steal(mem_ctx, auth->credentials.data);
+ talloc_free(ndr);
+
+ if (_auth_length != NULL) {
+ *_auth_length = auth_length;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/**
+* @brief Verify the fields in ncacn_packet header.
+*
+* @param pkt - The ncacn_packet strcuture
+* @param ptype - The expected PDU type
+* @param max_auth_info - The maximum size of a possible auth trailer
+* @param required_flags - The required flags for the pdu.
+* @param optional_flags - The possible optional flags for the pdu.
+*
+* @return - A NTSTATUS error code.
+*/
+NTSTATUS dcerpc_verify_ncacn_packet_header(const struct ncacn_packet *pkt,
+ enum dcerpc_pkt_type ptype,
+ size_t max_auth_info,
+ uint8_t required_flags,
+ uint8_t optional_flags)
+{
+ if (pkt->rpc_vers != 5) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (pkt->rpc_vers_minor != 0) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (pkt->auth_length > pkt->frag_length) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (pkt->ptype != ptype) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (max_auth_info > UINT16_MAX) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ if (pkt->auth_length > 0) {
+ size_t max_auth_length;
+
+ if (max_auth_info <= DCERPC_AUTH_TRAILER_LENGTH) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+ max_auth_length = max_auth_info - DCERPC_AUTH_TRAILER_LENGTH;
+
+ if (pkt->auth_length > max_auth_length) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+ }
+
+ if ((pkt->pfc_flags & required_flags) != required_flags) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+ if (pkt->pfc_flags & ~(optional_flags|required_flags)) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (pkt->drep[0] & ~DCERPC_DREP_LE) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+ if (pkt->drep[1] != 0) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+ if (pkt->drep[2] != 0) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+ if (pkt->drep[3] != 0) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ return NT_STATUS_OK;
+}
+
+struct dcerpc_read_ncacn_packet_state {
+#if 0
+ struct {
+ } caller;
+#endif
+ DATA_BLOB buffer;
+ struct ncacn_packet *pkt;
+};
+
+static int dcerpc_read_ncacn_packet_next_vector(struct tstream_context *stream,
+ void *private_data,
+ TALLOC_CTX *mem_ctx,
+ struct iovec **_vector,
+ size_t *_count);
+static void dcerpc_read_ncacn_packet_done(struct tevent_req *subreq);
+
+struct tevent_req *dcerpc_read_ncacn_packet_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tstream_context *stream)
+{
+ struct tevent_req *req;
+ struct dcerpc_read_ncacn_packet_state *state;
+ struct tevent_req *subreq;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct dcerpc_read_ncacn_packet_state);
+ if (req == NULL) {
+ return NULL;
+ }
+
+ state->pkt = talloc_zero(state, struct ncacn_packet);
+ if (tevent_req_nomem(state->pkt, req)) {
+ goto post;
+ }
+
+ subreq = tstream_readv_pdu_send(state, ev,
+ stream,
+ dcerpc_read_ncacn_packet_next_vector,
+ state);
+ if (tevent_req_nomem(subreq, req)) {
+ goto post;
+ }
+ tevent_req_set_callback(subreq, dcerpc_read_ncacn_packet_done, req);
+
+ return req;
+ post:
+ tevent_req_post(req, ev);
+ return req;
+}
+
+static int dcerpc_read_ncacn_packet_next_vector(struct tstream_context *stream,
+ void *private_data,
+ TALLOC_CTX *mem_ctx,
+ struct iovec **_vector,
+ size_t *_count)
+{
+ struct dcerpc_read_ncacn_packet_state *state =
+ talloc_get_type_abort(private_data,
+ struct dcerpc_read_ncacn_packet_state);
+ struct iovec *vector;
+ off_t ofs = 0;
+
+ if (state->buffer.length == 0) {
+ /*
+ * first get enough to read the fragment length
+ *
+ * We read the full fixed ncacn_packet header
+ * in order to make wireshark happy with
+ * pcap files from socket_wrapper.
+ */
+ ofs = 0;
+ state->buffer.length = DCERPC_NCACN_PAYLOAD_OFFSET;
+ state->buffer.data = talloc_array(state, uint8_t,
+ state->buffer.length);
+ if (!state->buffer.data) {
+ return -1;
+ }
+ } else if (state->buffer.length == DCERPC_NCACN_PAYLOAD_OFFSET) {
+ /* now read the fragment length and allocate the full buffer */
+ size_t frag_len = dcerpc_get_frag_length(&state->buffer);
+
+ ofs = state->buffer.length;
+
+ if (frag_len <= ofs) {
+ /*
+ * With frag_len == ofs, we are done, this is likely
+ * a DCERPC_PKT_CO_CANCEL and DCERPC_PKT_ORPHANED
+ * without any payload.
+ *
+ * Otherwise it's a broken packet and we
+ * let the caller deal with it.
+ */
+ *_vector = NULL;
+ *_count = 0;
+ return 0;
+ }
+
+ state->buffer.data = talloc_realloc(state,
+ state->buffer.data,
+ uint8_t, frag_len);
+ if (!state->buffer.data) {
+ return -1;
+ }
+ state->buffer.length = frag_len;
+ } else {
+ /* if we reach this we have a full fragment */
+ *_vector = NULL;
+ *_count = 0;
+ return 0;
+ }
+
+ /* now create the vector that we want to be filled */
+ vector = talloc_array(mem_ctx, struct iovec, 1);
+ if (!vector) {
+ return -1;
+ }
+
+ vector[0].iov_base = (void *) (state->buffer.data + ofs);
+ vector[0].iov_len = state->buffer.length - ofs;
+
+ *_vector = vector;
+ *_count = 1;
+ return 0;
+}
+
+static void dcerpc_read_ncacn_packet_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(subreq,
+ struct tevent_req);
+ struct dcerpc_read_ncacn_packet_state *state = tevent_req_data(req,
+ struct dcerpc_read_ncacn_packet_state);
+ int ret;
+ int sys_errno;
+ NTSTATUS status;
+
+ ret = tstream_readv_pdu_recv(subreq, &sys_errno);
+ TALLOC_FREE(subreq);
+ if (ret == -1) {
+ status = map_nt_error_from_unix_common(sys_errno);
+ tevent_req_nterror(req, status);
+ return;
+ }
+
+ status = dcerpc_pull_ncacn_packet(state->pkt,
+ &state->buffer,
+ state->pkt);
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+
+ tevent_req_done(req);
+}
+
+NTSTATUS dcerpc_read_ncacn_packet_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ struct ncacn_packet **pkt,
+ DATA_BLOB *buffer)
+{
+ struct dcerpc_read_ncacn_packet_state *state = tevent_req_data(req,
+ struct dcerpc_read_ncacn_packet_state);
+ NTSTATUS status;
+
+ if (tevent_req_is_nterror(req, &status)) {
+ tevent_req_received(req);
+ return status;
+ }
+
+ *pkt = talloc_move(mem_ctx, &state->pkt);
+ if (buffer) {
+ buffer->data = talloc_move(mem_ctx, &state->buffer.data);
+ buffer->length = state->buffer.length;
+ }
+
+ tevent_req_received(req);
+ return NT_STATUS_OK;
+}
+
+const char *dcerpc_default_transport_endpoint(TALLOC_CTX *mem_ctx,
+ enum dcerpc_transport_t transport,
+ const struct ndr_interface_table *table)
+{
+ NTSTATUS status;
+ const char *p = NULL;
+ const char *endpoint = NULL;
+ uint32_t i;
+ struct dcerpc_binding *default_binding = NULL;
+ TALLOC_CTX *frame = talloc_stackframe();
+
+ /* Find one of the default pipes for this interface */
+
+ for (i = 0; i < table->endpoints->count; i++) {
+ enum dcerpc_transport_t dtransport;
+ const char *dendpoint;
+
+ status = dcerpc_parse_binding(frame, table->endpoints->names[i],
+ &default_binding);
+ if (!NT_STATUS_IS_OK(status)) {
+ continue;
+ }
+
+ dtransport = dcerpc_binding_get_transport(default_binding);
+ dendpoint = dcerpc_binding_get_string_option(default_binding,
+ "endpoint");
+ if (dendpoint == NULL) {
+ TALLOC_FREE(default_binding);
+ continue;
+ }
+
+ if (transport == NCA_UNKNOWN) {
+ transport = dtransport;
+ }
+
+ if (transport != dtransport) {
+ TALLOC_FREE(default_binding);
+ continue;
+ }
+
+ p = dendpoint;
+ break;
+ }
+
+ if (p == NULL) {
+ goto done;
+ }
+
+ /*
+ * extract the pipe name without \\pipe from for example
+ * ncacn_np:[\\pipe\\epmapper]
+ */
+ if (transport == NCACN_NP) {
+ if (strncasecmp(p, "\\pipe\\", 6) == 0) {
+ p += 6;
+ }
+ if (strncmp(p, "\\", 1) == 0) {
+ p += 1;
+ }
+ }
+
+ endpoint = talloc_strdup(mem_ctx, p);
+
+ done:
+ talloc_free(frame);
+ return endpoint;
+}
+
+struct dcerpc_sec_vt_header2 dcerpc_sec_vt_header2_from_ncacn_packet(const struct ncacn_packet *pkt)
+{
+ struct dcerpc_sec_vt_header2 ret;
+
+ ZERO_STRUCT(ret);
+ ret.ptype = pkt->ptype;
+ memcpy(&ret.drep, pkt->drep, sizeof(ret.drep));
+ ret.call_id = pkt->call_id;
+
+ switch (pkt->ptype) {
+ case DCERPC_PKT_REQUEST:
+ ret.context_id = pkt->u.request.context_id;
+ ret.opnum = pkt->u.request.opnum;
+ break;
+
+ case DCERPC_PKT_RESPONSE:
+ ret.context_id = pkt->u.response.context_id;
+ break;
+
+ case DCERPC_PKT_FAULT:
+ ret.context_id = pkt->u.fault.context_id;
+ break;
+
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+bool dcerpc_sec_vt_header2_equal(const struct dcerpc_sec_vt_header2 *v1,
+ const struct dcerpc_sec_vt_header2 *v2)
+{
+ if (v1->ptype != v2->ptype) {
+ return false;
+ }
+
+ if (memcmp(v1->drep, v2->drep, sizeof(v1->drep)) != 0) {
+ return false;
+ }
+
+ if (v1->call_id != v2->call_id) {
+ return false;
+ }
+
+ if (v1->context_id != v2->context_id) {
+ return false;
+ }
+
+ if (v1->opnum != v2->opnum) {
+ return false;
+ }
+
+ return true;
+}
+
+static bool dcerpc_sec_vt_is_valid(const struct dcerpc_sec_verification_trailer *r)
+{
+ bool ret = false;
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct bitmap *commands_seen;
+ int i;
+
+ if (r->count.count == 0) {
+ ret = true;
+ goto done;
+ }
+
+ if (memcmp(r->magic, DCERPC_SEC_VT_MAGIC, sizeof(r->magic)) != 0) {
+ goto done;
+ }
+
+ commands_seen = bitmap_talloc(frame, DCERPC_SEC_VT_COMMAND_ENUM + 1);
+ if (commands_seen == NULL) {
+ goto done;
+ }
+
+ for (i=0; i < r->count.count; i++) {
+ enum dcerpc_sec_vt_command_enum cmd =
+ r->commands[i].command & DCERPC_SEC_VT_COMMAND_ENUM;
+
+ if (bitmap_query(commands_seen, cmd)) {
+ /* Each command must appear at most once. */
+ goto done;
+ }
+ bitmap_set(commands_seen, cmd);
+
+ switch (cmd) {
+ case DCERPC_SEC_VT_COMMAND_BITMASK1:
+ case DCERPC_SEC_VT_COMMAND_PCONTEXT:
+ case DCERPC_SEC_VT_COMMAND_HEADER2:
+ break;
+ default:
+ if ((r->commands[i].u._unknown.length % 4) != 0) {
+ goto done;
+ }
+ break;
+ }
+ }
+ ret = true;
+done:
+ TALLOC_FREE(frame);
+ return ret;
+}
+
+static bool dcerpc_sec_vt_bitmask_check(const uint32_t *bitmask1,
+ struct dcerpc_sec_vt *c)
+{
+ if (bitmask1 == NULL) {
+ if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
+ DEBUG(10, ("SEC_VT check Bitmask1 must_process_command "
+ "failed\n"));
+ return false;
+ }
+
+ return true;
+ }
+
+ if ((c->u.bitmask1 & DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING)
+ && (!(*bitmask1 & DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING))) {
+ DEBUG(10, ("SEC_VT check Bitmask1 client_header_signing "
+ "failed\n"));
+ return false;
+ }
+ return true;
+}
+
+static bool dcerpc_sec_vt_pctx_check(const struct dcerpc_sec_vt_pcontext *pcontext,
+ struct dcerpc_sec_vt *c)
+{
+ bool ok;
+
+ if (pcontext == NULL) {
+ if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
+ DEBUG(10, ("SEC_VT check Pcontext must_process_command "
+ "failed\n"));
+ return false;
+ }
+
+ return true;
+ }
+
+ ok = ndr_syntax_id_equal(&pcontext->abstract_syntax,
+ &c->u.pcontext.abstract_syntax);
+ if (!ok) {
+ struct ndr_syntax_id_buf buf1, buf2;
+ DEBUG(10, ("SEC_VT check pcontext abstract_syntax failed: "
+ "%s vs. %s\n",
+ ndr_syntax_id_buf_string(
+ &pcontext->abstract_syntax, &buf1),
+ ndr_syntax_id_buf_string(
+ &c->u.pcontext.abstract_syntax, &buf2)));
+ return false;
+ }
+ ok = ndr_syntax_id_equal(&pcontext->transfer_syntax,
+ &c->u.pcontext.transfer_syntax);
+ if (!ok) {
+ struct ndr_syntax_id_buf buf1, buf2;
+ DEBUG(10, ("SEC_VT check pcontext transfer_syntax failed: "
+ "%s vs. %s\n",
+ ndr_syntax_id_buf_string(
+ &pcontext->transfer_syntax, &buf1),
+ ndr_syntax_id_buf_string(
+ &c->u.pcontext.transfer_syntax, &buf2)));
+ return false;
+ }
+
+ return true;
+}
+
+static bool dcerpc_sec_vt_hdr2_check(const struct dcerpc_sec_vt_header2 *header2,
+ struct dcerpc_sec_vt *c)
+{
+ if (header2 == NULL) {
+ if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
+ DEBUG(10, ("SEC_VT check Header2 must_process_command failed\n"));
+ return false;
+ }
+
+ return true;
+ }
+
+ if (!dcerpc_sec_vt_header2_equal(header2, &c->u.header2)) {
+ DEBUG(10, ("SEC_VT check Header2 failed\n"));
+ return false;
+ }
+
+ return true;
+}
+
+bool dcerpc_sec_verification_trailer_check(
+ const struct dcerpc_sec_verification_trailer *vt,
+ const uint32_t *bitmask1,
+ const struct dcerpc_sec_vt_pcontext *pcontext,
+ const struct dcerpc_sec_vt_header2 *header2)
+{
+ size_t i;
+
+ if (!dcerpc_sec_vt_is_valid(vt)) {
+ return false;
+ }
+
+ for (i=0; i < vt->count.count; i++) {
+ bool ok;
+ struct dcerpc_sec_vt *c = &vt->commands[i];
+
+ switch (c->command & DCERPC_SEC_VT_COMMAND_ENUM) {
+ case DCERPC_SEC_VT_COMMAND_BITMASK1:
+ ok = dcerpc_sec_vt_bitmask_check(bitmask1, c);
+ if (!ok) {
+ return false;
+ }
+ break;
+
+ case DCERPC_SEC_VT_COMMAND_PCONTEXT:
+ ok = dcerpc_sec_vt_pctx_check(pcontext, c);
+ if (!ok) {
+ return false;
+ }
+ break;
+
+ case DCERPC_SEC_VT_COMMAND_HEADER2: {
+ ok = dcerpc_sec_vt_hdr2_check(header2, c);
+ if (!ok) {
+ return false;
+ }
+ break;
+ }
+
+ default:
+ if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
+ DEBUG(10, ("SEC_VT check Unknown must_process_command failed\n"));
+ return false;
+ }
+
+ break;
+ }
+ }
+
+ return true;
+}
+
+static const struct ndr_syntax_id dcerpc_bind_time_features_prefix = {
+ .uuid = {
+ .time_low = 0x6cb71c2c,
+ .time_mid = 0x9812,
+ .time_hi_and_version = 0x4540,
+ .clock_seq = {0x00, 0x00},
+ .node = {0x00,0x00,0x00,0x00,0x00,0x00}
+ },
+ .if_version = 1,
+};
+
+bool dcerpc_extract_bind_time_features(struct ndr_syntax_id s, uint64_t *_features)
+{
+ uint8_t values[8];
+ uint64_t features = 0;
+
+ values[0] = s.uuid.clock_seq[0];
+ values[1] = s.uuid.clock_seq[1];
+ values[2] = s.uuid.node[0];
+ values[3] = s.uuid.node[1];
+ values[4] = s.uuid.node[2];
+ values[5] = s.uuid.node[3];
+ values[6] = s.uuid.node[4];
+ values[7] = s.uuid.node[5];
+
+ ZERO_STRUCT(s.uuid.clock_seq);
+ ZERO_STRUCT(s.uuid.node);
+
+ if (!ndr_syntax_id_equal(&s, &dcerpc_bind_time_features_prefix)) {
+ if (_features != NULL) {
+ *_features = 0;
+ }
+ return false;
+ }
+
+ features = BVAL(values, 0);
+
+ if (_features != NULL) {
+ *_features = features;
+ }
+
+ return true;
+}
+
+struct ndr_syntax_id dcerpc_construct_bind_time_features(uint64_t features)
+{
+ struct ndr_syntax_id s = dcerpc_bind_time_features_prefix;
+ uint8_t values[8];
+
+ SBVAL(values, 0, features);
+
+ s.uuid.clock_seq[0] = values[0];
+ s.uuid.clock_seq[1] = values[1];
+ s.uuid.node[0] = values[2];
+ s.uuid.node[1] = values[3];
+ s.uuid.node[2] = values[4];
+ s.uuid.node[3] = values[5];
+ s.uuid.node[4] = values[6];
+ s.uuid.node[5] = values[7];
+
+ return s;
+}
+
+NTSTATUS dcerpc_generic_session_key(DATA_BLOB *session_key)
+{
+ *session_key = data_blob_null;
+
+ /* this took quite a few CPU cycles to find ... */
+ session_key->data = discard_const_p(unsigned char, "SystemLibraryDTC");
+ session_key->length = 16;
+ return NT_STATUS_OK;
+}
+
+/*
+ push a ncacn_packet into a blob, potentially with auth info
+*/
+NTSTATUS dcerpc_ncacn_push_auth(DATA_BLOB *blob,
+ TALLOC_CTX *mem_ctx,
+ struct ncacn_packet *pkt,
+ struct dcerpc_auth *auth_info)
+{
+ struct ndr_push *ndr;
+ enum ndr_err_code ndr_err;
+
+ ndr = ndr_push_init_ctx(mem_ctx);
+ if (!ndr) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if (auth_info) {
+ pkt->auth_length = auth_info->credentials.length;
+ } else {
+ pkt->auth_length = 0;
+ }
+
+ ndr_err = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ if (auth_info) {
+#if 0
+ /* the s3 rpc server doesn't handle auth padding in
+ bind requests. Use zero auth padding to keep us
+ working with old servers */
+ uint32_t offset = ndr->offset;
+ ndr_err = ndr_push_align(ndr, 16);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+ auth_info->auth_pad_length = ndr->offset - offset;
+#else
+ auth_info->auth_pad_length = 0;
+#endif
+ ndr_err = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth_info);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+ }
+
+ *blob = ndr_push_blob(ndr);
+
+ /* fill in the frag length */
+ dcerpc_set_frag_length(blob, blob->length);
+
+ return NT_STATUS_OK;
+}
+
+/*
+ log a rpc packet in a format suitable for ndrdump. This is especially useful
+ for sealed packets, where ethereal cannot easily see the contents
+
+ this triggers if "dcesrv:stubs directory" is set and present
+ for all packets that fail to parse
+*/
+void dcerpc_log_packet(const char *packet_log_dir,
+ const char *interface_name,
+ uint32_t opnum, uint32_t flags,
+ const DATA_BLOB *pkt,
+ const char *why)
+{
+ const int num_examples = 20;
+ int i;
+
+ if (packet_log_dir == NULL) {
+ return;
+ }
+
+ for (i=0;i<num_examples;i++) {
+ char *name=NULL;
+ int ret;
+ bool saved;
+ ret = asprintf(&name, "%s/%s-%u.%d.%s.%s",
+ packet_log_dir, interface_name, opnum, i,
+ (flags&NDR_IN)?"in":"out",
+ why);
+ if (ret == -1) {
+ return;
+ }
+
+ saved = file_save(name, pkt->data, pkt->length);
+ if (saved) {
+ DBG_DEBUG("Logged rpc packet to %s\n", name);
+ free(name);
+ break;
+ }
+ free(name);
+ }
+}
diff --git a/librpc/rpc/dcerpc_util.h b/librpc/rpc/dcerpc_util.h
new file mode 100644
index 0000000..a9bc7bd
--- /dev/null
+++ b/librpc/rpc/dcerpc_util.h
@@ -0,0 +1,85 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Copyright (C) Stefan Metzmacher 2010-2011
+ Copyright (C) Andrew Tridgell 2010-2011
+ Copyright (C) Simo Sorce 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __LIBRPC_RPC_DCERPC_UTIL_H__
+#define __LIBRPC_RPC_DCERPC_UTIL_H__
+
+#include "replace.h"
+#include <talloc.h>
+#include "lib/util/data_blob.h"
+#include "librpc/rpc/rpc_common.h"
+#include "librpc/gen_ndr/dcerpc.h"
+
+void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v);
+uint16_t dcerpc_get_frag_length(const DATA_BLOB *blob);
+void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v);
+uint16_t dcerpc_get_auth_length(const DATA_BLOB *blob);
+uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
+uint8_t dcerpc_get_auth_type(const DATA_BLOB *blob);
+uint8_t dcerpc_get_auth_level(const DATA_BLOB *blob);
+uint32_t dcerpc_get_auth_context_id(const DATA_BLOB *blob);
+const char *dcerpc_default_transport_endpoint(TALLOC_CTX *mem_ctx,
+ enum dcerpc_transport_t transport,
+ const struct ndr_interface_table *table);
+
+NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *blob,
+ struct ncacn_packet *r);
+
+/**
+* @brief Pull a dcerpc_auth structure, taking account of any auth
+* padding in the blob. For request/response packets we pass
+* the whole data blob, so auth_data_only must be set to false
+* as the blob contains data+pad+auth and no just pad+auth.
+*
+* @param pkt - The ncacn_packet strcuture
+* @param mem_ctx - The mem_ctx used to allocate dcerpc_auth elements
+* @param pkt_trailer - The packet trailer data, usually the trailing
+* auth_info blob, but in the request/response case
+* this is the stub_and_verifier blob.
+* @param auth - A preallocated dcerpc_auth *empty* structure
+* @param auth_length - The length of the auth trail, sum of auth header
+* lenght and pkt->auth_length
+* @param auth_data_only - Whether the pkt_trailer includes only the auth_blob
+* (+ padding) or also other data.
+*
+* @return - A NTSTATUS error code.
+*/
+NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
+ TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *pkt_trailer,
+ struct dcerpc_auth *auth,
+ uint32_t *auth_length,
+ bool auth_data_only);
+NTSTATUS dcerpc_verify_ncacn_packet_header(const struct ncacn_packet *pkt,
+ enum dcerpc_pkt_type ptype,
+ size_t max_auth_info,
+ uint8_t required_flags,
+ uint8_t optional_flags);
+struct tevent_req *dcerpc_read_ncacn_packet_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tstream_context *stream);
+NTSTATUS dcerpc_read_ncacn_packet_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ struct ncacn_packet **pkt,
+ DATA_BLOB *buffer);
+
+#endif
diff --git a/librpc/rpc/dcesrv_auth.c b/librpc/rpc/dcesrv_auth.c
new file mode 100644
index 0000000..99d8e01
--- /dev/null
+++ b/librpc/rpc/dcesrv_auth.c
@@ -0,0 +1,703 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ server side dcerpc authentication code
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/rpc/dcesrv_core.h"
+#include "librpc/rpc/dcesrv_core_proto.h"
+#include "librpc/rpc/dcerpc_util.h"
+#include "librpc/rpc/dcerpc_pkt_auth.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "auth/credentials/credentials.h"
+#include "auth/gensec/gensec.h"
+#include "auth/auth.h"
+#include "param/param.h"
+
+static NTSTATUS dcesrv_auth_negotiate_hdr_signing(struct dcesrv_call_state *call,
+ struct ncacn_packet *pkt)
+{
+ struct dcesrv_connection *dce_conn = call->conn;
+ struct dcesrv_auth *a = NULL;
+
+ if (!(call->pkt.pfc_flags & DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN)) {
+ return NT_STATUS_OK;
+ }
+
+ if (dce_conn->client_hdr_signing) {
+ if (dce_conn->negotiated_hdr_signing && pkt != NULL) {
+ pkt->pfc_flags |= DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN;
+ }
+ return NT_STATUS_OK;
+ }
+
+ dce_conn->client_hdr_signing = true;
+ dce_conn->negotiated_hdr_signing = dce_conn->support_hdr_signing;
+
+ if (!dce_conn->negotiated_hdr_signing) {
+ return NT_STATUS_OK;
+ }
+
+ if (pkt != NULL) {
+ pkt->pfc_flags |= DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN;
+ }
+
+ a = call->conn->default_auth_state;
+ if (a->gensec_security != NULL) {
+ gensec_want_feature(a->gensec_security,
+ GENSEC_FEATURE_SIGN_PKT_HEADER);
+ }
+
+ for (a = call->conn->auth_states; a != NULL; a = a->next) {
+ if (a->gensec_security == NULL) {
+ continue;
+ }
+
+ gensec_want_feature(a->gensec_security,
+ GENSEC_FEATURE_SIGN_PKT_HEADER);
+ }
+
+ return NT_STATUS_OK;
+}
+
+static bool dcesrv_auth_prepare_gensec(struct dcesrv_call_state *call)
+{
+ struct dcesrv_connection *dce_conn = call->conn;
+ struct dcesrv_auth *auth = call->auth_state;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ NTSTATUS status;
+
+ if (auth->auth_started) {
+ return false;
+ }
+
+ auth->auth_started = true;
+
+ if (auth->auth_invalid) {
+ return false;
+ }
+
+ if (auth->auth_finished) {
+ return false;
+ }
+
+ if (auth->gensec_security != NULL) {
+ return false;
+ }
+
+ switch (call->in_auth_info.auth_level) {
+ case DCERPC_AUTH_LEVEL_CONNECT:
+ case DCERPC_AUTH_LEVEL_CALL:
+ case DCERPC_AUTH_LEVEL_PACKET:
+ case DCERPC_AUTH_LEVEL_INTEGRITY:
+ case DCERPC_AUTH_LEVEL_PRIVACY:
+ /*
+ * We evaluate auth_type only if auth_level was valid
+ */
+ break;
+ default:
+ /*
+ * Setting DCERPC_AUTH_LEVEL_NONE,
+ * gives the caller the reject_reason
+ * as auth_context_id.
+ *
+ * Note: DCERPC_AUTH_LEVEL_NONE == 1
+ */
+ auth->auth_type = DCERPC_AUTH_TYPE_NONE;
+ auth->auth_level = DCERPC_AUTH_LEVEL_NONE;
+ auth->auth_context_id = DCERPC_BIND_NAK_REASON_NOT_SPECIFIED;
+ return false;
+ }
+
+ auth->auth_type = call->in_auth_info.auth_type;
+ auth->auth_level = call->in_auth_info.auth_level;
+ auth->auth_context_id = call->in_auth_info.auth_context_id;
+
+ cb->auth.become_root();
+ status = cb->auth.gensec_prepare(
+ auth,
+ call,
+ &auth->gensec_security,
+ cb->auth.private_data);
+ cb->auth.unbecome_root();
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to call samba_server_gensec_start %s\n",
+ nt_errstr(status)));
+ return false;
+ }
+
+ /*
+ * We have to call this because we set the target_service for
+ * Kerberos to NULL above, and in any case we wish to log a
+ * more specific service target.
+ *
+ */
+ status = gensec_set_target_service_description(auth->gensec_security,
+ "DCE/RPC");
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to call gensec_set_target_service_description %s\n",
+ nt_errstr(status)));
+ return false;
+ }
+
+ if (call->conn->remote_address != NULL) {
+ status = gensec_set_remote_address(auth->gensec_security,
+ call->conn->remote_address);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to call gensec_set_remote_address() %s\n",
+ nt_errstr(status)));
+ return false;
+ }
+ }
+
+ if (call->conn->local_address != NULL) {
+ status = gensec_set_local_address(auth->gensec_security,
+ call->conn->local_address);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to call gensec_set_local_address() %s\n",
+ nt_errstr(status)));
+ return false;
+ }
+ }
+
+ status = gensec_start_mech_by_authtype(auth->gensec_security, auth->auth_type,
+ auth->auth_level);
+ if (!NT_STATUS_IS_OK(status)) {
+ const char *backend_name =
+ gensec_get_name_by_authtype(auth->gensec_security,
+ auth->auth_type);
+
+ DEBUG(3, ("Failed to start GENSEC mechanism for DCERPC server: "
+ "auth_type=%d (%s), auth_level=%d: %s\n",
+ (int)auth->auth_type, backend_name,
+ (int)auth->auth_level,
+ nt_errstr(status)));
+
+ /*
+ * Setting DCERPC_AUTH_LEVEL_NONE,
+ * gives the caller the reject_reason
+ * as auth_context_id.
+ *
+ * Note: DCERPC_AUTH_LEVEL_NONE == 1
+ */
+ auth->auth_type = DCERPC_AUTH_TYPE_NONE;
+ auth->auth_level = DCERPC_AUTH_LEVEL_NONE;
+ if (backend_name != NULL) {
+ auth->auth_context_id =
+ DCERPC_BIND_NAK_REASON_INVALID_CHECKSUM;
+ } else {
+ auth->auth_context_id =
+ DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE;
+ }
+ return false;
+ }
+
+ if (dce_conn->negotiated_hdr_signing) {
+ gensec_want_feature(auth->gensec_security,
+ GENSEC_FEATURE_SIGN_PKT_HEADER);
+ }
+
+ return true;
+}
+
+static void dcesrv_default_auth_state_finish_bind(struct dcesrv_call_state *call)
+{
+ SMB_ASSERT(call->pkt.ptype == DCERPC_PKT_BIND);
+
+ if (call->auth_state == call->conn->default_auth_state) {
+ return;
+ }
+
+ if (call->conn->default_auth_state->auth_started) {
+ return;
+ }
+
+ if (call->conn->default_auth_state->auth_invalid) {
+ return;
+ }
+
+ call->conn->default_auth_state->auth_type = DCERPC_AUTH_TYPE_NONE;
+ call->conn->default_auth_state->auth_level = DCERPC_AUTH_LEVEL_NONE;
+ call->conn->default_auth_state->auth_context_id = 0;
+ call->conn->default_auth_state->auth_started = true;
+ call->conn->default_auth_state->auth_finished = true;
+
+ /*
+ *
+ * We defer log_successful_dcesrv_authz_event()
+ * to dcesrv_default_auth_state_prepare_request()
+ *
+ * As we don't want to trigger authz_events
+ * just for alter_context requests without authentication
+ */
+}
+
+void dcesrv_default_auth_state_prepare_request(struct dcesrv_call_state *call)
+{
+ struct dcesrv_connection *dce_conn = call->conn;
+ struct dcesrv_auth *auth = call->auth_state;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+
+ if (auth->auth_audited) {
+ return;
+ }
+
+ if (call->pkt.ptype != DCERPC_PKT_REQUEST) {
+ return;
+ }
+
+ if (auth != dce_conn->default_auth_state) {
+ return;
+ }
+
+ if (auth->auth_invalid) {
+ return;
+ }
+
+ if (!auth->auth_finished) {
+ return;
+ }
+
+ if (cb->log.successful_authz == NULL) {
+ return;
+ }
+
+ cb->log.successful_authz(call, cb->log.private_data);
+}
+
+/*
+ parse any auth information from a dcerpc bind request
+ return false if we can't handle the auth request for some
+ reason (in which case we send a bind_nak)
+*/
+bool dcesrv_auth_bind(struct dcesrv_call_state *call)
+{
+ struct ncacn_packet *pkt = &call->pkt;
+ struct dcesrv_auth *auth = call->auth_state;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ NTSTATUS status;
+
+ if (pkt->auth_length == 0) {
+ auth->auth_type = DCERPC_AUTH_TYPE_NONE;
+ auth->auth_level = DCERPC_AUTH_LEVEL_NONE;
+ auth->auth_context_id = 0;
+ auth->auth_started = true;
+
+ if (cb->log.successful_authz != NULL) {
+ cb->log.successful_authz(call, cb->log.private_data);
+ }
+
+ return true;
+ }
+
+ status = dcerpc_pull_auth_trailer(pkt, call, &pkt->u.bind.auth_info,
+ &call->in_auth_info,
+ NULL, true);
+ if (!NT_STATUS_IS_OK(status)) {
+ /*
+ * Setting DCERPC_AUTH_LEVEL_NONE,
+ * gives the caller the reject_reason
+ * as auth_context_id.
+ *
+ * Note: DCERPC_AUTH_LEVEL_NONE == 1
+ */
+ auth->auth_type = DCERPC_AUTH_TYPE_NONE;
+ auth->auth_level = DCERPC_AUTH_LEVEL_NONE;
+ auth->auth_context_id =
+ DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED;
+ return false;
+ }
+
+ return dcesrv_auth_prepare_gensec(call);
+}
+
+NTSTATUS dcesrv_auth_complete(struct dcesrv_call_state *call, NTSTATUS status)
+{
+ struct dcesrv_auth *auth = call->auth_state;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ const char *pdu = "<unknown>";
+
+ switch (call->pkt.ptype) {
+ case DCERPC_PKT_BIND:
+ pdu = "BIND";
+ break;
+ case DCERPC_PKT_ALTER:
+ pdu = "ALTER";
+ break;
+ case DCERPC_PKT_AUTH3:
+ pdu = "AUTH3";
+ if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+ DEBUG(4, ("GENSEC not finished at at %s\n", pdu));
+ return NT_STATUS_RPC_SEC_PKG_ERROR;
+ }
+ break;
+ default:
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+ return NT_STATUS_OK;
+ }
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(4, ("GENSEC mech rejected the incoming authentication "
+ "at %s: %s\n", pdu, nt_errstr(status)));
+ return status;
+ }
+
+ cb->auth.become_root();
+ status = gensec_session_info(auth->gensec_security,
+ auth,
+ &auth->session_info);
+ cb->auth.unbecome_root();
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to establish session_info: %s\n",
+ nt_errstr(status)));
+ return status;
+ }
+ auth->auth_finished = true;
+
+ if (auth->auth_level == DCERPC_AUTH_LEVEL_CONNECT &&
+ !call->conn->got_explicit_auth_level_connect)
+ {
+ call->conn->default_auth_level_connect = auth;
+ }
+
+ if (call->pkt.ptype != DCERPC_PKT_AUTH3) {
+ return NT_STATUS_OK;
+ }
+
+ if (call->out_auth_info->credentials.length != 0) {
+ DEBUG(4, ("GENSEC produced output token (len=%zu) at %s\n",
+ call->out_auth_info->credentials.length, pdu));
+ return NT_STATUS_RPC_SEC_PKG_ERROR;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/*
+ add any auth information needed in a bind ack, and process the authentication
+ information found in the bind.
+*/
+NTSTATUS dcesrv_auth_prepare_bind_ack(struct dcesrv_call_state *call, struct ncacn_packet *pkt)
+{
+ struct dcesrv_connection *dce_conn = call->conn;
+ struct dcesrv_auth *auth = call->auth_state;
+ NTSTATUS status;
+
+ status = dcesrv_auth_negotiate_hdr_signing(call, pkt);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ dce_conn->allow_alter = true;
+ dcesrv_default_auth_state_finish_bind(call);
+
+ if (call->pkt.auth_length == 0) {
+ auth->auth_finished = true;
+ return NT_STATUS_OK;
+ }
+
+ /* We can't work without an existing gensec state */
+ if (auth->gensec_security == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ call->_out_auth_info = (struct dcerpc_auth) {
+ .auth_type = auth->auth_type,
+ .auth_level = auth->auth_level,
+ .auth_context_id = auth->auth_context_id,
+ };
+ call->out_auth_info = &call->_out_auth_info;
+
+ return NT_STATUS_OK;
+}
+
+/*
+ process the final stage of a auth request
+*/
+bool dcesrv_auth_prepare_auth3(struct dcesrv_call_state *call)
+{
+ struct ncacn_packet *pkt = &call->pkt;
+ struct dcesrv_auth *auth = call->auth_state;
+ NTSTATUS status;
+
+ if (pkt->auth_length == 0) {
+ return false;
+ }
+
+ if (auth->auth_finished) {
+ return false;
+ }
+
+ if (auth->auth_invalid) {
+ return false;
+ }
+
+ /* We can't work without an existing gensec state */
+ if (auth->gensec_security == NULL) {
+ return false;
+ }
+
+ status = dcerpc_pull_auth_trailer(pkt, call, &pkt->u.auth3.auth_info,
+ &call->in_auth_info, NULL, true);
+ if (!NT_STATUS_IS_OK(status)) {
+ /*
+ * Windows returns DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY
+ * instead of DCERPC_NCA_S_PROTO_ERROR.
+ */
+ call->fault_code = DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY;
+ return false;
+ }
+
+ if (call->in_auth_info.auth_type != auth->auth_type) {
+ return false;
+ }
+
+ if (call->in_auth_info.auth_level != auth->auth_level) {
+ return false;
+ }
+
+ if (call->in_auth_info.auth_context_id != auth->auth_context_id) {
+ return false;
+ }
+
+ call->_out_auth_info = (struct dcerpc_auth) {
+ .auth_type = auth->auth_type,
+ .auth_level = auth->auth_level,
+ .auth_context_id = auth->auth_context_id,
+ };
+ call->out_auth_info = &call->_out_auth_info;
+
+ return true;
+}
+
+/*
+ parse any auth information from a dcerpc alter request
+ return false if we can't handle the auth request for some
+ reason (in which case we send a bind_nak (is this true for here?))
+*/
+bool dcesrv_auth_alter(struct dcesrv_call_state *call)
+{
+ struct ncacn_packet *pkt = &call->pkt;
+ struct dcesrv_auth *auth = call->auth_state;
+ NTSTATUS status;
+
+ /* on a pure interface change there is no auth blob */
+ if (pkt->auth_length == 0) {
+ if (!auth->auth_finished) {
+ return false;
+ }
+ return true;
+ }
+
+ if (auth->auth_finished) {
+ call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
+ return false;
+ }
+
+ status = dcerpc_pull_auth_trailer(pkt, call, &pkt->u.alter.auth_info,
+ &call->in_auth_info, NULL, true);
+ if (!NT_STATUS_IS_OK(status)) {
+ call->fault_code = DCERPC_NCA_S_PROTO_ERROR;
+ return false;
+ }
+
+ if (!auth->auth_started) {
+ bool ok;
+
+ ok = dcesrv_auth_prepare_gensec(call);
+ if (!ok) {
+ call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
+ return false;
+ }
+
+ return true;
+ }
+
+ if (call->in_auth_info.auth_type == DCERPC_AUTH_TYPE_NONE) {
+ call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
+ return false;
+ }
+
+ if (auth->auth_invalid) {
+ return false;
+ }
+
+ if (call->in_auth_info.auth_type != auth->auth_type) {
+ return false;
+ }
+
+ if (call->in_auth_info.auth_level != auth->auth_level) {
+ return false;
+ }
+
+ if (call->in_auth_info.auth_context_id != auth->auth_context_id) {
+ return false;
+ }
+
+ return true;
+}
+
+/*
+ add any auth information needed in a alter ack, and process the authentication
+ information found in the alter.
+*/
+NTSTATUS dcesrv_auth_prepare_alter_ack(struct dcesrv_call_state *call, struct ncacn_packet *pkt)
+{
+ struct dcesrv_auth *auth = call->auth_state;
+ NTSTATUS status;
+
+ status = dcesrv_auth_negotiate_hdr_signing(call, pkt);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ /* on a pure interface change there is no auth_info structure
+ setup */
+ if (call->pkt.auth_length == 0) {
+ return NT_STATUS_OK;
+ }
+
+ if (auth->gensec_security == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ call->_out_auth_info = (struct dcerpc_auth) {
+ .auth_type = auth->auth_type,
+ .auth_level = auth->auth_level,
+ .auth_context_id = auth->auth_context_id,
+ };
+ call->out_auth_info = &call->_out_auth_info;
+
+ return NT_STATUS_OK;
+}
+
+/*
+ check credentials on a packet
+*/
+bool dcesrv_auth_pkt_pull(struct dcesrv_call_state *call,
+ DATA_BLOB *full_packet,
+ uint8_t required_flags,
+ uint8_t optional_flags,
+ uint8_t payload_offset,
+ DATA_BLOB *payload_and_verifier)
+{
+ struct ncacn_packet *pkt = &call->pkt;
+ struct dcesrv_auth *auth = call->auth_state;
+ const struct dcerpc_auth tmp_auth = {
+ .auth_type = auth->auth_type,
+ .auth_level = auth->auth_level,
+ .auth_context_id = auth->auth_context_id,
+ };
+ bool check_pkt_auth_fields;
+ NTSTATUS status;
+
+ if (!auth->auth_started) {
+ return false;
+ }
+
+ if (!auth->auth_finished) {
+ call->fault_code = DCERPC_NCA_S_PROTO_ERROR;
+ return false;
+ }
+
+ if (auth->auth_invalid) {
+ return false;
+ }
+
+ if (call->pkt.pfc_flags & DCERPC_PFC_FLAG_FIRST) {
+ /*
+ * The caller most likely checked this
+ * already, but we better double check.
+ */
+ check_pkt_auth_fields = true;
+ } else {
+ /*
+ * The caller already found first fragment
+ * and is passing the auth_state of it.
+ * A server is supposed to use the
+ * setting of the first fragment and
+ * completely ignore the values
+ * on the remaining fragments
+ */
+ check_pkt_auth_fields = false;
+ }
+
+ status = dcerpc_ncacn_pull_pkt_auth(&tmp_auth,
+ auth->gensec_security,
+ check_pkt_auth_fields,
+ call,
+ pkt->ptype,
+ required_flags,
+ optional_flags,
+ payload_offset,
+ payload_and_verifier,
+ full_packet,
+ pkt);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTOCOL_ERROR)) {
+ call->fault_code = DCERPC_NCA_S_PROTO_ERROR;
+ return false;
+ }
+ if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_UNSUPPORTED_AUTHN_LEVEL)) {
+ call->fault_code = DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL;
+ return false;
+ }
+ if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_SEC_PKG_ERROR)) {
+ call->fault_code = DCERPC_FAULT_SEC_PKG_ERROR;
+ return false;
+ }
+ if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+ call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
+ return false;
+ }
+ if (!NT_STATUS_IS_OK(status)) {
+ return false;
+ }
+
+ return true;
+}
+
+/*
+ push a signed or sealed dcerpc request packet into a blob
+*/
+bool dcesrv_auth_pkt_push(struct dcesrv_call_state *call,
+ DATA_BLOB *blob, size_t sig_size,
+ uint8_t payload_offset,
+ const DATA_BLOB *payload,
+ const struct ncacn_packet *pkt)
+{
+ struct dcesrv_auth *auth = call->auth_state;
+ const struct dcerpc_auth tmp_auth = {
+ .auth_type = auth->auth_type,
+ .auth_level = auth->auth_level,
+ .auth_context_id = auth->auth_context_id,
+ };
+ NTSTATUS status;
+
+ status = dcerpc_ncacn_push_pkt_auth(&tmp_auth,
+ auth->gensec_security,
+ call, blob, sig_size,
+ payload_offset,
+ payload,
+ pkt);
+ return NT_STATUS_IS_OK(status);
+}
diff --git a/librpc/rpc/dcesrv_core.c b/librpc/rpc/dcesrv_core.c
new file mode 100644
index 0000000..ead37c2
--- /dev/null
+++ b/librpc/rpc/dcesrv_core.c
@@ -0,0 +1,3160 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ server side dcerpc core code
+
+ Copyright (C) Andrew Tridgell 2003-2005
+ Copyright (C) Stefan (metze) Metzmacher 2004-2005
+ Copyright (C) Samuel Cabrero <scabrero@samba.org> 2019
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/rpc/dcesrv_core.h"
+#include "librpc/rpc/dcesrv_core_proto.h"
+#include "librpc/rpc/dcerpc_util.h"
+#include "librpc/gen_ndr/auth.h"
+#include "auth/gensec/gensec.h"
+#include "lib/util/dlinklist.h"
+#include "libcli/security/security.h"
+#include "param/param.h"
+#include "lib/tsocket/tsocket.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "lib/util/tevent_ntstatus.h"
+#include "system/network.h"
+#include "nsswitch/winbind_client.h"
+
+/**
+ * @file
+ * @brief DCERPC server
+ */
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_RPC_SRV
+
+#undef strcasecmp
+
+static NTSTATUS dcesrv_negotiate_contexts(struct dcesrv_call_state *call,
+ const struct dcerpc_bind *b,
+ struct dcerpc_ack_ctx *ack_ctx_list);
+
+/*
+ see if two endpoints match
+*/
+static bool endpoints_match(const struct dcerpc_binding *ep1,
+ const struct dcerpc_binding *ep2)
+{
+ enum dcerpc_transport_t t1;
+ enum dcerpc_transport_t t2;
+ const char *e1;
+ const char *e2;
+
+ t1 = dcerpc_binding_get_transport(ep1);
+ t2 = dcerpc_binding_get_transport(ep2);
+
+ e1 = dcerpc_binding_get_string_option(ep1, "endpoint");
+ e2 = dcerpc_binding_get_string_option(ep2, "endpoint");
+
+ if (t1 != t2) {
+ return false;
+ }
+
+ if (!e1 || !e2) {
+ return e1 == e2;
+ }
+
+ if (strcasecmp(e1, e2) != 0) {
+ return false;
+ }
+
+ return true;
+}
+
+/*
+ find an endpoint in the dcesrv_context
+*/
+_PUBLIC_ NTSTATUS dcesrv_find_endpoint(struct dcesrv_context *dce_ctx,
+ const struct dcerpc_binding *ep_description,
+ struct dcesrv_endpoint **_out)
+{
+ struct dcesrv_endpoint *ep = NULL;
+ for (ep=dce_ctx->endpoint_list; ep; ep=ep->next) {
+ if (endpoints_match(ep->ep_description, ep_description)) {
+ *_out = ep;
+ return NT_STATUS_OK;
+ }
+ }
+ return NT_STATUS_NOT_FOUND;
+}
+
+/*
+ find a registered context_id from a bind or alter_context
+*/
+static struct dcesrv_connection_context *dcesrv_find_context(struct dcesrv_connection *conn,
+ uint16_t context_id)
+{
+ struct dcesrv_connection_context *c;
+ for (c=conn->contexts;c;c=c->next) {
+ if (c->context_id == context_id) return c;
+ }
+ return NULL;
+}
+
+/*
+ find the interface operations on any endpoint with this binding
+*/
+static const struct dcesrv_interface *find_interface_by_binding(struct dcesrv_context *dce_ctx,
+ struct dcerpc_binding *binding,
+ const struct dcesrv_interface *iface)
+{
+ struct dcesrv_endpoint *ep;
+ for (ep=dce_ctx->endpoint_list; ep; ep=ep->next) {
+ if (endpoints_match(ep->ep_description, binding)) {
+ const struct dcesrv_interface *ret = NULL;
+
+ ret = find_interface_by_syntax_id(
+ ep, &iface->syntax_id);
+ if (ret != NULL) {
+ return ret;
+ }
+ }
+ }
+ return NULL;
+}
+
+/*
+ find the interface operations on an endpoint by uuid
+*/
+_PUBLIC_ const struct dcesrv_interface *find_interface_by_syntax_id(
+ const struct dcesrv_endpoint *endpoint,
+ const struct ndr_syntax_id *interface)
+{
+ struct dcesrv_if_list *ifl;
+ for (ifl=endpoint->interface_list; ifl; ifl=ifl->next) {
+ if (ndr_syntax_id_equal(&ifl->iface->syntax_id, interface)) {
+ return ifl->iface;
+ }
+ }
+ return NULL;
+}
+
+/*
+ find the earlier parts of a fragmented call awaiting reassembly
+*/
+static struct dcesrv_call_state *dcesrv_find_fragmented_call(struct dcesrv_connection *dce_conn, uint32_t call_id)
+{
+ struct dcesrv_call_state *c;
+ for (c=dce_conn->incoming_fragmented_call_list;c;c=c->next) {
+ if (c->pkt.call_id == call_id) {
+ return c;
+ }
+ }
+ return NULL;
+}
+
+/*
+ register an interface on an endpoint
+
+ An endpoint is one unix domain socket (for ncalrpc), one TCP port
+ (for ncacn_ip_tcp) or one (forwarded) named pipe (for ncacn_np).
+
+ Each endpoint can have many interfaces such as netlogon, lsa or
+ samr. Some have essentially the full set.
+
+ This is driven from the set of interfaces listed in each IDL file
+ via the PIDL generated *__op_init_server() functions.
+*/
+_PUBLIC_ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx,
+ const char *ep_name,
+ const char *ncacn_np_secondary_endpoint,
+ const struct dcesrv_interface *iface,
+ const struct security_descriptor *sd)
+{
+ struct dcerpc_binding *binding = NULL;
+ struct dcerpc_binding *binding2 = NULL;
+ NTSTATUS ret;
+
+ ret = dcerpc_parse_binding(dce_ctx, ep_name, &binding);
+ if (NT_STATUS_IS_ERR(ret)) {
+ DBG_ERR("Trouble parsing binding string '%s'\n", ep_name);
+ goto out;
+ }
+
+ if (ncacn_np_secondary_endpoint != NULL) {
+ ret = dcerpc_parse_binding(dce_ctx,
+ ncacn_np_secondary_endpoint,
+ &binding2);
+ if (NT_STATUS_IS_ERR(ret)) {
+ DBG_ERR("Trouble parsing 2nd binding string '%s'\n",
+ ncacn_np_secondary_endpoint);
+ goto out;
+ }
+ }
+
+ ret = dcesrv_interface_register_b(dce_ctx,
+ binding,
+ binding2,
+ iface,
+ sd);
+out:
+ TALLOC_FREE(binding);
+ TALLOC_FREE(binding2);
+ return ret;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_interface_register_b(struct dcesrv_context *dce_ctx,
+ struct dcerpc_binding *binding,
+ struct dcerpc_binding *binding2,
+ const struct dcesrv_interface *iface,
+ const struct security_descriptor *sd)
+{
+ struct dcesrv_endpoint *ep;
+ struct dcesrv_if_list *ifl;
+ bool add_ep = false;
+ NTSTATUS status;
+ enum dcerpc_transport_t transport;
+ char *ep_string = NULL;
+ bool use_single_process = true;
+ const char *ep_process_string;
+
+ /*
+ * If we are not using handles, there is no need for force
+ * this service into using a single process.
+ *
+ * However, due to the way we listen for RPC packets, we can
+ * only do this if we have a single service per pipe or TCP
+ * port, so we still force a single combined process for
+ * ncalrpc.
+ */
+ if (iface->flags & DCESRV_INTERFACE_FLAGS_HANDLES_NOT_USED) {
+ use_single_process = false;
+ }
+
+ transport = dcerpc_binding_get_transport(binding);
+ if (transport == NCACN_IP_TCP) {
+ int port;
+
+ /*
+ * First check if there is already a port specified, eg
+ * for epmapper on ncacn_ip_tcp:[135]
+ */
+ const char *endpoint
+ = dcerpc_binding_get_string_option(binding,
+ "endpoint");
+ if (endpoint == NULL) {
+ port = lpcfg_parm_int(dce_ctx->lp_ctx, NULL,
+ "rpc server port", iface->name, 0);
+
+ /*
+ * For RPC services that are not set to use a single
+ * process, we do not default to using the 'rpc server
+ * port' because that would cause a double-bind on
+ * that port.
+ */
+ if (port == 0 && !use_single_process) {
+ port = lpcfg_rpc_server_port(dce_ctx->lp_ctx);
+ }
+ if (port != 0) {
+ char port_str[6];
+ snprintf(port_str, sizeof(port_str), "%u", port);
+ status = dcerpc_binding_set_string_option(binding,
+ "endpoint",
+ port_str);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+ }
+ }
+
+ if (transport == NCACN_NP && binding2 != NULL) {
+ enum dcerpc_transport_t transport2;
+
+ transport2 = dcerpc_binding_get_transport(binding2);
+ SMB_ASSERT(transport2 == transport);
+ }
+
+ /* see if the interface is already registered on the endpoint */
+ if (find_interface_by_binding(dce_ctx, binding, iface)!=NULL) {
+ char *binding_string = dcerpc_binding_string(dce_ctx, binding);
+ DBG_ERR("Interface '%s' already registered on endpoint '%s'\n",
+ iface->name, binding_string);
+ TALLOC_FREE(binding_string);
+ return NT_STATUS_OBJECT_NAME_COLLISION;
+ }
+
+ /* check if this endpoint exists
+ */
+ status = dcesrv_find_endpoint(dce_ctx, binding, &ep);
+ if (NT_STATUS_IS_OK(status)) {
+ /*
+ * We want a new port on ncacn_ip_tcp for NETLOGON, so
+ * it can be multi-process. Other processes can also
+ * listen on distinct ports, if they have one forced
+ * in the code above with eg 'rpc server port:drsuapi = 1027'
+ *
+ * If we have mulitiple endpoints on port 0, they each
+ * get an epemeral port (currently by walking up from
+ * 1024).
+ *
+ * Because one endpoint can only have one process
+ * model, we add a new IP_TCP endpoint for each model.
+ *
+ * This works in conjunction with the forced overwrite
+ * of ep->use_single_process below.
+ */
+ if (ep->use_single_process != use_single_process
+ && transport == NCACN_IP_TCP) {
+ add_ep = true;
+ }
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND) || add_ep) {
+ ep = talloc_zero(dce_ctx, struct dcesrv_endpoint);
+ if (!ep) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ ep->ep_description = dcerpc_binding_dup(ep, binding);
+ if (transport == NCACN_NP && binding2 != NULL) {
+ ep->ep_2nd_description =
+ dcerpc_binding_dup(ep, binding2);
+ }
+ add_ep = true;
+
+ /* add mgmt interface */
+ ifl = talloc_zero(ep, struct dcesrv_if_list);
+ if (!ifl) {
+ TALLOC_FREE(ep);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ifl->iface = talloc_memdup(ifl,
+ dcesrv_get_mgmt_interface(),
+ sizeof(struct dcesrv_interface));
+ if (ifl->iface == NULL) {
+ talloc_free(ep);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ DLIST_ADD(ep->interface_list, ifl);
+ } else if (!NT_STATUS_IS_OK(status)) {
+ DBG_NOTICE("Failed to find endpoint: %s\n", nt_errstr(status));
+ return status;
+ }
+
+ /*
+ * By default don't force into a single process, but if any
+ * interface on this endpoint on this service uses handles
+ * (most do), then we must force into single process mode
+ *
+ * By overwriting this each time a new interface is added to
+ * this endpoint, we end up with the most restrictive setting.
+ */
+ if (use_single_process) {
+ ep->use_single_process = true;
+ }
+
+ /* talloc a new interface list element */
+ ifl = talloc_zero(ep, struct dcesrv_if_list);
+ if (!ifl) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /* copy the given interface struct to the one on the endpoints interface list */
+ ifl->iface = talloc_memdup(ifl,
+ iface,
+ sizeof(struct dcesrv_interface));
+ if (ifl->iface == NULL) {
+ talloc_free(ep);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /* if we have a security descriptor given,
+ * we should see if we can set it up on the endpoint
+ */
+ if (sd != NULL) {
+ /* if there's currently no security descriptor given on the endpoint
+ * we try to set it
+ */
+ if (ep->sd == NULL) {
+ ep->sd = security_descriptor_copy(ep, sd);
+ }
+
+ /* if now there's no security descriptor given on the endpoint
+ * something goes wrong, either we failed to copy the security descriptor
+ * or there was already one on the endpoint
+ */
+ if (ep->sd != NULL) {
+ char *binding_string =
+ dcerpc_binding_string(dce_ctx, binding);
+ DBG_ERR("Interface '%s' failed to setup a security "
+ "descriptor on endpoint '%s'\n",
+ iface->name, binding_string);
+ TALLOC_FREE(binding_string);
+ if (add_ep) free(ep);
+ free(ifl);
+ return NT_STATUS_OBJECT_NAME_COLLISION;
+ }
+ }
+
+ /* finally add the interface on the endpoint */
+ DLIST_ADD(ep->interface_list, ifl);
+
+ /* if it's a new endpoint add it to the dcesrv_context */
+ if (add_ep) {
+ DLIST_ADD(dce_ctx->endpoint_list, ep);
+ }
+
+ /* Re-get the string as we may have set a port */
+ ep_string = dcerpc_binding_string(dce_ctx, ep->ep_description);
+
+ if (use_single_process) {
+ ep_process_string = "single process required";
+ } else {
+ ep_process_string = "multi process compatible";
+ }
+
+ DBG_INFO("Interface '%s' registered on endpoint '%s' (%s)\n",
+ iface->name, ep_string, ep_process_string);
+ TALLOC_FREE(ep_string);
+
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS dcesrv_session_info_session_key(struct dcesrv_auth *auth,
+ DATA_BLOB *session_key)
+{
+ if (auth->session_info == NULL) {
+ return NT_STATUS_NO_USER_SESSION_KEY;
+ }
+
+ if (auth->session_info->session_key.length == 0) {
+ return NT_STATUS_NO_USER_SESSION_KEY;
+ }
+
+ *session_key = auth->session_info->session_key;
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS dcesrv_remote_session_key(struct dcesrv_auth *auth,
+ DATA_BLOB *session_key)
+{
+ if (auth->auth_type != DCERPC_AUTH_TYPE_NONE) {
+ return NT_STATUS_NO_USER_SESSION_KEY;
+ }
+
+ return dcesrv_session_info_session_key(auth, session_key);
+}
+
+static NTSTATUS dcesrv_local_fixed_session_key(struct dcesrv_auth *auth,
+ DATA_BLOB *session_key)
+{
+ return dcerpc_generic_session_key(session_key);
+}
+
+/*
+ * Fetch the authentication session key if available.
+ *
+ * This is the key generated by a gensec authentication.
+ *
+ */
+_PUBLIC_ NTSTATUS dcesrv_auth_session_key(struct dcesrv_call_state *call,
+ DATA_BLOB *session_key)
+{
+ struct dcesrv_auth *auth = call->auth_state;
+ SMB_ASSERT(auth->auth_finished);
+ return dcesrv_session_info_session_key(auth, session_key);
+}
+
+/*
+ * Fetch the transport session key if available.
+ * Typically this is the SMB session key
+ * or a fixed key for local transports.
+ *
+ * The key is always truncated to 16 bytes.
+*/
+_PUBLIC_ NTSTATUS dcesrv_transport_session_key(struct dcesrv_call_state *call,
+ DATA_BLOB *session_key)
+{
+ struct dcesrv_auth *auth = call->auth_state;
+ NTSTATUS status;
+
+ SMB_ASSERT(auth->auth_finished);
+
+ if (auth->session_key_fn == NULL) {
+ return NT_STATUS_NO_USER_SESSION_KEY;
+ }
+
+ status = auth->session_key_fn(auth, session_key);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ session_key->length = MIN(session_key->length, 16);
+
+ return NT_STATUS_OK;
+}
+
+static struct dcesrv_auth *dcesrv_auth_create(struct dcesrv_connection *conn)
+{
+ const struct dcesrv_endpoint *ep = conn->endpoint;
+ enum dcerpc_transport_t transport =
+ dcerpc_binding_get_transport(ep->ep_description);
+ struct dcesrv_auth *auth = NULL;
+
+ auth = talloc_zero(conn, struct dcesrv_auth);
+ if (auth == NULL) {
+ return NULL;
+ }
+
+ switch (transport) {
+ case NCACN_NP:
+ auth->session_key_fn = dcesrv_remote_session_key;
+ break;
+ case NCALRPC:
+ case NCACN_UNIX_STREAM:
+ auth->session_key_fn = dcesrv_local_fixed_session_key;
+ break;
+ default:
+ /*
+ * All other's get a NULL pointer, which
+ * results in NT_STATUS_NO_USER_SESSION_KEY
+ */
+ break;
+ }
+
+ return auth;
+}
+
+/*
+ connect to a dcerpc endpoint
+*/
+_PUBLIC_ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx,
+ TALLOC_CTX *mem_ctx,
+ const struct dcesrv_endpoint *ep,
+ struct auth_session_info *session_info,
+ struct tevent_context *event_ctx,
+ uint32_t state_flags,
+ struct dcesrv_connection **_p)
+{
+ struct dcesrv_auth *auth = NULL;
+ struct dcesrv_connection *p = NULL;
+
+ if (!session_info) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ p = talloc_zero(mem_ctx, struct dcesrv_connection);
+ if (p == NULL) {
+ goto nomem;
+ }
+
+ p->dce_ctx = dce_ctx;
+ p->endpoint = ep;
+ p->packet_log_dir = lpcfg_parm_string(dce_ctx->lp_ctx,
+ NULL,
+ "dcesrv",
+ "stubs directory");
+ p->event_ctx = event_ctx;
+ p->state_flags = state_flags;
+ p->allow_bind = true;
+ p->max_recv_frag = 5840;
+ p->max_xmit_frag = 5840;
+ p->max_total_request_size = DCERPC_NCACN_REQUEST_DEFAULT_MAX_SIZE;
+
+ p->support_hdr_signing = lpcfg_parm_bool(dce_ctx->lp_ctx,
+ NULL,
+ "dcesrv",
+ "header signing",
+ true);
+ p->max_auth_states = lpcfg_parm_ulong(dce_ctx->lp_ctx,
+ NULL,
+ "dcesrv",
+ "max auth states",
+ 2049);
+
+ auth = dcesrv_auth_create(p);
+ if (auth == NULL) {
+ goto nomem;
+ }
+
+ auth->session_info = talloc_reference(auth, session_info);
+ if (auth->session_info == NULL) {
+ goto nomem;
+ }
+
+ p->default_auth_state = auth;
+
+ /*
+ * For now we only support NDR32.
+ */
+ p->preferred_transfer = &ndr_transfer_syntax_ndr;
+
+ *_p = p;
+ return NT_STATUS_OK;
+nomem:
+ TALLOC_FREE(p);
+ return NT_STATUS_NO_MEMORY;
+}
+
+/*
+ move a call from an existing linked list to the specified list. This
+ prevents bugs where we forget to remove the call from a previous
+ list when moving it.
+ */
+static void dcesrv_call_set_list(struct dcesrv_call_state *call,
+ enum dcesrv_call_list list)
+{
+ switch (call->list) {
+ case DCESRV_LIST_NONE:
+ break;
+ case DCESRV_LIST_CALL_LIST:
+ DLIST_REMOVE(call->conn->call_list, call);
+ break;
+ case DCESRV_LIST_FRAGMENTED_CALL_LIST:
+ DLIST_REMOVE(call->conn->incoming_fragmented_call_list, call);
+ break;
+ case DCESRV_LIST_PENDING_CALL_LIST:
+ DLIST_REMOVE(call->conn->pending_call_list, call);
+ break;
+ }
+ call->list = list;
+ switch (list) {
+ case DCESRV_LIST_NONE:
+ break;
+ case DCESRV_LIST_CALL_LIST:
+ DLIST_ADD_END(call->conn->call_list, call);
+ break;
+ case DCESRV_LIST_FRAGMENTED_CALL_LIST:
+ DLIST_ADD_END(call->conn->incoming_fragmented_call_list, call);
+ break;
+ case DCESRV_LIST_PENDING_CALL_LIST:
+ DLIST_ADD_END(call->conn->pending_call_list, call);
+ break;
+ }
+}
+
+static void dcesrv_call_disconnect_after(struct dcesrv_call_state *call,
+ const char *reason)
+{
+ struct dcesrv_auth *a = NULL;
+
+ if (call->conn->terminate != NULL) {
+ return;
+ }
+
+ call->conn->allow_bind = false;
+ call->conn->allow_alter = false;
+
+ call->conn->default_auth_state->auth_invalid = true;
+
+ for (a = call->conn->auth_states; a != NULL; a = a->next) {
+ a->auth_invalid = true;
+ }
+
+ call->terminate_reason = talloc_strdup(call, reason);
+ if (call->terminate_reason == NULL) {
+ call->terminate_reason = __location__;
+ }
+}
+
+/*
+ return a dcerpc bind_nak
+*/
+static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32_t reason)
+{
+ struct ncacn_packet pkt;
+ struct dcerpc_bind_nak_version version;
+ struct data_blob_list_item *rep;
+ NTSTATUS status;
+ static const uint8_t _pad[3] = { 0, };
+
+ /*
+ * We add the call to the pending_call_list
+ * in order to defer the termination.
+ */
+ dcesrv_call_disconnect_after(call, "dcesrv_bind_nak");
+
+ /* setup a bind_nak */
+ dcesrv_init_hdr(&pkt, lpcfg_rpc_big_endian(call->conn->dce_ctx->lp_ctx));
+ pkt.auth_length = 0;
+ pkt.call_id = call->pkt.call_id;
+ pkt.ptype = DCERPC_PKT_BIND_NAK;
+ pkt.pfc_flags = DCERPC_PFC_FLAG_FIRST | DCERPC_PFC_FLAG_LAST;
+ pkt.u.bind_nak.reject_reason = reason;
+ version.rpc_vers = 5;
+ version.rpc_vers_minor = 0;
+ pkt.u.bind_nak.num_versions = 1;
+ pkt.u.bind_nak.versions = &version;
+ pkt.u.bind_nak._pad = data_blob_const(_pad, sizeof(_pad));
+
+ rep = talloc_zero(call, struct data_blob_list_item);
+ if (!rep) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = dcerpc_ncacn_push_auth(&rep->blob, call, &pkt, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ dcerpc_set_frag_length(&rep->blob, rep->blob.length);
+
+ DLIST_ADD_END(call->replies, rep);
+ dcesrv_call_set_list(call, DCESRV_LIST_CALL_LIST);
+
+ if (call->conn->call_list && call->conn->call_list->replies) {
+ if (call->conn->transport.report_output_data) {
+ call->conn->transport.report_output_data(call->conn);
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS _dcesrv_fault_disconnect_flags(struct dcesrv_call_state *call,
+ uint32_t fault_code,
+ uint8_t extra_flags,
+ const char *func,
+ const char *location)
+{
+ const char *reason = NULL;
+
+ reason = talloc_asprintf(call, "%s:%s: fault=%u (%s) flags=0x%x",
+ func, location,
+ fault_code,
+ dcerpc_errstr(call, fault_code),
+ extra_flags);
+ if (reason == NULL) {
+ reason = location;
+ }
+
+ /*
+ * We add the call to the pending_call_list
+ * in order to defer the termination.
+ */
+
+ dcesrv_call_disconnect_after(call, reason);
+
+ return dcesrv_fault_with_flags(call, fault_code, extra_flags);
+}
+
+#define dcesrv_fault_disconnect(call, fault_code) \
+ _dcesrv_fault_disconnect_flags(call, fault_code, \
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE, \
+ __func__, __location__)
+#define dcesrv_fault_disconnect0(call, fault_code) \
+ _dcesrv_fault_disconnect_flags(call, fault_code, 0, \
+ __func__, __location__)
+
+static int dcesrv_connection_context_destructor(struct dcesrv_connection_context *c)
+{
+ DLIST_REMOVE(c->conn->contexts, c);
+
+ if (c->iface && c->iface->unbind) {
+ c->iface->unbind(c, c->iface);
+ c->iface = NULL;
+ }
+
+ return 0;
+}
+
+static void dcesrv_prepare_context_auth(struct dcesrv_call_state *dce_call)
+{
+ struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
+ const struct dcesrv_endpoint *endpoint = dce_call->conn->endpoint;
+ enum dcerpc_transport_t transport =
+ dcerpc_binding_get_transport(endpoint->ep_description);
+ struct dcesrv_connection_context *context = dce_call->context;
+ const struct dcesrv_interface *iface = context->iface;
+
+ context->min_auth_level = DCERPC_AUTH_LEVEL_NONE;
+
+ if (transport == NCALRPC) {
+ context->allow_connect = true;
+ return;
+ }
+
+ /*
+ * allow overwrite per interface
+ * allow dcerpc auth level connect:<interface>
+ */
+ context->allow_connect = lpcfg_allow_dcerpc_auth_level_connect(lp_ctx);
+ context->allow_connect = lpcfg_parm_bool(lp_ctx, NULL,
+ "allow dcerpc auth level connect",
+ iface->name,
+ context->allow_connect);
+}
+
+NTSTATUS dcesrv_interface_bind_require_integrity(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface)
+{
+ /*
+ * For connection oriented DCERPC DCERPC_AUTH_LEVEL_PACKET (4)
+ * has the same behavior as DCERPC_AUTH_LEVEL_INTEGRITY (5).
+ */
+ context->min_auth_level = DCERPC_AUTH_LEVEL_PACKET;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS dcesrv_interface_bind_require_privacy(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface)
+{
+ context->min_auth_level = DCERPC_AUTH_LEVEL_PRIVACY;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_interface_bind_reject_connect(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface)
+{
+ struct loadparm_context *lp_ctx = context->conn->dce_ctx->lp_ctx;
+ const struct dcesrv_endpoint *endpoint = context->conn->endpoint;
+ enum dcerpc_transport_t transport =
+ dcerpc_binding_get_transport(endpoint->ep_description);
+
+ if (transport == NCALRPC) {
+ context->allow_connect = true;
+ return NT_STATUS_OK;
+ }
+
+ /*
+ * allow overwrite per interface
+ * allow dcerpc auth level connect:<interface>
+ */
+ context->allow_connect = false;
+ context->allow_connect = lpcfg_parm_bool(lp_ctx, NULL,
+ "allow dcerpc auth level connect",
+ iface->name,
+ context->allow_connect);
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_interface_bind_allow_connect(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface)
+{
+ struct loadparm_context *lp_ctx = context->conn->dce_ctx->lp_ctx;
+ const struct dcesrv_endpoint *endpoint = context->conn->endpoint;
+ enum dcerpc_transport_t transport =
+ dcerpc_binding_get_transport(endpoint->ep_description);
+
+ if (transport == NCALRPC) {
+ context->allow_connect = true;
+ return NT_STATUS_OK;
+ }
+
+ /*
+ * allow overwrite per interface
+ * allow dcerpc auth level connect:<interface>
+ */
+ context->allow_connect = true;
+ context->allow_connect = lpcfg_parm_bool(lp_ctx, NULL,
+ "allow dcerpc auth level connect",
+ iface->name,
+ context->allow_connect);
+ return NT_STATUS_OK;
+}
+
+struct dcesrv_conn_auth_wait_context {
+ struct tevent_req *req;
+ bool done;
+ NTSTATUS status;
+};
+
+struct dcesrv_conn_auth_wait_state {
+ uint8_t dummy;
+};
+
+static struct tevent_req *dcesrv_conn_auth_wait_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ void *private_data)
+{
+ struct dcesrv_conn_auth_wait_context *auth_wait =
+ talloc_get_type_abort(private_data,
+ struct dcesrv_conn_auth_wait_context);
+ struct tevent_req *req = NULL;
+ struct dcesrv_conn_auth_wait_state *state = NULL;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct dcesrv_conn_auth_wait_state);
+ if (req == NULL) {
+ return NULL;
+ }
+ auth_wait->req = req;
+
+ tevent_req_defer_callback(req, ev);
+
+ if (!auth_wait->done) {
+ return req;
+ }
+
+ if (tevent_req_nterror(req, auth_wait->status)) {
+ return tevent_req_post(req, ev);
+ }
+
+ tevent_req_done(req);
+ return tevent_req_post(req, ev);
+}
+
+static NTSTATUS dcesrv_conn_auth_wait_recv(struct tevent_req *req)
+{
+ return tevent_req_simple_recv_ntstatus(req);
+}
+
+static NTSTATUS dcesrv_conn_auth_wait_setup(struct dcesrv_connection *conn)
+{
+ struct dcesrv_conn_auth_wait_context *auth_wait = NULL;
+
+ if (conn->wait_send != NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ auth_wait = talloc_zero(conn, struct dcesrv_conn_auth_wait_context);
+ if (auth_wait == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ conn->wait_private = auth_wait;
+ conn->wait_send = dcesrv_conn_auth_wait_send;
+ conn->wait_recv = dcesrv_conn_auth_wait_recv;
+ return NT_STATUS_OK;
+}
+
+static void dcesrv_conn_auth_wait_finished(struct dcesrv_connection *conn,
+ NTSTATUS status)
+{
+ struct dcesrv_conn_auth_wait_context *auth_wait =
+ talloc_get_type_abort(conn->wait_private,
+ struct dcesrv_conn_auth_wait_context);
+
+ auth_wait->done = true;
+ auth_wait->status = status;
+
+ if (auth_wait->req == NULL) {
+ return;
+ }
+
+ if (tevent_req_nterror(auth_wait->req, status)) {
+ return;
+ }
+
+ tevent_req_done(auth_wait->req);
+}
+
+static NTSTATUS dcesrv_auth_reply(struct dcesrv_call_state *call);
+
+static void dcesrv_bind_done(struct tevent_req *subreq);
+
+/*
+ handle a bind request
+*/
+static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
+{
+ struct dcesrv_connection *conn = call->conn;
+ struct dcesrv_context *dce_ctx = conn->dce_ctx;
+ struct ncacn_packet *pkt = &call->ack_pkt;
+ NTSTATUS status;
+ uint32_t extra_flags = 0;
+ uint16_t max_req = 0;
+ uint16_t max_rep = 0;
+ struct dcerpc_binding *ep_2nd_description = NULL;
+ const char *endpoint = NULL;
+ struct dcesrv_auth *auth = call->auth_state;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ struct dcerpc_ack_ctx *ack_ctx_list = NULL;
+ struct dcerpc_ack_ctx *ack_features = NULL;
+ struct tevent_req *subreq = NULL;
+ size_t i;
+
+ status = dcerpc_verify_ncacn_packet_header(&call->pkt,
+ DCERPC_PKT_BIND,
+ call->pkt.u.bind.auth_info.length,
+ 0, /* required flags */
+ DCERPC_PFC_FLAG_FIRST |
+ DCERPC_PFC_FLAG_LAST |
+ DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN |
+ 0x08 | /* this is not defined, but should be ignored */
+ DCERPC_PFC_FLAG_CONC_MPX |
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
+ DCERPC_PFC_FLAG_MAYBE |
+ DCERPC_PFC_FLAG_OBJECT_UUID);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_bind_nak(call,
+ DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED);
+ }
+
+ /* max_recv_frag and max_xmit_frag result always in the same value! */
+ max_req = MIN(call->pkt.u.bind.max_xmit_frag,
+ call->pkt.u.bind.max_recv_frag);
+ /*
+ * The values are between 2048 and 5840 tested against Windows 2012R2
+ * via ncacn_ip_tcp on port 135.
+ */
+ max_req = MAX(2048, max_req);
+ max_rep = MIN(max_req, conn->max_recv_frag);
+ /* They are truncated to an 8 byte boundary. */
+ max_rep &= 0xFFF8;
+
+ /* max_recv_frag and max_xmit_frag result always in the same value! */
+ conn->max_recv_frag = max_rep;
+ conn->max_xmit_frag = max_rep;
+
+ status = dce_ctx->callbacks->assoc_group.find(
+ call, dce_ctx->callbacks->assoc_group.private_data);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_NOTICE("Failed to find assoc_group 0x%08x: %s\n",
+ call->pkt.u.bind.assoc_group_id, nt_errstr(status));
+ return dcesrv_bind_nak(call, 0);
+ }
+
+ if (call->pkt.u.bind.num_contexts < 1) {
+ return dcesrv_bind_nak(call, 0);
+ }
+
+ ack_ctx_list = talloc_zero_array(call, struct dcerpc_ack_ctx,
+ call->pkt.u.bind.num_contexts);
+ if (ack_ctx_list == NULL) {
+ return dcesrv_bind_nak(call, 0);
+ }
+
+ /*
+ * Set some sane defaults (required by dcesrv_negotiate_contexts()/
+ * dcesrv_check_or_create_context()) and do some protocol validation
+ * and set sane defaults.
+ */
+ for (i = 0; i < call->pkt.u.bind.num_contexts; i++) {
+ const struct dcerpc_ctx_list *c = &call->pkt.u.bind.ctx_list[i];
+ struct dcerpc_ack_ctx *a = &ack_ctx_list[i];
+ bool is_feature = false;
+ uint64_t features = 0;
+
+ if (c->num_transfer_syntaxes == 0) {
+ return dcesrv_bind_nak(call, 0);
+ }
+
+ a->result = DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION;
+ a->reason.value = DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED;
+
+ /*
+ * It's only treated as bind time feature request, if the first
+ * transfer_syntax matches, all others are ignored.
+ */
+ is_feature = dcerpc_extract_bind_time_features(c->transfer_syntaxes[0],
+ &features);
+ if (!is_feature) {
+ continue;
+ }
+
+ if (ack_features != NULL) {
+ /*
+ * Only one bind time feature context is allowed.
+ */
+ return dcesrv_bind_nak(call, 0);
+ }
+ ack_features = a;
+
+ a->result = DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK;
+ a->reason.negotiate = 0;
+ if (features & DCERPC_BIND_TIME_SECURITY_CONTEXT_MULTIPLEXING) {
+ if (conn->max_auth_states != 0) {
+ a->reason.negotiate |=
+ DCERPC_BIND_TIME_SECURITY_CONTEXT_MULTIPLEXING;
+ }
+ }
+ if (features & DCERPC_BIND_TIME_KEEP_CONNECTION_ON_ORPHAN) {
+ a->reason.negotiate |=
+ DCERPC_BIND_TIME_KEEP_CONNECTION_ON_ORPHAN;
+ }
+
+ conn->assoc_group->bind_time_features = a->reason.negotiate;
+ }
+
+ /*
+ * Try to negotiate one new presentation context.
+ *
+ * Deep in here we locate the iface (by uuid) that the client
+ * requested, from the list of interfaces on the
+ * call->conn->endpoint, and call iface->bind() on that iface.
+ *
+ * call->conn was set up at the accept() of the socket, and
+ * call->conn->endpoint has a list of interfaces restricted to
+ * this port or pipe.
+ */
+ status = dcesrv_negotiate_contexts(call, &call->pkt.u.bind, ack_ctx_list);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTOCOL_ERROR)) {
+ return dcesrv_bind_nak(call, 0);
+ }
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ /*
+ * At this point we still don't know which interface (eg
+ * netlogon, lsa, drsuapi) the caller requested in this bind!
+ * The most recently added context is available as the first
+ * element in the linked list at call->conn->contexts, that is
+ * call->conn->contexts->iface, but they may not have
+ * requested one at all!
+ */
+
+ if ((call->pkt.pfc_flags & DCERPC_PFC_FLAG_CONC_MPX) &&
+ (call->state_flags & DCESRV_CALL_STATE_FLAG_MULTIPLEXED)) {
+ call->conn->state_flags |= DCESRV_CALL_STATE_FLAG_MULTIPLEXED;
+ extra_flags |= DCERPC_PFC_FLAG_CONC_MPX;
+ }
+
+ if (call->state_flags & DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL) {
+ conn->state_flags |= DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL;
+ }
+
+ /*
+ * After finding the interface and setting up the NDR
+ * transport negotiation etc, handle any authentication that
+ * is being requested.
+ */
+ if (!dcesrv_auth_bind(call)) {
+
+ if (auth->auth_level == DCERPC_AUTH_LEVEL_NONE) {
+ /*
+ * With DCERPC_AUTH_LEVEL_NONE, we get the
+ * reject_reason in auth->auth_context_id.
+ */
+ return dcesrv_bind_nak(call, auth->auth_context_id);
+ }
+
+ /*
+ * This must a be a temporary failure e.g. talloc or invalid
+ * configuration, e.g. no machine account.
+ */
+ return dcesrv_bind_nak(call,
+ DCERPC_BIND_NAK_REASON_TEMPORARY_CONGESTION);
+ }
+
+ /* setup a bind_ack */
+ dcesrv_init_hdr(pkt, lpcfg_rpc_big_endian(dce_ctx->lp_ctx));
+ pkt->auth_length = 0;
+ pkt->call_id = call->pkt.call_id;
+ pkt->ptype = DCERPC_PKT_BIND_ACK;
+ pkt->pfc_flags = DCERPC_PFC_FLAG_FIRST | DCERPC_PFC_FLAG_LAST | extra_flags;
+ pkt->u.bind_ack.max_xmit_frag = conn->max_xmit_frag;
+ pkt->u.bind_ack.max_recv_frag = conn->max_recv_frag;
+ pkt->u.bind_ack.assoc_group_id = conn->assoc_group->id;
+
+ ep_2nd_description = conn->endpoint->ep_2nd_description;
+ if (ep_2nd_description == NULL) {
+ ep_2nd_description = conn->endpoint->ep_description;
+ }
+
+ endpoint = dcerpc_binding_get_string_option(
+ ep_2nd_description,
+ "endpoint");
+ if (endpoint == NULL) {
+ endpoint = "";
+ }
+
+ pkt->u.bind_ack.secondary_address = endpoint;
+ pkt->u.bind_ack.num_results = call->pkt.u.bind.num_contexts;
+ pkt->u.bind_ack.ctx_list = ack_ctx_list;
+ pkt->u.bind_ack.auth_info = data_blob_null;
+
+ status = dcesrv_auth_prepare_bind_ack(call, pkt);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_bind_nak(call, 0);
+ }
+
+ if (auth->auth_finished) {
+ return dcesrv_auth_reply(call);
+ }
+
+ cb->auth.become_root();
+ subreq = gensec_update_send(call, call->event_ctx,
+ auth->gensec_security,
+ call->in_auth_info.credentials);
+ cb->auth.unbecome_root();
+ if (subreq == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ tevent_req_set_callback(subreq, dcesrv_bind_done, call);
+
+ return dcesrv_conn_auth_wait_setup(conn);
+}
+
+static void dcesrv_bind_done(struct tevent_req *subreq)
+{
+ struct dcesrv_call_state *call =
+ tevent_req_callback_data(subreq,
+ struct dcesrv_call_state);
+ struct dcesrv_connection *conn = call->conn;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ NTSTATUS status;
+
+ cb->auth.become_root();
+ status = gensec_update_recv(subreq, call,
+ &call->out_auth_info->credentials);
+ cb->auth.unbecome_root();
+ TALLOC_FREE(subreq);
+
+ status = dcesrv_auth_complete(call, status);
+ if (!NT_STATUS_IS_OK(status)) {
+ status = dcesrv_bind_nak(call, 0);
+ dcesrv_conn_auth_wait_finished(conn, status);
+ return;
+ }
+
+ status = dcesrv_auth_reply(call);
+ dcesrv_conn_auth_wait_finished(conn, status);
+ return;
+}
+
+static NTSTATUS dcesrv_auth_reply(struct dcesrv_call_state *call)
+{
+ struct ncacn_packet *pkt = &call->ack_pkt;
+ struct data_blob_list_item *rep = NULL;
+ NTSTATUS status;
+
+ rep = talloc_zero(call, struct data_blob_list_item);
+ if (!rep) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = dcerpc_ncacn_push_auth(&rep->blob,
+ call,
+ pkt,
+ call->out_auth_info);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ dcerpc_set_frag_length(&rep->blob, rep->blob.length);
+
+ DLIST_ADD_END(call->replies, rep);
+ dcesrv_call_set_list(call, DCESRV_LIST_CALL_LIST);
+
+ if (call->conn->call_list && call->conn->call_list->replies) {
+ if (call->conn->transport.report_output_data) {
+ call->conn->transport.report_output_data(call->conn);
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+
+static void dcesrv_auth3_done(struct tevent_req *subreq);
+
+/*
+ handle a auth3 request
+*/
+static NTSTATUS dcesrv_auth3(struct dcesrv_call_state *call)
+{
+ struct dcesrv_connection *conn = call->conn;
+ struct dcesrv_auth *auth = call->auth_state;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ struct tevent_req *subreq = NULL;
+ NTSTATUS status;
+
+ if (!auth->auth_started) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ if (auth->auth_finished) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ status = dcerpc_verify_ncacn_packet_header(&call->pkt,
+ DCERPC_PKT_AUTH3,
+ call->pkt.u.auth3.auth_info.length,
+ 0, /* required flags */
+ DCERPC_PFC_FLAG_FIRST |
+ DCERPC_PFC_FLAG_LAST |
+ DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN |
+ 0x08 | /* this is not defined, but should be ignored */
+ DCERPC_PFC_FLAG_CONC_MPX |
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
+ DCERPC_PFC_FLAG_MAYBE |
+ DCERPC_PFC_FLAG_OBJECT_UUID);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ /* handle the auth3 in the auth code */
+ if (!dcesrv_auth_prepare_auth3(call)) {
+ /*
+ * we don't send a reply to a auth3 request,
+ * except by a fault.
+ *
+ * In anycase we mark the connection as
+ * invalid.
+ */
+ auth->auth_invalid = true;
+ if (call->fault_code != 0) {
+ return dcesrv_fault_disconnect(call, call->fault_code);
+ }
+ TALLOC_FREE(call);
+ return NT_STATUS_OK;
+ }
+
+ cb->auth.become_root();
+ subreq = gensec_update_send(call, call->event_ctx,
+ auth->gensec_security,
+ call->in_auth_info.credentials);
+ cb->auth.unbecome_root();
+ if (subreq == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ tevent_req_set_callback(subreq, dcesrv_auth3_done, call);
+
+ return dcesrv_conn_auth_wait_setup(conn);
+}
+
+static void dcesrv_auth3_done(struct tevent_req *subreq)
+{
+ struct dcesrv_call_state *call =
+ tevent_req_callback_data(subreq,
+ struct dcesrv_call_state);
+ struct dcesrv_connection *conn = call->conn;
+ struct dcesrv_auth *auth = call->auth_state;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ NTSTATUS status;
+
+ cb->auth.become_root();
+ status = gensec_update_recv(subreq, call,
+ &call->out_auth_info->credentials);
+ cb->auth.unbecome_root();
+ TALLOC_FREE(subreq);
+
+ status = dcesrv_auth_complete(call, status);
+ if (!NT_STATUS_IS_OK(status)) {
+ /*
+ * we don't send a reply to a auth3 request,
+ * except by a fault.
+ *
+ * In anycase we mark the connection as
+ * invalid.
+ */
+ auth->auth_invalid = true;
+ if (call->fault_code != 0) {
+ status = dcesrv_fault_disconnect(call, call->fault_code);
+ dcesrv_conn_auth_wait_finished(conn, status);
+ return;
+ }
+ TALLOC_FREE(call);
+ dcesrv_conn_auth_wait_finished(conn, NT_STATUS_OK);
+ return;
+ }
+
+ /*
+ * we don't send a reply to a auth3 request.
+ */
+ TALLOC_FREE(call);
+ dcesrv_conn_auth_wait_finished(conn, NT_STATUS_OK);
+ return;
+}
+
+
+static NTSTATUS dcesrv_check_or_create_context(struct dcesrv_call_state *call,
+ const struct dcerpc_bind *b,
+ const struct dcerpc_ctx_list *ctx,
+ struct dcerpc_ack_ctx *ack,
+ bool validate_only,
+ const struct ndr_syntax_id *supported_transfer)
+{
+ struct dcesrv_connection_context *context;
+ const struct dcesrv_interface *iface;
+ NTSTATUS status;
+ const struct ndr_syntax_id *selected_transfer = NULL;
+ size_t i;
+ bool ok;
+
+ if (b == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ if (ctx == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ if (ctx->num_transfer_syntaxes < 1) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ if (ack == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ if (supported_transfer == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ switch (ack->result) {
+ case DCERPC_BIND_ACK_RESULT_ACCEPTANCE:
+ case DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK:
+ /*
+ * We is already completed.
+ */
+ return NT_STATUS_OK;
+ default:
+ break;
+ }
+
+ ack->result = DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION;
+ ack->reason.value = DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED;
+
+ iface = find_interface_by_syntax_id(
+ call->conn->endpoint, &ctx->abstract_syntax);
+ if (iface == NULL) {
+ struct ndr_syntax_id_buf buf;
+ DBG_NOTICE("Request for unknown dcerpc interface %s\n",
+ ndr_syntax_id_buf_string(
+ &ctx->abstract_syntax, &buf));
+ /*
+ * We report this only via ack->result
+ */
+ return NT_STATUS_OK;
+ }
+
+ ack->result = DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION;
+ ack->reason.value = DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED;
+
+ if (validate_only) {
+ /*
+ * We report this only via ack->result
+ */
+ return NT_STATUS_OK;
+ }
+
+ for (i = 0; i < ctx->num_transfer_syntaxes; i++) {
+ /*
+ * we only do NDR encoded dcerpc for now.
+ */
+ ok = ndr_syntax_id_equal(&ctx->transfer_syntaxes[i],
+ supported_transfer);
+ if (ok) {
+ selected_transfer = supported_transfer;
+ break;
+ }
+ }
+
+ context = dcesrv_find_context(call->conn, ctx->context_id);
+ if (context != NULL) {
+ ok = ndr_syntax_id_equal(&context->iface->syntax_id,
+ &ctx->abstract_syntax);
+ if (!ok) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ if (selected_transfer != NULL) {
+ ok = ndr_syntax_id_equal(&context->transfer_syntax,
+ selected_transfer);
+ if (!ok) {
+ return NT_STATUS_RPC_PROTOCOL_ERROR;
+ }
+
+ ack->result = DCERPC_BIND_ACK_RESULT_ACCEPTANCE;
+ ack->reason.value = DCERPC_BIND_ACK_REASON_NOT_SPECIFIED;
+ ack->syntax = context->transfer_syntax;
+ }
+
+ /*
+ * We report this only via ack->result
+ */
+ return NT_STATUS_OK;
+ }
+
+ if (selected_transfer == NULL) {
+ /*
+ * We report this only via ack->result
+ */
+ return NT_STATUS_OK;
+ }
+
+ ack->result = DCERPC_BIND_ACK_RESULT_USER_REJECTION;
+ ack->reason.value = DCERPC_BIND_ACK_REASON_LOCAL_LIMIT_EXCEEDED;
+
+ /* add this context to the list of available context_ids */
+ context = talloc_zero(call->conn, struct dcesrv_connection_context);
+ if (context == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ context->conn = call->conn;
+ context->context_id = ctx->context_id;
+ context->iface = iface;
+ context->transfer_syntax = *selected_transfer;
+ DLIST_ADD(call->conn->contexts, context);
+ call->context = context;
+ talloc_set_destructor(context, dcesrv_connection_context_destructor);
+
+ dcesrv_prepare_context_auth(call);
+
+ /*
+ * Multiplex is supported by default
+ */
+ call->state_flags |= DCESRV_CALL_STATE_FLAG_MULTIPLEXED;
+
+ status = iface->bind(context, iface);
+ call->context = NULL;
+ if (!NT_STATUS_IS_OK(status)) {
+ /* we don't want to trigger the iface->unbind() hook */
+ context->iface = NULL;
+ talloc_free(context);
+ /*
+ * We report this only via ack->result
+ */
+ return NT_STATUS_OK;
+ }
+
+ ack->result = DCERPC_BIND_ACK_RESULT_ACCEPTANCE;
+ ack->reason.value = DCERPC_BIND_ACK_REASON_NOT_SPECIFIED;
+ ack->syntax = context->transfer_syntax;
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS dcesrv_negotiate_contexts(struct dcesrv_call_state *call,
+ const struct dcerpc_bind *b,
+ struct dcerpc_ack_ctx *ack_ctx_list)
+{
+ NTSTATUS status;
+ size_t i;
+ bool validate_only = false;
+ bool preferred_ndr32;
+
+ /*
+ * Try to negotiate one new presentation context,
+ * using our preferred transfer syntax.
+ */
+ for (i = 0; i < b->num_contexts; i++) {
+ const struct dcerpc_ctx_list *c = &b->ctx_list[i];
+ struct dcerpc_ack_ctx *a = &ack_ctx_list[i];
+
+ status = dcesrv_check_or_create_context(call, b, c, a,
+ validate_only,
+ call->conn->preferred_transfer);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (a->result == DCERPC_BIND_ACK_RESULT_ACCEPTANCE) {
+ /*
+ * We managed to negotiate one context.
+ *
+ * => we're done.
+ */
+ validate_only = true;
+ }
+ }
+
+ preferred_ndr32 = ndr_syntax_id_equal(&ndr_transfer_syntax_ndr,
+ call->conn->preferred_transfer);
+ if (preferred_ndr32) {
+ /*
+ * We're done.
+ */
+ return NT_STATUS_OK;
+ }
+
+ /*
+ * Try to negotiate one new presentation context,
+ * using NDR 32 as fallback.
+ */
+ for (i = 0; i < b->num_contexts; i++) {
+ const struct dcerpc_ctx_list *c = &b->ctx_list[i];
+ struct dcerpc_ack_ctx *a = &ack_ctx_list[i];
+
+ status = dcesrv_check_or_create_context(call, b, c, a,
+ validate_only,
+ &ndr_transfer_syntax_ndr);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (a->result == DCERPC_BIND_ACK_RESULT_ACCEPTANCE) {
+ /*
+ * We managed to negotiate one context.
+ *
+ * => we're done.
+ */
+ validate_only = true;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+static void dcesrv_alter_done(struct tevent_req *subreq);
+
+/*
+ handle a alter context request
+*/
+static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call)
+{
+ struct dcesrv_connection *conn = call->conn;
+ NTSTATUS status;
+ bool auth_ok = false;
+ struct ncacn_packet *pkt = &call->ack_pkt;
+ uint32_t extra_flags = 0;
+ struct dcesrv_auth *auth = call->auth_state;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ struct dcerpc_ack_ctx *ack_ctx_list = NULL;
+ struct tevent_req *subreq = NULL;
+ size_t i;
+
+ if (!call->conn->allow_alter) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ status = dcerpc_verify_ncacn_packet_header(&call->pkt,
+ DCERPC_PKT_ALTER,
+ call->pkt.u.alter.auth_info.length,
+ 0, /* required flags */
+ DCERPC_PFC_FLAG_FIRST |
+ DCERPC_PFC_FLAG_LAST |
+ DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN |
+ 0x08 | /* this is not defined, but should be ignored */
+ DCERPC_PFC_FLAG_CONC_MPX |
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
+ DCERPC_PFC_FLAG_MAYBE |
+ DCERPC_PFC_FLAG_OBJECT_UUID);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ auth_ok = dcesrv_auth_alter(call);
+ if (!auth_ok) {
+ if (call->fault_code != 0) {
+ return dcesrv_fault_disconnect(call, call->fault_code);
+ }
+ }
+
+ if (call->pkt.u.alter.num_contexts < 1) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ ack_ctx_list = talloc_zero_array(call, struct dcerpc_ack_ctx,
+ call->pkt.u.alter.num_contexts);
+ if (ack_ctx_list == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /*
+ * Set some sane defaults (required by dcesrv_negotiate_contexts()/
+ * dcesrv_check_or_create_context()) and do some protocol validation
+ * and set sane defaults.
+ */
+ for (i = 0; i < call->pkt.u.alter.num_contexts; i++) {
+ const struct dcerpc_ctx_list *c = &call->pkt.u.alter.ctx_list[i];
+ struct dcerpc_ack_ctx *a = &ack_ctx_list[i];
+
+ if (c->num_transfer_syntaxes == 0) {
+ return dcesrv_fault_disconnect(call,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ a->result = DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION;
+ a->reason.value = DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED;
+ }
+
+ /*
+ * Try to negotiate one new presentation context.
+ */
+ status = dcesrv_negotiate_contexts(call, &call->pkt.u.alter, ack_ctx_list);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTOCOL_ERROR)) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if ((call->pkt.pfc_flags & DCERPC_PFC_FLAG_CONC_MPX) &&
+ (call->state_flags & DCESRV_CALL_STATE_FLAG_MULTIPLEXED)) {
+ call->conn->state_flags |= DCESRV_CALL_STATE_FLAG_MULTIPLEXED;
+ extra_flags |= DCERPC_PFC_FLAG_CONC_MPX;
+ }
+
+ if (call->state_flags & DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL) {
+ call->conn->state_flags |= DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL;
+ }
+
+ /* handle any authentication that is being requested */
+ if (!auth_ok) {
+ if (call->in_auth_info.auth_type != auth->auth_type) {
+ return dcesrv_fault_disconnect(call,
+ DCERPC_FAULT_SEC_PKG_ERROR);
+ }
+ return dcesrv_fault_disconnect(call, DCERPC_FAULT_ACCESS_DENIED);
+ }
+
+ dcesrv_init_hdr(pkt, lpcfg_rpc_big_endian(call->conn->dce_ctx->lp_ctx));
+ pkt->auth_length = 0;
+ pkt->call_id = call->pkt.call_id;
+ pkt->ptype = DCERPC_PKT_ALTER_RESP;
+ pkt->pfc_flags = DCERPC_PFC_FLAG_FIRST | DCERPC_PFC_FLAG_LAST | extra_flags;
+ pkt->u.alter_resp.max_xmit_frag = call->conn->max_xmit_frag;
+ pkt->u.alter_resp.max_recv_frag = call->conn->max_recv_frag;
+ pkt->u.alter_resp.assoc_group_id = call->conn->assoc_group->id;
+ pkt->u.alter_resp.secondary_address = "";
+ pkt->u.alter_resp.num_results = call->pkt.u.alter.num_contexts;
+ pkt->u.alter_resp.ctx_list = ack_ctx_list;
+ pkt->u.alter_resp.auth_info = data_blob_null;
+
+ status = dcesrv_auth_prepare_alter_ack(call, pkt);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_fault_disconnect(call, DCERPC_FAULT_SEC_PKG_ERROR);
+ }
+
+ if (auth->auth_finished) {
+ return dcesrv_auth_reply(call);
+ }
+
+ cb->auth.become_root();
+ subreq = gensec_update_send(call, call->event_ctx,
+ auth->gensec_security,
+ call->in_auth_info.credentials);
+ cb->auth.unbecome_root();
+ if (subreq == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ tevent_req_set_callback(subreq, dcesrv_alter_done, call);
+
+ return dcesrv_conn_auth_wait_setup(conn);
+}
+
+static void dcesrv_alter_done(struct tevent_req *subreq)
+{
+ struct dcesrv_call_state *call =
+ tevent_req_callback_data(subreq,
+ struct dcesrv_call_state);
+ struct dcesrv_connection *conn = call->conn;
+ struct dcesrv_context_callbacks *cb = call->conn->dce_ctx->callbacks;
+ NTSTATUS status;
+
+ cb->auth.become_root();
+ status = gensec_update_recv(subreq, call,
+ &call->out_auth_info->credentials);
+ cb->auth.unbecome_root();
+ TALLOC_FREE(subreq);
+
+ status = dcesrv_auth_complete(call, status);
+ if (!NT_STATUS_IS_OK(status)) {
+ status = dcesrv_fault_disconnect(call, DCERPC_FAULT_SEC_PKG_ERROR);
+ dcesrv_conn_auth_wait_finished(conn, status);
+ return;
+ }
+
+ status = dcesrv_auth_reply(call);
+ dcesrv_conn_auth_wait_finished(conn, status);
+ return;
+}
+
+/*
+ possibly save the call for inspection with ndrdump
+ */
+static void dcesrv_save_call(struct dcesrv_call_state *call, const char *why)
+{
+#ifdef DEVELOPER
+ dcerpc_log_packet(call->conn->packet_log_dir,
+ call->context->iface->name,
+ call->pkt.u.request.opnum,
+ NDR_IN,
+ &call->pkt.u.request.stub_and_verifier,
+ why);
+#endif
+}
+
+#ifdef DEVELOPER
+/*
+ Save the call for use as a seed for fuzzing.
+
+ This is only enabled in a developer build, and only has effect if the
+ "dcesrv fuzz directory" param is set.
+*/
+void _dcesrv_save_ndr_fuzz_seed(DATA_BLOB call_blob,
+ struct dcesrv_call_state *call,
+ int flags)
+{
+ const char *dump_dir = lpcfg_parm_string(call->conn->dce_ctx->lp_ctx,
+ NULL,
+ "dcesrv", "fuzz directory");
+
+ dcerpc_save_ndr_fuzz_seed(call,
+ call_blob,
+ dump_dir,
+ call->context->iface->name,
+ flags,
+ call->pkt.u.request.opnum,
+ call->ndr_pull->flags & LIBNDR_FLAG_NDR64);
+}
+#endif /*if DEVELOPER, enveloping _dcesrv_save_ndr_fuzz_seed() */
+
+
+static NTSTATUS dcesrv_check_verification_trailer(struct dcesrv_call_state *call)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ const uint32_t bitmask1 = call->conn->client_hdr_signing ?
+ DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING : 0;
+ const struct dcerpc_sec_vt_pcontext pcontext = {
+ .abstract_syntax = call->context->iface->syntax_id,
+ .transfer_syntax = call->context->transfer_syntax,
+ };
+ const struct dcerpc_sec_vt_header2 header2 =
+ dcerpc_sec_vt_header2_from_ncacn_packet(&call->pkt);
+ enum ndr_err_code ndr_err;
+ struct dcerpc_sec_verification_trailer *vt = NULL;
+ NTSTATUS status = NT_STATUS_OK;
+ bool ok;
+
+ SMB_ASSERT(call->pkt.ptype == DCERPC_PKT_REQUEST);
+
+ ndr_err = ndr_pop_dcerpc_sec_verification_trailer(call->ndr_pull,
+ frame, &vt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ goto done;
+ }
+
+ ok = dcerpc_sec_verification_trailer_check(vt, &bitmask1,
+ &pcontext, &header2);
+ if (!ok) {
+ status = NT_STATUS_ACCESS_DENIED;
+ goto done;
+ }
+done:
+ TALLOC_FREE(frame);
+ return status;
+}
+
+/*
+ handle a dcerpc request packet
+*/
+static NTSTATUS dcesrv_request(struct dcesrv_call_state *call)
+{
+ const struct dcesrv_endpoint *endpoint = call->conn->endpoint;
+ struct dcesrv_auth *auth = call->auth_state;
+ enum dcerpc_transport_t transport =
+ dcerpc_binding_get_transport(endpoint->ep_description);
+ struct ndr_pull *pull;
+ bool turn_winbind_on = false;
+ NTSTATUS status;
+
+ if (auth->auth_invalid) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ if (!auth->auth_finished) {
+ return dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ /* if authenticated, and the mech we use can't do async replies, don't use them... */
+ if (auth->gensec_security != NULL &&
+ !gensec_have_feature(auth->gensec_security, GENSEC_FEATURE_ASYNC_REPLIES)) {
+ call->state_flags &= ~DCESRV_CALL_STATE_FLAG_MAY_ASYNC;
+ }
+
+ if (call->context == NULL) {
+ return dcesrv_fault_with_flags(call, DCERPC_NCA_S_UNKNOWN_IF,
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE);
+ }
+
+ switch (auth->auth_level) {
+ case DCERPC_AUTH_LEVEL_NONE:
+ case DCERPC_AUTH_LEVEL_PACKET:
+ case DCERPC_AUTH_LEVEL_INTEGRITY:
+ case DCERPC_AUTH_LEVEL_PRIVACY:
+ break;
+ default:
+ if (!call->context->allow_connect) {
+ char *addr;
+
+ addr = tsocket_address_string(call->conn->remote_address,
+ call);
+
+ DEBUG(2, ("%s: restrict auth_level_connect access "
+ "to [%s] with auth[type=0x%x,level=0x%x] "
+ "on [%s] from [%s]\n",
+ __func__, call->context->iface->name,
+ auth->auth_type,
+ auth->auth_level,
+ derpc_transport_string_by_transport(transport),
+ addr));
+ return dcesrv_fault(call, DCERPC_FAULT_ACCESS_DENIED);
+ }
+ break;
+ }
+
+ if (auth->auth_level < call->context->min_auth_level) {
+ char *addr;
+
+ addr = tsocket_address_string(call->conn->remote_address, call);
+
+ DEBUG(2, ("%s: restrict access by min_auth_level[0x%x] "
+ "to [%s] with auth[type=0x%x,level=0x%x] "
+ "on [%s] from [%s]\n",
+ __func__,
+ call->context->min_auth_level,
+ call->context->iface->name,
+ auth->auth_type,
+ auth->auth_level,
+ derpc_transport_string_by_transport(transport),
+ addr));
+ return dcesrv_fault(call, DCERPC_FAULT_ACCESS_DENIED);
+ }
+
+ pull = ndr_pull_init_blob(&call->pkt.u.request.stub_and_verifier, call);
+ NT_STATUS_HAVE_NO_MEMORY(pull);
+
+ pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+
+ call->ndr_pull = pull;
+
+ if (!(call->pkt.drep[0] & DCERPC_DREP_LE)) {
+ pull->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+
+ status = dcesrv_check_verification_trailer(call);
+ if (!NT_STATUS_IS_OK(status)) {
+ uint32_t faultcode = DCERPC_FAULT_OTHER;
+ if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+ faultcode = DCERPC_FAULT_ACCESS_DENIED;
+ }
+ DEBUG(10, ("dcesrv_check_verification_trailer failed: %s\n",
+ nt_errstr(status)));
+ return dcesrv_fault(call, faultcode);
+ }
+
+ /* unravel the NDR for the packet */
+ status = call->context->iface->ndr_pull(call, call, pull, &call->r);
+ if (!NT_STATUS_IS_OK(status)) {
+ uint8_t extra_flags = 0;
+ if (call->fault_code == DCERPC_FAULT_OP_RNG_ERROR) {
+ /* we got an unknown call */
+ DEBUG(3,(__location__ ": Unknown RPC call %u on %s\n",
+ call->pkt.u.request.opnum,
+ call->context->iface->name));
+ dcesrv_save_call(call, "unknown");
+ extra_flags |= DCERPC_PFC_FLAG_DID_NOT_EXECUTE;
+ } else {
+ dcesrv_save_call(call, "pullfail");
+ }
+
+ return dcesrv_fault_with_flags(call, call->fault_code, extra_flags);
+ }
+
+ dcesrv_save_ndr_fuzz_seed(call->pkt.u.request.stub_and_verifier,
+ call,
+ NDR_IN);
+
+ if (pull->offset != pull->data_size) {
+ dcesrv_save_call(call, "extrabytes");
+ DEBUG(3,("Warning: %d extra bytes in incoming RPC request\n",
+ pull->data_size - pull->offset));
+ }
+
+ if (call->state_flags & DCESRV_CALL_STATE_FLAG_WINBIND_OFF) {
+ bool winbind_active = !winbind_env_set();
+ if (winbind_active) {
+ DBG_DEBUG("turning winbind off\n");
+ (void)winbind_off();
+ turn_winbind_on = true;
+ }
+ }
+
+ /* call the dispatch function */
+ status = call->context->iface->dispatch(call, call, call->r);
+
+ if (turn_winbind_on) {
+ DBG_DEBUG("turning winbind on\n");
+ (void)winbind_on();
+ }
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(5,("dcerpc fault in call %s:%02x - %s\n",
+ call->context->iface->name,
+ call->pkt.u.request.opnum,
+ dcerpc_errstr(pull, call->fault_code)));
+ return dcesrv_fault(call, call->fault_code);
+ }
+
+ /* add the call to the pending list */
+ dcesrv_call_set_list(call, DCESRV_LIST_PENDING_CALL_LIST);
+
+ if (call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
+ return NT_STATUS_OK;
+ }
+
+ return dcesrv_reply(call);
+}
+
+
+/*
+ remove the call from the right list when freed
+ */
+static int dcesrv_call_dequeue(struct dcesrv_call_state *call)
+{
+ dcesrv_call_set_list(call, DCESRV_LIST_NONE);
+ return 0;
+}
+
+_PUBLIC_ const struct tsocket_address *dcesrv_connection_get_local_address(struct dcesrv_connection *conn)
+{
+ return conn->local_address;
+}
+
+_PUBLIC_ const struct tsocket_address *dcesrv_connection_get_remote_address(struct dcesrv_connection *conn)
+{
+ return conn->remote_address;
+}
+
+/*
+ process some input to a dcerpc endpoint server.
+*/
+static NTSTATUS dcesrv_process_ncacn_packet(struct dcesrv_connection *dce_conn,
+ struct ncacn_packet *pkt,
+ DATA_BLOB blob)
+{
+ NTSTATUS status;
+ struct dcesrv_call_state *call;
+ struct dcesrv_call_state *existing = NULL;
+ size_t num_auth_ctx = 0;
+ enum dcerpc_AuthType auth_type = 0;
+ enum dcerpc_AuthLevel auth_level = 0;
+ uint32_t auth_context_id = 0;
+ bool auth_invalid = false;
+
+ call = talloc_zero(dce_conn, struct dcesrv_call_state);
+ if (!call) {
+ data_blob_free(&blob);
+ talloc_free(pkt);
+ return NT_STATUS_NO_MEMORY;
+ }
+ call->conn = dce_conn;
+ call->event_ctx = dce_conn->event_ctx;
+ call->state_flags = call->conn->state_flags;
+ call->time = timeval_current();
+ call->list = DCESRV_LIST_NONE;
+
+ talloc_steal(call, pkt);
+ talloc_steal(call, blob.data);
+ call->pkt = *pkt;
+
+ if (dce_conn->max_auth_states == 0) {
+ call->auth_state = dce_conn->default_auth_state;
+ } else if (call->pkt.auth_length == 0) {
+ if (call->pkt.ptype == DCERPC_PKT_REQUEST &&
+ dce_conn->default_auth_level_connect != NULL)
+ {
+ call->auth_state = dce_conn->default_auth_level_connect;
+ } else {
+ call->auth_state = dce_conn->default_auth_state;
+ }
+ }
+
+ if (call->auth_state == NULL) {
+ struct dcesrv_auth *a = NULL;
+ bool check_type_level = true;
+
+ auth_type = dcerpc_get_auth_type(&blob);
+ auth_level = dcerpc_get_auth_level(&blob);
+ auth_context_id = dcerpc_get_auth_context_id(&blob);
+
+ if (call->pkt.ptype == DCERPC_PKT_REQUEST) {
+ if (!(call->pkt.pfc_flags & DCERPC_PFC_FLAG_FIRST)) {
+ check_type_level = false;
+ }
+ dce_conn->default_auth_level_connect = NULL;
+ if (auth_level == DCERPC_AUTH_LEVEL_CONNECT) {
+ dce_conn->got_explicit_auth_level_connect = true;
+ }
+ }
+
+ for (a = dce_conn->auth_states; a != NULL; a = a->next) {
+ num_auth_ctx++;
+
+ if (a->auth_context_id != auth_context_id) {
+ continue;
+ }
+
+ if (a->auth_type != auth_type) {
+ auth_invalid = true;
+ }
+ if (a->auth_level != auth_level) {
+ auth_invalid = true;
+ }
+
+ if (check_type_level && auth_invalid) {
+ a->auth_invalid = true;
+ }
+
+ DLIST_PROMOTE(dce_conn->auth_states, a);
+ call->auth_state = a;
+ break;
+ }
+ }
+
+ if (call->auth_state == NULL) {
+ struct dcesrv_auth *a = NULL;
+
+ if (num_auth_ctx >= dce_conn->max_auth_states) {
+ return dcesrv_fault_disconnect(call,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ a = dcesrv_auth_create(dce_conn);
+ if (a == NULL) {
+ talloc_free(call);
+ return NT_STATUS_NO_MEMORY;
+ }
+ DLIST_ADD(dce_conn->auth_states, a);
+ if (call->pkt.ptype == DCERPC_PKT_REQUEST) {
+ /*
+ * This can never be valid.
+ */
+ auth_invalid = true;
+ a->auth_invalid = true;
+ }
+ call->auth_state = a;
+ }
+
+ talloc_set_destructor(call, dcesrv_call_dequeue);
+
+ if (call->conn->allow_bind) {
+ /*
+ * Only one bind is possible per connection
+ */
+ call->conn->allow_bind = false;
+ return dcesrv_bind(call);
+ }
+
+ /* we have to check the signing here, before combining the
+ pdus */
+ if (call->pkt.ptype == DCERPC_PKT_REQUEST) {
+ dcesrv_default_auth_state_prepare_request(call);
+
+ if (call->auth_state->auth_started &&
+ !call->auth_state->auth_finished) {
+ return dcesrv_fault_disconnect(call,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ status = dcerpc_verify_ncacn_packet_header(&call->pkt,
+ DCERPC_PKT_REQUEST,
+ call->pkt.u.request.stub_and_verifier.length,
+ 0, /* required_flags */
+ DCERPC_PFC_FLAG_FIRST |
+ DCERPC_PFC_FLAG_LAST |
+ DCERPC_PFC_FLAG_PENDING_CANCEL |
+ 0x08 | /* this is not defined, but should be ignored */
+ DCERPC_PFC_FLAG_CONC_MPX |
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
+ DCERPC_PFC_FLAG_MAYBE |
+ DCERPC_PFC_FLAG_OBJECT_UUID);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_fault_disconnect(call,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ if (call->pkt.frag_length > DCERPC_FRAG_MAX_SIZE) {
+ /*
+ * We don't use dcesrv_fault_disconnect()
+ * here, because we don't want to set
+ * DCERPC_PFC_FLAG_DID_NOT_EXECUTE
+ *
+ * Note that we don't check against the negotiated
+ * max_recv_frag, but a hard coded value.
+ */
+ return dcesrv_fault_disconnect0(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ if (call->pkt.pfc_flags & DCERPC_PFC_FLAG_FIRST) {
+ if (dce_conn->pending_call_list != NULL) {
+ /*
+ * concurrent requests are only allowed
+ * if DCERPC_PFC_FLAG_CONC_MPX was negotiated.
+ */
+ if (!(dce_conn->state_flags & DCESRV_CALL_STATE_FLAG_MULTIPLEXED)) {
+ return dcesrv_fault_disconnect0(call,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+ }
+ /* only one request is possible in the fragmented list */
+ if (dce_conn->incoming_fragmented_call_list != NULL) {
+ call->fault_code = DCERPC_NCA_S_PROTO_ERROR;
+
+ existing = dcesrv_find_fragmented_call(dce_conn,
+ call->pkt.call_id);
+ if (existing != NULL && call->auth_state != existing->auth_state) {
+ call->context = dcesrv_find_context(call->conn,
+ call->pkt.u.request.context_id);
+
+ if (call->pkt.auth_length != 0 && existing->context == call->context) {
+ call->fault_code = DCERPC_FAULT_SEC_PKG_ERROR;
+ }
+ }
+ if (!(dce_conn->state_flags & DCESRV_CALL_STATE_FLAG_MULTIPLEXED)) {
+ /*
+ * Without DCERPC_PFC_FLAG_CONC_MPX
+ * we need to return the FAULT on the
+ * already existing call.
+ *
+ * This is important to get the
+ * call_id and context_id right.
+ */
+ dce_conn->incoming_fragmented_call_list->fault_code = call->fault_code;
+ TALLOC_FREE(call);
+ call = dce_conn->incoming_fragmented_call_list;
+ }
+ if (existing != NULL) {
+ call->context = existing->context;
+ }
+ return dcesrv_fault_disconnect0(call, call->fault_code);
+ }
+ if (call->pkt.pfc_flags & DCERPC_PFC_FLAG_PENDING_CANCEL) {
+ return dcesrv_fault_disconnect(call,
+ DCERPC_FAULT_NO_CALL_ACTIVE);
+ }
+ call->context = dcesrv_find_context(call->conn,
+ call->pkt.u.request.context_id);
+ if (call->context == NULL) {
+ return dcesrv_fault_with_flags(call, DCERPC_NCA_S_UNKNOWN_IF,
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE);
+ }
+ } else {
+ int cmp;
+
+ existing = dcesrv_find_fragmented_call(dce_conn,
+ call->pkt.call_id);
+ if (existing == NULL) {
+ if (!(dce_conn->state_flags & DCESRV_CALL_STATE_FLAG_MULTIPLEXED)) {
+ /*
+ * Without DCERPC_PFC_FLAG_CONC_MPX
+ * we need to return the FAULT on the
+ * already existing call.
+ *
+ * This is important to get the
+ * call_id and context_id right.
+ */
+ if (dce_conn->incoming_fragmented_call_list != NULL) {
+ TALLOC_FREE(call);
+ call = dce_conn->incoming_fragmented_call_list;
+ }
+ return dcesrv_fault_disconnect0(call,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+ if (dce_conn->incoming_fragmented_call_list != NULL) {
+ return dcesrv_fault_disconnect0(call, DCERPC_NCA_S_PROTO_ERROR);
+ }
+ call->context = dcesrv_find_context(call->conn,
+ call->pkt.u.request.context_id);
+ if (call->context == NULL) {
+ return dcesrv_fault_with_flags(call, DCERPC_NCA_S_UNKNOWN_IF,
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE);
+ }
+ if (auth_invalid) {
+ return dcesrv_fault_disconnect0(call,
+ DCERPC_FAULT_ACCESS_DENIED);
+ }
+ return dcesrv_fault_disconnect0(call,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+
+ if (call->pkt.ptype != existing->pkt.ptype) {
+ /* trying to play silly buggers are we? */
+ return dcesrv_fault_disconnect(existing,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+ cmp = memcmp(call->pkt.drep, existing->pkt.drep,
+ sizeof(pkt->drep));
+ if (cmp != 0) {
+ return dcesrv_fault_disconnect(existing,
+ DCERPC_NCA_S_PROTO_ERROR);
+ }
+ call->auth_state = existing->auth_state;
+ call->context = existing->context;
+ }
+ }
+
+ if (call->pkt.ptype == DCERPC_PKT_REQUEST) {
+ bool ok;
+ uint8_t payload_offset = DCERPC_REQUEST_LENGTH;
+
+ if (call->pkt.pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ payload_offset += 16;
+ }
+
+ ok = dcesrv_auth_pkt_pull(call, &blob,
+ 0, /* required_flags */
+ DCERPC_PFC_FLAG_FIRST |
+ DCERPC_PFC_FLAG_LAST |
+ DCERPC_PFC_FLAG_PENDING_CANCEL |
+ 0x08 | /* this is not defined, but should be ignored */
+ DCERPC_PFC_FLAG_CONC_MPX |
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
+ DCERPC_PFC_FLAG_MAYBE |
+ DCERPC_PFC_FLAG_OBJECT_UUID,
+ payload_offset,
+ &call->pkt.u.request.stub_and_verifier);
+ if (!ok) {
+ /*
+ * We don't use dcesrv_fault_disconnect()
+ * here, because we don't want to set
+ * DCERPC_PFC_FLAG_DID_NOT_EXECUTE
+ */
+ if (call->fault_code == 0) {
+ call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
+ }
+ return dcesrv_fault_disconnect0(call, call->fault_code);
+ }
+ }
+
+ /* see if this is a continued packet */
+ if (existing != NULL) {
+ struct dcerpc_request *er = &existing->pkt.u.request;
+ const struct dcerpc_request *nr = &call->pkt.u.request;
+ size_t available;
+ size_t alloc_size;
+ size_t alloc_hint;
+
+ /*
+ * Up to 4 MByte are allowed by all fragments
+ */
+ available = dce_conn->max_total_request_size;
+ if (er->stub_and_verifier.length > available) {
+ return dcesrv_fault_disconnect0(existing,
+ DCERPC_FAULT_ACCESS_DENIED);
+ }
+ available -= er->stub_and_verifier.length;
+ if (nr->alloc_hint > available) {
+ return dcesrv_fault_disconnect0(existing,
+ DCERPC_FAULT_ACCESS_DENIED);
+ }
+ if (nr->stub_and_verifier.length > available) {
+ return dcesrv_fault_disconnect0(existing,
+ DCERPC_FAULT_ACCESS_DENIED);
+ }
+ alloc_hint = er->stub_and_verifier.length + nr->alloc_hint;
+ /* allocate at least 1 byte */
+ alloc_hint = MAX(alloc_hint, 1);
+ alloc_size = er->stub_and_verifier.length +
+ nr->stub_and_verifier.length;
+ alloc_size = MAX(alloc_size, alloc_hint);
+
+ er->stub_and_verifier.data =
+ talloc_realloc(existing,
+ er->stub_and_verifier.data,
+ uint8_t, alloc_size);
+ if (er->stub_and_verifier.data == NULL) {
+ TALLOC_FREE(call);
+ return dcesrv_fault_with_flags(existing,
+ DCERPC_FAULT_OUT_OF_RESOURCES,
+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE);
+ }
+ memcpy(er->stub_and_verifier.data +
+ er->stub_and_verifier.length,
+ nr->stub_and_verifier.data,
+ nr->stub_and_verifier.length);
+ er->stub_and_verifier.length += nr->stub_and_verifier.length;
+
+ existing->pkt.pfc_flags |= (call->pkt.pfc_flags & DCERPC_PFC_FLAG_LAST);
+
+ TALLOC_FREE(call);
+ call = existing;
+ }
+
+ /* this may not be the last pdu in the chain - if its isn't then
+ just put it on the incoming_fragmented_call_list and wait for the rest */
+ if (call->pkt.ptype == DCERPC_PKT_REQUEST &&
+ !(call->pkt.pfc_flags & DCERPC_PFC_FLAG_LAST)) {
+ /*
+ * Up to 4 MByte are allowed by all fragments
+ */
+ if (call->pkt.u.request.alloc_hint > dce_conn->max_total_request_size) {
+ return dcesrv_fault_disconnect0(call,
+ DCERPC_FAULT_ACCESS_DENIED);
+ }
+ dcesrv_call_set_list(call, DCESRV_LIST_FRAGMENTED_CALL_LIST);
+ return NT_STATUS_OK;
+ }
+
+ /* This removes any fragments we may have had stashed away */
+ dcesrv_call_set_list(call, DCESRV_LIST_NONE);
+
+ switch (call->pkt.ptype) {
+ case DCERPC_PKT_BIND:
+ status = dcesrv_bind_nak(call,
+ DCERPC_BIND_NAK_REASON_NOT_SPECIFIED);
+ break;
+ case DCERPC_PKT_AUTH3:
+ status = dcesrv_auth3(call);
+ break;
+ case DCERPC_PKT_ALTER:
+ status = dcesrv_alter(call);
+ break;
+ case DCERPC_PKT_REQUEST:
+ status = dcesrv_request(call);
+ break;
+ case DCERPC_PKT_CO_CANCEL:
+ case DCERPC_PKT_ORPHANED:
+ /*
+ * Window just ignores CO_CANCEL and ORPHANED,
+ * so we do...
+ */
+ status = NT_STATUS_OK;
+ TALLOC_FREE(call);
+ break;
+ case DCERPC_PKT_BIND_ACK:
+ case DCERPC_PKT_BIND_NAK:
+ case DCERPC_PKT_ALTER_RESP:
+ case DCERPC_PKT_RESPONSE:
+ case DCERPC_PKT_FAULT:
+ case DCERPC_PKT_SHUTDOWN:
+ default:
+ status = dcesrv_fault_disconnect(call, DCERPC_NCA_S_PROTO_ERROR);
+ break;
+ }
+
+ /* if we are going to be sending a reply then add
+ it to the list of pending calls. We add it to the end to keep the call
+ list in the order we will answer */
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(call);
+ }
+
+ return status;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ struct dcesrv_context_callbacks *cb,
+ struct dcesrv_context **_dce_ctx)
+{
+ struct dcesrv_context *dce_ctx;
+
+ if (cb == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ dce_ctx = talloc_zero(mem_ctx, struct dcesrv_context);
+ NT_STATUS_HAVE_NO_MEMORY(dce_ctx);
+
+ if (uid_wrapper_enabled()) {
+ setenv("UID_WRAPPER_MYUID", "1", 1);
+ }
+ dce_ctx->initial_euid = geteuid();
+ if (uid_wrapper_enabled()) {
+ unsetenv("UID_WRAPPER_MYUID");
+ }
+
+ dce_ctx->endpoint_list = NULL;
+ dce_ctx->lp_ctx = lp_ctx;
+ dce_ctx->assoc_groups_idr = idr_init(dce_ctx);
+ if (dce_ctx->assoc_groups_idr == NULL) {
+ TALLOC_FREE(dce_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
+ dce_ctx->broken_connections = NULL;
+ dce_ctx->callbacks = cb;
+
+ *_dce_ctx = dce_ctx;
+ return NT_STATUS_OK;
+}
+
+/**
+ * @brief Set callback functions on an existing dcesrv_context
+ *
+ * This allows to reset callbacks initially set via
+ * dcesrv_init_context()
+ *
+ * @param[in] dce_ctx The context to set the callbacks on
+ * @param[in] cb The callbacks to set on dce_ctx
+ */
+_PUBLIC_ void dcesrv_context_set_callbacks(
+ struct dcesrv_context *dce_ctx,
+ struct dcesrv_context_callbacks *cb)
+{
+ dce_ctx->callbacks = cb;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_init_ep_servers(struct dcesrv_context *dce_ctx,
+ const char **endpoint_servers)
+{
+ NTSTATUS status;
+ int i;
+
+ if (endpoint_servers == NULL) {
+ DBG_ERR("No endpoint servers configured\n");
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ for (i=0;endpoint_servers[i];i++) {
+ status = dcesrv_init_ep_server(dce_ctx, endpoint_servers[i]);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("failed to init endpoint server = '%s': %s\n",
+ endpoint_servers[i], nt_errstr(status));
+ return status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+/* the list of currently registered DCERPC endpoint servers.
+ */
+static struct ep_server {
+ struct dcesrv_endpoint_server *ep_server;
+} *ep_servers = NULL;
+static int num_ep_servers = 0;
+
+_PUBLIC_ NTSTATUS dcesrv_init_registered_ep_servers(
+ struct dcesrv_context *dce_ctx)
+{
+ NTSTATUS status;
+ int i;
+
+ for (i = 0; i < num_ep_servers; i++) {
+ status = dcesrv_init_ep_server(dce_ctx,
+ ep_servers[i].ep_server->name);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_init_ep_server(struct dcesrv_context *dce_ctx,
+ const char *ep_server_name)
+{
+ struct dcesrv_endpoint_server *ep_server = NULL;
+ NTSTATUS status;
+
+ ep_server = discard_const_p(struct dcesrv_endpoint_server,
+ dcesrv_ep_server_byname(ep_server_name));
+ if (ep_server == NULL) {
+ DBG_ERR("Failed to find endpoint server '%s'\n",
+ ep_server_name);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ if (ep_server->initialized) {
+ return NT_STATUS_OK;
+ }
+
+ status = ep_server->init_server(dce_ctx, ep_server);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("Failed to init endpoint server '%s': %s\n",
+ ep_server_name, nt_errstr(status));
+ return status;
+ }
+
+ ep_server->initialized = true;
+
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_shutdown_registered_ep_servers(
+ struct dcesrv_context *dce_ctx)
+{
+ NTSTATUS status;
+ int i;
+
+ for (i = 0; i < num_ep_servers; i++) {
+ status = dcesrv_shutdown_ep_server(dce_ctx,
+ ep_servers[i].ep_server->name);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_shutdown_ep_server(struct dcesrv_context *dce_ctx,
+ const char *ep_server_name)
+{
+ struct dcesrv_endpoint_server *ep_server = NULL;
+ NTSTATUS status;
+
+ ep_server = discard_const_p(struct dcesrv_endpoint_server,
+ dcesrv_ep_server_byname(ep_server_name));
+ if (ep_server == NULL) {
+ DBG_ERR("Failed to find endpoint server '%s'\n",
+ ep_server_name);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ if (!ep_server->initialized) {
+ return NT_STATUS_OK;
+ }
+
+ DBG_INFO("Shutting down DCE/RPC endpoint server '%s'\n",
+ ep_server_name);
+
+ status = ep_server->shutdown_server(dce_ctx, ep_server);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("Failed to shutdown endpoint server '%s': %s\n",
+ ep_server_name, nt_errstr(status));
+ return status;
+ }
+
+ ep_server->initialized = false;
+
+ return NT_STATUS_OK;
+}
+
+/*
+ register a DCERPC endpoint server.
+
+ The 'name' can be later used by other backends to find the operations
+ structure for this backend.
+
+*/
+_PUBLIC_ NTSTATUS dcerpc_register_ep_server(const struct dcesrv_endpoint_server *ep_server)
+{
+
+ if (dcesrv_ep_server_byname(ep_server->name) != NULL) {
+ /* its already registered! */
+ DEBUG(0,("DCERPC endpoint server '%s' already registered\n",
+ ep_server->name));
+ return NT_STATUS_OBJECT_NAME_COLLISION;
+ }
+
+ ep_servers = realloc_p(ep_servers, struct ep_server, num_ep_servers+1);
+ if (!ep_servers) {
+ smb_panic("out of memory in dcerpc_register");
+ }
+
+ ep_servers[num_ep_servers].ep_server = smb_xmemdup(ep_server, sizeof(*ep_server));
+ ep_servers[num_ep_servers].ep_server->name = smb_xstrdup(ep_server->name);
+
+ num_ep_servers++;
+
+ DEBUG(3,("DCERPC endpoint server '%s' registered\n",
+ ep_server->name));
+
+ return NT_STATUS_OK;
+}
+
+/*
+ return the operations structure for a named backend of the specified type
+*/
+_PUBLIC_ const struct dcesrv_endpoint_server *dcesrv_ep_server_byname(const char *name)
+{
+ int i;
+
+ for (i=0;i<num_ep_servers;i++) {
+ if (strcmp(ep_servers[i].ep_server->name, name) == 0) {
+ return ep_servers[i].ep_server;
+ }
+ }
+
+ return NULL;
+}
+
+/*
+ return the DCERPC module version, and the size of some critical types
+ This can be used by endpoint server modules to either detect compilation errors, or provide
+ multiple implementations for different smbd compilation options in one module
+*/
+const struct dcesrv_critical_sizes *dcerpc_module_version(void)
+{
+ static const struct dcesrv_critical_sizes critical_sizes = {
+ DCERPC_MODULE_VERSION,
+ sizeof(struct dcesrv_context),
+ sizeof(struct dcesrv_endpoint),
+ sizeof(struct dcesrv_endpoint_server),
+ sizeof(struct dcesrv_interface),
+ sizeof(struct dcesrv_if_list),
+ sizeof(struct dcesrv_connection),
+ sizeof(struct dcesrv_call_state),
+ sizeof(struct dcesrv_auth),
+ sizeof(struct dcesrv_handle)
+ };
+
+ return &critical_sizes;
+}
+
+_PUBLIC_ void dcesrv_terminate_connection(struct dcesrv_connection *dce_conn, const char *reason)
+{
+ struct dcesrv_context *dce_ctx = dce_conn->dce_ctx;
+ struct dcesrv_auth *a = NULL;
+
+ dce_conn->wait_send = NULL;
+ dce_conn->wait_recv = NULL;
+ dce_conn->wait_private = NULL;
+
+ dce_conn->allow_bind = false;
+ dce_conn->allow_alter = false;
+
+ dce_conn->default_auth_state->auth_invalid = true;
+
+ for (a = dce_conn->auth_states; a != NULL; a = a->next) {
+ a->auth_invalid = true;
+ }
+
+ if (dce_conn->pending_call_list == NULL) {
+ char *full_reason = talloc_asprintf(dce_conn, "dcesrv: %s", reason);
+
+ DLIST_REMOVE(dce_ctx->broken_connections, dce_conn);
+ dce_conn->transport.terminate_connection(dce_conn,
+ full_reason ? full_reason : reason);
+ return;
+ }
+
+ if (dce_conn->terminate != NULL) {
+ return;
+ }
+
+ DEBUG(3,("dcesrv: terminating connection due to '%s' deferred due to pending calls\n",
+ reason));
+ dce_conn->terminate = talloc_strdup(dce_conn, reason);
+ if (dce_conn->terminate == NULL) {
+ dce_conn->terminate = "dcesrv: deferred terminating connection - no memory";
+ }
+ DLIST_ADD_END(dce_ctx->broken_connections, dce_conn);
+}
+
+_PUBLIC_ void dcesrv_cleanup_broken_connections(struct dcesrv_context *dce_ctx)
+{
+ struct dcesrv_connection *cur, *next;
+
+ next = dce_ctx->broken_connections;
+ while (next != NULL) {
+ cur = next;
+ next = cur->next;
+
+ if (cur->state_flags & DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL) {
+ struct dcesrv_connection_context *context_cur, *context_next;
+
+ context_next = cur->contexts;
+ while (context_next != NULL) {
+ context_cur = context_next;
+ context_next = context_cur->next;
+
+ dcesrv_connection_context_destructor(context_cur);
+ }
+ }
+
+ dcesrv_terminate_connection(cur, cur->terminate);
+ }
+}
+
+struct dcesrv_sock_reply_state {
+ struct dcesrv_connection *dce_conn;
+ struct dcesrv_call_state *call;
+ struct iovec iov;
+};
+
+static void dcesrv_sock_reply_done(struct tevent_req *subreq);
+static void dcesrv_call_terminate_step1(struct tevent_req *subreq);
+
+_PUBLIC_ void dcesrv_sock_report_output_data(struct dcesrv_connection *dce_conn)
+{
+ struct dcesrv_call_state *call;
+
+ call = dce_conn->call_list;
+ if (!call || !call->replies) {
+ return;
+ }
+
+ while (call->replies) {
+ struct data_blob_list_item *rep = call->replies;
+ struct dcesrv_sock_reply_state *substate;
+ struct tevent_req *subreq;
+
+ substate = talloc_zero(call, struct dcesrv_sock_reply_state);
+ if (!substate) {
+ dcesrv_terminate_connection(dce_conn, "no memory");
+ return;
+ }
+
+ substate->dce_conn = dce_conn;
+ substate->call = NULL;
+
+ DLIST_REMOVE(call->replies, rep);
+
+ if (call->replies == NULL && call->terminate_reason == NULL) {
+ substate->call = call;
+ }
+
+ substate->iov.iov_base = (void *) rep->blob.data;
+ substate->iov.iov_len = rep->blob.length;
+
+ subreq = tstream_writev_queue_send(substate,
+ dce_conn->event_ctx,
+ dce_conn->stream,
+ dce_conn->send_queue,
+ &substate->iov, 1);
+ if (!subreq) {
+ dcesrv_terminate_connection(dce_conn, "no memory");
+ return;
+ }
+ tevent_req_set_callback(subreq, dcesrv_sock_reply_done,
+ substate);
+ }
+
+ if (call->terminate_reason != NULL) {
+ struct tevent_req *subreq;
+
+ subreq = tevent_queue_wait_send(call,
+ dce_conn->event_ctx,
+ dce_conn->send_queue);
+ if (!subreq) {
+ dcesrv_terminate_connection(dce_conn, __location__);
+ return;
+ }
+ tevent_req_set_callback(subreq, dcesrv_call_terminate_step1,
+ call);
+ }
+
+ DLIST_REMOVE(call->conn->call_list, call);
+ call->list = DCESRV_LIST_NONE;
+}
+
+static void dcesrv_sock_reply_done(struct tevent_req *subreq)
+{
+ struct dcesrv_sock_reply_state *substate = tevent_req_callback_data(subreq,
+ struct dcesrv_sock_reply_state);
+ int ret;
+ int sys_errno;
+ NTSTATUS status;
+ struct dcesrv_call_state *call = substate->call;
+
+ ret = tstream_writev_queue_recv(subreq, &sys_errno);
+ TALLOC_FREE(subreq);
+ if (ret == -1) {
+ status = map_nt_error_from_unix_common(sys_errno);
+ dcesrv_terminate_connection(substate->dce_conn, nt_errstr(status));
+ return;
+ }
+
+ talloc_free(substate);
+ if (call) {
+ talloc_free(call);
+ }
+}
+
+static void dcesrv_call_terminate_step2(struct tevent_req *subreq);
+
+static void dcesrv_call_terminate_step1(struct tevent_req *subreq)
+{
+ struct dcesrv_call_state *call = tevent_req_callback_data(subreq,
+ struct dcesrv_call_state);
+ bool ok;
+ struct timeval tv;
+
+ /* make sure we stop send queue before removing subreq */
+ tevent_queue_stop(call->conn->send_queue);
+
+ ok = tevent_queue_wait_recv(subreq);
+ TALLOC_FREE(subreq);
+ if (!ok) {
+ dcesrv_terminate_connection(call->conn, __location__);
+ return;
+ }
+
+ /* disconnect after 200 usecs */
+ tv = timeval_current_ofs_usec(200);
+ subreq = tevent_wakeup_send(call, call->conn->event_ctx, tv);
+ if (subreq == NULL) {
+ dcesrv_terminate_connection(call->conn, __location__);
+ return;
+ }
+ tevent_req_set_callback(subreq, dcesrv_call_terminate_step2,
+ call);
+}
+
+static void dcesrv_call_terminate_step2(struct tevent_req *subreq)
+{
+ struct dcesrv_call_state *call = tevent_req_callback_data(subreq,
+ struct dcesrv_call_state);
+ bool ok;
+
+ ok = tevent_wakeup_recv(subreq);
+ TALLOC_FREE(subreq);
+ if (!ok) {
+ dcesrv_terminate_connection(call->conn, __location__);
+ return;
+ }
+
+ dcesrv_terminate_connection(call->conn, call->terminate_reason);
+}
+
+static void dcesrv_conn_wait_done(struct tevent_req *subreq);
+
+static void dcesrv_read_fragment_done(struct tevent_req *subreq)
+{
+ struct dcesrv_connection *dce_conn = tevent_req_callback_data(subreq,
+ struct dcesrv_connection);
+ struct dcesrv_context *dce_ctx = dce_conn->dce_ctx;
+ struct ncacn_packet *pkt;
+ DATA_BLOB buffer;
+ NTSTATUS status;
+
+ if (dce_conn->terminate) {
+ /*
+ * if the current connection is broken
+ * we need to clean it up before any other connection
+ */
+ dcesrv_terminate_connection(dce_conn, dce_conn->terminate);
+ dcesrv_cleanup_broken_connections(dce_ctx);
+ return;
+ }
+
+ dcesrv_cleanup_broken_connections(dce_ctx);
+
+ status = dcerpc_read_ncacn_packet_recv(subreq, dce_conn,
+ &pkt, &buffer);
+ TALLOC_FREE(subreq);
+ if (!NT_STATUS_IS_OK(status)) {
+ dcesrv_terminate_connection(dce_conn, nt_errstr(status));
+ return;
+ }
+
+ dcesrv_loop_next_packet(dce_conn, pkt, buffer);
+}
+
+/**
+ * @brief Start the dcesrv loop, inducing the bind as a blob
+ *
+ * Like dcesrv_connection_loop_start() but used from connections
+ * where the caller has already read the dcerpc bind packet from
+ * the socket and is available as a DATA_BLOB.
+ *
+ * @param[in] dce_conn The connection to start
+ * @param[in] pkt The parsed bind packet
+ * @param[in] buffer The full binary bind including auth data
+ */
+void dcesrv_loop_next_packet(
+ struct dcesrv_connection *dce_conn,
+ struct ncacn_packet *pkt,
+ DATA_BLOB buffer)
+{
+ struct tevent_req *subreq = NULL;
+ NTSTATUS status;
+
+ status = dcesrv_process_ncacn_packet(dce_conn, pkt, buffer);
+ if (!NT_STATUS_IS_OK(status)) {
+ dcesrv_terminate_connection(dce_conn, nt_errstr(status));
+ return;
+ }
+
+ /*
+ * This is used to block the connection during
+ * pending authentication.
+ */
+ if (dce_conn->wait_send != NULL) {
+ subreq = dce_conn->wait_send(dce_conn,
+ dce_conn->event_ctx,
+ dce_conn->wait_private);
+ if (!subreq) {
+ status = NT_STATUS_NO_MEMORY;
+ dcesrv_terminate_connection(dce_conn, nt_errstr(status));
+ return;
+ }
+ tevent_req_set_callback(subreq, dcesrv_conn_wait_done, dce_conn);
+ return;
+ }
+
+ subreq = dcerpc_read_ncacn_packet_send(dce_conn,
+ dce_conn->event_ctx,
+ dce_conn->stream);
+ if (!subreq) {
+ status = NT_STATUS_NO_MEMORY;
+ dcesrv_terminate_connection(dce_conn, nt_errstr(status));
+ return;
+ }
+ tevent_req_set_callback(subreq, dcesrv_read_fragment_done, dce_conn);
+}
+
+static void dcesrv_conn_wait_done(struct tevent_req *subreq)
+{
+ struct dcesrv_connection *dce_conn = tevent_req_callback_data(subreq,
+ struct dcesrv_connection);
+ struct dcesrv_context *dce_ctx = dce_conn->dce_ctx;
+ NTSTATUS status;
+
+ if (dce_conn->terminate) {
+ /*
+ * if the current connection is broken
+ * we need to clean it up before any other connection
+ */
+ dcesrv_terminate_connection(dce_conn, dce_conn->terminate);
+ dcesrv_cleanup_broken_connections(dce_ctx);
+ return;
+ }
+
+ dcesrv_cleanup_broken_connections(dce_ctx);
+
+ status = dce_conn->wait_recv(subreq);
+ dce_conn->wait_send = NULL;
+ dce_conn->wait_recv = NULL;
+ dce_conn->wait_private = NULL;
+ TALLOC_FREE(subreq);
+ if (!NT_STATUS_IS_OK(status)) {
+ dcesrv_terminate_connection(dce_conn, nt_errstr(status));
+ return;
+ }
+
+ status = dcesrv_connection_loop_start(dce_conn);
+ if (!NT_STATUS_IS_OK(status)) {
+ dcesrv_terminate_connection(dce_conn, nt_errstr(status));
+ return;
+ }
+}
+
+/**
+ * retrieve credentials from a dce_call
+ */
+_PUBLIC_ struct cli_credentials *dcesrv_call_credentials(struct dcesrv_call_state *dce_call)
+{
+ struct dcesrv_auth *auth = dce_call->auth_state;
+ SMB_ASSERT(auth->auth_finished);
+ return auth->session_info->credentials;
+}
+
+/**
+ * returns true if this is an authenticated call
+ */
+_PUBLIC_ bool dcesrv_call_authenticated(struct dcesrv_call_state *dce_call)
+{
+ struct dcesrv_auth *auth = dce_call->auth_state;
+ enum security_user_level level;
+ SMB_ASSERT(auth->auth_finished);
+ level = security_session_user_level(auth->session_info, NULL);
+ return level >= SECURITY_USER;
+}
+
+/**
+ * retrieve account_name for a dce_call
+ */
+_PUBLIC_ const char *dcesrv_call_account_name(struct dcesrv_call_state *dce_call)
+{
+ struct dcesrv_auth *auth = dce_call->auth_state;
+ SMB_ASSERT(auth->auth_finished);
+ return auth->session_info->info->account_name;
+}
+
+/**
+ * retrieve session_info from a dce_call
+ */
+_PUBLIC_ struct auth_session_info *dcesrv_call_session_info(struct dcesrv_call_state *dce_call)
+{
+ struct dcesrv_auth *auth = dce_call->auth_state;
+ SMB_ASSERT(auth->auth_finished);
+ return auth->session_info;
+}
+
+/**
+ * retrieve auth type/level from a dce_call
+ */
+_PUBLIC_ void dcesrv_call_auth_info(struct dcesrv_call_state *dce_call,
+ enum dcerpc_AuthType *auth_type,
+ enum dcerpc_AuthLevel *auth_level)
+{
+ struct dcesrv_auth *auth = dce_call->auth_state;
+
+ SMB_ASSERT(auth->auth_finished);
+
+ if (auth_type != NULL) {
+ *auth_type = auth->auth_type;
+ }
+ if (auth_level != NULL) {
+ *auth_level = auth->auth_level;
+ }
+}
+
+_PUBLIC_ NTSTATUS dcesrv_connection_loop_start(struct dcesrv_connection *conn)
+{
+ struct tevent_req *subreq;
+
+ subreq = dcerpc_read_ncacn_packet_send(conn,
+ conn->event_ctx,
+ conn->stream);
+ if (subreq == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ tevent_req_set_callback(subreq, dcesrv_read_fragment_done, conn);
+
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcesrv_call_dispatch_local(struct dcesrv_call_state *call)
+{
+ NTSTATUS status;
+ struct ndr_pull *pull = NULL;
+ struct ndr_push *push = NULL;
+ struct data_blob_list_item *rep = NULL;
+
+ pull = ndr_pull_init_blob(&call->pkt.u.request.stub_and_verifier,
+ call);
+ if (pull == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+
+ call->ndr_pull = pull;
+
+ /* unravel the NDR for the packet */
+ status = call->context->iface->ndr_pull(call, call, pull, &call->r);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_INFO("DCE/RPC fault in call %s:%02X - %s\n",
+ call->context->iface->name,
+ call->pkt.u.request.opnum,
+ dcerpc_errstr(call, call->fault_code));
+ return dcerpc_fault_to_nt_status(call->fault_code);
+ }
+
+ status = call->context->iface->local(call, call, call->r);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_INFO("DCE/RPC fault in call %s:%02X - %s\n",
+ call->context->iface->name,
+ call->pkt.u.request.opnum,
+ dcerpc_errstr(call, call->fault_code));
+ return dcerpc_fault_to_nt_status(call->fault_code);
+ }
+
+ /* This can never go async for now! */
+ SMB_ASSERT(!(call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC));
+
+ /* call the reply function */
+ status = call->context->iface->reply(call, call, call->r);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_INFO("DCE/RPC fault in call %s:%02X - %s\n",
+ call->context->iface->name,
+ call->pkt.u.request.opnum,
+ dcerpc_errstr(call, call->fault_code));
+ return dcerpc_fault_to_nt_status(call->fault_code);
+ }
+
+ push = ndr_push_init_ctx(call);
+ if (push == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ push->ptr_count = call->ndr_pull->ptr_count;
+
+ status = call->context->iface->ndr_push(call, call, push, call->r);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_INFO("DCE/RPC fault in call %s:%02X - %s\n",
+ call->context->iface->name,
+ call->pkt.u.request.opnum,
+ dcerpc_errstr(call, call->fault_code));
+ return dcerpc_fault_to_nt_status(call->fault_code);
+ }
+
+ rep = talloc_zero(call, struct data_blob_list_item);
+ if (rep == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ rep->blob = ndr_push_blob(push);
+ DLIST_ADD_END(call->replies, rep);
+
+ return NT_STATUS_OK;
+}
diff --git a/librpc/rpc/dcesrv_core.h b/librpc/rpc/dcesrv_core.h
new file mode 100644
index 0000000..aefb3f1
--- /dev/null
+++ b/librpc/rpc/dcesrv_core.h
@@ -0,0 +1,669 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ server side dcerpc defines
+
+ Copyright (C) Andrew Tridgell 2003-2005
+ Copyright (C) Stefan (metze) Metzmacher 2004-2005
+ Copyright (C) Samuel Cabrero <scabrero@samba.org> 2019
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _LIBRPC_RPC_DCESRV_CORE_H_
+#define _LIBRPC_RPC_DCESRV_CORE_H_
+
+#include "librpc/rpc/rpc_common.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/security.h"
+
+/* modules can use the following to determine if the interface has changed
+ * please increment the version number after each interface change
+ * with a comment and maybe update struct dcesrv_critical_sizes.
+ */
+/* version 1 - initial version - metze */
+#define DCERPC_MODULE_VERSION 1
+
+struct dcesrv_connection;
+struct dcesrv_call_state;
+struct dcesrv_auth;
+struct dcesrv_connection_context;
+struct dcesrv_iface_state;
+struct cli_credentials;
+
+struct dcesrv_interface {
+ const char *name;
+ struct ndr_syntax_id syntax_id;
+
+ /* this function is called when the client binds to this interface */
+ NTSTATUS (*bind)(struct dcesrv_connection_context *, const struct dcesrv_interface *);
+
+ /* this function is called when the client disconnects the endpoint */
+ void (*unbind)(struct dcesrv_connection_context *, const struct dcesrv_interface *);
+
+ /* the ndr_pull function for the chosen interface.
+ */
+ NTSTATUS (*ndr_pull)(struct dcesrv_call_state *, TALLOC_CTX *, struct ndr_pull *, void **);
+
+ /* the dispatch function for the chosen interface.
+ */
+ NTSTATUS (*dispatch)(struct dcesrv_call_state *, TALLOC_CTX *, void *);
+
+ /* the reply function for the chosen interface.
+ */
+ NTSTATUS (*reply)(struct dcesrv_call_state *, TALLOC_CTX *, void *);
+
+ /* the ndr_push function for the chosen interface.
+ */
+ NTSTATUS (*ndr_push)(struct dcesrv_call_state *, TALLOC_CTX *, struct ndr_push *, const void *);
+
+ /* the local dispatch function for the chosen interface.
+ */
+ NTSTATUS (*local)(struct dcesrv_call_state *, TALLOC_CTX *, void *);
+
+ /* for any private use by the interface code */
+ const void *private_data;
+
+ uint64_t flags;
+};
+
+#define DCESRV_INTERFACE_FLAGS_HANDLES_NOT_USED 0x00000001
+
+enum dcesrv_call_list {
+ DCESRV_LIST_NONE,
+ DCESRV_LIST_CALL_LIST,
+ DCESRV_LIST_FRAGMENTED_CALL_LIST,
+ DCESRV_LIST_PENDING_CALL_LIST
+};
+
+struct data_blob_list_item {
+ struct data_blob_list_item *prev,*next;
+ DATA_BLOB blob;
+};
+
+/* the state of an ongoing dcerpc call */
+struct dcesrv_call_state {
+ struct dcesrv_call_state *next, *prev;
+ struct dcesrv_auth *auth_state;
+ struct dcesrv_connection *conn;
+ struct dcesrv_connection_context *context;
+ struct ncacn_packet pkt;
+
+ /*
+ * Used during async bind/alter_context.
+ */
+ struct ncacn_packet ack_pkt;
+
+ /*
+ which list this request is in, if any
+ */
+ enum dcesrv_call_list list;
+
+ /* the backend can mark the call
+ * with DCESRV_CALL_STATE_FLAG_ASYNC
+ * that will cause the frontend to not touch r->out
+ * and skip the reply
+ *
+ * this is only allowed to the backend when DCESRV_CALL_STATE_FLAG_MAY_ASYNC
+ * is already set by the frontend
+ *
+ * the backend then needs to call dcesrv_reply() when it's
+ * ready to send the reply
+ */
+#define DCESRV_CALL_STATE_FLAG_ASYNC (1<<0)
+#define DCESRV_CALL_STATE_FLAG_MAY_ASYNC (1<<1)
+#define DCESRV_CALL_STATE_FLAG_MULTIPLEXED (1<<3)
+#define DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL (1<<4)
+#define DCESRV_CALL_STATE_FLAG_WINBIND_OFF (1 << 5)
+ uint32_t state_flags;
+
+ /* the time the request arrived in the server */
+ struct timeval time;
+
+ /* the backend can use this event context for async replies */
+ struct tevent_context *event_ctx;
+
+ /* this is the pointer to the allocated function struct */
+ void *r;
+
+ /*
+ * that's the ndr pull context used in dcesrv_request()
+ * needed by dcesrv_reply() to carry over information
+ * for full pointer support.
+ */
+ struct ndr_pull *ndr_pull;
+
+ DATA_BLOB input;
+
+ struct data_blob_list_item *replies;
+
+ /* this is used by the boilerplate code to generate DCERPC faults */
+ uint32_t fault_code;
+
+ /* the reason why we terminate the connection after sending a response */
+ const char *terminate_reason;
+
+ /* temporary auth_info fields */
+ struct dcerpc_auth in_auth_info;
+ struct dcerpc_auth _out_auth_info;
+ struct dcerpc_auth *out_auth_info;
+};
+
+/*
+* DCERPC Handles
+* --------------
+* The various handles that are used in the RPC servers should be
+* created and fetch using the dcesrv_handle_* functions.
+*
+* Use
+* dcesrv_handle_create(struct dcesrv_call_state \*, uint8 handle_type)
+* to obtain a new handle of the specified type. Handle types are
+* unique within each pipe.
+*
+* The handle can later be fetched again using:
+*
+* struct dcesrv_handle *dcesrv_handle_lookup(
+* struct dcesrv_call_state *dce_call,
+* struct policy_handle *p,
+* uint8 handle_type)
+*
+* and destroyed by:
+*
+* TALLOC_FREE(struct dcesrv_handle *).
+*
+* User data should be stored in the 'data' member of the dcesrv_handle
+* struct.
+*/
+
+#define DCESRV_HANDLE_ANY 255
+
+/* a dcerpc handle in internal format */
+struct dcesrv_handle {
+ struct dcesrv_handle *next, *prev;
+ struct dcesrv_assoc_group *assoc_group;
+ struct policy_handle wire_handle;
+ struct dom_sid sid;
+ enum dcerpc_AuthLevel min_auth_level;
+ const struct dcesrv_interface *iface;
+ void *data;
+};
+
+/* hold the authentication state information */
+struct dcesrv_auth {
+ struct dcesrv_auth *prev, *next;
+ enum dcerpc_AuthType auth_type;
+ enum dcerpc_AuthLevel auth_level;
+ uint32_t auth_context_id;
+ struct gensec_security *gensec_security;
+ struct auth_session_info *session_info;
+ NTSTATUS (*session_key_fn)(struct dcesrv_auth *, DATA_BLOB *session_key);
+ bool auth_started;
+ bool auth_finished;
+ bool auth_audited;
+ bool auth_invalid;
+};
+
+struct dcesrv_connection_context {
+ struct dcesrv_connection_context *next, *prev;
+ uint16_t context_id;
+
+ /* the connection this is on */
+ struct dcesrv_connection *conn;
+
+ /* the ndr function table for the chosen interface */
+ const struct dcesrv_interface *iface;
+
+ /*
+ * the minimum required auth level for this interface
+ */
+ enum dcerpc_AuthLevel min_auth_level;
+ bool allow_connect;
+
+ /* the negotiated transfer syntax */
+ struct ndr_syntax_id transfer_syntax;
+};
+
+
+/* the state associated with a dcerpc server connection */
+struct dcesrv_connection {
+ /* for the broken_connections DLIST */
+ struct dcesrv_connection *prev, *next;
+
+ /* the top level context for this server */
+ struct dcesrv_context *dce_ctx;
+
+ /* the endpoint that was opened */
+ const struct dcesrv_endpoint *endpoint;
+
+ /* a list of established context_ids */
+ struct dcesrv_connection_context *contexts;
+
+ /* the state of the current incoming call fragments */
+ struct dcesrv_call_state *incoming_fragmented_call_list;
+
+ /* the state of the async pending calls */
+ struct dcesrv_call_state *pending_call_list;
+
+ /* the state of the current outgoing calls */
+ struct dcesrv_call_state *call_list;
+
+ /* the maximum size the client wants to receive */
+ uint16_t max_recv_frag;
+ uint16_t max_xmit_frag;
+
+ DATA_BLOB partial_input;
+
+ /* the event_context that will be used for this connection */
+ struct tevent_context *event_ctx;
+
+ /* is this connection pending termination? If so, why? */
+ const char *terminate;
+
+ const char *packet_log_dir;
+
+ /* this is the default state_flags for dcesrv_call_state structs */
+ uint32_t state_flags;
+
+ struct {
+ void *private_data;
+ void (*report_output_data)(struct dcesrv_connection *);
+ void (*terminate_connection)(struct dcesrv_connection *,
+ const char *);
+ } transport;
+
+ struct tstream_context *stream;
+ struct tevent_queue *send_queue;
+
+ const struct tsocket_address *local_address;
+ const struct tsocket_address *remote_address;
+
+ /* the current authentication state */
+ struct dcesrv_auth *default_auth_state;
+ size_t max_auth_states;
+ struct dcesrv_auth *auth_states;
+ bool got_explicit_auth_level_connect;
+ struct dcesrv_auth *default_auth_level_connect;
+ bool client_hdr_signing;
+ bool support_hdr_signing;
+ bool negotiated_hdr_signing;
+
+ /*
+ * remember which pdu types are allowed
+ */
+ bool allow_bind;
+ bool allow_alter;
+
+ /* the association group the connection belongs to */
+ struct dcesrv_assoc_group *assoc_group;
+
+ /* The maximum total payload of reassembled request pdus */
+ size_t max_total_request_size;
+
+ /*
+ * Our preferred transfer syntax.
+ */
+ const struct ndr_syntax_id *preferred_transfer;
+
+ /*
+ * This is used to block the connection during
+ * pending authentication.
+ */
+ struct tevent_req *(*wait_send)(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ void *private_data);
+ NTSTATUS (*wait_recv)(struct tevent_req *req);
+ void *wait_private;
+};
+
+
+struct dcesrv_endpoint_server {
+ /* this is the name of the endpoint server */
+ const char *name;
+
+ /* true if the endpoint server has been initialized */
+ bool initialized;
+
+ /* this function should register endpoints and some other setup stuff,
+ * it is called when the dcesrv_context gets initialized.
+ */
+ NTSTATUS (*init_server)(struct dcesrv_context *, const struct dcesrv_endpoint_server *);
+
+ /* this function should cleanup endpoint server state and unregister
+ * the endpoint server from dcesrv_context */
+ NTSTATUS (*shutdown_server)(struct dcesrv_context *, const struct dcesrv_endpoint_server *);
+
+ /* this function can be used by other endpoint servers to
+ * ask for a dcesrv_interface implementation
+ * - iface must be reference to an already existing struct !
+ */
+ bool (*interface_by_uuid)(struct dcesrv_interface *iface, const struct GUID *, uint32_t);
+
+ /* this function can be used by other endpoint servers to
+ * ask for a dcesrv_interface implementation
+ * - iface must be reference to an already existing struct !
+ */
+ bool (*interface_by_name)(struct dcesrv_interface *iface, const char *);
+};
+
+
+/* one association groups */
+struct dcesrv_assoc_group {
+ /* the wire id */
+ uint32_t id;
+
+ /* The transport this is valid on */
+ enum dcerpc_transport_t transport;
+
+ /* list of handles in this association group */
+ struct dcesrv_handle *handles;
+
+ /*
+ * list of iface states per assoc/conn
+ */
+ struct dcesrv_iface_state *iface_states;
+
+ /* parent context */
+ struct dcesrv_context *dce_ctx;
+
+ /* the negotiated bind time features */
+ uint16_t bind_time_features;
+};
+
+struct dcesrv_context_callbacks {
+ struct {
+ void (*successful_authz)(
+ struct dcesrv_call_state *call, void *private_data);
+ void *private_data;
+ } log;
+ struct {
+ NTSTATUS (*gensec_prepare)(
+ TALLOC_CTX *mem_ctx,
+ struct dcesrv_call_state *call,
+ struct gensec_security **out,
+ void *private_data);
+ void *private_data;
+ void (*become_root)(void);
+ void (*unbecome_root)(void);
+ } auth;
+ struct {
+ NTSTATUS (*find)(
+ struct dcesrv_call_state *call, void *private_data);
+ void *private_data;
+ } assoc_group;
+};
+
+/* server-wide context information for the dcerpc server */
+struct dcesrv_context {
+ /*
+ * The euid at startup time.
+ *
+ * This is required for DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM
+ */
+ uid_t initial_euid;
+
+ /* the list of endpoints that have registered
+ * by the configured endpoint servers
+ */
+ struct dcesrv_endpoint {
+ struct dcesrv_endpoint *next, *prev;
+ /* the type and location of the endpoint */
+ struct dcerpc_binding *ep_description;
+ /* the secondary endpoint description for the BIND_ACK */
+ struct dcerpc_binding *ep_2nd_description;
+ /* the security descriptor for smb named pipes */
+ struct security_descriptor *sd;
+ /* the list of interfaces available on this endpoint */
+ struct dcesrv_if_list {
+ struct dcesrv_if_list *next, *prev;
+ struct dcesrv_interface *iface;
+ } *interface_list;
+
+ /*
+ * Should this service be run in a single process (so far only
+ * NETLOGON is not run in a single process)
+ */
+ bool use_single_process;
+ } *endpoint_list;
+
+ /* loadparm context to use for this connection */
+ struct loadparm_context *lp_ctx;
+
+ struct idr_context *assoc_groups_idr;
+
+ struct dcesrv_connection *broken_connections;
+
+ struct dcesrv_context_callbacks *callbacks;
+};
+
+/* this structure is used by modules to determine the size of some critical types */
+struct dcesrv_critical_sizes {
+ int interface_version;
+ int sizeof_dcesrv_context;
+ int sizeof_dcesrv_endpoint;
+ int sizeof_dcesrv_endpoint_server;
+ int sizeof_dcesrv_interface;
+ int sizeof_dcesrv_if_list;
+ int sizeof_dcesrv_connection;
+ int sizeof_dcesrv_call_state;
+ int sizeof_dcesrv_auth;
+ int sizeof_dcesrv_handle;
+};
+
+NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx,
+ const char *ep_name,
+ const char *ncacn_np_secondary_endpoint,
+ const struct dcesrv_interface *iface,
+ const struct security_descriptor *sd);
+NTSTATUS dcesrv_interface_register_b(struct dcesrv_context *dce_ctx,
+ struct dcerpc_binding *binding,
+ struct dcerpc_binding *binding2,
+ const struct dcesrv_interface *iface,
+ const struct security_descriptor *sd);
+NTSTATUS dcerpc_register_ep_server(const struct dcesrv_endpoint_server *ep_server);
+NTSTATUS dcesrv_init_ep_servers(struct dcesrv_context *dce_ctx,
+ const char **ep_servers);
+NTSTATUS dcesrv_init_registered_ep_servers(struct dcesrv_context *dce_ctx);
+NTSTATUS dcesrv_shutdown_registered_ep_servers(struct dcesrv_context *dce_ctx);
+NTSTATUS dcesrv_init_ep_server(struct dcesrv_context *dce_ctx,
+ const char *ep_server_name);
+NTSTATUS dcesrv_shutdown_ep_server(struct dcesrv_context *dce_ctx,
+ const char *name);
+const struct dcesrv_endpoint_server *dcesrv_ep_server_byname(const char *name);
+
+NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ struct dcesrv_context_callbacks *cb,
+ struct dcesrv_context **_dce_ctx);
+void dcesrv_context_set_callbacks(
+ struct dcesrv_context *dce_ctx,
+ struct dcesrv_context_callbacks *cb);
+
+NTSTATUS dcesrv_reply(struct dcesrv_call_state *call);
+struct dcesrv_handle *dcesrv_handle_create(struct dcesrv_call_state *call,
+ uint8_t handle_type);
+
+struct dcesrv_handle *dcesrv_handle_lookup(struct dcesrv_call_state *call,
+ const struct policy_handle *p,
+ uint8_t handle_type);
+
+const struct tsocket_address *dcesrv_connection_get_local_address(struct dcesrv_connection *conn);
+const struct tsocket_address *dcesrv_connection_get_remote_address(struct dcesrv_connection *conn);
+
+/*
+ * Fetch the authentication session key if available.
+ *
+ * This is the key generated by a gensec authentication.
+ */
+NTSTATUS dcesrv_auth_session_key(struct dcesrv_call_state *call,
+ DATA_BLOB *session_key);
+
+/*
+ * Fetch the transport session key if available.
+ * Typically this is the SMB session key
+ * or a fixed key for local transports.
+ *
+ * The key is always truncated to 16 bytes.
+*/
+NTSTATUS dcesrv_transport_session_key(struct dcesrv_call_state *call,
+ DATA_BLOB *session_key);
+
+/* a useful macro for generating a RPC fault in the backend code */
+#define DCESRV_FAULT(code) do { \
+ dce_call->fault_code = code; \
+ return r->out.result; \
+} while(0)
+
+/* a useful macro for generating a RPC fault in the backend code */
+#define DCESRV_FAULT_VOID(code) do { \
+ dce_call->fault_code = code; \
+ return; \
+} while(0)
+
+/* a useful macro for checking the validity of a dcerpc policy handle
+ and giving the right fault code if invalid */
+#define DCESRV_CHECK_HANDLE(h) do {if (!(h)) DCESRV_FAULT(DCERPC_FAULT_CONTEXT_MISMATCH); } while (0)
+
+/* this checks for a valid policy handle, and gives a fault if an
+ invalid handle or retval if the handle is of the
+ wrong type */
+#define DCESRV_PULL_HANDLE_RETVAL(h, inhandle, t, retval) do { \
+ (h) = dcesrv_handle_lookup(dce_call, (inhandle), DCESRV_HANDLE_ANY); \
+ DCESRV_CHECK_HANDLE(h); \
+ if ((t) != DCESRV_HANDLE_ANY && (h)->wire_handle.handle_type != (t)) { \
+ return retval; \
+ } \
+} while (0)
+
+/* this checks for a valid policy handle and gives a dcerpc fault
+ if its the wrong type of handle */
+#define DCESRV_PULL_HANDLE_FAULT(h, inhandle, t) do { \
+ (h) = dcesrv_handle_lookup(dce_call, (inhandle), t); \
+ DCESRV_CHECK_HANDLE(h); \
+} while (0)
+
+#define DCESRV_PULL_HANDLE(h, inhandle, t) DCESRV_PULL_HANDLE_RETVAL(h, inhandle, t, NT_STATUS_INVALID_HANDLE)
+#define DCESRV_PULL_HANDLE_WERR(h, inhandle, t) DCESRV_PULL_HANDLE_RETVAL(h, inhandle, t, WERR_INVALID_HANDLE)
+
+/**
+ * retrieve credentials from a dce_call
+ */
+_PUBLIC_ struct cli_credentials *dcesrv_call_credentials(struct dcesrv_call_state *dce_call);
+
+/**
+ * returns true if this is an authenticated call
+ */
+_PUBLIC_ bool dcesrv_call_authenticated(struct dcesrv_call_state *dce_call);
+
+/**
+ * retrieve account_name for a dce_call
+ */
+_PUBLIC_ const char *dcesrv_call_account_name(struct dcesrv_call_state *dce_call);
+
+/**
+ * retrieve session_info from a dce_call
+ */
+_PUBLIC_ struct auth_session_info *dcesrv_call_session_info(struct dcesrv_call_state *dce_call);
+
+/**
+ * retrieve auth type/level from a dce_call
+ */
+_PUBLIC_ void dcesrv_call_auth_info(struct dcesrv_call_state *dce_call,
+ enum dcerpc_AuthType *auth_type,
+ enum dcerpc_AuthLevel *auth_level);
+
+_PUBLIC_ NTSTATUS dcesrv_interface_bind_require_integrity(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface);
+_PUBLIC_ NTSTATUS dcesrv_interface_bind_require_privacy(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface);
+_PUBLIC_ NTSTATUS dcesrv_interface_bind_reject_connect(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface);
+_PUBLIC_ NTSTATUS dcesrv_interface_bind_allow_connect(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface);
+
+_PUBLIC_ NTSTATUS _dcesrv_iface_state_store_assoc(
+ struct dcesrv_call_state *call,
+ uint64_t magic,
+ void *ptr,
+ const char *location);
+#define dcesrv_iface_state_store_assoc(call, magic, ptr) \
+ _dcesrv_iface_state_store_assoc((call), (magic), (ptr), \
+ __location__)
+_PUBLIC_ void *_dcesrv_iface_state_find_assoc(
+ struct dcesrv_call_state *call,
+ uint64_t magic);
+#define dcesrv_iface_state_find_assoc(call, magic, _type) \
+ talloc_get_type( \
+ _dcesrv_iface_state_find_assoc((call), (magic)), \
+ _type)
+
+_PUBLIC_ NTSTATUS _dcesrv_iface_state_store_conn(
+ struct dcesrv_call_state *call,
+ uint64_t magic,
+ void *_pptr,
+ const char *location);
+#define dcesrv_iface_state_store_conn(call, magic, ptr) \
+ _dcesrv_iface_state_store_conn((call), (magic), (ptr), \
+ __location__)
+_PUBLIC_ void *_dcesrv_iface_state_find_conn(
+ struct dcesrv_call_state *call,
+ uint64_t magic);
+#define dcesrv_iface_state_find_conn(call, magic, _type) \
+ talloc_get_type( \
+ _dcesrv_iface_state_find_conn((call), (magic)), \
+ _type)
+
+_PUBLIC_ void dcesrv_cleanup_broken_connections(struct dcesrv_context *dce_ctx);
+
+_PUBLIC_ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx,
+ TALLOC_CTX *mem_ctx,
+ const struct dcesrv_endpoint *ep,
+ struct auth_session_info *session_info,
+ struct tevent_context *event_ctx,
+ uint32_t state_flags,
+ struct dcesrv_connection **_p);
+_PUBLIC_ NTSTATUS dcesrv_find_endpoint(struct dcesrv_context *dce_ctx,
+ const struct dcerpc_binding *ep_description,
+ struct dcesrv_endpoint **_out);
+
+_PUBLIC_ void dcesrv_terminate_connection(struct dcesrv_connection *dce_conn,
+ const char *reason);
+_PUBLIC_ void dcesrv_sock_report_output_data(struct dcesrv_connection *dce_conn);
+
+_PUBLIC_ NTSTATUS dcesrv_connection_loop_start(struct dcesrv_connection *conn);
+
+_PUBLIC_ void dcesrv_loop_next_packet(
+ struct dcesrv_connection *dce_conn,
+ struct ncacn_packet *pkt,
+ DATA_BLOB buffer);
+
+_PUBLIC_ NTSTATUS dcesrv_call_dispatch_local(struct dcesrv_call_state *call);
+
+_PUBLIC_ const struct dcesrv_interface *find_interface_by_syntax_id(
+ const struct dcesrv_endpoint *endpoint,
+ const struct ndr_syntax_id *interface);
+
+void _dcesrv_save_ndr_fuzz_seed(DATA_BLOB call_blob,
+ struct dcesrv_call_state *call,
+ int flags);
+
+#if DEVELOPER
+#define dcesrv_save_ndr_fuzz_seed(stub, call, flags) \
+ _dcesrv_save_ndr_fuzz_seed(stub, call, flags)
+#else
+#define dcesrv_save_ndr_fuzz_seed(stub, call, flags) \
+ /* */
+#endif
+
+
+#endif /* _LIBRPC_RPC_DCESRV_CORE_H_ */
diff --git a/librpc/rpc/dcesrv_handles.c b/librpc/rpc/dcesrv_handles.c
new file mode 100644
index 0000000..da1f00f
--- /dev/null
+++ b/librpc/rpc/dcesrv_handles.c
@@ -0,0 +1,372 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ server side dcerpc handle code
+
+ Copyright (C) Andrew Tridgell 2003
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "lib/util/dlinklist.h"
+#include "rpc_server/dcerpc_server.h"
+#include "libcli/security/security.h"
+#include "librpc/gen_ndr/auth.h"
+
+/*
+ destroy a rpc handle
+*/
+static int dcesrv_handle_destructor(struct dcesrv_handle *h)
+{
+ DLIST_REMOVE(h->assoc_group->handles, h);
+ return 0;
+}
+
+
+/*
+ allocate a new rpc handle
+*/
+_PUBLIC_
+struct dcesrv_handle *dcesrv_handle_create(struct dcesrv_call_state *call,
+ uint8_t handle_type)
+{
+ struct dcesrv_connection_context *context = call->context;
+ struct auth_session_info *session_info =
+ dcesrv_call_session_info(call);
+ struct dcesrv_handle *h;
+ struct dom_sid *sid;
+
+ /*
+ * For simplicity, ensure we abort here for an interface that
+ * has no handles (programmer error)
+ */
+ SMB_ASSERT((context->iface->flags & DCESRV_INTERFACE_FLAGS_HANDLES_NOT_USED) == 0);
+
+ sid = &session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
+
+ h = talloc_zero(context->conn->assoc_group, struct dcesrv_handle);
+ if (!h) {
+ return NULL;
+ }
+ h->data = NULL;
+ sid_copy(&h->sid, sid);
+ h->min_auth_level = call->auth_state->auth_level;
+ h->assoc_group = context->conn->assoc_group;
+ h->iface = context->iface;
+ h->wire_handle.handle_type = handle_type;
+ h->wire_handle.uuid = GUID_random();
+
+ DLIST_ADD(context->conn->assoc_group->handles, h);
+
+ talloc_set_destructor(h, dcesrv_handle_destructor);
+
+ return h;
+}
+
+/**
+ find an internal handle given a wire handle. If the wire handle is NULL then
+ allocate a new handle
+*/
+
+_PUBLIC_
+struct dcesrv_handle *dcesrv_handle_lookup(struct dcesrv_call_state *call,
+ const struct policy_handle *p,
+ uint8_t handle_type)
+{
+ struct dcesrv_connection_context *context = call->context;
+ struct auth_session_info *session_info =
+ dcesrv_call_session_info(call);
+ struct dcesrv_handle *h;
+ struct dom_sid *sid;
+
+ /*
+ * For simplicity, ensure we abort here for an interface that
+ * has no handles (programmer error)
+ */
+ SMB_ASSERT((context->iface->flags & DCESRV_INTERFACE_FLAGS_HANDLES_NOT_USED) == 0);
+
+ sid = &session_info->security_token->sids[PRIMARY_USER_SID_INDEX];
+
+ if (ndr_policy_handle_empty(p)) {
+ /* TODO: we should probably return a NULL handle here */
+ return dcesrv_handle_create(call, handle_type);
+ }
+
+ if (handle_type != DCESRV_HANDLE_ANY &&
+ p->handle_type != handle_type) {
+ DBG_WARNING("client gave us the wrong handle type "
+ "(%"PRIu32" should be %"PRIu8")\n",
+ p->handle_type,
+ handle_type);
+ return NULL;
+ }
+
+ for (h=context->conn->assoc_group->handles; h; h=h->next) {
+ if (h->wire_handle.handle_type == p->handle_type &&
+ GUID_equal(&p->uuid, &h->wire_handle.uuid)) {
+ break;
+ }
+ }
+
+ if (h == NULL) {
+ /* not found */
+ return NULL;
+ }
+
+ if (!dom_sid_equal(&h->sid, sid)) {
+ struct dom_sid_buf buf1, buf2;
+ DBG_ERR("Attempt to use invalid sid %s - %s\n",
+ dom_sid_str_buf(&h->sid, &buf1),
+ dom_sid_str_buf(sid, &buf2));
+ return NULL;
+ }
+
+ if (call->auth_state->auth_level < h->min_auth_level) {
+ DBG_ERR("Attempt to use invalid auth_level %u < %u\n",
+ call->auth_state->auth_level,
+ h->min_auth_level);
+ return NULL;
+ }
+
+ if (h->iface != context->iface) {
+ DBG_ERR("Attempt to use invalid iface\n");
+ return NULL;
+ }
+
+ return h;
+}
+
+struct dcesrv_iface_state {
+ struct dcesrv_iface_state *prev, *next;
+ struct dcesrv_assoc_group *assoc;
+ const struct dcesrv_interface *iface;
+ struct dom_sid owner;
+ const struct dcesrv_connection *conn;
+ const struct dcesrv_auth *auth;
+ const struct dcesrv_connection_context *pres;
+ uint64_t magic;
+ void *ptr;
+ const char *location;
+};
+
+static int dcesrv_iface_state_destructor(struct dcesrv_iface_state *istate)
+{
+ DLIST_REMOVE(istate->assoc->iface_states, istate);
+ return 0;
+}
+
+static void *dcesrv_iface_state_find(struct dcesrv_assoc_group *assoc,
+ const struct dcesrv_interface *iface,
+ const struct dom_sid *owner,
+ const struct dcesrv_connection *conn,
+ const struct dcesrv_auth *auth,
+ const struct dcesrv_connection_context *pres,
+ uint64_t magic,
+ const void *ptr)
+{
+ struct dcesrv_iface_state *cur = NULL;
+
+ for (cur = assoc->iface_states; cur != NULL; cur = cur->next) {
+ bool match;
+
+ SMB_ASSERT(cur->assoc == assoc);
+
+ if (cur->ptr == ptr) {
+ return cur->ptr;
+ }
+
+ if (cur->iface != iface) {
+ continue;
+ }
+
+ match = dom_sid_equal(&cur->owner, owner);
+ if (!match) {
+ continue;
+ }
+
+ if (cur->conn != conn) {
+ continue;
+ }
+
+ if (cur->auth != auth) {
+ continue;
+ }
+
+ if (cur->pres != pres) {
+ continue;
+ }
+
+ if (cur->magic != magic) {
+ continue;
+ }
+
+ return cur->ptr;
+ }
+
+ return NULL;
+}
+
+static NTSTATUS dcesrv_iface_state_store(struct dcesrv_assoc_group *assoc,
+ const struct dcesrv_interface *iface,
+ const struct dom_sid *owner,
+ const struct dcesrv_connection *conn,
+ const struct dcesrv_auth *auth,
+ const struct dcesrv_connection_context *pres,
+ uint64_t magic,
+ TALLOC_CTX *mem_ctx,
+ void *ptr,
+ const char *location)
+{
+ struct dcesrv_iface_state *istate = NULL;
+ void *optr = NULL;
+
+ optr = dcesrv_iface_state_find(assoc,
+ iface,
+ owner,
+ conn,
+ auth,
+ pres,
+ magic,
+ ptr);
+ if (optr != NULL) {
+ return NT_STATUS_OBJECTID_EXISTS;
+ }
+
+ istate = talloc_zero(ptr, struct dcesrv_iface_state);
+ if (istate == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ *istate = (struct dcesrv_iface_state) {
+ .assoc = assoc,
+ .iface = iface,
+ .owner = *owner,
+ .conn = conn,
+ .auth = auth,
+ .pres = pres,
+ .magic = magic,
+ .location = location,
+ };
+
+ istate->ptr = talloc_steal(mem_ctx, ptr);
+
+ talloc_set_destructor(istate, dcesrv_iface_state_destructor);
+
+ DLIST_ADD_END(assoc->iface_states, istate);
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS _dcesrv_iface_state_store_assoc(struct dcesrv_call_state *call,
+ uint64_t magic,
+ void *ptr,
+ const char *location)
+{
+ struct auth_session_info *session_info =
+ dcesrv_call_session_info(call);
+ const struct dom_sid *owner =
+ &session_info->security_token->sids[0];
+ NTSTATUS status;
+
+ status = dcesrv_iface_state_store(call->conn->assoc_group,
+ call->context->iface,
+ owner,
+ NULL, /* conn */
+ NULL, /* auth */
+ NULL, /* pres */
+ magic,
+ call->conn->assoc_group, /* mem_ctx */
+ ptr,
+ location);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ return NT_STATUS_OK;
+}
+
+void *_dcesrv_iface_state_find_assoc(struct dcesrv_call_state *call, uint64_t magic)
+{
+ struct auth_session_info *session_info =
+ dcesrv_call_session_info(call);
+ const struct dom_sid *owner =
+ &session_info->security_token->sids[0];
+ void *ptr = NULL;
+
+ ptr = dcesrv_iface_state_find(call->conn->assoc_group,
+ call->context->iface,
+ owner,
+ NULL, /* conn */
+ NULL, /* auth */
+ NULL, /* pres */
+ magic,
+ NULL); /* ptr */
+ if (ptr == NULL) {
+ return NULL;
+ }
+
+ return ptr;
+}
+
+NTSTATUS _dcesrv_iface_state_store_conn(struct dcesrv_call_state *call,
+ uint64_t magic,
+ void *ptr,
+ const char *location)
+{
+ struct auth_session_info *session_info =
+ dcesrv_call_session_info(call);
+ const struct dom_sid *owner =
+ &session_info->security_token->sids[0];
+ NTSTATUS status;
+
+ status = dcesrv_iface_state_store(call->conn->assoc_group,
+ call->context->iface,
+ owner,
+ call->conn,
+ call->auth_state,
+ call->context,
+ magic,
+ call->conn, /* mem_ctx */
+ ptr,
+ location);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ return NT_STATUS_OK;
+}
+
+void *_dcesrv_iface_state_find_conn(struct dcesrv_call_state *call, uint64_t magic)
+{
+ struct auth_session_info *session_info =
+ dcesrv_call_session_info(call);
+ const struct dom_sid *owner =
+ &session_info->security_token->sids[0];
+ void *ptr = NULL;
+
+ ptr = dcesrv_iface_state_find(call->conn->assoc_group,
+ call->context->iface,
+ owner,
+ call->conn,
+ call->auth_state,
+ call->context,
+ magic,
+ NULL); /* ptr */
+ if (ptr == NULL) {
+ return NULL;
+ }
+
+ return ptr;
+}
diff --git a/librpc/rpc/dcesrv_mgmt.c b/librpc/rpc/dcesrv_mgmt.c
new file mode 100644
index 0000000..d75f08b
--- /dev/null
+++ b/librpc/rpc/dcesrv_mgmt.c
@@ -0,0 +1,125 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ endpoint server for the mgmt pipe
+
+ Copyright (C) Jelmer Vernooij 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/rpc/dcesrv_core.h"
+#include "librpc/rpc/dcesrv_core_proto.h"
+#include "librpc/gen_ndr/ndr_mgmt.h"
+
+#define DCESRV_INTERFACE_MGMT_BIND(context, iface) \
+ dcesrv_interface_mgmt_bind(context, iface)
+/*
+ * This #define allows the mgmt interface to accept invalid
+ * association groups, because association groups are to coordinate
+ * handles, and handles are not used in mgmt. This in turn avoids
+ * the need to coordinate these across multiple possible NETLOGON
+ * processes, as an mgmt interface is added to each
+ */
+
+#define DCESRV_INTERFACE_MGMT_FLAGS DCESRV_INTERFACE_FLAGS_HANDLES_NOT_USED
+
+static NTSTATUS dcesrv_interface_mgmt_bind(struct dcesrv_connection_context *context,
+ const struct dcesrv_interface *iface)
+{
+ return dcesrv_interface_bind_allow_connect(context, iface);
+}
+
+/*
+ mgmt_inq_if_ids
+*/
+static WERROR dcesrv_mgmt_inq_if_ids(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct mgmt_inq_if_ids *r)
+{
+ const struct dcesrv_endpoint *ep = dce_call->conn->endpoint;
+ struct dcesrv_if_list *l;
+ struct rpc_if_id_vector_t *vector;
+
+ vector = *r->out.if_id_vector = talloc(mem_ctx, struct rpc_if_id_vector_t);
+ vector->count = 0;
+ vector->if_id = NULL;
+ for (l = ep->interface_list; l; l = l->next) {
+ vector->count++;
+ vector->if_id = talloc_realloc(mem_ctx, vector->if_id, struct ndr_syntax_id_p, vector->count);
+ vector->if_id[vector->count-1].id = &l->iface->syntax_id;
+ }
+ return WERR_OK;
+}
+
+
+/*
+ mgmt_inq_stats
+*/
+static WERROR dcesrv_mgmt_inq_stats(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct mgmt_inq_stats *r)
+{
+ if (r->in.max_count != MGMT_STATS_ARRAY_MAX_SIZE)
+ return WERR_NOT_SUPPORTED;
+
+ r->out.statistics->count = r->in.max_count;
+ r->out.statistics->statistics = talloc_array(mem_ctx, uint32_t, r->in.max_count);
+ /* FIXME */
+ r->out.statistics->statistics[MGMT_STATS_CALLS_IN] = 0;
+ r->out.statistics->statistics[MGMT_STATS_CALLS_OUT] = 0;
+ r->out.statistics->statistics[MGMT_STATS_PKTS_IN] = 0;
+ r->out.statistics->statistics[MGMT_STATS_PKTS_OUT] = 0;
+
+ return WERR_OK;
+}
+
+
+/*
+ mgmt_is_server_listening
+*/
+static uint32_t dcesrv_mgmt_is_server_listening(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct mgmt_is_server_listening *r)
+{
+ *r->out.status = 0;
+ return 1;
+}
+
+
+/*
+ mgmt_stop_server_listening
+*/
+static WERROR dcesrv_mgmt_stop_server_listening(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct mgmt_stop_server_listening *r)
+{
+ return WERR_ACCESS_DENIED;
+}
+
+
+/*
+ mgmt_inq_princ_name
+*/
+static WERROR dcesrv_mgmt_inq_princ_name(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct mgmt_inq_princ_name *r)
+{
+ DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+}
+
+
+/* include the generated boilerplate */
+#include "librpc/gen_ndr/ndr_mgmt_s.c"
+
+const struct dcesrv_interface *dcesrv_get_mgmt_interface(void)
+{
+ return &dcesrv_mgmt_interface;
+}
diff --git a/librpc/rpc/dcesrv_reply.c b/librpc/rpc/dcesrv_reply.c
new file mode 100644
index 0000000..5b44299
--- /dev/null
+++ b/librpc/rpc/dcesrv_reply.c
@@ -0,0 +1,265 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ server side dcerpc common code
+
+ Copyright (C) Andrew Tridgell 2003-2010
+ Copyright (C) Stefan (metze) Metzmacher 2004-2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "librpc/rpc/dcesrv_core.h"
+#include "librpc/rpc/dcesrv_core_proto.h"
+#include "librpc/rpc/dcerpc_util.h"
+#include "auth/gensec/gensec.h"
+#include "lib/util/dlinklist.h"
+#include "param/param.h"
+
+/*
+ move a call from an existing linked list to the specified list. This
+ prevents bugs where we forget to remove the call from a previous
+ list when moving it.
+ */
+static void dcesrv_call_set_list(struct dcesrv_call_state *call,
+ enum dcesrv_call_list list)
+{
+ switch (call->list) {
+ case DCESRV_LIST_NONE:
+ break;
+ case DCESRV_LIST_CALL_LIST:
+ DLIST_REMOVE(call->conn->call_list, call);
+ break;
+ case DCESRV_LIST_FRAGMENTED_CALL_LIST:
+ DLIST_REMOVE(call->conn->incoming_fragmented_call_list, call);
+ break;
+ case DCESRV_LIST_PENDING_CALL_LIST:
+ DLIST_REMOVE(call->conn->pending_call_list, call);
+ break;
+ }
+ call->list = list;
+ switch (list) {
+ case DCESRV_LIST_NONE:
+ break;
+ case DCESRV_LIST_CALL_LIST:
+ DLIST_ADD_END(call->conn->call_list, call);
+ break;
+ case DCESRV_LIST_FRAGMENTED_CALL_LIST:
+ DLIST_ADD_END(call->conn->incoming_fragmented_call_list, call);
+ break;
+ case DCESRV_LIST_PENDING_CALL_LIST:
+ DLIST_ADD_END(call->conn->pending_call_list, call);
+ break;
+ }
+}
+
+
+void dcesrv_init_hdr(struct ncacn_packet *pkt, bool bigendian)
+{
+ pkt->rpc_vers = 5;
+ pkt->rpc_vers_minor = 0;
+ if (bigendian) {
+ pkt->drep[0] = 0;
+ } else {
+ pkt->drep[0] = DCERPC_DREP_LE;
+ }
+ pkt->drep[1] = 0;
+ pkt->drep[2] = 0;
+ pkt->drep[3] = 0;
+}
+
+
+/*
+ return a dcerpc fault
+*/
+NTSTATUS dcesrv_fault_with_flags(struct dcesrv_call_state *call,
+ uint32_t fault_code,
+ uint8_t extra_flags)
+{
+ struct ncacn_packet pkt;
+ struct data_blob_list_item *rep;
+ NTSTATUS status;
+
+ /* setup a fault */
+ dcesrv_init_hdr(&pkt, lpcfg_rpc_big_endian(call->conn->dce_ctx->lp_ctx));
+ pkt.auth_length = 0;
+ pkt.call_id = call->pkt.call_id;
+ pkt.ptype = DCERPC_PKT_FAULT;
+ pkt.pfc_flags = DCERPC_PFC_FLAG_FIRST | DCERPC_PFC_FLAG_LAST | extra_flags;
+ pkt.u.fault.alloc_hint = 24;
+ if (call->context != NULL) {
+ pkt.u.fault.context_id = call->context->context_id;
+ } else {
+ pkt.u.fault.context_id = 0;
+ }
+ pkt.u.fault.cancel_count = 0;
+ pkt.u.fault.flags = 0;
+ pkt.u.fault.status = fault_code;
+ pkt.u.fault.reserved = 0;
+ pkt.u.fault.error_and_verifier = data_blob_null;
+
+ rep = talloc_zero(call, struct data_blob_list_item);
+ if (!rep) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = dcerpc_ncacn_push_auth(&rep->blob, call, &pkt, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ dcerpc_set_frag_length(&rep->blob, rep->blob.length);
+
+ DLIST_ADD_END(call->replies, rep);
+ dcesrv_call_set_list(call, DCESRV_LIST_CALL_LIST);
+
+ if (call->conn->call_list && call->conn->call_list->replies) {
+ if (call->conn->transport.report_output_data) {
+ call->conn->transport.report_output_data(call->conn);
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS dcesrv_fault(struct dcesrv_call_state *call, uint32_t fault_code)
+{
+ return dcesrv_fault_with_flags(call, fault_code, 0);
+}
+
+_PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call)
+{
+ struct ndr_push *push;
+ NTSTATUS status;
+ DATA_BLOB stub;
+ uint32_t total_length, chunk_size;
+ struct dcesrv_connection_context *context = call->context;
+ struct dcesrv_auth *auth = call->auth_state;
+ size_t sig_size = 0;
+
+ /* call the reply function */
+ status = context->iface->reply(call, call, call->r);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_fault(call, call->fault_code);
+ }
+
+ /* form the reply NDR */
+ push = ndr_push_init_ctx(call);
+ NT_STATUS_HAVE_NO_MEMORY(push);
+
+ /* carry over the pointer count to the reply in case we are
+ using full pointer. See NDR specification for full
+ pointers */
+ push->ptr_count = call->ndr_pull->ptr_count;
+
+ if (lpcfg_rpc_big_endian(call->conn->dce_ctx->lp_ctx)) {
+ push->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+
+ status = context->iface->ndr_push(call, call, push, call->r);
+ if (!NT_STATUS_IS_OK(status)) {
+ return dcesrv_fault(call, call->fault_code);
+ }
+
+ stub = ndr_push_blob(push);
+
+ dcesrv_save_ndr_fuzz_seed(stub,
+ call,
+ NDR_OUT);
+
+ total_length = stub.length;
+
+ /* we can write a full max_recv_frag size, minus the dcerpc
+ request header size */
+ chunk_size = call->conn->max_xmit_frag;
+ chunk_size -= DCERPC_REQUEST_LENGTH;
+ if (auth->auth_finished && auth->gensec_security != NULL) {
+ size_t max_payload = chunk_size;
+
+ max_payload -= DCERPC_AUTH_TRAILER_LENGTH;
+ max_payload -= (max_payload % DCERPC_AUTH_PAD_ALIGNMENT);
+
+ sig_size = gensec_sig_size(auth->gensec_security,
+ max_payload);
+ if (sig_size) {
+ chunk_size -= DCERPC_AUTH_TRAILER_LENGTH;
+ chunk_size -= sig_size;
+ }
+ }
+ chunk_size -= (chunk_size % DCERPC_AUTH_PAD_ALIGNMENT);
+
+ do {
+ uint32_t length;
+ struct data_blob_list_item *rep;
+ struct ncacn_packet pkt;
+ bool ok;
+
+ rep = talloc_zero(call, struct data_blob_list_item);
+ NT_STATUS_HAVE_NO_MEMORY(rep);
+
+ length = MIN(chunk_size, stub.length);
+
+ /* form the dcerpc response packet */
+ dcesrv_init_hdr(&pkt,
+ lpcfg_rpc_big_endian(call->conn->dce_ctx->lp_ctx));
+ pkt.auth_length = 0;
+ pkt.call_id = call->pkt.call_id;
+ pkt.ptype = DCERPC_PKT_RESPONSE;
+ pkt.pfc_flags = 0;
+ if (stub.length == total_length) {
+ pkt.pfc_flags |= DCERPC_PFC_FLAG_FIRST;
+ }
+ if (length == stub.length) {
+ pkt.pfc_flags |= DCERPC_PFC_FLAG_LAST;
+ }
+ pkt.u.response.alloc_hint = stub.length;
+ /*
+ * bug for bug, feature for feature...
+ *
+ * Windows truncates the context_id with & 0xFF,
+ * so we do.
+ */
+ pkt.u.response.context_id = context->context_id & 0xFF;
+ pkt.u.response.cancel_count = 0;
+ pkt.u.response.stub_and_verifier.data = stub.data;
+ pkt.u.response.stub_and_verifier.length = length;
+
+ ok = dcesrv_auth_pkt_push(call, &rep->blob, sig_size,
+ DCERPC_RESPONSE_LENGTH,
+ &pkt.u.response.stub_and_verifier,
+ &pkt);
+ if (!ok) {
+ return dcesrv_fault(call, DCERPC_FAULT_OTHER);
+ }
+
+ dcerpc_set_frag_length(&rep->blob, rep->blob.length);
+
+ DLIST_ADD_END(call->replies, rep);
+
+ stub.data += length;
+ stub.length -= length;
+ } while (stub.length != 0);
+
+ /* move the call from the pending to the finished calls list */
+ dcesrv_call_set_list(call, DCESRV_LIST_CALL_LIST);
+
+ if (call->conn->call_list && call->conn->call_list->replies) {
+ if (call->conn->transport.report_output_data) {
+ call->conn->transport.report_output_data(call->conn);
+ }
+ }
+
+ return NT_STATUS_OK;
+}
diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h
new file mode 100644
index 0000000..55a35f3
--- /dev/null
+++ b/librpc/rpc/rpc_common.h
@@ -0,0 +1,410 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Copyright (C) Stefan Metzmacher 2010-2011
+ Copyright (C) Andrew Tridgell 2010-2011
+ Copyright (C) Simo Sorce 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __DEFAULT_LIBRPC_RPCCOMMON_H__
+#define __DEFAULT_LIBRPC_RPCCOMMON_H__
+
+#include "lib/util/data_blob.h"
+
+#include "gen_ndr/dcerpc.h"
+#include "lib/util/attr.h"
+
+struct dcerpc_binding_handle;
+struct GUID;
+struct ndr_interface_table;
+struct ndr_interface_call;
+struct ndr_push;
+struct ndr_pull;
+struct ncacn_packet;
+struct epm_floor;
+struct epm_tower;
+struct tevent_context;
+struct tstream_context;
+struct gensec_security;
+
+enum dcerpc_transport_t {
+ NCA_UNKNOWN, 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, NCACN_INTERNAL };
+
+/** this describes a binding to a particular transport/pipe */
+struct dcerpc_binding;
+
+/* 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)
+
+#define DCERPC_ANON_FALLBACK (1<<10)
+
+/* 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 triggers the DCERPC_PFC_FLAG_CONC_MPX flag in the bind request */
+#define DCERPC_CONCURRENT_MULTIPLEX (1<<19)
+
+/* this indicates DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN flag was negotiated */
+#define DCERPC_HEADER_SIGNING (1<<20)
+
+/* use NDR64 transport */
+#define DCERPC_NDR64 (1<<21)
+
+/* handle upgrades or downgrades automatically */
+#define DCERPC_SCHANNEL_AUTO (1<<23)
+
+/* use aes schannel with hmac-sh256 session key */
+#define DCERPC_SCHANNEL_AES (1<<24)
+
+/* this triggers the DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN flag in the bind request */
+#define DCERPC_PROPOSE_HEADER_SIGNING (1<<25)
+
+#define DCERPC_PACKET (1<<26)
+
+#define DCERPC_SMB1 (1<<27)
+
+/* The following definitions come from ../librpc/rpc/dcerpc_error.c */
+
+const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
+NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code);
+uint32_t dcerpc_fault_from_nt_status(NTSTATUS nt_status);
+
+/* The following definitions come from ../librpc/rpc/binding.c */
+
+const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
+char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
+enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
+struct dcerpc_binding *dcerpc_binding_dup(TALLOC_CTX *mem_ctx,
+ const struct dcerpc_binding *b);
+NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
+ const struct dcerpc_binding *binding,
+ struct epm_tower *tower);
+NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
+ struct epm_tower *tower,
+ struct dcerpc_binding **b_out);
+NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out);
+char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b);
+struct GUID dcerpc_binding_get_object(const struct dcerpc_binding *b);
+NTSTATUS dcerpc_binding_set_object(struct dcerpc_binding *b,
+ struct GUID object);
+enum dcerpc_transport_t dcerpc_binding_get_transport(const struct dcerpc_binding *b);
+NTSTATUS dcerpc_binding_set_transport(struct dcerpc_binding *b,
+ enum dcerpc_transport_t transport);
+void dcerpc_binding_get_auth_info(const struct dcerpc_binding *b,
+ enum dcerpc_AuthType *_auth_type,
+ enum dcerpc_AuthLevel *_auth_level);
+uint32_t dcerpc_binding_get_assoc_group_id(const struct dcerpc_binding *b);
+NTSTATUS dcerpc_binding_set_assoc_group_id(struct dcerpc_binding *b,
+ uint32_t assoc_group_id);
+struct ndr_syntax_id dcerpc_binding_get_abstract_syntax(const struct dcerpc_binding *b);
+NTSTATUS dcerpc_binding_set_abstract_syntax(struct dcerpc_binding *b,
+ const struct ndr_syntax_id *syntax);
+const char *dcerpc_binding_get_string_option(const struct dcerpc_binding *b,
+ const char *name);
+char *dcerpc_binding_copy_string_option(TALLOC_CTX *mem_ctx,
+ const struct dcerpc_binding *b,
+ const char *name);
+NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b,
+ const char *name,
+ const char *value);
+uint32_t dcerpc_binding_get_flags(const struct dcerpc_binding *b);
+NTSTATUS dcerpc_binding_set_flags(struct dcerpc_binding *b,
+ uint32_t additional,
+ uint32_t clear);
+NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor, struct ndr_syntax_id *syntax);
+const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t);
+enum dcerpc_transport_t dcerpc_transport_by_name(const char *name);
+enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower);
+
+/* The following definitions come from ../librpc/rpc/binding_handle.c */
+
+struct dcerpc_binding_handle_ops {
+ const char *name;
+
+ bool (*is_connected)(struct dcerpc_binding_handle *h);
+ uint32_t (*set_timeout)(struct dcerpc_binding_handle *h,
+ uint32_t timeout);
+
+ void (*auth_info)(struct dcerpc_binding_handle *h,
+ enum dcerpc_AuthType *auth_type,
+ enum dcerpc_AuthLevel *auth_level);
+
+ struct tevent_req *(*raw_call_send)(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ uint32_t opnum,
+ uint32_t in_flags,
+ const uint8_t *in_data,
+ size_t in_length);
+ NTSTATUS (*raw_call_recv)(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **out_data,
+ size_t *out_length,
+ uint32_t *out_flags);
+
+ struct tevent_req *(*disconnect_send)(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h);
+ NTSTATUS (*disconnect_recv)(struct tevent_req *req);
+
+ /* TODO: remove the following functions */
+ bool (*push_bigendian)(struct dcerpc_binding_handle *h);
+ bool (*ref_alloc)(struct dcerpc_binding_handle *h);
+ bool (*use_ndr64)(struct dcerpc_binding_handle *h);
+ void (*do_ndr_print)(struct dcerpc_binding_handle *h,
+ int ndr_flags,
+ const void *struct_ptr,
+ const struct ndr_interface_call *call);
+ void (*ndr_push_failed)(struct dcerpc_binding_handle *h,
+ NTSTATUS error,
+ const void *struct_ptr,
+ const struct ndr_interface_call *call);
+ void (*ndr_pull_failed)(struct dcerpc_binding_handle *h,
+ NTSTATUS error,
+ const DATA_BLOB *blob,
+ const struct ndr_interface_call *call);
+ NTSTATUS (*ndr_validate_in)(struct dcerpc_binding_handle *h,
+ TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *blob,
+ const struct ndr_interface_call *call);
+ NTSTATUS (*ndr_validate_out)(struct dcerpc_binding_handle *h,
+ struct ndr_pull *pull_in,
+ const void *struct_ptr,
+ const struct ndr_interface_call *call);
+};
+
+struct dcerpc_binding_handle *_dcerpc_binding_handle_create(TALLOC_CTX *mem_ctx,
+ const struct dcerpc_binding_handle_ops *ops,
+ const struct GUID *object,
+ const struct ndr_interface_table *table,
+ void *pstate,
+ size_t psize,
+ const char *type,
+ const char *location);
+#define dcerpc_binding_handle_create(mem_ctx, ops, object, table, \
+ state, type, location) \
+ _dcerpc_binding_handle_create(mem_ctx, ops, object, table, \
+ state, sizeof(type), #type, location)
+
+void *_dcerpc_binding_handle_data(struct dcerpc_binding_handle *h);
+#define dcerpc_binding_handle_data(_h, _type) \
+ talloc_get_type_abort(_dcerpc_binding_handle_data(_h), _type)
+
+_DEPRECATED_ void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle *h,
+ struct tevent_context *ev);
+
+bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h);
+
+uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
+ uint32_t timeout);
+
+void dcerpc_binding_handle_auth_info(struct dcerpc_binding_handle *h,
+ enum dcerpc_AuthType *auth_type,
+ enum dcerpc_AuthLevel *auth_level);
+
+struct tevent_req *dcerpc_binding_handle_raw_call_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ uint32_t opnum,
+ uint32_t in_flags,
+ const uint8_t *in_data,
+ size_t in_length);
+NTSTATUS dcerpc_binding_handle_raw_call_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **out_data,
+ size_t *out_length,
+ uint32_t *out_flags);
+NTSTATUS dcerpc_binding_handle_raw_call(struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ uint32_t opnum,
+ uint32_t in_flags,
+ const uint8_t *in_data,
+ size_t in_length,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **out_data,
+ size_t *out_length,
+ uint32_t *out_flags);
+
+struct tevent_req *dcerpc_binding_handle_disconnect_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h);
+NTSTATUS dcerpc_binding_handle_disconnect_recv(struct tevent_req *req);
+
+struct tevent_req *dcerpc_binding_handle_call_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ const struct ndr_interface_table *table,
+ uint32_t opnum,
+ TALLOC_CTX *r_mem,
+ void *r_ptr);
+NTSTATUS dcerpc_binding_handle_call_recv(struct tevent_req *req);
+NTSTATUS dcerpc_binding_handle_call(struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ const struct ndr_interface_table *table,
+ uint32_t opnum,
+ TALLOC_CTX *r_mem,
+ void *r_ptr);
+
+/**
+ * Extract header information from a ncacn_packet
+ * as a dcerpc_sec_vt_header2 as used by the security verification trailer.
+ *
+ * @param[in] pkt a packet
+ *
+ * @return a dcerpc_sec_vt_header2
+ */
+struct dcerpc_sec_vt_header2 dcerpc_sec_vt_header2_from_ncacn_packet(const struct ncacn_packet *pkt);
+
+
+/**
+ * Test if two dcerpc_sec_vt_header2 structures are equal
+ * without consideration of reserved fields.
+ *
+ * @param v1 a pointer to a dcerpc_sec_vt_header2 structure
+ * @param v2 a pointer to a dcerpc_sec_vt_header2 structure
+ *
+ * @retval true if *v1 equals *v2
+ */
+bool dcerpc_sec_vt_header2_equal(const struct dcerpc_sec_vt_header2 *v1,
+ const struct dcerpc_sec_vt_header2 *v2);
+
+/**
+ * Check for consistency of the security verification trailer with the PDU header.
+ * See <a href="http://msdn.microsoft.com/en-us/library/cc243559.aspx">MS-RPCE 2.2.2.13</a>.
+ * A check with an empty trailer succeeds.
+ *
+ * @param[in] vt a pointer to the security verification trailer.
+ * @param[in] bitmask1 which flags were negotiated on the connection.
+ * @param[in] pcontext the syntaxes negotiatied for the presentation context.
+ * @param[in] header2 some fields from the PDU header.
+ *
+ * @retval true on success.
+ */
+bool dcerpc_sec_verification_trailer_check(
+ const struct dcerpc_sec_verification_trailer *vt,
+ const uint32_t *bitmask1,
+ const struct dcerpc_sec_vt_pcontext *pcontext,
+ const struct dcerpc_sec_vt_header2 *header2);
+
+/**
+ * @brief check and optionally extract the Bind Time Features from
+ * the given ndr_syntax_id.
+ *
+ * <a href="http://msdn.microsoft.com/en-us/library/cc243715.aspx">MS-RPCE 3.3.1.5.3 Bind Time Feature Negotiation</a>.
+ *
+ * @param[in] s the syntax that should be checked.
+ *
+ * @param[out] features This is optional, it will be filled with the extracted
+ * features the on success, otherwise it's filled with 0.
+ *
+ * @return true if the syntax matches the 6CB71C2C-9812-4540 prefix with version 1, false otherwise.
+ *
+ * @see dcerpc_construct_bind_time_features
+ */
+bool dcerpc_extract_bind_time_features(struct ndr_syntax_id syntax, uint64_t *features);
+
+/**
+ * @brief Construct a ndr_syntax_id used for Bind Time Features Negotiation.
+ *
+ * <a href="http://msdn.microsoft.com/en-us/library/cc243715.aspx">MS-RPCE 3.3.1.5.3 Bind Time Feature Negotiation</a>.
+ *
+ * @param[in] features The supported features.
+ *
+ * @return The ndr_syntax_id with the given features.
+ *
+ * @see dcerpc_extract_bind_time_features
+ */
+struct ndr_syntax_id dcerpc_construct_bind_time_features(uint64_t features);
+
+#define DCERPC_AUTH_PAD_LENGTH(stub_length) (\
+ (((stub_length) % DCERPC_AUTH_PAD_ALIGNMENT) > 0)?\
+ (DCERPC_AUTH_PAD_ALIGNMENT - (stub_length) % DCERPC_AUTH_PAD_ALIGNMENT):\
+ 0)
+
+NTSTATUS dcerpc_generic_session_key(DATA_BLOB *session_key);
+
+NTSTATUS dcerpc_ncacn_push_auth(DATA_BLOB *blob,
+ TALLOC_CTX *mem_ctx,
+ struct ncacn_packet *pkt,
+ struct dcerpc_auth *auth_info);
+
+void dcerpc_log_packet(const char *packet_log_dir,
+ const char *interface_name,
+ uint32_t opnum, uint32_t flags,
+ const DATA_BLOB *pkt,
+ const char *why);
+
+#ifdef DEVELOPER
+void dcerpc_save_ndr_fuzz_seed(TALLOC_CTX *mem_ctx,
+ DATA_BLOB raw_blob,
+ const char *dump_dir,
+ const char *iface_name,
+ int flags,
+ int opnum,
+ bool ndr64);
+#else
+static inline void dcerpc_save_ndr_fuzz_seed(TALLOC_CTX *mem_ctx,
+ DATA_BLOB raw_blob,
+ const char *dump_dir,
+ const char *iface_name,
+ int flags,
+ int opnum,
+ bool ndr64)
+{
+ return;
+}
+#endif
+
+#endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */
diff --git a/librpc/rpc/server/netlogon/schannel_util.c b/librpc/rpc/server/netlogon/schannel_util.c
new file mode 100644
index 0000000..b14497b
--- /dev/null
+++ b/librpc/rpc/server/netlogon/schannel_util.c
@@ -0,0 +1,570 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ netlogon schannel utility functions
+
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2008
+ Copyright (C) Stefan Metzmacher <metze@samba.org> 2005
+ Copyright (C) Matthias Dieter Wallnöfer 2009-2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "schannel_util.h"
+#include "param/param.h"
+#include "libcli/security/dom_sid.h"
+#include "libcli/auth/schannel.h"
+#include "librpc/rpc/dcesrv_core.h"
+#include "librpc/gen_ndr/ndr_netlogon.h"
+#include "lib/util/util_str_escape.h"
+
+struct dcesrv_netr_check_schannel_state {
+ struct dom_sid account_sid;
+ enum dcerpc_AuthType auth_type;
+ enum dcerpc_AuthLevel auth_level;
+
+ bool schannel_global_required;
+ bool schannel_required;
+ bool schannel_explicitly_set;
+
+ bool seal_global_required;
+ bool seal_required;
+ bool seal_explicitly_set;
+
+ NTSTATUS result;
+};
+
+static NTSTATUS dcesrv_netr_check_schannel_get_state(struct dcesrv_call_state *dce_call,
+ const struct netlogon_creds_CredentialState *creds,
+ enum dcerpc_AuthType auth_type,
+ enum dcerpc_AuthLevel auth_level,
+ struct dcesrv_netr_check_schannel_state **_s)
+{
+ struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
+ int schannel = lpcfg_server_schannel(lp_ctx);
+ bool schannel_global_required = (schannel == true);
+ bool schannel_required = schannel_global_required;
+ const char *explicit_opt = NULL;
+ bool global_require_seal = lpcfg_server_schannel_require_seal(lp_ctx);
+ bool require_seal = global_require_seal;
+ const char *explicit_seal_opt = NULL;
+#define DCESRV_NETR_CHECK_SCHANNEL_STATE_MAGIC (NETLOGON_SERVER_PIPE_STATE_MAGIC+1)
+ struct dcesrv_netr_check_schannel_state *s = NULL;
+ NTSTATUS status;
+
+ *_s = NULL;
+
+ s = dcesrv_iface_state_find_conn(dce_call,
+ DCESRV_NETR_CHECK_SCHANNEL_STATE_MAGIC,
+ struct dcesrv_netr_check_schannel_state);
+ if (s != NULL) {
+ if (!dom_sid_equal(&s->account_sid, creds->sid)) {
+ goto new_state;
+ }
+ if (s->auth_type != auth_type) {
+ goto new_state;
+ }
+ if (s->auth_level != auth_level) {
+ goto new_state;
+ }
+
+ *_s = s;
+ return NT_STATUS_OK;
+ }
+
+new_state:
+ TALLOC_FREE(s);
+ s = talloc_zero(dce_call,
+ struct dcesrv_netr_check_schannel_state);
+ if (s == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ s->account_sid = *creds->sid;
+ s->auth_type = auth_type;
+ s->auth_level = auth_level;
+ s->result = NT_STATUS_MORE_PROCESSING_REQUIRED;
+
+ /*
+ * We don't use lpcfg_parm_bool(), as we
+ * need the explicit_opt pointer in order to
+ * adjust the debug messages.
+ */
+ explicit_seal_opt = lpcfg_get_parametric(lp_ctx,
+ NULL,
+ "server schannel require seal",
+ creds->account_name);
+ if (explicit_seal_opt != NULL) {
+ require_seal = lp_bool(explicit_seal_opt);
+ }
+
+ /*
+ * We don't use lpcfg_parm_bool(), as we
+ * need the explicit_opt pointer in order to
+ * adjust the debug messages.
+ */
+ explicit_opt = lpcfg_get_parametric(lp_ctx,
+ NULL,
+ "server require schannel",
+ creds->account_name);
+ if (explicit_opt != NULL) {
+ schannel_required = lp_bool(explicit_opt);
+ }
+
+ s->schannel_global_required = schannel_global_required;
+ s->schannel_required = schannel_required;
+ s->schannel_explicitly_set = explicit_opt != NULL;
+
+ s->seal_global_required = global_require_seal;
+ s->seal_required = require_seal;
+ s->seal_explicitly_set = explicit_seal_opt != NULL;
+
+ status = dcesrv_iface_state_store_conn(dce_call,
+ DCESRV_NETR_CHECK_SCHANNEL_STATE_MAGIC,
+ s);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ *_s = s;
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS dcesrv_netr_check_schannel_once(struct dcesrv_call_state *dce_call,
+ struct dcesrv_netr_check_schannel_state *s,
+ const struct netlogon_creds_CredentialState *creds,
+ uint16_t opnum)
+{
+ struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
+ int CVE_2020_1472_warn_level = lpcfg_parm_int(lp_ctx, NULL,
+ "CVE_2020_1472", "warn_about_unused_debug_level", DBGLVL_ERR);
+ int CVE_2020_1472_error_level = lpcfg_parm_int(lp_ctx, NULL,
+ "CVE_2020_1472", "error_debug_level", DBGLVL_ERR);
+ int CVE_2022_38023_warn_level = lpcfg_parm_int(lp_ctx, NULL,
+ "CVE_2022_38023", "warn_about_unused_debug_level", DBGLVL_ERR);
+ int CVE_2022_38023_error_level = lpcfg_parm_int(lp_ctx, NULL,
+ "CVE_2022_38023", "error_debug_level", DBGLVL_ERR);
+ TALLOC_CTX *frame = talloc_stackframe();
+ unsigned int dbg_lvl = DBGLVL_DEBUG;
+ const char *opname = "<unknown>";
+ const char *reason = "<unknown>";
+
+ if (opnum < ndr_table_netlogon.num_calls) {
+ opname = ndr_table_netlogon.calls[opnum].name;
+ }
+
+ if (s->auth_type == DCERPC_AUTH_TYPE_SCHANNEL) {
+ if (s->auth_level == DCERPC_AUTH_LEVEL_PRIVACY) {
+ reason = "WITH SEALED";
+ } else if (s->auth_level == DCERPC_AUTH_LEVEL_INTEGRITY) {
+ reason = "WITH SIGNED";
+ } else {
+ reason = "WITH INVALID";
+ dbg_lvl = DBGLVL_ERR;
+ s->result = NT_STATUS_INTERNAL_ERROR;
+ }
+ } else {
+ reason = "WITHOUT";
+ }
+
+ if (!NT_STATUS_EQUAL(s->result, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+ if (!NT_STATUS_IS_OK(s->result)) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_INFO);
+ }
+
+ DEBUG(dbg_lvl, (
+ "CVE-2020-1472(ZeroLogon)/CVE-2022-38023: "
+ "%s request (opnum[%u]) %s schannel from "
+ "client_account[%s] client_computer_name[%s] %s\n",
+ opname, opnum, reason,
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name),
+ nt_errstr(s->result)));
+ TALLOC_FREE(frame);
+ return s->result;
+ }
+
+ if (s->auth_type == DCERPC_AUTH_TYPE_SCHANNEL &&
+ s->auth_level == DCERPC_AUTH_LEVEL_PRIVACY)
+ {
+ s->result = NT_STATUS_OK;
+
+ if (s->schannel_explicitly_set && !s->schannel_required) {
+ dbg_lvl = MIN(dbg_lvl, CVE_2020_1472_warn_level);
+ } else if (!s->schannel_required) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_INFO);
+ }
+ if (s->seal_explicitly_set && !s->seal_required) {
+ dbg_lvl = MIN(dbg_lvl, CVE_2022_38023_warn_level);
+ } else if (!s->seal_required) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_INFO);
+ }
+
+ DEBUG(dbg_lvl, (
+ "CVE-2020-1472(ZeroLogon)/CVE-2022-38023: "
+ "%s request (opnum[%u]) %s schannel from "
+ "client_account[%s] client_computer_name[%s] %s\n",
+ opname, opnum, reason,
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name),
+ nt_errstr(s->result)));
+
+ if (s->schannel_explicitly_set && !s->schannel_required) {
+ DEBUG(CVE_2020_1472_warn_level, (
+ "CVE-2020-1472(ZeroLogon): "
+ "Option 'server require schannel:%s = no' not needed for '%s'!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name)));
+ }
+
+ if (s->seal_explicitly_set && !s->seal_required) {
+ DEBUG(CVE_2022_38023_warn_level, (
+ "CVE-2022-38023: "
+ "Option 'server schannel require seal:%s = no' not needed for '%s'!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name)));
+ }
+
+ TALLOC_FREE(frame);
+ return s->result;
+ }
+
+ if (s->auth_type == DCERPC_AUTH_TYPE_SCHANNEL) {
+ if (s->seal_required) {
+ s->result = NT_STATUS_ACCESS_DENIED;
+
+ if (s->seal_explicitly_set) {
+ dbg_lvl = DBGLVL_NOTICE;
+ } else {
+ dbg_lvl = MIN(dbg_lvl, CVE_2022_38023_error_level);
+ }
+ if (s->schannel_explicitly_set && !s->schannel_required) {
+ dbg_lvl = MIN(dbg_lvl, CVE_2022_38023_warn_level);
+ }
+
+ DEBUG(dbg_lvl, (
+ "CVE-2022-38023: "
+ "%s request (opnum[%u]) %s schannel from "
+ "from client_account[%s] client_computer_name[%s] %s\n",
+ opname, opnum, reason,
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name),
+ nt_errstr(s->result)));
+ if (s->seal_explicitly_set) {
+ D_NOTICE("CVE-2022-38023: Option "
+ "'server schannel require seal:%s = yes' "
+ "rejects access for client.\n",
+ log_escape(frame, creds->account_name));
+ } else {
+ DEBUG(CVE_2020_1472_error_level, (
+ "CVE-2022-38023: Check if option "
+ "'server schannel require seal:%s = no' "
+ "might be needed for a legacy client.\n",
+ log_escape(frame, creds->account_name)));
+ }
+ if (s->schannel_explicitly_set && !s->schannel_required) {
+ DEBUG(CVE_2020_1472_warn_level, (
+ "CVE-2020-1472(ZeroLogon): Option "
+ "'server require schannel:%s = no' "
+ "not needed for '%s'!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name)));
+ }
+ TALLOC_FREE(frame);
+ return s->result;
+ }
+
+ s->result = NT_STATUS_OK;
+
+ if (s->schannel_explicitly_set && !s->schannel_required) {
+ dbg_lvl = MIN(dbg_lvl, CVE_2020_1472_warn_level);
+ } else if (!s->schannel_required) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_INFO);
+ }
+ if (s->seal_explicitly_set && !s->seal_required) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_INFO);
+ } else if (!s->seal_required) {
+ dbg_lvl = MIN(dbg_lvl, CVE_2022_38023_error_level);
+ }
+
+ DEBUG(dbg_lvl, (
+ "CVE-2020-1472(ZeroLogon): "
+ "%s request (opnum[%u]) %s schannel from "
+ "client_account[%s] client_computer_name[%s] %s\n",
+ opname, opnum, reason,
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name),
+ nt_errstr(s->result)));
+ if (s->schannel_explicitly_set && !s->schannel_required) {
+ DEBUG(CVE_2020_1472_warn_level, (
+ "CVE-2020-1472(ZeroLogon): "
+ "Option 'server require schannel:%s = no' not needed for '%s'!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name)));
+ }
+ if (s->seal_explicitly_set && !s->seal_required) {
+ D_INFO("CVE-2022-38023: "
+ "Option 'server schannel require seal:%s = no' still needed for '%s'!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name));
+ } else if (!s->seal_required) {
+ /*
+ * admins should set
+ * server schannel require seal:COMPUTER$ = no
+ * in order to avoid the level 0 messages.
+ * Over time they can switch the global value
+ * to be strict.
+ */
+ DEBUG(CVE_2022_38023_error_level, (
+ "CVE-2022-38023: "
+ "Please use 'server schannel require seal:%s = no' "
+ "for '%s' to avoid this warning!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name)));
+ }
+
+ TALLOC_FREE(frame);
+ return s->result;
+ }
+
+ if (s->seal_required) {
+ s->result = NT_STATUS_ACCESS_DENIED;
+
+ if (s->seal_explicitly_set) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_NOTICE);
+ } else {
+ dbg_lvl = MIN(dbg_lvl, CVE_2022_38023_error_level);
+ }
+ if (!s->schannel_explicitly_set) {
+ dbg_lvl = MIN(dbg_lvl, CVE_2020_1472_error_level);
+ } else if (s->schannel_required) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_NOTICE);
+ }
+
+ DEBUG(dbg_lvl, (
+ "CVE-2020-1472(ZeroLogon)/CVE-2022-38023: "
+ "%s request (opnum[%u]) %s schannel from "
+ "from client_account[%s] client_computer_name[%s] %s\n",
+ opname, opnum, reason,
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name),
+ nt_errstr(s->result)));
+ if (s->seal_explicitly_set) {
+ D_NOTICE("CVE-2022-38023: Option "
+ "'server schannel require seal:%s = yes' "
+ "rejects access for client.\n",
+ log_escape(frame, creds->account_name));
+ } else {
+ DEBUG(CVE_2022_38023_error_level, (
+ "CVE-2022-38023: Check if option "
+ "'server schannel require seal:%s = no' "
+ "might be needed for a legacy client.\n",
+ log_escape(frame, creds->account_name)));
+ }
+ if (!s->schannel_explicitly_set) {
+ DEBUG(CVE_2020_1472_error_level, (
+ "CVE-2020-1472(ZeroLogon): Check if option "
+ "'server require schannel:%s = no' "
+ "might be needed for a legacy client.\n",
+ log_escape(frame, creds->account_name)));
+ } else if (s->schannel_required) {
+ D_NOTICE("CVE-2022-38023: Option "
+ "'server require schannel:%s = yes' "
+ "also rejects access for client.\n",
+ log_escape(frame, creds->account_name));
+ }
+ TALLOC_FREE(frame);
+ return s->result;
+ }
+
+ if (s->schannel_required) {
+ s->result = NT_STATUS_ACCESS_DENIED;
+
+ if (s->schannel_explicitly_set) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_NOTICE);
+ } else {
+ dbg_lvl = MIN(dbg_lvl, CVE_2020_1472_error_level);
+ }
+ if (!s->seal_explicitly_set) {
+ dbg_lvl = MIN(dbg_lvl, CVE_2022_38023_error_level);
+ }
+
+ DEBUG(dbg_lvl, (
+ "CVE-2020-1472(ZeroLogon)/CVE-2022-38023: "
+ "%s request (opnum[%u]) %s schannel from "
+ "client_account[%s] client_computer_name[%s] %s\n",
+ opname, opnum, reason,
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name),
+ nt_errstr(s->result)));
+ if (s->schannel_explicitly_set) {
+ D_NOTICE("CVE-2020-1472(ZeroLogon): Option "
+ "'server require schannel:%s = yes' "
+ "rejects access for client.\n",
+ log_escape(frame, creds->account_name));
+ } else {
+ DEBUG(CVE_2020_1472_error_level, (
+ "CVE-2020-1472(ZeroLogon): Check if option "
+ "'server require schannel:%s = no' "
+ "might be needed for a legacy client.\n",
+ log_escape(frame, creds->account_name)));
+ }
+ if (!s->seal_explicitly_set) {
+ DEBUG(CVE_2022_38023_error_level, (
+ "CVE-2022-38023: Check if option "
+ "'server schannel require seal:%s = no' "
+ "might be needed for a legacy client.\n",
+ log_escape(frame, creds->account_name)));
+ }
+ TALLOC_FREE(frame);
+ return s->result;
+ }
+
+ s->result = NT_STATUS_OK;
+
+ if (s->seal_explicitly_set) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_INFO);
+ } else {
+ dbg_lvl = MIN(dbg_lvl, CVE_2022_38023_error_level);
+ }
+
+ if (s->schannel_explicitly_set) {
+ dbg_lvl = MIN(dbg_lvl, DBGLVL_INFO);
+ } else {
+ dbg_lvl = MIN(dbg_lvl, CVE_2020_1472_error_level);
+ }
+
+ DEBUG(dbg_lvl, (
+ "CVE-2020-1472(ZeroLogon)/CVE-2022-38023: "
+ "%s request (opnum[%u]) %s schannel from "
+ "client_account[%s] client_computer_name[%s] %s\n",
+ opname, opnum, reason,
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name),
+ nt_errstr(s->result)));
+
+ if (s->seal_explicitly_set) {
+ D_INFO("CVE-2022-38023: Option "
+ "'server schannel require seal:%s = no' "
+ "still needed for '%s'!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name));
+ } else {
+ /*
+ * admins should set
+ * server schannel require seal:COMPUTER$ = no
+ * in order to avoid the level 0 messages.
+ * Over time they can switch the global value
+ * to be strict.
+ */
+ DEBUG(CVE_2022_38023_error_level, (
+ "CVE-2022-38023: Please use "
+ "'server schannel require seal:%s = no' "
+ "for '%s' to avoid this warning!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name)));
+ }
+
+ if (s->schannel_explicitly_set) {
+ D_INFO("CVE-2020-1472(ZeroLogon): Option "
+ "'server require schannel:%s = no' "
+ "still needed for '%s'!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name));
+ } else {
+ /*
+ * admins should set
+ * server require schannel:COMPUTER$ = no
+ * in order to avoid the level 0 messages.
+ * Over time they can switch the global value
+ * to be strict.
+ */
+ DEBUG(CVE_2020_1472_error_level, (
+ "CVE-2020-1472(ZeroLogon): "
+ "Please use 'server require schannel:%s = no' "
+ "for '%s' to avoid this warning!\n",
+ log_escape(frame, creds->account_name),
+ log_escape(frame, creds->computer_name)));
+ }
+
+ TALLOC_FREE(frame);
+ return s->result;
+}
+
+NTSTATUS dcesrv_netr_check_schannel(struct dcesrv_call_state *dce_call,
+ const struct netlogon_creds_CredentialState *creds,
+ enum dcerpc_AuthType auth_type,
+ enum dcerpc_AuthLevel auth_level,
+ uint16_t opnum)
+{
+ struct dcesrv_netr_check_schannel_state *s = NULL;
+ NTSTATUS status;
+
+ status = dcesrv_netr_check_schannel_get_state(dce_call,
+ creds,
+ auth_type,
+ auth_level,
+ &s);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ status = dcesrv_netr_check_schannel_once(dce_call, s, creds, opnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS dcesrv_netr_creds_server_step_check(struct dcesrv_call_state *dce_call,
+ TALLOC_CTX *mem_ctx,
+ const char *computer_name,
+ struct netr_Authenticator *received_authenticator,
+ struct netr_Authenticator *return_authenticator,
+ struct netlogon_creds_CredentialState **creds_out)
+{
+ NTSTATUS nt_status;
+ struct netlogon_creds_CredentialState *creds = NULL;
+ enum dcerpc_AuthType auth_type = DCERPC_AUTH_TYPE_NONE;
+ enum dcerpc_AuthLevel auth_level = DCERPC_AUTH_LEVEL_NONE;
+
+ dcesrv_call_auth_info(dce_call, &auth_type, &auth_level);
+
+ nt_status = schannel_check_creds_state(mem_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ computer_name,
+ received_authenticator,
+ return_authenticator,
+ &creds);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ ZERO_STRUCTP(return_authenticator);
+ return nt_status;
+ }
+
+ nt_status = dcesrv_netr_check_schannel(dce_call,
+ creds,
+ auth_type,
+ auth_level,
+ dce_call->pkt.u.request.opnum);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ TALLOC_FREE(creds);
+ ZERO_STRUCTP(return_authenticator);
+ return nt_status;
+ }
+
+ *creds_out = creds;
+ return NT_STATUS_OK;
+}
diff --git a/librpc/rpc/server/netlogon/schannel_util.h b/librpc/rpc/server/netlogon/schannel_util.h
new file mode 100644
index 0000000..561e256
--- /dev/null
+++ b/librpc/rpc/server/netlogon/schannel_util.h
@@ -0,0 +1,54 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ netlogon schannel utility functions
+
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2008
+ Copyright (C) Stefan Metzmacher <metze@samba.org> 2005
+ Copyright (C) Matthias Dieter Wallnöfer 2009-2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __LIBRPC_RPC_SERVER_NETLOGON_SCHANNEL_UTIL_H__
+#define __LIBRPC_RPC_SERVER_NETLOGON_SCHANNEL_UTIL_H__
+
+#include "replace.h"
+#include <talloc.h>
+#include "libcli/util/ntstatus.h"
+
+#define NETLOGON_SERVER_PIPE_STATE_MAGIC 0x4f555358
+
+struct dcesrv_call_state;
+struct netlogon_creds_CredentialState;
+struct netr_Authenticator;
+enum dcerpc_AuthType;
+enum dcerpc_AuthLevel;
+
+NTSTATUS dcesrv_netr_check_schannel(
+ struct dcesrv_call_state *dce_call,
+ const struct netlogon_creds_CredentialState *creds,
+ enum dcerpc_AuthType auth_type,
+ enum dcerpc_AuthLevel auth_level,
+ uint16_t opnum);
+
+NTSTATUS dcesrv_netr_creds_server_step_check(
+ struct dcesrv_call_state *dce_call,
+ TALLOC_CTX *mem_ctx,
+ const char *computer_name,
+ struct netr_Authenticator *received_authenticator,
+ struct netr_Authenticator *return_authenticator,
+ struct netlogon_creds_CredentialState **creds_out);
+
+#endif /* __LIBRPC_RPC_SERVER_NETLOGON_SCHANNEL_UTIL_H__ */
diff --git a/librpc/tables.pl b/librpc/tables.pl
new file mode 100755
index 0000000..b7ac6e0
--- /dev/null
+++ b/librpc/tables.pl
@@ -0,0 +1,87 @@
+#!/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_help = 0;
+
+
+#########################################
+# display help text
+sub ShowHelp()
+{
+ print "
+ perl NDR interface table generator
+ Copyright (C) tridge\@samba.org
+
+ Usage: tables.pl [options] <idlfile>
+
+ \n";
+ exit(0);
+}
+
+# main program
+GetOptions (
+ 'help|h|?' => \$opt_help,
+ );
+
+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 ndr_interface_table (\w+);/) {
+ $found = 1;
+ $init_fns.="\tstatus = ndr_table_register(&$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/ndr/libndr.h"
+#include "librpc/ndr/ndr_table.h"
+EOF
+
+process_file($_) foreach (@ARGV);
+
+print <<EOF;
+
+NTSTATUS ndr_table_register_builtin_tables(void)
+{
+ NTSTATUS status;
+
+$init_fns
+
+ return NT_STATUS_OK;
+}
+EOF
diff --git a/librpc/tests/test_ndr.c b/librpc/tests/test_ndr.c
new file mode 100644
index 0000000..a26c75a
--- /dev/null
+++ b/librpc/tests/test_ndr.c
@@ -0,0 +1,142 @@
+/*
+ * Tests for librpc ndr functions
+ *
+ * Copyright (C) Catalyst.NET Ltd 2020
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * from cmocka.c:
+ * These headers or their equivalents should be included prior to
+ * including
+ * this header file.
+ *
+ * #include <stdarg.h>
+ * #include <stddef.h>
+ * #include <setjmp.h>
+ *
+ * This allows test applications to use custom definitions of C standard
+ * library functions and types.
+ *
+ */
+#include "replace.h"
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "librpc/ndr/libndr.h"
+
+/*
+ * Test NDR_PULL_NEED_BYTES integer overflow handling.
+ */
+static enum ndr_err_code wrap_NDR_PULL_NEED_BYTES(
+ struct ndr_pull *ndr,
+ uint32_t bytes) {
+
+ NDR_PULL_NEED_BYTES(ndr, bytes);
+ return NDR_ERR_SUCCESS;
+}
+
+static void test_NDR_PULL_NEED_BYTES(void **state)
+{
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+
+ ndr.data_size = UINT32_MAX;
+ ndr.offset = UINT32_MAX -1;
+
+ /*
+ * This will not cause an overflow
+ */
+ err = wrap_NDR_PULL_NEED_BYTES(&ndr, 1);
+ assert_int_equal(NDR_ERR_SUCCESS, err);
+
+ /*
+ * This will cause an overflow
+ * and (offset + n) will be less than data_size
+ */
+ err = wrap_NDR_PULL_NEED_BYTES(&ndr, 2);
+ assert_int_equal(NDR_ERR_BUFSIZE, err);
+}
+
+/*
+ * Test NDR_PULL_ALIGN integer overflow handling.
+ */
+static enum ndr_err_code wrap_NDR_PULL_ALIGN(
+ struct ndr_pull *ndr,
+ uint32_t bytes) {
+
+ NDR_PULL_ALIGN(ndr, bytes);
+ return NDR_ERR_SUCCESS;
+}
+
+static void test_NDR_PULL_ALIGN(void **state)
+{
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+
+ ndr.data_size = UINT32_MAX;
+ ndr.offset = UINT32_MAX -1;
+
+ /*
+ * This will not cause an overflow
+ */
+ err = wrap_NDR_PULL_ALIGN(&ndr, 2);
+ assert_int_equal(NDR_ERR_SUCCESS, err);
+
+ /*
+ * This will cause an overflow
+ * and (offset + n) will be less than data_size
+ */
+ err = wrap_NDR_PULL_ALIGN(&ndr, 4);
+ assert_int_equal(NDR_ERR_BUFSIZE, err);
+}
+
+/*
+ * Test ndr_pull_advance integer overflow handling.
+ */
+static void test_ndr_pull_advance(void **state)
+{
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+
+ ndr.data_size = UINT32_MAX;
+ ndr.offset = UINT32_MAX -1;
+
+ /*
+ * This will not cause an overflow
+ */
+ err = ndr_pull_advance(&ndr, 1);
+ assert_int_equal(NDR_ERR_SUCCESS, err);
+
+ /*
+ * This will cause an overflow
+ * and (offset + n) will be less than data_size
+ */
+ err = ndr_pull_advance(&ndr, 2);
+ assert_int_equal(NDR_ERR_BUFSIZE, err);
+}
+
+int main(int argc, const char **argv)
+{
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_NDR_PULL_NEED_BYTES),
+ cmocka_unit_test(test_NDR_PULL_ALIGN),
+ cmocka_unit_test(test_ndr_pull_advance),
+ };
+
+ cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/librpc/tests/test_ndr_dns_nbt.c b/librpc/tests/test_ndr_dns_nbt.c
new file mode 100644
index 0000000..1e2ef45
--- /dev/null
+++ b/librpc/tests/test_ndr_dns_nbt.c
@@ -0,0 +1,236 @@
+/*
+ * Tests for librpc ndr functions
+ *
+ * Copyright (C) Catalyst.NET Ltd 2020
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "replace.h"
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "includes.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/ndr_dns.h"
+#include "librpc/gen_ndr/ndr_nbt.h"
+#include "lib/util/time.h"
+
+#define NBT_NAME "EOGFGLGPCACACACACACACACACACACACA" /* "neko" */
+
+
+static DATA_BLOB generate_obnoxious_dns_name(TALLOC_CTX *mem_ctx,
+ size_t n_labels,
+ size_t dot_every,
+ bool is_nbt)
+{
+ size_t i, j;
+ char *s;
+ DATA_BLOB name = data_blob_talloc(mem_ctx, NULL, 64 * n_labels + 1);
+ assert_non_null(name.data);
+
+ s = (char*)name.data;
+ if (is_nbt) {
+ size_t len = strlen(NBT_NAME);
+ *s = len;
+ s++;
+ memcpy(s, NBT_NAME, len);
+ s += len;
+ n_labels--;
+ }
+
+ for (i = 0; i < n_labels; i++) {
+ *s = 63;
+ s++;
+ for (j = 0; j < 63; j++) {
+ if (j % dot_every == (dot_every - 1)) {
+ *s = '.';
+ } else {
+ *s = 'x';
+ }
+ s++;
+ }
+ }
+ *s = 0;
+ s++;
+ name.length = s - (char*)name.data;
+ return name;
+}
+
+
+static char *_test_ndr_pull_dns_string_list(TALLOC_CTX *mem_ctx,
+ size_t n_labels,
+ size_t dot_every,
+ bool is_nbt)
+{
+ enum ndr_err_code ndr_err;
+ DATA_BLOB blob = generate_obnoxious_dns_name(mem_ctx,
+ n_labels,
+ dot_every,
+ is_nbt);
+
+ char *name;
+ ndr_pull_flags_fn_t fn;
+
+ if (is_nbt) {
+ fn = (ndr_pull_flags_fn_t)ndr_pull_nbt_string;
+ } else {
+ fn = (ndr_pull_flags_fn_t)ndr_pull_dns_string;
+ }
+
+ ndr_err = ndr_pull_struct_blob(&blob,
+ mem_ctx,
+ &name,
+ fn);
+ /* Success here is not expected, but we let it go to measure timing. */
+ if (ndr_err == NDR_ERR_SUCCESS) {
+ printf("pull succeed\n");
+ } else {
+ assert_int_equal(ndr_err, NDR_ERR_STRING);
+ }
+
+ TALLOC_FREE(blob.data);
+ return name;
+}
+
+
+static void _test_ndr_push_dns_string_list(TALLOC_CTX *mem_ctx,
+ char *name,
+ bool is_nbt)
+{
+ DATA_BLOB blob;
+ enum ndr_err_code ndr_err;
+ ndr_push_flags_fn_t fn;
+
+ if (is_nbt) {
+ fn = (ndr_push_flags_fn_t)ndr_push_nbt_string;
+ } else {
+ fn = (ndr_push_flags_fn_t)ndr_push_dns_string;
+ }
+
+ ndr_err = ndr_push_struct_blob(&blob,
+ mem_ctx,
+ name,
+ fn);
+
+ /* Success here is not expected, but we let it go to measure timing. */
+ if (ndr_err == NDR_ERR_SUCCESS) {
+ printf("push succeed\n");
+ } else {
+ assert_int_equal(ndr_err, NDR_ERR_STRING);
+ }
+}
+
+
+static uint64_t elapsed_time(struct timespec start, const char *print)
+{
+ struct timespec end;
+ unsigned long long microsecs;
+ clock_gettime_mono(&end);
+ end.tv_sec -= start.tv_sec;
+ if (end.tv_nsec < start.tv_nsec) {
+ /* we need to borrow */
+ end.tv_nsec += 1000 * 1000 * 1000;
+ end.tv_sec -= 1;
+ }
+ end.tv_nsec -= start.tv_nsec;
+ microsecs = end.tv_sec * 1000000;
+ microsecs += end.tv_nsec / 1000;
+
+ if (print != NULL) {
+ printf(" %s: %llu microseconds\n", print, microsecs);
+ }
+ return microsecs;
+}
+
+
+static void test_ndr_dns_string_half_dots(void **state)
+{
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ char *name;
+ struct timespec start;
+ uint64_t elapsed;
+
+ clock_gettime_mono(&start);
+ name =_test_ndr_pull_dns_string_list(mem_ctx, 127, 2, false);
+ elapsed_time(start, "pull");
+ _test_ndr_push_dns_string_list(mem_ctx, name, false);
+ elapsed = elapsed_time(start, "total");
+ assert_in_range(elapsed, 0, 200000);
+ talloc_free(mem_ctx);
+}
+
+static void test_ndr_nbt_string_half_dots(void **state)
+{
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ char *name;
+ struct timespec start;
+ uint64_t elapsed;
+
+ clock_gettime_mono(&start);
+ name =_test_ndr_pull_dns_string_list(mem_ctx, 127, 2, true);
+ elapsed_time(start, "pull");
+ _test_ndr_push_dns_string_list(mem_ctx, name, true);
+ elapsed = elapsed_time(start, "total");
+ assert_in_range(elapsed, 0, 200000);
+ talloc_free(mem_ctx);
+}
+
+static void test_ndr_dns_string_all_dots(void **state)
+{
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ char *name;
+ struct timespec start;
+ uint64_t elapsed;
+
+ clock_gettime_mono(&start);
+ name =_test_ndr_pull_dns_string_list(mem_ctx, 127, 1, false);
+ elapsed_time(start, "pull");
+ _test_ndr_push_dns_string_list(mem_ctx, name, false);
+ elapsed = elapsed_time(start, "total");
+ assert_in_range(elapsed, 0, 200000);
+ talloc_free(mem_ctx);
+}
+
+static void test_ndr_nbt_string_all_dots(void **state)
+{
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ char *name;
+ struct timespec start;
+ uint64_t elapsed;
+
+ clock_gettime_mono(&start);
+ name =_test_ndr_pull_dns_string_list(mem_ctx, 127, 1, true);
+ elapsed_time(start, "pull");
+ _test_ndr_push_dns_string_list(mem_ctx, name, true);
+ elapsed = elapsed_time(start, "total");
+ assert_in_range(elapsed, 0, 200000);
+ talloc_free(mem_ctx);
+}
+
+
+
+int main(int argc, const char **argv)
+{
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_ndr_nbt_string_half_dots),
+ cmocka_unit_test(test_ndr_dns_string_half_dots),
+ cmocka_unit_test(test_ndr_nbt_string_all_dots),
+ cmocka_unit_test(test_ndr_dns_string_all_dots),
+ };
+
+ cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/librpc/tests/test_ndr_macros.c b/librpc/tests/test_ndr_macros.c
new file mode 100644
index 0000000..337bc95
--- /dev/null
+++ b/librpc/tests/test_ndr_macros.c
@@ -0,0 +1,136 @@
+/*
+ * Tests for librpc ndr functions
+ *
+ * Copyright (C) Catalyst.NET Ltd 2020
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * from cmocka.c:
+ * These headers or their equivalents should be included prior to
+ * including
+ * this header file.
+ *
+ * #include <stdarg.h>
+ * #include <stddef.h>
+ * #include <setjmp.h>
+ *
+ * This allows test applications to use custom definitions of C standard
+ * library functions and types.
+ *
+ */
+#include "replace.h"
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "librpc/ndr/libndr.h"
+
+/*
+ * Test NDR_RECURSION_CHECK.
+ */
+static enum ndr_err_code wrap_NDR_RECURSION_CHECK(
+ struct ndr_pull *ndr,
+ uint32_t bytes) {
+
+ NDR_RECURSION_CHECK(ndr, bytes);
+ return NDR_ERR_SUCCESS;
+}
+
+static void test_NDR_RECURSION_CHECK(void **state)
+{
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+
+
+ ndr.global_max_recursion = 0;
+ ndr.recursion_depth = 42;
+ err = wrap_NDR_RECURSION_CHECK(&ndr, 43);
+ assert_int_equal(NDR_ERR_SUCCESS, err);
+ assert_int_equal(43, ndr.recursion_depth);
+
+ ndr.global_max_recursion = 0;
+ ndr.recursion_depth = 43;
+ err = wrap_NDR_RECURSION_CHECK(&ndr, 43);
+ assert_int_equal(NDR_ERR_MAX_RECURSION_EXCEEDED, err);
+ assert_int_equal(44, ndr.recursion_depth);
+
+ ndr.global_max_recursion = 0;
+ ndr.recursion_depth = 44;
+ err = wrap_NDR_RECURSION_CHECK(&ndr, 43);
+ assert_int_equal(NDR_ERR_MAX_RECURSION_EXCEEDED, err);
+ assert_int_equal(45, ndr.recursion_depth);
+
+ ndr.global_max_recursion = 5;
+ ndr.recursion_depth = 5;
+ err = wrap_NDR_RECURSION_CHECK(&ndr, 20);
+ assert_int_equal(NDR_ERR_MAX_RECURSION_EXCEEDED, err);
+ assert_int_equal(6, ndr.recursion_depth);
+
+ ndr.global_max_recursion = 5;
+ ndr.recursion_depth = 4;
+ err = wrap_NDR_RECURSION_CHECK(&ndr, 20);
+ assert_int_equal(NDR_ERR_SUCCESS, err);
+ assert_int_equal(5, ndr.recursion_depth);
+
+ ndr.global_max_recursion = 20;
+ ndr.recursion_depth = 5;
+ err = wrap_NDR_RECURSION_CHECK(&ndr, 5);
+ assert_int_equal(NDR_ERR_MAX_RECURSION_EXCEEDED, err);
+ assert_int_equal(6, ndr.recursion_depth);
+
+ ndr.global_max_recursion = 20;
+ ndr.recursion_depth = 4;
+ err = wrap_NDR_RECURSION_CHECK(&ndr, 5);
+ assert_int_equal(NDR_ERR_SUCCESS, err);
+ assert_int_equal(5, ndr.recursion_depth);
+}
+
+/*
+ * Test NDR_RECURSION_RETURN.
+ */
+static enum ndr_err_code wrap_NDR_RECURSION_UNWIND(
+ struct ndr_pull *ndr) {
+
+ NDR_RECURSION_UNWIND(ndr);
+ return NDR_ERR_SUCCESS;
+}
+
+static void test_NDR_RECURSION_UNWIND(void **state)
+{
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+
+ ndr.recursion_depth = 5;
+ err = wrap_NDR_RECURSION_UNWIND(&ndr);
+ assert_int_equal(NDR_ERR_SUCCESS, err);
+ assert_int_equal(4, ndr.recursion_depth);
+
+ ndr.recursion_depth = 0;
+ err = wrap_NDR_RECURSION_UNWIND(&ndr);
+ assert_int_equal(NDR_ERR_UNDERFLOW, err);
+ assert_int_equal(0, ndr.recursion_depth);
+
+}
+int main(int argc, const char **argv)
+{
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_NDR_RECURSION_CHECK),
+ cmocka_unit_test(test_NDR_RECURSION_UNWIND),
+ };
+
+ cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/librpc/tests/test_ndr_string.c b/librpc/tests/test_ndr_string.c
new file mode 100644
index 0000000..24ec93b
--- /dev/null
+++ b/librpc/tests/test_ndr_string.c
@@ -0,0 +1,207 @@
+/*
+ * Tests for librpc ndr_string.c
+ *
+ * Copyright (C) Catalyst.NET Ltd 2019
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * from cmocka.c:
+ * These headers or their equivalents should be included prior to
+ * including
+ * this header file.
+ *
+ * #include <stdarg.h>
+ * #include <stddef.h>
+ * #include <setjmp.h>
+ *
+ * This allows test applications to use custom definitions of C standard
+ * library functions and types.
+ *
+ */
+#include "replace.h"
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "librpc/ndr/ndr_string.c"
+
+/*
+ * Try and pull a null terminated string from a zero length buffer
+ * Should fail for both 1 byte, and 2 byte character strings.
+ */
+static void test_pull_string_zero_len_nul_term(void **state)
+{
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+ int flags = NDR_SCALARS;
+ uint8_t data[] = {0x0, 0x0};
+ const char *s = NULL;
+
+ ndr.flags = LIBNDR_FLAG_STR_UTF8 | LIBNDR_FLAG_STR_NULLTERM;
+ ndr.data = data;
+ ndr.data_size = 0;
+ err = ndr_pull_string(&ndr, flags, &s);
+ assert_int_equal(err, NDR_ERR_BUFSIZE);
+ assert_null(s);
+ assert_int_equal(0, ndr.offset);
+
+ ndr.flags = LIBNDR_FLAG_STR_NULLTERM;
+ ndr.offset = 0;
+ err = ndr_pull_string(&ndr, flags, &s);
+ assert_int_equal(err, NDR_ERR_BUFSIZE);
+ assert_null(s);
+ assert_int_equal(0, ndr.offset);
+
+}
+
+/*
+ * Try and pull a null terminated string from a 1 byte buffer
+ * Should succeed for 1 byte character and
+ * fail for 2 byte character strings.
+ */
+static void test_pull_string_len_1_nul_term(void **state)
+{
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+ int flags = NDR_SCALARS;
+ const char *s = NULL;
+ uint8_t data[] = {0x0, 0x0};
+
+ ndr.flags = LIBNDR_FLAG_STR_UTF8 | LIBNDR_FLAG_STR_NULLTERM;
+ ndr.data = data;
+ ndr.data_size = 1;
+ err = ndr_pull_string(&ndr, flags, &s);
+ assert_int_equal(err, NDR_ERR_SUCCESS);
+ assert_non_null(s);
+ assert_int_equal(1, ndr.offset);
+
+ ndr.offset = 0;
+ ndr.flags = LIBNDR_FLAG_STR_NULLTERM;
+ err = ndr_pull_string(&ndr, flags, &s);
+ assert_int_equal(err, NDR_ERR_BUFSIZE);
+ assert_int_equal(0, ndr.offset);
+}
+
+/*
+ * Try and pull a null terminated string from a 2 byte buffer
+ * Should succeed for both 1 byte, and 2 byte character strings.
+ */
+static void test_pull_string_len_2_nul_term(void **state)
+{
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+ int flags = NDR_SCALARS;
+ const char *s;
+ uint8_t data[] = {0x0, 0x0};
+
+ ndr.flags = LIBNDR_FLAG_STR_UTF8 | LIBNDR_FLAG_STR_NULLTERM;
+ ndr.data = data;
+ ndr.data_size = 2;
+ err = ndr_pull_string(&ndr, flags, &s);
+ assert_int_equal(err, NDR_ERR_SUCCESS);
+ assert_non_null(s);
+ assert_int_equal(1, ndr.offset);
+
+ ndr.offset = 0;
+ ndr.flags = LIBNDR_FLAG_STR_NULLTERM;
+ err = ndr_pull_string(&ndr, flags, &s);
+ assert_int_equal(err, NDR_ERR_SUCCESS);
+ assert_non_null(s);
+ assert_int_equal(2, ndr.offset);
+
+
+}
+
+static void test_ndr_string_n_length(void **state)
+{
+ char test_str1[5] = "Test";
+ char test_str2[5] = {0};
+ char test_str3[32] = "This is a test too";
+ uint8_t test_str_u16[64] = {
+ 0x5C, 0x00, 0x5C, 0x00, 0x4C, 0x00, 0x6F, 0x00,
+ 0x67, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x2D, 0x00,
+ 0x6D, 0x00, 0x75, 0x00, 0x63, 0x00, 0x5C, 0x00,
+ 0x6B, 0x00, 0x79, 0x00, 0x6F, 0x00, 0x63, 0x00,
+ 0x65, 0x00, 0x72, 0x00, 0x61, 0x00, 0x2D, 0x00,
+ 0x6D, 0x00, 0x75, 0x00, 0x63, 0x00, 0x2D, 0x00,
+ 0x6E, 0x00, 0x00, 0x00 };
+ size_t len;
+
+ len = ndr_string_n_length(test_str1, sizeof(test_str1), 1);
+ assert_int_equal(len, 5);
+
+ len = ndr_string_n_length(test_str1, sizeof(test_str1) - 1, 1);
+ assert_int_equal(len, 4);
+
+ len = ndr_string_n_length(test_str2, sizeof(test_str2), 1);
+ assert_int_equal(len, 1);
+
+ len = ndr_string_n_length(test_str3, sizeof(test_str3), 1);
+ assert_int_equal(len, 19);
+
+ len = ndr_string_n_length(test_str3, 0, 1);
+ assert_int_equal(len, 0);
+
+ len = ndr_string_n_length(test_str_u16, 32, 2);
+ assert_int_equal(len, 26);
+}
+
+static void test_pull_string_array(void **state)
+{
+ /* We try pulling long string arrays without long strings */
+ const char **r = NULL;
+ struct ndr_pull ndr = {0};
+ enum ndr_err_code err;
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ size_t len = 1 * 1024 * 1024;
+ uint8_t *data = talloc_array(mem_ctx, uint8_t, len);
+ size_t i;
+
+ for (i = 0; i < len; i++) {
+ data[i] = (i & 1) ? '\0' : 'X';
+ }
+
+ ndr.current_mem_ctx = mem_ctx;
+
+ ndr.flags = (LIBNDR_FLAG_REF_ALLOC |
+ LIBNDR_FLAG_REMAINING |
+ LIBNDR_FLAG_STR_NULLTERM |
+ LIBNDR_FLAG_STR_RAW8);
+ ndr.data = data;
+ ndr.data_size = len;
+
+ err = ndr_pull_string_array(&ndr, NDR_SCALARS, &r);
+ assert_int_equal(err, NDR_ERR_SUCCESS);
+ assert_string_equal(r[0], "X");
+ assert_string_equal(r[len / 3], "X");
+ assert_string_equal(r[len / 2 - 1], "X");
+ assert_ptr_equal(r[len / 2], NULL);
+ TALLOC_FREE(mem_ctx);
+}
+
+int main(int argc, const char **argv)
+{
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_pull_string_zero_len_nul_term),
+ cmocka_unit_test(test_pull_string_len_1_nul_term),
+ cmocka_unit_test(test_pull_string_len_2_nul_term),
+ cmocka_unit_test(test_ndr_string_n_length),
+ cmocka_unit_test(test_pull_string_array)
+ };
+
+ cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/librpc/tools/ndrdump.1.xml b/librpc/tools/ndrdump.1.xml
new file mode 100644
index 0000000..fa6d763
--- /dev/null
+++ b/librpc/tools/ndrdump.1.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<refentry id="ndrdump.1">
+
+<refmeta>
+ <refentrytitle>ndrdump</refentrytitle>
+ <manvolnum>1</manvolnum>
+ <refmiscinfo class="source">Samba</refmiscinfo>
+ <refmiscinfo class="manual">System Administration tools</refmiscinfo>
+ <refmiscinfo class="version">4.0</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+ <refname>ndrdump</refname>
+ <refpurpose>DCE/RPC Packet Parser and Dumper</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+ <cmdsynopsis>
+ <command>ndrdump</command>
+ <arg choice="opt">-c context</arg>
+ <arg choice="req">pipe</arg>
+ <arg choice="req">format</arg>
+ <arg choice="req">in|out|struct</arg>
+ <arg choice="req">filename</arg>
+ </cmdsynopsis>
+ <cmdsynopsis>
+ <command>ndrdump</command>
+ <arg choice="opt">pipe</arg>
+ </cmdsynopsis>
+ <cmdsynopsis>
+ <command>ndrdump</command>
+ </cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+ <title>DESCRIPTION</title>
+
+ <para>ndrdump tries to parse the specified <replaceable>filename</replaceable>
+ using Samba's parser for the specified pipe and format. The
+ third argument should be
+ either <emphasis>in</emphasis>, <emphasis>out</emphasis>
+ or <emphasis>struct</emphasis>depending
+ on whether the data should be parsed as a request, reply or a
+ public structure.</para>
+
+ <para>Running ndrdump without arguments will list the pipes for which
+ parsers are available.</para>
+
+ <para>Running ndrdump with one argument will list the functions and
+ public structures that
+ Samba can parse for the specified pipe.</para>
+
+ <para>The primary function of ndrdump is debugging Samba's internal
+ DCE/RPC parsing functions. The file being parsed is usually
+ one exported by wiresharks <quote>Export selected packet bytes</quote>
+ function.</para>
+
+ <para>The context argument can be used to load context data from the request
+ packet when parsing reply packets (such as array lengths).</para>
+
+</refsect1>
+
+<refsect1>
+ <title>VERSION</title>
+
+ <para>This man page is correct for version 4.0 of the Samba suite.</para>
+</refsect1>
+
+<refsect1>
+ <title>SEE ALSO</title>
+
+ <para>wireshark, pidl</para>
+
+</refsect1>
+
+<refsect1>
+ <title>AUTHOR</title>
+
+ <para>This utility is part of the <ulink url="http://www.samba.org/">Samba</ulink> suite, which is developed by the global <ulink url="http://www.samba.org/samba/team/">Samba Team</ulink>.</para>
+
+ <para>ndrdump was written by Andrew Tridgell. </para>
+
+ <para>This manpage was written by Jelmer Vernooij. </para>
+
+</refsect1>
+
+</refentry>
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c
new file mode 100644
index 0000000..0d39ed3
--- /dev/null
+++ b/librpc/tools/ndrdump.c
@@ -0,0 +1,793 @@
+/*
+ Unix SMB/CIFS implementation.
+ SMB torture tester
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Jelmer Vernooij 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "system/filesys.h"
+#include "system/locale.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_table.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "lib/cmdline/cmdline.h"
+#include "param/param.h"
+#include "lib/util/base64.h"
+
+static const struct ndr_interface_call *find_function(
+ const struct ndr_interface_table *p,
+ const char *function)
+{
+ unsigned int i;
+ if (isdigit(function[0])) {
+ char *eptr = NULL;
+ i = strtoul(function, &eptr, 0);
+ if (i >= p->num_calls
+ || eptr == NULL
+ || eptr[0] != '\0') {
+ printf("Function number '%s' not found\n",
+ function);
+ exit(1);
+ }
+ return &p->calls[i];
+ }
+ for (i=0;i<p->num_calls;i++) {
+ if (strcmp(p->calls[i].name, function) == 0) {
+ break;
+ }
+ }
+ if (i == p->num_calls) {
+ printf("Function '%s' not found\n", function);
+ exit(1);
+ }
+ return &p->calls[i];
+}
+
+/*
+ * Find a public structure on the pipe and return it as if it were
+ * a function (as the rest of ndrdump is based around functions)
+ */
+static const struct ndr_interface_call *find_struct(
+ const struct ndr_interface_table *p,
+ const char *struct_name,
+ struct ndr_interface_call *out_buffer)
+{
+ unsigned int i;
+ const struct ndr_interface_public_struct *public_struct = NULL;
+ if (isdigit(struct_name[0])) {
+ char *eptr = NULL;
+ i = strtoul(struct_name, &eptr, 0);
+ if (i >= p->num_public_structs
+ || eptr == NULL
+ || eptr[0] != '\0') {
+ printf("Public structure number '%s' not found\n",
+ struct_name);
+ exit(1);
+ }
+ public_struct = &p->public_structs[i];
+ } else {
+ for (i=0;i<p->num_public_structs;i++) {
+ if (strcmp(p->public_structs[i].name, struct_name) == 0) {
+ break;
+ }
+ }
+ if (i == p->num_public_structs) {
+ printf("Public structure '%s' not found\n", struct_name);
+ exit(1);
+ }
+ public_struct = &p->public_structs[i];
+ }
+ *out_buffer = (struct ndr_interface_call) {
+ .name = public_struct->name,
+ .struct_size = public_struct->struct_size,
+ .ndr_pull = public_struct->ndr_pull,
+ .ndr_push = public_struct->ndr_push,
+ .ndr_print = public_struct->ndr_print
+ };
+ return out_buffer;
+}
+
+_NORETURN_ static void show_pipes(void)
+{
+ const struct ndr_interface_list *l;
+ printf("\nYou must specify a pipe\n");
+ printf("known pipes are:\n");
+ for (l=ndr_table_list();l;l=l->next) {
+ if(l->table->helpstring) {
+ printf("\t%s - %s\n", l->table->name, l->table->helpstring);
+ } else {
+ printf("\t%s\n", l->table->name);
+ }
+ }
+ exit(1);
+}
+
+_NORETURN_ static void show_functions(const struct ndr_interface_table *p)
+{
+ int i;
+ printf("\nYou must specify a function\n");
+ printf("known functions on '%s' are:\n", p->name);
+ for (i=0;i<p->num_calls;i++) {
+ printf("\t0x%02x (%2d) %s\n", i, i, p->calls[i].name);
+ }
+ printf("known public structures on '%s' are:\n", p->name);
+ for (i=0;i<p->num_public_structs;i++) {
+ printf("\t%s\n", p->public_structs[i].name);
+ }
+ exit(1);
+}
+
+static char *stdin_load(TALLOC_CTX *mem_ctx, size_t *size)
+{
+ int num_read, total_len = 0;
+ char buf[255];
+ char *result = NULL;
+
+ while((num_read = read(STDIN_FILENO, buf, 255)) > 0) {
+
+ if (result) {
+ result = talloc_realloc(
+ mem_ctx, result, char, total_len + num_read);
+ } else {
+ result = talloc_array(mem_ctx, char, num_read);
+ }
+
+ memcpy(result + total_len, buf, num_read);
+
+ total_len += num_read;
+ }
+
+ if (size)
+ *size = total_len;
+
+ return result;
+}
+
+static const struct ndr_interface_table *load_iface_from_plugin(const char *plugin, const char *pipe_name)
+{
+ const struct ndr_interface_table *p;
+ void *handle;
+ char *symbol;
+
+ handle = dlopen(plugin, RTLD_NOW);
+ if (handle == NULL) {
+ printf("%s: Unable to open: %s\n", plugin, dlerror());
+ return NULL;
+ }
+
+ symbol = talloc_asprintf(NULL, "ndr_table_%s", pipe_name);
+ p = (const struct ndr_interface_table *)dlsym(handle, symbol);
+
+ if (!p) {
+ printf("%s: Unable to find DCE/RPC interface table for '%s': %s\n", plugin, pipe_name, dlerror());
+ talloc_free(symbol);
+ dlclose(handle);
+ return NULL;
+ }
+
+ talloc_free(symbol);
+
+ return p;
+}
+
+static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
+{
+ dump_data_file(d, l, !force, stdout);
+}
+
+static void ndrdump_data_diff(const uint8_t *d1, size_t l1,
+ const uint8_t *d2, size_t l2,
+ bool force)
+{
+ dump_data_file_diff(stdout, !force, d1, l1, d2, l2);
+}
+
+static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
+ struct ndr_pull *ndr_pull,
+ struct ndr_print *ndr_print,
+ const struct ndr_interface_call_pipes *pipes)
+{
+ enum ndr_err_code ndr_err;
+ uint32_t i;
+
+ for (i=0; i < pipes->num_pipes; i++) {
+ uint64_t idx = 0;
+ while (true) {
+ void *saved_mem_ctx;
+ uint32_t *count;
+ void *c;
+ char *n;
+
+ c = talloc_zero_size(ndr_pull, pipes->pipes[i].chunk_struct_size);
+ talloc_set_name(c, "struct %s", pipes->pipes[i].name);
+ /*
+ * Note: the first struct member is always
+ * 'uint32_t count;'
+ */
+ count = (uint32_t *)c;
+
+ n = talloc_asprintf(c, "%s: %s[%llu]",
+ function, pipes->pipes[i].name,
+ (unsigned long long)idx);
+
+ saved_mem_ctx = ndr_pull->current_mem_ctx;
+ ndr_pull->current_mem_ctx = c;
+ ndr_err = pipes->pipes[i].ndr_pull(ndr_pull, NDR_SCALARS, c);
+ ndr_pull->current_mem_ctx = saved_mem_ctx;
+
+ printf("pull returned %s\n",
+ ndr_map_error2string(ndr_err));
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(c);
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+ pipes->pipes[i].ndr_print(ndr_print, n, c);
+ if (*count == 0) {
+ talloc_free(c);
+ break;
+ }
+ talloc_free(c);
+ idx++;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
+{
+ /* This is here so that you can turn ndr printing off for the purposes
+ of benchmarking ndr parsing. */
+}
+
+ int main(int argc, const char *argv[])
+{
+ const struct ndr_interface_table *p = NULL;
+ const struct ndr_interface_call *f;
+ struct ndr_interface_call f_buffer;
+ const char *pipe_name = NULL;
+ const char *filename = NULL;
+ /*
+ * The format type:
+ * in: a request
+ * out: a response
+ * struct: a public structure
+ */
+ const char *type = NULL;
+ /*
+ * Format is either the name of the decoding function or the
+ * name of a public structure
+ */
+ const char *format = NULL;
+ const char *cmdline_input = NULL;
+ const uint8_t *data;
+ size_t size;
+ DATA_BLOB blob;
+ struct ndr_pull *ndr_pull;
+ struct ndr_print *ndr_print;
+ TALLOC_CTX *mem_ctx;
+ int flags = 0;
+ poptContext pc;
+ NTSTATUS status;
+ enum ndr_err_code ndr_err;
+ void *st;
+ void *v_st;
+ const char *ctx_filename = NULL;
+ const char *plugin = NULL;
+ bool validate = false;
+ bool dumpdata = false;
+ bool assume_ndr64 = false;
+ bool quiet = false;
+ bool hex_input = false;
+ bool base64_input = false;
+ bool print_after_parse_failure = false;
+ int opt;
+ enum {
+ OPT_CONTEXT_FILE=1000,
+ OPT_VALIDATE,
+ OPT_DUMP_DATA,
+ OPT_LOAD_DSO,
+ OPT_NDR64,
+ OPT_QUIET,
+ OPT_BASE64_INPUT,
+ OPT_HEX_INPUT,
+ OPT_CMDLINE_INPUT,
+ OPT_PRINT_AFTER_PARSE_FAILURE,
+ };
+ struct poptOption long_options[] = {
+ POPT_AUTOHELP
+ {"context-file", 'c', POPT_ARG_STRING, NULL, OPT_CONTEXT_FILE, "In-filename to parse first", "CTX-FILE" },
+ {"validate", 0, POPT_ARG_NONE, NULL, OPT_VALIDATE, "try to validate the data", NULL },
+ {"dump-data", 0, POPT_ARG_NONE, NULL, OPT_DUMP_DATA, "dump the hex data", NULL },
+ {"load-dso", 0, POPT_ARG_STRING, NULL, OPT_LOAD_DSO, "load from shared object file", NULL },
+ {"ndr64", 0, POPT_ARG_NONE, NULL, OPT_NDR64, "Assume NDR64 data", NULL },
+ {"quiet", 0, POPT_ARG_NONE, NULL, OPT_QUIET, "Don't actually dump anything", NULL },
+ {"base64-input", 0, POPT_ARG_NONE, NULL, OPT_BASE64_INPUT, "Read the input file in as a base64 string", NULL },
+ {"hex-input", 0, POPT_ARG_NONE, NULL, OPT_HEX_INPUT, "Read the input file in as a hex dump", NULL },
+ {"input", 0, POPT_ARG_STRING, NULL, OPT_CMDLINE_INPUT, "Provide the input on the command line (use with --base64-input)", "INPUT" },
+ {"print-after-parse-failure", 0, POPT_ARG_NONE, NULL, OPT_PRINT_AFTER_PARSE_FAILURE,
+ "Try to print structures that fail to parse (used to develop parsers, segfaults are likely).", NULL },
+ POPT_COMMON_SAMBA
+ POPT_COMMON_VERSION
+ POPT_TABLEEND
+ };
+ uint32_t highest_ofs;
+ struct dcerpc_sec_verification_trailer *sec_vt = NULL;
+ bool ok;
+
+ ndr_table_init();
+
+ /* Initialise samba stuff */
+ smb_init_locale();
+
+ setlinebuf(stdout);
+
+ mem_ctx = talloc_init("ndrdump.c/main");
+ if (mem_ctx == NULL) {
+ exit(ENOMEM);
+ }
+
+ ok = samba_cmdline_init(mem_ctx,
+ SAMBA_CMDLINE_CONFIG_CLIENT,
+ false /* require_smbconf */);
+ if (!ok) {
+ DBG_ERR("Failed to init cmdline parser!\n");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ pc = samba_popt_get_context(getprogname(),
+ argc,
+ argv,
+ long_options,
+ 0);
+ if (pc == NULL) {
+ DBG_ERR("Failed to setup popt context!\n");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ poptSetOtherOptionHelp(
+ pc, "<pipe|uuid> <format> <in|out|struct> [<filename>]");
+
+ while ((opt = poptGetNextOpt(pc)) != -1) {
+ switch (opt) {
+ case OPT_CONTEXT_FILE:
+ ctx_filename = poptGetOptArg(pc);
+ break;
+ case OPT_VALIDATE:
+ validate = true;
+ break;
+ case OPT_DUMP_DATA:
+ dumpdata = true;
+ break;
+ case OPT_LOAD_DSO:
+ plugin = poptGetOptArg(pc);
+ break;
+ case OPT_NDR64:
+ assume_ndr64 = true;
+ break;
+ case OPT_QUIET:
+ quiet = true;
+ break;
+ case OPT_BASE64_INPUT:
+ base64_input = true;
+ break;
+ case OPT_HEX_INPUT:
+ hex_input = true;
+ break;
+ case OPT_CMDLINE_INPUT:
+ cmdline_input = poptGetOptArg(pc);
+ break;
+ case OPT_PRINT_AFTER_PARSE_FAILURE:
+ print_after_parse_failure = true;
+ break;
+ }
+ }
+
+ pipe_name = poptGetArg(pc);
+
+ if (!pipe_name) {
+ poptPrintUsage(pc, stderr, 0);
+ show_pipes();
+ exit(1);
+ }
+
+ if (plugin != NULL) {
+ p = load_iface_from_plugin(plugin, pipe_name);
+ }
+ if (!p) {
+ p = ndr_table_by_name(pipe_name);
+ }
+
+ if (!p) {
+ struct GUID uuid;
+
+ status = GUID_from_string(pipe_name, &uuid);
+
+ if (NT_STATUS_IS_OK(status)) {
+ p = ndr_table_by_uuid(&uuid);
+ }
+ }
+
+ if (!p) {
+ printf("Unknown pipe or UUID '%s'\n", pipe_name);
+ exit(1);
+ }
+
+ format = poptGetArg(pc);
+ type = poptGetArg(pc);
+ filename = poptGetArg(pc);
+
+ if (!format || !type) {
+ poptPrintUsage(pc, stderr, 0);
+ show_functions(p);
+ exit(1);
+ }
+
+ if (strcmp(type, "struct") == 0) {
+ flags = NDR_SCALARS|NDR_BUFFERS; /* neither NDR_IN nor NDR_OUT */
+ f = find_struct(p, format, &f_buffer);
+ } else {
+ f = find_function(p, format);
+ if (strcmp(type, "in") == 0 ||
+ strcmp(type, "request") == 0) {
+ flags |= NDR_IN;
+ } else if (strcmp(type, "out") == 0 ||
+ strcmp(type, "response") == 0) {
+ flags |= NDR_OUT;
+ } else {
+ printf("Bad type value '%s'\n", type);
+ exit(1);
+ }
+ }
+
+ st = talloc_zero_size(mem_ctx, f->struct_size);
+ if (!st) {
+ printf("Unable to allocate %d bytes for %s structure\n",
+ (int)f->struct_size,
+ f->name);
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ v_st = talloc_zero_size(mem_ctx, f->struct_size);
+ if (!v_st) {
+ printf("Unable to allocate %d bytes for %s validation "
+ "structure\n",
+ (int)f->struct_size,
+ f->name);
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ if (ctx_filename) {
+ if (flags & NDR_IN) {
+ printf("Context file can only be used for \"out\" packages\n");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ data = (uint8_t *)file_load(ctx_filename, &size, 0, mem_ctx);
+ if (!data) {
+ perror(ctx_filename);
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ blob = data_blob_const(data, size);
+
+ ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
+ if (ndr_pull == NULL) {
+ perror("ndr_pull_init_blob");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+ ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+ if (assume_ndr64) {
+ ndr_pull->flags |= LIBNDR_FLAG_NDR64;
+ }
+
+ ndr_err = f->ndr_pull(ndr_pull, NDR_IN, st);
+
+ if (ndr_pull->offset > ndr_pull->relative_highest_offset) {
+ highest_ofs = ndr_pull->offset;
+ } else {
+ highest_ofs = ndr_pull->relative_highest_offset;
+ }
+
+ if (highest_ofs != ndr_pull->data_size) {
+ printf("WARNING! %d unread bytes while parsing context file\n", ndr_pull->data_size - highest_ofs);
+ }
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ printf("pull for context file returned %s\n",
+ ndr_map_error2string(ndr_err));
+ TALLOC_FREE(mem_ctx);
+ exit(2);
+ }
+ memcpy(v_st, st, f->struct_size);
+ }
+
+ if (filename && cmdline_input) {
+ printf("cannot combine --input with a filename\n");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ } else if (cmdline_input) {
+ data = (const uint8_t *)cmdline_input;
+ size = strlen(cmdline_input);
+ } else if (filename) {
+ data = (uint8_t *)file_load(filename, &size, 0, mem_ctx);
+ } else {
+ data = (uint8_t *)stdin_load(mem_ctx, &size);
+ }
+
+ if (!data) {
+ if (filename)
+ perror(filename);
+ else
+ perror("stdin");
+ exit(1);
+ }
+
+ if (hex_input && base64_input) {
+ printf("cannot combine --hex-input with --base64-input\n");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+
+ } else if (hex_input) {
+ blob = hexdump_to_data_blob(mem_ctx, (const char *)data, size);
+ } else if (base64_input) {
+ /* Use talloc_strndup() to ensure null termination */
+ blob = base64_decode_data_blob_talloc(
+ mem_ctx,
+ talloc_strndup(mem_ctx, (const char *)data, size));
+ } else {
+ blob = data_blob_const(data, size);
+ }
+
+ if (data != NULL && blob.data == NULL) {
+ printf("failed to decode input data\n");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
+ if (ndr_pull == NULL) {
+ perror("ndr_pull_init_blob");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+ ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+ if (assume_ndr64) {
+ ndr_pull->flags |= LIBNDR_FLAG_NDR64;
+ }
+
+ ndr_print = talloc_zero(mem_ctx, struct ndr_print);
+ if (quiet) {
+ ndr_print->print = ndr_print_dummy;
+ } else {
+ ndr_print->print = ndr_print_printf_helper;
+ }
+ ndr_print->depth = 1;
+
+ ndr_err = ndr_pop_dcerpc_sec_verification_trailer(ndr_pull, mem_ctx, &sec_vt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ printf("ndr_pop_dcerpc_sec_verification_trailer returned %s\n",
+ ndr_map_error2string(ndr_err));
+ }
+
+ if (sec_vt != NULL && sec_vt->count.count > 0) {
+ printf("SEC_VT: consumed %d bytes\n",
+ (int)(blob.length - ndr_pull->data_size));
+ if (dumpdata) {
+ ndrdump_data(blob.data + ndr_pull->data_size,
+ blob.length - ndr_pull->data_size,
+ dumpdata);
+ }
+ ndr_print_dcerpc_sec_verification_trailer(ndr_print, "SEC_VT", sec_vt);
+ }
+ TALLOC_FREE(sec_vt);
+
+ if (flags & NDR_OUT) {
+ status = ndrdump_pull_and_print_pipes(format,
+ ndr_pull,
+ ndr_print,
+ &f->out_pipes);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("pull and dump of OUT pipes FAILED: %s\n",
+ nt_errstr(status));
+ TALLOC_FREE(mem_ctx);
+ exit(2);
+ }
+ }
+
+ ndr_err = f->ndr_pull(ndr_pull, flags, st);
+ printf("pull returned %s\n",
+ ndr_map_error2string(ndr_err));
+
+ if (ndr_pull->offset > ndr_pull->relative_highest_offset) {
+ highest_ofs = ndr_pull->offset;
+ } else {
+ highest_ofs = ndr_pull->relative_highest_offset;
+ }
+
+ if (dumpdata) {
+ printf("%d bytes consumed\n", highest_ofs);
+ ndrdump_data(blob.data, blob.length, dumpdata);
+ }
+
+ if (!print_after_parse_failure && !NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ TALLOC_FREE(mem_ctx);
+ exit(2);
+ }
+
+ if (highest_ofs != ndr_pull->data_size) {
+ printf("WARNING! %d unread bytes\n", ndr_pull->data_size - highest_ofs);
+ ndrdump_data(ndr_pull->data+highest_ofs,
+ ndr_pull->data_size - highest_ofs,
+ dumpdata);
+ }
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ printf("WARNING: pull of %s was incomplete, "
+ "therefore the parse below may SEGFAULT\n",
+ f->name);
+ }
+
+ f->ndr_print(ndr_print, f->name, flags, st);
+
+ if (flags & NDR_IN) {
+ status = ndrdump_pull_and_print_pipes(format,
+ ndr_pull,
+ ndr_print,
+ &f->in_pipes);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("pull and dump of IN pipes FAILED: %s\n",
+ nt_errstr(status));
+ exit(1);
+ }
+ }
+
+ /* Do not proceed to validate if we got an error */
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ printf("dump of failed-to-parse %s complete\n",
+ f->name);
+ TALLOC_FREE(mem_ctx);
+ exit(2);
+ }
+
+ if (validate) {
+ DATA_BLOB v_blob;
+ struct ndr_push *ndr_v_push;
+ struct ndr_pull *ndr_v_pull;
+ struct ndr_print *ndr_v_print;
+ uint32_t highest_v_ofs;
+ uint32_t i;
+ uint8_t byte_a, byte_b;
+ bool differ;
+
+ ndr_v_push = ndr_push_init_ctx(mem_ctx);
+ if (ndr_v_push == NULL) {
+ printf("No memory\n");
+ exit(1);
+ }
+
+ if (assume_ndr64) {
+ ndr_v_push->flags |= LIBNDR_FLAG_NDR64;
+ }
+
+ ndr_err = f->ndr_push(ndr_v_push, flags, st);
+ printf("push returned %s\n",
+ ndr_map_error2string(ndr_err));
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ printf("validate push FAILED\n");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ v_blob = ndr_push_blob(ndr_v_push);
+
+ if (dumpdata) {
+ printf("%ld bytes generated (validate)\n", (long)v_blob.length);
+ ndrdump_data(v_blob.data, v_blob.length, dumpdata);
+ }
+
+ ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx);
+ if (ndr_v_pull == NULL) {
+ perror("ndr_pull_init_blob");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+ ndr_v_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+
+ ndr_err = f->ndr_pull(ndr_v_pull, flags, v_st);
+ printf("pull returned %s\n",
+ ndr_map_error2string(ndr_err));
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ printf("validate pull FAILED\n");
+ TALLOC_FREE(mem_ctx);
+ exit(1);
+ }
+
+ if (ndr_v_pull->offset > ndr_v_pull->relative_highest_offset) {
+ highest_v_ofs = ndr_v_pull->offset;
+ } else {
+ highest_v_ofs = ndr_v_pull->relative_highest_offset;
+ }
+
+ if (highest_v_ofs != ndr_v_pull->data_size) {
+ printf("WARNING! %d unread bytes in validation\n",
+ ndr_v_pull->data_size - highest_v_ofs);
+ ndrdump_data(ndr_v_pull->data + highest_v_ofs,
+ ndr_v_pull->data_size - highest_v_ofs,
+ dumpdata);
+ }
+
+ ndr_v_print = talloc_zero(mem_ctx, struct ndr_print);
+ ndr_v_print->print = ndr_print_debug_helper;
+ ndr_v_print->depth = 1;
+ f->ndr_print(ndr_v_print,
+ format,
+ flags, v_st);
+
+ if (blob.length != v_blob.length) {
+ printf("WARNING! orig bytes:%llu validated pushed bytes:%llu\n",
+ (unsigned long long)blob.length, (unsigned long long)v_blob.length);
+ }
+
+ if (highest_ofs != highest_v_ofs) {
+ printf("WARNING! orig pulled bytes:%llu validated pulled bytes:%llu\n",
+ (unsigned long long)highest_ofs, (unsigned long long)highest_v_ofs);
+ }
+
+ differ = false;
+ byte_a = 0x00;
+ byte_b = 0x00;
+ for (i=0; i < blob.length; i++) {
+ byte_a = blob.data[i];
+
+ if (i == v_blob.length) {
+ byte_b = 0x00;
+ differ = true;
+ break;
+ }
+
+ byte_b = v_blob.data[i];
+
+ if (byte_a != byte_b) {
+ differ = true;
+ break;
+ }
+ }
+ if (differ) {
+ printf("WARNING! orig and validated differ at byte 0x%02X (%u)\n", i, i);
+ printf("WARNING! orig byte[0x%02X] = 0x%02X validated byte[0x%02X] = 0x%02X\n",
+ i, byte_a, i, byte_b);
+ ndrdump_data_diff(blob.data, blob.length,
+ v_blob.data, v_blob.length,
+ dumpdata);
+ }
+ }
+
+ printf("dump OK\n");
+ TALLOC_FREE(mem_ctx);
+
+ poptFreeContext(pc);
+
+ return 0;
+}
diff --git a/librpc/tools/wscript_build b/librpc/tools/wscript_build
new file mode 100644
index 0000000..3f2f950
--- /dev/null
+++ b/librpc/tools/wscript_build
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+bld.SAMBA_BINARY('ndrdump',
+ source='ndrdump.c',
+ manpages='ndrdump.1',
+ deps='samba-hostconfig samba-util popt CMDLINE_S4 ndr-table samba-errors NDR_DCERPC'
+ )
diff --git a/librpc/wscript_build b/librpc/wscript_build
new file mode 100644
index 0000000..7913b7c
--- /dev/null
+++ b/librpc/wscript_build
@@ -0,0 +1,773 @@
+#!/usr/bin/env python
+
+bld.RECURSE('idl')
+bld.RECURSE('../lib/compression')
+
+bld.SAMBA_SUBSYSTEM('NDR_AUDIOSRV',
+ source='gen_ndr/ndr_audiosrv.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_AUTH',
+ source='gen_ndr/ndr_auth.c ndr/ndr_auth.c',
+ public_headers='gen_ndr/auth.h',
+ header_path='gen_ndr',
+ public_deps='ndr NDR_SECURITY ndr-krb5pac'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_ATSVC',
+ source='gen_ndr/ndr_atsvc.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NAMED_PIPE_AUTH',
+ source='gen_ndr/ndr_named_pipe_auth.c',
+ public_deps='ndr NDR_AUTH'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DNSSERVER',
+ source='gen_ndr/ndr_dnsserver.c ndr/ndr_dnsserver.c',
+ public_deps='ndr NDR_DNSP'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DNS',
+ source='gen_ndr/ndr_dns.c ndr/ndr_dns.c ndr/ndr_dns_utils.c',
+ public_deps='ndr NDR_DNSP'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DSBACKUP',
+ source='gen_ndr/ndr_dsbackup.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DFS',
+ source='gen_ndr/ndr_dfs.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_WINREG',
+ source='gen_ndr/ndr_winreg.c',
+ public_deps='ndr NDR_SECURITY NDR_LSA'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_EFS',
+ source='gen_ndr/ndr_efs.c',
+ public_deps='ndr NDR_SECURITY'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_ROT',
+ source='gen_ndr/ndr_rot.c',
+ public_deps='ndr NDR_ORPC'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_FRSRPC',
+ source='ndr/ndr_frsrpc.c gen_ndr/ndr_frsrpc.c',
+ public_deps='ndr NDR_FSCC'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_FRSAPI',
+ source='gen_ndr/ndr_frsapi.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_FRSTRANS',
+ source='gen_ndr/ndr_frstrans.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DFSBLOBS',
+ source='gen_ndr/ndr_dfsblobs.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_BKUPBLOBS',
+ source='ndr/ndr_bkupblobs.c gen_ndr/ndr_bkupblobs.c',
+ public_deps='ndr NDR_SECURITY NDR_FSCC'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_FSCC',
+ source='gen_ndr/ndr_fscc.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_POLICYAGENT',
+ source='gen_ndr/ndr_policyagent.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_UNIXINFO',
+ source='gen_ndr/ndr_unixinfo.c',
+ public_deps='ndr NDR_SECURITY'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SPOOLSS',
+ source='gen_ndr/ndr_spoolss.c',
+ public_deps='ndr NDR_SPOOLSS_BUF NDR_SECURITY'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SPOOLSS_BUF',
+ source='ndr/ndr_spoolss_buf.c',
+ deps='talloc'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_WINSPOOL',
+ source='gen_ndr/ndr_winspool.c',
+ public_deps='ndr NDR_SPOOLSS'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_PRINTCAP',
+ source='gen_ndr/ndr_printcap.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_EPMAPPER',
+ source='gen_ndr/ndr_epmapper.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DBGIDL',
+ source='gen_ndr/ndr_dbgidl.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DSSETUP',
+ source='gen_ndr/ndr_dssetup.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_MSGSVC',
+ source='gen_ndr/ndr_msgsvc.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_MGMT',
+ source='gen_ndr/ndr_mgmt.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_ORPC',
+ source='ndr/ndr_orpc.c gen_ndr/ndr_orpc.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_OXIDRESOLVER',
+ source='gen_ndr/ndr_oxidresolver.c',
+ public_deps='ndr NDR_ORPC'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_REMACT',
+ source='gen_ndr/ndr_remact.c',
+ public_deps='ndr NDR_ORPC'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DCOM',
+ source='gen_ndr/ndr_dcom.c',
+ public_deps='ndr NDR_SECURITY NDR_ORPC'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_WMI',
+ source='ndr/ndr_wmi.c gen_ndr/ndr_wmi.c',
+ public_deps='ndr NDR_SECURITY NDR_DCOM'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_WZCSVC',
+ source='gen_ndr/ndr_wzcsvc.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_BROWSER',
+ source='gen_ndr/ndr_browser.c',
+ public_deps='ndr NDR_SRVSVC'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_W32TIME',
+ source='gen_ndr/ndr_w32time.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SCERPC',
+ source='gen_ndr/ndr_scerpc.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SERVER_ID',
+ source='gen_ndr/ndr_server_id.c',
+ deps='ndr',
+ public_headers='gen_ndr/server_id.h',
+ header_path='gen_ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_TRKWKS',
+ source='gen_ndr/ndr_trkwks.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_KEYSVC',
+ source='gen_ndr/ndr_keysvc.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_RAP',
+ source='gen_ndr/ndr_rap.c ndr/ndr_rap.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_IDMAP',
+ source='gen_ndr/ndr_idmap.c',
+ public_deps='ndr ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NOTIFY',
+ source='gen_ndr/ndr_notify.c',
+ public_deps='ndr ndr-standard NDR_SERVER_ID NDR_FILE_ID'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NTLMSSP',
+ source='ndr/ndr_ntlmssp.c gen_ndr/ndr_ntlmssp.c',
+ public_deps='ndr ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NEGOEX',
+ source='ndr/ndr_negoex.c gen_ndr/ndr_negoex.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DNSP',
+ source='gen_ndr/ndr_dnsp.c ndr/ndr_dnsp.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NFS4ACL',
+ source='gen_ndr/ndr_nfs4acl.c',
+ public_deps='ndr NDR_SECURITY'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NTPRINTING',
+ source='gen_ndr/ndr_ntprinting.c ndr/ndr_ntprinting.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SAMR',
+ source='gen_ndr/ndr_samr.c',
+ public_deps='ndr NDR_SECURITY NDR_LSA'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_LSA',
+ source='gen_ndr/ndr_lsa.c',
+ public_deps='ndr NDR_SECURITY'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SECURITY',
+ source='gen_ndr/ndr_security.c ndr/ndr_sec_helper.c',
+ deps='ndr samba-security',
+ public_headers='gen_ndr/security.h',
+ header_path='gen_ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SMB_ACL',
+ source='gen_ndr/ndr_smb_acl.c',
+ deps='ndr',
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SVCCTL',
+ source='gen_ndr/ndr_svcctl.c ndr/ndr_svcctl.c',
+ public_deps='ndr NDR_SECURITY'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SRVSVC',
+ source='gen_ndr/ndr_srvsvc.c',
+ public_deps='ndr NDR_SECURITY NDR_SVCCTL'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NETLOGON',
+ source='gen_ndr/ndr_netlogon.c ndr/ndr_netlogon.c',
+ public_deps='ndr NDR_SECURITY NDR_LSA NDR_SAMR ndr_nbt'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_EVENTLOG',
+ source='gen_ndr/ndr_eventlog.c',
+ public_deps='ndr NDR_SECURITY NDR_LSA'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_EVENTLOG6',
+ source='gen_ndr/ndr_eventlog6.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NTSVCS',
+ source='gen_ndr/ndr_ntsvcs.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_WKSSVC',
+ source='gen_ndr/ndr_wkssvc.c',
+ public_deps='ndr NDR_SECURITY NDR_SRVSVC NDR_LSA'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_ECHO',
+ source='gen_ndr/ndr_echo.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_INITSHUTDOWN',
+ source='gen_ndr/ndr_initshutdown.c',
+ public_deps='ndr NDR_LSA'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_COMPRESSION',
+ source='ndr/ndr_compression.c',
+ public_deps='samba-errors ndr',
+ deps='z LZXPRESS'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_FSRVP',
+ source='gen_ndr/ndr_fsrvp.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_WITNESS',
+ source='gen_ndr/ndr_witness.c ndr/ndr_witness.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_CLUSAPI',
+ source='gen_ndr/ndr_clusapi.c',
+ public_deps='ndr NDR_WINREG'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_MDSSVC',
+ source='gen_ndr/ndr_mdssvc.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DCERPC',
+ source='gen_ndr/ndr_dcerpc.c ndr/ndr_dcerpc.c',
+ public_deps='ndr',
+ public_headers='gen_ndr/ndr_dcerpc.h gen_ndr/dcerpc.h ndr/ndr_dcerpc.h',
+ header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')]
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DRSUAPI',
+ source='ndr/ndr_drsuapi.c gen_ndr/ndr_drsuapi.c',
+ public_deps='ndr NDR_COMPRESSION NDR_SECURITY ndr-standard asn1util',
+ public_headers='gen_ndr/ndr_drsuapi.h gen_ndr/drsuapi.h ndr/ndr_drsuapi.h',
+ header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')]
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_DRSBLOBS',
+ source='ndr/ndr_drsblobs.c gen_ndr/ndr_drsblobs.c',
+ public_deps='ndr NDR_DRSUAPI',
+ public_headers='gen_ndr/ndr_drsblobs.h gen_ndr/drsblobs.h ndr/ndr_drsblobs.h',
+ header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')]
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_ODJ',
+ source='gen_ndr/ndr_ODJ.c ndr/ndr_ODJ.c',
+ public_deps='NDR_LSA NDR_NETLOGON NDR_SECURITY',
+ deps='ndr')
+
+bld.SAMBA_SUBSYSTEM('NDR_KRB5PAC',
+ source='',
+ deps='ndr-krb5pac')
+
+bld.SAMBA_LIBRARY('ndr-krb5pac',
+ source='ndr/ndr_krb5pac.c gen_ndr/ndr_krb5pac.c',
+ public_deps='ndr ndr-standard NDR_SECURITY',
+ public_headers='gen_ndr/krb5pac.h gen_ndr/ndr_krb5pac.h ndr/ndr_krb5pac.h',
+ header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')],
+ pc_files='ndr_krb5pac.pc',
+ vnum='0.0.1'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_KRB5CCACHE',
+ source='gen_ndr/ndr_krb5ccache.c',
+ deps='ndr NDR_COMPRESSION NDR_SECURITY ndr-standard asn1util'
+ )
+
+bld.SAMBA_LIBRARY('ndr-standard',
+ source='',
+ vnum='0.0.1',
+ pc_files='ndr_standard.pc',
+ deps='''NDR_SECURITY NDR_LSA NDR_SAMR NDR_NETLOGON
+ NDR_EVENTLOG NDR_EVENTLOG6 NDR_DFS
+ NDR_NTSVCS NDR_SVCCTL NDR_INITSHUTDOWN NDR_WKSSVC NDR_SRVSVC NDR_WINREG
+ NDR_ECHO security NDR_DNS NDR_DNSP NDR_ATSVC NDR_SPOOLSS NDR_DSSETUP
+ NDR_SERVER_ID NDR_NOTIFY''',
+ public_deps='ndr',
+ public_headers='gen_ndr/samr.h gen_ndr/ndr_samr.h gen_ndr/lsa.h gen_ndr/netlogon.h gen_ndr/atsvc.h gen_ndr/ndr_atsvc.h gen_ndr/ndr_svcctl.h gen_ndr/svcctl.h',
+ header_path='gen_ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_XATTR',
+ source='ndr/ndr_xattr.c gen_ndr/ndr_xattr.c',
+ public_deps='ndr NDR_SECURITY'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SMB2_LEASE_STRUCT',
+ source='gen_ndr/ndr_smb2_lease_struct.c',
+ public_deps='ndr',
+ public_headers='gen_ndr/smb2_lease_struct.h'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_QUOTA',
+ source='gen_ndr/ndr_quota.c',
+ public_deps='ndr',
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_SCHANNEL',
+ source='ndr/ndr_schannel.c gen_ndr/ndr_schannel.c',
+ public_deps='ndr ndr_nbt'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_NBT',
+ source='',
+ deps='ndr_nbt')
+
+bld.SAMBA_LIBRARY('ndr_nbt',
+ source='gen_ndr/ndr_nbt.c ndr/ndr_nbt.c',
+ public_deps='ndr NDR_NBT_BUF NDR_SECURITY NDR_DNS',
+ public_headers='gen_ndr/nbt.h gen_ndr/ndr_nbt.h ndr/ndr_nbt.h',
+ header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')],
+ pc_files='ndr_nbt.pc',
+ vnum='0.0.1'
+)
+
+bld.SAMBA_SUBSYSTEM('NDR_BACKUPKEY',
+ source='ndr/ndr_backupkey.c gen_ndr/ndr_backupkey.c',
+ public_deps='ndr NDR_SECURITY'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_PREG',
+ source='gen_ndr/ndr_preg.c ndr/ndr_preg.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_CAB',
+ source='''
+ gen_ndr/ndr_cab.c
+ ndr/ndr_cab.c
+ ''',
+ public_deps='ndr NDR_COMPRESSION')
+
+bld.SAMBA_SUBSYSTEM('NDR_FILE_ID',
+ source='gen_ndr/ndr_file_id.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_MESSAGING',
+ source='gen_ndr/ndr_messaging.c',
+ public_deps='ndr NDR_SERVER_ID'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_WINSTATION',
+ source='gen_ndr/ndr_winstation.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_ATSVC',
+ source='gen_ndr/ndr_atsvc_c.c',
+ public_deps='dcerpc-binding NDR_ATSVC'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_ECHO',
+ source='gen_ndr/ndr_echo_c.c',
+ public_deps='dcerpc-binding NDR_ECHO'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_LSA',
+ source='gen_ndr/ndr_lsa_c.c',
+ public_deps='dcerpc-binding ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_SAMR',
+ source='gen_ndr/ndr_samr_c.c',
+ public_deps='dcerpc-binding NDR_SAMR'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_DFS',
+ source='gen_ndr/ndr_dfs_c.c',
+ public_deps='dcerpc-binding ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_FRSAPI',
+ source='gen_ndr/ndr_frsapi_c.c',
+ public_deps='dcerpc-binding NDR_FRSAPI'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_DRSUAPI',
+ source='gen_ndr/ndr_drsuapi_c.c',
+ public_deps='dcerpc-binding NDR_DRSUAPI'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_UNIXINFO',
+ source='gen_ndr/ndr_unixinfo_c.c',
+ public_deps='dcerpc-binding NDR_UNIXINFO'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_BROWSER',
+ source='gen_ndr/ndr_browser_c.c',
+ public_deps='dcerpc-binding NDR_BROWSER'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_SPOOLSS',
+ source='gen_ndr/ndr_spoolss_c.c',
+ public_deps='dcerpc-binding NDR_SPOOLSS'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_WINSPOOL',
+ source='gen_ndr/ndr_winspool_c.c',
+ public_deps='dcerpc-binding NDR_WINSPOOL'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_WKSSVC',
+ source='gen_ndr/ndr_wkssvc_c.c',
+ public_deps='dcerpc-binding ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_SRVSVC',
+ source='gen_ndr/ndr_srvsvc_c.c',
+ public_deps='dcerpc-binding NDR_SRVSVC'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_SVCCTL',
+ source='gen_ndr/ndr_svcctl_c.c',
+ public_deps='dcerpc-binding ndr-standard',
+ public_headers='gen_ndr/ndr_svcctl_c.h ndr/ndr_svcctl.h',
+ header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')]
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_EVENTLOG',
+ source='gen_ndr/ndr_eventlog_c.c',
+ public_deps='dcerpc-binding ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_EPMAPPER',
+ source='gen_ndr/ndr_epmapper_c.c',
+ public_deps='tevent NDR_EPMAPPER'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_DSSETUP',
+ source='gen_ndr/ndr_dssetup_c.c',
+ public_deps='dcerpc-binding NDR_DSSETUP'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_WINREG',
+ source='gen_ndr/ndr_winreg_c.c',
+ public_deps='dcerpc-binding ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_INITSHUTDOWN',
+ source='gen_ndr/ndr_initshutdown_c.c',
+ public_deps='dcerpc-binding ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_MGMT',
+ source='gen_ndr/ndr_mgmt_c.c',
+ deps='tevent NDR_MGMT'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_OXIDRESOLVER',
+ source='gen_ndr/ndr_oxidresolver_c.c',
+ public_deps='dcerpc-binding NDR_OXIDRESOLVER'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_REMACT',
+ source='gen_ndr/ndr_remact_c.c',
+ public_deps='dcerpc-binding NDR_REMACT'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_NTSVCS',
+ source='gen_ndr/ndr_ntsvcs_c.c',
+ public_deps='dcerpc-binding ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_NETLOGON',
+ source='gen_ndr/ndr_netlogon_c.c',
+ public_deps='ndr-standard tevent'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_BACKUPKEY',
+ source='gen_ndr/ndr_backupkey_c.c',
+ public_deps='dcerpc-binding NDR_BACKUPKEY'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_DNSSERVER',
+ source='gen_ndr/ndr_dnsserver_c.c',
+ public_deps='dcerpc-binding ndr-standard'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_IOCTL',
+ source='gen_ndr/ndr_ioctl.c ndr/ndr_ioctl.c',
+ public_deps='ndr'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_FSRVP',
+ source='gen_ndr/ndr_fsrvp_c.c',
+ public_deps='dcerpc-binding NDR_FSRVP'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_WITNESS',
+ source='gen_ndr/ndr_witness_c.c',
+ public_deps='dcerpc-binding NDR_WITNESS'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_CLUSAPI',
+ source='gen_ndr/ndr_clusapi_c.c',
+ public_deps='dcerpc-binding NDR_CLUSAPI'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_MDSSVC',
+ source='gen_ndr/ndr_mdssvc_c.c',
+ public_deps='dcerpc-binding NDR_MDSSVC'
+ )
+
+# a grouping library for NDR subsystems that may be used by more than one target
+bld.SAMBA_LIBRARY('ndr-samba',
+ source=[],
+ deps='''NDR_DRSBLOBS NDR_DRSUAPI NDR_IDMAP NDR_NTLMSSP NDR_NEGOEX NDR_SCHANNEL NDR_MGMT
+ NDR_DNSSERVER NDR_EPMAPPER NDR_XATTR NDR_UNIXINFO NDR_NAMED_PIPE_AUTH NDR_DCOM
+ NDR_NTPRINTING NDR_FSRVP NDR_WITNESS NDR_MDSSVC NDR_OPEN_FILES NDR_SMBXSRV
+ NDR_KRB5CCACHE''',
+ private_library=True,
+ grouping_library=True
+ )
+
+# a grouping library for RPC_NDR subsystems that may be used by more than one target
+bld.SAMBA_LIBRARY('dcerpc-samba',
+ source='',
+ deps='''RPC_NDR_LSA RPC_NDR_SAMR RPC_NDR_NETLOGON RPC_NDR_EVENTLOG
+ RPC_NDR_DFS RPC_NDR_NTSVCS RPC_NDR_SVCCTL RPC_NDR_INITSHUTDOWN
+ RPC_NDR_WKSSVC RPC_NDR_SRVSVC RPC_NDR_WINREG RPC_NDR_ECHO RPC_NDR_EPMAPPER
+ RPC_NDR_ATSVC RPC_NDR_SPOOLSS RPC_NDR_DNSSERVER''',
+ public_deps='ndr-standard',
+ private_library=True,
+ grouping_library=True
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_MISC',
+ source='',
+ deps='ndr')
+
+bld.SAMBA_LIBRARY('ndr',
+ source='ndr/ndr_string.c ndr/ndr_basic.c ndr/uuid.c ndr/ndr.c ndr/ndr_misc.c gen_ndr/ndr_misc.c ndr/util.c',
+ pc_files='ndr.pc',
+ public_deps='samba-errors talloc samba-util util_str_hex',
+ public_headers='gen_ndr/misc.h gen_ndr/ndr_misc.h ndr/libndr.h:ndr.h',
+ header_path= [('*gen_ndr*', 'gen_ndr')],
+ vnum='3.0.0',
+ abi_directory='ABI',
+ abi_match='!ndr_table_* ndr_* GUID_* _ndr_pull_error* _ndr_push_error*',
+ )
+
+bld.SAMBA_LIBRARY('dcerpc-binding',
+ source='''
+ rpc/dcerpc_error.c
+ rpc/binding.c
+ rpc/dcerpc_util.c
+ rpc/binding_handle.c
+ ''',
+ deps='ndr tevent NDR_DCERPC LIBTSOCKET tevent-util',
+ pc_files=[],
+ public_headers='rpc/rpc_common.h',
+ vnum='0.0.1')
+
+bld.SAMBA_LIBRARY('dcerpc-pkt-auth',
+ private_library=True,
+ source='''
+ rpc/dcerpc_pkt_auth.c
+ ''',
+ deps='dcerpc-binding gensec')
+
+bld.SAMBA_SUBSYSTEM('DCERPC_SERVER_NETLOGON',
+ source='''
+ rpc/server/netlogon/schannel_util.c
+ ''',
+ deps='''
+ talloc
+ util_str_escape
+ samba-hostconfig
+ NDR_NETLOGON
+ dcerpc-server-core
+ ''')
+
+bld.SAMBA_LIBRARY('dcerpc-server-core',
+ source='''
+ rpc/dcesrv_core.c
+ rpc/dcesrv_auth.c
+ rpc/dcesrv_mgmt.c
+ rpc/dcesrv_reply.c
+ rpc/dcesrv_handles.c
+ ''',
+ deps='''
+ ndr
+ dcerpc-binding
+ samba-util-core
+ gnutls
+ GNUTLS_HELPERS
+ dcerpc-pkt-auth
+ ''',
+ pc_files=[],
+ public_headers='rpc/dcesrv_core.h',
+ autoproto='rpc/dcesrv_core_proto.h',
+ vnum='0.0.1')
+
+bld.SAMBA_SUBSYSTEM('DCERPC_HELPER',
+ source='rpc/dcerpc_helper.c',
+ public_deps='''
+ samba-hostconfig
+ samba-security
+ gnutls
+ GNUTLS_HELPERS
+ ''')
+
+bld.SAMBA_SUBSYSTEM('NDR_WINBIND',
+ source='gen_ndr/ndr_winbind.c',
+ public_deps='ndr NDR_LSA'
+ )
+
+bld.SAMBA_SUBSYSTEM('RPC_NDR_WINBIND',
+ source='gen_ndr/ndr_winbind_c.c',
+ public_deps='dcerpc NDR_WINBIND'
+ )
+
+bld.SAMBA_SUBSYSTEM('NDR_FSRVP_STATE',
+ source='gen_ndr/ndr_fsrvp_state.c',
+ public_deps='ndr'
+ )
+#
+# Cmocka tests
+#
+
+bld.SAMBA_BINARY('test_ndr_macros',
+ source='tests/test_ndr_macros.c',
+ deps='''
+ cmocka
+ ndr
+ ''',
+ for_selftest=True)
+
+bld.SAMBA_BINARY('test_ndr_string',
+ source='tests/test_ndr_string.c',
+ deps='''
+ cmocka
+ talloc
+ ndr
+ ''',
+ for_selftest=True)
+
+bld.SAMBA_BINARY('test_ndr',
+ source='tests/test_ndr.c',
+ deps='''
+ cmocka
+ ndr
+ ''',
+ for_selftest=True)
+
+bld.SAMBA_BINARY('test_ndr_dns_nbt',
+ source='tests/test_ndr_dns_nbt.c',
+ deps='''
+ cmocka
+ ndr
+ ndr_nbt
+ ''',
+ for_selftest=True)