summaryrefslogtreecommitdiff
path: root/source3/librpc
diff options
context:
space:
mode:
Diffstat (limited to 'source3/librpc')
-rw-r--r--source3/librpc/gen_ndr/nbt.h756
-rw-r--r--source3/librpc/gen_ndr/ndr_nbt.c4148
-rw-r--r--source3/librpc/gen_ndr/ndr_nbt.h87
-rw-r--r--source3/librpc/gen_ndr/security.h1
-rw-r--r--source3/librpc/idl/drsuapi.idl1503
-rw-r--r--source3/librpc/idl/nbt.idl699
-rw-r--r--source3/librpc/idl/security.idl3
-rw-r--r--source3/librpc/ndr/libndr.h11
-rw-r--r--source3/librpc/ndr/ndr_basic.c4
-rw-r--r--source3/librpc/ndr/ndr_sec_helper.c26
-rw-r--r--source3/librpc/ndr/sid.c41
-rw-r--r--source3/librpc/rpc/binding.c708
-rw-r--r--source3/librpc/rpc/dcerpc.c187
-rw-r--r--source3/librpc/rpc/dcerpc.h75
-rw-r--r--source3/librpc/rpc/dcerpc_util.c1438
15 files changed, 9685 insertions, 2 deletions
diff --git a/source3/librpc/gen_ndr/nbt.h b/source3/librpc/gen_ndr/nbt.h
new file mode 100644
index 0000000000..8f2c38aef4
--- /dev/null
+++ b/source3/librpc/gen_ndr/nbt.h
@@ -0,0 +1,756 @@
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#include "librpc/gen_ndr/misc.h"
+#include "librpc/gen_ndr/security.h"
+#include "librpc/gen_ndr/svcctl.h"
+#ifndef _HEADER_nbt
+#define _HEADER_nbt
+
+#define NBT_NAME_SERVICE_PORT ( 137 )
+#define NBT_DGRAM_SERVICE_PORT ( 138 )
+#define NBT_MAILSLOT_NETLOGON ( "\\MAILSLOT\\NET\\NETLOGON" )
+#define NBT_MAILSLOT_NTLOGON ( "\\MAILSLOT\\NET\\NTLOGON" )
+#define NBT_MAILSLOT_GETDC ( "\\MAILSLOT\\NET\\GETDC" )
+#define NBT_MAILSLOT_BROWSE ( "\\MAILSLOT\\BROWSE" )
+#define DGRAM_SMB ( 0xff534d42 )
+/* bitmap nbt_operation */
+#define NBT_RCODE ( 0x000F )
+#define NBT_FLAG_BROADCAST ( 0x0010 )
+#define NBT_FLAG_RECURSION_AVAIL ( 0x0080 )
+#define NBT_FLAG_RECURSION_DESIRED ( 0x0100 )
+#define NBT_FLAG_TRUNCATION ( 0x0200 )
+#define NBT_FLAG_AUTHORITIVE ( 0x0400 )
+#define NBT_OPCODE ( 0x7800 )
+#define NBT_FLAG_REPLY ( 0x8000 )
+
+enum nbt_opcode
+#ifndef USE_UINT_ENUMS
+ {
+ 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)
+}
+#else
+ { __donnot_use_enum_nbt_opcode=0x7FFFFFFF}
+#define NBT_OPCODE_QUERY ( (0x0<<11) )
+#define NBT_OPCODE_REGISTER ( (0x5<<11) )
+#define NBT_OPCODE_RELEASE ( (0x6<<11) )
+#define NBT_OPCODE_WACK ( (0x7<<11) )
+#define NBT_OPCODE_REFRESH ( (0x8<<11) )
+#define NBT_OPCODE_REFRESH2 ( (0x9<<11) )
+#define NBT_OPCODE_MULTI_HOME_REG ( (0xf<<11) )
+#endif
+;
+
+enum nbt_rcode
+#ifndef USE_UINT_ENUMS
+ {
+ 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
+}
+#else
+ { __donnot_use_enum_nbt_rcode=0x7FFFFFFF}
+#define NBT_RCODE_OK ( 0x0 )
+#define NBT_RCODE_FMT ( 0x1 )
+#define NBT_RCODE_SVR ( 0x2 )
+#define NBT_RCODE_NAM ( 0x3 )
+#define NBT_RCODE_IMP ( 0x4 )
+#define NBT_RCODE_RFS ( 0x5 )
+#define NBT_RCODE_ACT ( 0x6 )
+#define NBT_RCODE_CFT ( 0x7 )
+#endif
+;
+
+enum nbt_name_type
+#ifndef USE_UINT_ENUMS
+ {
+ 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
+}
+#else
+ { __donnot_use_enum_nbt_name_type=0x7FFFFFFF}
+#define NBT_NAME_CLIENT ( 0x00 )
+#define NBT_NAME_MS ( 0x01 )
+#define NBT_NAME_USER ( 0x03 )
+#define NBT_NAME_SERVER ( 0x20 )
+#define NBT_NAME_PDC ( 0x1B )
+#define NBT_NAME_LOGON ( 0x1C )
+#define NBT_NAME_MASTER ( 0x1D )
+#define NBT_NAME_BROWSER ( 0x1E )
+#endif
+;
+
+struct nbt_name {
+ const char * name;
+ const char * scope;
+ enum nbt_name_type type;
+}/* [nopull,public,nopush] */;
+
+enum nbt_qclass
+#ifndef USE_UINT_ENUMS
+ {
+ NBT_QCLASS_IP=0x01
+}
+#else
+ { __donnot_use_enum_nbt_qclass=0x7FFFFFFF}
+#define NBT_QCLASS_IP ( 0x01 )
+#endif
+;
+
+enum nbt_qtype
+#ifndef USE_UINT_ENUMS
+ {
+ NBT_QTYPE_ADDRESS=0x0001,
+ NBT_QTYPE_NAMESERVICE=0x0002,
+ NBT_QTYPE_NULL=0x000A,
+ NBT_QTYPE_NETBIOS=0x0020,
+ NBT_QTYPE_STATUS=0x0021
+}
+#else
+ { __donnot_use_enum_nbt_qtype=0x7FFFFFFF}
+#define NBT_QTYPE_ADDRESS ( 0x0001 )
+#define NBT_QTYPE_NAMESERVICE ( 0x0002 )
+#define NBT_QTYPE_NULL ( 0x000A )
+#define NBT_QTYPE_NETBIOS ( 0x0020 )
+#define NBT_QTYPE_STATUS ( 0x0021 )
+#endif
+;
+
+struct nbt_name_question {
+ struct nbt_name name;
+ enum nbt_qtype question_type;
+ enum nbt_qclass question_class;
+};
+
+enum nbt_node_type
+#ifndef USE_UINT_ENUMS
+ {
+ NBT_NODE_B=0x0000,
+ NBT_NODE_P=0x2000,
+ NBT_NODE_M=0x4000,
+ NBT_NODE_H=0x6000
+}
+#else
+ { __donnot_use_enum_nbt_node_type=0x7FFFFFFF}
+#define NBT_NODE_B ( 0x0000 )
+#define NBT_NODE_P ( 0x2000 )
+#define NBT_NODE_M ( 0x4000 )
+#define NBT_NODE_H ( 0x6000 )
+#endif
+;
+
+/* bitmap nb_flags */
+#define NBT_NM_PERMANENT ( 0x0200 )
+#define NBT_NM_ACTIVE ( 0x0400 )
+#define NBT_NM_CONFLICT ( 0x0800 )
+#define NBT_NM_DEREGISTER ( 0x1000 )
+#define NBT_NM_OWNER_TYPE ( 0x6000 )
+#define NBT_NM_GROUP ( 0x8000 )
+
+struct nbt_rdata_address {
+ uint16_t nb_flags;
+ const char * ipaddr;
+};
+
+struct nbt_rdata_netbios {
+ uint16_t length;
+ struct nbt_rdata_address *addresses;
+};
+
+struct nbt_statistics {
+ uint8_t unit_id[6];
+ uint8_t jumpers;
+ uint8_t test_result;
+ uint16_t version_number;
+ uint16_t period_of_statistics;
+ uint16_t number_of_crcs;
+ uint16_t number_alignment_errors;
+ uint16_t number_of_collisions;
+ uint16_t number_send_aborts;
+ uint32_t number_good_sends;
+ uint32_t number_good_receives;
+ uint16_t number_retransmits;
+ uint16_t number_no_resource_conditions;
+ uint16_t number_free_command_blocks;
+ uint16_t total_number_command_blocks;
+ uint16_t max_total_number_command_blocks;
+ uint16_t number_pending_sessions;
+ uint16_t max_number_pending_sessions;
+ uint16_t max_total_sessions_possible;
+ uint16_t session_data_packet_size;
+};
+
+struct nbt_status_name {
+ const char *name;/* [charset(DOS)] */
+ enum nbt_name_type type;
+ uint16_t nb_flags;
+};
+
+struct nbt_rdata_status {
+ uint16_t length;/* [value(num_names*18+47)] */
+ uint8_t num_names;
+ struct nbt_status_name *names;
+ struct nbt_statistics statistics;
+};
+
+struct nbt_rdata_data {
+ uint16_t length;
+ uint8_t *data;
+};
+
+union nbt_rdata {
+ struct nbt_rdata_netbios netbios;/* [case(NBT_QTYPE_NETBIOS)] */
+ struct nbt_rdata_status status;/* [case(NBT_QTYPE_STATUS)] */
+ struct nbt_rdata_data data;/* [default] */
+}/* [nodiscriminant] */;
+
+struct nbt_res_rec {
+ struct nbt_name name;
+ enum nbt_qtype rr_type;
+ enum nbt_qclass rr_class;
+ uint32_t ttl;
+ union nbt_rdata rdata;/* [switch_is(((((rr_type)==NBT_QTYPE_NETBIOS)&&talloc_check_name(ndr,"struct ndr_push")&&((rdata).data.length==2))?0:rr_type))] */
+}/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */;
+
+struct nbt_name_packet {
+ uint16_t name_trn_id;
+ uint16_t operation;
+ uint16_t qdcount;
+ uint16_t ancount;
+ uint16_t nscount;
+ uint16_t arcount;
+ struct nbt_name_question *questions;
+ struct nbt_res_rec *answers;
+ struct nbt_res_rec *nsrecs;
+ struct nbt_res_rec *additional;
+ DATA_BLOB padding;/* [flag(LIBNDR_FLAG_REMAINING)] */
+}/* [public,flag(LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX)] */;
+
+enum dgram_msg_type
+#ifndef USE_UINT_ENUMS
+ {
+ 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
+}
+#else
+ { __donnot_use_enum_dgram_msg_type=0x7FFFFFFF}
+#define DGRAM_DIRECT_UNIQUE ( 0x10 )
+#define DGRAM_DIRECT_GROUP ( 0x11 )
+#define DGRAM_BCAST ( 0x12 )
+#define DGRAM_ERROR ( 0x13 )
+#define DGRAM_QUERY ( 0x14 )
+#define DGRAM_QUERY_POSITIVE ( 0x15 )
+#define DGRAM_QUERY_NEGATIVE ( 0x16 )
+#endif
+;
+
+/* bitmap dgram_flags */
+#define DGRAM_FLAG_MORE ( 0x01 )
+#define DGRAM_FLAG_FIRST ( 0x02 )
+#define DGRAM_FLAG_NODE_TYPE ( 0x0C )
+
+enum dgram_node_type
+#ifndef USE_UINT_ENUMS
+ {
+ DGRAM_NODE_B=0x00,
+ DGRAM_NODE_P=0x04,
+ DGRAM_NODE_M=0x08,
+ DGRAM_NODE_NBDD=0x0C
+}
+#else
+ { __donnot_use_enum_dgram_node_type=0x7FFFFFFF}
+#define DGRAM_NODE_B ( 0x00 )
+#define DGRAM_NODE_P ( 0x04 )
+#define DGRAM_NODE_M ( 0x08 )
+#define DGRAM_NODE_NBDD ( 0x0C )
+#endif
+;
+
+enum smb_command
+#ifndef USE_UINT_ENUMS
+ {
+ SMB_TRANSACTION=0x25
+}
+#else
+ { __donnot_use_enum_smb_command=0x7FFFFFFF}
+#define SMB_TRANSACTION ( 0x25 )
+#endif
+;
+
+struct smb_trans_body {
+ uint8_t wct;/* [value(17),range(17,17)] */
+ uint16_t total_param_count;
+ uint16_t total_data_count;
+ uint16_t max_param_count;
+ uint16_t max_data_count;
+ uint8_t max_setup_count;
+ uint8_t pad;
+ uint16_t trans_flags;
+ uint32_t timeout;
+ uint16_t reserved;
+ uint16_t param_count;
+ uint16_t param_offset;
+ uint16_t data_count;
+ uint16_t data_offset;
+ uint8_t setup_count;/* [value(3),range(3,3)] */
+ uint8_t pad2;
+ uint16_t opcode;
+ uint16_t priority;
+ uint16_t _class;
+ uint16_t byte_count;/* [value(strlen(mailslot_name)+1+data.length)] */
+ const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ DATA_BLOB data;/* [flag(LIBNDR_FLAG_REMAINING)] */
+};
+
+union smb_body {
+ struct smb_trans_body trans;/* [case(SMB_TRANSACTION)] */
+}/* [nodiscriminant] */;
+
+struct dgram_smb_packet {
+ enum smb_command smb_command;
+ uint8_t err_class;
+ uint8_t pad;
+ uint16_t err_code;
+ uint8_t flags;
+ uint16_t flags2;
+ uint16_t pid_high;
+ uint8_t signature[8];
+ uint16_t reserved;
+ uint16_t tid;
+ uint16_t pid;
+ uint16_t vuid;
+ uint16_t mid;
+ union smb_body body;/* [switch_is(smb_command)] */
+}/* [public,flag(LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX)] */;
+
+union dgram_message_body {
+ struct dgram_smb_packet smb;/* [case(DGRAM_SMB)] */
+}/* [nodiscriminant] */;
+
+struct dgram_message {
+ uint16_t length;
+ uint16_t offset;
+ struct nbt_name source_name;
+ struct nbt_name dest_name;
+ uint32_t dgram_body_type;
+ union dgram_message_body body;/* [switch_is(dgram_body_type)] */
+};
+
+enum dgram_err_code
+#ifndef USE_UINT_ENUMS
+ {
+ DGRAM_ERROR_NAME_NOT_PRESENT=0x82,
+ DGRAM_ERROR_INVALID_SOURCE=0x83,
+ DGRAM_ERROR_INVALID_DEST=0x84
+}
+#else
+ { __donnot_use_enum_dgram_err_code=0x7FFFFFFF}
+#define DGRAM_ERROR_NAME_NOT_PRESENT ( 0x82 )
+#define DGRAM_ERROR_INVALID_SOURCE ( 0x83 )
+#define DGRAM_ERROR_INVALID_DEST ( 0x84 )
+#endif
+;
+
+union dgram_data {
+ struct dgram_message msg;/* [case(DGRAM_DIRECT_UNIQUE)] */
+ enum dgram_err_code error;/* [case(DGRAM_ERROR)] */
+ struct nbt_name dest_name;/* [case(DGRAM_QUERY)] */
+}/* [nodiscriminant] */;
+
+struct nbt_dgram_packet {
+ enum dgram_msg_type msg_type;
+ uint8_t flags;
+ uint16_t dgram_id;
+ const char * src_addr;
+ uint16_t src_port;
+ union dgram_data data;/* [switch_is(msg_type)] */
+}/* [public,flag(LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX)] */;
+
+enum nbt_netlogon_command
+#ifndef USE_UINT_ENUMS
+ {
+ NETLOGON_QUERY_FOR_PDC=0x7,
+ NETLOGON_ANNOUNCE_UAS=0xa,
+ NETLOGON_RESPONSE_FROM_PDC=0xc,
+ NETLOGON_QUERY_FOR_PDC2=0x12,
+ NETLOGON_RESPONSE_FROM_PDC2=0x17,
+ NETLOGON_RESPONSE_FROM_PDC_USER=0x19
+}
+#else
+ { __donnot_use_enum_nbt_netlogon_command=0x7FFFFFFF}
+#define NETLOGON_QUERY_FOR_PDC ( 0x7 )
+#define NETLOGON_ANNOUNCE_UAS ( 0xa )
+#define NETLOGON_RESPONSE_FROM_PDC ( 0xc )
+#define NETLOGON_QUERY_FOR_PDC2 ( 0x12 )
+#define NETLOGON_RESPONSE_FROM_PDC2 ( 0x17 )
+#define NETLOGON_RESPONSE_FROM_PDC_USER ( 0x19 )
+#endif
+;
+
+struct nbt_netlogon_query_for_pdc {
+ const char * computer_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
+ const char * unicode_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t nt_version;
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+struct nbt_netlogon_query_for_pdc2 {
+ uint16_t request_count;
+ const char * computer_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t unknown[2];
+ uint32_t nt_version;
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+struct nbt_netlogon_response_from_pdc {
+ const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
+ const char * unicode_pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t nt_version;
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+/* bitmap nbt_server_type */
+#define NBT_SERVER_PDC ( 0x00000001 )
+#define NBT_SERVER_GC ( 0x00000004 )
+#define NBT_SERVER_LDAP ( 0x00000008 )
+#define NBT_SERVER_DS ( 0x00000010 )
+#define NBT_SERVER_KDC ( 0x00000020 )
+#define NBT_SERVER_TIMESERV ( 0x00000040 )
+#define NBT_SERVER_CLOSEST ( 0x00000080 )
+#define NBT_SERVER_WRITABLE ( 0x00000100 )
+#define NBT_SERVER_GOOD_TIMESERV ( 0x00000200 )
+
+struct nbt_netlogon_response_from_pdc2 {
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
+ uint32_t server_type;
+ struct GUID domain_uuid;
+ const char * forest;
+ const char * dns_domain;
+ const char * pdc_dns_name;
+ const char * domain;
+ const char * pdc_name;
+ const char * user_name;
+ const char * server_site;
+ const char * client_site;
+ uint8_t unknown;
+ uint32_t unknown2;
+ const char * pdc_ip;/* [flag(LIBNDR_FLAG_BIGENDIAN)] */
+ uint32_t unknown3[2];
+ uint32_t nt_version;
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+enum netr_SamDatabaseID;
+
+struct nbt_db_change {
+ enum netr_SamDatabaseID db_index;
+ uint64_t serial;
+ NTTIME timestamp;
+};
+
+struct nbt_netlogon_announce_uas {
+ uint32_t serial_lo;
+ time_t timestamp;
+ uint32_t pulse;
+ uint32_t random;
+ const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * domain;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
+ const char * unicode_pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * unicode_domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t db_count;
+ struct nbt_db_change *dbchange;
+ uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */
+ struct dom_sid0 sid;/* [subcontext_size(sid_size),subcontext(0)] */
+ uint32_t nt_version;
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+union nbt_netlogon_request {
+ struct nbt_netlogon_query_for_pdc pdc;/* [case(NETLOGON_QUERY_FOR_PDC)] */
+ struct nbt_netlogon_query_for_pdc2 pdc2;/* [case(NETLOGON_QUERY_FOR_PDC2)] */
+ struct nbt_netlogon_announce_uas uas;/* [case(NETLOGON_ANNOUNCE_UAS)] */
+ struct nbt_netlogon_response_from_pdc response;/* [case(NETLOGON_RESPONSE_FROM_PDC)] */
+ struct nbt_netlogon_response_from_pdc2 response2;/* [case(NETLOGON_RESPONSE_FROM_PDC2)] */
+}/* [nodiscriminant] */;
+
+struct nbt_netlogon_packet {
+ enum nbt_netlogon_command command;
+ union nbt_netlogon_request req;/* [switch_is(command)] */
+}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
+
+struct nbt_cldap_netlogon_1 {
+ uint16_t type;
+ const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t nt_version;/* [value] */
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+struct nbt_cldap_netlogon_3 {
+ uint16_t type;
+ const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ struct GUID domain_uuid;
+ struct GUID unknown_uuid;
+ const char * forest;
+ const char * dns_domain;
+ const char * pdc_dns_name;
+ const char * pdc_ip;
+ uint32_t server_type;
+ uint32_t nt_version;/* [value(3)] */
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+struct nbt_cldap_netlogon_5 {
+ uint32_t type;
+ uint32_t server_type;
+ struct GUID domain_uuid;
+ const char * forest;
+ const char * dns_domain;
+ const char * pdc_dns_name;
+ const char * domain;
+ const char * pdc_name;
+ const char * user_name;
+ const char * server_site;
+ const char * client_site;
+ uint32_t nt_version;/* [value(5)] */
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+struct nbt_cldap_netlogon_13 {
+ uint32_t type;
+ uint32_t server_type;
+ struct GUID domain_uuid;
+ const char * forest;
+ const char * dns_domain;
+ const char * pdc_dns_name;
+ const char * domain;
+ const char * pdc_name;
+ const char * user_name;
+ const char * server_site;
+ const char * client_site;
+ uint8_t unknown;
+ uint32_t unknown2;
+ const char * pdc_ip;/* [flag(LIBNDR_FLAG_BIGENDIAN)] */
+ uint32_t unknown3[2];
+ uint32_t nt_version;/* [value(13)] */
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+union nbt_cldap_netlogon {
+ struct nbt_cldap_netlogon_1 logon1;/* [case(0)] */
+ struct nbt_cldap_netlogon_3 logon3;/* [case(2)] */
+ struct nbt_cldap_netlogon_5 logon5;/* [case(4)] */
+ struct nbt_cldap_netlogon_13 logon13;/* [default] */
+}/* [public,nodiscriminant,flag(LIBNDR_FLAG_NOALIGN)] */;
+
+enum nbt_ntlogon_command
+#ifndef USE_UINT_ENUMS
+ {
+ NTLOGON_SAM_LOGON=0x12,
+ NTLOGON_SAM_LOGON_REPLY=0x13,
+ NTLOGON_SAM_LOGON_REPLY15=0x15
+}
+#else
+ { __donnot_use_enum_nbt_ntlogon_command=0x7FFFFFFF}
+#define NTLOGON_SAM_LOGON ( 0x12 )
+#define NTLOGON_SAM_LOGON_REPLY ( 0x13 )
+#define NTLOGON_SAM_LOGON_REPLY15 ( 0x15 )
+#endif
+;
+
+struct nbt_ntlogon_sam_logon {
+ uint16_t request_count;
+ const char * computer_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t acct_control;
+ uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */
+ struct dom_sid0 sid;/* [subcontext_size(sid_size),subcontext(0)] */
+ uint32_t nt_version;
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+struct nbt_ntlogon_sam_logon_reply {
+ const char * server;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t nt_version;
+ uint16_t lmnt_token;
+ uint16_t lm20_token;
+};
+
+union nbt_ntlogon_request {
+ struct nbt_ntlogon_sam_logon logon;/* [case(NTLOGON_SAM_LOGON)] */
+ struct nbt_ntlogon_sam_logon_reply reply;/* [case(NTLOGON_SAM_LOGON_REPLY)] */
+ struct nbt_netlogon_response_from_pdc2 reply2;/* [case(NETLOGON_RESPONSE_FROM_PDC2)] */
+}/* [nodiscriminant] */;
+
+struct nbt_ntlogon_packet {
+ enum nbt_ntlogon_command command;
+ union nbt_ntlogon_request req;/* [switch_is(command)] */
+}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
+
+enum nbt_browse_opcode
+#ifndef USE_UINT_ENUMS
+ {
+ HostAnnouncement=1,
+ AnnouncementRequest=2,
+ Election=8,
+ GetBackupListReq=9,
+ GetBackupListResp=10,
+ BecomeBackup=11,
+ DomainAnnouncement=12,
+ MasterAnnouncement=13,
+ ResetBrowserState=14,
+ LocalMasterAnnouncement=15
+}
+#else
+ { __donnot_use_enum_nbt_browse_opcode=0x7FFFFFFF}
+#define HostAnnouncement ( 1 )
+#define AnnouncementRequest ( 2 )
+#define Election ( 8 )
+#define GetBackupListReq ( 9 )
+#define GetBackupListResp ( 10 )
+#define BecomeBackup ( 11 )
+#define DomainAnnouncement ( 12 )
+#define MasterAnnouncement ( 13 )
+#define ResetBrowserState ( 14 )
+#define LocalMasterAnnouncement ( 15 )
+#endif
+;
+
+struct nbt_browse_host_announcement {
+ uint8_t UpdateCount;
+ uint32_t Periodicity;
+ const char *ServerName;/* [charset(DOS)] */
+ uint8_t OSMajor;
+ uint8_t OSMinor;
+ uint32_t ServerType;
+ uint8_t BroMajorVer;
+ uint8_t BroMinorVer;
+ uint16_t Signature;
+ const char * Comment;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+struct nbt_browse_announcement_request {
+ uint8_t Unused;
+ const char * ResponseName;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+struct nbt_browse_election_request {
+ uint8_t Version;
+ uint32_t Criteria;
+ uint32_t UpTime;
+ uint32_t Reserved;
+ const char * ServerName;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+struct nbt_browse_backup_list_request {
+ uint8_t ReqCount;
+ uint32_t Token;
+};
+
+struct nbt_browse_backup_list_response {
+ uint8_t BackupCount;
+ uint32_t Token;
+ struct nbt_name *BackupServerList;
+};
+
+struct nbt_browse_become_backup {
+ const char * BrowserName;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+struct nbt_browse_domain_announcement {
+ uint8_t UpdateCount;
+ uint32_t Periodicity;
+ const char *ServerName;/* [charset(DOS)] */
+ uint8_t OSMajor;
+ uint8_t OSMinor;
+ uint32_t ServerType;
+ uint32_t MysteriousField;
+ const char * Comment;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+struct nbt_browse_master_announcement {
+ const char * ServerName;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+struct nbt_browse_reset_state {
+ uint8_t Command;
+};
+
+struct nbt_browse_local_master_announcement {
+ uint8_t UpdateCount;
+ uint32_t Periodicity;
+ const char *ServerName;/* [charset(DOS)] */
+ uint8_t OSMajor;
+ uint8_t OSMinor;
+ uint32_t ServerType;
+ uint8_t BroMajorVer;
+ uint8_t BroMinorVer;
+ uint16_t Signature;
+ const char * Comment;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+union nbt_browse_payload {
+ struct nbt_browse_host_announcement host_annoucement;/* [case(HostAnnouncement)] */
+ struct nbt_browse_announcement_request announcement_request;/* [case(AnnouncementRequest)] */
+ struct nbt_browse_election_request election_request;/* [case(Election)] */
+ struct nbt_browse_backup_list_request backup_list_request;/* [case(GetBackupListReq)] */
+ struct nbt_browse_backup_list_response backup_list_response;/* [case(GetBackupListResp)] */
+ struct nbt_browse_become_backup become_backup;/* [case(BecomeBackup)] */
+ struct nbt_browse_domain_announcement domain_announcement;/* [case(DomainAnnouncement)] */
+ struct nbt_browse_master_announcement master_announcement;/* [case(MasterAnnouncement)] */
+ struct nbt_browse_reset_state reset_browser_state;/* [case(ResetBrowserState)] */
+ struct nbt_browse_local_master_announcement local_master_announcement;/* [case(LocalMasterAnnouncement)] */
+}/* [nodiscriminant] */;
+
+struct nbt_browse_packet {
+ enum nbt_browse_opcode opcode;
+ union nbt_browse_payload payload;/* [switch_is(opcode)] */
+}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
+
+#endif /* _HEADER_nbt */
diff --git a/source3/librpc/gen_ndr/ndr_nbt.c b/source3/librpc/gen_ndr/ndr_nbt.c
new file mode 100644
index 0000000000..45fd54d52f
--- /dev/null
+++ b/source3/librpc/gen_ndr/ndr_nbt.c
@@ -0,0 +1,4148 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_nbt.h"
+
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/gen_ndr/ndr_security.h"
+#include "librpc/gen_ndr/ndr_svcctl.h"
+static enum ndr_err_code ndr_push_nbt_operation(struct ndr_push *ndr, int ndr_flags, uint16_t r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_operation(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r)
+{
+ ndr_print_uint16(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_RCODE", NBT_RCODE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_BROADCAST", NBT_FLAG_BROADCAST, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_RECURSION_AVAIL", NBT_FLAG_RECURSION_AVAIL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_RECURSION_DESIRED", NBT_FLAG_RECURSION_DESIRED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_TRUNCATION", NBT_FLAG_TRUNCATION, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_AUTHORITIVE", NBT_FLAG_AUTHORITIVE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_OPCODE", NBT_OPCODE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_REPLY", NBT_FLAG_REPLY, r);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_name_type(struct ndr_push *ndr, int ndr_flags, enum nbt_name_type r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_name_type(struct ndr_pull *ndr, int ndr_flags, enum nbt_name_type *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case NBT_NAME_CLIENT: val = "NBT_NAME_CLIENT"; break;
+ case NBT_NAME_MS: val = "NBT_NAME_MS"; break;
+ case NBT_NAME_USER: val = "NBT_NAME_USER"; break;
+ case NBT_NAME_SERVER: val = "NBT_NAME_SERVER"; break;
+ case NBT_NAME_PDC: val = "NBT_NAME_PDC"; break;
+ case NBT_NAME_LOGON: val = "NBT_NAME_LOGON"; break;
+ case NBT_NAME_MASTER: val = "NBT_NAME_MASTER"; break;
+ case NBT_NAME_BROWSER: val = "NBT_NAME_BROWSER"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r)
+{
+ ndr_print_struct(ndr, name, "nbt_name");
+ ndr->depth++;
+ ndr_print_string(ndr, "name", r->name);
+ ndr_print_string(ndr, "scope", r->scope);
+ ndr_print_nbt_name_type(ndr, "type", r->type);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_qclass(struct ndr_push *ndr, int ndr_flags, enum nbt_qclass r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_qclass(struct ndr_pull *ndr, int ndr_flags, enum nbt_qclass *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case NBT_QCLASS_IP: val = "NBT_QCLASS_IP"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_nbt_qtype(struct ndr_push *ndr, int ndr_flags, enum nbt_qtype r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_qtype(struct ndr_pull *ndr, int ndr_flags, enum nbt_qtype *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case NBT_QTYPE_ADDRESS: val = "NBT_QTYPE_ADDRESS"; break;
+ case NBT_QTYPE_NAMESERVICE: val = "NBT_QTYPE_NAMESERVICE"; break;
+ case NBT_QTYPE_NULL: val = "NBT_QTYPE_NULL"; break;
+ case NBT_QTYPE_NETBIOS: val = "NBT_QTYPE_NETBIOS"; break;
+ case NBT_QTYPE_STATUS: val = "NBT_QTYPE_STATUS"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_nbt_name_question(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_question *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->name));
+ NDR_CHECK(ndr_push_nbt_qtype(ndr, NDR_SCALARS, r->question_type));
+ NDR_CHECK(ndr_push_nbt_qclass(ndr, NDR_SCALARS, r->question_class));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_name_question(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_question *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->name));
+ NDR_CHECK(ndr_pull_nbt_qtype(ndr, NDR_SCALARS, &r->question_type));
+ NDR_CHECK(ndr_pull_nbt_qclass(ndr, NDR_SCALARS, &r->question_class));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r)
+{
+ ndr_print_struct(ndr, name, "nbt_name_question");
+ ndr->depth++;
+ ndr_print_nbt_name(ndr, "name", &r->name);
+ ndr_print_nbt_qtype(ndr, "question_type", r->question_type);
+ ndr_print_nbt_qclass(ndr, "question_class", r->question_class);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nb_flags(struct ndr_push *ndr, int ndr_flags, uint16_t r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nb_flags(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r)
+{
+ ndr_print_uint16(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_PERMANENT", NBT_NM_PERMANENT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_ACTIVE", NBT_NM_ACTIVE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_CONFLICT", NBT_NM_CONFLICT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_DEREGISTER", NBT_NM_DEREGISTER, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_OWNER_TYPE", NBT_NM_OWNER_TYPE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_GROUP", NBT_NM_GROUP, r);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_rdata_address(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_address *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_nb_flags(ndr, NDR_SCALARS, r->nb_flags));
+ NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->ipaddr));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_rdata_address(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_address *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_nb_flags(ndr, NDR_SCALARS, &r->nb_flags));
+ NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->ipaddr));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r)
+{
+ ndr_print_struct(ndr, name, "nbt_rdata_address");
+ ndr->depth++;
+ ndr_print_nb_flags(ndr, "nb_flags", r->nb_flags);
+ ndr_print_ipv4address(ndr, "ipaddr", r->ipaddr);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_rdata_netbios(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_netbios *r)
+{
+ uint32_t cntr_addresses_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
+ for (cntr_addresses_0 = 0; cntr_addresses_0 < r->length / 6; cntr_addresses_0++) {
+ NDR_CHECK(ndr_push_nbt_rdata_address(ndr, NDR_SCALARS, &r->addresses[cntr_addresses_0]));
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_rdata_netbios(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_netbios *r)
+{
+ uint32_t cntr_addresses_0;
+ TALLOC_CTX *_mem_save_addresses_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
+ NDR_PULL_ALLOC_N(ndr, r->addresses, r->length / 6);
+ _mem_save_addresses_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->addresses, 0);
+ for (cntr_addresses_0 = 0; cntr_addresses_0 < r->length / 6; cntr_addresses_0++) {
+ NDR_CHECK(ndr_pull_nbt_rdata_address(ndr, NDR_SCALARS, &r->addresses[cntr_addresses_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_addresses_0, 0);
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r)
+{
+ uint32_t cntr_addresses_0;
+ ndr_print_struct(ndr, name, "nbt_rdata_netbios");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "length", r->length);
+ ndr->print(ndr, "%s: ARRAY(%d)", "addresses", r->length / 6);
+ ndr->depth++;
+ for (cntr_addresses_0=0;cntr_addresses_0<r->length / 6;cntr_addresses_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_addresses_0) != -1) {
+ ndr_print_nbt_rdata_address(ndr, "addresses", &r->addresses[cntr_addresses_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_statistics(struct ndr_push *ndr, int ndr_flags, const struct nbt_statistics *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->unit_id, 6));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->jumpers));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->test_result));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version_number));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->period_of_statistics));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_of_crcs));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_alignment_errors));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_of_collisions));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_send_aborts));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->number_good_sends));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->number_good_receives));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_retransmits));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_no_resource_conditions));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_free_command_blocks));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_number_command_blocks));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_total_number_command_blocks));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_pending_sessions));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_number_pending_sessions));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_total_sessions_possible));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->session_data_packet_size));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_statistics(struct ndr_pull *ndr, int ndr_flags, struct nbt_statistics *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->unit_id, 6));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->jumpers));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->test_result));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version_number));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->period_of_statistics));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_of_crcs));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_alignment_errors));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_of_collisions));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_send_aborts));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->number_good_sends));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->number_good_receives));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_retransmits));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_no_resource_conditions));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_free_command_blocks));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_number_command_blocks));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_total_number_command_blocks));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_pending_sessions));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_number_pending_sessions));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_total_sessions_possible));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->session_data_packet_size));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r)
+{
+ ndr_print_struct(ndr, name, "nbt_statistics");
+ ndr->depth++;
+ ndr_print_array_uint8(ndr, "unit_id", r->unit_id, 6);
+ ndr_print_uint8(ndr, "jumpers", r->jumpers);
+ ndr_print_uint8(ndr, "test_result", r->test_result);
+ ndr_print_uint16(ndr, "version_number", r->version_number);
+ ndr_print_uint16(ndr, "period_of_statistics", r->period_of_statistics);
+ ndr_print_uint16(ndr, "number_of_crcs", r->number_of_crcs);
+ ndr_print_uint16(ndr, "number_alignment_errors", r->number_alignment_errors);
+ ndr_print_uint16(ndr, "number_of_collisions", r->number_of_collisions);
+ ndr_print_uint16(ndr, "number_send_aborts", r->number_send_aborts);
+ ndr_print_uint32(ndr, "number_good_sends", r->number_good_sends);
+ ndr_print_uint32(ndr, "number_good_receives", r->number_good_receives);
+ ndr_print_uint16(ndr, "number_retransmits", r->number_retransmits);
+ ndr_print_uint16(ndr, "number_no_resource_conditions", r->number_no_resource_conditions);
+ ndr_print_uint16(ndr, "number_free_command_blocks", r->number_free_command_blocks);
+ ndr_print_uint16(ndr, "total_number_command_blocks", r->total_number_command_blocks);
+ ndr_print_uint16(ndr, "max_total_number_command_blocks", r->max_total_number_command_blocks);
+ ndr_print_uint16(ndr, "number_pending_sessions", r->number_pending_sessions);
+ ndr_print_uint16(ndr, "max_number_pending_sessions", r->max_number_pending_sessions);
+ ndr_print_uint16(ndr, "max_total_sessions_possible", r->max_total_sessions_possible);
+ ndr_print_uint16(ndr, "session_data_packet_size", r->session_data_packet_size);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_status_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_status_name *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 2));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, 15, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_push_nbt_name_type(ndr, NDR_SCALARS, r->type));
+ NDR_CHECK(ndr_push_nb_flags(ndr, NDR_SCALARS, r->nb_flags));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_status_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_status_name *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 2));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, 15, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_pull_nbt_name_type(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_nb_flags(ndr, NDR_SCALARS, &r->nb_flags));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r)
+{
+ ndr_print_struct(ndr, name, "nbt_status_name");
+ ndr->depth++;
+ ndr_print_string(ndr, "name", r->name);
+ ndr_print_nbt_name_type(ndr, "type", r->type);
+ ndr_print_nb_flags(ndr, "nb_flags", r->nb_flags);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_rdata_status(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_status *r)
+{
+ uint32_t cntr_names_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_names * 18 + 47));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->num_names));
+ for (cntr_names_0 = 0; cntr_names_0 < r->num_names; cntr_names_0++) {
+ NDR_CHECK(ndr_push_nbt_status_name(ndr, NDR_SCALARS, &r->names[cntr_names_0]));
+ }
+ NDR_CHECK(ndr_push_nbt_statistics(ndr, NDR_SCALARS, &r->statistics));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_rdata_status(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_status *r)
+{
+ uint32_t cntr_names_0;
+ TALLOC_CTX *_mem_save_names_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_names));
+ NDR_PULL_ALLOC_N(ndr, r->names, r->num_names);
+ _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->names, 0);
+ for (cntr_names_0 = 0; cntr_names_0 < r->num_names; cntr_names_0++) {
+ NDR_CHECK(ndr_pull_nbt_status_name(ndr, NDR_SCALARS, &r->names[cntr_names_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, 0);
+ NDR_CHECK(ndr_pull_nbt_statistics(ndr, NDR_SCALARS, &r->statistics));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r)
+{
+ uint32_t cntr_names_0;
+ ndr_print_struct(ndr, name, "nbt_rdata_status");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->num_names * 18 + 47:r->length);
+ ndr_print_uint8(ndr, "num_names", r->num_names);
+ ndr->print(ndr, "%s: ARRAY(%d)", "names", r->num_names);
+ ndr->depth++;
+ for (cntr_names_0=0;cntr_names_0<r->num_names;cntr_names_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_names_0) != -1) {
+ ndr_print_nbt_status_name(ndr, "names", &r->names[cntr_names_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr_print_nbt_statistics(ndr, "statistics", &r->statistics);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_rdata_data(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_data *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 2));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_rdata_data(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_data *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 2));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
+ NDR_PULL_ALLOC_N(ndr, r->data, r->length);
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r)
+{
+ ndr_print_struct(ndr, name, "nbt_rdata_data");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "length", r->length);
+ ndr_print_array_uint8(ndr, "data", r->data, r->length);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_rdata(struct ndr_push *ndr, int ndr_flags, const union nbt_rdata *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case NBT_QTYPE_NETBIOS: {
+ NDR_CHECK(ndr_push_nbt_rdata_netbios(ndr, NDR_SCALARS, &r->netbios));
+ break; }
+
+ case NBT_QTYPE_STATUS: {
+ NDR_CHECK(ndr_push_nbt_rdata_status(ndr, NDR_SCALARS, &r->status));
+ break; }
+
+ default: {
+ NDR_CHECK(ndr_push_nbt_rdata_data(ndr, NDR_SCALARS, &r->data));
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case NBT_QTYPE_NETBIOS:
+ break;
+
+ case NBT_QTYPE_STATUS:
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_rdata(struct ndr_pull *ndr, int ndr_flags, union nbt_rdata *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case NBT_QTYPE_NETBIOS: {
+ NDR_CHECK(ndr_pull_nbt_rdata_netbios(ndr, NDR_SCALARS, &r->netbios));
+ break; }
+
+ case NBT_QTYPE_STATUS: {
+ NDR_CHECK(ndr_pull_nbt_rdata_status(ndr, NDR_SCALARS, &r->status));
+ break; }
+
+ default: {
+ NDR_CHECK(ndr_pull_nbt_rdata_data(ndr, NDR_SCALARS, &r->data));
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case NBT_QTYPE_NETBIOS:
+ break;
+
+ case NBT_QTYPE_STATUS:
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "nbt_rdata");
+ switch (level) {
+ case NBT_QTYPE_NETBIOS:
+ ndr_print_nbt_rdata_netbios(ndr, "netbios", &r->netbios);
+ break;
+
+ case NBT_QTYPE_STATUS:
+ ndr_print_nbt_rdata_status(ndr, "status", &r->status);
+ break;
+
+ default:
+ ndr_print_nbt_rdata_data(ndr, "data", &r->data);
+ break;
+
+ }
+}
+
+static enum ndr_err_code ndr_push_nbt_res_rec(struct ndr_push *ndr, int ndr_flags, const struct nbt_res_rec *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->name));
+ NDR_CHECK(ndr_push_nbt_qtype(ndr, NDR_SCALARS, r->rr_type));
+ NDR_CHECK(ndr_push_nbt_qclass(ndr, NDR_SCALARS, r->rr_class));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ttl));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type)));
+ NDR_CHECK(ndr_push_nbt_rdata(ndr, NDR_SCALARS, &r->rdata));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_res_rec(struct ndr_pull *ndr, int ndr_flags, struct nbt_res_rec *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->name));
+ NDR_CHECK(ndr_pull_nbt_qtype(ndr, NDR_SCALARS, &r->rr_type));
+ NDR_CHECK(ndr_pull_nbt_qclass(ndr, NDR_SCALARS, &r->rr_class));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ttl));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type)));
+ NDR_CHECK(ndr_pull_nbt_rdata(ndr, NDR_SCALARS, &r->rdata));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r)
+{
+ ndr_print_struct(ndr, name, "nbt_res_rec");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+ ndr->depth++;
+ ndr_print_nbt_name(ndr, "name", &r->name);
+ ndr_print_nbt_qtype(ndr, "rr_type", r->rr_type);
+ ndr_print_nbt_qclass(ndr, "rr_class", r->rr_class);
+ ndr_print_uint32(ndr, "ttl", r->ttl);
+ ndr_print_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type));
+ ndr_print_nbt_rdata(ndr, "rdata", &r->rdata);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r)
+{
+ uint32_t cntr_questions_0;
+ uint32_t cntr_answers_0;
+ uint32_t cntr_nsrecs_0;
+ uint32_t cntr_additional_0;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->name_trn_id));
+ NDR_CHECK(ndr_push_nbt_operation(ndr, NDR_SCALARS, r->operation));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->qdcount));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->ancount));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nscount));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->arcount));
+ for (cntr_questions_0 = 0; cntr_questions_0 < r->qdcount; cntr_questions_0++) {
+ NDR_CHECK(ndr_push_nbt_name_question(ndr, NDR_SCALARS, &r->questions[cntr_questions_0]));
+ }
+ for (cntr_answers_0 = 0; cntr_answers_0 < r->ancount; cntr_answers_0++) {
+ NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->answers[cntr_answers_0]));
+ }
+ for (cntr_nsrecs_0 = 0; cntr_nsrecs_0 < r->nscount; cntr_nsrecs_0++) {
+ NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->nsrecs[cntr_nsrecs_0]));
+ }
+ for (cntr_additional_0 = 0; cntr_additional_0 < r->arcount; cntr_additional_0++) {
+ NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->additional[cntr_additional_0]));
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->padding));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r)
+{
+ uint32_t cntr_questions_0;
+ TALLOC_CTX *_mem_save_questions_0;
+ uint32_t cntr_answers_0;
+ TALLOC_CTX *_mem_save_answers_0;
+ uint32_t cntr_nsrecs_0;
+ TALLOC_CTX *_mem_save_nsrecs_0;
+ uint32_t cntr_additional_0;
+ TALLOC_CTX *_mem_save_additional_0;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_trn_id));
+ NDR_CHECK(ndr_pull_nbt_operation(ndr, NDR_SCALARS, &r->operation));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->qdcount));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->ancount));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->nscount));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->arcount));
+ NDR_PULL_ALLOC_N(ndr, r->questions, r->qdcount);
+ _mem_save_questions_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->questions, 0);
+ for (cntr_questions_0 = 0; cntr_questions_0 < r->qdcount; cntr_questions_0++) {
+ NDR_CHECK(ndr_pull_nbt_name_question(ndr, NDR_SCALARS, &r->questions[cntr_questions_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_questions_0, 0);
+ NDR_PULL_ALLOC_N(ndr, r->answers, r->ancount);
+ _mem_save_answers_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->answers, 0);
+ for (cntr_answers_0 = 0; cntr_answers_0 < r->ancount; cntr_answers_0++) {
+ NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->answers[cntr_answers_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_answers_0, 0);
+ NDR_PULL_ALLOC_N(ndr, r->nsrecs, r->nscount);
+ _mem_save_nsrecs_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->nsrecs, 0);
+ for (cntr_nsrecs_0 = 0; cntr_nsrecs_0 < r->nscount; cntr_nsrecs_0++) {
+ NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->nsrecs[cntr_nsrecs_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nsrecs_0, 0);
+ NDR_PULL_ALLOC_N(ndr, r->additional, r->arcount);
+ _mem_save_additional_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->additional, 0);
+ for (cntr_additional_0 = 0; cntr_additional_0 < r->arcount; cntr_additional_0++) {
+ NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->additional[cntr_additional_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_additional_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->padding));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r)
+{
+ uint32_t cntr_questions_0;
+ uint32_t cntr_answers_0;
+ uint32_t cntr_nsrecs_0;
+ uint32_t cntr_additional_0;
+ ndr_print_struct(ndr, name, "nbt_name_packet");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ ndr->depth++;
+ ndr_print_uint16(ndr, "name_trn_id", r->name_trn_id);
+ ndr_print_nbt_operation(ndr, "operation", r->operation);
+ ndr_print_uint16(ndr, "qdcount", r->qdcount);
+ ndr_print_uint16(ndr, "ancount", r->ancount);
+ ndr_print_uint16(ndr, "nscount", r->nscount);
+ ndr_print_uint16(ndr, "arcount", r->arcount);
+ ndr->print(ndr, "%s: ARRAY(%d)", "questions", r->qdcount);
+ ndr->depth++;
+ for (cntr_questions_0=0;cntr_questions_0<r->qdcount;cntr_questions_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_questions_0) != -1) {
+ ndr_print_nbt_name_question(ndr, "questions", &r->questions[cntr_questions_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr->print(ndr, "%s: ARRAY(%d)", "answers", r->ancount);
+ ndr->depth++;
+ for (cntr_answers_0=0;cntr_answers_0<r->ancount;cntr_answers_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_answers_0) != -1) {
+ ndr_print_nbt_res_rec(ndr, "answers", &r->answers[cntr_answers_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr->print(ndr, "%s: ARRAY(%d)", "nsrecs", r->nscount);
+ ndr->depth++;
+ for (cntr_nsrecs_0=0;cntr_nsrecs_0<r->nscount;cntr_nsrecs_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_nsrecs_0) != -1) {
+ ndr_print_nbt_res_rec(ndr, "nsrecs", &r->nsrecs[cntr_nsrecs_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr->print(ndr, "%s: ARRAY(%d)", "additional", r->arcount);
+ ndr->depth++;
+ for (cntr_additional_0=0;cntr_additional_0<r->arcount;cntr_additional_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_additional_0) != -1) {
+ ndr_print_nbt_res_rec(ndr, "additional", &r->additional[cntr_additional_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr_print_DATA_BLOB(ndr, "padding", r->padding);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+static enum ndr_err_code ndr_push_dgram_msg_type(struct ndr_push *ndr, int ndr_flags, enum dgram_msg_type r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dgram_msg_type(struct ndr_pull *ndr, int ndr_flags, enum dgram_msg_type *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case DGRAM_DIRECT_UNIQUE: val = "DGRAM_DIRECT_UNIQUE"; break;
+ case DGRAM_DIRECT_GROUP: val = "DGRAM_DIRECT_GROUP"; break;
+ case DGRAM_BCAST: val = "DGRAM_BCAST"; break;
+ case DGRAM_ERROR: val = "DGRAM_ERROR"; break;
+ case DGRAM_QUERY: val = "DGRAM_QUERY"; break;
+ case DGRAM_QUERY_POSITIVE: val = "DGRAM_QUERY_POSITIVE"; break;
+ case DGRAM_QUERY_NEGATIVE: val = "DGRAM_QUERY_NEGATIVE"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dgram_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dgram_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r)
+{
+ ndr_print_uint8(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_MORE", DGRAM_FLAG_MORE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_FIRST", DGRAM_FLAG_FIRST, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_NODE_TYPE", DGRAM_FLAG_NODE_TYPE, r);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_smb_command(struct ndr_push *ndr, int ndr_flags, enum smb_command r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_smb_command(struct ndr_pull *ndr, int ndr_flags, enum smb_command *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case SMB_TRANSACTION: val = "SMB_TRANSACTION"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_smb_trans_body(struct ndr_push *ndr, int ndr_flags, const struct smb_trans_body *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 17));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_param_count));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_data_count));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_param_count));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_data_count));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->max_setup_count));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->trans_flags));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->timeout));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reserved));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->param_count));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->param_offset));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->data_count));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->data_offset));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 3));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad2));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->opcode));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->priority));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->_class));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen(r->mailslot_name) + 1 + r->data.length));
+ {
+ 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;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_smb_trans_body(struct ndr_pull *ndr, int ndr_flags, struct smb_trans_body *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->wct));
+ if (r->wct < 17 || r->wct > 17) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_param_count));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_data_count));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_param_count));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_data_count));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->max_setup_count));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->trans_flags));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->timeout));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reserved));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->param_count));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->param_offset));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->data_count));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->data_offset));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->setup_count));
+ if (r->setup_count < 3 || r->setup_count > 3) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad2));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->opcode));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->priority));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->_class));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->byte_count));
+ {
+ 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;
+ }
+ {
+ 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->data));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r)
+{
+ ndr_print_struct(ndr, name, "smb_trans_body");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "wct", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?17:r->wct);
+ ndr_print_uint16(ndr, "total_param_count", r->total_param_count);
+ ndr_print_uint16(ndr, "total_data_count", r->total_data_count);
+ ndr_print_uint16(ndr, "max_param_count", r->max_param_count);
+ ndr_print_uint16(ndr, "max_data_count", r->max_data_count);
+ ndr_print_uint8(ndr, "max_setup_count", r->max_setup_count);
+ ndr_print_uint8(ndr, "pad", r->pad);
+ ndr_print_uint16(ndr, "trans_flags", r->trans_flags);
+ ndr_print_uint32(ndr, "timeout", r->timeout);
+ ndr_print_uint16(ndr, "reserved", r->reserved);
+ ndr_print_uint16(ndr, "param_count", r->param_count);
+ ndr_print_uint16(ndr, "param_offset", r->param_offset);
+ ndr_print_uint16(ndr, "data_count", r->data_count);
+ ndr_print_uint16(ndr, "data_offset", r->data_offset);
+ ndr_print_uint8(ndr, "setup_count", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?3:r->setup_count);
+ ndr_print_uint8(ndr, "pad2", r->pad2);
+ ndr_print_uint16(ndr, "opcode", r->opcode);
+ ndr_print_uint16(ndr, "priority", r->priority);
+ ndr_print_uint16(ndr, "_class", r->_class);
+ ndr_print_uint16(ndr, "byte_count", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->mailslot_name) + 1 + r->data.length:r->byte_count);
+ ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
+ ndr_print_DATA_BLOB(ndr, "data", r->data);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_smb_body(struct ndr_push *ndr, int ndr_flags, const union smb_body *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case SMB_TRANSACTION: {
+ NDR_CHECK(ndr_push_smb_trans_body(ndr, NDR_SCALARS, &r->trans));
+ break; }
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case SMB_TRANSACTION:
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_smb_body(struct ndr_pull *ndr, int ndr_flags, union smb_body *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case SMB_TRANSACTION: {
+ NDR_CHECK(ndr_pull_smb_trans_body(ndr, NDR_SCALARS, &r->trans));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case SMB_TRANSACTION:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "smb_body");
+ switch (level) {
+ case SMB_TRANSACTION:
+ ndr_print_smb_trans_body(ndr, "trans", &r->trans);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_smb_command(ndr, NDR_SCALARS, r->smb_command));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->err_class));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->err_code));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->flags2));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->pid_high));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->signature, 8));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reserved));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->tid));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->pid));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->vuid));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->mid));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->body, r->smb_command));
+ NDR_CHECK(ndr_push_smb_body(ndr, NDR_SCALARS, &r->body));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_smb_command(ndr, NDR_SCALARS, &r->smb_command));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->err_class));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->err_code));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->flags2));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->pid_high));
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->signature, 8));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reserved));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->tid));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->pid));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->vuid));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->mid));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->body, r->smb_command));
+ NDR_CHECK(ndr_pull_smb_body(ndr, NDR_SCALARS, &r->body));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r)
+{
+ ndr_print_struct(ndr, name, "dgram_smb_packet");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ ndr->depth++;
+ ndr_print_smb_command(ndr, "smb_command", r->smb_command);
+ ndr_print_uint8(ndr, "err_class", r->err_class);
+ ndr_print_uint8(ndr, "pad", r->pad);
+ ndr_print_uint16(ndr, "err_code", r->err_code);
+ ndr_print_uint8(ndr, "flags", r->flags);
+ ndr_print_uint16(ndr, "flags2", r->flags2);
+ ndr_print_uint16(ndr, "pid_high", r->pid_high);
+ ndr_print_array_uint8(ndr, "signature", r->signature, 8);
+ ndr_print_uint16(ndr, "reserved", r->reserved);
+ ndr_print_uint16(ndr, "tid", r->tid);
+ ndr_print_uint16(ndr, "pid", r->pid);
+ ndr_print_uint16(ndr, "vuid", r->vuid);
+ ndr_print_uint16(ndr, "mid", r->mid);
+ ndr_print_set_switch_value(ndr, &r->body, r->smb_command);
+ ndr_print_smb_body(ndr, "body", &r->body);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+static enum ndr_err_code ndr_push_dgram_message_body(struct ndr_push *ndr, int ndr_flags, const union dgram_message_body *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case DGRAM_SMB: {
+ NDR_CHECK(ndr_push_dgram_smb_packet(ndr, NDR_SCALARS, &r->smb));
+ break; }
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case DGRAM_SMB:
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dgram_message_body(struct ndr_pull *ndr, int ndr_flags, union dgram_message_body *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case DGRAM_SMB: {
+ NDR_CHECK(ndr_pull_dgram_smb_packet(ndr, NDR_SCALARS, &r->smb));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case DGRAM_SMB:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "dgram_message_body");
+ switch (level) {
+ case DGRAM_SMB:
+ ndr_print_dgram_smb_packet(ndr, "smb", &r->smb);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+static enum ndr_err_code ndr_push_dgram_message(struct ndr_push *ndr, int ndr_flags, const struct dgram_message *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->offset));
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->source_name));
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->dgram_body_type));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->body, r->dgram_body_type));
+ NDR_CHECK(ndr_push_dgram_message_body(ndr, NDR_SCALARS, &r->body));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dgram_message(struct ndr_pull *ndr, int ndr_flags, struct dgram_message *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->offset));
+ NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->source_name));
+ NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->dgram_body_type));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->body, r->dgram_body_type));
+ NDR_CHECK(ndr_pull_dgram_message_body(ndr, NDR_SCALARS, &r->body));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r)
+{
+ ndr_print_struct(ndr, name, "dgram_message");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "length", r->length);
+ ndr_print_uint16(ndr, "offset", r->offset);
+ ndr_print_nbt_name(ndr, "source_name", &r->source_name);
+ ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
+ ndr_print_uint32(ndr, "dgram_body_type", r->dgram_body_type);
+ ndr_print_set_switch_value(ndr, &r->body, r->dgram_body_type);
+ ndr_print_dgram_message_body(ndr, "body", &r->body);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dgram_err_code(struct ndr_push *ndr, int ndr_flags, enum dgram_err_code r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dgram_err_code(struct ndr_pull *ndr, int ndr_flags, enum dgram_err_code *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case DGRAM_ERROR_NAME_NOT_PRESENT: val = "DGRAM_ERROR_NAME_NOT_PRESENT"; break;
+ case DGRAM_ERROR_INVALID_SOURCE: val = "DGRAM_ERROR_INVALID_SOURCE"; break;
+ case DGRAM_ERROR_INVALID_DEST: val = "DGRAM_ERROR_INVALID_DEST"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dgram_data(struct ndr_push *ndr, int ndr_flags, const union dgram_data *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case DGRAM_DIRECT_UNIQUE: {
+ NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg));
+ break; }
+
+ case DGRAM_DIRECT_GROUP: {
+ NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg));
+ break; }
+
+ case DGRAM_BCAST: {
+ NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg));
+ break; }
+
+ case DGRAM_ERROR: {
+ NDR_CHECK(ndr_push_dgram_err_code(ndr, NDR_SCALARS, r->error));
+ break; }
+
+ case DGRAM_QUERY: {
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
+ break; }
+
+ case DGRAM_QUERY_POSITIVE: {
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
+ break; }
+
+ case DGRAM_QUERY_NEGATIVE: {
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
+ break; }
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case DGRAM_DIRECT_UNIQUE:
+ break;
+
+ case DGRAM_DIRECT_GROUP:
+ break;
+
+ case DGRAM_BCAST:
+ break;
+
+ case DGRAM_ERROR:
+ break;
+
+ case DGRAM_QUERY:
+ break;
+
+ case DGRAM_QUERY_POSITIVE:
+ break;
+
+ case DGRAM_QUERY_NEGATIVE:
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dgram_data(struct ndr_pull *ndr, int ndr_flags, union dgram_data *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case DGRAM_DIRECT_UNIQUE: {
+ NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg));
+ break; }
+
+ case DGRAM_DIRECT_GROUP: {
+ NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg));
+ break; }
+
+ case DGRAM_BCAST: {
+ NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg));
+ break; }
+
+ case DGRAM_ERROR: {
+ NDR_CHECK(ndr_pull_dgram_err_code(ndr, NDR_SCALARS, &r->error));
+ break; }
+
+ case DGRAM_QUERY: {
+ NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
+ break; }
+
+ case DGRAM_QUERY_POSITIVE: {
+ NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
+ break; }
+
+ case DGRAM_QUERY_NEGATIVE: {
+ NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case DGRAM_DIRECT_UNIQUE:
+ break;
+
+ case DGRAM_DIRECT_GROUP:
+ break;
+
+ case DGRAM_BCAST:
+ break;
+
+ case DGRAM_ERROR:
+ break;
+
+ case DGRAM_QUERY:
+ break;
+
+ case DGRAM_QUERY_POSITIVE:
+ break;
+
+ case DGRAM_QUERY_NEGATIVE:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "dgram_data");
+ switch (level) {
+ case DGRAM_DIRECT_UNIQUE:
+ ndr_print_dgram_message(ndr, "msg", &r->msg);
+ break;
+
+ case DGRAM_DIRECT_GROUP:
+ ndr_print_dgram_message(ndr, "msg", &r->msg);
+ break;
+
+ case DGRAM_BCAST:
+ ndr_print_dgram_message(ndr, "msg", &r->msg);
+ break;
+
+ case DGRAM_ERROR:
+ ndr_print_dgram_err_code(ndr, "error", r->error);
+ break;
+
+ case DGRAM_QUERY:
+ ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
+ break;
+
+ case DGRAM_QUERY_POSITIVE:
+ ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
+ break;
+
+ case DGRAM_QUERY_NEGATIVE:
+ ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_dgram_msg_type(ndr, NDR_SCALARS, r->msg_type));
+ NDR_CHECK(ndr_push_dgram_flags(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->dgram_id));
+ NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->src_addr));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->src_port));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->data, r->msg_type));
+ NDR_CHECK(ndr_push_dgram_data(ndr, NDR_SCALARS, &r->data));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_dgram_msg_type(ndr, NDR_SCALARS, &r->msg_type));
+ NDR_CHECK(ndr_pull_dgram_flags(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->dgram_id));
+ NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->src_addr));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->src_port));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->data, r->msg_type));
+ NDR_CHECK(ndr_pull_dgram_data(ndr, NDR_SCALARS, &r->data));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r)
+{
+ ndr_print_struct(ndr, name, "nbt_dgram_packet");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
+ ndr->depth++;
+ ndr_print_dgram_msg_type(ndr, "msg_type", r->msg_type);
+ ndr_print_dgram_flags(ndr, "flags", r->flags);
+ ndr_print_uint16(ndr, "dgram_id", r->dgram_id);
+ ndr_print_ipv4address(ndr, "src_addr", r->src_addr);
+ ndr_print_uint16(ndr, "src_port", r->src_port);
+ ndr_print_set_switch_value(ndr, &r->data, r->msg_type);
+ ndr_print_dgram_data(ndr, "data", &r->data);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+static enum ndr_err_code ndr_push_nbt_netlogon_command(struct ndr_push *ndr, int ndr_flags, enum nbt_netlogon_command r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_netlogon_command(struct ndr_pull *ndr, int ndr_flags, enum nbt_netlogon_command *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case NETLOGON_QUERY_FOR_PDC: val = "NETLOGON_QUERY_FOR_PDC"; break;
+ case NETLOGON_ANNOUNCE_UAS: val = "NETLOGON_ANNOUNCE_UAS"; break;
+ case NETLOGON_RESPONSE_FROM_PDC: val = "NETLOGON_RESPONSE_FROM_PDC"; break;
+ case NETLOGON_QUERY_FOR_PDC2: val = "NETLOGON_QUERY_FOR_PDC2"; break;
+ case NETLOGON_RESPONSE_FROM_PDC2: val = "NETLOGON_RESPONSE_FROM_PDC2"; break;
+ case NETLOGON_RESPONSE_FROM_PDC_USER: val = "NETLOGON_RESPONSE_FROM_PDC_USER"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_nbt_netlogon_query_for_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_query_for_pdc *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ 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, r->computer_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;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ {
+ 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->unicode_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_uint32(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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_netlogon_query_for_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_query_for_pdc *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->computer_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;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ {
+ 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->unicode_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r)
+{
+ ndr_print_struct(ndr, name, "nbt_netlogon_query_for_pdc");
+ ndr->depth++;
+ ndr_print_string(ndr, "computer_name", r->computer_name);
+ ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
+ ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+ ndr_print_string(ndr, "unicode_name", r->unicode_name);
+ ndr_print_uint32(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_netlogon_query_for_pdc2(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_query_for_pdc2 *r)
+{
+ uint32_t cntr_unknown_0;
+ 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;
+ }
+ for (cntr_unknown_0 = 0; cntr_unknown_0 < 2; cntr_unknown_0++) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown[cntr_unknown_0]));
+ }
+ NDR_CHECK(ndr_push_uint32(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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_netlogon_query_for_pdc2(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_query_for_pdc2 *r)
+{
+ uint32_t cntr_unknown_0;
+ 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;
+ }
+ for (cntr_unknown_0 = 0; cntr_unknown_0 < 2; cntr_unknown_0++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown[cntr_unknown_0]));
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r)
+{
+ uint32_t cntr_unknown_0;
+ ndr_print_struct(ndr, name, "nbt_netlogon_query_for_pdc2");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "request_count", r->request_count);
+ ndr_print_string(ndr, "computer_name", r->computer_name);
+ ndr_print_string(ndr, "user_name", r->user_name);
+ ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
+ ndr->print(ndr, "%s: ARRAY(%d)", "unknown", 2);
+ ndr->depth++;
+ for (cntr_unknown_0=0;cntr_unknown_0<2;cntr_unknown_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_unknown_0) != -1) {
+ ndr_print_uint32(ndr, "unknown", r->unknown[cntr_unknown_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_response_from_pdc *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ 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, r->pdc_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ {
+ 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->unicode_pdc_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->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_uint32(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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_response_from_pdc *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->pdc_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ {
+ 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->unicode_pdc_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->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r)
+{
+ ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc");
+ ndr->depth++;
+ ndr_print_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+ ndr_print_string(ndr, "unicode_pdc_name", r->unicode_pdc_name);
+ ndr_print_string(ndr, "domain_name", r->domain_name);
+ ndr_print_uint32(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_server_type(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_server_type(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+ uint32_t v;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+ ndr_print_uint32(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_PDC", NBT_SERVER_PDC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GC", NBT_SERVER_GC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_LDAP", NBT_SERVER_LDAP, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_DS", NBT_SERVER_DS, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_KDC", NBT_SERVER_KDC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_TIMESERV", NBT_SERVER_TIMESERV, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_CLOSEST", NBT_SERVER_CLOSEST, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_WRITABLE", NBT_SERVER_WRITABLE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GOOD_TIMESERV", NBT_SERVER_GOOD_TIMESERV, r);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc2(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_response_from_pdc2 *r)
+{
+ uint32_t cntr_unknown3_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ {
+ 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_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));
+ 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));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->unknown));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
+ {
+ uint32_t _flags_save_ipv4address = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+ NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
+ ndr->flags = _flags_save_ipv4address;
+ }
+ for (cntr_unknown3_0 = 0; cntr_unknown3_0 < 2; cntr_unknown3_0++) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3[cntr_unknown3_0]));
+ }
+ NDR_CHECK(ndr_push_uint32(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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc2(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_response_from_pdc2 *r)
+{
+ uint32_t cntr_unknown3_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ 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_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));
+ 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));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->unknown));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
+ {
+ uint32_t _flags_save_ipv4address = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+ NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
+ ndr->flags = _flags_save_ipv4address;
+ }
+ for (cntr_unknown3_0 = 0; cntr_unknown3_0 < 2; cntr_unknown3_0++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3[cntr_unknown3_0]));
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r)
+{
+ uint32_t cntr_unknown3_0;
+ ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc2");
+ ndr->depth++;
+ ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+ ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
+ ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
+ ndr_print_nbt_string(ndr, "forest", r->forest);
+ ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
+ ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
+ ndr_print_nbt_string(ndr, "domain", r->domain);
+ ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_nbt_string(ndr, "user_name", r->user_name);
+ ndr_print_nbt_string(ndr, "server_site", r->server_site);
+ ndr_print_nbt_string(ndr, "client_site", r->client_site);
+ ndr_print_uint8(ndr, "unknown", r->unknown);
+ ndr_print_uint32(ndr, "unknown2", r->unknown2);
+ ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
+ ndr->print(ndr, "%s: ARRAY(%d)", "unknown3", 2);
+ ndr->depth++;
+ for (cntr_unknown3_0=0;cntr_unknown3_0<2;cntr_unknown3_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_unknown3_0) != -1) {
+ ndr_print_uint32(ndr, "unknown3", r->unknown3[cntr_unknown3_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_db_change(struct ndr_push *ndr, int ndr_flags, const struct nbt_db_change *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 8));
+ NDR_CHECK(ndr_push_netr_SamDatabaseID(ndr, NDR_SCALARS, r->db_index));
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->serial));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->timestamp));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_db_change(struct ndr_pull *ndr, int ndr_flags, struct nbt_db_change *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 8));
+ NDR_CHECK(ndr_pull_netr_SamDatabaseID(ndr, NDR_SCALARS, &r->db_index));
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->serial));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->timestamp));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r)
+{
+ ndr_print_struct(ndr, name, "nbt_db_change");
+ ndr->depth++;
+ ndr_print_netr_SamDatabaseID(ndr, "db_index", r->db_index);
+ ndr_print_hyper(ndr, "serial", r->serial);
+ ndr_print_NTTIME(ndr, "timestamp", r->timestamp);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_netlogon_announce_uas(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_announce_uas *r)
+{
+ uint32_t cntr_dbchange_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 8));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->serial_lo));
+ NDR_CHECK(ndr_push_time_t(ndr, NDR_SCALARS, r->timestamp));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pulse));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->random));
+ {
+ 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->pdc_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->domain));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ {
+ 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->unicode_pdc_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->unicode_domain));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->db_count));
+ for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) {
+ NDR_CHECK(ndr_push_nbt_db_change(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ {
+ struct ndr_push *_ndr_sid;
+ 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_uint32(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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_netlogon_announce_uas(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_announce_uas *r)
+{
+ uint32_t cntr_dbchange_0;
+ TALLOC_CTX *_mem_save_dbchange_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 8));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->serial_lo));
+ NDR_CHECK(ndr_pull_time_t(ndr, NDR_SCALARS, &r->timestamp));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pulse));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->random));
+ {
+ 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->pdc_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->domain));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ {
+ 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->unicode_pdc_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->unicode_domain));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->db_count));
+ NDR_PULL_ALLOC_N(ndr, r->dbchange, r->db_count);
+ _mem_save_dbchange_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->dbchange, 0);
+ for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) {
+ NDR_CHECK(ndr_pull_nbt_db_change(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dbchange_0, 0);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
+ {
+ struct ndr_pull *_ndr_sid;
+ 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));
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r)
+{
+ uint32_t cntr_dbchange_0;
+ ndr_print_struct(ndr, name, "nbt_netlogon_announce_uas");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "serial_lo", r->serial_lo);
+ ndr_print_time_t(ndr, "timestamp", r->timestamp);
+ ndr_print_uint32(ndr, "pulse", r->pulse);
+ ndr_print_uint32(ndr, "random", r->random);
+ ndr_print_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_string(ndr, "domain", r->domain);
+ ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+ ndr_print_string(ndr, "unicode_pdc_name", r->unicode_pdc_name);
+ ndr_print_string(ndr, "unicode_domain", r->unicode_domain);
+ ndr_print_uint32(ndr, "db_count", r->db_count);
+ ndr->print(ndr, "%s: ARRAY(%d)", "dbchange", r->db_count);
+ ndr->depth++;
+ for (cntr_dbchange_0=0;cntr_dbchange_0<r->db_count;cntr_dbchange_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_dbchange_0) != -1) {
+ ndr_print_nbt_db_change(ndr, "dbchange", &r->dbchange[cntr_dbchange_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
+ ndr_print_dom_sid0(ndr, "sid", &r->sid);
+ ndr_print_uint32(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_netlogon_request(struct ndr_push *ndr, int ndr_flags, const union nbt_netlogon_request *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case NETLOGON_QUERY_FOR_PDC: {
+ NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
+ break; }
+
+ case NETLOGON_QUERY_FOR_PDC2: {
+ NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc2(ndr, NDR_SCALARS, &r->pdc2));
+ break; }
+
+ case NETLOGON_ANNOUNCE_UAS: {
+ NDR_CHECK(ndr_push_nbt_netlogon_announce_uas(ndr, NDR_SCALARS, &r->uas));
+ break; }
+
+ case NETLOGON_RESPONSE_FROM_PDC: {
+ NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc(ndr, NDR_SCALARS, &r->response));
+ break; }
+
+ case NETLOGON_RESPONSE_FROM_PDC2: {
+ NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2));
+ break; }
+
+ case NETLOGON_RESPONSE_FROM_PDC_USER: {
+ NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2));
+ break; }
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case NETLOGON_QUERY_FOR_PDC:
+ break;
+
+ case NETLOGON_QUERY_FOR_PDC2:
+ break;
+
+ case NETLOGON_ANNOUNCE_UAS:
+ NDR_CHECK(ndr_push_nbt_netlogon_announce_uas(ndr, NDR_BUFFERS, &r->uas));
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC:
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC2:
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC_USER:
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_netlogon_request(struct ndr_pull *ndr, int ndr_flags, union nbt_netlogon_request *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case NETLOGON_QUERY_FOR_PDC: {
+ NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
+ break; }
+
+ case NETLOGON_QUERY_FOR_PDC2: {
+ NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc2(ndr, NDR_SCALARS, &r->pdc2));
+ break; }
+
+ case NETLOGON_ANNOUNCE_UAS: {
+ NDR_CHECK(ndr_pull_nbt_netlogon_announce_uas(ndr, NDR_SCALARS, &r->uas));
+ break; }
+
+ case NETLOGON_RESPONSE_FROM_PDC: {
+ NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc(ndr, NDR_SCALARS, &r->response));
+ break; }
+
+ case NETLOGON_RESPONSE_FROM_PDC2: {
+ NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2));
+ break; }
+
+ case NETLOGON_RESPONSE_FROM_PDC_USER: {
+ NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case NETLOGON_QUERY_FOR_PDC:
+ break;
+
+ case NETLOGON_QUERY_FOR_PDC2:
+ break;
+
+ case NETLOGON_ANNOUNCE_UAS:
+ NDR_CHECK(ndr_pull_nbt_netlogon_announce_uas(ndr, NDR_BUFFERS, &r->uas));
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC:
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC2:
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC_USER:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "nbt_netlogon_request");
+ switch (level) {
+ case NETLOGON_QUERY_FOR_PDC:
+ ndr_print_nbt_netlogon_query_for_pdc(ndr, "pdc", &r->pdc);
+ break;
+
+ case NETLOGON_QUERY_FOR_PDC2:
+ ndr_print_nbt_netlogon_query_for_pdc2(ndr, "pdc2", &r->pdc2);
+ break;
+
+ case NETLOGON_ANNOUNCE_UAS:
+ ndr_print_nbt_netlogon_announce_uas(ndr, "uas", &r->uas);
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC:
+ ndr_print_nbt_netlogon_response_from_pdc(ndr, "response", &r->response);
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC2:
+ ndr_print_nbt_netlogon_response_from_pdc2(ndr, "response2", &r->response2);
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC_USER:
+ ndr_print_nbt_netlogon_response_from_pdc2(ndr, "response2", &r->response2);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *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, 8));
+ NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->command));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->req, r->command));
+ NDR_CHECK(ndr_push_nbt_netlogon_request(ndr, NDR_SCALARS, &r->req));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_nbt_netlogon_request(ndr, NDR_BUFFERS, &r->req));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *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, 8));
+ NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->command));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->req, r->command));
+ NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr, NDR_SCALARS, &r->req));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr, NDR_BUFFERS, &r->req));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r)
+{
+ ndr_print_struct(ndr, name, "nbt_netlogon_packet");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ ndr->depth++;
+ ndr_print_nbt_netlogon_command(ndr, "command", r->command);
+ ndr_print_set_switch_value(ndr, &r->req, r->command);
+ ndr_print_nbt_netlogon_request(ndr, "req", &r->req);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+static enum ndr_err_code ndr_push_nbt_cldap_netlogon_1(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_1 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->type));
+ {
+ 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->pdc_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_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1));
+ 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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_1(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_1 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->type));
+ {
+ 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->pdc_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_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r)
+{
+ ndr_print_struct(ndr, name, "nbt_cldap_netlogon_1");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "type", r->type);
+ ndr_print_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_string(ndr, "user_name", r->user_name);
+ ndr_print_string(ndr, "domain_name", r->domain_name);
+ ndr_print_uint32(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?1:r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_cldap_netlogon_3(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_3 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->type));
+ {
+ 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->pdc_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_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->unknown_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_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
+ NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 3));
+ 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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_3(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_3 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->type));
+ {
+ 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->pdc_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_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->unknown_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_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
+ NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r)
+{
+ ndr_print_struct(ndr, name, "nbt_cldap_netlogon_3");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "type", r->type);
+ ndr_print_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_string(ndr, "user_name", r->user_name);
+ ndr_print_string(ndr, "domain_name", r->domain_name);
+ ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
+ ndr_print_GUID(ndr, "unknown_uuid", &r->unknown_uuid);
+ ndr_print_nbt_string(ndr, "forest", r->forest);
+ ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
+ ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
+ ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
+ ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
+ ndr_print_uint32(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?3:r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_cldap_netlogon_5(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_5 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->type));
+ 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));
+ 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));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 5));
+ 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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_5(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_5 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->type));
+ 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));
+ 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));
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r)
+{
+ ndr_print_struct(ndr, name, "nbt_cldap_netlogon_5");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "type", r->type);
+ ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
+ ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
+ ndr_print_nbt_string(ndr, "forest", r->forest);
+ ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
+ ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
+ ndr_print_nbt_string(ndr, "domain", r->domain);
+ ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_nbt_string(ndr, "user_name", r->user_name);
+ ndr_print_nbt_string(ndr, "server_site", r->server_site);
+ ndr_print_nbt_string(ndr, "client_site", r->client_site);
+ ndr_print_uint32(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?5:r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_cldap_netlogon_13(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_13 *r)
+{
+ uint32_t cntr_unknown3_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->type));
+ 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));
+ 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));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->unknown));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
+ {
+ uint32_t _flags_save_ipv4address = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+ NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
+ ndr->flags = _flags_save_ipv4address;
+ }
+ for (cntr_unknown3_0 = 0; cntr_unknown3_0 < 2; cntr_unknown3_0++) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3[cntr_unknown3_0]));
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 13));
+ 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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_13(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_13 *r)
+{
+ uint32_t cntr_unknown3_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->type));
+ 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));
+ 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));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->unknown));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
+ {
+ uint32_t _flags_save_ipv4address = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+ NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
+ ndr->flags = _flags_save_ipv4address;
+ }
+ for (cntr_unknown3_0 = 0; cntr_unknown3_0 < 2; cntr_unknown3_0++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3[cntr_unknown3_0]));
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r)
+{
+ uint32_t cntr_unknown3_0;
+ ndr_print_struct(ndr, name, "nbt_cldap_netlogon_13");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "type", r->type);
+ ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
+ ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
+ ndr_print_nbt_string(ndr, "forest", r->forest);
+ ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
+ ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
+ ndr_print_nbt_string(ndr, "domain", r->domain);
+ ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_nbt_string(ndr, "user_name", r->user_name);
+ ndr_print_nbt_string(ndr, "server_site", r->server_site);
+ ndr_print_nbt_string(ndr, "client_site", r->client_site);
+ ndr_print_uint8(ndr, "unknown", r->unknown);
+ ndr_print_uint32(ndr, "unknown2", r->unknown2);
+ ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
+ ndr->print(ndr, "%s: ARRAY(%d)", "unknown3", 2);
+ ndr->depth++;
+ for (cntr_unknown3_0=0;cntr_unknown3_0<2;cntr_unknown3_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_unknown3_0) != -1) {
+ ndr_print_uint32(ndr, "unknown3", r->unknown3[cntr_unknown3_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?13:r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r)
+{
+ {
+ uint32_t _flags_save_UNION = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case 0: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
+ break; }
+
+ case 1: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
+ break; }
+
+ case 2: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
+ break; }
+
+ case 3: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
+ break; }
+
+ case 4: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
+ break; }
+
+ case 5: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
+ break; }
+
+ case 6: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
+ break; }
+
+ case 7: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
+ break; }
+
+ default: {
+ NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case 0:
+ break;
+
+ case 1:
+ break;
+
+ case 2:
+ break;
+
+ case 3:
+ break;
+
+ case 4:
+ break;
+
+ case 5:
+ break;
+
+ case 6:
+ break;
+
+ case 7:
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ ndr->flags = _flags_save_UNION;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r)
+{
+ int level;
+ {
+ uint32_t _flags_save_UNION = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case 0: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
+ break; }
+
+ case 1: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
+ break; }
+
+ case 2: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
+ break; }
+
+ case 3: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
+ break; }
+
+ case 4: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
+ break; }
+
+ case 5: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
+ break; }
+
+ case 6: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
+ break; }
+
+ case 7: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
+ break; }
+
+ default: {
+ NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case 0:
+ break;
+
+ case 1:
+ break;
+
+ case 2:
+ break;
+
+ case 3:
+ break;
+
+ case 4:
+ break;
+
+ case 5:
+ break;
+
+ case 6:
+ break;
+
+ case 7:
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ ndr->flags = _flags_save_UNION;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r)
+{
+ int level;
+ {
+ uint32_t _flags_save_UNION = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "nbt_cldap_netlogon");
+ switch (level) {
+ case 0:
+ ndr_print_nbt_cldap_netlogon_1(ndr, "logon1", &r->logon1);
+ break;
+
+ case 1:
+ ndr_print_nbt_cldap_netlogon_1(ndr, "logon1", &r->logon1);
+ break;
+
+ case 2:
+ ndr_print_nbt_cldap_netlogon_3(ndr, "logon3", &r->logon3);
+ break;
+
+ case 3:
+ ndr_print_nbt_cldap_netlogon_3(ndr, "logon3", &r->logon3);
+ break;
+
+ case 4:
+ ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5);
+ break;
+
+ case 5:
+ ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5);
+ break;
+
+ case 6:
+ ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5);
+ break;
+
+ case 7:
+ ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5);
+ break;
+
+ default:
+ ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
+ break;
+
+ }
+ ndr->flags = _flags_save_UNION;
+ }
+}
+
+static enum ndr_err_code ndr_push_nbt_ntlogon_command(struct ndr_push *ndr, int ndr_flags, enum nbt_ntlogon_command r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_ntlogon_command(struct ndr_pull *ndr, int ndr_flags, enum nbt_ntlogon_command *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case NTLOGON_SAM_LOGON: val = "NTLOGON_SAM_LOGON"; break;
+ case NTLOGON_SAM_LOGON_REPLY: val = "NTLOGON_SAM_LOGON_REPLY"; break;
+ case NTLOGON_SAM_LOGON_REPLY15: val = "NTLOGON_SAM_LOGON_REPLY15"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_nbt_ntlogon_sam_logon(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_sam_logon *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)));
+ {
+ struct ndr_push *_ndr_sid;
+ 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_uint32(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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_ntlogon_sam_logon(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_sam_logon *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));
+ {
+ struct ndr_pull *_ndr_sid;
+ 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));
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r)
+{
+ ndr_print_struct(ndr, name, "nbt_ntlogon_sam_logon");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "request_count", r->request_count);
+ ndr_print_string(ndr, "computer_name", r->computer_name);
+ ndr_print_string(ndr, "user_name", r->user_name);
+ ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
+ ndr_print_uint32(ndr, "acct_control", r->acct_control);
+ ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
+ ndr_print_dom_sid0(ndr, "sid", &r->sid);
+ ndr_print_uint32(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_ntlogon_sam_logon_reply(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_sam_logon_reply *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ {
+ 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->server));
+ 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_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_uint32(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;
+}
+
+static enum ndr_err_code ndr_pull_nbt_ntlogon_sam_logon_reply(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_sam_logon_reply *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_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->server));
+ 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_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_uint32(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;
+}
+
+_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r)
+{
+ ndr_print_struct(ndr, name, "nbt_ntlogon_sam_logon_reply");
+ ndr->depth++;
+ ndr_print_string(ndr, "server", r->server);
+ ndr_print_string(ndr, "user_name", r->user_name);
+ ndr_print_string(ndr, "domain", r->domain);
+ ndr_print_uint32(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_ntlogon_request(struct ndr_push *ndr, int ndr_flags, const union nbt_ntlogon_request *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case NTLOGON_SAM_LOGON: {
+ NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon(ndr, NDR_SCALARS, &r->logon));
+ break; }
+
+ case NTLOGON_SAM_LOGON_REPLY: {
+ NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply));
+ break; }
+
+ case NTLOGON_SAM_LOGON_REPLY15: {
+ NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply));
+ break; }
+
+ case NETLOGON_RESPONSE_FROM_PDC2: {
+ NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->reply2));
+ break; }
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case NTLOGON_SAM_LOGON:
+ NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon(ndr, NDR_BUFFERS, &r->logon));
+ break;
+
+ case NTLOGON_SAM_LOGON_REPLY:
+ break;
+
+ case NTLOGON_SAM_LOGON_REPLY15:
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC2:
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_ntlogon_request(struct ndr_pull *ndr, int ndr_flags, union nbt_ntlogon_request *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case NTLOGON_SAM_LOGON: {
+ NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon(ndr, NDR_SCALARS, &r->logon));
+ break; }
+
+ case NTLOGON_SAM_LOGON_REPLY: {
+ NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply));
+ break; }
+
+ case NTLOGON_SAM_LOGON_REPLY15: {
+ NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply));
+ break; }
+
+ case NETLOGON_RESPONSE_FROM_PDC2: {
+ NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->reply2));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case NTLOGON_SAM_LOGON:
+ NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon(ndr, NDR_BUFFERS, &r->logon));
+ break;
+
+ case NTLOGON_SAM_LOGON_REPLY:
+ break;
+
+ case NTLOGON_SAM_LOGON_REPLY15:
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC2:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "nbt_ntlogon_request");
+ switch (level) {
+ case NTLOGON_SAM_LOGON:
+ ndr_print_nbt_ntlogon_sam_logon(ndr, "logon", &r->logon);
+ break;
+
+ case NTLOGON_SAM_LOGON_REPLY:
+ ndr_print_nbt_ntlogon_sam_logon_reply(ndr, "reply", &r->reply);
+ break;
+
+ case NTLOGON_SAM_LOGON_REPLY15:
+ ndr_print_nbt_ntlogon_sam_logon_reply(ndr, "reply", &r->reply);
+ break;
+
+ case NETLOGON_RESPONSE_FROM_PDC2:
+ ndr_print_nbt_netlogon_response_from_pdc2(ndr, "reply2", &r->reply2);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *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_nbt_ntlogon_command(ndr, NDR_SCALARS, r->command));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->req, r->command));
+ NDR_CHECK(ndr_push_nbt_ntlogon_request(ndr, NDR_SCALARS, &r->req));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_nbt_ntlogon_request(ndr, NDR_BUFFERS, &r->req));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *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_nbt_ntlogon_command(ndr, NDR_SCALARS, &r->command));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->req, r->command));
+ NDR_CHECK(ndr_pull_nbt_ntlogon_request(ndr, NDR_SCALARS, &r->req));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_nbt_ntlogon_request(ndr, NDR_BUFFERS, &r->req));
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r)
+{
+ ndr_print_struct(ndr, name, "nbt_ntlogon_packet");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ ndr->depth++;
+ ndr_print_nbt_ntlogon_command(ndr, "command", r->command);
+ ndr_print_set_switch_value(ndr, &r->req, r->command);
+ ndr_print_nbt_ntlogon_request(ndr, "req", &r->req);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_opcode(struct ndr_push *ndr, int ndr_flags, enum nbt_browse_opcode r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_opcode(struct ndr_pull *ndr, int ndr_flags, enum nbt_browse_opcode *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case HostAnnouncement: val = "HostAnnouncement"; break;
+ case AnnouncementRequest: val = "AnnouncementRequest"; break;
+ case Election: val = "Election"; break;
+ case GetBackupListReq: val = "GetBackupListReq"; break;
+ case GetBackupListResp: val = "GetBackupListResp"; break;
+ case BecomeBackup: val = "BecomeBackup"; break;
+ case DomainAnnouncement: val = "DomainAnnouncement"; break;
+ case MasterAnnouncement: val = "MasterAnnouncement"; break;
+ case ResetBrowserState: val = "ResetBrowserState"; break;
+ case LocalMasterAnnouncement: val = "LocalMasterAnnouncement"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_host_announcement(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_host_announcement *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor));
+ NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMajorVer));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMinorVer));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->Signature));
+ {
+ 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->Comment));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_host_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_host_announcement *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor));
+ NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMajorVer));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMinorVer));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Signature));
+ {
+ 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->Comment));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_host_announcement");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount);
+ ndr_print_uint32(ndr, "Periodicity", r->Periodicity);
+ ndr_print_string(ndr, "ServerName", r->ServerName);
+ ndr_print_uint8(ndr, "OSMajor", r->OSMajor);
+ ndr_print_uint8(ndr, "OSMinor", r->OSMinor);
+ ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType);
+ ndr_print_uint8(ndr, "BroMajorVer", r->BroMajorVer);
+ ndr_print_uint8(ndr, "BroMinorVer", r->BroMinorVer);
+ ndr_print_uint16(ndr, "Signature", r->Signature);
+ ndr_print_string(ndr, "Comment", r->Comment);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_announcement_request(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_announcement_request *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Unused));
+ {
+ 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->ResponseName));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_announcement_request(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_announcement_request *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Unused));
+ {
+ 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->ResponseName));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_announcement_request");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "Unused", r->Unused);
+ ndr_print_string(ndr, "ResponseName", r->ResponseName);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_election_request(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_election_request *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Version));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Criteria));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->UpTime));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Reserved));
+ {
+ 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->ServerName));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_election_request(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_election_request *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Version));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Criteria));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->UpTime));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Reserved));
+ {
+ 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->ServerName));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_election_request");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "Version", r->Version);
+ ndr_print_uint32(ndr, "Criteria", r->Criteria);
+ ndr_print_uint32(ndr, "UpTime", r->UpTime);
+ ndr_print_uint32(ndr, "Reserved", r->Reserved);
+ ndr_print_string(ndr, "ServerName", r->ServerName);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_backup_list_request(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_backup_list_request *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->ReqCount));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_backup_list_request(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_backup_list_request *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->ReqCount));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_backup_list_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_request *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_backup_list_request");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "ReqCount", r->ReqCount);
+ ndr_print_uint32(ndr, "Token", r->Token);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_backup_list_response(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_backup_list_response *r)
+{
+ uint32_t cntr_BackupServerList_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BackupCount));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Token));
+ for (cntr_BackupServerList_0 = 0; cntr_BackupServerList_0 < r->BackupCount; cntr_BackupServerList_0++) {
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->BackupServerList[cntr_BackupServerList_0]));
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_backup_list_response(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_backup_list_response *r)
+{
+ uint32_t cntr_BackupServerList_0;
+ TALLOC_CTX *_mem_save_BackupServerList_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BackupCount));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Token));
+ NDR_PULL_ALLOC_N(ndr, r->BackupServerList, r->BackupCount);
+ _mem_save_BackupServerList_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->BackupServerList, 0);
+ for (cntr_BackupServerList_0 = 0; cntr_BackupServerList_0 < r->BackupCount; cntr_BackupServerList_0++) {
+ NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->BackupServerList[cntr_BackupServerList_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_BackupServerList_0, 0);
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_backup_list_response(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_response *r)
+{
+ uint32_t cntr_BackupServerList_0;
+ ndr_print_struct(ndr, name, "nbt_browse_backup_list_response");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "BackupCount", r->BackupCount);
+ ndr_print_uint32(ndr, "Token", r->Token);
+ ndr->print(ndr, "%s: ARRAY(%d)", "BackupServerList", r->BackupCount);
+ ndr->depth++;
+ for (cntr_BackupServerList_0=0;cntr_BackupServerList_0<r->BackupCount;cntr_BackupServerList_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_BackupServerList_0) != -1) {
+ ndr_print_nbt_name(ndr, "BackupServerList", &r->BackupServerList[cntr_BackupServerList_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_become_backup(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_become_backup *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ 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, r->BrowserName));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_become_backup(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_become_backup *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->BrowserName));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_become_backup");
+ ndr->depth++;
+ ndr_print_string(ndr, "BrowserName", r->BrowserName);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_domain_announcement(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_domain_announcement *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor));
+ NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->MysteriousField));
+ {
+ 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->Comment));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_domain_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_domain_announcement *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor));
+ NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->MysteriousField));
+ {
+ 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->Comment));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_domain_announcement");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount);
+ ndr_print_uint32(ndr, "Periodicity", r->Periodicity);
+ ndr_print_string(ndr, "ServerName", r->ServerName);
+ ndr_print_uint8(ndr, "OSMajor", r->OSMajor);
+ ndr_print_uint8(ndr, "OSMinor", r->OSMinor);
+ ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType);
+ ndr_print_uint32(ndr, "MysteriousField", r->MysteriousField);
+ ndr_print_string(ndr, "Comment", r->Comment);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_master_announcement(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_master_announcement *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ 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, r->ServerName));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_master_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_master_announcement *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->ServerName));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_master_announcement");
+ ndr->depth++;
+ ndr_print_string(ndr, "ServerName", r->ServerName);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_reset_state(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_reset_state *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 1));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Command));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_reset_state(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_reset_state *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 1));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Command));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_reset_state");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "Command", r->Command);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_local_master_announcement(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_local_master_announcement *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor));
+ NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMajorVer));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMinorVer));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->Signature));
+ {
+ 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->Comment));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_local_master_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_local_master_announcement *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor));
+ NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMajorVer));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMinorVer));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Signature));
+ {
+ 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->Comment));
+ ndr->flags = _flags_save_string;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_local_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_local_master_announcement *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_local_master_announcement");
+ ndr->depth++;
+ ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount);
+ ndr_print_uint32(ndr, "Periodicity", r->Periodicity);
+ ndr_print_string(ndr, "ServerName", r->ServerName);
+ ndr_print_uint8(ndr, "OSMajor", r->OSMajor);
+ ndr_print_uint8(ndr, "OSMinor", r->OSMinor);
+ ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType);
+ ndr_print_uint8(ndr, "BroMajorVer", r->BroMajorVer);
+ ndr_print_uint8(ndr, "BroMinorVer", r->BroMinorVer);
+ ndr_print_uint16(ndr, "Signature", r->Signature);
+ ndr_print_string(ndr, "Comment", r->Comment);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_nbt_browse_payload(struct ndr_push *ndr, int ndr_flags, const union nbt_browse_payload *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case HostAnnouncement: {
+ NDR_CHECK(ndr_push_nbt_browse_host_announcement(ndr, NDR_SCALARS, &r->host_annoucement));
+ break; }
+
+ case AnnouncementRequest: {
+ NDR_CHECK(ndr_push_nbt_browse_announcement_request(ndr, NDR_SCALARS, &r->announcement_request));
+ break; }
+
+ case Election: {
+ NDR_CHECK(ndr_push_nbt_browse_election_request(ndr, NDR_SCALARS, &r->election_request));
+ break; }
+
+ case GetBackupListReq: {
+ NDR_CHECK(ndr_push_nbt_browse_backup_list_request(ndr, NDR_SCALARS, &r->backup_list_request));
+ break; }
+
+ case GetBackupListResp: {
+ NDR_CHECK(ndr_push_nbt_browse_backup_list_response(ndr, NDR_SCALARS, &r->backup_list_response));
+ break; }
+
+ case BecomeBackup: {
+ NDR_CHECK(ndr_push_nbt_browse_become_backup(ndr, NDR_SCALARS, &r->become_backup));
+ break; }
+
+ case DomainAnnouncement: {
+ NDR_CHECK(ndr_push_nbt_browse_domain_announcement(ndr, NDR_SCALARS, &r->domain_announcement));
+ break; }
+
+ case MasterAnnouncement: {
+ NDR_CHECK(ndr_push_nbt_browse_master_announcement(ndr, NDR_SCALARS, &r->master_announcement));
+ break; }
+
+ case ResetBrowserState: {
+ NDR_CHECK(ndr_push_nbt_browse_reset_state(ndr, NDR_SCALARS, &r->reset_browser_state));
+ break; }
+
+ case LocalMasterAnnouncement: {
+ NDR_CHECK(ndr_push_nbt_browse_local_master_announcement(ndr, NDR_SCALARS, &r->local_master_announcement));
+ break; }
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case HostAnnouncement:
+ break;
+
+ case AnnouncementRequest:
+ break;
+
+ case Election:
+ break;
+
+ case GetBackupListReq:
+ break;
+
+ case GetBackupListResp:
+ break;
+
+ case BecomeBackup:
+ break;
+
+ case DomainAnnouncement:
+ break;
+
+ case MasterAnnouncement:
+ break;
+
+ case ResetBrowserState:
+ break;
+
+ case LocalMasterAnnouncement:
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_nbt_browse_payload(struct ndr_pull *ndr, int ndr_flags, union nbt_browse_payload *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case HostAnnouncement: {
+ NDR_CHECK(ndr_pull_nbt_browse_host_announcement(ndr, NDR_SCALARS, &r->host_annoucement));
+ break; }
+
+ case AnnouncementRequest: {
+ NDR_CHECK(ndr_pull_nbt_browse_announcement_request(ndr, NDR_SCALARS, &r->announcement_request));
+ break; }
+
+ case Election: {
+ NDR_CHECK(ndr_pull_nbt_browse_election_request(ndr, NDR_SCALARS, &r->election_request));
+ break; }
+
+ case GetBackupListReq: {
+ NDR_CHECK(ndr_pull_nbt_browse_backup_list_request(ndr, NDR_SCALARS, &r->backup_list_request));
+ break; }
+
+ case GetBackupListResp: {
+ NDR_CHECK(ndr_pull_nbt_browse_backup_list_response(ndr, NDR_SCALARS, &r->backup_list_response));
+ break; }
+
+ case BecomeBackup: {
+ NDR_CHECK(ndr_pull_nbt_browse_become_backup(ndr, NDR_SCALARS, &r->become_backup));
+ break; }
+
+ case DomainAnnouncement: {
+ NDR_CHECK(ndr_pull_nbt_browse_domain_announcement(ndr, NDR_SCALARS, &r->domain_announcement));
+ break; }
+
+ case MasterAnnouncement: {
+ NDR_CHECK(ndr_pull_nbt_browse_master_announcement(ndr, NDR_SCALARS, &r->master_announcement));
+ break; }
+
+ case ResetBrowserState: {
+ NDR_CHECK(ndr_pull_nbt_browse_reset_state(ndr, NDR_SCALARS, &r->reset_browser_state));
+ break; }
+
+ case LocalMasterAnnouncement: {
+ NDR_CHECK(ndr_pull_nbt_browse_local_master_announcement(ndr, NDR_SCALARS, &r->local_master_announcement));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case HostAnnouncement:
+ break;
+
+ case AnnouncementRequest:
+ break;
+
+ case Election:
+ break;
+
+ case GetBackupListReq:
+ break;
+
+ case GetBackupListResp:
+ break;
+
+ case BecomeBackup:
+ break;
+
+ case DomainAnnouncement:
+ break;
+
+ case MasterAnnouncement:
+ break;
+
+ case ResetBrowserState:
+ break;
+
+ case LocalMasterAnnouncement:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "nbt_browse_payload");
+ switch (level) {
+ case HostAnnouncement:
+ ndr_print_nbt_browse_host_announcement(ndr, "host_annoucement", &r->host_annoucement);
+ break;
+
+ case AnnouncementRequest:
+ ndr_print_nbt_browse_announcement_request(ndr, "announcement_request", &r->announcement_request);
+ break;
+
+ case Election:
+ ndr_print_nbt_browse_election_request(ndr, "election_request", &r->election_request);
+ break;
+
+ case GetBackupListReq:
+ ndr_print_nbt_browse_backup_list_request(ndr, "backup_list_request", &r->backup_list_request);
+ break;
+
+ case GetBackupListResp:
+ ndr_print_nbt_browse_backup_list_response(ndr, "backup_list_response", &r->backup_list_response);
+ break;
+
+ case BecomeBackup:
+ ndr_print_nbt_browse_become_backup(ndr, "become_backup", &r->become_backup);
+ break;
+
+ case DomainAnnouncement:
+ ndr_print_nbt_browse_domain_announcement(ndr, "domain_announcement", &r->domain_announcement);
+ break;
+
+ case MasterAnnouncement:
+ ndr_print_nbt_browse_master_announcement(ndr, "master_announcement", &r->master_announcement);
+ break;
+
+ case ResetBrowserState:
+ ndr_print_nbt_browse_reset_state(ndr, "reset_browser_state", &r->reset_browser_state);
+ break;
+
+ case LocalMasterAnnouncement:
+ ndr_print_nbt_browse_local_master_announcement(ndr, "local_master_announcement", &r->local_master_announcement);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_browse_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_packet *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_nbt_browse_opcode(ndr, NDR_SCALARS, r->opcode));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->payload, r->opcode));
+ NDR_CHECK(ndr_push_nbt_browse_payload(ndr, NDR_SCALARS, &r->payload));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_browse_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_packet *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_nbt_browse_opcode(ndr, NDR_SCALARS, &r->opcode));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->payload, r->opcode));
+ NDR_CHECK(ndr_pull_nbt_browse_payload(ndr, NDR_SCALARS, &r->payload));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_browse_packet(struct ndr_print *ndr, const char *name, const struct nbt_browse_packet *r)
+{
+ ndr_print_struct(ndr, name, "nbt_browse_packet");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ ndr->depth++;
+ ndr_print_nbt_browse_opcode(ndr, "opcode", r->opcode);
+ ndr_print_set_switch_value(ndr, &r->payload, r->opcode);
+ ndr_print_nbt_browse_payload(ndr, "payload", &r->payload);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
diff --git a/source3/librpc/gen_ndr/ndr_nbt.h b/source3/librpc/gen_ndr/ndr_nbt.h
new file mode 100644
index 0000000000..645669972d
--- /dev/null
+++ b/source3/librpc/gen_ndr/ndr_nbt.h
@@ -0,0 +1,87 @@
+/* header auto-generated by pidl */
+
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/nbt.h"
+
+#ifndef _HEADER_NDR_nbt
+#define _HEADER_NDR_nbt
+
+#include "libcli/nbt/libnbt.h"
+#define NDR_NBT_CALL_COUNT (0)
+void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r);
+void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r);
+enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r);
+enum ndr_err_code ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r);
+void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r);
+void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r);
+void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r);
+void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r);
+void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r);
+void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r);
+void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r);
+void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r);
+void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r);
+void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r);
+void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r);
+void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r);
+void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r);
+enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r);
+enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r);
+void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r);
+void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r);
+void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r);
+void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r);
+void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r);
+void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r);
+enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r);
+enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r);
+void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r);
+void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r);
+void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r);
+void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r);
+void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r);
+enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r);
+enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r);
+void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r);
+void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r);
+void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r);
+void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r);
+void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r);
+void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r);
+void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r);
+void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r);
+void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r);
+enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r);
+enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r);
+void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r);
+void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r);
+void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r);
+void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r);
+void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r);
+enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r);
+enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r);
+void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r);
+void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r);
+void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r);
+void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r);
+void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r);
+enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *r);
+enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *r);
+void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r);
+void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r);
+void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r);
+void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r);
+void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r);
+void ndr_print_nbt_browse_backup_list_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_request *r);
+void ndr_print_nbt_browse_backup_list_response(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_response *r);
+void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r);
+void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r);
+void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r);
+void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r);
+void ndr_print_nbt_browse_local_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_local_master_announcement *r);
+void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r);
+enum ndr_err_code ndr_push_nbt_browse_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_packet *r);
+enum ndr_err_code ndr_pull_nbt_browse_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_packet *r);
+void ndr_print_nbt_browse_packet(struct ndr_print *ndr, const char *name, const struct nbt_browse_packet *r);
+#endif /* _HEADER_NDR_nbt */
diff --git a/source3/librpc/gen_ndr/security.h b/source3/librpc/gen_ndr/security.h
index a17fd512f7..04655b178e 100644
--- a/source3/librpc/gen_ndr/security.h
+++ b/source3/librpc/gen_ndr/security.h
@@ -5,6 +5,7 @@
#include "librpc/gen_ndr/misc.h"
#define dom_sid2 dom_sid
#define dom_sid28 dom_sid
+#define dom_sid0 dom_sid
#ifndef _HEADER_security
#define _HEADER_security
diff --git a/source3/librpc/idl/drsuapi.idl b/source3/librpc/idl/drsuapi.idl
new file mode 100644
index 0000000000..80d800c533
--- /dev/null
+++ b/source3/librpc/idl/drsuapi.idl
@@ -0,0 +1,1503 @@
+#include "idl_types.h"
+
+import "security.idl", "misc.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 samr_GroupAttrs samr_GroupAttrs;
+
+ /*****************/
+ /* Function 0x00 */
+ 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_00000080 = 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_00100000 = 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_20000000 = 0x20000000,
+ DRSUAPI_SUPPORTED_EXTENSION_40000000 = 0x40000000,
+ DRSUAPI_SUPPORTED_EXTENSION_80000000 = 0x80000000
+ } drsuapi_SupportedExtensions;
+
+ /* this is used by w2k */
+ typedef struct {
+ drsuapi_SupportedExtensions supported_extensions;
+ GUID site_guid;
+ uint32 u1;
+ } drsuapi_DsBindInfo24;
+
+ /* this is used by w2k3 */
+ typedef struct {
+ drsuapi_SupportedExtensions supported_extensions;
+ GUID site_guid;
+ uint32 u1;
+ uint32 repl_epoch;
+ } drsuapi_DsBindInfo28;
+
+ typedef struct {
+ [flag(NDR_REMAINING)] DATA_BLOB info;
+ } drsuapi_DsBindInfoFallBack;
+
+ typedef [nodiscriminant] union {
+ [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
+ [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
+ [default][subcontext(4)] 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
+ */
+
+ typedef struct {
+ [range(1,10000)] uint32 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 [public] bitmap {
+ DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION = 0x00000001,
+ DRSUAPI_DS_REPLICA_SYNC_WRITEABLE = 0x00000002,
+ DRSUAPI_DS_REPLICA_SYNC_PERIODIC = 0x00000004,
+ DRSUAPI_DS_REPLICA_SYNC_INTERSITE_MESSAGING = 0x00000008,
+ DRSUAPI_DS_REPLICA_SYNC_ALL_SOURCES = 0x00000010,
+ DRSUAPI_DS_REPLICA_SYNC_FULL = 0x00000020,
+ DRSUAPI_DS_REPLICA_SYNC_URGENT = 0x00000040,
+ DRSUAPI_DS_REPLICA_SYNC_NO_DISCARD = 0x00000080,
+ DRSUAPI_DS_REPLICA_SYNC_FORCE = 0x00000100,
+ DRSUAPI_DS_REPLICA_SYNC_ADD_REFERENCE = 0x00000200,
+ DRSUAPI_DS_REPLICA_SYNC_NEVER_COMPLETED = 0x00000400,
+ DRSUAPI_DS_REPLICA_SYNC_TWO_WAY = 0x00000800,
+ DRSUAPI_DS_REPLICA_SYNC_NEVER_NOTIFY = 0x00001000,
+ DRSUAPI_DS_REPLICA_SYNC_INITIAL = 0x00002000,
+ DRSUAPI_DS_REPLICA_SYNC_USE_COMPRESSION = 0x00004000,
+ DRSUAPI_DS_REPLICA_SYNC_ABANDONED = 0x00008000,
+ DRSUAPI_DS_REPLICA_SYNC_INITIAL_IN_PROGRESS = 0x00010000,
+ DRSUAPI_DS_REPLICA_SYNC_PARTIAL_ATTRIBUTE_SET = 0x00020000,
+ DRSUAPI_DS_REPLICA_SYNC_REQUEUE = 0x00040000,
+ DRSUAPI_DS_REPLICA_SYNC_NOTIFICATION = 0x00080000,
+ DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_REPLICA = 0x00100000,
+ DRSUAPI_DS_REPLICA_SYNC_CRITICAL = 0x00200000,
+ DRSUAPI_DS_REPLICA_SYNC_FULL_IN_PROGRESS = 0x00400000,
+ DRSUAPI_DS_REPLICA_SYNC_PREEMPTED = 0x00800000
+ } drsuapi_DsReplicaSyncOptions;
+
+ typedef struct {
+ drsuapi_DsReplicaObjectIdentifier *naming_context;
+ GUID source_dsa_guid;
+ astring *other_info; /* I assume this is related to the repsFromTo1OtherInfo dns_name */
+ drsuapi_DsReplicaSyncOptions options;
+ } drsuapi_DsReplicaSyncRequest1;
+
+ typedef [switch_type(int32)] union {
+ [case(1)] drsuapi_DsReplicaSyncRequest1 req1;
+ } drsuapi_DsReplicaSyncRequest;
+
+ WERROR drsuapi_DsReplicaSync(
+ [in] policy_handle *bind_handle,
+ [in] int32 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 {
+ uint32 u1;
+ uint32 u2;
+ [range(0,0x100000)] uint32 count;
+ uint32 u3;
+ [size_is(count)] drsuapi_DsReplicaCursor cursors[];
+ } drsuapi_DsReplicaCursorCtrEx;
+
+ typedef [public] bitmap {
+ /* the _WRITEABLE flag indicates a replication with all attributes
+ *
+ * --metze
+ */
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE = 0x00000010,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP = 0x00000020,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS = 0x00000040,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_USE_ASYNC_INTERSIDE_TRANSPORT = 0x00000080,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_TWO_WAY_SYNC = 0x00000200,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS = 0x00000800,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS = 0x00001000, /* was 0x00010000, */
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_NEXT_PACKET = 0x00002000, /* was 0x00020000, */
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED = 0x00200000,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_PREEMPTED = 0x01000000,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_CHANGE_NOTIFICATIONS = 0x04000000,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_DISABLE_SCHEDULED_SYNC = 0x08000000,
+ /*
+ * the following NOTE applies to DsGetNCChangesRequest5:
+ * - the data is only compressed when 10 or more objects are replicated
+ * - but there could also be a size limit of 35 KBytes or something like that
+ * - the reply is DsGetNCChangesCtr2
+ * - maybe the same applies to DsGetNCChangesRequest8...
+ *
+ * --metze
+ */
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES = 0x10000000,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_NO_CHANGE_NOTIFICATIONS = 0x20000000,
+ DRSUAPI_DS_REPLICA_NEIGHBOUR_PARTIAL_ATTRIBUTE_SET = 0x40000000
+ } drsuapi_DsReplicaNeighbourFlags;
+
+ 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_DsReplicaNeighbourFlags replica_flags;
+ uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
+ uint32 max_ndr_size; /* w2k3 seems to ignore this */
+ uint32 unknown4;
+ hyper h1;
+ } 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 [nopush,nopull] struct {
+ [range(0,10000),value(ndr_size_drsuapi_DsReplicaOID_oid(oid, 0))] uint32 __ndr_size;
+ [size_is(__ndr_size),charset(DOS)] uint8 *oid; /* it's encoded with asn1_write_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_ATTRIBUTE_objectClass = 0x00000000,
+ DRSUAPI_ATTRIBUTE_description = 0x0000000d,
+ DRSUAPI_ATTRIBUTE_member = 0x0000001f,
+ DRSUAPI_ATTRIBUTE_instanceType = 0x00020001,
+ DRSUAPI_ATTRIBUTE_whenCreated = 0x00020002,
+ DRSUAPI_ATTRIBUTE_hasMasterNCs = 0x0002000e,
+ DRSUAPI_ATTRIBUTE_governsID = 0x00020016,
+ DRSUAPI_ATTRIBUTE_attributeID = 0x0002001e,
+ DRSUAPI_ATTRIBUTE_attributeSyntax = 0x00020020,
+ DRSUAPI_ATTRIBUTE_isSingleValued = 0x00020021,
+ DRSUAPI_ATTRIBUTE_rangeLower = 0x00020022,
+ DRSUAPI_ATTRIBUTE_rangeUpper = 0x00020023,
+ DRSUAPI_ATTRIBUTE_dMDLocation = 0x00020024,
+ DRSUAPI_ATTRIBUTE_objectVersion = 0x0002004c,
+ DRSUAPI_ATTRIBUTE_invocationId = 0x00020073,
+ DRSUAPI_ATTRIBUTE_showInAdvancedViewOnly = 0x000200a9,
+ DRSUAPI_ATTRIBUTE_adminDisplayName = 0x000200c2,
+ DRSUAPI_ATTRIBUTE_adminDescription = 0x000200e2,
+ DRSUAPI_ATTRIBUTE_oMSyntax = 0x000200e7,
+ DRSUAPI_ATTRIBUTE_ntSecurityDescriptor = 0x00020119,
+ DRSUAPI_ATTRIBUTE_searchFlags = 0x0002014e,
+ DRSUAPI_ATTRIBUTE_lDAPDisplayName = 0x000201cc,
+ DRSUAPI_ATTRIBUTE_name = 0x00090001,
+ DRSUAPI_ATTRIBUTE_currentValue = 0x0009001b,
+ DRSUAPI_ATTRIBUTE_objectSid = 0x00090092,
+ DRSUAPI_ATTRIBUTE_schemaIDGUID = 0x00090094,
+ DRSUAPI_ATTRIBUTE_dBCSPwd = 0x00090037,/* lmPwdHash */
+ DRSUAPI_ATTRIBUTE_unicodePwd = 0x0009005a,/* ntPwdHash */
+ DRSUAPI_ATTRIBUTE_ntPwdHistory = 0x0009005e,
+ DRSUAPI_ATTRIBUTE_priorValue = 0x00090064,
+ DRSUAPI_ATTRIBUTE_supplementalCredentials = 0x0009007d,
+ DRSUAPI_ATTRIBUTE_trustAuthIncoming = 0x00090081,
+ DRSUAPI_ATTRIBUTE_trustAuthOutgoing = 0x00090087,
+ DRSUAPI_ATTRIBUTE_lmPwdHistory = 0x000900a0,
+ DRSUAPI_ATTRIBUTE_sAMAccountName = 0x000900dd,
+ DRSUAPI_ATTRIBUTE_fSMORoleOwner = 0x00090171,
+ DRSUAPI_ATTRIBUTE_systemFlags = 0x00090177,
+ DRSUAPI_ATTRIBUTE_serverReference = 0x00090203,
+ DRSUAPI_ATTRIBUTE_serverReferenceBL = 0x00090204,
+ DRSUAPI_ATTRIBUTE_initialAuthIncoming = 0x0009021b,
+ DRSUAPI_ATTRIBUTE_initialAuthOutgoing = 0x0009021c,
+ DRSUAPI_ATTRIBUTE_wellKnownObjects = 0x0009026a,
+ DRSUAPI_ATTRIBUTE_isMemberOfPartialAttributeSet = 0x0009027f,
+ DRSUAPI_ATTRIBUTE_objectCategory = 0x0009030e,
+ DRSUAPI_ATTRIBUTE_gPLink = 0x0009037b,
+ DRSUAPI_ATTRIBUTE_msDS_Behavior_Version = 0x000905b3,
+ DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber = 0x000906f6,
+ DRSUAPI_ATTRIBUTE_msDS_HasDomainNCs = 0x0009071c,
+ DRSUAPI_ATTRIBUTE_msDS_hasMasterNCs = 0x0009072c
+ } drsuapi_DsAttributeId;
+
+ 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_DsReplicaNeighbourFlags replica_flags;
+ uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
+ uint32 max_ndr_size; /* w2k3 seems to ignore this */
+ uint32 unknown4;
+ hyper h1;
+ uint32 unique_ptr1;
+ uint32 unique_ptr2;
+ drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
+ } drsuapi_DsGetNCChangesRequest8;
+
+ typedef [switch_type(int32)] union {
+ [case(5)] drsuapi_DsGetNCChangesRequest5 req5;
+ [case(8)] drsuapi_DsGetNCChangesRequest8 req8;
+ } 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 {
+ uint32 u1;
+ uint32 u2;
+ [range(0,0x100000)] uint32 count;
+ uint32 u3;
+ [size_is(count)] drsuapi_DsReplicaCursor2 cursors[];
+ } drsuapi_DsReplicaCursor2CtrEx;
+
+ /* Generic DATA_BLOB values */
+ typedef struct {
+ [range(0,10485760),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,gensize] struct {
+ [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary(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] 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] struct {
+ drsuapi_DsReplicaObjectIdentifier *identifier;
+ uint32 unknown1;
+ 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 {
+ drsuapi_DsReplicaObjectListItemEx *next_object;
+ drsuapi_DsReplicaObject object;
+ uint32 unknown1;
+ 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;
+ uint32 total_object_count;
+ 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;
+ uint32 unknown4;
+ } 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;
+
+ 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;
+ uint32 total_object_count;
+ 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;
+ uint32 unknown4;
+ uint32 unknown5;
+ uint32 unknown6;
+ [range(0,1048576)] uint32 linked_attributes_count;
+ [size_is(linked_attributes_count)] drsuapi_DsReplicaLinkedAttribute *linked_attributes;
+ uint32 unknown7;
+ } drsuapi_DsGetNCChangesCtr6;
+
+ typedef struct {
+ uint32 decompressed_length;
+ uint32 compressed_length;
+ [subcontext(4),subcontext_size(compressed_length),
+ compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
+ drsuapi_DsGetNCChangesCtr1 *ctr1;
+ } drsuapi_DsGetNCChangesMSZIPCtr1;
+
+ typedef struct {
+ uint32 decompressed_length;
+ uint32 compressed_length;
+ [subcontext(4),subcontext_size(compressed_length),
+ compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
+ drsuapi_DsGetNCChangesCtr6 *ctr6;
+ } drsuapi_DsGetNCChangesMSZIPCtr6;
+
+ typedef struct {
+ uint32 decompressed_length;
+ uint32 compressed_length;
+ [subcontext(4),subcontext_size(compressed_length),
+ compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length),
+ flag(NDR_REMAINING)] DATA_BLOB *decompressed;
+ } drsuapi_DsGetNCChangesXPRESSCtr1;
+
+ typedef struct {
+ uint32 decompressed_length;
+ uint32 compressed_length;
+ [subcontext(4),subcontext_size(compressed_length),
+ compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length),
+ flag(NDR_REMAINING)] DATA_BLOB *decompressed;
+ } 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 {
+ /*
+ * this is a bit ugly, as the compression depends on the flags
+ * in the DsBind(), but only w2k uses DsGetNCChangesReq5
+ * and will get DsGetNCChangesCtr2 replies, and w2k only knowns
+ * about MSZIP and level 1 replies
+ */
+ [switch_is(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
+ } drsuapi_DsGetNCChangesCtr2;
+
+ typedef struct {
+ [range(0,6)] int32 level;
+ [range(2,3)] drsuapi_DsGetNCChangesCompressionType type;
+ [switch_is(level | (type<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
+ } drsuapi_DsGetNCChangesCtr7;
+
+ typedef [switch_type(int32)] 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,out,ref] int32 *level,
+ [in,ref,switch_is(*level)] drsuapi_DsGetNCChangesRequest *req,
+ [out,ref,switch_is(*level)] drsuapi_DsGetNCChangesCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x04 */
+ typedef bitmap {
+ DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION = 0x00000001,
+ DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE = 0x00000002,
+ DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE = 0x00000004,
+ DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE = 0x00000008,
+ DRSUAPI_DS_REPLICA_UPDATE_0x00000010 = 0x00000010
+ } drsuapi_DsReplicaUpdateRefsOptions;
+
+ typedef struct {
+ [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
+ [ref,charset(DOS),string] uint8 *dest_dsa_dns_name;
+ GUID dest_dsa_guid;
+ drsuapi_DsReplicaUpdateRefsOptions options;
+ } drsuapi_DsReplicaUpdateRefsRequest1;
+
+ typedef [switch_type(int32)] union {
+ [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
+ } drsuapi_DsReplicaUpdateRefsRequest;
+
+ WERROR drsuapi_DsReplicaUpdateRefs(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
+ );
+
+ /*****************/
+ /* Function 0x05 */
+ typedef bitmap {
+ DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION = 0x00000001,
+ DRSUAPI_DS_REPLICA_ADD_WRITEABLE = 0x00000002
+ /* TODO ... */
+ } drsuapi_DsReplicaAddOptions;
+
+ WERROR DRSUAPI_REPLICA_ADD();
+
+ /*****************/
+ /* Function 0x06 */
+ typedef bitmap {
+ DRSUAPI_DS_REPLICA_DELETE_ASYNCHRONOUS_OPERATION = 0x00000001,
+ DRSUAPI_DS_REPLICA_DELETE_WRITEABLE = 0x00000002
+ /* TODO ... */
+ } drsuapi_DsReplicaDeleteOptions;
+
+ WERROR DRSUAPI_REPLICA_DEL();
+
+ /*****************/
+ /* Function 0x07 */
+ typedef bitmap {
+ DRSUAPI_DS_REPLICA_MODIFY_ASYNCHRONOUS_OPERATION = 0x00000001,
+ DRSUAPI_DS_REPLICA_MODIFY_WRITEABLE = 0x00000002
+ } drsuapi_DsReplicaModifyOptions;
+
+ WERROR DRSUAPI_REPLICA_MODIFY();
+
+ /*****************/
+ /* Function 0x08 */
+ 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)] samr_GroupAttrs *group_attrs;
+ [size_is(num_sids)] dom_sid28 **sids;
+ } drsuapi_DsGetMembershipsCtr1;
+
+ typedef [switch_type(int32)] 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;
+ drsuapi_DsMembershipType type;
+ drsuapi_DsReplicaObjectIdentifier *domain;
+ } drsuapi_DsGetMembershipsRequest1;
+
+ typedef [switch_type(int32)] union {
+ [case(1)] drsuapi_DsGetMembershipsRequest1 req1;
+ } drsuapi_DsGetMembershipsRequest;
+
+ WERROR drsuapi_DsGetMemberships(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,ref] [switch_is(level)] drsuapi_DsGetMembershipsRequest *req,
+ [out,ref] int32 *level_out,
+ [out,ref] [switch_is(*level_out)] drsuapi_DsGetMembershipsCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x0a */
+ WERROR DRSUAPI_INTER_DOMAIN_MOVE();
+
+ /*****************/
+ /* Function 0x0b */
+ typedef struct {
+ uint32 unknown1;
+ uint32 unknown2;
+ [range(0,0x00A00000)] uint32 length;
+ [size_is(length)] uint8 *data;
+ } drsuapi_DsGetNT4ChangeLogRequest1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsGetNT4ChangeLogRequest1 req1;
+ } drsuapi_DsGetNT4ChangeLogRequest;
+
+ typedef struct {
+ [range(0,0x00A00000)] uint32 length1;
+ [range(0,0x00A00000)] uint32 length2;
+ hyper unknown1;
+ NTTIME time2;
+ hyper unknown3;
+ NTTIME time4;
+ hyper unknown5;
+ NTTIME time6;
+ NTSTATUS status;
+ [size_is(length1)] uint8 *data1;
+ [size_is(length2)] uint8 *data2;
+ } 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_UKNOWN = 0,
+ DRSUAPI_DS_NAME_FORMAT_FQDN_1779 = 1,
+ DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT = 2,
+ DRSUAPI_DS_NAME_FORMAT_DISPLAY = 3,
+ DRSUAPI_DS_NAME_FORMAT_GUID = 6,
+ DRSUAPI_DS_NAME_FORMAT_CANONICAL = 7,
+ DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL = 8,
+ DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX = 9,
+ DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL = 10,
+ DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY = 11,
+ DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN = 12
+ } 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(int32)] 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(int32)] union {
+ [case(1)] drsuapi_DsNameCtr1 *ctr1;
+ } drsuapi_DsNameCtr;
+
+ WERROR drsuapi_DsCrackNames(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,ref,switch_is(level)] drsuapi_DsNameRequest *req,
+ [out,ref] int32 *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(int32)] union {
+ [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
+ } drsuapi_DsWriteAccountSpnRequest;
+
+ typedef struct {
+ WERROR status;
+ } drsuapi_DsWriteAccountSpnResult1;
+
+ typedef [switch_type(int32)] union {
+ [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
+ } drsuapi_DsWriteAccountSpnResult;
+
+ WERROR drsuapi_DsWriteAccountSpn(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,ref,switch_is(level)] drsuapi_DsWriteAccountSpnRequest *req,
+ [out,ref] int32 *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;
+ uint32 unknown; /* 0x000000001 */
+ } drsuapi_DsRemoveDSServerRequest1;
+
+ typedef [switch_type(int32)] union {
+ [case(1)] drsuapi_DsRemoveDSServerRequest1 req1;
+ } drsuapi_DsRemoveDSServerRequest;
+
+ typedef struct {
+ WERROR status;
+ } drsuapi_DsRemoveDSServerResult1;
+
+ typedef [switch_type(int32)] union {
+ [case(1)] drsuapi_DsRemoveDSServerResult1 res1;
+ } drsuapi_DsRemoveDSServerResult;
+
+ WERROR drsuapi_DsRemoveDSServer(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,ref,switch_is(level)] drsuapi_DsRemoveDSServerRequest *req,
+ [out,ref] int32 *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsRemoveDSServerResult *res
+ );
+
+ /*****************/
+ /* Function 0x0f */
+ WERROR DRSUAPI_REMOVE_DS_DOMAIN();
+
+ /*****************/
+ /* Function 0x10 */
+ typedef struct {
+ [charset(UTF16),string] uint16 *domain_name; /* netbios or dns */
+ int32 level; /* specifies the switch level for the request */
+ } drsuapi_DsGetDCInfoRequest1;
+
+ typedef [switch_type(int32)] 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;
+
+ /*
+ * 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 [v1_enum] enum {
+ DRSUAPI_DC_INFO_CTR_1 = 1,
+ DRSUAPI_DC_INFO_CTR_2 = 2,
+ DRSUAPI_DC_CONNECTION_CTR_01 = -1
+ } drsuapi_DsGetDCInfoCtrLevels;
+
+ typedef [switch_type(int32)] union {
+ [case(DRSUAPI_DC_INFO_CTR_1)] drsuapi_DsGetDCInfoCtr1 ctr1;
+ [case(DRSUAPI_DC_INFO_CTR_2)] drsuapi_DsGetDCInfoCtr2 ctr2;
+ [case(DRSUAPI_DC_CONNECTION_CTR_01)] drsuapi_DsGetDCConnectionCtr01 ctr01;
+ } drsuapi_DsGetDCInfoCtr;
+
+ WERROR drsuapi_DsGetDomainControllerInfo(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,ref,switch_is(level)] drsuapi_DsGetDCInfoRequest *req,
+ [out,ref] int32 *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsGetDCInfoCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x11 */
+ typedef [public,noprint] struct {
+ 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";
+
+ /*
+ * please note the the current idl
+ * for DsAddEntry does only parse
+ * what I saw between 2 w2k3 boxes
+ * in my dssync experiments I got some other replies
+ * so all I want to say is that this is very incomplete yet...
+ * --metze
+ */
+ typedef struct {
+ drsuapi_DsReplicaObjectListItem first_object;
+ } drsuapi_DsAddEntryRequest2;
+
+ typedef [switch_type(int32)] union {
+ [case(2)] drsuapi_DsAddEntryRequest2 req2;
+ } drsuapi_DsAddEntryRequest;
+
+ typedef struct {
+ uint32 unknown1;
+ WERROR status;
+ uint32 unknown2;
+ uint16 unknown3;
+ } drsuapi_DsAddEntryErrorInfoX;
+
+ typedef struct {
+ [range(0,10485760)] uint32 size;
+ [size_is(size)] uint8 *data;
+ } drsuapi_DsAddEntryExtraErrorBuffer;
+
+ typedef struct {
+ drsuapi_DsAddEntryErrorInfoX error;
+ drsuapi_DsAttributeId attid;
+ uint32 unknown2;
+ drsuapi_DsAddEntryExtraErrorBuffer buffer;
+ } drsuapi_DsAddEntryExtraError1;
+
+ typedef /*[noprint]*/ struct {
+ drsuapi_DsAddEntryErrorListItem1 *next;
+ drsuapi_DsAddEntryExtraError1 error;
+ } drsuapi_DsAddEntryErrorListItem1;
+
+ typedef struct {
+ drsuapi_DsReplicaObjectIdentifier *id;
+ WERROR status;
+ drsuapi_DsAddEntryErrorListItem1 first;
+ } drsuapi_DsAddEntryErrorInfo1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsAddEntryErrorInfo1 error1;
+/* [case(2)] drsuapi_DsAddEntryErrorInfo2 error2;
+ [case(3)] drsuapi_DsAddEntryErrorInfo3 error3;
+*/ [case(4)] drsuapi_DsAddEntryErrorInfoX errorX;
+ [case(5)] drsuapi_DsAddEntryErrorInfoX errorX;
+ [case(6)] drsuapi_DsAddEntryErrorInfoX errorX;
+ [case(7)] drsuapi_DsAddEntryErrorInfoX errorX;
+ } drsuapi_DsAddEntryErrorInfo;
+
+ typedef struct {
+ WERROR status;
+ uint32 level;
+ [switch_is(level)] drsuapi_DsAddEntryErrorInfo *info;
+ } drsuapi_DsAddEntryError1;
+
+ typedef [switch_type(uint32)] union {
+ [case(1)] drsuapi_DsAddEntryError1 info1;
+ } drsuapi_DsAddEntryError;
+
+ typedef struct {
+ GUID guid;
+ dom_sid28 sid;
+ } drsuapi_DsReplicaObjectIdentifier2;
+
+ typedef struct {
+ drsuapi_DsReplicaObjectIdentifier *id;
+ uint32 unknown1;
+ drsuapi_DsAddEntryErrorInfoX error;
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
+ } drsuapi_DsAddEntryCtr2;
+
+ typedef struct {
+ drsuapi_DsReplicaObjectIdentifier *id;
+ uint32 level;
+ [switch_is(level)] drsuapi_DsAddEntryError *error;
+ [range(0,10000)] uint32 count;
+ [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
+ } drsuapi_DsAddEntryCtr3;
+
+ typedef [switch_type(int32)] union {
+ [case(2)] drsuapi_DsAddEntryCtr2 ctr2;
+ [case(3)] drsuapi_DsAddEntryCtr3 ctr3;
+ } drsuapi_DsAddEntryCtr;
+
+ [public] WERROR drsuapi_DsAddEntry(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,ref,switch_is(level)] drsuapi_DsAddEntryRequest *req,
+ [out,ref] int32 *level_out,
+ [out,ref,switch_is(*level_out)] drsuapi_DsAddEntryCtr *ctr
+ );
+
+ /*****************/
+ /* Function 0x12 */
+ WERROR DRSUAPI_EXECUTE_KCC();
+
+ /*****************/
+ /* 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_NEIGHBORS02 = -2,
+ DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04 = -4,
+ DRSUAPI_DS_REPLICA_INFO_CURSORS05 = -5,
+ DRSUAPI_DS_REPLICA_INFO_06 = -6
+ } drsuapi_DsReplicaInfoType;
+
+ typedef struct {
+ drsuapi_DsReplicaInfoType info_type;
+ [charset(UTF16),string] uint16 *object_dn;
+ GUID guid1;
+ } drsuapi_DsReplicaGetInfoRequest1;
+
+ typedef struct {
+ drsuapi_DsReplicaInfoType info_type;
+ [charset(UTF16),string] uint16 *object_dn;
+ GUID guid1;
+ uint32 unknown1;
+ [charset(UTF16),string] uint16 *string1;
+ [charset(UTF16),string] uint16 *string2;
+ uint32 unknown2;
+ } 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_DsReplicaNeighbourFlags 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 [switch_type(drsuapi_DsReplicaOpType)] union {
+ [case(DRSUAPI_DS_REPLICA_OP_TYPE_SYNC)] drsuapi_DsReplicaSyncOptions sync;
+ [case(DRSUAPI_DS_REPLICA_OP_TYPE_ADD)] drsuapi_DsReplicaAddOptions add;
+ [case(DRSUAPI_DS_REPLICA_OP_TYPE_DELETE)] drsuapi_DsReplicaDeleteOptions op_delete;
+ [case(DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY)] drsuapi_DsReplicaModifyOptions modify;
+ [case(DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS)] drsuapi_DsReplicaUpdateRefsOptions update_refs;
+ [default] uint32 unknown;
+ } drsuapi_DsRplicaOpOptions;
+
+ typedef struct {
+ NTTIME operation_start;
+ uint32 serial_num; /* unique till reboot */
+ uint32 priority;
+ drsuapi_DsReplicaOpType operation_type;
+ [switch_is(operation_type)] drsuapi_DsRplicaOpOptions 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;
+ int32 enumeration_context;
+ [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
+ } drsuapi_DsReplicaAttrValMetaDataCtr;
+
+ typedef struct {
+ uint32 count;
+ int32 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;
+ int32 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;
+ int32 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;
+ int32 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 u1 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_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02;
+ [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04;
+ [case(DRSUAPI_DS_REPLICA_INFO_CURSORS05)] drsuapi_DsReplicaCursorCtrEx *cursors05;
+ [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06;
+ } 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 */
+ 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(int32)] 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(int32)] union {
+ [case(1)] drsuapi_DsGetMemberships2Request1 req1;
+ } drsuapi_DsGetMemberships2Request;
+
+ WERROR drsuapi_DsGetMemberships2(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,ref] [switch_is(level)] drsuapi_DsGetMemberships2Request *req,
+ [out,ref] int32 *level_out,
+ [out,ref] [switch_is(*level_out)] drsuapi_DsGetMemberships2Ctr *ctr
+ );
+
+
+ /*****************/
+ /* Function 0x16 */
+ WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();
+
+ /*****************/
+ /* Function 0x17 */
+ 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;
+ uint32 unknown;
+ } drsuapi_QuerySitesByCostCtr1;
+
+ typedef [switch_type(int32)] 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(int32)] union {
+ [case(1)] drsuapi_QuerySitesByCostRequest1 req1;
+ } drsuapi_QuerySitesByCostRequest;
+
+ WERROR drsuapi_QuerySitesByCost(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in,ref] [switch_is(level)] drsuapi_QuerySitesByCostRequest *req,
+ [out,ref] int32 *level_out,
+ [out,ref] [switch_is(*level_out)] drsuapi_QuerySitesByCostCtr *ctr
+ );
+}
diff --git a/source3/librpc/idl/nbt.idl b/source3/librpc/idl/nbt.idl
new file mode 100644
index 0000000000..4dc7972e45
--- /dev/null
+++ b/source3/librpc/idl/nbt.idl
@@ -0,0 +1,699 @@
+#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", "svcctl.idl";
+[
+helper("libcli/nbt/libnbt.h")
+]
+interface nbt
+{
+ const int NBT_NAME_SERVICE_PORT = 137;
+ const int NBT_DGRAM_SERVICE_PORT = 138;
+
+ typedef [bitmap16bit] bitmap {
+ NBT_RCODE = 0x000F,
+ NBT_FLAG_BROADCAST = 0x0010,
+ NBT_FLAG_RECURSION_AVAIL = 0x0080,
+ NBT_FLAG_RECURSION_DESIRED = 0x0100,
+ NBT_FLAG_TRUNCATION = 0x0200,
+ NBT_FLAG_AUTHORITIVE = 0x0400,
+ NBT_OPCODE = 0x7800,
+ NBT_FLAG_REPLY = 0x8000
+ } nbt_operation;
+
+ /* the opcodes are in the operation field, masked with
+ NBT_OPCODE */
+ typedef enum {
+ NBT_OPCODE_QUERY = (0x0<<11),
+ NBT_OPCODE_REGISTER = (0x5<<11),
+ NBT_OPCODE_RELEASE = (0x6<<11),
+ NBT_OPCODE_WACK = (0x7<<11),
+ NBT_OPCODE_REFRESH = (0x8<<11),
+ NBT_OPCODE_REFRESH2 = (0x9<<11),
+ NBT_OPCODE_MULTI_HOME_REG = (0xf<<11)
+ } nbt_opcode;
+
+ /* rcode values */
+ typedef enum {
+ NBT_RCODE_OK = 0x0,
+ NBT_RCODE_FMT = 0x1,
+ NBT_RCODE_SVR = 0x2,
+ NBT_RCODE_NAM = 0x3,
+ NBT_RCODE_IMP = 0x4,
+ NBT_RCODE_RFS = 0x5,
+ NBT_RCODE_ACT = 0x6,
+ NBT_RCODE_CFT = 0x7
+ } nbt_rcode;
+
+ /* we support any 8bit name type, but by defining the common
+ ones here we get better debug displays */
+ typedef [enum8bit] enum {
+ NBT_NAME_CLIENT = 0x00,
+ NBT_NAME_MS = 0x01,
+ NBT_NAME_USER = 0x03,
+ NBT_NAME_SERVER = 0x20,
+ NBT_NAME_PDC = 0x1B,
+ NBT_NAME_LOGON = 0x1C,
+ NBT_NAME_MASTER = 0x1D,
+ NBT_NAME_BROWSER = 0x1E
+ } nbt_name_type;
+
+ /* the ndr parser for nbt_name is separately defined in
+ nbtname.c (along with the parsers for nbt_string) */
+ typedef [public,nopull,nopush] struct {
+ string name;
+ string scope;
+ nbt_name_type type;
+ } nbt_name;
+
+ typedef [enum16bit] enum {
+ NBT_QCLASS_IP = 0x01
+ } nbt_qclass;
+
+ typedef [enum16bit] enum {
+ NBT_QTYPE_ADDRESS = 0x0001,
+ NBT_QTYPE_NAMESERVICE = 0x0002,
+ NBT_QTYPE_NULL = 0x000A,
+ NBT_QTYPE_NETBIOS = 0x0020,
+ NBT_QTYPE_STATUS = 0x0021
+ } nbt_qtype;
+
+ typedef struct {
+ nbt_name name;
+ nbt_qtype question_type;
+ nbt_qclass question_class;
+ } nbt_name_question;
+
+ /* these are the possible values of the NBT_NM_OWNER_TYPE
+ field */
+ typedef enum {
+ NBT_NODE_B = 0x0000,
+ NBT_NODE_P = 0x2000,
+ NBT_NODE_M = 0x4000,
+ NBT_NODE_H = 0x6000
+ } nbt_node_type;
+
+ typedef [bitmap16bit] bitmap {
+ NBT_NM_PERMANENT = 0x0200,
+ NBT_NM_ACTIVE = 0x0400,
+ NBT_NM_CONFLICT = 0x0800,
+ NBT_NM_DEREGISTER = 0x1000,
+ NBT_NM_OWNER_TYPE = 0x6000,
+ NBT_NM_GROUP = 0x8000
+ } nb_flags;
+
+ typedef struct {
+ nb_flags nb_flags;
+ ipv4address ipaddr;
+ } nbt_rdata_address;
+
+ typedef struct {
+ uint16 length;
+ nbt_rdata_address addresses[length/6];
+ } nbt_rdata_netbios;
+
+ typedef struct {
+ uint8 unit_id[6];
+ uint8 jumpers;
+ uint8 test_result;
+ uint16 version_number;
+ uint16 period_of_statistics;
+ uint16 number_of_crcs;
+ uint16 number_alignment_errors;
+ uint16 number_of_collisions;
+ uint16 number_send_aborts;
+ uint32 number_good_sends;
+ uint32 number_good_receives;
+ uint16 number_retransmits;
+ uint16 number_no_resource_conditions;
+ uint16 number_free_command_blocks;
+ uint16 total_number_command_blocks;
+ uint16 max_total_number_command_blocks;
+ uint16 number_pending_sessions;
+ uint16 max_number_pending_sessions;
+ uint16 max_total_sessions_possible;
+ uint16 session_data_packet_size;
+ } nbt_statistics;
+
+ typedef struct {
+ [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] union {
+ [case(NBT_QTYPE_NETBIOS)] nbt_rdata_netbios netbios;
+ [case(NBT_QTYPE_STATUS)] nbt_rdata_status status;
+ [default] nbt_rdata_data data;
+ } nbt_rdata;
+
+/*
+ * this macro works arround the problem
+ * that we need to use nbt_rdata_data
+ * together with NBT_QTYPE_NETBIOS
+ * for WACK replies
+ */
+#define NBT_RES_REC_LEVEL(rr_type, rdata) (\
+ (((rr_type) == NBT_QTYPE_NETBIOS) && \
+ talloc_check_name(ndr, "struct ndr_push") && \
+ ((rdata).data.length == 2)) \
+ ? 0 : rr_type)
+
+ typedef [flag(LIBNDR_PRINT_ARRAY_HEX)] struct {
+ nbt_name name;
+ nbt_qtype rr_type;
+ nbt_qclass rr_class;
+ uint32 ttl;
+ [switch_is(NBT_RES_REC_LEVEL(rr_type, rdata))] nbt_rdata rdata;
+ } nbt_res_rec;
+
+ typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
+ uint16 name_trn_id;
+ nbt_operation operation;
+ uint16 qdcount;
+ uint16 ancount;
+ uint16 nscount;
+ uint16 arcount;
+ nbt_name_question questions[qdcount];
+ nbt_res_rec answers[ancount];
+ nbt_res_rec nsrecs[nscount];
+ nbt_res_rec additional[arcount];
+ [flag(NDR_REMAINING)] DATA_BLOB padding;
+ } nbt_name_packet;
+
+
+ /*
+ NBT DGRAM packets (UDP/138)
+ */
+
+ typedef [enum8bit] enum {
+ DGRAM_DIRECT_UNIQUE = 0x10,
+ DGRAM_DIRECT_GROUP = 0x11,
+ DGRAM_BCAST = 0x12,
+ DGRAM_ERROR = 0x13,
+ DGRAM_QUERY = 0x14,
+ DGRAM_QUERY_POSITIVE = 0x15,
+ DGRAM_QUERY_NEGATIVE = 0x16
+ } dgram_msg_type;
+
+ typedef [bitmap8bit] bitmap {
+ DGRAM_FLAG_MORE = 0x01,
+ DGRAM_FLAG_FIRST = 0x02,
+ DGRAM_FLAG_NODE_TYPE = 0x0C
+ } dgram_flags;
+
+ typedef [enum8bit] enum {
+ DGRAM_NODE_B = 0x00,
+ DGRAM_NODE_P = 0x04,
+ DGRAM_NODE_M = 0x08,
+ DGRAM_NODE_NBDD = 0x0C
+ } dgram_node_type;
+
+ /* a dgram_message is the main dgram body in general use */
+
+ /* the most common datagram type is a SMB_TRANSACTION
+ operation, where a SMB packet is used in the data section
+ of a dgram_message to hold a trans request, which in turn
+ holds a small command structure. It's a very strange beast
+ indeed. To make the code cleaner we define a basic SMB
+ packet in IDL here. This is not a general purpose SMB
+ packet, and won't be used in the core SMB client/server
+ code, but it does make working with these types of dgrams
+ easier */
+
+ const string NBT_MAILSLOT_NETLOGON = "\\MAILSLOT\\NET\\NETLOGON";
+ const string NBT_MAILSLOT_NTLOGON = "\\MAILSLOT\\NET\\NTLOGON";
+ const string NBT_MAILSLOT_GETDC = "\\MAILSLOT\\NET\\GETDC";
+ const string NBT_MAILSLOT_BROWSE = "\\MAILSLOT\\BROWSE";
+
+ typedef [enum8bit] enum {
+ SMB_TRANSACTION = 0x25
+ } smb_command;
+
+ typedef struct {
+ [range(17,17),value(17)] uint8 wct;
+ uint16 total_param_count;
+ uint16 total_data_count;
+ uint16 max_param_count;
+ uint16 max_data_count;
+ uint8 max_setup_count;
+ uint8 pad;
+ uint16 trans_flags;
+ uint32 timeout;
+ uint16 reserved;
+ uint16 param_count;
+ uint16 param_offset;
+ uint16 data_count;
+ uint16 data_offset;
+ [range(3,3),value(3)] uint8 setup_count;
+ uint8 pad2;
+ uint16 opcode;
+ uint16 priority;
+ uint16 _class;
+ [value(strlen(mailslot_name)+1+data.length)]
+ uint16 byte_count;
+ astring mailslot_name;
+ [flag(NDR_REMAINING)] DATA_BLOB data;
+ } smb_trans_body;
+
+ typedef [nodiscriminant] union {
+ [case(SMB_TRANSACTION)] smb_trans_body trans;
+ } smb_body;
+
+
+ typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN|NDR_PAHEX),public] struct {
+ smb_command smb_command;
+ uint8 err_class;
+ uint8 pad;
+ uint16 err_code;
+ uint8 flags;
+ uint16 flags2;
+ uint16 pid_high;
+ uint8 signature[8];
+ uint16 reserved;
+ uint16 tid;
+ uint16 pid;
+ uint16 vuid;
+ uint16 mid;
+ [switch_is(smb_command)] smb_body body;
+ } dgram_smb_packet;
+
+ const uint32 DGRAM_SMB = 0xff534d42; /* 0xffSMB */
+
+ typedef [nodiscriminant] union {
+ [case(DGRAM_SMB)] dgram_smb_packet smb;
+ } dgram_message_body;
+
+ typedef struct {
+ uint16 length;
+ uint16 offset;
+ nbt_name source_name;
+ nbt_name dest_name;
+ uint32 dgram_body_type;
+ [switch_is(dgram_body_type)] dgram_message_body body;
+ } dgram_message;
+
+ typedef [enum8bit] enum {
+ DGRAM_ERROR_NAME_NOT_PRESENT = 0x82,
+ DGRAM_ERROR_INVALID_SOURCE = 0x83,
+ DGRAM_ERROR_INVALID_DEST = 0x84
+ } dgram_err_code;
+
+ typedef [nodiscriminant] union {
+ [case(DGRAM_DIRECT_UNIQUE)] dgram_message msg;
+ [case(DGRAM_DIRECT_GROUP)] dgram_message msg;
+ [case(DGRAM_BCAST)] dgram_message msg;
+ [case(DGRAM_ERROR)] dgram_err_code error;
+ [case(DGRAM_QUERY)] nbt_name dest_name;
+ [case(DGRAM_QUERY_POSITIVE)] nbt_name dest_name;
+ [case(DGRAM_QUERY_NEGATIVE)] nbt_name dest_name;
+ } dgram_data;
+
+ typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
+ dgram_msg_type msg_type;
+ dgram_flags flags;
+ uint16 dgram_id;
+ ipv4address src_addr;
+ uint16 src_port;
+ [switch_is(msg_type)] dgram_data data;
+ } nbt_dgram_packet;
+
+
+ /*******************************************/
+ /* \MAILSLOT\NET\NETLOGON mailslot requests */
+ typedef enum {
+ NETLOGON_QUERY_FOR_PDC = 0x7,
+ NETLOGON_ANNOUNCE_UAS = 0xa,
+ NETLOGON_RESPONSE_FROM_PDC = 0xc,
+ NETLOGON_QUERY_FOR_PDC2 = 0x12,
+ NETLOGON_RESPONSE_FROM_PDC2 = 0x17,
+ NETLOGON_RESPONSE_FROM_PDC_USER = 0x19
+ } nbt_netlogon_command;
+
+ /* query for pdc request */
+ typedef struct {
+ astring computer_name;
+ astring mailslot_name;
+ [flag(NDR_ALIGN2)] DATA_BLOB _pad;
+ nstring unicode_name;
+ uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_netlogon_query_for_pdc;
+
+ /* query for pdc request - new style */
+ typedef struct {
+ uint16 request_count;
+ nstring computer_name;
+ nstring user_name;
+ astring mailslot_name;
+ uint32 unknown[2];
+ uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_netlogon_query_for_pdc2;
+
+ /* response from pdc */
+ typedef struct {
+ astring pdc_name;
+ [flag(NDR_ALIGN2)] DATA_BLOB _pad;
+ nstring unicode_pdc_name;
+ nstring domain_name;
+ uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_netlogon_response_from_pdc;
+
+ typedef [bitmap32bit] bitmap {
+ NBT_SERVER_PDC = 0x00000001,
+ NBT_SERVER_GC = 0x00000004,
+ NBT_SERVER_LDAP = 0x00000008,
+ NBT_SERVER_DS = 0x00000010,
+ NBT_SERVER_KDC = 0x00000020,
+ NBT_SERVER_TIMESERV = 0x00000040,
+ NBT_SERVER_CLOSEST = 0x00000080,
+ NBT_SERVER_WRITABLE = 0x00000100,
+ NBT_SERVER_GOOD_TIMESERV = 0x00000200
+ } nbt_server_type;
+
+ /* response from pdc - type2 */
+ typedef struct {
+ [flag(NDR_ALIGN4)] DATA_BLOB _pad;
+ nbt_server_type server_type;
+ GUID domain_uuid;
+ nbt_string forest;
+ nbt_string dns_domain;
+ nbt_string pdc_dns_name;
+ nbt_string domain;
+ nbt_string pdc_name;
+ nbt_string user_name;
+ nbt_string server_site;
+ nbt_string client_site;
+ uint8 unknown;
+ uint32 unknown2;
+ [flag(NDR_BIG_ENDIAN)]
+ ipv4address pdc_ip;
+ uint32 unknown3[2];
+ uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_netlogon_response_from_pdc2;
+
+ typedef enum netr_SamDatabaseID netr_SamDatabaseID;
+
+ /* announce change to UAS or SAM */
+ typedef struct {
+ netr_SamDatabaseID db_index;
+ hyper serial;
+ NTTIME timestamp;
+ } nbt_db_change;
+
+ /* used to announce SAM changes */
+ typedef struct {
+ uint32 serial_lo;
+ time_t timestamp;
+ uint32 pulse;
+ uint32 random;
+ astring pdc_name;
+ astring domain;
+ [flag(NDR_ALIGN2)] DATA_BLOB _pad;
+ nstring unicode_pdc_name;
+ nstring unicode_domain;
+ uint32 db_count;
+ nbt_db_change dbchange[db_count];
+ [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+ [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
+ uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_netlogon_announce_uas;
+
+ typedef [nodiscriminant] union {
+ [case(NETLOGON_QUERY_FOR_PDC)] nbt_netlogon_query_for_pdc pdc;
+ [case(NETLOGON_QUERY_FOR_PDC2)] nbt_netlogon_query_for_pdc2 pdc2;
+ [case(NETLOGON_ANNOUNCE_UAS)] nbt_netlogon_announce_uas uas;
+ [case(NETLOGON_RESPONSE_FROM_PDC)] nbt_netlogon_response_from_pdc response;
+ [case(NETLOGON_RESPONSE_FROM_PDC2)] nbt_netlogon_response_from_pdc2 response2;
+ [case(NETLOGON_RESPONSE_FROM_PDC_USER)] nbt_netlogon_response_from_pdc2 response2;
+ } nbt_netlogon_request;
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ nbt_netlogon_command command;
+ [switch_is(command)] nbt_netlogon_request req;
+ } nbt_netlogon_packet;
+
+ /*******************************************/
+ /* CLDAP netlogon response */
+
+ /* note that these structures are very similar to, but not
+ quite identical to, the netlogon structures above */
+
+ typedef struct {
+ uint16 type;
+ nstring pdc_name;
+ nstring user_name;
+ nstring domain_name;
+ [value(1)] uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_cldap_netlogon_1;
+
+ typedef struct {
+ uint16 type;
+ nstring pdc_name;
+ nstring user_name;
+ nstring domain_name;
+ GUID domain_uuid;
+ GUID unknown_uuid;
+ nbt_string forest;
+ nbt_string dns_domain;
+ nbt_string pdc_dns_name;
+ ipv4address pdc_ip;
+ nbt_server_type server_type;
+ [value(3)] uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_cldap_netlogon_3;
+
+ typedef struct {
+ uint32 type;
+ nbt_server_type server_type;
+ GUID domain_uuid;
+ nbt_string forest;
+ nbt_string dns_domain;
+ nbt_string pdc_dns_name;
+ nbt_string domain;
+ nbt_string pdc_name;
+ nbt_string user_name;
+ nbt_string server_site;
+ nbt_string client_site;
+ [value(5)] uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_cldap_netlogon_5;
+
+ typedef struct {
+ uint32 type;
+ nbt_server_type server_type;
+ GUID domain_uuid;
+ nbt_string forest;
+ nbt_string dns_domain;
+ nbt_string pdc_dns_name;
+ nbt_string domain;
+ nbt_string pdc_name;
+ nbt_string user_name;
+ nbt_string server_site;
+ nbt_string client_site;
+ uint8 unknown;
+ uint32 unknown2;
+ [flag(NDR_BIG_ENDIAN)]
+ ipv4address pdc_ip;
+ uint32 unknown3[2];
+ [value(13)] uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_cldap_netlogon_13;
+
+ typedef [flag(NDR_NOALIGN),public,nodiscriminant] union {
+ [case(0)] nbt_cldap_netlogon_1 logon1;
+ [case(1)] nbt_cldap_netlogon_1 logon1;
+ [case(2)] nbt_cldap_netlogon_3 logon3;
+ [case(3)] nbt_cldap_netlogon_3 logon3;
+ [case(4)] nbt_cldap_netlogon_5 logon5;
+ [case(5)] nbt_cldap_netlogon_5 logon5;
+ [case(6)] nbt_cldap_netlogon_5 logon5;
+ [case(7)] nbt_cldap_netlogon_5 logon5;
+ [default] nbt_cldap_netlogon_13 logon13;
+ } nbt_cldap_netlogon;
+
+ /*******************************************/
+ /* \MAILSLOT\NET\NTLOGON mailslot requests */
+ typedef enum {
+ NTLOGON_SAM_LOGON = 0x12,
+ NTLOGON_SAM_LOGON_REPLY = 0x13,
+ NTLOGON_SAM_LOGON_REPLY15 = 0x15
+ } nbt_ntlogon_command;
+
+ typedef struct {
+ uint16 request_count;
+ nstring computer_name;
+ nstring user_name;
+ astring mailslot_name;
+ uint32 acct_control;
+ [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+ [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
+ uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_ntlogon_sam_logon;
+
+ typedef struct {
+ nstring server;
+ nstring user_name;
+ nstring domain;
+ uint32 nt_version;
+ uint16 lmnt_token;
+ uint16 lm20_token;
+ } nbt_ntlogon_sam_logon_reply;
+
+ typedef [nodiscriminant] union {
+ [case(NTLOGON_SAM_LOGON)] nbt_ntlogon_sam_logon logon;
+ [case(NTLOGON_SAM_LOGON_REPLY)] nbt_ntlogon_sam_logon_reply reply;
+ [case(NTLOGON_SAM_LOGON_REPLY15)] nbt_ntlogon_sam_logon_reply reply;
+ [case(NETLOGON_RESPONSE_FROM_PDC2)] nbt_netlogon_response_from_pdc2 reply2;
+ } nbt_ntlogon_request;
+
+ typedef [flag(NDR_NOALIGN),public] struct {
+ nbt_ntlogon_command command;
+ [switch_is(command)] nbt_ntlogon_request req;
+ } nbt_ntlogon_packet;
+
+ /********************************************************/
+ /* \MAILSLOT\BROWSE mailslot requests */
+ /* for details see http://ubiqx.org/cifs/Browsing.html */
+ /********************************************************/
+ 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/source3/librpc/idl/security.idl b/source3/librpc/idl/security.idl
index c4c30e9b5a..c1dfe272e9 100644
--- a/source3/librpc/idl/security.idl
+++ b/source3/librpc/idl/security.idl
@@ -22,6 +22,9 @@ 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")
+
[
pointer_default(unique)
]
diff --git a/source3/librpc/ndr/libndr.h b/source3/librpc/ndr/libndr.h
index a277a626c7..35a5b136a7 100644
--- a/source3/librpc/ndr/libndr.h
+++ b/source3/librpc/ndr/libndr.h
@@ -337,4 +337,15 @@ struct ndr_interface_list {
const struct ndr_interface_table *table;
};
+#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_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);
+
+
#endif /* __LIBNDR_H__ */
diff --git a/source3/librpc/ndr/ndr_basic.c b/source3/librpc/ndr/ndr_basic.c
index f342c6e36f..c8fa70b185 100644
--- a/source3/librpc/ndr/ndr_basic.c
+++ b/source3/librpc/ndr/ndr_basic.c
@@ -196,7 +196,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, u
*/
_PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v)
{
- intptr_t h;
+ uintptr_t h;
NDR_PULL_ALIGN(ndr, sizeof(h));
NDR_PULL_NEED_BYTES(ndr, sizeof(h));
memcpy(&h, ndr->data+ndr->offset, sizeof(h));
@@ -393,7 +393,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, u
*/
_PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
{
- intptr_t h = (intptr_t)v;
+ uintptr_t h = (intptr_t)v;
NDR_PUSH_ALIGN(ndr, sizeof(h));
NDR_PUSH_NEED_BYTES(ndr, sizeof(h));
memcpy(ndr->data+ndr->offset, &h, sizeof(h));
diff --git a/source3/librpc/ndr/ndr_sec_helper.c b/source3/librpc/ndr/ndr_sec_helper.c
index f8bad6ca61..18d343799e 100644
--- a/source3/librpc/ndr/ndr_sec_helper.c
+++ b/source3/librpc/ndr/ndr_sec_helper.c
@@ -31,6 +31,26 @@ size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
return 8 + 4*sid->num_auths;
}
+size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
+{
+ struct dom_sid zero_sid;
+
+ if (!sid) return 0;
+
+ ZERO_STRUCT(zero_sid);
+
+ if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+ return 0;
+ }
+
+ return 8 + 4*sid->num_auths;
+}
+
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags)
+{
+ return ndr_size_dom_sid28(sid, flags);
+}
+
/*
return the wire size of a security_ace
*/
@@ -89,3 +109,9 @@ void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct d
{
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);
+}
+
diff --git a/source3/librpc/ndr/sid.c b/source3/librpc/ndr/sid.c
index b6ec045806..ed27375de1 100644
--- a/source3/librpc/ndr/sid.c
+++ b/source3/librpc/ndr/sid.c
@@ -187,3 +187,44 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
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)
+{
+ struct dom_sid zero_sid;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (!sid) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ ZERO_STRUCT(zero_sid);
+
+ if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_push_dom_sid(ndr, ndr_flags, sid);
+}
diff --git a/source3/librpc/rpc/binding.c b/source3/librpc/rpc/binding.c
new file mode 100644
index 0000000000..92f65b5827
--- /dev/null
+++ b/source3/librpc/rpc/binding.c
@@ -0,0 +1,708 @@
+/*
+ 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
+
+ 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"
+
+#define MAX_PROTSEQ 10
+
+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_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 {
+ const char *name;
+ uint32_t flag;
+} ncacn_options[] = {
+};
+
+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 */
+ char *uuidstr;
+
+ if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) {
+ return "NDR";
+ }
+
+ if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) {
+ return "NDR64";
+ }
+
+ uuidstr = GUID_string(mem_ctx, &syntax.uuid);
+
+ return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version);
+ } else { /* IPX */
+ return NULL;
+ }
+
+ 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_PIPE:
+ return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.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 = talloc_strdup(mem_ctx, "");
+ int i;
+ const char *t_name = NULL;
+
+ if (b->transport != NCA_UNKNOWN) {
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ if (transports[i].transport == b->transport) {
+ t_name = transports[i].name;
+ }
+ }
+ if (!t_name) {
+ return NULL;
+ }
+ }
+
+ if (!GUID_all_zero(&b->object.uuid)) {
+ s = talloc_asprintf(s, "%s@",
+ GUID_string(mem_ctx, &b->object.uuid));
+ }
+
+ if (t_name != NULL) {
+ s = talloc_asprintf_append_buffer(s, "%s:", t_name);
+ if (s == NULL) {
+ return NULL;
+ }
+ }
+
+ if (b->host) {
+ s = talloc_asprintf_append_buffer(s, "%s", b->host);
+ }
+
+ if (!b->endpoint && !b->options && !b->flags) {
+ return s;
+ }
+
+ s = talloc_asprintf_append_buffer(s, "[");
+
+ if (b->endpoint) {
+ s = talloc_asprintf_append_buffer(s, "%s", b->endpoint);
+ }
+
+ /* this is a *really* inefficent way of dealing with strings,
+ but this is rarely called and the strings are always short,
+ so I don't care */
+ for (i=0;b->options && b->options[i];i++) {
+ s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
+ if (!s) return NULL;
+ }
+
+ for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
+ if (b->flags & ncacn_options[i].flag) {
+ s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
+ if (!s) return NULL;
+ }
+ }
+
+ s = talloc_asprintf_append_buffer(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)
+{
+ struct dcerpc_binding *b;
+ char *options;
+ char *p;
+ int i, j, comma_count;
+
+ b = talloc(mem_ctx, struct dcerpc_binding);
+ if (!b) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ p = strchr(s, '@');
+
+ if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
+ NTSTATUS status;
+
+ status = GUID_from_string(s, &b->object.uuid);
+
+ if (NT_STATUS_IS_ERR(status)) {
+ DEBUG(0, ("Failed parsing UUID\n"));
+ return status;
+ }
+
+ s = p + 1;
+ } else {
+ ZERO_STRUCT(b->object);
+ }
+
+ b->object.if_version = 0;
+
+ p = strchr(s, ':');
+
+ if (p == NULL) {
+ b->transport = NCA_UNKNOWN;
+ } else {
+ char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s));
+ if (!type) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ if (strcmp(type, transports[i].name) == 0) {
+ b->transport = transports[i].transport;
+ break;
+ }
+ }
+
+ if (i==ARRAY_SIZE(transports)) {
+ DEBUG(0,("Unknown dcerpc transport '%s'\n", type));
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ talloc_free(type);
+
+ s = p+1;
+ }
+
+ p = strchr(s, '[');
+ if (p) {
+ b->host = talloc_strndup(b, s, PTR_DIFF(p, s));
+ options = talloc_strdup(mem_ctx, p+1);
+ if (options[strlen(options)-1] != ']') {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ options[strlen(options)-1] = 0;
+ } else {
+ b->host = talloc_strdup(b, s);
+ options = NULL;
+ }
+ if (!b->host) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ b->target_hostname = b->host;
+
+ b->options = NULL;
+ b->flags = 0;
+ b->assoc_group_id = 0;
+ b->endpoint = NULL;
+
+ if (!options) {
+ *b_out = b;
+ return NT_STATUS_OK;
+ }
+
+ comma_count = count_chars(options, ',');
+
+ b->options = talloc_array(b, const char *, comma_count+2);
+ if (!b->options) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i=0; (p = strchr(options, ',')); i++) {
+ b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options));
+ if (!b->options[i]) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ options = p+1;
+ }
+ b->options[i] = options;
+ b->options[i+1] = NULL;
+
+ /* some options are pre-parsed for convenience */
+ for (i=0;b->options[i];i++) {
+ for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
+ if (strcmp(ncacn_options[j].name, b->options[i]) == 0) {
+ int k;
+ b->flags |= ncacn_options[j].flag;
+ for (k=i;b->options[k];k++) {
+ b->options[k] = b->options[k+1];
+ }
+ i--;
+ break;
+ }
+ }
+ }
+
+ if (b->options[0]) {
+ /* Endpoint is first option */
+ b->endpoint = b->options[0];
+ if (strlen(b->endpoint) == 0) b->endpoint = NULL;
+
+ for (i=0;b->options[i];i++) {
+ b->options[i] = b->options[i+1];
+ }
+ }
+
+ if (b->options[0] == NULL)
+ b->options = NULL;
+
+ *b_out = b;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax)
+{
+ TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
+ struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
+ enum ndr_err_code ndr_err;
+ uint16_t if_version=0;
+
+ 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)
+{
+ struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
+
+ ndr->flags |= LIBNDR_FLAG_NOALIGN;
+
+ ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
+ ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
+
+ return ndr_push_blob(ndr);
+}
+
+const 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_PIPE:
+ if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL;
+ return talloc_strdup(mem_ctx, epm_floor->rhs.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)
+{
+ 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:
+ 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_PIPE:
+ epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data);
+ NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.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)
+{
+ int 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(struct epm_tower *tower)
+{
+ int 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++) {
+ 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_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
+ struct epm_tower *tower,
+ struct dcerpc_binding **b_out)
+{
+ NTSTATUS status;
+ struct dcerpc_binding *binding;
+
+ binding = talloc(mem_ctx, struct dcerpc_binding);
+ NT_STATUS_HAVE_NO_MEMORY(binding);
+
+ ZERO_STRUCT(binding->object);
+ binding->options = NULL;
+ binding->host = NULL;
+ binding->target_hostname = NULL;
+ binding->flags = 0;
+ binding->assoc_group_id = 0;
+
+ binding->transport = dcerpc_transport_by_tower(tower);
+
+ if (binding->transport == (unsigned int)-1) {
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+
+ if (tower->num_floors < 1) {
+ return NT_STATUS_OK;
+ }
+
+ /* Set object uuid */
+ status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));
+ return status;
+ }
+
+ /* Ignore floor 1, it contains the NDR version info */
+
+ binding->options = NULL;
+
+ /* Set endpoint */
+ if (tower->num_floors >= 4) {
+ binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]);
+ } else {
+ binding->endpoint = NULL;
+ }
+
+ /* Set network address */
+ if (tower->num_floors >= 5) {
+ binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]);
+ NT_STATUS_HAVE_NO_MEMORY(binding->host);
+ binding->target_hostname = binding->host;
+ }
+ *b_out = binding;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower)
+{
+ const enum epm_protocol *protseq = NULL;
+ int num_protocols = -1, i;
+ 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 (num_protocols == -1) {
+ 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);
+
+ /* Floor 0 */
+ tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
+
+ tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
+
+ tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
+
+ /* Floor 1 */
+ tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
+
+ tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
+ &ndr_transfer_syntax);
+
+ tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 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_talloc(mem_ctx, NULL, 0);
+ ZERO_STRUCT(tower->floors[2 + i].rhs);
+ dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], "");
+ }
+
+ /* The 4th floor contains the endpoint */
+ if (num_protocols >= 2 && binding->endpoint) {
+ status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint);
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
+ }
+ }
+
+ /* The 5th contains the network address */
+ if (num_protocols >= 3 && binding->host) {
+ if (is_ipaddress(binding->host)) {
+ status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
+ binding->host);
+ } else {
+ /* note that we don't attempt to resolve the
+ name here - when we get a hostname here we
+ are in the client code, and want to put in
+ a wildcard all-zeros IP for the server to
+ fill in */
+ status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
+ "0.0.0.0");
+ }
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
diff --git a/source3/librpc/rpc/dcerpc.c b/source3/librpc/rpc/dcerpc.c
new file mode 100644
index 0000000000..c8bca8d3eb
--- /dev/null
+++ b/source3/librpc/rpc/dcerpc.c
@@ -0,0 +1,187 @@
+/*
+ Unix SMB/CIFS implementation.
+ Samba 4-compatible DCE/RPC API on top of the Samba 3 DCE/RPC client library.
+ Copyright (C) Jelmer Vernooij <jelmer@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/>.
+*/
+
+#include "includes.h"
+#include "librpc/rpc/dcerpc.h"
+
+/**
+ * Send a struct-based RPC request using the Samba 3 RPC client library.
+ */
+struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, const struct GUID *object,
+ const struct ndr_interface_table *table, uint32_t opnum,
+ TALLOC_CTX *mem_ctx, void *r)
+{
+ const struct ndr_interface_call *call;
+ struct ndr_push *push;
+ struct rpc_request *ret = talloc(mem_ctx, struct rpc_request);
+ enum ndr_err_code ndr_err;
+ DATA_BLOB blob;
+
+ if (ret == NULL)
+ return NULL;
+
+ SMB_ASSERT(p->table->num_calls > opnum);
+
+ call = &p->table->calls[opnum];
+
+ ret->call = call;
+ ret->r = r;
+
+ push = ndr_push_init_ctx(mem_ctx);
+ if (!push) {
+ return NULL;
+ }
+
+ ndr_err = call->ndr_push(push, NDR_IN, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ /* FIXME: ndr_map_error2ntstatus(ndr_err); */
+ return NULL;
+ }
+
+ blob = ndr_push_blob(push);
+
+ if (!prs_init_data_blob(&ret->q_ps, &blob, mem_ctx)) {
+ return NULL;
+ }
+
+ talloc_free(push);
+
+ ret->opnum = opnum;
+
+ ret->pipe = p;
+
+ return ret;
+}
+
+/**
+ * Wait for a DCE/RPC request.
+ *
+ * @note at the moment this is still sync, even though the API is async.
+ */
+NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req)
+{
+ prs_struct r_ps;
+ struct ndr_pull *pull;
+ NTSTATUS status;
+ DATA_BLOB blob;
+ enum ndr_err_code ndr_err;
+
+ prs_init_empty( &r_ps, req, UNMARSHALL );
+
+ status = rpc_api_pipe_req(req->pipe->rpc_cli, req->opnum, &req->q_ps, &r_ps);
+
+ prs_mem_free( &req->q_ps );
+
+ if (!NT_STATUS_IS_OK(status)) {
+ prs_mem_free( &r_ps );
+ return status;
+ }
+
+ if (!prs_data_blob(&r_ps, &blob, req)) {
+ prs_mem_free( &r_ps );
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ prs_mem_free( &r_ps );
+
+ pull = ndr_pull_init_blob(&blob, req);
+ if (pull == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /* have the ndr parser alloc memory for us */
+ pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+ ndr_err = req->call->ndr_pull(pull, NDR_OUT, req->r);
+ talloc_free(pull);
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ return NT_STATUS_OK;
+}
+
+/**
+ * Connect to a DCE/RPC interface.
+ *
+ * @note lp_ctx and ev are ignored at the moment but present
+ * for API compatibility.
+ */
+_PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe **pp,
+ const char *binding_string, const struct ndr_interface_table *table,
+ struct cli_credentials *credentials, struct event_context *ev,
+ struct loadparm_context *lp_ctx)
+{
+ struct dcerpc_pipe *p = talloc(parent_ctx, struct dcerpc_pipe);
+ struct dcerpc_binding *binding;
+ NTSTATUS nt_status;
+ int idx;
+
+ nt_status = dcerpc_parse_binding(p, binding_string, &binding);
+
+ if (NT_STATUS_IS_ERR(nt_status)) {
+ DEBUG(1, ("Unable to parse binding string '%s'", binding_string));
+ talloc_free(p);
+ return nt_status;
+ }
+
+ if (binding->transport != NCACN_NP) {
+ DEBUG(0, ("Only ncacn_np supported"));
+ talloc_free(p);
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+
+ /* FIXME: Actually use loadparm_context.. */
+
+ /* FIXME: actually use credentials */
+
+ nt_status = cli_full_connection(&p->cli, global_myname(), binding->host,
+ NULL, 0,
+ "IPC$", "IPC",
+ get_cmdline_auth_info_username(),
+ lp_workgroup(),
+ get_cmdline_auth_info_password(),
+ get_cmdline_auth_info_use_kerberos() ? CLI_FULL_CONNECTION_USE_KERBEROS : 0,
+ get_cmdline_auth_info_signing_state(), NULL);
+
+ if (NT_STATUS_IS_ERR(nt_status)) {
+ talloc_free(p);
+ return nt_status;
+ }
+
+ idx = cli_get_pipe_idx(&table->syntax_id);
+ if (idx < 0) {
+ DEBUG(0, ("Unable to find interface index"));
+ talloc_free(p);
+ return NT_STATUS_OBJECT_PATH_INVALID;
+ }
+
+ p->rpc_cli = cli_rpc_pipe_open_noauth(p->cli, idx, &nt_status);
+
+ if (p->rpc_cli == NULL) {
+ talloc_free(p);
+ return nt_status;
+ }
+
+ p->table = table;
+
+ *pp = p;
+
+ return nt_status;
+}
diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
new file mode 100644
index 0000000000..739e60a341
--- /dev/null
+++ b/source3/librpc/rpc/dcerpc.h
@@ -0,0 +1,75 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ DCERPC client side interface structures
+
+ Copyright (C) 2008 Jelmer Vernooij
+
+ 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 __DCERPC_H__
+#define __DCERPC_H__
+
+#include "includes.h"
+#include "librpc/rpc/dcerpc.h"
+#include "librpc/gen_ndr/epmapper.h"
+
+struct loadparm_context;
+struct cli_credentials;
+
+/**
+ * Connection to a particular DCE/RPC interface.
+ */
+struct dcerpc_pipe {
+ const struct ndr_interface_table *table;
+
+ /** SMB context used when transport is ncacn_np. */
+ struct cli_state *cli;
+
+ /** Samba 3 DCE/RPC client context. */
+ struct rpc_pipe_client *rpc_cli;
+};
+
+struct rpc_request {
+ const struct ndr_interface_call *call;
+ prs_struct q_ps;
+ uint32_t opnum;
+ struct dcerpc_pipe *pipe;
+ void *r;
+};
+
+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 };
+
+
+/** this describes a binding to a particular transport/pipe */
+struct dcerpc_binding {
+ enum dcerpc_transport_t transport;
+ struct ndr_syntax_id object;
+ const char *host;
+ const char *target_hostname;
+ const char *endpoint;
+ const char **options;
+ uint32_t flags;
+ uint32_t assoc_group_id;
+};
+
+#endif /* __DCERPC_H__ */
diff --git a/source3/librpc/rpc/dcerpc_util.c b/source3/librpc/rpc/dcerpc_util.c
new file mode 100644
index 0000000000..3b8768ccc2
--- /dev/null
+++ b/source3/librpc/rpc/dcerpc_util.c
@@ -0,0 +1,1438 @@
+/*
+ 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
+
+ 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/events/events.h"
+#include "libcli/composite/composite.h"
+#include "librpc/gen_ndr/ndr_epmapper_c.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/rpc/dcerpc_proto.h"
+#include "auth/credentials/credentials.h"
+#include "param/param.h"
+
+/*
+ find a dcerpc call on an interface by name
+*/
+const struct ndr_interface_call *dcerpc_iface_find_call(const struct ndr_interface_table *iface,
+ const char *name)
+{
+ int i;
+ for (i=0;i<iface->num_calls;i++) {
+ if (strcmp(iface->calls[i].name, name) == 0) {
+ return &iface->calls[i];
+ }
+ }
+ return NULL;
+}
+
+/*
+ push a ncacn_packet into a blob, potentially with auth info
+*/
+NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
+ 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, iconv_convenience);
+ if (!ndr) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if (!(pkt->drep[0] & DCERPC_DREP_LE)) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+
+ if (pkt->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
+ }
+
+ 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) {
+ 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;
+}
+
+#define MAX_PROTSEQ 10
+
+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_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 {
+ 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},
+ {"validate", DCERPC_DEBUG_VALIDATE_BOTH},
+ {"print", DCERPC_DEBUG_PRINT_BOTH},
+ {"padcheck", DCERPC_DEBUG_PAD_CHECK},
+ {"bigendian", DCERPC_PUSH_BIGENDIAN},
+ {"smb2", DCERPC_SMB2}
+};
+
+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 */
+ char *uuidstr;
+
+ if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) {
+ return "NDR";
+ }
+
+ if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) {
+ return "NDR64";
+ }
+
+ uuidstr = GUID_string(mem_ctx, &syntax.uuid);
+
+ return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version);
+ } else { /* IPX */
+ return talloc_asprintf(mem_ctx, "IPX:%s",
+ data_blob_hex_string(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_PIPE:
+ return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.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 = talloc_strdup(mem_ctx, "");
+ int i;
+ const char *t_name = NULL;
+
+ if (b->transport != NCA_UNKNOWN) {
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ if (transports[i].transport == b->transport) {
+ t_name = transports[i].name;
+ }
+ }
+ if (!t_name) {
+ return NULL;
+ }
+ }
+
+ if (!GUID_all_zero(&b->object.uuid)) {
+ s = talloc_asprintf(s, "%s@",
+ GUID_string(mem_ctx, &b->object.uuid));
+ }
+
+ if (t_name != NULL) {
+ s = talloc_asprintf_append_buffer(s, "%s:", t_name);
+ if (s == NULL) {
+ return NULL;
+ }
+ }
+
+ if (b->host) {
+ s = talloc_asprintf_append_buffer(s, "%s", b->host);
+ }
+
+ if (!b->endpoint && !b->options && !b->flags) {
+ return s;
+ }
+
+ s = talloc_asprintf_append_buffer(s, "[");
+
+ if (b->endpoint) {
+ s = talloc_asprintf_append_buffer(s, "%s", b->endpoint);
+ }
+
+ /* this is a *really* inefficent way of dealing with strings,
+ but this is rarely called and the strings are always short,
+ so I don't care */
+ for (i=0;b->options && b->options[i];i++) {
+ s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
+ if (!s) return NULL;
+ }
+
+ for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
+ if (b->flags & ncacn_options[i].flag) {
+ s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
+ if (!s) return NULL;
+ }
+ }
+
+ s = talloc_asprintf_append_buffer(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)
+{
+ struct dcerpc_binding *b;
+ char *options;
+ char *p;
+ int i, j, comma_count;
+
+ b = talloc(mem_ctx, struct dcerpc_binding);
+ if (!b) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ p = strchr(s, '@');
+
+ if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
+ NTSTATUS status;
+
+ status = GUID_from_string(s, &b->object.uuid);
+
+ if (NT_STATUS_IS_ERR(status)) {
+ DEBUG(0, ("Failed parsing UUID\n"));
+ return status;
+ }
+
+ s = p + 1;
+ } else {
+ ZERO_STRUCT(b->object);
+ }
+
+ b->object.if_version = 0;
+
+ p = strchr(s, ':');
+
+ if (p == NULL) {
+ b->transport = NCA_UNKNOWN;
+ } else {
+ char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s));
+ if (!type) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ if (strcasecmp(type, transports[i].name) == 0) {
+ b->transport = transports[i].transport;
+ break;
+ }
+ }
+
+ if (i==ARRAY_SIZE(transports)) {
+ DEBUG(0,("Unknown dcerpc transport '%s'\n", type));
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ talloc_free(type);
+
+ s = p+1;
+ }
+
+ p = strchr(s, '[');
+ if (p) {
+ b->host = talloc_strndup(b, s, PTR_DIFF(p, s));
+ options = talloc_strdup(mem_ctx, p+1);
+ if (options[strlen(options)-1] != ']') {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ options[strlen(options)-1] = 0;
+ } else {
+ b->host = talloc_strdup(b, s);
+ options = NULL;
+ }
+ if (!b->host) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ b->target_hostname = b->host;
+
+ b->options = NULL;
+ b->flags = 0;
+ b->assoc_group_id = 0;
+ b->endpoint = NULL;
+
+ if (!options) {
+ *b_out = b;
+ return NT_STATUS_OK;
+ }
+
+ comma_count = count_chars(options, ',');
+
+ b->options = talloc_array(b, const char *, comma_count+2);
+ if (!b->options) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (i=0; (p = strchr(options, ',')); i++) {
+ b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options));
+ if (!b->options[i]) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ options = p+1;
+ }
+ b->options[i] = options;
+ b->options[i+1] = NULL;
+
+ /* some options are pre-parsed for convenience */
+ for (i=0;b->options[i];i++) {
+ for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
+ if (strcasecmp(ncacn_options[j].name, b->options[i]) == 0) {
+ int k;
+ b->flags |= ncacn_options[j].flag;
+ for (k=i;b->options[k];k++) {
+ b->options[k] = b->options[k+1];
+ }
+ i--;
+ break;
+ }
+ }
+ }
+
+ if (b->options[0]) {
+ /* Endpoint is first option */
+ b->endpoint = b->options[0];
+ if (strlen(b->endpoint) == 0) b->endpoint = NULL;
+
+ for (i=0;b->options[i];i++) {
+ b->options[i] = b->options[i+1];
+ }
+ }
+
+ if (b->options[0] == NULL)
+ b->options = NULL;
+
+ *b_out = b;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax)
+{
+ TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
+ struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL);
+ enum ndr_err_code ndr_err;
+ uint16_t if_version=0;
+
+ 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)
+{
+ struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL);
+
+ ndr->flags |= LIBNDR_FLAG_NOALIGN;
+
+ ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
+ ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
+
+ return ndr_push_blob(ndr);
+}
+
+const 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_PIPE:
+ if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL;
+ return talloc_strdup(mem_ctx, epm_floor->rhs.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)
+{
+ 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:
+ 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_PIPE:
+ epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data);
+ NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.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)
+{
+ int 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(struct epm_tower *tower)
+{
+ int 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++) {
+ 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_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
+ struct epm_tower *tower,
+ struct dcerpc_binding **b_out)
+{
+ NTSTATUS status;
+ struct dcerpc_binding *binding;
+
+ binding = talloc(mem_ctx, struct dcerpc_binding);
+ NT_STATUS_HAVE_NO_MEMORY(binding);
+
+ ZERO_STRUCT(binding->object);
+ binding->options = NULL;
+ binding->host = NULL;
+ binding->target_hostname = NULL;
+ binding->flags = 0;
+ binding->assoc_group_id = 0;
+
+ binding->transport = dcerpc_transport_by_tower(tower);
+
+ if (binding->transport == (unsigned int)-1) {
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+
+ if (tower->num_floors < 1) {
+ return NT_STATUS_OK;
+ }
+
+ /* Set object uuid */
+ status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));
+ return status;
+ }
+
+ /* Ignore floor 1, it contains the NDR version info */
+
+ binding->options = NULL;
+
+ /* Set endpoint */
+ if (tower->num_floors >= 4) {
+ binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]);
+ } else {
+ binding->endpoint = NULL;
+ }
+
+ /* Set network address */
+ if (tower->num_floors >= 5) {
+ binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]);
+ NT_STATUS_HAVE_NO_MEMORY(binding->host);
+ binding->target_hostname = binding->host;
+ }
+ *b_out = binding;
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower)
+{
+ const enum epm_protocol *protseq = NULL;
+ int num_protocols = -1, i;
+ 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 (num_protocols == -1) {
+ 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);
+
+ /* Floor 0 */
+ tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
+
+ tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
+
+ tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
+
+ /* Floor 1 */
+ tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
+
+ tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
+ &ndr_transfer_syntax);
+
+ tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 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_talloc(mem_ctx, NULL, 0);
+ ZERO_STRUCT(tower->floors[2 + i].rhs);
+ dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], "");
+ }
+
+ /* The 4th floor contains the endpoint */
+ if (num_protocols >= 2 && binding->endpoint) {
+ status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint);
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
+ }
+ }
+
+ /* The 5th contains the network address */
+ if (num_protocols >= 3 && binding->host) {
+ if (is_ipaddress(binding->host)) {
+ status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
+ binding->host);
+ } else {
+ /* note that we don't attempt to resolve the
+ name here - when we get a hostname here we
+ are in the client code, and want to put in
+ a wildcard all-zeros IP for the server to
+ fill in */
+ status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
+ "0.0.0.0");
+ }
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+
+struct epm_map_binding_state {
+ struct dcerpc_binding *binding;
+ const struct ndr_interface_table *table;
+ struct dcerpc_pipe *pipe;
+ struct policy_handle handle;
+ struct GUID guid;
+ struct epm_twr_t twr;
+ struct epm_twr_t *twr_r;
+ struct epm_Map r;
+};
+
+
+static void continue_epm_recv_binding(struct composite_context *ctx);
+static void continue_epm_map(struct rpc_request *req);
+
+
+/*
+ Stage 2 of epm_map_binding: Receive connected rpc pipe and send endpoint
+ mapping rpc request
+*/
+static void continue_epm_recv_binding(struct composite_context *ctx)
+{
+ struct rpc_request *map_req;
+
+ struct composite_context *c = talloc_get_type(ctx->async.private_data,
+ struct composite_context);
+ struct epm_map_binding_state *s = talloc_get_type(c->private_data,
+ struct epm_map_binding_state);
+
+ /* receive result of rpc pipe connect request */
+ c->status = dcerpc_pipe_connect_b_recv(ctx, c, &s->pipe);
+ if (!composite_is_ok(c)) return;
+
+ s->pipe->conn->flags |= DCERPC_NDR_REF_ALLOC;
+
+ /* prepare requested binding parameters */
+ s->binding->object = s->table->syntax_id;
+
+ c->status = dcerpc_binding_build_tower(s->pipe, s->binding, &s->twr.tower);
+ if (!composite_is_ok(c)) return;
+
+ /* with some nice pretty paper around it of course */
+ s->r.in.object = &s->guid;
+ s->r.in.map_tower = &s->twr;
+ s->r.in.entry_handle = &s->handle;
+ s->r.in.max_towers = 1;
+ s->r.out.entry_handle = &s->handle;
+
+ /* send request for an endpoint mapping - a rpc request on connected pipe */
+ map_req = dcerpc_epm_Map_send(s->pipe, c, &s->r);
+ if (composite_nomem(map_req, c)) return;
+
+ composite_continue_rpc(c, map_req, continue_epm_map, c);
+}
+
+
+/*
+ Stage 3 of epm_map_binding: Receive endpoint mapping and provide binding details
+*/
+static void continue_epm_map(struct rpc_request *req)
+{
+ struct composite_context *c = talloc_get_type(req->async.private_data,
+ struct composite_context);
+ struct epm_map_binding_state *s = talloc_get_type(c->private_data,
+ struct epm_map_binding_state);
+
+ /* receive result of a rpc request */
+ c->status = dcerpc_ndr_request_recv(req);
+ if (!composite_is_ok(c)) return;
+
+ /* check the details */
+ if (s->r.out.result != 0 || *s->r.out.num_towers != 1) {
+ composite_error(c, NT_STATUS_PORT_UNREACHABLE);
+ return;
+ }
+
+ s->twr_r = s->r.out.towers[0].twr;
+ if (s->twr_r == NULL) {
+ composite_error(c, NT_STATUS_PORT_UNREACHABLE);
+ return;
+ }
+
+ if (s->twr_r->tower.num_floors != s->twr.tower.num_floors ||
+ s->twr_r->tower.floors[3].lhs.protocol != s->twr.tower.floors[3].lhs.protocol) {
+ composite_error(c, NT_STATUS_PORT_UNREACHABLE);
+ return;
+ }
+
+ /* get received endpoint */
+ s->binding->endpoint = talloc_reference(s->binding,
+ dcerpc_floor_get_rhs_data(c, &s->twr_r->tower.floors[3]));
+ if (composite_nomem(s->binding->endpoint, c)) return;
+
+ composite_done(c);
+}
+
+
+/*
+ Request for endpoint mapping of dcerpc binding - try to request for endpoint
+ unless there is default one.
+*/
+struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
+ struct dcerpc_binding *binding,
+ const struct ndr_interface_table *table,
+ struct event_context *ev,
+ struct loadparm_context *lp_ctx)
+{
+ struct composite_context *c;
+ struct epm_map_binding_state *s;
+ struct composite_context *pipe_connect_req;
+ struct cli_credentials *anon_creds;
+ struct event_context *new_ev = NULL;
+
+ NTSTATUS status;
+ struct dcerpc_binding *epmapper_binding;
+ int i;
+
+ /* Try to find event context in memory context in case passed
+ * event_context (argument) was NULL. If there's none, just
+ * create a new one.
+ */
+ if (ev == NULL) {
+ ev = event_context_find(mem_ctx);
+ if (ev == NULL) {
+ new_ev = event_context_init(mem_ctx);
+ if (new_ev == NULL) return NULL;
+ ev = new_ev;
+ }
+ }
+
+ /* composite context allocation and setup */
+ c = composite_create(mem_ctx, ev);
+ if (c == NULL) {
+ talloc_free(new_ev);
+ return NULL;
+ }
+ talloc_steal(c, new_ev);
+
+ s = talloc_zero(c, struct epm_map_binding_state);
+ if (composite_nomem(s, c)) return c;
+ c->private_data = s;
+
+ s->binding = binding;
+ s->table = table;
+
+ /* anonymous credentials for rpc connection used to get endpoint mapping */
+ anon_creds = cli_credentials_init(mem_ctx);
+ cli_credentials_set_event_context(anon_creds, ev);
+ cli_credentials_set_anonymous(anon_creds);
+
+ /*
+ First, check if there is a default endpoint specified in the IDL
+ */
+ if (table != NULL) {
+ struct dcerpc_binding *default_binding;
+
+ /* Find one of the default pipes for this interface */
+ for (i = 0; i < table->endpoints->count; i++) {
+ status = dcerpc_parse_binding(mem_ctx, table->endpoints->names[i], &default_binding);
+
+ if (NT_STATUS_IS_OK(status)) {
+ if (binding->transport == NCA_UNKNOWN)
+ binding->transport = default_binding->transport;
+ if (default_binding->transport == binding->transport &&
+ default_binding->endpoint) {
+ binding->endpoint = talloc_reference(binding, default_binding->endpoint);
+ talloc_free(default_binding);
+
+ composite_done(c);
+ return c;
+
+ } else {
+ talloc_free(default_binding);
+ }
+ }
+ }
+ }
+
+ epmapper_binding = talloc_zero(c, struct dcerpc_binding);
+ if (composite_nomem(epmapper_binding, c)) return c;
+
+ /* basic endpoint mapping data */
+ epmapper_binding->transport = binding->transport;
+ epmapper_binding->host = talloc_reference(epmapper_binding, binding->host);
+ epmapper_binding->target_hostname = epmapper_binding->host;
+ epmapper_binding->options = NULL;
+ epmapper_binding->flags = 0;
+ epmapper_binding->assoc_group_id = 0;
+ epmapper_binding->endpoint = NULL;
+
+ /* initiate rpc pipe connection */
+ pipe_connect_req = dcerpc_pipe_connect_b_send(c, epmapper_binding,
+ &ndr_table_epmapper,
+ anon_creds, c->event_ctx,
+ lp_ctx);
+ if (composite_nomem(pipe_connect_req, c)) return c;
+
+ composite_continue(c, pipe_connect_req, continue_epm_recv_binding, c);
+ return c;
+}
+
+
+/*
+ Receive result of endpoint mapping request
+ */
+NTSTATUS dcerpc_epm_map_binding_recv(struct composite_context *c)
+{
+ NTSTATUS status = composite_wait(c);
+
+ talloc_free(c);
+ return status;
+}
+
+
+/*
+ Get endpoint mapping for rpc connection
+*/
+_PUBLIC_ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding,
+ const struct ndr_interface_table *table, struct event_context *ev,
+ struct loadparm_context *lp_ctx)
+{
+ struct composite_context *c;
+
+ c = dcerpc_epm_map_binding_send(mem_ctx, binding, table, ev, lp_ctx);
+ return dcerpc_epm_map_binding_recv(c);
+}
+
+
+struct pipe_auth_state {
+ struct dcerpc_pipe *pipe;
+ struct dcerpc_binding *binding;
+ const struct ndr_interface_table *table;
+ struct loadparm_context *lp_ctx;
+ struct cli_credentials *credentials;
+};
+
+
+static void continue_auth_schannel(struct composite_context *ctx);
+static void continue_auth(struct composite_context *ctx);
+static void continue_auth_none(struct composite_context *ctx);
+static void continue_ntlmssp_connection(struct composite_context *ctx);
+static void continue_spnego_after_wrong_pass(struct composite_context *ctx);
+
+
+/*
+ Stage 2 of pipe_auth: Receive result of schannel bind request
+*/
+static void continue_auth_schannel(struct composite_context *ctx)
+{
+ struct composite_context *c = talloc_get_type(ctx->async.private_data,
+ struct composite_context);
+
+ c->status = dcerpc_bind_auth_schannel_recv(ctx);
+ if (!composite_is_ok(c)) return;
+
+ composite_done(c);
+}
+
+
+/*
+ Stage 2 of pipe_auth: Receive result of authenticated bind request
+*/
+static void continue_auth(struct composite_context *ctx)
+{
+ struct composite_context *c = talloc_get_type(ctx->async.private_data,
+ struct composite_context);
+
+ c->status = dcerpc_bind_auth_recv(ctx);
+ if (!composite_is_ok(c)) return;
+
+ composite_done(c);
+}
+/*
+ Stage 2 of pipe_auth: Receive result of authenticated bind request, but handle fallbacks:
+ SPNEGO -> NTLMSSP
+*/
+static void continue_auth_auto(struct composite_context *ctx)
+{
+ struct composite_context *c = talloc_get_type(ctx->async.private_data,
+ struct composite_context);
+ struct pipe_auth_state *s = talloc_get_type(c->private_data, struct pipe_auth_state);
+ struct composite_context *sec_conn_req;
+
+ c->status = dcerpc_bind_auth_recv(ctx);
+ if (NT_STATUS_EQUAL(c->status, NT_STATUS_INVALID_PARAMETER)) {
+ /*
+ * Retry with NTLMSSP auth as fallback
+ * send a request for secondary rpc connection
+ */
+ sec_conn_req = dcerpc_secondary_connection_send(s->pipe,
+ s->binding);
+ composite_continue(c, sec_conn_req, continue_ntlmssp_connection, c);
+ return;
+ } else if (NT_STATUS_EQUAL(c->status, NT_STATUS_LOGON_FAILURE)) {
+ if (cli_credentials_wrong_password(s->credentials)) {
+ /*
+ * Retry SPNEGO with a better password
+ * send a request for secondary rpc connection
+ */
+ sec_conn_req = dcerpc_secondary_connection_send(s->pipe,
+ s->binding);
+ composite_continue(c, sec_conn_req, continue_spnego_after_wrong_pass, c);
+ return;
+ }
+ }
+
+ if (!composite_is_ok(c)) return;
+
+ composite_done(c);
+}
+
+/*
+ Stage 3 of pipe_auth (fallback to NTLMSSP case): Receive secondary
+ rpc connection (the first one can't be used any more, due to the
+ bind nak) and perform authenticated bind request
+*/
+static void continue_ntlmssp_connection(struct composite_context *ctx)
+{
+ struct composite_context *c;
+ struct pipe_auth_state *s;
+ struct composite_context *auth_req;
+ struct dcerpc_pipe *p2;
+
+ c = talloc_get_type(ctx->async.private_data, struct composite_context);
+ s = talloc_get_type(c->private_data, struct pipe_auth_state);
+
+ /* receive secondary rpc connection */
+ c->status = dcerpc_secondary_connection_recv(ctx, &p2);
+ if (!composite_is_ok(c)) return;
+
+ talloc_steal(s, p2);
+ talloc_steal(p2, s->pipe);
+ s->pipe = p2;
+
+ /* initiate a authenticated bind */
+ auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
+ s->credentials, s->lp_ctx,
+ DCERPC_AUTH_TYPE_NTLMSSP,
+ dcerpc_auth_level(s->pipe->conn),
+ s->table->authservices->names[0]);
+ composite_continue(c, auth_req, continue_auth, c);
+}
+
+/*
+ Stage 3 of pipe_auth (retry on wrong password): Receive secondary
+ rpc connection (the first one can't be used any more, due to the
+ bind nak) and perform authenticated bind request
+*/
+static void continue_spnego_after_wrong_pass(struct composite_context *ctx)
+{
+ struct composite_context *c;
+ struct pipe_auth_state *s;
+ struct composite_context *auth_req;
+ struct dcerpc_pipe *p2;
+
+ c = talloc_get_type(ctx->async.private_data, struct composite_context);
+ s = talloc_get_type(c->private_data, struct pipe_auth_state);
+
+ /* receive secondary rpc connection */
+ c->status = dcerpc_secondary_connection_recv(ctx, &p2);
+ if (!composite_is_ok(c)) return;
+
+ talloc_steal(s, p2);
+ talloc_steal(p2, s->pipe);
+ s->pipe = p2;
+
+ /* initiate a authenticated bind */
+ auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
+ s->credentials, s->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO,
+ dcerpc_auth_level(s->pipe->conn),
+ s->table->authservices->names[0]);
+ composite_continue(c, auth_req, continue_auth, c);
+}
+
+
+/*
+ Stage 2 of pipe_auth: Receive result of non-authenticated bind request
+*/
+static void continue_auth_none(struct composite_context *ctx)
+{
+ struct composite_context *c = talloc_get_type(ctx->async.private_data,
+ struct composite_context);
+
+ c->status = dcerpc_bind_auth_none_recv(ctx);
+ if (!composite_is_ok(c)) return;
+
+ composite_done(c);
+}
+
+
+/*
+ Request to perform an authenticated bind if required. Authentication
+ is determined using credentials passed and binding flags.
+*/
+struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p,
+ struct dcerpc_binding *binding,
+ const struct ndr_interface_table *table,
+ struct cli_credentials *credentials,
+ struct loadparm_context *lp_ctx)
+{
+ struct composite_context *c;
+ struct pipe_auth_state *s;
+ struct composite_context *auth_schannel_req;
+ struct composite_context *auth_req;
+ struct composite_context *auth_none_req;
+ struct dcerpc_connection *conn;
+ uint8_t auth_type;
+
+ /* composite context allocation and setup */
+ c = composite_create(p, p->conn->event_ctx);
+ if (c == NULL) return NULL;
+
+ s = talloc_zero(c, struct pipe_auth_state);
+ if (composite_nomem(s, c)) return c;
+ c->private_data = s;
+
+ /* store parameters in state structure */
+ s->binding = binding;
+ s->table = table;
+ s->credentials = credentials;
+ s->pipe = p;
+ s->lp_ctx = lp_ctx;
+
+ conn = s->pipe->conn;
+ conn->flags = binding->flags;
+
+ /* remember the binding string for possible secondary connections */
+ conn->binding_string = dcerpc_binding_string(p, binding);
+
+ if (cli_credentials_is_anonymous(s->credentials)) {
+ auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe, s->table);
+ composite_continue(c, auth_none_req, continue_auth_none, c);
+ return c;
+ }
+
+ if ((binding->flags & DCERPC_SCHANNEL) &&
+ !cli_credentials_get_netlogon_creds(s->credentials)) {
+ /* If we don't already have netlogon credentials for
+ * the schannel bind, then we have to get these
+ * first */
+ auth_schannel_req = dcerpc_bind_auth_schannel_send(c, s->pipe, s->table,
+ s->credentials, s->lp_ctx,
+ dcerpc_auth_level(conn));
+ composite_continue(c, auth_schannel_req, continue_auth_schannel, c);
+ return c;
+ }
+
+ /*
+ * we rely on the already authenticated CIFS connection
+ * if not doing sign or seal
+ */
+ if (conn->transport.transport == NCACN_NP &&
+ !(s->binding->flags & (DCERPC_SIGN|DCERPC_SEAL))) {
+ auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe, s->table);
+ composite_continue(c, auth_none_req, continue_auth_none, c);
+ return c;
+ }
+
+
+ /* Perform an authenticated DCE-RPC bind
+ */
+ if (!(conn->flags & (DCERPC_SIGN|DCERPC_SEAL))) {
+ /*
+ we are doing an authenticated connection,
+ but not using sign or seal. We must force
+ the CONNECT dcerpc auth type as a NONE auth
+ type doesn't allow authentication
+ information to be passed.
+ */
+ conn->flags |= DCERPC_CONNECT;
+ }
+
+ if (s->binding->flags & DCERPC_AUTH_SPNEGO) {
+ auth_type = DCERPC_AUTH_TYPE_SPNEGO;
+
+ } else if (s->binding->flags & DCERPC_AUTH_KRB5) {
+ auth_type = DCERPC_AUTH_TYPE_KRB5;
+
+ } else if (s->binding->flags & DCERPC_SCHANNEL) {
+ auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
+
+ } else if (s->binding->flags & DCERPC_AUTH_NTLM) {
+ auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
+
+ } else {
+ /* try SPNEGO with fallback to NTLMSSP */
+ auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
+ s->credentials, s->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO,
+ dcerpc_auth_level(conn),
+ s->table->authservices->names[0]);
+ composite_continue(c, auth_req, continue_auth_auto, c);
+ return c;
+ }
+
+ auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
+ s->credentials, s->lp_ctx, auth_type,
+ dcerpc_auth_level(conn),
+ s->table->authservices->names[0]);
+ composite_continue(c, auth_req, continue_auth, c);
+ return c;
+}
+
+
+/*
+ Receive result of authenticated bind request on dcerpc pipe
+
+ This returns *p, which may be different to the one originally
+ supllied, as it rebinds to a new pipe due to authentication fallback
+
+*/
+NTSTATUS dcerpc_pipe_auth_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
+ struct dcerpc_pipe **p)
+{
+ NTSTATUS status;
+
+ struct pipe_auth_state *s = talloc_get_type(c->private_data,
+ struct pipe_auth_state);
+ status = composite_wait(c);
+ if (!NT_STATUS_IS_OK(status)) {
+ char *uuid_str = GUID_string(s->pipe, &s->table->syntax_id.uuid);
+ DEBUG(0, ("Failed to bind to uuid %s - %s\n", uuid_str, nt_errstr(status)));
+ talloc_free(uuid_str);
+ } else {
+ talloc_steal(mem_ctx, s->pipe);
+ *p = s->pipe;
+ }
+
+ talloc_free(c);
+ return status;
+}
+
+
+/*
+ Perform an authenticated bind if needed - sync version
+
+ This may change *p, as it rebinds to a new pipe due to authentication fallback
+*/
+_PUBLIC_ NTSTATUS dcerpc_pipe_auth(TALLOC_CTX *mem_ctx,
+ struct dcerpc_pipe **p,
+ struct dcerpc_binding *binding,
+ const struct ndr_interface_table *table,
+ struct cli_credentials *credentials,
+ struct loadparm_context *lp_ctx)
+{
+ struct composite_context *c;
+
+ c = dcerpc_pipe_auth_send(*p, binding, table, credentials, lp_ctx);
+ return dcerpc_pipe_auth_recv(c, mem_ctx, p);
+}
+
+
+NTSTATUS dcerpc_generic_session_key(struct dcerpc_connection *c,
+ DATA_BLOB *session_key)
+{
+ /* 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;
+}
+
+/*
+ fetch the user session key - may be default (above) or the SMB session key
+*/
+_PUBLIC_ NTSTATUS dcerpc_fetch_session_key(struct dcerpc_pipe *p,
+ DATA_BLOB *session_key)
+{
+ return p->conn->security_state.session_key(p->conn, session_key);
+}
+
+
+/*
+ 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 on a debug level of >= 10
+*/
+_PUBLIC_ void dcerpc_log_packet(const struct ndr_interface_table *ndr,
+ uint32_t opnum, uint32_t flags,
+ DATA_BLOB *pkt)
+{
+ const int num_examples = 20;
+ int i;
+
+ if (DEBUGLEVEL < 10) return;
+
+ for (i=0;i<num_examples;i++) {
+ char *name=NULL;
+ asprintf(&name, "%s/rpclog/%s-%u.%d.%s",
+ lp_lockdir(global_loadparm), ndr->name, opnum, i,
+ (flags&NDR_IN)?"in":"out");
+ if (name == NULL) {
+ return;
+ }
+ if (!file_exist(name)) {
+ if (file_save(name, pkt->data, pkt->length)) {
+ DEBUG(10,("Logged rpc packet to %s\n", name));
+ }
+ free(name);
+ break;
+ }
+ free(name);
+ }
+}
+
+
+
+/*
+ create a secondary context from a primary connection
+
+ this uses dcerpc_alter_context() to create a new dcerpc context_id
+*/
+_PUBLIC_ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
+ struct dcerpc_pipe **pp2,
+ const struct ndr_interface_table *table)
+{
+ NTSTATUS status;
+ struct dcerpc_pipe *p2;
+
+ p2 = talloc_zero(p, struct dcerpc_pipe);
+ if (p2 == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ p2->conn = talloc_reference(p2, p->conn);
+ p2->request_timeout = p->request_timeout;
+
+ p2->context_id = ++p->conn->next_context_id;
+
+ p2->syntax = table->syntax_id;
+
+ p2->transfer_syntax = ndr_transfer_syntax;
+
+ p2->binding = talloc_reference(p2, p->binding);
+
+ status = dcerpc_alter_context(p2, p2, &p2->syntax, &p2->transfer_syntax);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(p2);
+ return status;
+ }
+
+ *pp2 = p2;
+
+ return NT_STATUS_OK;
+}