diff options
author | Gerald Carter <jerry@samba.org> | 2005-09-30 17:13:37 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:04:48 -0500 |
commit | 54abd2aa66069e6baf7769c496f46d9dba18db39 (patch) | |
tree | 9cf8e88168011797319ba9e9866749201b1eac1e /source3/include | |
parent | 4a2cc231d22a82ed21771a72508f15d21ed63227 (diff) | |
download | samba-54abd2aa66069e6baf7769c496f46d9dba18db39.tar.gz samba-54abd2aa66069e6baf7769c496f46d9dba18db39.tar.bz2 samba-54abd2aa66069e6baf7769c496f46d9dba18db39.zip |
r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
(This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)
Diffstat (limited to 'source3/include')
34 files changed, 1337 insertions, 878 deletions
diff --git a/source3/include/ads.h b/source3/include/ads.h index 8f6cc6e582..d2eeaab4d8 100644 --- a/source3/include/ads.h +++ b/source3/include/ads.h @@ -130,7 +130,7 @@ typedef void **ADS_MODLIST; #define UF_UNUSED_5 0x00800000 #define UF_UNUSED_6 0x01000000 -#define UF_UNUSED_7 0x02000000 +#define UF_NO_AUTH_DATA_REQUIRED 0x02000000 #define UF_UNUSED_8 0x04000000 #define UF_UNUSED_9 0x08000000 diff --git a/source3/include/asn_1.h b/source3/include/asn_1.h index 796c8bb740..63a18c4923 100644 --- a/source3/include/asn_1.h +++ b/source3/include/asn_1.h @@ -27,7 +27,7 @@ struct nesting { struct nesting *next; }; -typedef struct { +typedef struct asn1_data { uint8 *data; size_t length; off_t ofs; @@ -37,13 +37,16 @@ typedef struct { #define ASN1_APPLICATION(x) ((x)+0x60) +#define ASN1_APPLICATION_SIMPLE(x) ((x)+0x40) #define ASN1_SEQUENCE(x) ((x)+0x30) #define ASN1_CONTEXT(x) ((x)+0xa0) +#define ASN1_CONTEXT_SIMPLE(x) ((x)+0x80) #define ASN1_GENERAL_STRING 0x1b #define ASN1_OCTET_STRING 0x4 #define ASN1_OID 0x6 #define ASN1_BOOLEAN 0x1 #define ASN1_INTEGER 0x2 +#define ASN1_BITFIELD 0x3 #define ASN1_ENUMERATED 0xa #define ASN1_SET 0x31 diff --git a/source3/include/authdata.h b/source3/include/authdata.h index 1be127aaac..194429ab67 100644 --- a/source3/include/authdata.h +++ b/source3/include/authdata.h @@ -23,12 +23,22 @@ #define _AUTHDATA_H #include "rpc_misc.h" +#include "rpc_netlogon.h" #define PAC_TYPE_LOGON_INFO 1 #define PAC_TYPE_SERVER_CHECKSUM 6 #define PAC_TYPE_PRIVSVR_CHECKSUM 7 #define PAC_TYPE_LOGON_NAME 10 +#ifndef KRB5_AUTHDATA_WIN2K_PAC +#define KRB5_AUTHDATA_WIN2K_PAC 128 +#endif + +#ifndef KRB5_AUTHDATA_IF_RELEVANT +#define KRB5_AUTHDATA_IF_RELEVANT 1 +#endif + + typedef struct pac_logon_name { NTTIME logon_time; uint16 len; @@ -37,7 +47,7 @@ typedef struct pac_logon_name { typedef struct pac_signature_data { uint32 type; - uint8 *signature; + RPC_DATA_BLOB signature; /* this not the on-wire-format (!) */ } PAC_SIGNATURE_DATA; typedef struct group_membership { @@ -50,6 +60,8 @@ typedef struct group_membership_array { GROUP_MEMBERSHIP *group_membership; } GROUP_MEMBERSHIP_ARRAY; +#if 0 /* Unused, replaced by NET_USER_INFO_3 - Guenther */ + typedef struct krb_sid_and_attrs { uint32 sid_ptr; uint32 attrs; @@ -82,7 +94,7 @@ typedef struct pac_logon_info { UNIHDR hdr_dir_drive; uint16 logon_count; /* number of times user has logged onto domain */ - uint16 reserved12; + uint16 bad_password_count; /* samba4 idl */ uint32 user_rid; uint32 group_rid; @@ -90,15 +102,15 @@ typedef struct pac_logon_info { uint32 group_membership_ptr; uint32 user_flags; - uint32 reserved13[4]; + uint8 session_key[16]; /* samba4 idl */ UNIHDR hdr_dom_controller; UNIHDR hdr_dom_name; uint32 ptr_dom_sid; - - uint32 reserved16[2]; - uint32 reserved17; /* looks like it may be acb_info */ - uint32 reserved18[7]; + + uint8 lm_session_key[8]; /* samba4 idl */ + uint32 acct_flags; /* samba4 idl */ + uint32 unknown[7]; uint32 sid_count; uint32 ptr_extra_sids; @@ -122,6 +134,14 @@ typedef struct pac_logon_info { GROUP_MEMBERSHIP_ARRAY res_groups; } PAC_LOGON_INFO; +#endif + +typedef struct pac_logon_info { + NET_USER_INFO_3 info3; + DOM_SID2 res_group_dom_sid; + GROUP_MEMBERSHIP_ARRAY res_groups; + +} PAC_LOGON_INFO; typedef struct pac_info_ctr { @@ -134,18 +154,19 @@ typedef struct pac_info_ctr } pac; } PAC_INFO_CTR; -typedef struct pac_info_hdr { +typedef struct pac_buffer { uint32 type; uint32 size; uint32 offset; uint32 offsethi; PAC_INFO_CTR *ctr; -} PAC_INFO_HDR; + uint32 pad; +} PAC_BUFFER; typedef struct pac_data { uint32 num_buffers; uint32 version; - PAC_INFO_HDR *pac_info_hdr_ptr; + PAC_BUFFER *pac_buffer; } PAC_DATA; diff --git a/source3/include/client.h b/source3/include/client.h index e9d40c3b7c..df52e227f0 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -57,25 +57,39 @@ struct print_job_info time_t t; }; +struct cli_pipe_auth_data { + enum pipe_auth_type auth_type; /* switch for the union below. Defined in ntdomain.h */ + enum pipe_auth_level auth_level; /* defined in ntdomain.h */ + union { + struct schannel_auth_struct *schannel_auth; + NTLMSSP_STATE *ntlmssp_state; + struct kerberos_auth_struct *kerberos_auth; + } a_u; + void (*cli_auth_data_free_func)(struct cli_pipe_auth_data *); +}; + struct rpc_pipe_client { + struct rpc_pipe_client *prev, *next; + TALLOC_CTX *mem_ctx; struct cli_state *cli; int pipe_idx; + const char *pipe_name; uint16 fnum; - int pipe_auth_flags; - - NTLMSSP_STATE *ntlmssp_pipe_state; - const char *user_name; const char *domain; + const char *user_name; struct pwd_info pwd; - struct netsec_auth_struct auth_info; - uint16 max_xmit_frag; uint16 max_recv_frag; + + struct cli_pipe_auth_data auth; + + /* The following is only non-null on a netlogon pipe. */ + struct dcinfo *dc; }; struct cli_state { @@ -92,8 +106,11 @@ struct cli_state { int privileges; fstring desthost; - fstring user_name; + + /* The credentials used to open the cli_state connection. */ fstring domain; + fstring user_name; + struct pwd_info pwd; /* * The following strings are the @@ -111,7 +128,6 @@ struct cli_state { fstring full_dest_host_name; struct in_addr dest_ip; - struct pwd_info pwd; DATA_BLOB secblob; /* cryptkey or negTokenInit */ uint32 sesskey; int serverzone; @@ -137,27 +153,8 @@ struct cli_state { any per-pipe authenticaion */ DATA_BLOB user_session_key; - /* - * Only used in NT domain calls. - */ - - int pipe_idx; /* Index (into list of known pipes) - of the pipe we're talking to, - if any */ - - struct rpc_pipe_client pipes[PI_MAX_PIPES]; - - /* Secure pipe parameters */ - int pipe_auth_flags; - - struct rpc_pipe_client netlogon_pipe; /* The "first" pipe to get - the session key for the - schannel. */ - unsigned char sess_key[16]; /* Current session key. */ - DOM_CRED clnt_cred; /* Client credential. */ - fstring mach_acct; /* MYNAME$. */ - fstring srv_name_slash; /* \\remote server. */ - fstring clnt_name_slash; /* \\local client. */ + /* The list of pipes currently open on this connection. */ + struct rpc_pipe_client *pipe_list; BOOL use_kerberos; BOOL fallback_after_kerberos; @@ -175,9 +172,6 @@ struct cli_state { /* was this structure allocated by cli_initialise? If so, then free in cli_shutdown() */ BOOL allocated; - - /* Name of the pipe we're talking to, if any */ - fstring pipe_name; }; #define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001 diff --git a/source3/include/dlinklist.h b/source3/include/dlinklist.h index 794aea7576..c856aaa762 100644 --- a/source3/include/dlinklist.h +++ b/source3/include/dlinklist.h @@ -70,6 +70,20 @@ } \ } +/* insert 'p' after the given element 'el' in a list. If el is NULL then + this is the same as a DLIST_ADD() */ +#define DLIST_ADD_AFTER(list, p, el) \ +do { \ + if (!(list) || !(el)) { \ + DLIST_ADD(list, p); \ + } else { \ + p->prev = el; \ + p->next = el->next; \ + el->next = p; \ + if (p->next) p->next->prev = p; \ + }\ +} while (0) + /* demote an element to the top of the list, needs a tmp pointer */ #define DLIST_DEMOTE(list, p, tmp) \ { \ diff --git a/source3/include/doserr.h b/source3/include/doserr.h index 7c98171250..593d5d99ee 100644 --- a/source3/include/doserr.h +++ b/source3/include/doserr.h @@ -5,6 +5,7 @@ Copyright (C) John H Terpstra 1996-2000 Copyright (C) Luke Kenneth Casson Leighton 1996-2000 Copyright (C) Paul Ashton 1998-2000 + Copyright (C) Gerald (Jerry) Carter 2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -174,6 +175,7 @@ #define WERR_NOMEM W_ERROR(8) #define WERR_GENERAL_FAILURE W_ERROR(31) #define WERR_NOT_SUPPORTED W_ERROR(50) +#define WERR_DEVICE_NOT_EXIST W_ERROR(55) #define WERR_PRINTQ_FULL W_ERROR(61) #define WERR_NO_SPOOL_SPACE W_ERROR(62) #define WERR_NO_SUCH_SHARE W_ERROR(67) @@ -227,6 +229,12 @@ #define WERR_PRINT_MONITOR_IN_USE W_ERROR(ERRprintmonitorinuse) #define WERR_PRINTER_HAS_JOBS_QUEUED W_ERROR(ERRprinterhasjobsqueued) +/* Configuration Manager Errors */ +/* Basically Win32 errors meanings are specific to the \ntsvcs pipe */ + +#define WERR_CM_NO_MORE_HW_PROFILES W_ERROR(35) +#define WERR_CM_NO_SUCH_VALUE W_ERROR(37) + /* DFS errors */ diff --git a/source3/include/includes.h b/source3/include/includes.h index 51aa218ac6..573982903b 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -27,7 +27,8 @@ #ifndef __cplusplus #define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES -#define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +/* allow to build with newer heimdal releases */ +/* #define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES */ #define public #error DONT_USE_CPLUSPLUS_RESERVED_NAMES #define protected #error DONT_USE_CPLUSPLUS_RESERVED_NAMES #define template #error DONT_USE_CPLUSPLUS_RESERVED_NAMES @@ -288,6 +289,7 @@ #include <net/if.h> #endif + #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> #endif @@ -896,19 +898,17 @@ extern int errno; #include "privileges.h" -#include "rpc_creds.h" +#include "rpc_misc.h" + +#include "rpc_dce.h" #include "mapping.h" #include "passdb.h" -#include "ntdomain.h" - -#include "rpc_misc.h" - #include "rpc_secdes.h" -#include "nt_printing.h" +#include "authdata.h" #include "msdfs.h" @@ -923,6 +923,29 @@ extern int errno; #include "auth.h" +#include "ntdomain.h" + +#include "rpc_svcctl.h" +#include "rpc_ntsvcs.h" +#include "rpc_lsa.h" +#include "rpc_netlogon.h" +#include "reg_objects.h" +#include "rpc_reg.h" +#include "rpc_samr.h" +#include "rpc_srvsvc.h" +#include "rpc_wkssvc.h" +#include "rpc_spoolss.h" +#include "rpc_eventlog.h" +#include "rpc_dfs.h" +#include "rpc_ds.h" +#include "rpc_echo.h" +#include "rpc_shutdown.h" +#include "rpc_unixinfo.h" +#include "rpc_perfcount.h" +#include "rpc_perfcount_defs.h" + +#include "nt_printing.h" + #include "idmap.h" #include "client.h" @@ -945,6 +968,8 @@ extern int errno; #include "spnego.h" +#include "rpc_client.h" + /* * Type for wide character dirent structure. * Only d_name is defined by POSIX. @@ -995,6 +1020,8 @@ struct smb_ldap_privates; #include "smbldap.h" +#include "smb_ldap.h" + /***** automatically generated prototypes *****/ #ifndef NO_PROTO_H #include "proto.h" @@ -1414,7 +1441,7 @@ void krb5_free_unparsed_name(krb5_context ctx, char *val); void setup_kaddr( krb5_address *pkaddr, struct sockaddr *paddr); int create_kerberos_key_from_string(krb5_context context, krb5_principal host_princ, krb5_data *password, krb5_keyblock *key, krb5_enctype enctype); int create_kerberos_key_from_string_direct(krb5_context context, krb5_principal host_princ, krb5_data *password, krb5_keyblock *key, krb5_enctype enctype); -void get_auth_data_from_tkt(DATA_BLOB *auth_data, krb5_ticket *tkt); +BOOL get_auth_data_from_tkt(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, krb5_ticket *tkt); krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt); krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters); krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes); diff --git a/source3/include/messages.h b/source3/include/messages.h index 1039e0d9a7..abe219374e 100644 --- a/source3/include/messages.h +++ b/source3/include/messages.h @@ -63,6 +63,11 @@ #define MSG_SMB_SAM_SYNC 3003 #define MSG_SMB_SAM_REPL 3004 #define MSG_SMB_UNLOCK 3005 +#define MSG_SMB_BREAK_REQUEST 3006 +#define MSG_SMB_BREAK_RESPONSE 3007 +#define MSG_SMB_ASYNC_LEVEL2_BREAK 3008 +#define MSG_SMB_OPEN_RETRY 3009 +#define MSG_SMB_KERNEL_BREAK 3010 /* winbind messages */ #define MSG_WINBIND_FINISHED 4001 @@ -77,4 +82,8 @@ #define FLAG_MSG_PRINT_NOTIFY 0x0008 #define FLAG_MSG_PRINT_GENERAL 0x0010 +struct process_id { + pid_t pid; +}; + #endif diff --git a/source3/include/module.h b/source3/include/module.h index c41310c7f7..8b317a9d59 100644 --- a/source3/include/module.h +++ b/source3/include/module.h @@ -33,6 +33,4 @@ typedef int smb_event_id_t; typedef void (smb_idle_event_fn)(void **data,time_t *interval,time_t now); -typedef void (smb_exit_event_fn)(void **data); - #endif /* _MODULE_H */ diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 87fac492db..967aac2bb5 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -24,30 +24,6 @@ #ifndef _NT_DOMAIN_H /* _NT_DOMAIN_H */ #define _NT_DOMAIN_H -struct uuid { - uint32 time_low; - uint16 time_mid; - uint16 time_hi_and_version; - uint8 clock_seq[2]; - uint8 node[6]; -}; -#define UUID_SIZE 16 - -#define UUID_FLAT_SIZE 16 -typedef struct uuid_flat { - uint8 info[UUID_FLAT_SIZE]; -} UUID_FLAT; - -/* dce/rpc support */ -#include "rpc_dce.h" - -/* miscellaneous structures / defines */ -#include "rpc_misc.h" - -#include "rpc_creds.h" - -#include "talloc.h" - /* * A bunch of stuff that was put into smb.h * in the NTDOM branch - it didn't belong there. @@ -67,6 +43,7 @@ typedef struct _prs_struct { uint32 grow_size; /* size requested via prs_grow() calls */ char *data_p; /* The buffer itself. */ TALLOC_CTX *mem_ctx; /* When unmarshalling, use this.... */ + const char *sess_key; /* If we have to do encrypt/decrypt on the fly. */ } prs_struct; /* @@ -97,7 +74,7 @@ typedef struct _output_data { * The current PDU being returned. This inclues * headers, data and authentication footer. */ - unsigned char current_pdu[MAX_PDU_FRAG_LEN]; + unsigned char current_pdu[RPC_MAX_PDU_FRAG_LEN]; /* The amount of data in the current_pdu buffer. */ uint32 current_pdu_len; @@ -111,9 +88,9 @@ typedef struct _input_data { * This is the current incoming pdu. The data here * is collected via multiple writes until a complete * pdu is seen, then the data is copied into the in_data - * structure. The maximum size of this is 0x1630 (MAX_PDU_FRAG_LEN). + * structure. The maximum size of this is 0x1630 (RPC_MAX_PDU_FRAG_LEN). */ - unsigned char current_in_pdu[MAX_PDU_FRAG_LEN]; + unsigned char current_in_pdu[RPC_MAX_PDU_FRAG_LEN]; /* * The amount of data needed to complete the in_pdu. @@ -158,22 +135,22 @@ struct handle_list { /* Domain controller authentication protocol info */ struct dcinfo { - DOM_CHAL clnt_chal; /* Initial challenge received from client */ - DOM_CHAL srv_chal; /* Initial server challenge */ - DOM_CRED clnt_cred; /* Last client credential */ - DOM_CRED srv_cred; /* Last server credential */ + uint32 sequence; /* "timestamp" from client. */ + DOM_CHAL seed_chal; + DOM_CHAL clnt_chal; /* Client credential */ + DOM_CHAL srv_chal; /* Server credential */ uchar sess_key[8]; /* Session key */ - uchar md4pw[16]; /* md4(machine password) */ + uchar mach_pw[16]; /* md4(machine password) */ fstring mach_acct; /* Machine name we've authenticated. */ fstring remote_machine; /* Machine name we've authenticated. */ + fstring domain; BOOL challenge_sent; BOOL got_session_key; BOOL authenticated; - }; typedef struct pipe_rpc_fns { @@ -189,6 +166,46 @@ typedef struct pipe_rpc_fns { } PIPE_RPC_FNS; /* + * Different auth types we support. + * Can't keep in sync with wire values as spnego wraps different auth methods. + */ + +enum pipe_auth_type { PIPE_AUTH_TYPE_NONE = 0, PIPE_AUTH_TYPE_NTLMSSP, PIPE_AUTH_TYPE_SCHANNEL, + PIPE_AUTH_TYPE_SPNEGO_NTLMSSP, PIPE_AUTH_TYPE_KRB5, PIPE_AUTH_TYPE_SPNEGO_KRB5 }; + +/* Possible auth levels - keep these in sync with the wire values. */ +enum pipe_auth_level { PIPE_AUTH_LEVEL_NONE = 0, + PIPE_AUTH_LEVEL_CONNECT = 1, /* We treat as NONE. */ + PIPE_AUTH_LEVEL_INTEGRITY = 5, /* Sign. */ + PIPE_AUTH_LEVEL_PRIVACY = 6 /* Seal. */ +}; + +/* auth state for krb5. */ +struct kerberos_auth_struct { + const char *service_principal; + DATA_BLOB session_key; +}; + +/* auth state for schannel. */ +struct schannel_auth_struct { + uchar sess_key[16]; + uint32 seq_num; +}; + +/* auth state for all bind types. */ + +struct pipe_auth_data { + enum pipe_auth_type auth_type; /* switch for union below. */ + enum pipe_auth_level auth_level; + union { + struct schannel_auth_struct *schannel_auth; + AUTH_NTLMSSP_STATE *auth_ntlmssp_state; +/* struct kerberos_auth_struct *kerberos_auth; TO BE ADDED... */ + } a_u; + void (*auth_data_free_func)(struct pipe_auth_data *); +}; + +/* * DCE/RPC-specific samba-internal-specific handling of data on * NamedPipes. */ @@ -210,20 +227,12 @@ typedef struct pipes_struct { RPC_HDR hdr; /* Incoming RPC header. */ RPC_HDR_REQ hdr_req; /* Incoming request header. */ - uint32 ntlmssp_chal_flags; /* Client challenge flags. */ - BOOL ntlmssp_auth_requested; /* If the client wanted authenticated rpc. */ - BOOL ntlmssp_auth_validated; /* If the client *got* authenticated rpc. */ - unsigned char challenge[8]; - unsigned char ntlmssp_hash[258]; - uint32 ntlmssp_seq_num; - struct dcinfo dc; /* Keeps the creds data. */ + /* This context is used for pipe state storage and is freed when the pipe is closed. */ + TALLOC_CTX *pipe_state_mem_ctx; - /* Hmm. In my understanding the authentication happens - implicitly later, so there are no two stages for - schannel. */ + struct pipe_auth_data auth; - BOOL netsec_auth_validated; - struct netsec_auth_struct netsec_auth; + struct dcinfo *dc; /* Keeps the creds data from netlogon. */ /* * Windows user info. @@ -233,14 +242,13 @@ typedef struct pipes_struct { fstring wks; /* - * Unix user name and credentials. + * Unix user name and credentials used when a pipe is authenticated. */ fstring pipe_user_name; struct current_user pipe_user; - DATA_BLOB session_key; - + /* * Set to true when an RPC bind has been done on this pipe. */ @@ -277,7 +285,8 @@ typedef struct pipes_struct { output_data out_data; - /* talloc context to use when allocating memory on this pipe. */ + /* This context is used for PUD data and is freed between each pdu. + Don't use for pipe state storage. */ TALLOC_CTX *mem_ctx; /* handle database to use on this pipe. */ @@ -383,27 +392,11 @@ typedef struct { /* end higher order functions */ - -/* security descriptor structures */ -#include "rpc_secdes.h" - -/* pac */ -#include "authdata.h" - -/* different dce/rpc pipes */ -#include "rpc_buffer.h" -#include "rpc_lsa.h" -#include "rpc_netlogon.h" -#include "rpc_reg.h" -#include "rpc_samr.h" -#include "rpc_srvsvc.h" -#include "rpc_wkssvc.h" -#include "rpc_svcctl.h" -#include "rpc_spoolss.h" -#include "rpc_eventlog.h" -#include "rpc_dfs.h" -#include "rpc_ds.h" -#include "rpc_echo.h" -#include "rpc_shutdown.h" +typedef struct { + uint32 size; + prs_struct prs; + uint32 struct_start; + uint32 string_at_end; +} RPC_BUFFER; #endif /* _NT_DOMAIN_H */ diff --git a/source3/include/ntlmssp.h b/source3/include/ntlmssp.h index 267779c434..30a37e06c3 100644 --- a/source3/include/ntlmssp.h +++ b/source3/include/ntlmssp.h @@ -34,7 +34,8 @@ enum NTLM_MESSAGE_TYPE NTLMSSP_NEGOTIATE = 1, NTLMSSP_CHALLENGE = 2, NTLMSSP_AUTH = 3, - NTLMSSP_UNKNOWN = 4 + NTLMSSP_UNKNOWN = 4, + NTLMSSP_DONE = 5 /* samba final state */ }; /* NTLMSSP negotiation flags */ @@ -61,13 +62,15 @@ enum NTLM_MESSAGE_TYPE #define NTLMSSP_CHAL_TARGET_INFO 0x00800000 #define NTLMSSP_NEGOTIATE_128 0x20000000 /* 128-bit encryption */ #define NTLMSSP_NEGOTIATE_KEY_EXCH 0x40000000 -#define NTLMSSP_NEGOTIATE_080000000 0x80000000 +#define NTLMSSP_NEGOTIATE_56 0x80000000 #define NTLMSSP_NAME_TYPE_SERVER 0x01 #define NTLMSSP_NAME_TYPE_DOMAIN 0x02 #define NTLMSSP_NAME_TYPE_SERVER_DNS 0x03 #define NTLMSSP_NAME_TYPE_DOMAIN_DNS 0x04 +#define NTLMSSP_SIG_SIZE 16 + typedef struct ntlmssp_state { TALLOC_CTX *mem_ctx; @@ -142,23 +145,22 @@ typedef struct ntlmssp_state const char *(*get_global_myname)(void); const char *(*get_domain)(void); - /* SMB Signing */ - - uint32 ntlmssp_seq_num; - /* ntlmv2 */ - unsigned char send_sign_const[16]; - unsigned char send_seal_const[16]; - unsigned char recv_sign_const[16]; - unsigned char recv_seal_const[16]; - unsigned char send_sign_hash[258]; - unsigned char send_seal_hash[258]; - unsigned char recv_sign_hash[258]; - unsigned char recv_seal_hash[258]; + unsigned char send_sign_key[16]; + unsigned char send_seal_key[16]; + unsigned char recv_sign_key[16]; + unsigned char recv_seal_key[16]; + + unsigned char send_seal_arc4_state[258]; + unsigned char recv_seal_arc4_state[258]; + + uint32 ntlm2_send_seq_num; + uint32 ntlm2_recv_seq_num; /* ntlmv1 */ - unsigned char ntlmssp_hash[258]; + unsigned char ntlmv1_arc4_state[258]; + uint32 ntlmv1_seq_num; /* it turns out that we don't always get the response in at the time we want to process it. @@ -166,4 +168,3 @@ typedef struct ntlmssp_state DATA_BLOB stored_response; } NTLMSSP_STATE; - diff --git a/source3/include/passdb.h b/source3/include/passdb.h index 114585346e..e985ab582d 100644 --- a/source3/include/passdb.h +++ b/source3/include/passdb.h @@ -233,6 +233,7 @@ struct acct_info }; struct samr_displayentry { + uint32 idx; uint32 rid; uint16 acct_flags; const char *account_name; @@ -268,7 +269,7 @@ struct pdb_search { * this SAMBA will load. Increment this if *ANY* changes are made to the interface. */ -#define PASSDB_INTERFACE_VERSION 8 +#define PASSDB_INTERFACE_VERSION 9 typedef struct pdb_context { @@ -373,6 +374,14 @@ typedef struct pdb_context const char ***names, uint32 **attrs); + NTSTATUS (*pdb_get_account_policy)(struct pdb_context *context, + int policy_index, uint32 *value); + + NTSTATUS (*pdb_set_account_policy)(struct pdb_context *context, + int policy_index, uint32 value); + + NTSTATUS (*pdb_get_seq_num)(struct pdb_context *context, time_t *seq_num); + BOOL (*pdb_search_users)(struct pdb_context *context, struct pdb_search *search, uint16 acct_flags); @@ -478,6 +487,7 @@ typedef struct pdb_methods int num_members, uint32 **alias_rids, int *num_alias_rids); + NTSTATUS (*lookup_rids)(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, @@ -486,6 +496,14 @@ typedef struct pdb_methods const char ***names, uint32 **attrs); + NTSTATUS (*get_account_policy)(struct pdb_methods *methods, + int policy_index, uint32 *value); + + NTSTATUS (*set_account_policy)(struct pdb_methods *methods, + int policy_index, uint32 value); + + NTSTATUS (*get_seq_num)(struct pdb_methods *methods, time_t *seq_num); + BOOL (*search_users)(struct pdb_methods *methods, struct pdb_search *search, uint16 acct_flags); diff --git a/source3/include/printing.h b/source3/include/printing.h index 220fd08ef1..54f32d5954 100644 --- a/source3/include/printing.h +++ b/source3/include/printing.h @@ -57,7 +57,7 @@ struct printif print_status_struct *status); int (*queue_pause)(int snum); int (*queue_resume)(int snum); - int (*job_delete)(int snum, struct printjob *pjob); + int (*job_delete)(const char *sharename, const char *lprm_command, struct printjob *pjob); int (*job_pause)(int snum, struct printjob *pjob); int (*job_resume)(int snum, struct printjob *pjob); int (*job_submit)(int snum, struct printjob *pjob); diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index 9ca2d5aa8c..8a83c0f8ae 100644 --- a/source3/include/rpc_client.h +++ b/source3/include/rpc_client.h @@ -22,36 +22,68 @@ #define _RPC_CLIENT_H /* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */ - -#define CLI_DO_RPC( pcli, ctx, pipe_num, opnum, q_in, r_out, \ + +#define CLI_DO_RPC( pcli, ctx, p_idx, opnum, q_in, r_out, \ q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ -{ r_out.status = default_error;\ - prs_init( &q_ps, MAX_PDU_FRAG_LEN, ctx, MARSHALL ); \ - prs_init( &r_ps, 0, ctx, UNMARSHALL );\ +{\ + SMB_ASSERT(pcli->pipe_idx == p_idx); \ + if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \ + return NT_STATUS_NO_MEMORY;\ + }\ + if (!prs_init( &r_ps, 0, ctx, UNMARSHALL )) {\ + prs_mem_free( &q_ps );\ + return NT_STATUS_NO_MEMORY;\ + }\ if ( q_io_fn("", &q_in, &q_ps, 0) ) {\ - if ( rpc_api_pipe_req(pcli, pipe_num, opnum, &q_ps, &r_ps) ) {\ - if (!r_io_fn("", &r_out, &r_ps, 0)) {\ - r_out.status = default_error;\ - }\ + NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \ + if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return _smb_pipe_stat_;\ + }\ + if (!r_io_fn("", &r_out, &r_ps, 0)) {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return default_error;\ }\ + } else {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return default_error;\ }\ prs_mem_free( &q_ps );\ prs_mem_free( &r_ps );\ } -/* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req_int() */ +/* Arrrgg. Same but with WERRORS. Needed for registry code. */ -#define CLI_DO_RPC_EX( pcli, ctx, pipe_num, opnum, q_in, r_out, \ +#define CLI_DO_RPC_WERR( pcli, ctx, p_idx, opnum, q_in, r_out, \ q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ -{ r_out.status = default_error;\ - prs_init( &q_ps, MAX_PDU_FRAG_LEN, ctx, MARSHALL ); \ - prs_init( &r_ps, 0, ctx, UNMARSHALL );\ +{\ + SMB_ASSERT(pcli->pipe_idx == p_idx); \ + if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \ + return WERR_NOMEM;\ + }\ + if (!prs_init( &r_ps, 0, ctx, UNMARSHALL )) {\ + prs_mem_free( &q_ps );\ + return WERR_NOMEM;\ + }\ if ( q_io_fn("", &q_in, &q_ps, 0) ) {\ - if ( rpc_api_pipe_req_int(pcli, opnum, &q_ps, &r_ps) ) {\ - if (!r_io_fn("", &r_out, &r_ps, 0)) {\ - r_out.status = default_error;\ - }\ + NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \ + if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return ntstatus_to_werror(_smb_pipe_stat_);\ + }\ + if (!r_io_fn("", &r_out, &r_ps, 0)) {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return default_error;\ }\ + } else {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return default_error;\ }\ prs_mem_free( &q_ps );\ prs_mem_free( &r_ps );\ diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h index 88b8380870..3de4d2b691 100644 --- a/source3/include/rpc_dce.h +++ b/source3/include/rpc_dce.h @@ -23,9 +23,6 @@ #ifndef _DCE_RPC_H /* _DCE_RPC_H */ #define _DCE_RPC_H -#include "rpc_misc.h" /* this only pulls in STRHDR */ - - /* DCE/RPC packet types */ enum RPC_PKT_TYPE { @@ -37,7 +34,7 @@ enum RPC_PKT_TYPE { RPC_BINDNACK = 0x0D, RPC_ALTCONT = 0x0E, RPC_ALTCONTRESP = 0x0F, - RPC_BINDRESP = 0x10 /* not the real name! this is undocumented! */ + RPC_AUTH3 = 0x10 /* not the real name! this is undocumented! */ }; /* DCE/RPC flags */ @@ -45,29 +42,41 @@ enum RPC_PKT_TYPE { #define RPC_FLG_LAST 0x02 #define RPC_FLG_NOCALL 0x20 + #define SMBD_NTLMSSP_NEG_FLAGS 0x000082b1 /* ALWAYS_SIGN|NEG_NTLM|NEG_LM|NEG_SEAL|NEG_SIGN|NEG_UNICODE */ /* NTLMSSP signature version */ #define NTLMSSP_SIGN_VERSION 0x01 -/* NTLMSSP auth type */ -#define NTLMSSP_AUTH_TYPE 0xa +/* DCE RPC auth types - extended by Microsoft. */ +#define RPC_ANONYMOUS_AUTH_TYPE 0 +#define RPC_AUTH_TYPE_KRB5_1 1 +#define RPC_SPNEGO_AUTH_TYPE 9 +#define RPC_NTLMSSP_AUTH_TYPE 10 +#define RPC_KRB5_AUTH_TYPE 16 /* Not yet implemented. */ +#define RPC_SCHANNEL_AUTH_TYPE 68 /* 0x44 */ /* DCE-RPC standard identifiers to indicate signing or sealing of an RPC pipe */ +#define RPC_AUTH_LEVEL_NONE 1 +#define RPC_AUTH_LEVEL_CONNECT 2 +#define RPC_AUTH_LEVEL_CALL 3 +#define RPC_AUTH_LEVEL_PACKET 4 +#define RPC_AUTH_LEVEL_INTEGRITY 5 +#define RPC_AUTH_LEVEL_PRIVACY 6 + +#if 0 #define RPC_PIPE_AUTH_SIGN_LEVEL 0x5 #define RPC_PIPE_AUTH_SEAL_LEVEL 0x6 +#endif /* Netlogon schannel auth type and level */ -#define NETSEC_AUTH_TYPE 0x44 -#define NETSEC_SIGN_SIGNATURE { 0x77, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } -#define NETSEC_SEAL_SIGNATURE { 0x77, 0x00, 0x7a, 0x00, 0xff, 0xff, 0x00, 0x00 } +#define SCHANNEL_SIGN_SIGNATURE { 0x77, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } +#define SCHANNEL_SEAL_SIGNATURE { 0x77, 0x00, 0x7a, 0x00, 0xff, 0xff, 0x00, 0x00 } -#define RPC_AUTH_NETSEC_SIGN_OR_SEAL_CHK_LEN 0x20 -#define RPC_AUTH_NETSEC_SIGN_ONLY_CHK_LEN 0x18 +#define RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN 0x20 +#define RPC_AUTH_SCHANNEL_SIGN_ONLY_CHK_LEN 0x18 -/* SPNEGO auth type. */ -#define SPNEGO_AUTH_TYPE 0x9 /* The 7 here seems to be required to get Win2k not to downgrade us to NT4. Actually, anything other than 1ff would seem to do... */ @@ -76,20 +85,17 @@ enum RPC_PKT_TYPE { #define NETLOGON_NEG_SCHANNEL 0x40000000 #define NETLOGON_NEG_DOMAIN_TRUST_ACCOUNT 0x2010b000 -enum netsec_direction { +enum schannel_direction { SENDER_IS_INITIATOR, SENDER_IS_ACCEPTOR }; -/* Internal Flags to indicate what type of authentication on the pipe */ -#define AUTH_PIPE_SIGN 0x0001 -#define AUTH_PIPE_SEAL 0x0002 -#define AUTH_PIPE_NTLMSSP 0x0004 -#define AUTH_PIPE_NETSEC 0x0008 +/* Maximum size of the signing data in a fragment. */ +#define RPC_MAX_SIGN_SIZE 0x20 /* 32 */ /* Maximum PDU fragment size. */ /* #define MAX_PDU_FRAG_LEN 0x1630 this is what wnt sets */ -#define MAX_PDU_FRAG_LEN 0x10b8 /* this is what w2k sets */ +#define RPC_MAX_PDU_FRAG_LEN 0x10b8 /* this is what w2k sets */ /* RPC_IFACE */ typedef struct rpc_iface_info { @@ -163,7 +169,7 @@ typedef struct rpc_addr_info { fstring str; /* the string above in single byte, null terminated form */ } RPC_ADDR_STR; -/* RPC_HDR_BBA */ +/* RPC_HDR_BBA - bind acknowledge, and alter context response. */ typedef struct rpc_hdr_bba_info { uint16 max_tsize; /* maximum transmission fragment size (0x1630) */ uint16 max_rsize; /* max receive fragment size (0x1630) */ @@ -183,39 +189,24 @@ typedef struct rpc_hdr_auth_info { #define RPC_HDR_AUTH_LEN 8 -/* RPC_HDR_AUTHA */ -typedef struct rpc_hdr_autha_info { - uint16 max_tsize; /* maximum transmission fragment size (0x1630) */ - uint16 max_rsize; /* max receive fragment size (0x1630) */ - RPC_HDR_AUTH auth; -} RPC_HDR_AUTHA; - -#define RPC_HDR_AUTHA_LEN (RPC_HDR_AUTH_LEN+4) - /* this is TEMPORARILY coded up as a specific structure */ /* this structure comes after the bind request */ -/* RPC_AUTH_NETSEC_NEG */ -typedef struct rpc_auth_netsec_neg_info { +/* RPC_AUTH_SCHANNEL_NEG */ +typedef struct rpc_auth_schannel_neg_info { uint32 type1; /* Always zero ? */ uint32 type2; /* Types 0x3 and 0x13 seen. Check AcquireSecurityContext() docs.... */ fstring domain; /* calling workstations's domain */ fstring myname; /* calling workstation's name */ -} RPC_AUTH_NETSEC_NEG; +} RPC_AUTH_SCHANNEL_NEG; /* attached to the end of encrypted rpc requests and responses */ -/* RPC_AUTH_NETSEC_CHK */ -typedef struct rpc_auth_netsec_chk_info { +/* RPC_AUTH_SCHANNEL_CHK */ +typedef struct rpc_auth_schannel_chk_info { uint8 sig [8]; /* 77 00 7a 00 ff ff 00 00 */ uint8 packet_digest[8]; /* checksum over the packet, MD5'ed with session key */ uint8 seq_num[8]; /* verifier, seq num */ uint8 confounder[8]; /* random 8-byte nonce */ -} RPC_AUTH_NETSEC_CHK; - -struct netsec_auth_struct { - uchar sess_key[16]; - uint32 seq_num; - int auth_flags; -}; +} RPC_AUTH_SCHANNEL_CHK; typedef struct rpc_context { uint16 context_id; /* presentation context identifier. */ @@ -268,60 +259,4 @@ typedef struct rpc_auth_verif_info { uint32 msg_type; /* NTLMSSP_MESSAGE_TYPE (1,2,3) and 5 for schannel */ } RPC_AUTH_VERIFIER; -/* this is TEMPORARILY coded up as a specific structure */ -/* this structure comes after the bind request */ -/* RPC_AUTH_NTLMSSP_NEG */ - -typedef struct rpc_auth_ntlmssp_neg_info { - uint32 neg_flgs; /* 0x0000 b2b3 */ - - STRHDR hdr_myname; /* offset is against START of this structure */ - STRHDR hdr_domain; /* offset is against START of this structure */ - - fstring myname; /* calling workstation's name */ - fstring domain; /* calling workstations's domain */ -} RPC_AUTH_NTLMSSP_NEG; - -/* this is TEMPORARILY coded up as a specific structure */ -/* this structure comes after the bind acknowledgement */ -/* RPC_AUTH_NTLMSSP_CHAL */ -typedef struct rpc_auth_ntlmssp_chal_info { - uint32 unknown_1; /* 0x0000 0000 */ - uint32 unknown_2; /* 0x0000 0028 */ - uint32 neg_flags; /* 0x0000 82b1 */ - - uint8 challenge[8]; /* ntlm challenge */ - uint8 reserved [8]; /* zeros */ -} RPC_AUTH_NTLMSSP_CHAL; - - -/* RPC_AUTH_NTLMSSP_RESP */ -typedef struct rpc_auth_ntlmssp_resp_info { - STRHDR hdr_lm_resp; /* 24 byte response */ - STRHDR hdr_nt_resp; /* 24 byte response */ - STRHDR hdr_domain; - STRHDR hdr_usr; - STRHDR hdr_wks; - STRHDR hdr_sess_key; /* NULL unless negotiated */ - uint32 neg_flags; /* 0x0000 82b1 */ - - fstring sess_key; - fstring wks; - fstring user; - fstring domain; - fstring nt_resp; - fstring lm_resp; -} RPC_AUTH_NTLMSSP_RESP; - -/* attached to the end of encrypted rpc requests and responses */ -/* RPC_AUTH_NTLMSSP_CHK */ -typedef struct rpc_auth_ntlmssp_chk_info { - uint32 ver; /* 0x0000 0001 */ - uint32 reserved; - uint32 crc32; /* checksum using 0xEDB8 8320 as a polynomial */ - uint32 seq_num; -} RPC_AUTH_NTLMSSP_CHK; - -#define RPC_AUTH_NTLMSSP_CHK_LEN 16 - #endif /* _DCE_RPC_H */ diff --git a/source3/include/rpc_dfs.h b/source3/include/rpc_dfs.h index 39316a5d54..7aee208c14 100644 --- a/source3/include/rpc_dfs.h +++ b/source3/include/rpc_dfs.h @@ -34,164 +34,131 @@ #define DFSFLAG_ADD_VOLUME 0x00000001 #define DFSFLAG_RESTORE_VOLUME 0x00000002 -typedef struct dfs_q_dfs_exist -{ - uint32 dummy; -} -DFS_Q_DFS_EXIST; +typedef struct dfs_q_dfs_exist { + uint32 dummy; +} DFS_Q_DFS_EXIST; /* status == 1 if dfs exists. */ -typedef struct dfs_r_dfs_exist -{ +typedef struct dfs_r_dfs_exist { uint32 status; /* Not a WERROR or NTSTATUS code */ -} -DFS_R_DFS_EXIST; - -typedef struct dfs_q_dfs_add -{ - uint32 ptr_DfsEntryPath; - UNISTR2 DfsEntryPath; - uint32 ptr_ServerName; - UNISTR2 ServerName; - uint32 ptr_ShareName; - UNISTR2 ShareName; - uint32 ptr_Comment; - UNISTR2 Comment; - uint32 Flags; -} -DFS_Q_DFS_ADD; - -typedef struct dfs_r_dfs_add -{ - WERROR status; -} -DFS_R_DFS_ADD; +} DFS_R_DFS_EXIST; + +typedef struct dfs_q_dfs_add { + uint32 ptr_DfsEntryPath; + UNISTR2 DfsEntryPath; + uint32 ptr_ServerName; + UNISTR2 ServerName; + uint32 ptr_ShareName; + UNISTR2 ShareName; + uint32 ptr_Comment; + UNISTR2 Comment; + uint32 Flags; +} DFS_Q_DFS_ADD; + +typedef struct dfs_r_dfs_add { + WERROR status; +} DFS_R_DFS_ADD; /********************************************/ -typedef struct dfs_q_dfs_remove -{ - UNISTR2 DfsEntryPath; - uint32 ptr_ServerName; - UNISTR2 ServerName; - uint32 ptr_ShareName; - UNISTR2 ShareName; -} -DFS_Q_DFS_REMOVE; - -typedef struct dfs_r_dfs_remove -{ - WERROR status; -} -DFS_R_DFS_REMOVE; +typedef struct dfs_q_dfs_remove { + UNISTR2 DfsEntryPath; + uint32 ptr_ServerName; + UNISTR2 ServerName; + uint32 ptr_ShareName; + UNISTR2 ShareName; +} DFS_Q_DFS_REMOVE; + +typedef struct dfs_r_dfs_remove { + WERROR status; +} DFS_R_DFS_REMOVE; /********************************************/ -typedef struct dfs_info_1 -{ - uint32 ptr_entrypath; - UNISTR2 entrypath; -} -DFS_INFO_1; - -typedef struct dfs_info_2 -{ - uint32 ptr_entrypath; - UNISTR2 entrypath; - uint32 ptr_comment; - UNISTR2 comment; - uint32 state; - uint32 num_storages; -} -DFS_INFO_2; - -typedef struct dfs_storage_info -{ - uint32 state; - uint32 ptr_servername; - UNISTR2 servername; - uint32 ptr_sharename; - UNISTR2 sharename; -} -DFS_STORAGE_INFO; - -typedef struct dfs_info_3 -{ - uint32 ptr_entrypath; - UNISTR2 entrypath; - uint32 ptr_comment; - UNISTR2 comment; - uint32 state; - uint32 num_storages; - uint32 ptr_storages; - uint32 num_storage_infos; - DFS_STORAGE_INFO* storages; -} -DFS_INFO_3; - -typedef struct dfs_info_ctr -{ +typedef struct dfs_info_1 { + uint32 ptr_entrypath; + UNISTR2 entrypath; +} DFS_INFO_1; + +typedef struct dfs_info_2 { + uint32 ptr_entrypath; + UNISTR2 entrypath; + uint32 ptr_comment; + UNISTR2 comment; + uint32 state; + uint32 num_storages; +} DFS_INFO_2; + +typedef struct dfs_storage_info { + uint32 state; + uint32 ptr_servername; + UNISTR2 servername; + uint32 ptr_sharename; + UNISTR2 sharename; +} DFS_STORAGE_INFO; + +typedef struct dfs_info_3 { + uint32 ptr_entrypath; + UNISTR2 entrypath; + uint32 ptr_comment; + UNISTR2 comment; + uint32 state; + uint32 num_storages; + uint32 ptr_storages; + uint32 num_storage_infos; + DFS_STORAGE_INFO* storages; +} DFS_INFO_3; + +typedef struct dfs_info_ctr { + uint32 switch_value; + uint32 num_entries; + uint32 ptr_dfs_ctr; /* pointer to dfs info union */ + union { + DFS_INFO_1 *info1; + DFS_INFO_2 *info2; + DFS_INFO_3 *info3; + } dfs; +} DFS_INFO_CTR; + +typedef struct dfs_q_dfs_get_info { + UNISTR2 uni_path; - uint32 switch_value; - uint32 num_entries; - uint32 ptr_dfs_ctr; /* pointer to dfs info union */ - union - { - DFS_INFO_1 *info1; - DFS_INFO_2 *info2; - DFS_INFO_3 *info3; - } dfs; -} -DFS_INFO_CTR; - -typedef struct dfs_q_dfs_get_info -{ - UNISTR2 uni_path; - - uint32 ptr_server; - UNISTR2 uni_server; + uint32 ptr_server; + UNISTR2 uni_server; - uint32 ptr_share; - UNISTR2 uni_share; + uint32 ptr_share; + UNISTR2 uni_share; - uint32 level; -} -DFS_Q_DFS_GET_INFO; - -typedef struct dfs_r_dfs_get_info -{ - uint32 level; - uint32 ptr_ctr; - DFS_INFO_CTR ctr; - WERROR status; -} -DFS_R_DFS_GET_INFO; - -typedef struct dfs_q_dfs_enum -{ - uint32 level; - uint32 maxpreflen; - uint32 ptr_buffer; - uint32 level2; - uint32 ptr_num_entries; - uint32 num_entries; - uint32 ptr_num_entries2; - uint32 num_entries2; - ENUM_HND reshnd; -} -DFS_Q_DFS_ENUM; - -typedef struct dfs_r_dfs_enum -{ - DFS_INFO_CTR *ctr; - uint32 ptr_buffer; - uint32 level; - uint32 level2; - uint32 ptr_num_entries; - uint32 num_entries; - uint32 ptr_num_entries2; - uint32 num_entries2; - ENUM_HND reshnd; - WERROR status; -} -DFS_R_DFS_ENUM; - + uint32 level; +} DFS_Q_DFS_GET_INFO; + +typedef struct dfs_r_dfs_get_info { + uint32 level; + uint32 ptr_ctr; + DFS_INFO_CTR ctr; + WERROR status; +} DFS_R_DFS_GET_INFO; + +typedef struct dfs_q_dfs_enum { + uint32 level; + uint32 maxpreflen; + uint32 ptr_buffer; + uint32 level2; + uint32 ptr_num_entries; + uint32 num_entries; + uint32 ptr_num_entries2; + uint32 num_entries2; + ENUM_HND reshnd; +} DFS_Q_DFS_ENUM; + +typedef struct dfs_r_dfs_enum { + DFS_INFO_CTR *ctr; + uint32 ptr_buffer; + uint32 level; + uint32 level2; + uint32 ptr_num_entries; + uint32 num_entries; + uint32 ptr_num_entries2; + uint32 num_entries2; + ENUM_HND reshnd; + WERROR status; +} DFS_R_DFS_ENUM; #endif diff --git a/source3/include/rpc_ds.h b/source3/include/rpc_ds.h index e06918730a..24bf1e948a 100644 --- a/source3/include/rpc_ds.h +++ b/source3/include/rpc_ds.h @@ -21,9 +21,6 @@ #ifndef _RPC_DS_H /* _RPC_LSA_H */ #define _RPC_DS_H -#include "rpc_misc.h" - - /* Opcodes available on PIPE_LSARPC_DS */ #define DS_GETPRIMDOMINFO 0x00 diff --git a/source3/include/rpc_eventlog.h b/source3/include/rpc_eventlog.h index b692a76225..7ce1199b21 100644 --- a/source3/include/rpc_eventlog.h +++ b/source3/include/rpc_eventlog.h @@ -47,77 +47,74 @@ #define EVENTLOG_AUDIT_FAILURE 0x0010 -typedef struct eventlog_q_open_eventlog -{ - uint32 unknown1; +/***********************************/ + +typedef struct { + uint16 unknown1; uint16 unknown2; - uint16 unknown3; - uint16 sourcename_length; - uint16 sourcename_size; - uint32 sourcename_ptr; - UNISTR2 sourcename; - uint32 servername_ptr; - UNISTR2 servername; -} -EVENTLOG_Q_OPEN_EVENTLOG; - -typedef struct eventlog_r_open_eventlog -{ +} EVENTLOG_OPEN_UNKNOWN0; + +typedef struct { + EVENTLOG_OPEN_UNKNOWN0 *unknown0; + UNISTR4 logname; + UNISTR4 servername; + uint32 unknown1; + uint32 unknown2; +} EVENTLOG_Q_OPEN_EVENTLOG; + +typedef struct { POLICY_HND handle; WERROR status; -} -EVENTLOG_R_OPEN_EVENTLOG; +} EVENTLOG_R_OPEN_EVENTLOG; -typedef struct eventlog_q_close_eventlog -{ + +/***********************************/ + +typedef struct { POLICY_HND handle; -} -EVENTLOG_Q_CLOSE_EVENTLOG; +} EVENTLOG_Q_CLOSE_EVENTLOG; -typedef struct eventlog_r_close_eventlog -{ +typedef struct { POLICY_HND handle; WERROR status; -} -EVENTLOG_R_CLOSE_EVENTLOG; +} EVENTLOG_R_CLOSE_EVENTLOG; -typedef struct eventlog_q_get_num_records -{ + +/***********************************/ + +typedef struct { POLICY_HND handle; -} -EVENTLOG_Q_GET_NUM_RECORDS; +} EVENTLOG_Q_GET_NUM_RECORDS; -typedef struct eventlog_r_get_num_records -{ +typedef struct { uint32 num_records; WERROR status; -} -EVENTLOG_R_GET_NUM_RECORDS; +} EVENTLOG_R_GET_NUM_RECORDS; -typedef struct eventlog_q_get_oldest_entry -{ + +/***********************************/ + +typedef struct { POLICY_HND handle; -} -EVENTLOG_Q_GET_OLDEST_ENTRY; +} EVENTLOG_Q_GET_OLDEST_ENTRY; -typedef struct eventlog_r_get_oldest_entry -{ +typedef struct { uint32 oldest_entry; WERROR status; -} -EVENTLOG_R_GET_OLDEST_ENTRY; +} EVENTLOG_R_GET_OLDEST_ENTRY; + -typedef struct eventlog_q_read_eventlog +/***********************************/ + +typedef struct { POLICY_HND handle; uint32 flags; uint32 offset; uint32 max_read_size; -} -EVENTLOG_Q_READ_EVENTLOG; +} EVENTLOG_Q_READ_EVENTLOG; -typedef struct eventlog_record -{ +typedef struct { uint32 length; uint32 reserved1; uint32 record_number; @@ -136,8 +133,7 @@ typedef struct eventlog_record uint32 data_offset; } Eventlog_record; -typedef struct eventlog_data_record -{ +typedef struct { uint32 source_name_len; wpstring source_name; uint32 computer_name_len; @@ -151,8 +147,7 @@ typedef struct eventlog_data_record uint32 data_padding; } Eventlog_data_record; -typedef struct eventlog_entry -{ +typedef struct eventlog_entry { Eventlog_record record; Eventlog_data_record data_record; uint8 *data; @@ -160,8 +155,7 @@ typedef struct eventlog_entry struct eventlog_entry *next; } Eventlog_entry; -typedef struct eventlog_r_read_eventlog -{ +typedef struct { uint32 num_bytes_in_resp; uint32 bytes_in_next_record; uint32 num_records; @@ -170,24 +164,18 @@ typedef struct eventlog_r_read_eventlog uint32 sent_size; uint32 real_size; WERROR status; -} -EVENTLOG_R_READ_EVENTLOG; +} EVENTLOG_R_READ_EVENTLOG; -typedef struct eventlog_q_clear_eventlog -{ + +/***********************************/ + +typedef struct { POLICY_HND handle; - uint32 unknown1; - uint16 backup_file_length; - uint16 backup_file_size; - uint32 backup_file_ptr; - UNISTR2 backup_file; -} -EVENTLOG_Q_CLEAR_EVENTLOG; - -typedef struct eventlog_r_clear_eventlog -{ + UNISTR4 backupfile; +} EVENTLOG_Q_CLEAR_EVENTLOG; + +typedef struct { WERROR status; -} -EVENTLOG_R_CLEAR_EVENTLOG; +} EVENTLOG_R_CLEAR_EVENTLOG; #endif /* _RPC_EVENTLOG_H */ diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index 053a23b218..dd255c28d5 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -24,8 +24,6 @@ #ifndef _RPC_LSA_H /* _RPC_LSA_H */ #define _RPC_LSA_H -#include "rpc_misc.h" - /* Opcodes available on PIPE_LSARPC */ #if 0 /* UNIMPLEMENTED */ diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h index 9f35450d95..e5d91c1b63 100644 --- a/source3/include/rpc_misc.h +++ b/source3/include/rpc_misc.h @@ -21,9 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "ntdomain.h" -#include "rpc_dce.h" - #ifndef _RPC_MISC_H /* _RPC_MISC_H */ #define _RPC_MISC_H @@ -302,8 +299,7 @@ typedef struct { **********************************************************************/ /* DOM_CLNT_SRV - client / server names */ -typedef struct clnt_srv_info -{ +typedef struct clnt_srv_info { uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ UNISTR2 uni_logon_srv; /* logon server name */ uint32 undoc_buffer2; /* undocumented 32 bit buffer pointer */ @@ -311,8 +307,7 @@ typedef struct clnt_srv_info } DOM_CLNT_SRV; /* DOM_LOG_INFO - login info */ -typedef struct log_info -{ +typedef struct log_info { uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ UNISTR2 uni_logon_srv; /* logon server name */ UNISTR2 uni_acct_name; /* account name */ @@ -321,89 +316,44 @@ typedef struct log_info } DOM_LOG_INFO; /* DOM_CHAL - challenge info */ -typedef struct chal_info -{ +typedef struct chal_info { uchar data[8]; /* credentials */ } DOM_CHAL; /* DOM_CREDs - timestamped client or server credentials */ -typedef struct cred_info -{ +typedef struct cred_info { DOM_CHAL challenge; /* credentials */ UTIME timestamp; /* credential time-stamp */ } DOM_CRED; /* DOM_CLNT_INFO - client info */ -typedef struct clnt_info -{ +typedef struct clnt_info { DOM_LOG_INFO login; DOM_CRED cred; } DOM_CLNT_INFO; /* DOM_CLNT_INFO2 - client info */ -typedef struct clnt_info2 -{ +typedef struct clnt_info2 { DOM_CLNT_SRV login; uint32 ptr_cred; DOM_CRED cred; } DOM_CLNT_INFO2; /* DOM_LOGON_ID - logon id */ -typedef struct logon_info -{ +typedef struct logon_info { uint32 low; uint32 high; } DOM_LOGON_ID; /* OWF INFO */ -typedef struct owf_info -{ +typedef struct owf_info { uint8 data[16]; } OWF_INFO; - - - - -/* - * A client connection's state, pipe name, - * user credentials, etc... - */ -typedef struct _cli_auth_fns cli_auth_fns; -struct user_creds; -struct cli_connection { - - char *srv_name; - char *pipe_name; - struct user_creds usr_creds; - - struct cli_state *pCli_state; - - cli_auth_fns *auth; - - void *auth_info; - void *auth_creds; -}; - - -/* - * Associate a POLICY_HND with a cli_connection - */ -typedef struct rpc_hnd_node { - - POLICY_HND hnd; - struct cli_connection *cli; - -} RPC_HND_NODE; - typedef struct uint64_s { uint32 low; uint32 high; } UINT64_S; - - - - #endif /* _RPC_MISC_H */ diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h index b3fe16ba2b..b004e26397 100644 --- a/source3/include/rpc_netlogon.h +++ b/source3/include/rpc_netlogon.h @@ -84,11 +84,22 @@ #define NL_CTRL_REPL_IN_PROGRESS 0x0002 #define NL_CTRL_FULL_SYNC 0x0004 +#define LOGON_EXTRA_SIDS 0x0020 +#define LOGON_RESOURCE_GROUPS 0x0200 + +#define SE_GROUP_MANDATORY 0x00000001 +#define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002 +#define SE_GROUP_ENABLED 0x00000004 +#define SE_GROUP_OWNER 0x00000008 +#define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010 +#define SE_GROUP_LOGON_ID 0xC0000000 +#define SE_GROUP_RESOURCE 0x20000000 + + #if 0 /* I think this is correct - it's what gets parsed on the wire. JRA. */ /* NET_USER_INFO_2 */ -typedef struct net_user_info_2 -{ +typedef struct net_user_info_2 { uint32 ptr_user_info; NTTIME logon_time; /* logon time */ @@ -145,8 +156,7 @@ typedef struct net_user_info_2 #endif /* NET_USER_INFO_3 */ -typedef struct net_user_info_3 -{ +typedef struct net_user_info_3 { uint32 ptr_user_info; NTTIME logon_time; /* logon time */ @@ -186,6 +196,13 @@ typedef struct net_user_info_3 uint32 num_other_sids; /* number of foreign/trusted domain sids */ uint32 buffer_other_sids; + /* The next three uint32 are not really part of user_info_3 but here + * for parsing convenience. They are only valid in Kerberos PAC + * parsing - Guenther */ + uint32 ptr_res_group_dom_sid; + uint32 res_group_count; + uint32 ptr_res_groups; + UNISTR2 uni_user_name; /* username unicode string */ UNISTR2 uni_full_name; /* user's full name unicode string */ UNISTR2 uni_logon_script; /* logon script unicode string */ @@ -203,32 +220,26 @@ typedef struct net_user_info_3 DOM_SID2 *other_sids; /* foreign/trusted domain SIDs */ uint32 *other_sids_attrib; - } NET_USER_INFO_3; /* NETLOGON_INFO_1 - pdc status info, i presume */ -typedef struct netlogon_1_info -{ +typedef struct netlogon_1_info { uint32 flags; /* 0x0 - undocumented */ uint32 pdc_status; /* 0x0 - undocumented */ - } NETLOGON_INFO_1; /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */ -typedef struct netlogon_2_info -{ +typedef struct netlogon_2_info { uint32 flags; /* 0x0 - undocumented */ uint32 pdc_status; /* 0x0 - undocumented */ uint32 ptr_trusted_dc_name; /* pointer to trusted domain controller name */ uint32 tc_status; UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */ - } NETLOGON_INFO_2; /* NETLOGON_INFO_3 - logon status info, i presume */ -typedef struct netlogon_3_info -{ +typedef struct netlogon_3_info { uint32 flags; /* 0x0 - undocumented */ uint32 logon_attempts; /* number of logon attempts */ uint32 reserved_1; /* 0x0 - undocumented */ @@ -236,7 +247,6 @@ typedef struct netlogon_3_info uint32 reserved_3; /* 0x0 - undocumented */ uint32 reserved_4; /* 0x0 - undocumented */ uint32 reserved_5; /* 0x0 - undocumented */ - } NETLOGON_INFO_3; /******************************************************** @@ -250,8 +260,7 @@ typedef struct netlogon_3_info /* NET_Q_LOGON_CTRL - LSA Netr Logon Control */ -typedef struct net_q_logon_ctrl_info -{ +typedef struct net_q_logon_ctrl_info { uint32 ptr; UNISTR2 uni_server_name; uint32 function_code; @@ -260,8 +269,7 @@ typedef struct net_q_logon_ctrl_info /* NET_R_LOGON_CTRL - LSA Netr Logon Control */ -typedef struct net_r_logon_ctrl_info -{ +typedef struct net_r_logon_ctrl_info { uint32 switch_value; uint32 ptr; @@ -273,22 +281,18 @@ typedef struct net_r_logon_ctrl_info } NET_R_LOGON_CTRL; -typedef struct ctrl_data_info_5 -{ +typedef struct ctrl_data_info_5 { uint32 function_code; uint32 ptr_domain; UNISTR2 domain; - } CTRL_DATA_INFO_5; -typedef struct ctrl_data_info_6 -{ +typedef struct ctrl_data_info_6 { uint32 function_code; uint32 ptr_domain; UNISTR2 domain; - } CTRL_DATA_INFO_6; @@ -301,8 +305,7 @@ typedef struct ctrl_data_info_6 ********************************************************/ /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2 */ -typedef struct net_q_logon_ctrl2_info -{ +typedef struct net_q_logon_ctrl2_info { uint32 ptr; /* undocumented buffer pointer */ UNISTR2 uni_server_name; /* server name, starting with two '\'s */ @@ -312,7 +315,6 @@ typedef struct net_q_logon_ctrl2_info CTRL_DATA_INFO_5 info5; CTRL_DATA_INFO_6 info6; } info; - } NET_Q_LOGON_CTRL2; /******************************************************* @@ -322,8 +324,7 @@ typedef struct net_q_logon_ctrl2_info *******************************************************/ /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */ -typedef struct net_r_logon_ctrl2_info -{ +typedef struct net_r_logon_ctrl2_info { uint32 switch_value; /* 0x1, 0x3 */ uint32 ptr; @@ -336,13 +337,11 @@ typedef struct net_r_logon_ctrl2_info } logon; NTSTATUS status; /* return code */ - } NET_R_LOGON_CTRL2; /* NET_Q_GETDCNAME - Ask a DC for a trusted DC name */ -typedef struct net_q_getdcname -{ +typedef struct net_q_getdcname { uint32 ptr_logon_server; UNISTR2 uni_logon_server; uint32 ptr_domainname; @@ -351,103 +350,86 @@ typedef struct net_q_getdcname /* NET_R_GETDCNAME - Ask a DC for a trusted DC name */ -typedef struct net_r_getdcname -{ +typedef struct net_r_getdcname { uint32 ptr_dcname; UNISTR2 uni_dcname; NTSTATUS status; } NET_R_GETDCNAME; /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */ -typedef struct net_q_trust_dom_info -{ +typedef struct net_q_trust_dom_info { uint32 ptr; /* undocumented buffer pointer */ UNISTR2 uni_server_name; /* server name, starting with two '\'s */ - } NET_Q_TRUST_DOM_LIST; #define MAX_TRUST_DOMS 1 /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */ -typedef struct net_r_trust_dom_info -{ +typedef struct net_r_trust_dom_info { UNISTR2 uni_trust_dom_name[MAX_TRUST_DOMS]; NTSTATUS status; /* return code */ - } NET_R_TRUST_DOM_LIST; /* NEG_FLAGS */ -typedef struct neg_flags_info -{ - uint32 neg_flags; /* negotiated flags */ - +typedef struct neg_flags_info { + uint32 neg_flags; /* negotiated flags */ } NEG_FLAGS; /* NET_Q_REQ_CHAL */ -typedef struct net_q_req_chal_info -{ - uint32 undoc_buffer; /* undocumented buffer pointer */ - UNISTR2 uni_logon_srv; /* logon server unicode string */ - UNISTR2 uni_logon_clnt; /* logon client unicode string */ - DOM_CHAL clnt_chal; /* client challenge */ - +typedef struct net_q_req_chal_info { + uint32 undoc_buffer; /* undocumented buffer pointer */ + UNISTR2 uni_logon_srv; /* logon server unicode string */ + UNISTR2 uni_logon_clnt; /* logon client unicode string */ + DOM_CHAL clnt_chal; /* client challenge */ } NET_Q_REQ_CHAL; /* NET_R_REQ_CHAL */ -typedef struct net_r_req_chal_info -{ +typedef struct net_r_req_chal_info { DOM_CHAL srv_chal; /* server challenge */ NTSTATUS status; /* return code */ } NET_R_REQ_CHAL; /* NET_Q_AUTH */ -typedef struct net_q_auth_info -{ +typedef struct net_q_auth_info { DOM_LOG_INFO clnt_id; /* client identification info */ DOM_CHAL clnt_chal; /* client-calculated credentials */ } NET_Q_AUTH; /* NET_R_AUTH */ -typedef struct net_r_auth_info -{ +typedef struct net_r_auth_info { DOM_CHAL srv_chal; /* server-calculated credentials */ NTSTATUS status; /* return code */ } NET_R_AUTH; /* NET_Q_AUTH_2 */ -typedef struct net_q_auth2_info -{ - DOM_LOG_INFO clnt_id; /* client identification info */ - DOM_CHAL clnt_chal; /* client-calculated credentials */ - - NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */ +typedef struct net_q_auth2_info { + DOM_LOG_INFO clnt_id; /* client identification info */ + DOM_CHAL clnt_chal; /* client-calculated credentials */ + NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */ } NET_Q_AUTH_2; /* NET_R_AUTH_2 */ -typedef struct net_r_auth2_info -{ +typedef struct net_r_auth2_info { DOM_CHAL srv_chal; /* server-calculated credentials */ NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */ NTSTATUS status; /* return code */ } NET_R_AUTH_2; /* NET_Q_AUTH_3 */ -typedef struct net_q_auth3_info -{ - DOM_LOG_INFO clnt_id; /* client identification info */ - DOM_CHAL clnt_chal; /* client-calculated credentials */ - NEG_FLAGS clnt_flgs; /* usually 0x6007 ffff */ +typedef struct net_q_auth3_info { + DOM_LOG_INFO clnt_id; /* client identification info */ + DOM_CHAL clnt_chal; /* client-calculated credentials */ + NEG_FLAGS clnt_flgs; /* usually 0x6007 ffff */ } NET_Q_AUTH_3; /* NET_R_AUTH_3 */ -typedef struct net_r_auth3_info -{ +typedef struct net_r_auth3_info { DOM_CHAL srv_chal; /* server-calculated credentials */ NEG_FLAGS srv_flgs; /* usually 0x6007 ffff */ uint32 unknown; /* 0x0000045b */ @@ -456,25 +438,20 @@ typedef struct net_r_auth3_info /* NET_Q_SRV_PWSET */ -typedef struct net_q_srv_pwset_info -{ - DOM_CLNT_INFO clnt_id; /* client identification/authentication info */ - uint8 pwd[16]; /* new password - undocumented. */ - +typedef struct net_q_srv_pwset_info { + DOM_CLNT_INFO clnt_id; /* client identification/authentication info */ + uint8 pwd[16]; /* new password - undocumented. */ } NET_Q_SRV_PWSET; /* NET_R_SRV_PWSET */ -typedef struct net_r_srv_pwset_info -{ - DOM_CRED srv_cred; /* server-calculated credentials */ - - NTSTATUS status; /* return code */ +typedef struct net_r_srv_pwset_info { + DOM_CRED srv_cred; /* server-calculated credentials */ + NTSTATUS status; /* return code */ } NET_R_SRV_PWSET; /* NET_ID_INFO_2 */ -typedef struct net_network_info_2 -{ +typedef struct net_network_info_2 { uint32 ptr_id_info2; /* pointer to id_info_2 */ UNIHDR hdr_domain_name; /* domain name unicode header */ uint32 param_ctrl; /* param control (0x2) */ @@ -490,12 +467,10 @@ typedef struct net_network_info_2 UNISTR2 uni_wksta_name; /* workgroup name unicode string */ STRING2 nt_chal_resp; /* nt challenge response */ STRING2 lm_chal_resp; /* lm challenge response */ - } NET_ID_INFO_2; /* NET_ID_INFO_1 */ -typedef struct id_info_1 -{ +typedef struct id_info_1 { uint32 ptr_id_info1; /* pointer to id_info_1 */ UNIHDR hdr_domain_name; /* domain name unicode header */ uint32 param_ctrl; /* param control */ @@ -507,81 +482,64 @@ typedef struct id_info_1 UNISTR2 uni_domain_name; /* domain name unicode string */ UNISTR2 uni_user_name; /* user name unicode string */ UNISTR2 uni_wksta_name; /* workgroup name unicode string */ - } NET_ID_INFO_1; #define INTERACTIVE_LOGON_TYPE 1 #define NET_LOGON_TYPE 2 /* NET_ID_INFO_CTR */ -typedef struct net_id_info_ctr_info -{ - uint16 switch_value; - - union - { - NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */ - NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */ - - } auth; +typedef struct net_id_info_ctr_info { + uint16 switch_value; + union { + NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */ + NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */ + } auth; } NET_ID_INFO_CTR; /* SAM_INFO - sam logon/off id structure */ -typedef struct sam_info -{ - DOM_CLNT_INFO2 client; - uint32 ptr_rtn_cred; /* pointer to return credentials */ - DOM_CRED rtn_cred; /* return credentials */ - uint16 logon_level; - NET_ID_INFO_CTR *ctr; - +typedef struct sam_info { + DOM_CLNT_INFO2 client; + uint32 ptr_rtn_cred; /* pointer to return credentials */ + DOM_CRED rtn_cred; /* return credentials */ + uint16 logon_level; + NET_ID_INFO_CTR *ctr; } DOM_SAM_INFO; /* NET_Q_SAM_LOGON */ -typedef struct net_q_sam_logon_info -{ - DOM_SAM_INFO sam_id; +typedef struct net_q_sam_logon_info { + DOM_SAM_INFO sam_id; uint16 validation_level; - } NET_Q_SAM_LOGON; /* NET_R_SAM_LOGON */ -typedef struct net_r_sam_logon_info -{ - uint32 buffer_creds; /* undocumented buffer pointer */ - DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ +typedef struct net_r_sam_logon_info { + uint32 buffer_creds; /* undocumented buffer pointer */ + DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ uint16 switch_value; /* 3 - indicates type of USER INFO */ - NET_USER_INFO_3 *user; - - uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */ + NET_USER_INFO_3 *user; - NTSTATUS status; /* return code */ + uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */ + NTSTATUS status; /* return code */ } NET_R_SAM_LOGON; /* NET_Q_SAM_LOGOFF */ -typedef struct net_q_sam_logoff_info -{ - DOM_SAM_INFO sam_id; - +typedef struct net_q_sam_logoff_info { + DOM_SAM_INFO sam_id; } NET_Q_SAM_LOGOFF; /* NET_R_SAM_LOGOFF */ -typedef struct net_r_sam_logoff_info -{ - uint32 buffer_creds; /* undocumented buffer pointer */ - DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ - - NTSTATUS status; /* return code */ - +typedef struct net_r_sam_logoff_info { + uint32 buffer_creds; /* undocumented buffer pointer */ + DOM_CRED srv_creds; /* server credentials. server time stamp appears to be ignored. */ + NTSTATUS status; /* return code */ } NET_R_SAM_LOGOFF; /* NET_Q_SAM_SYNC */ -typedef struct net_q_sam_sync_info -{ +typedef struct net_q_sam_sync_info { UNISTR2 uni_srv_name; /* \\PDC */ UNISTR2 uni_cli_name; /* BDC */ DOM_CRED cli_creds; @@ -592,19 +550,16 @@ typedef struct net_q_sam_sync_info uint32 sync_context; uint32 max_size; /* preferred maximum length */ - } NET_Q_SAM_SYNC; /* SAM_DELTA_HDR */ -typedef struct sam_delta_hdr_info -{ +typedef struct sam_delta_hdr_info { uint16 type; /* type of structure attached */ uint16 type2; uint32 target_rid; uint32 type3; uint32 ptr_delta; - } SAM_DELTA_HDR; /* LOCKOUT_STRING */ @@ -617,7 +572,6 @@ typedef struct account_lockout_string { UINT64_S reset_count; uint32 bad_attempt_lockout; uint32 dummy; - } LOCKOUT_STRING; /* HDR_LOCKOUT_STRING */ @@ -625,12 +579,10 @@ typedef struct hdr_account_lockout_string { uint16 size; uint16 length; uint32 buffer; - } HDR_LOCKOUT_STRING; /* SAM_DOMAIN_INFO (0x1) */ -typedef struct sam_domain_info_info -{ +typedef struct sam_domain_info_info { UNIHDR hdr_dom_name; UNIHDR hdr_oem_info; @@ -666,13 +618,10 @@ typedef struct sam_domain_info_info uint32 unknown6; uint32 unknown7; uint32 unknown8; - - } SAM_DOMAIN_INFO; /* SAM_GROUP_INFO (0x2) */ -typedef struct sam_group_info_info -{ +typedef struct sam_group_info_info { UNIHDR hdr_grp_name; DOM_GID gid; UNIHDR hdr_grp_desc; @@ -682,12 +631,10 @@ typedef struct sam_group_info_info UNISTR2 uni_grp_name; UNISTR2 uni_grp_desc; RPC_DATA_BLOB buf_sec_desc; - } SAM_GROUP_INFO; /* SAM_PWD */ -typedef struct sam_passwd_info -{ +typedef struct sam_passwd_info { /* this structure probably contains password history */ /* this is probably a count of lm/nt pairs */ uint32 unk_0; /* 0x0000 0002 */ @@ -700,12 +647,10 @@ typedef struct sam_passwd_info UNIHDR hdr_empty_lm; UNIHDR hdr_empty_nt; - } SAM_PWD; /* SAM_ACCOUNT_INFO (0x5) */ -typedef struct sam_account_info_info -{ +typedef struct sam_account_info_info { UNIHDR hdr_acct_name; UNIHDR hdr_full_name; @@ -765,12 +710,10 @@ typedef struct sam_account_info_info SAM_PWD pass; RPC_DATA_BLOB buf_sec_desc; UNISTR2 uni_profile; - } SAM_ACCOUNT_INFO; /* SAM_GROUP_MEM_INFO (0x8) */ -typedef struct sam_group_mem_info_info -{ +typedef struct sam_group_mem_info_info { uint32 ptr_rids; uint32 ptr_attribs; uint32 num_members; @@ -785,8 +728,7 @@ typedef struct sam_group_mem_info_info } SAM_GROUP_MEM_INFO; /* SAM_ALIAS_INFO (0x9) */ -typedef struct sam_alias_info_info -{ +typedef struct sam_alias_info_info { UNIHDR hdr_als_name; uint32 als_rid; BUFHDR2 hdr_sec_desc; /* security descriptor */ @@ -796,12 +738,10 @@ typedef struct sam_alias_info_info UNISTR2 uni_als_name; RPC_DATA_BLOB buf_sec_desc; UNISTR2 uni_als_desc; - } SAM_ALIAS_INFO; /* SAM_ALIAS_MEM_INFO (0xC) */ -typedef struct sam_alias_mem_info_info -{ +typedef struct sam_alias_mem_info_info { uint32 num_members; uint32 ptr_members; uint8 unknown[16]; @@ -809,13 +749,11 @@ typedef struct sam_alias_mem_info_info uint32 num_sids; uint32 *ptr_sids; DOM_SID2 *sids; - } SAM_ALIAS_MEM_INFO; /* SAM_DELTA_POLICY (0x0D) */ -typedef struct -{ +typedef struct { uint32 max_log_size; /* 0x5000 */ UINT64_S audit_retention_period; /* 0 */ uint32 auditing_mode; /* 0 */ @@ -844,8 +782,7 @@ typedef struct } SAM_DELTA_POLICY; /* SAM_DELTA_TRUST_DOMS */ -typedef struct -{ +typedef struct { uint32 buf_size; SEC_DESC *sec_desc; DOM_SID2 sid; @@ -860,12 +797,10 @@ typedef struct uint32 unknown3; UNISTR2 domain; - } SAM_DELTA_TRUSTDOMS; /* SAM_DELTA_PRIVS (0x10) */ -typedef struct -{ +typedef struct { DOM_SID2 sid; uint32 priv_count; @@ -896,8 +831,7 @@ typedef struct } SAM_DELTA_PRIVS; /* SAM_DELTA_SECRET */ -typedef struct -{ +typedef struct { uint32 buf_size; SEC_DESC *sec_desc; UNISTR2 secret; @@ -928,19 +862,16 @@ typedef struct uint32 buf_size3; SEC_DESC *sec_desc2; - } SAM_DELTA_SECRET; /* SAM_DELTA_MOD_COUNT (0x16) */ -typedef struct -{ +typedef struct { uint32 seqnum; uint32 dom_mod_count_ptr; UINT64_S dom_mod_count; /* domain mod count at last sync */ } SAM_DELTA_MOD_COUNT; -typedef union sam_delta_ctr_info -{ +typedef union sam_delta_ctr_info { SAM_DOMAIN_INFO domain_info ; SAM_GROUP_INFO group_info ; SAM_ACCOUNT_INFO account_info; @@ -955,8 +886,7 @@ typedef union sam_delta_ctr_info } SAM_DELTA_CTR; /* NET_R_SAM_SYNC */ -typedef struct net_r_sam_sync_info -{ +typedef struct net_r_sam_sync_info { DOM_CRED srv_creds; uint32 sync_context; @@ -973,8 +903,7 @@ typedef struct net_r_sam_sync_info } NET_R_SAM_SYNC; /* NET_Q_SAM_DELTAS */ -typedef struct net_q_sam_deltas_info -{ +typedef struct net_q_sam_deltas_info { UNISTR2 uni_srv_name; UNISTR2 uni_cli_name; DOM_CRED cli_creds; @@ -984,12 +913,10 @@ typedef struct net_q_sam_deltas_info UINT64_S dom_mod_count; /* domain mod count at last sync */ uint32 max_size; /* preferred maximum length */ - } NET_Q_SAM_DELTAS; /* NET_R_SAM_DELTAS */ -typedef struct net_r_sam_deltas_info -{ +typedef struct net_r_sam_deltas_info { DOM_CRED srv_creds; UINT64_S dom_mod_count; /* new domain mod count */ diff --git a/source3/include/rpc_ntsvcs.h b/source3/include/rpc_ntsvcs.h new file mode 100644 index 0000000000..947794bba1 --- /dev/null +++ b/source3/include/rpc_ntsvcs.h @@ -0,0 +1,147 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Gerald (Jerry) Carter 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _RPC_NTSVCS_H /* _RPC_NTSVCS_H */ +#define _RPC_NTSVCS_H + +/* ntsvcs pipe */ + +#define NTSVCS_GET_VERSION 0x02 +#define NTSVCS_VALIDATE_DEVICE_INSTANCE 0x06 +#define NTSVCS_GET_ROOT_DEVICE_INSTANCE 0x07 +#define NTSVCS_GET_DEVICE_LIST 0x0a +#define NTSVCS_GET_DEVICE_LIST_SIZE 0x0b +#define NTSVCS_GET_DEVICE_REG_PROPERTY 0x0d +#define NTSVCS_HW_PROFILE_FLAGS 0x28 +#define NTSVCS_GET_HW_PROFILE_INFO 0x29 +#define NTSVCS_GET_VERSION_INTERNAL 0x3e + + +/**************************/ + +typedef struct { + /* nothing in the request */ + uint32 dummy; +} NTSVCS_Q_GET_VERSION; + +typedef struct { + uint32 version; + WERROR status; +} NTSVCS_R_GET_VERSION; + + +/**************************/ + +typedef struct { + UNISTR2 *devicename; + uint32 flags; +} NTSVCS_Q_GET_DEVICE_LIST_SIZE; + +typedef struct { + uint32 size; + WERROR status; +} NTSVCS_R_GET_DEVICE_LIST_SIZE; + + +/**************************/ + +typedef struct { + UNISTR2 *devicename; + uint32 buffer_size; + uint32 flags; +} NTSVCS_Q_GET_DEVICE_LIST; + +typedef struct { + UNISTR2 devicepath; + uint32 needed; + WERROR status; +} NTSVCS_R_GET_DEVICE_LIST; + +/**************************/ + +typedef struct { + UNISTR2 devicepath; + uint32 flags; +} NTSVCS_Q_VALIDATE_DEVICE_INSTANCE; + +typedef struct { + WERROR status; +} NTSVCS_R_VALIDATE_DEVICE_INSTANCE; + +/**************************/ + +#define DEV_REGPROP_DESC 1 + +typedef struct { + UNISTR2 devicepath; + uint32 property; + uint32 unknown2; + uint32 buffer_size1; + uint32 buffer_size2; + uint32 unknown5; +} NTSVCS_Q_GET_DEVICE_REG_PROPERTY; + +typedef struct { + uint32 unknown1; + REGVAL_BUFFER value; + uint32 size; + uint32 needed; + WERROR status; +} NTSVCS_R_GET_DEVICE_REG_PROPERTY; + + +/**************************/ + +typedef struct { + uint32 index; + uint8 *buffer; + uint32 buffer_size; + uint32 unknown1; +} NTSVCS_Q_GET_HW_PROFILE_INFO; + +typedef struct { + uint32 buffer_size; /* the size (not included in the reply) + if just matched from the request */ + uint8 *buffer; + WERROR status; +} NTSVCS_R_GET_HW_PROFILE_INFO; + + +/**************************/ + +typedef struct { + uint32 unknown1; + UNISTR2 devicepath; + uint32 unknown2; + uint32 unknown3; + uint32 unknown4; + uint32 unknown5; + uint32 unknown6; + uint32 unknown7; +} NTSVCS_Q_HW_PROFILE_FLAGS; + +typedef struct { + uint32 unknown1; + uint32 unknown2; + uint32 unknown3; + WERROR status; +} NTSVCS_R_HW_PROFILE_FLAGS; + +#endif /* _RPC_NTSVCS_H */ diff --git a/source3/include/rpc_perfcount.h b/source3/include/rpc_perfcount.h new file mode 100644 index 0000000000..0e3a6eb018 --- /dev/null +++ b/source3/include/rpc_perfcount.h @@ -0,0 +1,106 @@ +#ifndef _RPC_PERFCOUNT_H +#define _RPC_PERFCOUNT_H + +typedef struct perf_counter_definition +{ + /* sizeof(PERF_COUNTER_DEFINITION) */ + uint32 ByteLength; + uint32 CounterNameTitleIndex; + uint32 CounterNameTitlePointer; + uint32 CounterHelpTitleIndex; + uint32 CounterHelpTitlePointer; + uint32 DefaultScale; + uint32 DetailLevel; + uint32 CounterType; + uint32 CounterSize; + uint32 CounterOffset; +} +PERF_COUNTER_DEFINITION; + +typedef struct perf_counter_block +{ + /* Total size of the data block, including all data plus this header */ + uint32 ByteLength; + uint8 *data; +} +PERF_COUNTER_BLOCK; + +typedef struct perf_instance_definition +{ + /* Total size of the instance definition, including the length of the terminated Name string */ + uint32 ByteLength; + uint32 ParentObjectTitleIndex; + uint32 ParentObjectTitlePointer; + uint32 UniqueID; + /* From the start of the PERF_INSTANCE_DEFINITION, the byte offset to the start of the Name string */ + uint32 NameOffset; + uint32 NameLength; + /* Unicode string containing the name for the instance */ + uint8 *data; + PERF_COUNTER_BLOCK counter_data; +} +PERF_INSTANCE_DEFINITION; + +typedef struct perf_object_type +{ + /* Total size of the object block, including all PERF_INSTANCE_DEFINITIONs, + PERF_COUNTER_DEFINITIONs and PERF_COUNTER_BLOCKs in bytes */ + uint32 TotalByteLength; + /* Size of this PERF_OBJECT_TYPE plus all PERF_COUNTER_DEFINITIONs in bytes */ + uint32 DefinitionLength; + /* Size of this PERF_OBJECT_TYPE */ + uint32 HeaderLength; + uint32 ObjectNameTitleIndex; + uint32 ObjectNameTitlePointer; + uint32 ObjectHelpTitleIndex; + uint32 ObjectHelpTitlePointer; + uint32 DetailLevel; + uint32 NumCounters; + uint32 DefaultCounter; + uint32 NumInstances; + uint32 CodePage; + UINT64_S PerfTime; + UINT64_S PerfFreq; + PERF_COUNTER_DEFINITION *counters; + PERF_INSTANCE_DEFINITION *instances; + PERF_COUNTER_BLOCK counter_data; +} +PERF_OBJECT_TYPE; + +/* PerfCounter Inner Buffer structs */ +typedef struct perf_data_block +{ + /* hardcoded to read "P.E.R.F" */ + uint16 Signature[4]; + uint32 LittleEndian; + /* both currently hardcoded to 1 */ + uint32 Version; + uint32 Revision; + /* bytes of PERF_OBJECT_TYPE data, does NOT include the PERF_DATA_BLOCK */ + uint32 TotalByteLength; + /* size of PERF_DATA_BLOCK including the uint8 *data */ + uint32 HeaderLength; + /* number of PERF_OBJECT_TYPE structures encoded */ + uint32 NumObjectTypes; + uint32 DefaultObject; + SYSTEMTIME SystemTime; + /* This will guarantee that we're on a 64-bit boundary before we encode + PerfTime, and having it there will make my offset math much easier. */ + uint32 Padding; + /* Now when I'm marshalling this, I'll need to call prs_align_uint64() + before I start encodint the UINT64_S structs */ + /* clock rate * seconds uptime */ + UINT64_S PerfTime; + /* The clock rate of the CPU */ + UINT64_S PerfFreq; + /* used for high-res timers -- for now PerfTime * 10e7 */ + UINT64_S PerfTime100nSec; + uint32 SystemNameLength; + uint32 SystemNameOffset; + /* The SystemName, in unicode, terminated */ + uint8* data; + PERF_OBJECT_TYPE *objects; +} +PERF_DATA_BLOCK; + +#endif /* _RPC_PERFCOUNT_H */ diff --git a/source3/include/rpc_perfcount_defs.h b/source3/include/rpc_perfcount_defs.h new file mode 100644 index 0000000000..3999a6864d --- /dev/null +++ b/source3/include/rpc_perfcount_defs.h @@ -0,0 +1,73 @@ +#ifndef _RPC_PERFCOUNT_DEFS_H +#define _RPC_PERFCOUNT_DEFS_H + +/* + * The following #defines match what is in winperf.h. + * See that include file for more details, or look up + * "Performance Data Format" on MSDN + * + * Rather than including them in rpc_perfcount.h, they + * were broken out into a separate .h file so that they + * can be included by other programs that need this info + * without pulling in everything else samba-related. + */ + +#define PERF_NO_INSTANCES -1 +#define PERF_NO_UNIQUE_ID -1 + +/* These determine the data size */ +#define PERF_SIZE_DWORD 0x00000000 +#define PERF_SIZE_LARGE 0x00000100 +#define PERF_SIZE_ZERO 0x00000200 +#define PERF_SIZE_VARIABLE_LEN 0x00000300 + +/* These determine the usage of the counter */ +#define PERF_TYPE_NUMBER 0x00000000 +#define PERF_TYPE_COUNTER 0x00000400 +#define PERF_TYPE_TEXT 0x00000800 +#define PERF_TYPE_ZERO 0x00000C00 + +/* If PERF_TYPE_NUMBER was selected, these provide display information */ +#define PERF_NUMBER_HEX 0x00000000 +#define PERF_NUMBER_DECIMAL 0x00010000 +#define PERF_NUMBER_DEC_1000 0x00020000 + +/* If PERF_TYPE_COUNTER was selected, these provide display information */ +#define PERF_COUNTER_VALUE 0x00000000 +#define PERF_COUNTER_RATE 0x00010000 +#define PERF_COUNTER_FRACTION 0x00020000 +#define PERF_COUNTER_BASE 0x00030000 +#define PERF_COUNTER_ELAPSED 0x00040000 +#define PERF_COUNTER_QUEUELEN 0x00050000 +#define PERF_COUNTER_HISTOGRAM 0x00060000 +#define PERF_COUNTER_PRECISION 0x00070000 + +/* If PERF_TYPE_TEXT was selected, these provide display information */ +#define PERF_TEXT_UNICODE 0x00000000 +#define PERF_TEXT_ASCII 0x00010000 + +/* These provide information for which tick count to use when computing elapsed interval */ +#define PERF_TIMER_TICK 0x00000000 +#define PERF_TIMER_100NS 0x00100000 +#define PERF_OBJECT_TIMER 0x00200000 + +/* These affect how the data is manipulated prior to being displayed */ +#define PERF_DELTA_COUNTER 0x00400000 +#define PERF_DELTA_BASE 0x00800000 +#define PERF_INVERSE_COUNTER 0x01000000 +#define PERF_MULTI_COUNTER 0x02000000 + +/* These determine if any text gets added when the value is displayed */ +#define PERF_DISPLAY_NO_SUFFIX 0x00000000 +#define PERF_DISPLAY_PER_SEC 0x10000000 +#define PERF_DISPLAY_PERCENT 0x20000000 +#define PERF_DISPLAY_SECONDS 0x30000000 +#define PERF_DISPLAY_NOSHOW 0x40000000 + +/* These determine the DetailLevel of the counter */ +#define PERF_DETAIL_NOVICE 100 +#define PERF_DETAIL_ADVANCED 200 +#define PERF_DETAIL_EXPERT 300 +#define PERF_DETAIL_WIZARD 400 + +#endif /* _RPC_PERFCOUNT_DEFS_H */ diff --git a/source3/include/rpc_reg.h b/source3/include/rpc_reg.h index f6ddf5b9ad..b24b640237 100644 --- a/source3/include/rpc_reg.h +++ b/source3/include/rpc_reg.h @@ -25,8 +25,6 @@ #ifndef _RPC_REG_H /* _RPC_REG_H */ #define _RPC_REG_H -#include "reg_objects.h" - /* RPC opnum */ #define REG_OPEN_HKCR 0x00 @@ -50,6 +48,7 @@ #define REG_SET_VALUE 0x16 #define REG_SHUTDOWN 0x18 #define REG_ABORT_SHUTDOWN 0x19 +#define REG_OPEN_HKPT 0x20 #define REG_GETVERSION 0x1a #define REG_SHUTDOWN_EX 0x1e @@ -63,6 +62,9 @@ #define KEY_HKLM "HKLM" #define KEY_HKU "HKU" #define KEY_HKCR "HKCR" +#define KEY_HKPD "HKPD" +#define KEY_HKPT "HKPT" +#define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services" #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports" @@ -85,6 +87,16 @@ #define REG_FULL_RESOURCE_DESCRIPTOR 9 #define REG_RESOURCE_REQUIREMENTS_LIST 10 +/* + * Registry key types + * Most keys are going to be GENERIC -- may need a better name? + * HKPD and HKPT are used by reg_perfcount.c + * they are special keys that congtain performance data + */ +#define REG_KEY_GENERIC 0 +#define REG_KEY_HKPD 1 +#define REG_KEY_HKPT 2 + /* * container for function pointers to enumeration routines * for vitural registry view @@ -108,9 +120,8 @@ typedef struct { /* structure to store the registry handles */ typedef struct _RegistryKey { - struct _RegistryKey *prev, *next; - - pstring name; /* full name of registry key */ + uint32 type; + char *name; /* full name of registry key */ uint32 access_granted; REGISTRY_HOOK *hook; } REGISTRY_KEY; diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index fb829558d4..6067587654 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -26,8 +26,6 @@ #ifndef _RPC_SAMR_H /* _RPC_SAMR_H */ #define _RPC_SAMR_H -#include "rpc_misc.h" - /******************************************************************* the following information comes from a QuickView on samsrv.dll, and gives an idea of exactly what is needed: diff --git a/source3/include/rpc_secdes.h b/source3/include/rpc_secdes.h index b2b97e391e..c385e41fd3 100644 --- a/source3/include/rpc_secdes.h +++ b/source3/include/rpc_secdes.h @@ -481,13 +481,16 @@ typedef struct standard_mapping { SC_RIGHT_MGR_ENUMERATE_SERVICE | \ SC_RIGHT_MGR_QUERY_LOCK_STATUS ) -#define SC_MANAGER_ALL_ACCESS \ +#define SC_MANAGER_EXECUTE_ACCESS SC_MANAGER_READ_ACCESS + +#define SC_MANAGER_WRITE_ACCESS \ ( STANDARD_RIGHTS_REQUIRED_ACCESS | \ SC_MANAGER_READ_ACCESS | \ SC_RIGHT_MGR_CREATE_SERVICE | \ SC_RIGHT_MGR_LOCK | \ SC_RIGHT_MGR_MODIFY_BOOT_CONFIG ) +#define SC_MANAGER_ALL_ACCESS SC_MANAGER_WRITE_ACCESS /* Service Object Bits */ @@ -515,12 +518,14 @@ typedef struct standard_mapping { SC_RIGHT_SVC_STOP | \ SC_RIGHT_SVC_PAUSE_CONTINUE ) -#define SERVICE_ALL_ACCESS \ +#define SERVICE_WRITE_ACCESS \ ( STANDARD_RIGHTS_REQUIRED_ACCESS | \ SERVICE_READ_ACCESS | \ SERVICE_EXECUTE_ACCESS | \ SC_RIGHT_SVC_CHANGE_CONFIG ) +#define SERVICE_ALL_ACCESS SERVICE_WRITE_ACCESS + /* diff --git a/source3/include/rpc_svcctl.h b/source3/include/rpc_svcctl.h index 77dd004fed..443a6588a6 100644 --- a/source3/include/rpc_svcctl.h +++ b/source3/include/rpc_svcctl.h @@ -22,12 +22,15 @@ #ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */ #define _RPC_SVCCTL_H - /* svcctl pipe */ #define SVCCTL_CLOSE_SERVICE 0x00 #define SVCCTL_CONTROL_SERVICE 0x01 +#define SVCCTL_LOCK_SERVICE_DB 0x03 +#define SVCCTL_QUERY_SERVICE_SEC 0x04 /* not impmenented */ +#define SVCCTL_SET_SEVICE_SEC 0x05 /* not implemented */ #define SVCCTL_QUERY_STATUS 0x06 +#define SVCCTL_UNLOCK_SERVICE_DB 0x08 #define SVCCTL_ENUM_DEPENDENT_SERVICES_W 0x0d #define SVCCTL_ENUM_SERVICES_STATUS_W 0x0e #define SVCCTL_OPEN_SCMANAGER_W 0x0f @@ -105,14 +108,17 @@ #define SVCCTL_CONTROL_STOP 0x00000001 #define SVCCTL_CONTROL_PAUSE 0x00000002 #define SVCCTL_CONTROL_CONTINUE 0x00000003 -#define SVCCTL_CONTROL_SHUTDOWN 0x00000004 +#define SVCCTL_CONTROL_INTERROGATE 0x00000004 +#define SVCCTL_CONTROL_SHUTDOWN 0x00000005 #define SVC_HANDLE_IS_SCM 0x0000001 #define SVC_HANDLE_IS_SERVICE 0x0000002 +#define SVC_HANDLE_IS_DBLOCK 0x0000003 -#define SVC_STATUS_PROCESS_INFO 0x00000001 +#define SVC_STATUS_PROCESS_INFO 0x00000000 -#define SVCCTL_SCRIPT_DIR "/svcctl/" +/* where we assume the location of the service control scripts */ +#define SVCCTL_SCRIPT_DIR "svcctl" /* utility structures for RPCs */ @@ -127,13 +133,7 @@ typedef struct { } SERVICE_STATUS; typedef struct { - uint32 type; - uint32 state; - uint32 controls_accepted; - uint32 win32_exit_code; - uint32 service_exit_code; - uint32 check_point; - uint32 wait_hint; + SERVICE_STATUS status; uint32 process_id; uint32 service_flags; } SERVICE_STATUS_PROCESS; @@ -158,7 +158,8 @@ typedef struct { } SERVICE_CONFIG; typedef struct { - UNISTR2 *description; + uint32 unknown; + UNISTR description; } SERVICE_DESCRIPTION; typedef struct { @@ -168,20 +169,12 @@ typedef struct { typedef struct { uint32 reset_period; - UNISTR2 *rebootmsg; + UNISTR2 *rebootmsg; /* i have no idea if these are UNISTR2's. I can't get a good trace */ UNISTR2 *command; - uint32 nActions; - SC_ACTION *saActions; - UNISTR2 *description; + uint32 num_actions; + SC_ACTION *actions; } SERVICE_FAILURE_ACTIONS; - -typedef struct SCM_info_struct { - uint32 type; /* should be SVC_HANDLE_IS_SCM */ - pstring target_server_name; /* name of the server on which the operation is taking place */ - pstring target_db_name; /* name of the database that we're opening */ -} SCM_info; - typedef struct Service_info_struct { uint32 type; /* should be SVC_HANDLE_IS_SERVICE */ pstring servicename; /* the name of the service */ @@ -205,9 +198,9 @@ typedef struct Service_info_struct { typedef struct { /* functions for enumerating subkeys and values */ - WERROR (*stop_service)( SERVICE_STATUS *status ); - WERROR (*start_service) ( void ); - WERROR (*service_status)( SERVICE_STATUS *status ); + WERROR (*stop_service)( const char *service, SERVICE_STATUS *status ); + WERROR (*start_service) ( const char *service ); + WERROR (*service_status)( const char *service, SERVICE_STATUS *status ); } SERVICE_CONTROL_OPS; /* structure to store the service handle information */ @@ -341,6 +334,7 @@ typedef struct { WERROR status; } SVCCTL_R_ENUM_DEPENDENT_SERVICES; + /**************************/ typedef struct { @@ -354,32 +348,58 @@ typedef struct { WERROR status; } SVCCTL_R_QUERY_SERVICE_CONFIG; + +/**************************/ + typedef struct { POLICY_HND handle; - uint32 info_level; + uint32 level; uint32 buffer_size; } SVCCTL_Q_QUERY_SERVICE_CONFIG2; typedef struct { - UNISTR2 *description; - uint32 returned; + RPC_BUFFER buffer; uint32 needed; - uint32 offset; WERROR status; } SVCCTL_R_QUERY_SERVICE_CONFIG2; + +/**************************/ + typedef struct { POLICY_HND handle; - uint32 info_level; + uint32 level; uint32 buffer_size; } SVCCTL_Q_QUERY_SERVICE_STATUSEX; typedef struct { RPC_BUFFER buffer; - uint32 returned; uint32 needed; WERROR status; } SVCCTL_R_QUERY_SERVICE_STATUSEX; + +/**************************/ + +typedef struct { + POLICY_HND handle; +} SVCCTL_Q_LOCK_SERVICE_DB; + +typedef struct { + POLICY_HND h_lock; + WERROR status; +} SVCCTL_R_LOCK_SERVICE_DB; + + +/**************************/ + +typedef struct { + POLICY_HND h_lock; +} SVCCTL_Q_UNLOCK_SERVICE_DB; + +typedef struct { + WERROR status; +} SVCCTL_R_UNLOCK_SERVICE_DB; + #endif /* _RPC_SVCCTL_H */ diff --git a/source3/include/smb.h b/source3/include/smb.h index c0778383c6..61d2237b2d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -206,13 +206,13 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN]; #define PI_SHUTDOWN 10 #define PI_SVCCTL 11 #define PI_EVENTLOG 12 -#define PI_MAX_PIPES 13 +#define PI_NTSVCS 13 +#define PI_MAX_PIPES 14 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ -typedef struct nttime_info -{ - uint32 low; - uint32 high; +typedef struct nttime_info { + uint32 low; + uint32 high; } NTTIME; @@ -414,6 +414,10 @@ struct fd_handle { */ }; +struct timed_event; +struct idle_event; +struct share_mode_entry; + typedef struct files_struct { struct files_struct *next, *prev; int fnum; @@ -437,6 +441,11 @@ typedef struct files_struct { time_t last_write_time; int oplock_type; int sent_oplock_break; + struct timed_event *oplock_timeout; + + struct share_mode_entry *pending_break_messages; + int num_pending_break_messages; + unsigned long file_id; BOOL can_lock; BOOL can_read; @@ -564,6 +573,7 @@ struct current_user #define NO_BREAK_SENT 0 #define BREAK_TO_NONE_SENT 1 #define LEVEL_II_BREAK_SENT 2 +#define ASYNC_LEVEL_II_BREAK_SENT 3 typedef struct { fstring smb_name; /* user name from the client */ @@ -619,28 +629,19 @@ struct interface struct in_addr nmask; }; -/* struct used by share mode violation error processing */ -typedef struct { - pid_t pid; - uint16 mid; - struct timeval time; - SMB_DEV_T dev; - SMB_INO_T inode; - uint16 port; -} deferred_open_entry; - /* Internal message queue for deferred opens. */ struct pending_message_list { struct pending_message_list *next, *prev; - struct timeval msg_time; /* The timeout time */ + struct timeval request_time; /* When was this first issued? */ + struct timeval end_time; /* When does this time out? */ DATA_BLOB buf; DATA_BLOB private_data; }; /* struct returned by get_share_modes */ -typedef struct { - pid_t pid; - uint16 op_port; +struct share_mode_entry { + struct process_id pid; + uint16 op_mid; uint16 op_type; uint32 access_mask; /* NTCreateX access bits (FILE_READ_DATA etc.) */ uint32 share_access; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */ @@ -652,14 +653,18 @@ typedef struct { SMB_DEV_T dev; SMB_INO_T inode; unsigned long share_file_id; -} share_mode_entry; - - -#define SHAREMODE_FN_CAST() \ - void (*)(share_mode_entry *, char*) +}; -#define SHAREMODE_FN(fn) \ - void (*fn)(share_mode_entry *, char*) +struct share_mode_lock { + const char *filename; + SMB_DEV_T dev; + SMB_INO_T ino; + int num_share_modes; + struct share_mode_entry *share_modes; + BOOL delete_on_close; + BOOL fresh; + BOOL modified; +}; #define NT_HASH_LEN 16 #define LM_HASH_LEN 16 @@ -700,14 +705,14 @@ typedef struct { /* key and data in the connections database - used in smbstatus and smbd */ struct connections_key { - pid_t pid; + struct process_id pid; int cnum; fstring name; }; struct connections_data { int magic; - pid_t pid; + struct process_id pid; int cnum; uid_t uid; gid_t gid; @@ -719,12 +724,6 @@ struct connections_data { }; -/* key and data records in the tdb locking database */ -struct locking_key { - SMB_DEV_T dev; - SMB_INO_T inode; -}; - /* the following are used by loadparm for option lists */ typedef enum { P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST, @@ -744,11 +743,11 @@ struct enum_list { }; #define BRLOCK_FN_CAST() \ - void (*)(SMB_DEV_T dev, SMB_INO_T ino, int pid, \ + void (*)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \ enum brl_type lock_type, \ br_off start, br_off size) #define BRLOCK_FN(fn) \ - void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, int pid, \ + void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \ enum brl_type lock_type, \ br_off start, br_off size) struct parm_struct @@ -1462,10 +1461,29 @@ extern int chain_size; #define BATCH_OPLOCK 2 #define LEVEL_II_OPLOCK 4 #define INTERNAL_OPEN_ONLY 8 +#define FAKE_LEVEL_II_OPLOCK 16 /* Client requested no_oplock, but we have to + * inform potential level2 holders on + * write. */ +#define DEFERRED_OPEN_ENTRY 32 +#define UNUSED_SHARE_MODE_ENTRY 64 #define EXCLUSIVE_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)EXCLUSIVE_OPLOCK|(unsigned int)BATCH_OPLOCK)) #define BATCH_OPLOCK_TYPE(lck) ((lck) & (unsigned int)BATCH_OPLOCK) -#define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & (unsigned int)LEVEL_II_OPLOCK) +#define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)LEVEL_II_OPLOCK|(unsigned int)FAKE_LEVEL_II_OPLOCK)) + +struct inform_level2_message { + SMB_DEV_T dev; + SMB_INO_T inode; + uint16 mid; + unsigned long target_file_id; + unsigned long source_file_id; +}; + +struct kernel_oplock_message { + SMB_DEV_T dev; + SMB_INO_T inode; + unsigned long file_id; +}; /* * On the wire return values for oplock types. @@ -1484,94 +1502,22 @@ extern int chain_size; #define OPLOCKLEVEL_II 1 /* - * Loopback command offsets. - */ - -#define OPBRK_CMD_LEN_OFFSET 0 -#define OPBRK_CMD_PORT_OFFSET 4 -#define OPBRK_CMD_HEADER_LEN 6 - -#define OPBRK_MESSAGE_CMD_OFFSET 0 - -/* - * Oplock break command code to send over the udp socket. - * The same message is sent for both exlusive and level II breaks. - * - * The form of this is : - * - * 0 2 2+pid 2+pid+dev 2+pid+dev+ino - * +----+--------+-------+--------+---------+ - * | cmd| pid | dev | inode | fileid | - * +----+--------+-------+--------+---------+ - */ - -#define OPLOCK_BREAK_PID_OFFSET 2 -#define OPLOCK_BREAK_DEV_OFFSET (OPLOCK_BREAK_PID_OFFSET + sizeof(pid_t)) -#define OPLOCK_BREAK_INODE_OFFSET (OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T)) -#define OPLOCK_BREAK_FILEID_OFFSET (OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T)) -#define OPLOCK_BREAK_MSG_LEN (OPLOCK_BREAK_FILEID_OFFSET + sizeof(unsigned long)) - -/* Message types */ -#define OPLOCK_BREAK_CMD 0x1 -#define KERNEL_OPLOCK_BREAK_CMD 0x2 -#define LEVEL_II_OPLOCK_BREAK_CMD 0x3 -#define ASYNC_LEVEL_II_OPLOCK_BREAK_CMD 0x4 - -/* Add the "deferred open" message. */ -#define RETRY_DEFERRED_OPEN_CMD 0x5 - -/* - * And the message format for it. Keep the same message length. - * - * 0 2 2+pid 2+pid+dev 2+pid+dev+ino - * +----+--------+-------+--------+---------+ - * | cmd| pid | dev | inode | mid | - * +----+--------+-------+--------+---------+ - */ - -#define DEFERRED_OPEN_CMD_OFFSET 0 -#define DEFERRED_OPEN_PID_OFFSET 2 /* pid we're *sending* from. */ -#define DEFERRED_OPEN_DEV_OFFSET (DEFERRED_OPEN_PID_OFFSET + sizeof(pid_t)) -#define DEFERRED_OPEN_INODE_OFFSET (DEFERRED_OPEN_DEV_OFFSET + sizeof(SMB_DEV_T)) -#define DEFERRED_OPEN_MID_OFFSET (DEFERRED_OPEN_INODE_OFFSET + sizeof(SMB_INO_T)) -#define DEFERRED_OPEN_MSG_LEN OPLOCK_BREAK_MSG_LEN - -/* * Capabilities abstracted for different systems. */ #define KERNEL_OPLOCK_CAPABILITY 0x1 -/* - * Oplock break command code sent via the kernel interface (if it exists). - * - * Form of this is : - * - * 0 2 2+devsize 2+devsize+inodesize - * +----+--------+--------+----------+ - * | cmd| dev | inode | fileid | - * +----+--------+--------+----------+ - */ -#define KERNEL_OPLOCK_BREAK_DEV_OFFSET 2 -#define KERNEL_OPLOCK_BREAK_INODE_OFFSET (KERNEL_OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T)) -#define KERNEL_OPLOCK_BREAK_FILEID_OFFSET (KERNEL_OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T)) -#define KERNEL_OPLOCK_BREAK_MSG_LEN (KERNEL_OPLOCK_BREAK_FILEID_OFFSET + sizeof(unsigned long)) - - /* if a kernel does support oplocks then a structure of the following typee is used to describe how to interact with the kernel */ struct kernel_oplocks { - BOOL (*receive_message)(fd_set *fds, char *buffer, int buffer_len); + files_struct * (*receive_message)(fd_set *fds); BOOL (*set_oplock)(files_struct *fsp, int oplock_type); void (*release_oplock)(files_struct *fsp); - BOOL (*parse_message)(char *msg_start, int msg_len, SMB_INO_T *inode, SMB_DEV_T *dev, unsigned long *file_id); BOOL (*msg_waiting)(fd_set *fds); int notification_fd; }; -#define CMD_REPLY 0x8000 - /* this structure defines the functions for doing change notify in various implementations */ struct cnotify_fns { @@ -1759,4 +1705,18 @@ struct ea_list { /* EA to use for DOS attributes */ #define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" +struct uuid { + uint32 time_low; + uint16 time_mid; + uint16 time_hi_and_version; + uint8 clock_seq[2]; + uint8 node[6]; +}; +#define UUID_SIZE 16 + +#define UUID_FLAT_SIZE 16 +typedef struct uuid_flat { + uint8 info[UUID_FLAT_SIZE]; +} UUID_FLAT; + #endif /* _SMB_H */ diff --git a/source3/include/smb_ldap.h b/source3/include/smb_ldap.h new file mode 100644 index 0000000000..144317cc1e --- /dev/null +++ b/source3/include/smb_ldap.h @@ -0,0 +1,256 @@ +/* + Unix SMB/CIFS Implementation. + LDAP protocol helper functions for SAMBA + Copyright (C) Volker Lendecke 2004 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef _SMB_LDAP_H +#define _SMB_LDAP_H + +enum ldap_request_tag { + LDAP_TAG_BindRequest = 0, + LDAP_TAG_BindResponse = 1, + LDAP_TAG_UnbindRequest = 2, + LDAP_TAG_SearchRequest = 3, + LDAP_TAG_SearchResultEntry = 4, + LDAP_TAG_SearchResultDone = 5, + LDAP_TAG_ModifyRequest = 6, + LDAP_TAG_ModifyResponse = 7, + LDAP_TAG_AddRequest = 8, + LDAP_TAG_AddResponse = 9, + LDAP_TAG_DelRequest = 10, + LDAP_TAG_DelResponse = 11, + LDAP_TAG_ModifyDNRequest = 12, + LDAP_TAG_ModifyDNResponse = 13, + LDAP_TAG_CompareRequest = 14, + LDAP_TAG_CompareResponse = 15, + LDAP_TAG_AbandonRequest = 16, + LDAP_TAG_SearchResultReference = 19, + LDAP_TAG_ExtendedRequest = 23, + LDAP_TAG_ExtendedResponse = 24 +}; + +enum ldap_auth_mechanism { + LDAP_AUTH_MECH_SIMPLE = 0, + LDAP_AUTH_MECH_SASL = 3 +}; + +#ifndef LDAP_SUCCESS +enum ldap_result_code { + LDAP_SUCCESS = 0, + LDAP_SASL_BIND_IN_PROGRESS = 0x0e, + LDAP_INVALID_CREDENTIALS = 0x31, + LDAP_OTHER = 0x50 +}; +#endif /* LDAP_SUCCESS */ + +struct ldap_Result { + int resultcode; + const char *dn; + const char *errormessage; + const char *referral; +}; + +struct ldap_attribute { + const char *name; + int num_values; + DATA_BLOB *values; +}; + +struct ldap_BindRequest { + int version; + const char *dn; + enum ldap_auth_mechanism mechanism; + union { + const char *password; + struct { + const char *mechanism; + DATA_BLOB secblob; + } SASL; + } creds; +}; + +struct ldap_BindResponse { + struct ldap_Result response; + union { + DATA_BLOB secblob; + } SASL; +}; + +struct ldap_UnbindRequest { + uint8 __dummy; +}; + +enum ldap_scope { + LDAP_SEARCH_SCOPE_BASE = 0, + LDAP_SEARCH_SCOPE_SINGLE = 1, + LDAP_SEARCH_SCOPE_SUB = 2 +}; + +enum ldap_deref { + LDAP_DEREFERENCE_NEVER = 0, + LDAP_DEREFERENCE_IN_SEARCHING = 1, + LDAP_DEREFERENCE_FINDING_BASE = 2, + LDAP_DEREFERENCE_ALWAYS +}; + +struct ldap_SearchRequest { + const char *basedn; + enum ldap_scope scope; + enum ldap_deref deref; + uint32 timelimit; + uint32 sizelimit; + BOOL attributesonly; + char *filter; + int num_attributes; + const char **attributes; +}; + +struct ldap_SearchResEntry { + const char *dn; + int num_attributes; + struct ldap_attribute *attributes; +}; + +struct ldap_SearchResRef { + int num_referrals; + const char **referrals; +}; + +enum ldap_modify_type { + LDAP_MODIFY_NONE = -1, + LDAP_MODIFY_ADD = 0, + LDAP_MODIFY_DELETE = 1, + LDAP_MODIFY_REPLACE = 2 +}; + +struct ldap_mod { + enum ldap_modify_type type; + struct ldap_attribute attrib; +}; + +struct ldap_ModifyRequest { + const char *dn; + int num_mods; + struct ldap_mod *mods; +}; + +struct ldap_AddRequest { + const char *dn; + int num_attributes; + struct ldap_attribute *attributes; +}; + +struct ldap_DelRequest { + const char *dn; +}; + +struct ldap_ModifyDNRequest { + const char *dn; + const char *newrdn; + BOOL deleteolddn; + const char *newsuperior; +}; + +struct ldap_CompareRequest { + const char *dn; + const char *attribute; + const char *value; +}; + +struct ldap_AbandonRequest { + uint32 messageid; +}; + +struct ldap_ExtendedRequest { + const char *oid; + DATA_BLOB value; +}; + +struct ldap_ExtendedResponse { + struct ldap_Result response; + const char *name; + DATA_BLOB value; +}; + +union ldap_Request { + struct ldap_BindRequest BindRequest; + struct ldap_BindResponse BindResponse; + struct ldap_UnbindRequest UnbindRequest; + struct ldap_SearchRequest SearchRequest; + struct ldap_SearchResEntry SearchResultEntry; + struct ldap_Result SearchResultDone; + struct ldap_SearchResRef SearchResultReference; + struct ldap_ModifyRequest ModifyRequest; + struct ldap_Result ModifyResponse; + struct ldap_AddRequest AddRequest; + struct ldap_Result AddResponse; + struct ldap_DelRequest DelRequest; + struct ldap_Result DelResponse; + struct ldap_ModifyDNRequest ModifyDNRequest; + struct ldap_Result ModifyDNResponse; + struct ldap_CompareRequest CompareRequest; + struct ldap_Result CompareResponse; + struct ldap_AbandonRequest AbandonRequest; + struct ldap_ExtendedRequest ExtendedRequest; + struct ldap_ExtendedResponse ExtendedResponse; +}; + +struct ldap_Control { + const char *oid; + BOOL critical; + DATA_BLOB value; +}; + +struct ldap_message { + TALLOC_CTX *mem_ctx; + uint32 messageid; + uint8 type; + union ldap_Request r; + int num_controls; + struct ldap_Control *controls; +}; + +struct ldap_queue_entry { + struct ldap_queue_entry *next, *prev; + int msgid; + struct ldap_message *msg; +}; + +struct ldap_connection { + TALLOC_CTX *mem_ctx; + int sock; + int next_msgid; + char *host; + uint16 port; + BOOL ldaps; + + const char *auth_dn; + const char *simple_pw; + + /* Current outstanding search entry */ + int searchid; + + /* List for incoming search entries */ + struct ldap_queue_entry *search_entries; + + /* Outstanding LDAP requests that have not yet been replied to */ + struct ldap_queue_entry *outstanding; +}; + +#endif diff --git a/source3/include/smb_share_modes.h b/source3/include/smb_share_modes.h index f61ba624c6..1e04ea496d 100644 --- a/source3/include/smb_share_modes.h +++ b/source3/include/smb_share_modes.h @@ -55,7 +55,7 @@ struct smb_share_mode_entry { uint32_t access_mask; struct timeval open_time; uint32_t file_id; - pid_t pid; + struct process_id pid; }; /* diff --git a/source3/include/smbldap.h b/source3/include/smbldap.h index df56f60bf3..bea1a6d84a 100644 --- a/source3/include/smbldap.h +++ b/source3/include/smbldap.h @@ -1,5 +1,5 @@ /* - Unix SMB/CIFS implementation. + Unix SMB/CIFS mplementation. LDAP protocol helper functions for SAMBA Copyright (C) Gerald Carter 2001-2003 @@ -40,6 +40,7 @@ struct smbldap_state; #define LDAP_OBJ_IDPOOL "sambaUnixIdPool" #define LDAP_OBJ_IDMAP_ENTRY "sambaIdmapEntry" #define LDAP_OBJ_SID_ENTRY "sambaSidEntry" +#define LDAP_OBJ_TRUST_PASSWORD "sambaTrustPassword" #define LDAP_OBJ_ACCOUNT "account" #define LDAP_OBJ_POSIXACCOUNT "posixAccount" @@ -95,10 +96,12 @@ struct smbldap_state; #define LDAP_ATTR_LOGON_COUNT 36 #define LDAP_ATTR_MUNGED_DIAL 37 #define LDAP_ATTR_BAD_PASSWORD_TIME 38 -#define LDAP_ATTR_PWD_HISTORY 39 +#define LDAP_ATTR_PWD_HISTORY 39 #define LDAP_ATTR_SID_LIST 40 -#define LDAP_ATTR_MOD_TIMESTAMP 41 -#define LDAP_ATTR_LOGON_HOURS 42 +#define LDAP_ATTR_MOD_TIMESTAMP 41 +#define LDAP_ATTR_LOGON_HOURS 42 +#define LDAP_ATTR_TRUST_PASSWD_FLAGS 43 + typedef struct _attrib_map_entry { int attrib; @@ -117,6 +120,8 @@ extern ATTRIB_MAP_ENTRY groupmap_attr_list[]; extern ATTRIB_MAP_ENTRY groupmap_attr_list_to_delete[]; extern ATTRIB_MAP_ENTRY idpool_attr_list[]; extern ATTRIB_MAP_ENTRY sidmap_attr_list[]; +extern ATTRIB_MAP_ENTRY trustpw_attr_list[]; + /* Function declarations -- not included in proto.h so we don't have to worry about LDAP structure types */ diff --git a/source3/include/spnego.h b/source3/include/spnego.h index 8bb13bd354..66abe31705 100644 --- a/source3/include/spnego.h +++ b/source3/include/spnego.h @@ -43,7 +43,7 @@ typedef enum _spnego_negResult { } negResult_t; typedef struct spnego_negTokenInit { - char **mechTypes; + const char **mechTypes; int reqFlags; DATA_BLOB mechToken; DATA_BLOB mechListMIC; diff --git a/source3/include/srvstr.h b/source3/include/srvstr.h index 04db59cf01..1029df53ae 100644 --- a/source3/include/srvstr.h +++ b/source3/include/srvstr.h @@ -18,8 +18,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "includes.h" - #define srvstr_pull(base_ptr, dest, src, dest_len, src_len, flags) \ pull_string(base_ptr, dest, src, dest_len, src_len, flags) |